update credits
[LibreOffice.git] / configure.ac
bloba20e0be6c688baf0cb2c21b99bc4e8de8865a694
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([LibreOffice],[6.2.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
85         if test "$fp_count_space" != "0"; then
86             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
87         fi
88     fi
91 AbsolutePath()
93     # There appears to be no simple and portable method to get an absolute and
94     # canonical path, so we try creating the directory if does not exist and
95     # utilizing the shell and pwd.
96     rel="$1"
97     absolute_path=""
98     test ! -e "$rel" && mkdir -p "$rel"
99     if test -d "$rel" ; then
100         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
101         absolute_path="$(pwd)"
102         cd - > /dev/null
103     else
104         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
105     fi
108 rm -f warn
109 have_WARNINGS="no"
110 add_warning()
112     if test "$have_WARNINGS" = "no"; then
113         echo "*************************************" > warn
114         have_WARNINGS="yes"
115         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
116             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
117             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
118         else
119             COLORWARN="* WARNING :"
120         fi
121     fi
122     echo "$COLORWARN $@" >> warn
125 dnl Some Mac User have the bad habbit of letting a lot fo crap
126 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
127 dnl that confuse the build.
128 dnl For the ones that use LODE, let's be nice and protect them
129 dnl from themselves
131 mac_sanitize_path()
133     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
134 dnl a common but nevertheless necessary thing that may be in a fancy
135 dnl path location is git, so make sure we have it
136     mac_git_path=`which git 2>/dev/null`
137     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
138         mac_path="$mac_path:`dirname $mac_git_path`"
139     fi
140 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
141 dnl path location is gpg, so make sure we find it
142     mac_gpg_path=`which gpg 2>/dev/null`
143     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
144         mac_path="$mac_path:`dirname $mac_gpg_path`"
145     fi
146     PATH="$mac_path"
147     unset mac_path
148     unset mac_git_path
149     unset mac_gpg_path
152 echo "********************************************************************"
153 echo "*"
154 echo "*   Running ${PACKAGE_NAME} build configuration."
155 echo "*"
156 echo "********************************************************************"
157 echo ""
159 dnl ===================================================================
160 dnl checks build and host OSes
161 dnl do this before argument processing to allow for platform dependent defaults
162 dnl ===================================================================
163 AC_CANONICAL_HOST
165 AC_MSG_CHECKING([for product name])
166 PRODUCTNAME="AC_PACKAGE_NAME"
167 if test -n "$with_product_name" -a "$with_product_name" != no; then
168     PRODUCTNAME="$with_product_name"
170 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
171     PRODUCTNAME="${PRODUCTNAME}Dev"
173 AC_MSG_RESULT([$PRODUCTNAME])
174 AC_SUBST(PRODUCTNAME)
175 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
176 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
178 dnl ===================================================================
179 dnl Our version is defined by the AC_INIT() at the top of this script.
180 dnl ===================================================================
182 AC_MSG_CHECKING([for package version])
183 if test -n "$with_package_version" -a "$with_package_version" != no; then
184     PACKAGE_VERSION="$with_package_version"
186 AC_MSG_RESULT([$PACKAGE_VERSION])
188 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
190 LIBO_VERSION_MAJOR=$1
191 LIBO_VERSION_MINOR=$2
192 LIBO_VERSION_MICRO=$3
193 LIBO_VERSION_PATCH=$4
195 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
196 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
197 # no way to encode that into an integer in general.
198 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
200 LIBO_VERSION_SUFFIX=$5
201 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
202 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
203 # they get undoubled before actually passed to sed.
204 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
205 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
206 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
207 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
209 AC_SUBST(LIBO_VERSION_MAJOR)
210 AC_SUBST(LIBO_VERSION_MINOR)
211 AC_SUBST(LIBO_VERSION_MICRO)
212 AC_SUBST(LIBO_VERSION_PATCH)
213 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
214 AC_SUBST(LIBO_VERSION_SUFFIX)
215 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
217 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
218 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
219 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
220 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
222 LIBO_THIS_YEAR=`date +%Y`
223 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
225 dnl ===================================================================
226 dnl Product version
227 dnl ===================================================================
228 AC_MSG_CHECKING([for product version])
229 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
230 AC_MSG_RESULT([$PRODUCTVERSION])
231 AC_SUBST(PRODUCTVERSION)
233 AC_PROG_EGREP
234 # AC_PROG_EGREP doesn't set GREP on all systems as well
235 AC_PATH_PROG(GREP, grep)
237 BUILDDIR=`pwd`
238 cd $srcdir
239 SRC_ROOT=`pwd`
240 cd $BUILDDIR
241 x_Cygwin=[\#]
243 dnl ======================================
244 dnl Required GObject introspection version
245 dnl ======================================
246 INTROSPECTION_REQUIRED_VERSION=1.32.0
248 dnl ===================================================================
249 dnl Search all the common names for GNU Make
250 dnl ===================================================================
251 AC_MSG_CHECKING([for GNU Make])
253 # try to use our own make if it is available and GNUMAKE was not already defined
254 if test -z "$GNUMAKE"; then
255     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
256         GNUMAKE="$LODE_HOME/opt/bin/make"
257     elif test -x "/opt/lo/bin/make"; then
258         GNUMAKE="/opt/lo/bin/make"
259     fi
262 GNUMAKE_WIN_NATIVE=
263 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
264     if test -n "$a"; then
265         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
266         if test $? -eq 0;  then
267             if test "$build_os" = "cygwin"; then
268                 if test -n "$($a -v | grep 'Built for Windows')" ; then
269                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
270                     GNUMAKE_WIN_NATIVE="TRUE"
271                 else
272                     GNUMAKE=`which $a`
273                 fi
274             else
275                 GNUMAKE=`which $a`
276             fi
277             break
278         fi
279     fi
280 done
281 AC_MSG_RESULT($GNUMAKE)
282 if test -z "$GNUMAKE"; then
283     AC_MSG_ERROR([not found. install GNU Make.])
284 else
285     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
286         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
287     fi
290 win_short_path_for_make()
292     local_short_path="$1"
293     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
294         cygpath -sm "$local_short_path"
295     else
296         cygpath -u "$(cygpath -d "$local_short_path")"
297     fi
301 if test "$build_os" = "cygwin"; then
302     PathFormat "$SRC_ROOT"
303     SRC_ROOT="$formatted_path"
304     PathFormat "$BUILDDIR"
305     BUILDDIR="$formatted_path"
306     x_Cygwin=
307     AC_MSG_CHECKING(for explicit COMSPEC)
308     if test -z "$COMSPEC"; then
309         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
310     else
311         AC_MSG_RESULT([found: $COMSPEC])
312     fi
315 AC_SUBST(SRC_ROOT)
316 AC_SUBST(BUILDDIR)
317 AC_SUBST(x_Cygwin)
318 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
319 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
321 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
322     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
325 # need sed in os checks...
326 AC_PATH_PROGS(SED, sed)
327 if test -z "$SED"; then
328     AC_MSG_ERROR([install sed to run this script])
331 # Set the ENABLE_LTO variable
332 # ===================================================================
333 AC_MSG_CHECKING([whether to use link-time optimization])
334 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
335     ENABLE_LTO="TRUE"
336     AC_MSG_RESULT([yes])
337     AC_DEFINE(STATIC_LINKING)
338 else
339     ENABLE_LTO=""
340     AC_MSG_RESULT([no])
342 AC_SUBST(ENABLE_LTO)
344 AC_ARG_ENABLE(fuzz-options,
345     AS_HELP_STRING([--enable-fuzz-options],
346         [Randomly enable or disable each of those configurable options
347          that are supposed to be freely selectable without interdependencies,
348          or where bad interaction from interdependencies is automatically avoided.])
351 dnl ===================================================================
352 dnl When building for Android, --with-android-ndk,
353 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
354 dnl mandatory
355 dnl ===================================================================
357 AC_ARG_WITH(android-ndk,
358     AS_HELP_STRING([--with-android-ndk],
359         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
362 AC_ARG_WITH(android-ndk-toolchain-version,
363     AS_HELP_STRING([--with-android-ndk-toolchain-version],
364         [Specify which toolchain version to use, of those present in the
365         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
366         with_android_ndk_toolchain_version=clang5.0)
368 AC_ARG_WITH(android-sdk,
369     AS_HELP_STRING([--with-android-sdk],
370         [Specify location of the Android SDK. Mandatory when building for Android.]),
373 ANDROID_NDK_HOME=
374 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
375     with_android_ndk="$SRC_ROOT/external/android-ndk"
377 if test -n "$with_android_ndk"; then
378     ANDROID_NDK_HOME=$with_android_ndk
380     # Set up a lot of pre-canned defaults
382     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
383         if test ! -f $ANDROID_NDK_HOME/source.properties; then
384             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
385         fi
386         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
387     else
388         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
389     fi
390     if test -z "$ANDROID_NDK_VERSION";  then
391         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
392     fi
393     case $ANDROID_NDK_VERSION in
394     r9*|r10*)
395         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
396         ;;
397     11.1.*|12.1.*|13.1.*|14.1.*)
398         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
399         ;;
400     16.*)
401         ;;
402     *)
403         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
404         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
405         ;;
406     esac
408     ANDROID_API_LEVEL=14
409     android_cpu=$host_cpu
410     ANDROID_ARCH=$android_cpu
411     if test $host_cpu = arm; then
412         android_platform_prefix=$android_cpu-linux-androideabi
413         android_gnu_prefix=$android_platform_prefix
414         LLVM_TRIPLE=armv7-none-linux-androideabi
415         ANDROID_APP_ABI=armeabi-v7a
416         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
417     elif test $host_cpu = aarch64; then
418         android_platform_prefix=$android_cpu-linux-android
419         android_gnu_prefix=$android_platform_prefix
420         LLVM_TRIPLE=aarch64-none-linux-android
421         # minimum android version that supports aarch64
422         ANDROID_API_LEVEL=21
423         ANDROID_APP_ABI=arm64-v8a
424         ANDROID_ARCH=arm64
425     elif test $host_cpu = mips; then
426         android_platform_prefix=mipsel-linux-android
427         android_gnu_prefix=$android_platform_prefix
428         LLVM_TRIPLE=mipsel-none-linux-android
429         ANDROID_APP_ABI=mips
430     else
431         # host_cpu is something like "i386" or "i686" I guess, NDK uses
432         # "x86" in some contexts
433         android_cpu=x86
434         android_platform_prefix=$android_cpu
435         android_gnu_prefix=i686-linux-android
436         LLVM_TRIPLE=i686-none-linux-android
437         ANDROID_APP_ABI=x86
438         ANDROID_ARCH=$android_cpu
439         ANDROIDCFLAGS="-march=atom"
440     fi
442     case "$with_android_ndk_toolchain_version" in
443     clang5.0)
444         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
445         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
446         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
447         ;;
448     *)
449         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
450     esac
452     if test ! -d $ANDROID_BINUTILS_DIR; then
453         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
454     elif test ! -d $ANDROID_COMPILER_DIR; then
455         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
456     fi
458     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
459     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
460     # manage to link the (app-specific) single huge .so that is built for the app in
461     # android/source/ if there is debug information in a significant part of the object files.
462     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
463     # all objects have been built with debug information.)
464     case $build_os in
465     linux-gnu*)
466         ndk_build_os=linux
467         ;;
468     darwin*)
469         ndk_build_os=darwin
470         ;;
471     *)
472         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
473         ;;
474     esac
475     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
476     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
477     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
479     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
480     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
481     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
482     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
483     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
484     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
487     # android is using different sysroots for compilation and linking, but as
488     # there is no full separation in configure and elsewhere, use isystem for
489     # compilation stuff and sysroot for linking
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
491     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
492     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
493     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
494     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
495     else
496     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
497     fi
498     if test "$ENABLE_LTO" = TRUE; then
499         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
500         # $CC and $CXX when building external libraries
501         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
502     fi
504     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
505     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI/include -std=c++11"
506     else
507     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
508     fi
510     if test -z "$CC"; then
511         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
512     fi
513     if test -z "$CXX"; then
514         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
515     fi
517     # remember to download the ownCloud Android library later
518     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
520 AC_SUBST(ANDROID_NDK_HOME)
521 AC_SUBST(ANDROID_APP_ABI)
522 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
524 dnl ===================================================================
525 dnl --with-android-sdk
526 dnl ===================================================================
527 ANDROID_SDK_HOME=
528 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
529     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
531 if test -n "$with_android_sdk"; then
532     ANDROID_SDK_HOME=$with_android_sdk
533     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
535 AC_SUBST(ANDROID_SDK_HOME)
537 dnl ===================================================================
538 dnl The following is a list of supported systems.
539 dnl Sequential to keep the logic very simple
540 dnl These values may be checked and reset later.
541 dnl ===================================================================
542 #defaults unless the os test overrides this:
543 test_randr=yes
544 test_xrender=yes
545 test_cups=yes
546 test_dbus=yes
547 test_fontconfig=yes
548 test_cairo=no
550 # Default values, as such probably valid just for Linux, set
551 # differently below just for Mac OSX,but at least better than
552 # hardcoding these as we used to do. Much of this is duplicated also
553 # in solenv for old build system and for gbuild, ideally we should
554 # perhaps define stuff like this only here in configure.ac?
556 LINKFLAGSSHL="-shared"
557 PICSWITCH="-fpic"
558 DLLPOST=".so"
560 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
562 INSTROOTBASESUFFIX=
563 INSTROOTCONTENTSUFFIX=
564 SDKDIRNAME=sdk
566 case "$host_os" in
568 solaris*)
569     test_gtk=yes
570     build_gstreamer_1_0=yes
571     build_gstreamer_0_10=yes
572     test_freetype=yes
573     _os=SunOS
575     dnl ===========================================================
576     dnl Check whether we're using Solaris 10 - SPARC or Intel.
577     dnl ===========================================================
578     AC_MSG_CHECKING([the Solaris operating system release])
579     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
580     if test "$_os_release" -lt "10"; then
581         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
582     else
583         AC_MSG_RESULT([ok ($_os_release)])
584     fi
586     dnl Check whether we're using a SPARC or i386 processor
587     AC_MSG_CHECKING([the processor type])
588     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
589         AC_MSG_RESULT([ok ($host_cpu)])
590     else
591         AC_MSG_ERROR([only SPARC and i386 processors are supported])
592     fi
593     ;;
595 linux-gnu*|k*bsd*-gnu*)
596     test_gtk=yes
597     build_gstreamer_1_0=yes
598     build_gstreamer_0_10=yes
599     test_kde4=yes
600     test_kde5=yes
601     test_gtk3_kde5=yes
602     if test "$enable_fuzzers" != yes; then
603         test_freetype=yes
604         test_fontconfig=yes
605     else
606         test_freetype=no
607         test_fontconfig=no
608         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
609     fi
610     _os=Linux
611     ;;
613 gnu)
614     test_randr=no
615     test_xrender=no
616     _os=GNU
617      ;;
619 cygwin*|interix*)
621     # When building on Windows normally with MSVC under Cygwin,
622     # configure thinks that the host platform (the platform the
623     # built code will run on) is Cygwin, even if it obviously is
624     # Windows, which in Autoconf terminology is called
625     # "mingw32". (Which is misleading as MinGW is the name of the
626     # tool-chain, not an operating system.)
628     # Somewhat confusing, yes. But this configure script doesn't
629     # look at $host etc that much, it mostly uses its own $_os
630     # variable, set here in this case statement.
632     test_cups=no
633     test_dbus=no
634     test_randr=no
635     test_xrender=no
636     test_freetype=no
637     test_fontconfig=no
638     _os=WINNT
640     DLLPOST=".dll"
641     LINKFLAGSNOUNDEFS=
642     ;;
644 darwin*) # Mac OS X or iOS
645     test_gtk=yes
646     test_randr=no
647     test_xrender=no
648     test_freetype=no
649     test_fontconfig=no
650     test_dbus=no
651     if test -n "$LODE_HOME" ; then
652         mac_sanitize_path
653         AC_MSG_NOTICE([sanitized the PATH to $PATH])
654     fi
655     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
656         build_for_ios=YES
657         _os=iOS
658         test_gtk=no
659         test_cups=no
660         enable_mpl_subset=yes
661         enable_lotuswordpro=no
662         enable_coinmp=no
663         enable_lpsolve=no
664         enable_postgresql_sdbc=no
665         enable_extension_integration=no
666         enable_report_builder=no
667         with_theme="tango"
668         with_ppds=no
669         if test "$enable_ios_simulator" = "yes"; then
670             host=x86_64-apple-darwin
671         fi
672     else
673         _os=Darwin
674         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
675         INSTROOTCONTENTSUFFIX=/Contents
676         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
677     fi
678     # See comment above the case "$host_os"
679     LINKFLAGSSHL="-dynamiclib -single_module"
681     # -fPIC is default
682     PICSWITCH=""
684     DLLPOST=".dylib"
686     # -undefined error is the default
687     LINKFLAGSNOUNDEFS=""
690 freebsd*)
691     test_gtk=yes
692     build_gstreamer_1_0=yes
693     build_gstreamer_0_10=yes
694     test_kde4=yes
695     test_kde5=yes
696     test_gtk3_kde5=yes
697     test_freetype=yes
698     AC_MSG_CHECKING([the FreeBSD operating system release])
699     if test -n "$with_os_version"; then
700         OSVERSION="$with_os_version"
701     else
702         OSVERSION=`/sbin/sysctl -n kern.osreldate`
703     fi
704     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
705     AC_MSG_CHECKING([which thread library to use])
706     if test "$OSVERSION" -lt "500016"; then
707         PTHREAD_CFLAGS="-D_THREAD_SAFE"
708         PTHREAD_LIBS="-pthread"
709     elif test "$OSVERSION" -lt "502102"; then
710         PTHREAD_CFLAGS="-D_THREAD_SAFE"
711         PTHREAD_LIBS="-lc_r"
712     else
713         PTHREAD_CFLAGS=""
714         PTHREAD_LIBS="-pthread"
715     fi
716     AC_MSG_RESULT([$PTHREAD_LIBS])
717     _os=FreeBSD
718     ;;
720 *netbsd*)
721     test_gtk=yes
722     build_gstreamer_1_0=yes
723     build_gstreamer_0_10=yes
724     test_kde4=yes
725     test_kde5=yes
726     test_gtk3_kde5=yes
727     test_freetype=yes
728     PTHREAD_LIBS="-pthread -lpthread"
729     _os=NetBSD
730     ;;
732 aix*)
733     test_randr=no
734     test_freetype=yes
735     PTHREAD_LIBS=-pthread
736     _os=AIX
737     ;;
739 openbsd*)
740     test_gtk=yes
741     test_freetype=yes
742     PTHREAD_CFLAGS="-D_THREAD_SAFE"
743     PTHREAD_LIBS="-pthread"
744     _os=OpenBSD
745     ;;
747 dragonfly*)
748     test_gtk=yes
749     build_gstreamer_1_0=yes
750     build_gstreamer_0_10=yes
751     test_kde4=yes
752     test_kde5=yes
753     test_gtk3_kde5=yes
754     test_freetype=yes
755     PTHREAD_LIBS="-pthread"
756     _os=DragonFly
757     ;;
759 linux-android*)
760     build_gstreamer_1_0=no
761     build_gstreamer_0_10=no
762     enable_lotuswordpro=no
763     enable_mpl_subset=yes
764     enable_coinmp=yes
765     enable_lpsolve=no
766     enable_report_builder=no
767     enable_odk=no
768     enable_postgresql_sdbc=no
769     enable_python=no
770     with_theme="tango"
771     test_cups=no
772     test_dbus=no
773     test_fontconfig=no
774     test_freetype=no
775     test_gtk=no
776     test_kde4=no
777     test_kde5=no
778     test_gtk3_kde5=no
779     test_randr=no
780     test_xrender=no
781     _os=Android
783     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
784     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
785     ;;
787 haiku*)
788     test_cups=no
789     test_dbus=no
790     test_randr=no
791     test_xrender=no
792     test_freetype=yes
793     enable_odk=no
794     enable_gstreamer_0_10=no
795     enable_gstreamer_1_0=no
796     enable_vlc=no
797     enable_coinmp=no
798     enable_pdfium=no
799     enable_sdremote=no
800     enable_postgresql_sdbc=no
801     enable_firebird_sdbc=no
802     _os=Haiku
803     ;;
806     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
807     ;;
808 esac
810 if test "$_os" != "WINNT"; then
811 AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
812 else
813 ENDIANNESS=little
815 AC_SUBST(ENDIANNESS)
817 if test "$_os" = "Android" ; then
818     # Verify that the NDK and SDK options are proper
819     if test -z "$with_android_ndk"; then
820         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
821     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
822         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
823     fi
825     if test -z "$ANDROID_SDK_HOME"; then
826         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
827     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
828         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
829     fi
831     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
832     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
833         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
834                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
835                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
836         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
837         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
838         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
839     fi
840     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
841         AC_MSG_WARN([android support repository not found - install with
842                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
843                      to allow the build to download the specified version of the android support libraries])
844         add_warning "android support repository not found - install with"
845         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
846         add_warning "to allow the build to download the specified version of the android support libraries"
847     fi
850 if test "$_os" = "AIX"; then
851     AC_PATH_PROG(GAWK, gawk)
852     if test -z "$GAWK"; then
853         AC_MSG_ERROR([gawk not found in \$PATH])
854     fi
857 AC_SUBST(SDKDIRNAME)
859 AC_SUBST(PTHREAD_CFLAGS)
860 AC_SUBST(PTHREAD_LIBS)
862 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
863 # By default use the ones specified by our build system,
864 # but explicit override is possible.
865 AC_MSG_CHECKING(for explicit AFLAGS)
866 if test -n "$AFLAGS"; then
867     AC_MSG_RESULT([$AFLAGS])
868     x_AFLAGS=
869 else
870     AC_MSG_RESULT(no)
871     x_AFLAGS=[\#]
873 AC_MSG_CHECKING(for explicit CFLAGS)
874 if test -n "$CFLAGS"; then
875     AC_MSG_RESULT([$CFLAGS])
876     x_CFLAGS=
877 else
878     AC_MSG_RESULT(no)
879     x_CFLAGS=[\#]
881 AC_MSG_CHECKING(for explicit CXXFLAGS)
882 if test -n "$CXXFLAGS"; then
883     AC_MSG_RESULT([$CXXFLAGS])
884     x_CXXFLAGS=
885 else
886     AC_MSG_RESULT(no)
887     x_CXXFLAGS=[\#]
889 AC_MSG_CHECKING(for explicit OBJCFLAGS)
890 if test -n "$OBJCFLAGS"; then
891     AC_MSG_RESULT([$OBJCFLAGS])
892     x_OBJCFLAGS=
893 else
894     AC_MSG_RESULT(no)
895     x_OBJCFLAGS=[\#]
897 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
898 if test -n "$OBJCXXFLAGS"; then
899     AC_MSG_RESULT([$OBJCXXFLAGS])
900     x_OBJCXXFLAGS=
901 else
902     AC_MSG_RESULT(no)
903     x_OBJCXXFLAGS=[\#]
905 AC_MSG_CHECKING(for explicit LDFLAGS)
906 if test -n "$LDFLAGS"; then
907     AC_MSG_RESULT([$LDFLAGS])
908     x_LDFLAGS=
909 else
910     AC_MSG_RESULT(no)
911     x_LDFLAGS=[\#]
913 AC_SUBST(AFLAGS)
914 AC_SUBST(CFLAGS)
915 AC_SUBST(CXXFLAGS)
916 AC_SUBST(OBJCFLAGS)
917 AC_SUBST(OBJCXXFLAGS)
918 AC_SUBST(LDFLAGS)
919 AC_SUBST(x_AFLAGS)
920 AC_SUBST(x_CFLAGS)
921 AC_SUBST(x_CXXFLAGS)
922 AC_SUBST(x_OBJCFLAGS)
923 AC_SUBST(x_OBJCXXFLAGS)
924 AC_SUBST(x_LDFLAGS)
926 dnl These are potentially set for MSVC, in the code checking for UCRT below:
927 my_original_CFLAGS=$CFLAGS
928 my_original_CXXFLAGS=$CXXFLAGS
929 my_original_CPPFLAGS=$CPPFLAGS
931 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
932 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
933 dnl AC_PROG_CC internally.
934 if test "$_os" != "WINNT"; then
935     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
936     save_CFLAGS=$CFLAGS
937     AC_PROG_CC
938     CFLAGS=$save_CFLAGS
941 if test $_os != "WINNT"; then
942     save_LIBS="$LIBS"
943     AC_SEARCH_LIBS([dlsym], [dl],
944         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
945         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
946     LIBS="$save_LIBS"
948 AC_SUBST(DLOPEN_LIBS)
950 AC_ARG_ENABLE(ios-simulator,
951     AS_HELP_STRING([--enable-ios-simulator],
952         [build i386 or x86_64 for ios simulator])
955 AC_ARG_ENABLE(ios-libreofficelight-app,
956     AS_HELP_STRING([--enable-ios-libreofficelight-app],
957         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
958          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
959          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
962 ENABLE_IOS_LIBREOFFICELIGHT_APP=
963 if test "$enable_ios_libreofficelight_app" = yes; then
964     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
966 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
968 ###############################################################################
969 # Extensions switches --enable/--disable
970 ###############################################################################
971 # By default these should be enabled unless having extra dependencies.
972 # If there is extra dependency over configure options then the enable should
973 # be automagic based on whether the requiring feature is enabled or not.
974 # All this options change anything only with --enable-extension-integration.
976 # The name of this option and its help string makes it sound as if
977 # extensions are built anyway, just not integrated in the installer,
978 # if you use --disable-extension-integration. Is that really the
979 # case?
981 libo_FUZZ_ARG_ENABLE(extension-integration,
982     AS_HELP_STRING([--disable-extension-integration],
983         [Disable integration of the built extensions in the installer of the
984          product. Use this switch to disable the integration.])
987 AC_ARG_ENABLE(avmedia,
988     AS_HELP_STRING([--disable-avmedia],
989         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
992 AC_ARG_ENABLE(database-connectivity,
993     AS_HELP_STRING([--disable-database-connectivity],
994         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
997 # This doesn't mean not building (or "integrating") extensions
998 # (although it probably should; i.e. it should imply
999 # --disable-extension-integration I guess), it means not supporting
1000 # any extension mechanism at all
1001 libo_FUZZ_ARG_ENABLE(extensions,
1002     AS_HELP_STRING([--disable-extensions],
1003         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1006 AC_ARG_ENABLE(scripting,
1007     AS_HELP_STRING([--disable-scripting],
1008         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1011 # This is mainly for Android and iOS, but could potentially be used in some
1012 # special case otherwise, too, so factored out as a separate setting
1014 AC_ARG_ENABLE(dynamic-loading,
1015     AS_HELP_STRING([--disable-dynamic-loading],
1016         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1019 libo_FUZZ_ARG_ENABLE(report-builder,
1020     AS_HELP_STRING([--disable-report-builder],
1021         [Disable the Report Builder.])
1024 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1025     AS_HELP_STRING([--enable-ext-wiki-publisher],
1026         [Enable the Wiki Publisher extension.])
1029 libo_FUZZ_ARG_ENABLE(lpsolve,
1030     AS_HELP_STRING([--disable-lpsolve],
1031         [Disable compilation of the lp solve solver ])
1033 libo_FUZZ_ARG_ENABLE(coinmp,
1034     AS_HELP_STRING([--disable-coinmp],
1035         [Disable compilation of the CoinMP solver ])
1038 libo_FUZZ_ARG_ENABLE(pdfimport,
1039     AS_HELP_STRING([--disable-pdfimport],
1040         [Disable building the PDF import feature.])
1043 libo_FUZZ_ARG_ENABLE(pdfium,
1044     AS_HELP_STRING([--disable-pdfium],
1045         [Disable building PDFium.])
1048 ###############################################################################
1050 dnl ---------- *** ----------
1052 libo_FUZZ_ARG_ENABLE(mergelibs,
1053     AS_HELP_STRING([--enable-mergelibs],
1054         [Merge several of the smaller libraries into one big, "merged", one.])
1057 libo_FUZZ_ARG_ENABLE(breakpad,
1058     AS_HELP_STRING([--enable-breakpad],
1059         [Enables breakpad for crash reporting.])
1062 AC_ARG_ENABLE(fetch-external,
1063     AS_HELP_STRING([--disable-fetch-external],
1064         [Disables fetching external tarballs from web sources.])
1067 AC_ARG_ENABLE(fuzzers,
1068     AS_HELP_STRING([--enable-fuzzers],
1069         [Enables building libfuzzer targets for fuzz testing.])
1072 libo_FUZZ_ARG_ENABLE(pch,
1073     AS_HELP_STRING([--enable-pch],
1074         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1077 libo_FUZZ_ARG_ENABLE(epm,
1078     AS_HELP_STRING([--enable-epm],
1079         [LibreOffice includes self-packaging code, that requires epm, however epm is
1080          useless for large scale package building.])
1083 libo_FUZZ_ARG_ENABLE(odk,
1084     AS_HELP_STRING([--disable-odk],
1085         [LibreOffice includes an ODK, office development kit which some packagers may
1086          wish to build without.])
1089 AC_ARG_ENABLE(mpl-subset,
1090     AS_HELP_STRING([--enable-mpl-subset],
1091         [Don't compile any pieces which are not MPL or more liberally licensed])
1094 libo_FUZZ_ARG_ENABLE(evolution2,
1095     AS_HELP_STRING([--enable-evolution2],
1096         [Allows the built-in evolution 2 addressbook connectivity build to be
1097          enabled.])
1100 AC_ARG_ENABLE(avahi,
1101     AS_HELP_STRING([--enable-avahi],
1102         [Determines whether to use Avahi to advertise Impress to remote controls.])
1105 libo_FUZZ_ARG_ENABLE(werror,
1106     AS_HELP_STRING([--enable-werror],
1107         [Turn warnings to errors. (Has no effect in modules where the treating
1108          of warnings as errors is disabled explicitly.)]),
1111 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1112     AS_HELP_STRING([--enable-assert-always-abort],
1113         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1116 libo_FUZZ_ARG_ENABLE(dbgutil,
1117     AS_HELP_STRING([--enable-dbgutil],
1118         [Provide debugging support from --enable-debug and include additional debugging
1119          utilities such as object counting or more expensive checks.
1120          This is the recommended option for developers.
1121          Note that this makes the build ABI incompatible, it is not possible to mix object
1122          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1124 libo_FUZZ_ARG_ENABLE(debug,
1125     AS_HELP_STRING([--enable-debug],
1126         [Include debugging information, disable compiler optimization and inlining plus
1127          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1129 libo_FUZZ_ARG_ENABLE(split-debug,
1130     AS_HELP_STRING([--enable-split-debug],
1131         [Uses split debug information (-gsplit-dwarf compile flag). Saves disk space and build time,
1132          but requires tools that support it (both build tools and debuggers).]))
1134 libo_FUZZ_ARG_ENABLE(gdb-index,
1135     AS_HELP_STRING([--enable-gdb-index],
1136         [Creates debug information in the gdb index format, which makes gdb start faster.
1137          Requires the gold or lld linker.]))
1139 libo_FUZZ_ARG_ENABLE(sal-log,
1140     AS_HELP_STRING([--enable-sal-log],
1141         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1143 AC_ARG_ENABLE(selective-debuginfo,
1144     AS_HELP_STRING([--enable-selective-debuginfo],
1145         [If --enable-debug or --enable-dbgutil is used, build debugging information
1146          (-g compiler flag) only for the specified gbuild build targets
1147          (where all means everything, - prepended means not to enable, / appended means
1148          everything in the directory; there is no ordering, more specific overrides
1149          more general, and disabling takes precedence).
1150          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1152 libo_FUZZ_ARG_ENABLE(symbols,
1153     AS_HELP_STRING([--enable-symbols],
1154         [Generate debug information.
1155          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1156          otherwise.]))
1158 libo_FUZZ_ARG_ENABLE(optimized,
1159     AS_HELP_STRING([--disable-optimized],
1160         [Whether to compile with optimization flags.
1161          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1162          otherwise.]))
1164 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1165     AS_HELP_STRING([--disable-runtime-optimizations],
1166         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1167          JVM JIT) that are known to interact badly with certain dynamic analysis
1168          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1169          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1170          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1172 AC_ARG_WITH(valgrind,
1173     AS_HELP_STRING([--with-valgrind],
1174         [Make availability of Valgrind headers a hard requirement.]))
1176 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1177     AS_HELP_STRING([--enable-compiler-plugins],
1178         [Enable compiler plugins that will perform additional checks during
1179          building. Enabled automatically by --enable-dbgutil.
1180          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1181 COMPILER_PLUGINS_DEBUG=
1182 if test "$enable_compiler_plugins" = debug; then
1183     enable_compiler_plugins=yes
1184     COMPILER_PLUGINS_DEBUG=TRUE
1187 libo_FUZZ_ARG_ENABLE(ooenv,
1188     AS_HELP_STRING([--disable-ooenv],
1189         [Disable ooenv for the instdir installation.]))
1191 libo_FUZZ_ARG_ENABLE(libnumbertext,
1192     AS_HELP_STRING([--disable-libnumbertext],
1193         [Disable use of numbertext external library.]))
1195 AC_ARG_ENABLE(lto,
1196     AS_HELP_STRING([--enable-lto],
1197         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1198          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1199          linker. For MSVC, this option is broken at the moment. This is experimental work
1200          in progress that shouldn't be used unless you are working on it.)]))
1202 AC_ARG_ENABLE(python,
1203     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1204         [Enables or disables Python support at run-time.
1205          Also specifies what Python to use. 'auto' is the default.
1206          'fully-internal' even forces the internal version for uses of Python
1207          during the build.]))
1209 libo_FUZZ_ARG_ENABLE(gtk,
1210     AS_HELP_STRING([--disable-gtk],
1211         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1212 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1214 libo_FUZZ_ARG_ENABLE(gtk3,
1215     AS_HELP_STRING([--disable-gtk3],
1216         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1217 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1219 AC_ARG_ENABLE(split-app-modules,
1220     AS_HELP_STRING([--enable-split-app-modules],
1221         [Split file lists for app modules, e.g. base, calc.
1222          Has effect only with make distro-pack-install]),
1225 AC_ARG_ENABLE(split-opt-features,
1226     AS_HELP_STRING([--enable-split-opt-features],
1227         [Split file lists for some optional features, e.g. pyuno, testtool.
1228          Has effect only with make distro-pack-install]),
1231 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1232     AS_HELP_STRING([--disable-cairo-canvas],
1233         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1236 libo_FUZZ_ARG_ENABLE(dbus,
1237     AS_HELP_STRING([--disable-dbus],
1238         [Determines whether to enable features that depend on dbus.
1239          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1240 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1242 libo_FUZZ_ARG_ENABLE(sdremote,
1243     AS_HELP_STRING([--disable-sdremote],
1244         [Determines whether to enable Impress remote control (i.e. the server component).]),
1245 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1247 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1248     AS_HELP_STRING([--disable-sdremote-bluetooth],
1249         [Determines whether to build sdremote with bluetooth support.
1250          Requires dbus on Linux.]))
1252 libo_FUZZ_ARG_ENABLE(gio,
1253     AS_HELP_STRING([--disable-gio],
1254         [Determines whether to use the GIO support.]),
1255 ,test "${enable_gio+set}" = set || enable_gio=yes)
1257 AC_ARG_ENABLE(kde4,
1258     AS_HELP_STRING([--enable-kde4],
1259         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1260          KDE4 are available.]),
1263 AC_ARG_ENABLE(qt5,
1264     AS_HELP_STRING([--enable-qt5],
1265         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1266          available.]),
1269 AC_ARG_ENABLE(kde5,
1270     AS_HELP_STRING([--enable-kde5],
1271         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1272          KF5 are available.]),
1275 AC_ARG_ENABLE(gtk3_kde5,
1276     AS_HELP_STRING([--enable-gtk3-kde5],
1277         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1278          platforms where Gtk3, Qt5 and Plasma is available.]),
1281 libo_FUZZ_ARG_ENABLE(gui,
1282     AS_HELP_STRING([--disable-gui],
1283         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1284          command-line option. Not related to LibreOffice Online functionality. Don't use
1285          unless you are certain you need to. Nobody will help you if you insist on trying
1286          this and run into problems.]),
1287 ,test "${enable_gui+set}" = set || enable_gui=yes)
1289 libo_FUZZ_ARG_ENABLE(randr,
1290     AS_HELP_STRING([--disable-randr],
1291         [Disable RandR support in the vcl project.]),
1292 ,test "${enable_randr+set}" = set || enable_randr=yes)
1294 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1295     AS_HELP_STRING([--disable-gstreamer-1-0],
1296         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1297 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1299 AC_ARG_ENABLE(gstreamer-0-10,
1300     AS_HELP_STRING([--enable-gstreamer-0-10],
1301         [Enable building with the gstreamer 0.10 avmedia backend.]),
1302 ,enable_gstreamer_0_10=no)
1304 libo_FUZZ_ARG_ENABLE(vlc,
1305     AS_HELP_STRING([--enable-vlc],
1306         [Enable building with the (experimental) VLC avmedia backend.]),
1307 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1309 libo_FUZZ_ARG_ENABLE(neon,
1310     AS_HELP_STRING([--disable-neon],
1311         [Disable neon and the compilation of webdav binding.]),
1314 libo_FUZZ_ARG_ENABLE([eot],
1315     [AS_HELP_STRING([--enable-eot],
1316         [Enable support for Embedded OpenType fonts.])],
1317 ,test "${enable_eot+set}" = set || enable_eot=no)
1319 libo_FUZZ_ARG_ENABLE(cve-tests,
1320     AS_HELP_STRING([--disable-cve-tests],
1321         [Prevent CVE tests to be executed]),
1324 libo_FUZZ_ARG_ENABLE(chart-tests,
1325     AS_HELP_STRING([--enable-chart-tests],
1326         [Executes chart XShape tests. In a perfect world these tests would be
1327          stable and everyone could run them, in reality it is best to run them
1328          only on a few machines that are known to work and maintained by people
1329          who can judge if a test failure is a regression or not.]),
1332 AC_ARG_ENABLE(build-unowinreg,
1333     AS_HELP_STRING([--enable-build-unowinreg],
1334         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1335          compiler is needed on Linux.]),
1338 AC_ARG_ENABLE(build-opensymbol,
1339     AS_HELP_STRING([--enable-build-opensymbol],
1340         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1341          fontforge installed.]),
1344 AC_ARG_ENABLE(dependency-tracking,
1345     AS_HELP_STRING([--enable-dependency-tracking],
1346         [Do not reject slow dependency extractors.])[
1347   --disable-dependency-tracking
1348                           Disables generation of dependency information.
1349                           Speed up one-time builds.],
1352 AC_ARG_ENABLE(icecream,
1353     AS_HELP_STRING([--enable-icecream],
1354         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1355          It defaults to /opt/icecream for the location of the icecream gcc/g++
1356          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1359 AC_ARG_ENABLE(ld,
1360     AS_HELP_STRING([--enable-ld=<linker>],
1361         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.]),
1364 libo_FUZZ_ARG_ENABLE(cups,
1365     AS_HELP_STRING([--disable-cups],
1366         [Do not build cups support.])
1369 AC_ARG_ENABLE(ccache,
1370     AS_HELP_STRING([--disable-ccache],
1371         [Do not try to use ccache automatically.
1372          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1373          CC/CXX are not yet set, and --enable-icecream is not given, we
1374          attempt to use ccache. --disable-ccache disables ccache completely.
1378 AC_ARG_ENABLE(64-bit,
1379     AS_HELP_STRING([--enable-64-bit],
1380         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1381          At the moment meaningful only for Windows.]), ,)
1383 libo_FUZZ_ARG_ENABLE(online-update,
1384     AS_HELP_STRING([--enable-online-update],
1385         [Enable the online update service that will check for new versions of
1386          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1387          If the value is "mar", the experimental Mozilla-like update will be
1388          enabled instead of the traditional update mechanism.]),
1391 AC_ARG_WITH(update-config,
1392     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1393                    [Path to the update config ini file]))
1395 libo_FUZZ_ARG_ENABLE(extension-update,
1396     AS_HELP_STRING([--disable-extension-update],
1397         [Disable possibility to update installed extensions.]),
1400 libo_FUZZ_ARG_ENABLE(release-build,
1401     AS_HELP_STRING([--enable-release-build],
1402         [Enable release build. Note that the "release build" choice is orthogonal to
1403          whether symbols are present, debug info is generated, or optimization
1404          is done.
1405          See http://wiki.documentfoundation.org/Development/DevBuild]),
1408 AC_ARG_ENABLE(windows-build-signing,
1409     AS_HELP_STRING([--enable-windows-build-signing],
1410         [Enable signing of windows binaries (*.exe, *.dll)]),
1413 AC_ARG_ENABLE(silent-msi,
1414     AS_HELP_STRING([--enable-silent-msi],
1415         [Enable MSI with LIMITUI=1 (silent install).]),
1418 AC_ARG_ENABLE(macosx-code-signing,
1419     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1420         [Sign executables, dylibs, frameworks and the app bundle. If you
1421          don't provide an identity the first suitable certificate
1422          in your keychain is used.]),
1425 AC_ARG_ENABLE(macosx-package-signing,
1426     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1427         [Create a .pkg suitable for uploading to the Mac App Store and sign
1428          it. If you don't provide an identity the first suitable certificate
1429          in your keychain is used.]),
1432 AC_ARG_ENABLE(macosx-sandbox,
1433     AS_HELP_STRING([--enable-macosx-sandbox],
1434         [Make the app bundle run in a sandbox. Requires code signing.
1435          Is required by apps distributed in the Mac App Store, and implies
1436          adherence to App Store rules.]),
1439 AC_ARG_WITH(macosx-bundle-identifier,
1440     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1441         [Define the OS X bundle identifier. Default is the somewhat weird
1442          org.libreoffice.script ("script", huh?).]),
1443 ,with_macosx_bundle_identifier=org.libreoffice.script)
1445 AC_ARG_WITH(product-name,
1446     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1447         [Define the product name. Default is AC_PACKAGE_NAME.]),
1448 ,with_product_name=$PRODUCTNAME)
1450 AC_ARG_WITH(package-version,
1451     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1452         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1455 libo_FUZZ_ARG_ENABLE(readonly-installset,
1456     AS_HELP_STRING([--enable-readonly-installset],
1457         [Prevents any attempts by LibreOffice to write into its installation. That means
1458          at least that no "system-wide" extensions can be added. Partly experimental work in
1459          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1462 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1463     AS_HELP_STRING([--disable-postgresql-sdbc],
1464         [Disable the build of the PostgreSQL-SDBC driver.])
1467 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1468     AS_HELP_STRING([--disable-lotuswordpro],
1469         [Disable the build of the Lotus Word Pro filter.]),
1470 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1472 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1473     AS_HELP_STRING([--disable-firebird-sdbc],
1474         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1475 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1477 AC_ARG_ENABLE(bogus-pkg-config,
1478     AS_HELP_STRING([--enable-bogus-pkg-config],
1479         [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.]),
1482 AC_ARG_ENABLE(openssl,
1483     AS_HELP_STRING([--disable-openssl],
1484         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1485          components will either use GNUTLS or NSS. Work in progress,
1486          use only if you are hacking on it.]),
1487 ,enable_openssl=yes)
1489 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1490     AS_HELP_STRING([--enable-cipher-openssl-backend],
1491         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1492          Requires --enable-openssl.]))
1494 AC_ARG_ENABLE(library-bin-tar,
1495     AS_HELP_STRING([--enable-library-bin-tar],
1496         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1497         Some libraries can save their build result in a tarball
1498         stored in TARFILE_LOCATION. That binary tarball is
1499         uniquely identified by the source tarball,
1500         the content of the config_host.mk file and the content
1501         of the top-level directory in core for that library
1502         If this option is enabled, then if such a tarfile exist, it will be untarred
1503         instead of the source tarfile, and the build step will be skipped for that
1504         library.
1505         If a proper tarfile does not exist, then the normal source-based
1506         build is done for that library and a proper binary tarfile is created
1507         for the next time.]),
1510 AC_ARG_ENABLE(dconf,
1511     AS_HELP_STRING([--disable-dconf],
1512         [Disable the dconf configuration backend (enabled by default where
1513          available).]))
1515 libo_FUZZ_ARG_ENABLE(formula-logger,
1516     AS_HELP_STRING(
1517         [--enable-formula-logger],
1518         [Enable formula logger for logging formula calculation flow in Calc.]
1519     )
1522 dnl ===================================================================
1523 dnl Optional Packages (--with/without-)
1524 dnl ===================================================================
1526 AC_ARG_WITH(gcc-home,
1527     AS_HELP_STRING([--with-gcc-home],
1528         [Specify the location of gcc/g++ manually. This can be used in conjunction
1529          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1530          non-default path.]),
1533 AC_ARG_WITH(gnu-patch,
1534     AS_HELP_STRING([--with-gnu-patch],
1535         [Specify location of GNU patch on Solaris or FreeBSD.]),
1538 AC_ARG_WITH(build-platform-configure-options,
1539     AS_HELP_STRING([--with-build-platform-configure-options],
1540         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1543 AC_ARG_WITH(gnu-cp,
1544     AS_HELP_STRING([--with-gnu-cp],
1545         [Specify location of GNU cp on Solaris or FreeBSD.]),
1548 AC_ARG_WITH(external-tar,
1549     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1550         [Specify an absolute path of where to find (and store) tarfiles.]),
1551     TARFILE_LOCATION=$withval ,
1554 AC_ARG_WITH(referenced-git,
1555     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1556         [Specify another checkout directory to reference. This makes use of
1557                  git submodule update --reference, and saves a lot of diskspace
1558                  when having multiple trees side-by-side.]),
1559     GIT_REFERENCE_SRC=$withval ,
1562 AC_ARG_WITH(linked-git,
1563     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1564         [Specify a directory where the repositories of submodules are located.
1565          This uses a method similar to git-new-workdir to get submodules.]),
1566     GIT_LINK_SRC=$withval ,
1569 AC_ARG_WITH(galleries,
1570     AS_HELP_STRING([--with-galleries],
1571         [Specify how galleries should be built. It is possible either to
1572          build these internally from source ("build"),
1573          or to disable them ("no")]),
1576 AC_ARG_WITH(theme,
1577     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1578         [Choose which themes to include. By default those themes with an '*' are included.
1579          Possible choices: *breeze, *breeze_dark, *colibre, *elementary, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1582 libo_FUZZ_ARG_WITH(helppack-integration,
1583     AS_HELP_STRING([--without-helppack-integration],
1584         [It will not integrate the helppacks to the installer
1585          of the product. Please use this switch to use the online help
1586          or separate help packages.]),
1589 libo_FUZZ_ARG_WITH(fonts,
1590     AS_HELP_STRING([--without-fonts],
1591         [LibreOffice includes some third-party fonts to provide a reliable basis for
1592          help content, templates, samples, etc. When these fonts are already
1593          known to be available on the system then you should use this option.]),
1596 AC_ARG_WITH(epm,
1597     AS_HELP_STRING([--with-epm],
1598         [Decides which epm to use. Default is to use the one from the system if
1599          one is built. When either this is not there or you say =internal epm
1600          will be built.]),
1603 AC_ARG_WITH(package-format,
1604     AS_HELP_STRING([--with-package-format],
1605         [Specify package format(s) for LibreOffice installation sets. The
1606          implicit --without-package-format leads to no installation sets being
1607          generated. Possible values: aix, archive, bsd, deb, dmg,
1608          installed, msi, pkg, and rpm.
1609          Example: --with-package-format='deb rpm']),
1612 AC_ARG_WITH(tls,
1613     AS_HELP_STRING([--with-tls],
1614         [Decides which TLS/SSL and cryptographic implementations to use for
1615          LibreOffice's code. Notice that this doesn't apply for depending
1616          libraries like "neon", for example. Default is to use OpenSSL
1617          although NSS is also possible. Notice that selecting NSS restricts
1618          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1619          restrict by now the usage of NSS in LO's code. Possible values:
1620          openssl, nss. Example: --with-tls="nss"]),
1623 AC_ARG_WITH(system-libs,
1624     AS_HELP_STRING([--with-system-libs],
1625         [Use libraries already on system -- enables all --with-system-* flags.]),
1628 AC_ARG_WITH(system-bzip2,
1629     AS_HELP_STRING([--with-system-bzip2],
1630         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1631     [with_system_bzip2="$with_system_libs"])
1633 AC_ARG_WITH(system-headers,
1634     AS_HELP_STRING([--with-system-headers],
1635         [Use headers already on system -- enables all --with-system-* flags for
1636          external packages whose headers are the only entities used i.e.
1637          boost/odbc/sane-header(s).]),,
1638     [with_system_headers="$with_system_libs"])
1640 AC_ARG_WITH(system-jars,
1641     AS_HELP_STRING([--without-system-jars],
1642         [When building with --with-system-libs, also the needed jars are expected
1643          on the system. Use this to disable that]),,
1644     [with_system_jars="$with_system_libs"])
1646 AC_ARG_WITH(system-cairo,
1647     AS_HELP_STRING([--with-system-cairo],
1648         [Use cairo libraries already on system.  Happens automatically for
1649          (implicit) --enable-gtk and for --enable-gtk3.]))
1651 AC_ARG_WITH(system-epoxy,
1652     AS_HELP_STRING([--with-system-epoxy],
1653         [Use epoxy libraries already on system.  Happens automatically for
1654          --enable-gtk3.]),,
1655        [with_system_epoxy="$with_system_libs"])
1657 AC_ARG_WITH(myspell-dicts,
1658     AS_HELP_STRING([--with-myspell-dicts],
1659         [Adds myspell dictionaries to the LibreOffice installation set]),
1662 AC_ARG_WITH(system-dicts,
1663     AS_HELP_STRING([--without-system-dicts],
1664         [Do not use dictionaries from system paths.]),
1667 AC_ARG_WITH(external-dict-dir,
1668     AS_HELP_STRING([--with-external-dict-dir],
1669         [Specify external dictionary dir.]),
1672 AC_ARG_WITH(external-hyph-dir,
1673     AS_HELP_STRING([--with-external-hyph-dir],
1674         [Specify external hyphenation pattern dir.]),
1677 AC_ARG_WITH(external-thes-dir,
1678     AS_HELP_STRING([--with-external-thes-dir],
1679         [Specify external thesaurus dir.]),
1682 AC_ARG_WITH(system-zlib,
1683     AS_HELP_STRING([--with-system-zlib],
1684         [Use zlib already on system.]),,
1685     [with_system_zlib=auto])
1687 AC_ARG_WITH(system-jpeg,
1688     AS_HELP_STRING([--with-system-jpeg],
1689         [Use jpeg already on system.]),,
1690     [with_system_jpeg="$with_system_libs"])
1692 AC_ARG_WITH(system-clucene,
1693     AS_HELP_STRING([--with-system-clucene],
1694         [Use clucene already on system.]),,
1695     [with_system_clucene="$with_system_libs"])
1697 AC_ARG_WITH(system-expat,
1698     AS_HELP_STRING([--with-system-expat],
1699         [Use expat already on system.]),,
1700     [with_system_expat="$with_system_libs"])
1702 AC_ARG_WITH(system-libxml,
1703     AS_HELP_STRING([--with-system-libxml],
1704         [Use libxml/libxslt already on system.]),,
1705     [with_system_libxml=auto])
1707 AC_ARG_WITH(system-icu,
1708     AS_HELP_STRING([--with-system-icu],
1709         [Use icu already on system.]),,
1710     [with_system_icu="$with_system_libs"])
1712 AC_ARG_WITH(system-ucpp,
1713     AS_HELP_STRING([--with-system-ucpp],
1714         [Use ucpp already on system.]),,
1715     [])
1717 AC_ARG_WITH(system-openldap,
1718     AS_HELP_STRING([--with-system-openldap],
1719         [Use the OpenLDAP LDAP SDK already on system.]),,
1720     [with_system_openldap="$with_system_libs"])
1722 AC_ARG_WITH(system-poppler,
1723     AS_HELP_STRING([--with-system-poppler],
1724         [Use system poppler (only needed for PDF import).]),,
1725     [with_system_poppler="$with_system_libs"])
1727 AC_ARG_WITH(system-gpgmepp,
1728     AS_HELP_STRING([--with-system-gpgmepp],
1729         [Use gpgmepp already on system]),,
1730     [with_system_gpgmepp="$with_system_libs"])
1732 AC_ARG_WITH(system-apache-commons,
1733     AS_HELP_STRING([--with-system-apache-commons],
1734         [Use Apache commons libraries already on system.]),,
1735     [with_system_apache_commons="$with_system_jars"])
1737 AC_ARG_WITH(system-mariadb,
1738     AS_HELP_STRING([--with-system-mariadb],
1739         [Use MariaDB/MySQL libraries already on system.]),,
1740     [with_system_mariadb="$with_system_libs"])
1742 AC_ARG_ENABLE(bundle-mariadb,
1743     AS_HELP_STRING([--enable-bundle-mariadb],
1744         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1747 AC_ARG_WITH(system-postgresql,
1748     AS_HELP_STRING([--with-system-postgresql],
1749         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1750          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1751     [with_system_postgresql="$with_system_libs"])
1753 AC_ARG_WITH(libpq-path,
1754     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1755         [Use this PostgreSQL C interface (libpq) installation for building
1756          the PostgreSQL-SDBC extension.]),
1759 AC_ARG_WITH(system-firebird,
1760     AS_HELP_STRING([--with-system-firebird],
1761         [Use Firebird libraries already on system, for building the Firebird-SDBC
1762          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1763     [with_system_firebird="$with_system_libs"])
1765 AC_ARG_WITH(system-libtommath,
1766             AS_HELP_STRING([--with-system-libtommath],
1767                            [Use libtommath already on system]),,
1768             [with_system_libtommath="$with_system_libs"])
1770 AC_ARG_WITH(system-hsqldb,
1771     AS_HELP_STRING([--with-system-hsqldb],
1772         [Use hsqldb already on system.]))
1774 AC_ARG_WITH(hsqldb-jar,
1775     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1776         [Specify path to jarfile manually.]),
1777     HSQLDB_JAR=$withval)
1779 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1780     AS_HELP_STRING([--disable-scripting-beanshell],
1781         [Disable support for scripts in BeanShell.]),
1785 AC_ARG_WITH(system-beanshell,
1786     AS_HELP_STRING([--with-system-beanshell],
1787         [Use beanshell already on system.]),,
1788     [with_system_beanshell="$with_system_jars"])
1790 AC_ARG_WITH(beanshell-jar,
1791     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1792         [Specify path to jarfile manually.]),
1793     BSH_JAR=$withval)
1795 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1796     AS_HELP_STRING([--disable-scripting-javascript],
1797         [Disable support for scripts in JavaScript.]),
1801 AC_ARG_WITH(system-rhino,
1802     AS_HELP_STRING([--with-system-rhino],
1803         [Use rhino already on system.]),,)
1804 #    [with_system_rhino="$with_system_jars"])
1805 # Above is not used as we have different debug interface
1806 # patched into internal rhino. This code needs to be fixed
1807 # before we can enable it by default.
1809 AC_ARG_WITH(rhino-jar,
1810     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1811         [Specify path to jarfile manually.]),
1812     RHINO_JAR=$withval)
1814 AC_ARG_WITH(commons-logging-jar,
1815     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1816         [Specify path to jarfile manually.]),
1817     COMMONS_LOGGING_JAR=$withval)
1819 AC_ARG_WITH(system-jfreereport,
1820     AS_HELP_STRING([--with-system-jfreereport],
1821         [Use JFreeReport already on system.]),,
1822     [with_system_jfreereport="$with_system_jars"])
1824 AC_ARG_WITH(sac-jar,
1825     AS_HELP_STRING([--with-sac-jar=JARFILE],
1826         [Specify path to jarfile manually.]),
1827     SAC_JAR=$withval)
1829 AC_ARG_WITH(libxml-jar,
1830     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1831         [Specify path to jarfile manually.]),
1832     LIBXML_JAR=$withval)
1834 AC_ARG_WITH(flute-jar,
1835     AS_HELP_STRING([--with-flute-jar=JARFILE],
1836         [Specify path to jarfile manually.]),
1837     FLUTE_JAR=$withval)
1839 AC_ARG_WITH(jfreereport-jar,
1840     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1841         [Specify path to jarfile manually.]),
1842     JFREEREPORT_JAR=$withval)
1844 AC_ARG_WITH(liblayout-jar,
1845     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1846         [Specify path to jarfile manually.]),
1847     LIBLAYOUT_JAR=$withval)
1849 AC_ARG_WITH(libloader-jar,
1850     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1851         [Specify path to jarfile manually.]),
1852     LIBLOADER_JAR=$withval)
1854 AC_ARG_WITH(libformula-jar,
1855     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1856         [Specify path to jarfile manually.]),
1857     LIBFORMULA_JAR=$withval)
1859 AC_ARG_WITH(librepository-jar,
1860     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1861         [Specify path to jarfile manually.]),
1862     LIBREPOSITORY_JAR=$withval)
1864 AC_ARG_WITH(libfonts-jar,
1865     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1866         [Specify path to jarfile manually.]),
1867     LIBFONTS_JAR=$withval)
1869 AC_ARG_WITH(libserializer-jar,
1870     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1871         [Specify path to jarfile manually.]),
1872     LIBSERIALIZER_JAR=$withval)
1874 AC_ARG_WITH(libbase-jar,
1875     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1876         [Specify path to jarfile manually.]),
1877     LIBBASE_JAR=$withval)
1879 AC_ARG_WITH(system-odbc,
1880     AS_HELP_STRING([--with-system-odbc],
1881         [Use the odbc headers already on system.]),,
1882     [with_system_odbc="auto"])
1884 AC_ARG_WITH(system-sane,
1885     AS_HELP_STRING([--with-system-sane],
1886         [Use sane.h already on system.]),,
1887     [with_system_sane="$with_system_headers"])
1889 AC_ARG_WITH(system-bluez,
1890     AS_HELP_STRING([--with-system-bluez],
1891         [Use bluetooth.h already on system.]),,
1892     [with_system_bluez="$with_system_headers"])
1894 AC_ARG_WITH(system-curl,
1895     AS_HELP_STRING([--with-system-curl],
1896         [Use curl already on system.]),,
1897     [with_system_curl=auto])
1899 AC_ARG_WITH(system-boost,
1900     AS_HELP_STRING([--with-system-boost],
1901         [Use boost already on system.]),,
1902     [with_system_boost="$with_system_headers"])
1904 AC_ARG_WITH(system-glm,
1905     AS_HELP_STRING([--with-system-glm],
1906         [Use glm already on system.]),,
1907     [with_system_glm="$with_system_headers"])
1909 AC_ARG_WITH(system-hunspell,
1910     AS_HELP_STRING([--with-system-hunspell],
1911         [Use libhunspell already on system.]),,
1912     [with_system_hunspell="$with_system_libs"])
1914 AC_ARG_WITH(system-mythes,
1915     AS_HELP_STRING([--with-system-mythes],
1916         [Use mythes already on system.]),,
1917     [with_system_mythes="$with_system_libs"])
1919 AC_ARG_WITH(system-altlinuxhyph,
1920     AS_HELP_STRING([--with-system-altlinuxhyph],
1921         [Use ALTLinuxhyph already on system.]),,
1922     [with_system_altlinuxhyph="$with_system_libs"])
1924 AC_ARG_WITH(system-lpsolve,
1925     AS_HELP_STRING([--with-system-lpsolve],
1926         [Use lpsolve already on system.]),,
1927     [with_system_lpsolve="$with_system_libs"])
1929 AC_ARG_WITH(system-coinmp,
1930     AS_HELP_STRING([--with-system-coinmp],
1931         [Use CoinMP already on system.]),,
1932     [with_system_coinmp="$with_system_libs"])
1934 AC_ARG_WITH(system-liblangtag,
1935     AS_HELP_STRING([--with-system-liblangtag],
1936         [Use liblangtag library already on system.]),,
1937     [with_system_liblangtag="$with_system_libs"])
1939 AC_ARG_WITH(webdav,
1940     AS_HELP_STRING([--with-webdav],
1941         [Specify which library to use for webdav implementation.
1942          Possible values: "neon", "serf", "no". The default value is "neon".
1943          Example: --with-webdav="serf"]),
1944     WITH_WEBDAV=$withval,
1945     WITH_WEBDAV="neon")
1947 AC_ARG_WITH(linker-hash-style,
1948     AS_HELP_STRING([--with-linker-hash-style],
1949         [Use linker with --hash-style=<style> when linking shared objects.
1950          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1951          if supported on the build system, and "sysv" otherwise.]))
1953 AC_ARG_WITH(jdk-home,
1954     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1955         [If you have installed JDK 1.6 or later on your system please supply the
1956          path here. Note that this is not the location of the java command but the
1957          location of the entire distribution.]),
1960 AC_ARG_WITH(help,
1961     AS_HELP_STRING([--with-help],
1962         [Enable the build of help. There is a special parameter "common" that
1963          can be used to bundle only the common part, .e.g help-specific icons.
1964          This is useful when you build the helpcontent separately.])
1965     [
1966                           Usage:     --with-help    build the old local help
1967                                  --without-help     no local help (default)
1968                                  --with-help=html   build the new HTML local help
1969                                  --with-help=online build the new HTML online help
1970     ],
1973 libo_FUZZ_ARG_WITH(java,
1974     AS_HELP_STRING([--with-java=<java command>],
1975         [Specify the name of the Java interpreter command. Typically "java"
1976          which is the default.
1978          To build without support for Java components, applets, accessibility
1979          or the XML filters written in Java, use --without-java or --with-java=no.]),
1980     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1981     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1984 AC_ARG_WITH(jvm-path,
1985     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1986         [Use a specific JVM search path at runtime.
1987          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1990 AC_ARG_WITH(ant-home,
1991     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1992         [If you have installed Jakarta Ant on your system, please supply the path here.
1993          Note that this is not the location of the Ant binary but the location
1994          of the entire distribution.]),
1997 AC_ARG_WITH(symbol-config,
1998     AS_HELP_STRING([--with-symbol-config],
1999         [Configuration for the crashreport symbol upload]),
2000         [],
2001         [with_symbol_config=no])
2003 AC_ARG_WITH(export-validation,
2004     AS_HELP_STRING([--without-export-validation],
2005         [Disable validating OOXML and ODF files as exported from in-tree tests.
2006          Use this option e.g. if your system only provides Java 5.]),
2007 ,with_export_validation=auto)
2009 AC_ARG_WITH(bffvalidator,
2010     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2011         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2012          Requires installed Microsoft Office Binary File Format Validator.
2013          Note: export-validation (--with-export-validation) is required to be turned on.
2014          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2015 ,with_bffvalidator=no)
2017 libo_FUZZ_ARG_WITH(junit,
2018     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2019         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2020          --without-junit disables those tests. Not relevant in the --without-java case.]),
2021 ,with_junit=yes)
2023 AC_ARG_WITH(hamcrest,
2024     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2025         [Specifies the hamcrest jar file to use for JUnit-based tests.
2026          --without-junit disables those tests. Not relevant in the --without-java case.]),
2027 ,with_hamcrest=yes)
2029 AC_ARG_WITH(perl-home,
2030     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2031         [If you have installed Perl 5 Distribution, on your system, please
2032          supply the path here. Note that this is not the location of the Perl
2033          binary but the location of the entire distribution.]),
2036 libo_FUZZ_ARG_WITH(doxygen,
2037     AS_HELP_STRING(
2038         [--with-doxygen=<absolute path to doxygen executable>],
2039         [Specifies the doxygen executable to use when generating ODK C/C++
2040          documentation. --without-doxygen disables generation of ODK C/C++
2041          documentation. Not relevant in the --disable-odk case.]),
2042 ,with_doxygen=yes)
2044 AC_ARG_WITH(visual-studio,
2045     AS_HELP_STRING([--with-visual-studio=<2017>],
2046         [Specify which Visual Studio version to use in case several are
2047          installed. Currently only 2017 is supported.]),
2050 AC_ARG_WITH(windows-sdk,
2051     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2052         [Specify which Windows SDK, or "Windows Kit", version to use
2053          in case the one that came with the selected Visual Studio
2054          is not what you want for some reason. Note that not all compiler/SDK
2055          combinations are supported. The intent is that this option should not
2056          be needed.]),
2059 AC_ARG_WITH(lang,
2060     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2061         [Use this option to build LibreOffice with additional UI language support.
2062          English (US) is always included by default.
2063          Separate multiple languages with space.
2064          For all languages, use --with-lang=ALL.]),
2067 AC_ARG_WITH(locales,
2068     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2069         [Use this option to limit the locale information built in.
2070          Separate multiple locales with space.
2071          Very experimental and might well break stuff.
2072          Just a desperate measure to shrink code and data size.
2073          By default all the locales available is included.
2074          This option is completely unrelated to --with-lang.])
2075     [
2076                           Affects also our character encoding conversion
2077                           tables for encodings mainly targeted for a
2078                           particular locale, like EUC-CN and EUC-TW for
2079                           zh, ISO-2022-JP for ja.
2081                           Affects also our add-on break iterator data for
2082                           some languages.
2084                           For the default, all locales, don't use this switch at all.
2085                           Specifying just the language part of a locale means all matching
2086                           locales will be included.
2087     ],
2090 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2091 libo_FUZZ_ARG_WITH(krb5,
2092     AS_HELP_STRING([--with-krb5],
2093         [Enable MIT Kerberos 5 support in modules that support it.
2094          By default automatically enabled on platforms
2095          where a good system Kerberos 5 is available.]),
2098 libo_FUZZ_ARG_WITH(gssapi,
2099     AS_HELP_STRING([--with-gssapi],
2100         [Enable GSSAPI support in modules that support it.
2101          By default automatically enabled on platforms
2102          where a good system GSSAPI is available.]),
2105 AC_ARG_WITH(iwyu,
2106     AS_HELP_STRING([--with-iwyu],
2107         [Use given IWYU binary path to check unneeded includes instead of building.
2108          Use only if you are hacking on it.]),
2111 libo_FUZZ_ARG_WITH(lxml,
2112     AS_HELP_STRING([--without-lxml],
2113         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2114          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2115          report widget classes and ids.]),
2118 dnl ===================================================================
2119 dnl Branding
2120 dnl ===================================================================
2122 AC_ARG_WITH(branding,
2123     AS_HELP_STRING([--with-branding=/path/to/images],
2124         [Use given path to retrieve branding images set.])
2125     [
2126                           Search for intro.png about.svg and flat_logo.svg.
2127                           If any is missing, default ones will be used instead.
2129                           Search also progress.conf for progress
2130                           settings on intro screen :
2132                           PROGRESSBARCOLOR="255,255,255" Set color of
2133                           progress bar. Comma separated RGB decimal values.
2134                           PROGRESSSIZE="407,6" Set size of progress bar.
2135                           Comma separated decimal values (width, height).
2136                           PROGRESSPOSITION="61,317" Set position of progress
2137                           bar from left,top. Comma separated decimal values.
2138                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2139                           bar frame. Comma separated RGB decimal values.
2140                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2141                           bar text. Comma separated RGB decimal values.
2142                           PROGRESSTEXTBASELINE="287" Set vertical position of
2143                           progress bar text from top. Decimal value.
2145                           Default values will be used if not found.
2146     ],
2150 AC_ARG_WITH(extra-buildid,
2151     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2152         [Show addition build identification in about dialog.]),
2156 AC_ARG_WITH(vendor,
2157     AS_HELP_STRING([--with-vendor="John the Builder"],
2158         [Set vendor of the build.]),
2161 AC_ARG_WITH(android-package-name,
2162     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2163         [Set Android package name of the build.]),
2166 AC_ARG_WITH(compat-oowrappers,
2167     AS_HELP_STRING([--with-compat-oowrappers],
2168         [Install oo* wrappers in parallel with
2169          lo* ones to keep backward compatibility.
2170          Has effect only with make distro-pack-install]),
2173 AC_ARG_WITH(os-version,
2174     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2175         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2178 AC_ARG_WITH(mingw-cross-compiler,
2179     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2180         [Specify the MinGW cross-compiler to use.
2181          When building on the ODK on Unix and building unowinreg.dll,
2182          specify the MinGW C++ cross-compiler.]),
2185 AC_ARG_WITH(idlc-cpp,
2186     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2187         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2190 AC_ARG_WITH(build-version,
2191     AS_HELP_STRING([--with-build-version="Built by Jim"],
2192         [Allows the builder to add a custom version tag that will appear in the
2193          Help/About box for QA purposes.]),
2194 with_build_version=$withval,
2197 AC_ARG_WITH(parallelism,
2198     AS_HELP_STRING([--with-parallelism],
2199         [Number of jobs to run simultaneously during build. Parallel builds can
2200         save a lot of time on multi-cpu machines. Defaults to the number of
2201         CPUs on the machine, unless you configure --enable-icecream - then to
2202         10.]),
2205 AC_ARG_WITH(all-tarballs,
2206     AS_HELP_STRING([--with-all-tarballs],
2207         [Download all external tarballs unconditionally]))
2209 AC_ARG_WITH(gdrive-client-id,
2210     AS_HELP_STRING([--with-gdrive-client-id],
2211         [Provides the client id of the application for OAuth2 authentication
2212         on Google Drive. If either this or --with-gdrive-client-secret is
2213         empty, the feature will be disabled]),
2216 AC_ARG_WITH(gdrive-client-secret,
2217     AS_HELP_STRING([--with-gdrive-client-secret],
2218         [Provides the client secret of the application for OAuth2
2219         authentication on Google Drive. If either this or
2220         --with-gdrive-client-id is empty, the feature will be disabled]),
2223 AC_ARG_WITH(alfresco-cloud-client-id,
2224     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2225         [Provides the client id of the application for OAuth2 authentication
2226         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2227         empty, the feature will be disabled]),
2230 AC_ARG_WITH(alfresco-cloud-client-secret,
2231     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2232         [Provides the client secret of the application for OAuth2
2233         authentication on Alfresco Cloud. If either this or
2234         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2237 AC_ARG_WITH(onedrive-client-id,
2238     AS_HELP_STRING([--with-onedrive-client-id],
2239         [Provides the client id of the application for OAuth2 authentication
2240         on OneDrive. If either this or --with-onedrive-client-secret is
2241         empty, the feature will be disabled]),
2244 AC_ARG_WITH(onedrive-client-secret,
2245     AS_HELP_STRING([--with-onedrive-client-secret],
2246         [Provides the client secret of the application for OAuth2
2247         authentication on OneDrive. If either this or
2248         --with-onedrive-client-id is empty, the feature will be disabled]),
2250 dnl ===================================================================
2251 dnl Do we want to use pre-build binary tarball for recompile
2252 dnl ===================================================================
2254 if test "$enable_library_bin_tar" = "yes" ; then
2255     USE_LIBRARY_BIN_TAR=TRUE
2256 else
2257     USE_LIBRARY_BIN_TAR=
2259 AC_SUBST(USE_LIBRARY_BIN_TAR)
2261 dnl ===================================================================
2262 dnl Test whether build target is Release Build
2263 dnl ===================================================================
2264 AC_MSG_CHECKING([whether build target is Release Build])
2265 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2266     AC_MSG_RESULT([no])
2267     ENABLE_RELEASE_BUILD=
2268 else
2269     AC_MSG_RESULT([yes])
2270     ENABLE_RELEASE_BUILD=TRUE
2272 AC_SUBST(ENABLE_RELEASE_BUILD)
2274 dnl ===================================================================
2275 dnl Test whether to sign Windows Build
2276 dnl ===================================================================
2277 AC_MSG_CHECKING([whether to sign windows build])
2278 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2279     AC_MSG_RESULT([yes])
2280     WINDOWS_BUILD_SIGNING="TRUE"
2281 else
2282     AC_MSG_RESULT([no])
2283     WINDOWS_BUILD_SIGNING="FALSE"
2285 AC_SUBST(WINDOWS_BUILD_SIGNING)
2287 dnl ===================================================================
2288 dnl MacOSX build and runtime environment options
2289 dnl ===================================================================
2291 AC_ARG_WITH(macosx-sdk,
2292     AS_HELP_STRING([--with-macosx-sdk=<version>],
2293         [Prefer a specific SDK for building.])
2294     [
2295                           If the requested SDK is not available, a search for the oldest one will be done.
2296                           With current Xcode versions, only the latest SDK is included, so this option is
2297                           not terribly useful. It works fine to build with a new SDK and run the result
2298                           on an older OS.
2300                           e. g.: --with-macosx-sdk=10.9
2302                           there are 3 options to control the MacOSX build:
2303                           --with-macosx-sdk (referred as 'sdk' below)
2304                           --with-macosx-version-min-required (referred as 'min' below)
2305                           --with-macosx-version-max-allowed (referred as 'max' below)
2307                           the connection between these value and the default they take is as follow:
2308                           ( ? means not specified on the command line, s means the SDK version found,
2309                           constraint: 8 <= x <= y <= z)
2311                           ==========================================
2312                            command line      || config result
2313                           ==========================================
2314                           min  | max  | sdk  || min  | max  | sdk  |
2315                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2316                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2317                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2318                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2319                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2320                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2321                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2322                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2325                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2326                           for a detailed technical explanation of these variables
2328                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2329     ],
2332 AC_ARG_WITH(macosx-version-min-required,
2333     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2334         [set the minimum OS version needed to run the built LibreOffice])
2335     [
2336                           e. g.: --with-macos-version-min-required=10.9
2337                           see --with-macosx-sdk for more info
2338     ],
2341 AC_ARG_WITH(macosx-version-max-allowed,
2342     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2343         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2344     [
2345                           e. g.: --with-macos-version-max-allowed=10.9
2346                           see --with-macosx-sdk for more info
2347     ],
2351 dnl ===================================================================
2352 dnl options for stuff used during cross-compilation build
2353 dnl Not quite superseded by --with-build-platform-configure-options.
2354 dnl TODO: check, if the "force" option is still needed anywhere.
2355 dnl ===================================================================
2357 AC_ARG_WITH(system-icu-for-build,
2358     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2359         [Use icu already on system for build tools (cross-compilation only).]))
2362 dnl ===================================================================
2363 dnl Check for incompatible options set by fuzzing, and reset those
2364 dnl automatically to working combinations
2365 dnl ===================================================================
2367 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2368         "$enable_dbus" != "$enable_avahi"; then
2369     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2370     enable_avahi=$enable_dbus
2373 dnl ===================================================================
2374 dnl check for required programs (grep, awk, sed, bash)
2375 dnl ===================================================================
2377 pathmunge ()
2379     if test -n "$1"; then
2380         if test "$build_os" = "cygwin"; then
2381             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2382                 PathFormat "$1"
2383                 new_path=`cygpath -sm "$formatted_path"`
2384             else
2385                 PathFormat "$1"
2386                 new_path=`cygpath -u "$formatted_path"`
2387             fi
2388         else
2389             new_path="$1"
2390         fi
2391         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2392             if test "$2" = "after"; then
2393                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2394             else
2395                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2396             fi
2397         fi
2398         unset new_path
2399     fi
2402 AC_PROG_AWK
2403 AC_PATH_PROG( AWK, $AWK)
2404 if test -z "$AWK"; then
2405     AC_MSG_ERROR([install awk to run this script])
2408 AC_PATH_PROG(BASH, bash)
2409 if test -z "$BASH"; then
2410     AC_MSG_ERROR([bash not found in \$PATH])
2412 AC_SUBST(BASH)
2414 AC_MSG_CHECKING([for GNU or BSD tar])
2415 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2416     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2417     if test $? -eq 0;  then
2418         GNUTAR=$a
2419         break
2420     fi
2421 done
2422 AC_MSG_RESULT($GNUTAR)
2423 if test -z "$GNUTAR"; then
2424     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2426 AC_SUBST(GNUTAR)
2428 AC_MSG_CHECKING([for tar's option to strip components])
2429 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2430 if test $? -eq 0; then
2431     STRIP_COMPONENTS="--strip-components"
2432 else
2433     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2434     if test $? -eq 0; then
2435         STRIP_COMPONENTS="--strip-path"
2436     else
2437         STRIP_COMPONENTS="unsupported"
2438     fi
2440 AC_MSG_RESULT($STRIP_COMPONENTS)
2441 if test x$STRIP_COMPONENTS = xunsupported; then
2442     AC_MSG_ERROR([you need a tar that is able to strip components.])
2444 AC_SUBST(STRIP_COMPONENTS)
2446 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2447 dnl desktop OSes from "mobile" ones.
2449 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2450 dnl In other words, that when building for an OS that is not a
2451 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2453 dnl Note the direction of the implication; there is no assumption that
2454 dnl cross-compiling would imply a non-desktop OS.
2456 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2457     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2458     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2459     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2462 # Whether to build "avmedia" functionality or not.
2464 if test -z "$enable_avmedia"; then
2465     enable_avmedia=yes
2468 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2469 if test "$enable_avmedia" = yes; then
2470     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2471 else
2472     USE_AVMEDIA_DUMMY='TRUE'
2474 AC_SUBST(USE_AVMEDIA_DUMMY)
2476 # Decide whether to build database connectivity stuff (including
2477 # Base) or not. We probably don't want to on non-desktop OSes.
2478 if test -z "$enable_database_connectivity"; then
2479     # --disable-database-connectivity is unfinished work in progress
2480     # and the iOS test app doesn't link if we actually try to use it.
2481     # if test $_os != iOS -a $_os != Android; then
2482     if test $_os != iOS; then
2483         enable_database_connectivity=yes
2484     fi
2487 if test "$enable_database_connectivity" = yes; then
2488     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2489     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2492 if test -z "$enable_extensions"; then
2493     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2494     if test $_os != iOS -a $_os != Android; then
2495         enable_extensions=yes
2496     fi
2499 if test "$enable_extensions" = yes; then
2500     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2501     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2504 if test -z "$enable_scripting"; then
2505     # Disable scripting for iOS unless specifically overridden
2506     # with --enable-scripting.
2507     if test $_os != iOS; then
2508         enable_scripting=yes
2509     fi
2512 DISABLE_SCRIPTING=''
2513 if test "$enable_scripting" = yes; then
2514     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2515     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2516 else
2517     DISABLE_SCRIPTING='TRUE'
2518     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2521 if test $_os = iOS -o $_os = Android; then
2522     # Disable dynamic_loading always for iOS and Android
2523     enable_dynamic_loading=no
2524 elif test -z "$enable_dynamic_loading"; then
2525     # Otherwise enable it unless speficically disabled
2526     enable_dynamic_loading=yes
2529 DISABLE_DYNLOADING=''
2530 if test "$enable_dynamic_loading" = yes; then
2531     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2532 else
2533     DISABLE_DYNLOADING='TRUE'
2535 AC_SUBST(DISABLE_DYNLOADING)
2537 # remenber SYSBASE value
2538 AC_SUBST(SYSBASE)
2540 dnl ===================================================================
2541 dnl  Sort out various gallery compilation options
2542 dnl ===================================================================
2543 AC_MSG_CHECKING([how to build and package galleries])
2544 if test -n "${with_galleries}"; then
2545     if test "$with_galleries" = "build"; then
2546         WITH_GALLERY_BUILD=TRUE
2547         AC_MSG_RESULT([build from source images internally])
2548     elif test "$with_galleries" = "no"; then
2549         WITH_GALLERY_BUILD=
2550         AC_MSG_RESULT([disable non-internal gallery build])
2551     else
2552         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2553     fi
2554 else
2555     if test $_os != iOS -a $_os != Android; then
2556         WITH_GALLERY_BUILD=TRUE
2557         AC_MSG_RESULT([internal src images for desktop])
2558     else
2559         WITH_GALLERY_BUILD=
2560         AC_MSG_RESULT([disable src image build])
2561     fi
2563 AC_SUBST(WITH_GALLERY_BUILD)
2565 dnl ===================================================================
2566 dnl  Checks if ccache is available
2567 dnl ===================================================================
2568 if test "$_os" = "WINNT"; then
2569     # on windows/VC build do not use ccache
2570     CCACHE=""
2571 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2572     case "%$CC%$CXX%" in
2573     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2574     # assume that's good then
2575     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2576         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2577         ;;
2578     *)
2579         AC_PATH_PROG([CCACHE],[ccache],[not found])
2580         if test "$CCACHE" = "not found"; then
2581             CCACHE=""
2582         else
2583             # Need to check for ccache version: otherwise prevents
2584             # caching of the results (like "-x objective-c++" for Mac)
2585             if test $_os = Darwin -o $_os = iOS; then
2586                 # Check ccache version
2587                 AC_MSG_CHECKING([whether version of ccache is suitable])
2588                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2589                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2590                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2591                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2592                 else
2593                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2594                     CCACHE=""
2595                 fi
2596             fi
2597         fi
2598         ;;
2599     esac
2600 else
2601     CCACHE=""
2604 if test "$CCACHE" != ""; then
2605     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2606     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2607     if test "$ccache_size" = ""; then
2608         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2609         if test "$ccache_size" = ""; then
2610             ccache_size=0
2611         fi
2612         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2613         if test $ccache_size -lt 1024; then
2614             CCACHE=""
2615             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2616             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2617         else
2618             # warn that ccache may be too small for debug build
2619             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2620             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2621         fi
2622     else
2623         if test $ccache_size -lt 5; then
2624             #warn that ccache may be too small for debug build
2625             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2626             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2627         fi
2628     fi
2631 dnl ===================================================================
2632 dnl  Checks for C compiler,
2633 dnl  The check for the C++ compiler is later on.
2634 dnl ===================================================================
2635 if test "$_os" != "WINNT"; then
2636     GCC_HOME_SET="true"
2637     AC_MSG_CHECKING([gcc home])
2638     if test -z "$with_gcc_home"; then
2639         if test "$enable_icecream" = "yes"; then
2640             if test -d "/usr/lib/icecc/bin"; then
2641                 GCC_HOME="/usr/lib/icecc/"
2642             elif test -d "/usr/libexec/icecc/bin"; then
2643                 GCC_HOME="/usr/libexec/icecc/"
2644             elif test -d "/opt/icecream/bin"; then
2645                 GCC_HOME="/opt/icecream/"
2646             else
2647                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2649             fi
2650         else
2651             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2652             GCC_HOME_SET="false"
2653         fi
2654     else
2655         GCC_HOME="$with_gcc_home"
2656     fi
2657     AC_MSG_RESULT($GCC_HOME)
2658     AC_SUBST(GCC_HOME)
2660     if test "$GCC_HOME_SET" = "true"; then
2661         if test -z "$CC"; then
2662             CC="$GCC_HOME/bin/gcc"
2663         fi
2664         if test -z "$CXX"; then
2665             CXX="$GCC_HOME/bin/g++"
2666         fi
2667     fi
2670 COMPATH=`dirname "$CC"`
2671 if test "$COMPATH" = "."; then
2672     AC_PATH_PROGS(COMPATH, $CC)
2673     dnl double square bracket to get single because of M4 quote...
2674     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2676 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2678 dnl ===================================================================
2679 dnl Java support
2680 dnl ===================================================================
2681 AC_MSG_CHECKING([whether to build with Java support])
2682 if test "$with_java" != "no"; then
2683     if test "$DISABLE_SCRIPTING" = TRUE; then
2684         AC_MSG_RESULT([no, overridden by --disable-scripting])
2685         ENABLE_JAVA=""
2686         with_java=no
2687     else
2688         AC_MSG_RESULT([yes])
2689         ENABLE_JAVA="TRUE"
2690         AC_DEFINE(HAVE_FEATURE_JAVA)
2691     fi
2692 else
2693     AC_MSG_RESULT([no])
2694     ENABLE_JAVA=""
2697 AC_SUBST(ENABLE_JAVA)
2699 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2701 dnl ENABLE_JAVA="" indicate no Java support at all
2703 dnl ===================================================================
2704 dnl Check OS X SDK and compiler
2705 dnl ===================================================================
2707 if test $_os = Darwin -o $_os = iOS; then
2709     # If no --with-macosx-sdk option is given, look for one
2711     # The intent is that for "most" Mac-based developers, a suitable
2712     # SDK will be found automatically without any configure options.
2714     # For developers with a current Xcode, the lowest-numbered SDK
2715     # higher than or equal to the minimum required should be found.
2717     AC_MSG_CHECKING([what Mac OS X SDK to use])
2718     for _macosx_sdk in ${with_macosx_sdk-10.14 10.13 10.12}; do
2719         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2720         if test -d "$MACOSX_SDK_PATH"; then
2721             with_macosx_sdk="${_macosx_sdk}"
2722             break
2723         else
2724             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2725             if test -d "$MACOSX_SDK_PATH"; then
2726                 with_macosx_sdk="${_macosx_sdk}"
2727                 break
2728             fi
2729         fi
2730     done
2731     if test ! -d "$MACOSX_SDK_PATH"; then
2732         AC_MSG_ERROR([Could not find an appropriate Mac OS X SDK])
2733     fi
2735     if test $_os = iOS; then
2736         if test "$enable_ios_simulator" = "yes"; then
2737             useos=iphonesimulator
2738         else
2739             useos=iphoneos
2740         fi
2741         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2742     fi
2743     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2746     case $with_macosx_sdk in
2747     10.12)
2748         MACOSX_SDK_VERSION=101200
2749         ;;
2750     10.13)
2751         MACOSX_SDK_VERSION=101300
2752         ;;
2753     10.14)
2754         MACOSX_SDK_VERSION=101400
2755         ;;
2756     *)
2757         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--14])
2758         ;;
2759     esac
2761     if test "$with_macosx_version_min_required" = "" ; then
2762         with_macosx_version_min_required="10.9";
2763     fi
2765     if test "$with_macosx_version_max_allowed" = "" ; then
2766         with_macosx_version_max_allowed="$with_macosx_sdk"
2767     fi
2769     # export this so that "xcrun" invocations later return matching values
2770     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2771     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2772     export DEVELOPER_DIR
2773     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2774     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2776     case "$with_macosx_version_min_required" in
2777     10.9)
2778         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2779         ;;
2780     10.10)
2781         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2782         ;;
2783     10.11)
2784         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2785         ;;
2786     10.12)
2787         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2788         ;;
2789     10.13)
2790         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2791         ;;
2792     10.14)
2793         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2794         ;;
2795     *)
2796         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--14])
2797         ;;
2798     esac
2799     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2801     LIBTOOL=/usr/bin/libtool
2802     INSTALL_NAME_TOOL=install_name_tool
2803     if test -z "$save_CC"; then
2804         AC_MSG_CHECKING([what compiler to use])
2805         stdlib=-stdlib=libc++
2806         if test "$ENABLE_LTO" = TRUE; then
2807             lto=-flto
2808         fi
2809         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2810         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2811         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2812         AR=`xcrun -find ar`
2813         NM=`xcrun -find nm`
2814         STRIP=`xcrun -find strip`
2815         LIBTOOL=`xcrun -find libtool`
2816         RANLIB=`xcrun -find ranlib`
2817         AC_MSG_RESULT([$CC and $CXX])
2818     fi
2820     case "$with_macosx_version_max_allowed" in
2821     10.9)
2822         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2823         ;;
2824     10.10)
2825         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2826         ;;
2827     10.11)
2828         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2829         ;;
2830     10.12)
2831         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2832         ;;
2833     10.13)
2834         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2835         ;;
2836     10.14)
2837         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2838         ;;
2839     *)
2840         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--14])
2841         ;;
2842     esac
2844     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2845     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2846         AC_MSG_ERROR([the version minimumn required, $MAC_OS_X_VERSION_MIN_REQUIRED, must be <= the version maximum allowed, $MAC_OS_X_VERSION_MAX_ALLOWED])
2847     else
2848         AC_MSG_RESULT([ok])
2849     fi
2851     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2852     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2853         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2854     else
2855         AC_MSG_RESULT([ok])
2856     fi
2857     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2858     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2860     AC_MSG_CHECKING([whether to do code signing])
2862     if test "$enable_macosx_code_signing" = yes; then
2863         # By default use the first suitable certificate (?).
2865         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2866         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2867         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2868         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2869         # "Developer ID Application" one.
2871         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2872         if test -n "$identity"; then
2873             MACOSX_CODESIGNING_IDENTITY=$identity
2874             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2875             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2876         else
2877             AC_MSG_ERROR([cannot determine identity to use])
2878         fi
2879     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2880         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2881         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2882         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2883     else
2884         AC_MSG_RESULT([no])
2885     fi
2887     AC_MSG_CHECKING([whether to create a Mac App Store package])
2889     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2890         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2891     elif test "$enable_macosx_package_signing" = yes; then
2892         # By default use the first suitable certificate.
2893         # It should be a "3rd Party Mac Developer Installer" one
2895         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2896         if test -n "$identity"; then
2897             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2898             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2899             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2900         else
2901             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2902         fi
2903     elif test -n "$enable_macosx_package_signing"; then
2904         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2905         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2906         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2907     else
2908         AC_MSG_RESULT([no])
2909     fi
2911     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2912         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2913     fi
2915     AC_MSG_CHECKING([whether to sandbox the application])
2917     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2918         AC_MSG_ERROR([OS X sandboxing requires code signing])
2919     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2920         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2921     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2922         ENABLE_MACOSX_SANDBOX=TRUE
2923         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2924         AC_MSG_RESULT([yes])
2925     else
2926         AC_MSG_RESULT([no])
2927     fi
2929     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2930     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2931     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2933 AC_SUBST(MACOSX_SDK_PATH)
2934 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2935 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2936 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2937 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2938 AC_SUBST(INSTALL_NAME_TOOL)
2939 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2940 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2941 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2942 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2943 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2945 dnl ===================================================================
2946 dnl Check iOS SDK and compiler
2947 dnl ===================================================================
2949 if test $_os = iOS; then
2950     AC_MSG_CHECKING([what iOS SDK to use])
2951     current_sdk_ver=12.0
2952     if test "$enable_ios_simulator" = "yes"; then
2953         platform=iPhoneSimulator
2954         versionmin=-mios-simulator-version-min=$current_sdk_ver
2955     else
2956         platform=iPhoneOS
2957         versionmin=-miphoneos-version-min=11.0
2958     fi
2959     xcode_developer=`xcode-select -print-path`
2961     for sdkver in $current_sdk_ver; do
2962         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2963         if test -d $t; then
2964             ios_sdk=$sdkver
2965             sysroot=$t
2966             break
2967         fi
2968     done
2970     if test -z "$sysroot"; then
2971         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2972     fi
2974     AC_MSG_RESULT($sysroot)
2976     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2977     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2979     # LTO is not really recommended for iOS builds,
2980     # the link time will be astronomical
2981     if test "$ENABLE_LTO" = TRUE; then
2982         lto=-flto
2983     fi
2985     stdlib="-stdlib=libc++"
2987     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2988     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2990     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2991     AR=`xcrun -find ar`
2992     NM=`xcrun -find nm`
2993     STRIP=`xcrun -find strip`
2994     LIBTOOL=`xcrun -find libtool`
2995     RANLIB=`xcrun -find ranlib`
2998 AC_SUBST(IOS_SDK)
2999 AC_SUBST(IOS_DEPLOYMENT_VERSION)
3001 AC_MSG_CHECKING([whether to treat the installation as read-only])
3003 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3004         "$enable_extensions" != yes; then
3005     enable_readonly_installset=yes
3007 if test "$enable_readonly_installset" = yes; then
3008     AC_MSG_RESULT([yes])
3009     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3010 else
3011     AC_MSG_RESULT([no])
3014 dnl ===================================================================
3015 dnl Structure of install set
3016 dnl ===================================================================
3018 if test $_os = Darwin; then
3019     LIBO_BIN_FOLDER=MacOS
3020     LIBO_ETC_FOLDER=Resources
3021     LIBO_LIBEXEC_FOLDER=MacOS
3022     LIBO_LIB_FOLDER=Frameworks
3023     LIBO_LIB_PYUNO_FOLDER=Resources
3024     LIBO_SHARE_FOLDER=Resources
3025     LIBO_SHARE_HELP_FOLDER=Resources/help
3026     LIBO_SHARE_JAVA_FOLDER=Resources/java
3027     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3028     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3029     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3030     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3031     LIBO_URE_BIN_FOLDER=MacOS
3032     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3033     LIBO_URE_LIB_FOLDER=Frameworks
3034     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3035     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3036 elif test $_os = WINNT; then
3037     LIBO_BIN_FOLDER=program
3038     LIBO_ETC_FOLDER=program
3039     LIBO_LIBEXEC_FOLDER=program
3040     LIBO_LIB_FOLDER=program
3041     LIBO_LIB_PYUNO_FOLDER=program
3042     LIBO_SHARE_FOLDER=share
3043     LIBO_SHARE_HELP_FOLDER=help
3044     LIBO_SHARE_JAVA_FOLDER=program/classes
3045     LIBO_SHARE_PRESETS_FOLDER=presets
3046     LIBO_SHARE_READMES_FOLDER=readmes
3047     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3048     LIBO_SHARE_SHELL_FOLDER=program/shell
3049     LIBO_URE_BIN_FOLDER=program
3050     LIBO_URE_ETC_FOLDER=program
3051     LIBO_URE_LIB_FOLDER=program
3052     LIBO_URE_MISC_FOLDER=program
3053     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3054 else
3055     LIBO_BIN_FOLDER=program
3056     LIBO_ETC_FOLDER=program
3057     LIBO_LIBEXEC_FOLDER=program
3058     LIBO_LIB_FOLDER=program
3059     LIBO_LIB_PYUNO_FOLDER=program
3060     LIBO_SHARE_FOLDER=share
3061     LIBO_SHARE_HELP_FOLDER=help
3062     LIBO_SHARE_JAVA_FOLDER=program/classes
3063     LIBO_SHARE_PRESETS_FOLDER=presets
3064     LIBO_SHARE_READMES_FOLDER=readmes
3065     if test "$enable_fuzzers" != yes; then
3066         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3067     else
3068         LIBO_SHARE_RESOURCE_FOLDER=resource
3069     fi
3070     LIBO_SHARE_SHELL_FOLDER=program/shell
3071     LIBO_URE_BIN_FOLDER=program
3072     LIBO_URE_ETC_FOLDER=program
3073     LIBO_URE_LIB_FOLDER=program
3074     LIBO_URE_MISC_FOLDER=program
3075     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3077 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3078 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3079 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3080 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3081 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3091 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3092 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3094 # Not all of them needed in config_host.mk, add more if need arises
3095 AC_SUBST(LIBO_BIN_FOLDER)
3096 AC_SUBST(LIBO_ETC_FOLDER)
3097 AC_SUBST(LIBO_LIB_FOLDER)
3098 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3099 AC_SUBST(LIBO_SHARE_FOLDER)
3100 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3101 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3102 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3103 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3104 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3105 AC_SUBST(LIBO_URE_BIN_FOLDER)
3106 AC_SUBST(LIBO_URE_ETC_FOLDER)
3107 AC_SUBST(LIBO_URE_LIB_FOLDER)
3108 AC_SUBST(LIBO_URE_MISC_FOLDER)
3109 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3111 dnl ===================================================================
3112 dnl Windows specific tests and stuff
3113 dnl ===================================================================
3115 reg_get_value()
3117     # Return value: $regvalue
3118     unset regvalue
3120     local _regentry="/proc/registry${1}/${2}"
3121     if test -f "$_regentry"; then
3122         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3123         # Registry keys read via /proc/registry* are always \0 terminated!
3124         local _regvalue=$(tr -d '\0' < "$_regentry")
3125         if test $? -eq 0; then
3126             regvalue=$_regvalue
3127         fi
3128     fi
3131 # Get a value from the 32-bit side of the Registry
3132 reg_get_value_32()
3134     reg_get_value "32" "$1"
3137 # Get a value from the 64-bit side of the Registry
3138 reg_get_value_64()
3140     reg_get_value "64" "$1"
3143 if test "$_os" = "WINNT"; then
3144     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3145     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3146         AC_MSG_RESULT([no])
3147         WINDOWS_SDK_ARCH="x86"
3148     else
3149         AC_MSG_RESULT([yes])
3150         WINDOWS_SDK_ARCH="x64"
3151         BITNESS_OVERRIDE=64
3152     fi
3154 if test "$_os" = "iOS"; then
3155     cross_compiling="yes"
3158 if test "$cross_compiling" = "yes"; then
3159     export CROSS_COMPILING=TRUE
3160 else
3161     CROSS_COMPILING=
3162     BUILD_TYPE="$BUILD_TYPE NATIVE"
3164 AC_SUBST(CROSS_COMPILING)
3166 USE_LD=
3167 if test -n "$enable_ld" -a "$enable_ld" != "no"; then
3168     AC_MSG_CHECKING([for -fuse-ld=$enable_ld linker support])
3169     if test "$GCC" = "yes"; then
3170         ldflags_save=$LDFLAGS
3171         LDFLAGS="$LDFLAGS -fuse-ld=$enable_ld"
3172         AC_LINK_IFELSE([AC_LANG_PROGRAM([
3173 #include <stdio.h>
3174             ],[
3175 printf ("hello world\n");
3176             ])], USE_LD=$enable_ld, [])
3177         if test -n "$USE_LD"; then
3178             AC_MSG_RESULT( yes )
3179             LDFLAGS="$ldflags_save -fuse-ld=$enable_ld"
3180         else
3181             AC_MSG_ERROR( no )
3182         fi
3183     else
3184         AC_MSG_ERROR( not supported )
3185     fi
3187 AC_SUBST(USE_LD)
3189 ENABLE_GDB_INDEX=
3190 if test "$enable_gdb_index" = "yes"; then
3191     AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
3192     save_CFLAGS=$CFLAGS
3193     CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
3194     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ AC_MSG_RESULT( yes )],[ AC_MSG_ERROR( no )])
3196     AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
3197     ldflags_save=$LDFLAGS
3198     LDFLAGS="$LDFLAGS -Wl,--gdb-index"
3199     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3200 #include <stdio.h>
3201         ],[
3202 printf ("hello world\n");
3203         ])], ENABLE_GDB_INDEX=TRUE, [])
3204     if test "$ENABLE_GDB_INDEX" = "TRUE"; then
3205         AC_MSG_RESULT( yes )
3206     else
3207         AC_MSG_ERROR( no )
3208     fi
3209     CFLAGS=$save_CFLAGS
3210     LDFLAGS=$ldflags_save
3212 AC_SUBST(ENABLE_GDB_INDEX)
3214 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3215 if test "$GCC" = "yes"; then
3216     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3217     bsymbolic_functions_ldflags_save=$LDFLAGS
3218     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
3219     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3220 #include <stdio.h>
3221         ],[
3222 printf ("hello world\n");
3223         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3224     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3225         AC_MSG_RESULT( found )
3226     else
3227         AC_MSG_RESULT( not found )
3228     fi
3229     LDFLAGS=$bsymbolic_functions_ldflags_save
3231 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3233 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3234 # NOTE: must _not_ be used for bundled external libraries!
3235 ISYSTEM=
3236 if test "$GCC" = "yes"; then
3237     AC_MSG_CHECKING( for -isystem )
3238     save_CFLAGS=$CFLAGS
3239     CFLAGS="$CFLAGS -Werror"
3240     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3241     CFLAGS=$save_CFLAGS
3242     if test -n "$ISYSTEM"; then
3243         AC_MSG_RESULT(yes)
3244     else
3245         AC_MSG_RESULT(no)
3246     fi
3248 if test -z "$ISYSTEM"; then
3249     # fall back to using -I
3250     ISYSTEM=-I
3252 AC_SUBST(ISYSTEM)
3254 dnl ===================================================================
3255 dnl  Check which Visual Studio compiler is used
3256 dnl ===================================================================
3258 map_vs_year_to_version()
3260     # Return value: $vsversion
3262     unset vsversion
3264     case $1 in
3265     2017)
3266         vsversion=15.0;;
3267     *)
3268         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3269     esac
3272 vs_versions_to_check()
3274     # Args: $1 (optional) : versions to check, in the order of preference
3275     # Return value: $vsversions
3277     unset vsversions
3279     if test -n "$1"; then
3280         map_vs_year_to_version "$1"
3281         vsversions=$vsversion
3282     else
3283         # We accept only 2017
3284         vsversions="15.0"
3285     fi
3288 win_get_env_from_vsvars32bat()
3290     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3291     # Also seems to be located in another directory under the same name: vsvars32.bat
3292     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3293     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3294     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3295     chmod +x $WRAPPERBATCHFILEPATH
3296     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3297     rm -f $WRAPPERBATCHFILEPATH
3298     printf '%s' "$_win_get_env_from_vsvars32bat"
3301 find_ucrt()
3303     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3304     if test -n "$regvalue"; then
3305         PathFormat "$regvalue"
3306         UCRTSDKDIR=$formatted_path
3307         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3308         UCRTVERSION=$regvalue
3309         # Rest if not exist
3310         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3311           UCRTSDKDIR=
3312         fi
3313     fi
3314     if test -z "$UCRTSDKDIR"; then
3315         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3316         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3317         if test -f "$ide_env_file"; then
3318             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3319             UCRTSDKDIR=$formatted_path
3320             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3321             dnl Hack needed at least by tml:
3322             if test "$UCRTVERSION" = 10.0.15063.0 \
3323                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3324                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3325             then
3326                 UCRTVERSION=10.0.14393.0
3327             fi
3328         else
3329           AC_MSG_ERROR([No UCRT found])
3330         fi
3331     fi
3334 find_msvc()
3336     # Find Visual C++ 2017
3337     # Args: $1 (optional) : The VS version year
3338     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3340     unset vctest vcnum vcnumwithdot vcbuildnumber
3342     vs_versions_to_check "$1"
3344     for ver in $vsversions; do
3345         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3346         if test -n "$regvalue"; then
3347             vctest=$regvalue
3348             break
3349         fi
3350         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3351         if test -n "$regvalue"; then
3352             AC_MSG_RESULT([found: $regvalue])
3353             PathFormat "$regvalue"
3354             vctest=$formatted_path
3355             break
3356         fi
3357     done
3358     if test -n "$vctest"; then
3359         vcnumwithdot=$ver
3360         case "$vcnumwithdot" in
3361         15.0)
3362             vcyear=2017
3363             vcnum=150
3364             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3365             ;;
3366         esac
3367     fi
3370 SOLARINC=
3371 MSBUILD_PATH=
3372 DEVENV=
3373 if test "$_os" = "WINNT"; then
3374     AC_MSG_CHECKING([Visual C++])
3376     find_msvc "$with_visual_studio"
3377     if test -z "$vctest"; then
3378         if test -n "$with_visual_studio"; then
3379             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3380         else
3381             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3382         fi
3383     fi
3385     if test "$BITNESS_OVERRIDE" = ""; then
3386         if test -f "$vctest/bin/cl.exe"; then
3387             VC_PRODUCT_DIR=$vctest
3388         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3389             VC_PRODUCT_DIR=$vctest/VC
3390         else
3391             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3392         fi
3393     else
3394         if test -f "$vctest/bin/amd64/cl.exe"; then
3395             VC_PRODUCT_DIR=$vctest
3396         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3397             VC_PRODUCT_DIR=$vctest/VC
3398         else
3399             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe or $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3400         fi
3401     fi
3403     AC_MSG_CHECKING([for short pathname of VC product directory])
3404     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3405     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3407     UCRTSDKDIR=
3408     UCRTVERSION=
3410     AC_MSG_CHECKING([for UCRT location])
3411     find_ucrt
3412     # find_ucrt errors out if it doesn't find it
3413     AC_MSG_RESULT([found])
3414     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3415     ucrtincpath_formatted=$formatted_path
3416     # SOLARINC is used for external modules and must be set too.
3417     # And no, it's not sufficient to set SOLARINC only, as configure
3418     # itself doesn't honour it.
3419     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3420     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3421     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3422     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3424     AC_SUBST(UCRTSDKDIR)
3425     AC_SUBST(UCRTVERSION)
3427     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3428     # Find the proper version of MSBuild.exe to use based on the VS version
3429     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3430     if test -n "$regvalue" ; then
3431         AC_MSG_RESULT([found: $regvalue])
3432         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3433     else
3434         if test "$BITNESS_OVERRIDE" = ""; then
3435             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3436         else
3437             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3438         fi
3439         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3440         AC_MSG_RESULT([$regvalue])
3441     fi
3443     # Find the version of devenv.exe
3444     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3445     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3446     if test ! -e "$DEVENV"; then
3447         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3448     fi
3450     dnl ===========================================================
3451     dnl  Check for the corresponding mspdb*.dll
3452     dnl ===========================================================
3454     MSPDB_PATH=
3455     CL_DIR=
3456     CL_LIB=
3458     if test "$BITNESS_OVERRIDE" = ""; then
3459         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3460         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3461     else
3462         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3463         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3464     fi
3466     # MSVC 15.0 has libraries from 14.0?
3467     mspdbnum="140"
3469     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3470         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3471     fi
3473     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3474     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3476     dnl The path needs to be added before cl is called
3477     PATH="$MSPDB_PATH:$PATH"
3479     AC_MSG_CHECKING([cl.exe])
3481     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3482     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3483     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3484     # is not enough?
3486     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3487     dnl needed when building CLR code:
3488     if test -z "$MSVC_CXX"; then
3489         if test "$BITNESS_OVERRIDE" = ""; then
3490             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3491                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3492             fi
3493         else
3494             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3495                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3496             fi
3497         fi
3499         # This gives us a posix path with 8.3 filename restrictions
3500         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3501     fi
3503     if test -z "$CC"; then
3504         CC=$MSVC_CXX
3505     fi
3506     if test "$BITNESS_OVERRIDE" = ""; then
3507         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3508         MSVC_CXX="$MSVC_CXX -arch:SSE"
3509     fi
3511     if test -n "$CC"; then
3512         # Remove /cl.exe from CC case insensitive
3513         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3514         if test "$BITNESS_OVERRIDE" = ""; then
3515            COMPATH="$VC_PRODUCT_DIR"
3516         else
3517             if test -n "$VC_PRODUCT_DIR"; then
3518                 COMPATH=$VC_PRODUCT_DIR
3519             fi
3520         fi
3521         if test "$BITNESS_OVERRIDE" = ""; then
3522             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3523             CC="$CC -arch:SSE"
3524         fi
3526         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3528         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3530         PathFormat "$COMPATH"
3531         COMPATH="$formatted_path"
3533         VCVER=$vcnum
3534         MSVSVER=$vcyear
3536         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3537         # are always "better", we list them in reverse chronological order.
3539         case $vcnum in
3540         150)
3541             COMEX=19
3542             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3543             ;;
3544         esac
3546         # The expectation is that --with-windows-sdk should not need to be used
3547         if test -n "$with_windows_sdk"; then
3548             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3549             *" "$with_windows_sdk" "*)
3550                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3551                 ;;
3552             *)
3553                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3554                 ;;
3555             esac
3556         fi
3558         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3559         ac_objext=obj
3560         ac_exeext=exe
3562     else
3563         AC_MSG_ERROR([Visual C++ not found after all, huh])
3564     fi
3566     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3567     # version of the Explorer extension (and maybe other small
3568     # bits, too) needed when installing a 32-bit LibreOffice on a
3569     # 64-bit OS. The 64-bit Explorer extension is a feature that
3570     # has been present since long in OOo. Don't confuse it with
3571     # building LibreOffice itself as 64-bit code.
3573     BUILD_X64=
3574     CXX_X64_BINARY=
3575     LINK_X64_BINARY=
3577     if test "$BITNESS_OVERRIDE" = ""; then
3578         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3579         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3580             # Prefer native x64 compiler to cross-compiler, in case we are running
3581             # the build on a 64-bit OS.
3582             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3583                 BUILD_X64=TRUE
3584                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3585                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3586             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3587                 BUILD_X64=TRUE
3588                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3589                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3590             fi
3591         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3592             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3593             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3594                 BUILD_X64=TRUE
3595                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3596                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3597             fi
3598         fi
3599         if test "$BUILD_X64" = TRUE; then
3600             AC_MSG_RESULT([found])
3601         else
3602             AC_MSG_RESULT([not found])
3603             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3604         fi
3605     fi
3606     AC_SUBST(BUILD_X64)
3608     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3609     AC_SUBST(CXX_X64_BINARY)
3610     AC_SUBST(LINK_X64_BINARY)
3612 AC_SUBST(VCVER)
3613 AC_SUBST(DEVENV)
3614 PathFormat "$MSPDB_PATH"
3615 MSPDB_PATH="$formatted_path"
3616 AC_SUBST(MSVC_CXX)
3619 # unowinreg.dll
3621 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3622 AC_SUBST(UNOWINREG_DLL)
3624 COM_IS_CLANG=
3625 AC_MSG_CHECKING([whether the compiler is actually Clang])
3626 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3627     #ifndef __clang__
3628     you lose
3629     #endif
3630     int foo=42;
3631     ]])],
3632     [AC_MSG_RESULT([yes])
3633      COM_IS_CLANG=TRUE],
3634     [AC_MSG_RESULT([no])])
3636 CC_PLAIN=$CC
3637 if test "$COM_IS_CLANG" = TRUE; then
3638     AC_MSG_CHECKING([the Clang version])
3639     if test "$_os" = WINNT; then
3640         dnl In which case, assume clang-cl:
3641         my_args="/EP /TC"
3642         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3643         dnl clang-cl:
3644         CC_PLAIN=
3645         for i in $CC; do
3646             case $i in
3647             -FIIntrin.h)
3648                 ;;
3649             *)
3650                 CC_PLAIN="$CC_PLAIN $i"
3651                 ;;
3652             esac
3653         done
3654     else
3655         my_args="-E -P"
3656     fi
3657     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3658     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3659     CLANGVER=`echo $clang_version \
3660         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3661     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3662     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3663     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3665 AC_SUBST(COM_IS_CLANG)
3666 AC_SUBST(CLANGVER)
3668 SHOWINCLUDES_PREFIX=
3669 if test "$_os" = WINNT; then
3670     dnl We need to guess the prefix of the -showIncludes output, it can be
3671     dnl localized
3672     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3673     echo "#include <stdlib.h>" > conftest.c
3674     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3675         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3676     rm -f conftest.c conftest.obj
3677     if test -z "$SHOWINCLUDES_PREFIX"; then
3678         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3679     else
3680         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3681     fi
3683 AC_SUBST(SHOWINCLUDES_PREFIX)
3686 # prefix C with ccache if needed
3688 if test "$CCACHE" != ""; then
3689     AC_MSG_CHECKING([whether $CC is already ccached])
3691     AC_LANG_PUSH([C])
3692     save_CFLAGS=$CFLAGS
3693     CFLAGS="$CFLAGS --ccache-skip -O2"
3694     dnl an empty program will do, we're checking the compiler flags
3695     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3696                       [use_ccache=yes], [use_ccache=no])
3697     if test $use_ccache = yes; then
3698         AC_MSG_RESULT([yes])
3699     else
3700         CC="$CCACHE $CC"
3701         AC_MSG_RESULT([no])
3702     fi
3703     CFLAGS=$save_CFLAGS
3704     AC_LANG_POP([C])
3707 # ===================================================================
3708 # check various GCC options that Clang does not support now but maybe
3709 # will somewhen in the future, check them even for GCC, so that the
3710 # flags are set
3711 # ===================================================================
3713 HAVE_GCC_GGDB2=
3714 HAVE_GCC_FINLINE_LIMIT=
3715 HAVE_GCC_FNO_INLINE=
3716 if test "$GCC" = "yes"; then
3717     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3718     save_CFLAGS=$CFLAGS
3719     CFLAGS="$CFLAGS -Werror -ggdb2"
3720     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3721     CFLAGS=$save_CFLAGS
3722     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3723         AC_MSG_RESULT([yes])
3724     else
3725         AC_MSG_RESULT([no])
3726     fi
3728     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3729     save_CFLAGS=$CFLAGS
3730     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3731     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3732     CFLAGS=$save_CFLAGS
3733     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3734         AC_MSG_RESULT([yes])
3735     else
3736         AC_MSG_RESULT([no])
3737     fi
3739     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3740     save_CFLAGS=$CFLAGS
3741     CFLAGS="$CFLAGS -Werror -fno-inline"
3742     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3743     CFLAGS=$save_CFLAGS
3744     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3745         AC_MSG_RESULT([yes])
3746     else
3747         AC_MSG_RESULT([no])
3748     fi
3750     if test "$host_cpu" = "m68k"; then
3751         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3752         save_CFLAGS=$CFLAGS
3753         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3754         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3755         CFLAGS=$save_CFLAGS
3756         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3757             AC_MSG_RESULT([yes])
3758         else
3759             AC_MSG_ERROR([no])
3760         fi
3761     fi
3763 AC_SUBST(HAVE_GCC_GGDB2)
3764 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3765 AC_SUBST(HAVE_GCC_FNO_INLINE)
3767 dnl ===================================================================
3768 dnl  Test the gcc version
3769 dnl ===================================================================
3770 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3771     AC_MSG_CHECKING([the GCC version])
3772     _gcc_version=`$CC -dumpversion`
3773     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3774         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3775     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3777     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3779     if test "$gcc_full_version" -lt 40801; then
3780         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3781     fi
3782 else
3783     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3784     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3785     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3786     # (which reports itself as GCC 4.2.1).
3787     GCC_VERSION=
3789 AC_SUBST(GCC_VERSION)
3791 dnl Set the ENABLE_DBGUTIL variable
3792 dnl ===================================================================
3793 AC_MSG_CHECKING([whether to build with additional debug utilities])
3794 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3795     ENABLE_DBGUTIL="TRUE"
3796     # this is an extra var so it can have different default on different MSVC
3797     # versions (in case there are version specific problems with it)
3798     MSVC_USE_DEBUG_RUNTIME="TRUE"
3800     AC_MSG_RESULT([yes])
3801     # cppunit and graphite expose STL in public headers
3802     if test "$with_system_cppunit" = "yes"; then
3803         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3804     else
3805         with_system_cppunit=no
3806     fi
3807     if test "$with_system_graphite" = "yes"; then
3808         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3809     else
3810         with_system_graphite=no
3811     fi
3812     if test "$with_system_orcus" = "yes"; then
3813         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3814     else
3815         with_system_orcus=no
3816     fi
3817     if test "$with_system_libcmis" = "yes"; then
3818         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3819     else
3820         with_system_libcmis=no
3821     fi
3822     if test "$with_system_hunspell" = "yes"; then
3823         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3824     else
3825         with_system_hunspell=no
3826     fi
3827     if test "$with_system_gpgmepp" = "yes"; then
3828         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3829     else
3830         with_system_gpgmepp=no
3831     fi
3832     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3833     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3834     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3835     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3836     # of those two is using the system variant:
3837     if test "$with_system_libnumbertext" = "yes"; then
3838         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3839     else
3840         with_system_libnumbertext=no
3841     fi
3842     if test "$with_system_libwps" = "yes"; then
3843         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3844     else
3845         with_system_libwps=no
3846     fi
3847 else
3848     ENABLE_DBGUTIL=""
3849     MSVC_USE_DEBUG_RUNTIME=""
3850     AC_MSG_RESULT([no])
3852 AC_SUBST(ENABLE_DBGUTIL)
3853 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3855 dnl Set the ENABLE_DEBUG variable.
3856 dnl ===================================================================
3857 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3858     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3860 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3861     if test -z "$libo_fuzzed_enable_debug"; then
3862         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3863     else
3864         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3865         enable_debug=yes
3866     fi
3869 AC_MSG_CHECKING([whether to do a debug build])
3870 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3871     ENABLE_DEBUG="TRUE"
3872     if test -n "$ENABLE_DBGUTIL" ; then
3873         AC_MSG_RESULT([yes (dbgutil)])
3874     else
3875         AC_MSG_RESULT([yes])
3876     fi
3877 else
3878     ENABLE_DEBUG=""
3879     AC_MSG_RESULT([no])
3881 AC_SUBST(ENABLE_DEBUG)
3883 if test "$enable_split_debug" = yes; then
3884     HAVE_GSPLIT_DWARF=
3885     if test "$GCC" = "yes"; then
3886         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
3887         save_CFLAGS=$CFLAGS
3888         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
3889         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
3890         CFLAGS=$save_CFLAGS
3891         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
3892             AC_MSG_RESULT([yes])
3893         else
3894             AC_MSG_RESULT([no])
3895         fi
3896     fi
3897     AC_SUBST(HAVE_GCC_SPLIT_DWARF)
3900 if test "$enable_sal_log" = yes; then
3901     ENABLE_SAL_LOG=TRUE
3903 AC_SUBST(ENABLE_SAL_LOG)
3905 dnl Selective debuginfo
3906 ENABLE_DEBUGINFO_FOR=
3907 if test -n "$ENABLE_DEBUG"; then
3908     AC_MSG_CHECKING([whether to use selective debuginfo])
3909     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3910         if test "$enable_selective_debuginfo" = "yes"; then
3911             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3912         fi
3913         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3914         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3915     else
3916         ENABLE_DEBUGINFO_FOR=all
3917         AC_MSG_RESULT([no, for all])
3918     fi
3919 else
3920     if test -n "$enable_selective_debuginfo"; then
3921         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3922     fi
3924 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3926 dnl Check for enable symbols option
3927 dnl ===================================================================
3928 AC_MSG_CHECKING([whether to generate debug information])
3929 if test -z "$enable_symbols"; then
3930     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3931         enable_symbols=yes
3932     else
3933         enable_symbols=no
3934     fi
3936 if test "$enable_symbols" != no; then
3937     ENABLE_SYMBOLS=TRUE
3938     AC_MSG_RESULT([yes])
3939 else
3940     ENABLE_SYMBOLS=
3941     AC_MSG_RESULT([no])
3943 AC_SUBST(ENABLE_SYMBOLS)
3945 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3946     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3947     AC_MSG_CHECKING([whether enough memory is available for linking])
3948     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3949     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3950     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3951         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3952     else
3953         AC_MSG_RESULT([yes])
3954     fi
3957 AC_MSG_CHECKING([whether to compile with optimization flags])
3958 if test -z "$enable_optimized"; then
3959     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3960         enable_optimized=no
3961     else
3962         enable_optimized=yes
3963     fi
3965 if test "$enable_optimized" != no; then
3966     ENABLE_OPTIMIZED=TRUE
3967     AC_MSG_RESULT([yes])
3968 else
3969     ENABLE_OPTIMIZED=
3970     AC_MSG_RESULT([no])
3972 AC_SUBST(ENABLE_OPTIMIZED)
3975 # determine CPUNAME, OS, ...
3976 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3978 case "$host_os" in
3980 aix*)
3981     COM=GCC
3982     CPUNAME=POWERPC
3983     USING_X11=TRUE
3984     OS=AIX
3985     RTL_OS=AIX
3986     RTL_ARCH=PowerPC
3987     PLATFORMID=aix_powerpc
3988     P_SEP=:
3989     ;;
3991 cygwin*)
3992     COM=MSC
3993     USING_X11=
3994     OS=WNT
3995     RTL_OS=Windows
3996     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3997         P_SEP=";"
3998     else
3999         P_SEP=:
4000     fi
4001     case "$host_cpu" in
4002     i*86|x86_64)
4003         if test "$BITNESS_OVERRIDE" = 64; then
4004             CPUNAME=X86_64
4005             RTL_ARCH=X86_64
4006             PLATFORMID=windows_x86_64
4007             WINDOWS_X64=1
4008             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4009         else
4010             CPUNAME=INTEL
4011             RTL_ARCH=x86
4012             PLATFORMID=windows_x86
4013         fi
4014         ;;
4015     *)
4016         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4017         ;;
4018     esac
4019     SCPDEFS="$SCPDEFS -D_MSC_VER"
4020     ;;
4022 darwin*)
4023     COM=GCC
4024     USING_X11=
4025     OS=MACOSX
4026     RTL_OS=MacOSX
4027     P_SEP=:
4029     case "$host_cpu" in
4030     arm)
4031         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4032         ;;
4033     arm64)
4034         OS=IOS
4035         if test "$enable_ios_simulator" = "yes"; then
4036             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4037         else
4038             CPUNAME=ARM64
4039             RTL_ARCH=ARM_EABI
4040             PLATFORMID=ios_arm64
4041         fi
4042         ;;
4043     i*86)
4044         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4045         ;;
4046     x86_64)
4047         if test "$enable_ios_simulator" = "yes"; then
4048             OS=IOS
4049         fi
4050         CPUNAME=X86_64
4051         RTL_ARCH=X86_64
4052         PLATFORMID=macosx_x86_64
4053         ;;
4054     *)
4055         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4056         ;;
4057     esac
4058     ;;
4060 dragonfly*)
4061     COM=GCC
4062     USING_X11=TRUE
4063     OS=DRAGONFLY
4064     RTL_OS=DragonFly
4065     P_SEP=:
4067     case "$host_cpu" in
4068     i*86)
4069         CPUNAME=INTEL
4070         RTL_ARCH=x86
4071         PLATFORMID=dragonfly_x86
4072         ;;
4073     x86_64)
4074         CPUNAME=X86_64
4075         RTL_ARCH=X86_64
4076         PLATFORMID=dragonfly_x86_64
4077         ;;
4078     *)
4079         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4080         ;;
4081     esac
4082     ;;
4084 freebsd*)
4085     COM=GCC
4086     USING_X11=TRUE
4087     RTL_OS=FreeBSD
4088     OS=FREEBSD
4089     P_SEP=:
4091     case "$host_cpu" in
4092     i*86)
4093         CPUNAME=INTEL
4094         RTL_ARCH=x86
4095         PLATFORMID=freebsd_x86
4096         ;;
4097     x86_64|amd64)
4098         CPUNAME=X86_64
4099         RTL_ARCH=X86_64
4100         PLATFORMID=freebsd_x86_64
4101         ;;
4102     *)
4103         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4104         ;;
4105     esac
4106     ;;
4108 haiku*)
4109     COM=GCC
4110     USING_X11=
4111     GUIBASE=haiku
4112     RTL_OS=Haiku
4113     OS=HAIKU
4114     P_SEP=:
4116     case "$host_cpu" in
4117     i*86)
4118         CPUNAME=INTEL
4119         RTL_ARCH=x86
4120         PLATFORMID=haiku_x86
4121         ;;
4122     x86_64|amd64)
4123         CPUNAME=X86_64
4124         RTL_ARCH=X86_64
4125         PLATFORMID=haiku_x86_64
4126         ;;
4127     *)
4128         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4129         ;;
4130     esac
4131     ;;
4133 kfreebsd*)
4134     COM=GCC
4135     USING_X11=TRUE
4136     OS=LINUX
4137     RTL_OS=kFreeBSD
4138     P_SEP=:
4140     case "$host_cpu" in
4142     i*86)
4143         CPUNAME=INTEL
4144         RTL_ARCH=x86
4145         PLATFORMID=kfreebsd_x86
4146         ;;
4147     x86_64)
4148         CPUNAME=X86_64
4149         RTL_ARCH=X86_64
4150         PLATFORMID=kfreebsd_x86_64
4151         ;;
4152     *)
4153         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4154         ;;
4155     esac
4156     ;;
4158 linux-gnu*)
4159     COM=GCC
4160     USING_X11=TRUE
4161     OS=LINUX
4162     RTL_OS=Linux
4163     P_SEP=:
4165     case "$host_cpu" in
4167     aarch64)
4168         CPUNAME=AARCH64
4169         PLATFORMID=linux_aarch64
4170         RTL_ARCH=AARCH64
4171         ;;
4172     alpha)
4173         CPUNAME=AXP
4174         RTL_ARCH=ALPHA
4175         PLATFORMID=linux_alpha
4176         ;;
4177     arm*)
4178         CPUNAME=ARM
4179         EPM_FLAGS="-a arm"
4180         RTL_ARCH=ARM_EABI
4181         PLATFORMID=linux_arm_eabi
4182         case "$host_cpu" in
4183         arm*-linux)
4184             RTL_ARCH=ARM_OABI
4185             PLATFORMID=linux_arm_oabi
4186             ;;
4187         esac
4188         ;;
4189     hppa)
4190         CPUNAME=HPPA
4191         RTL_ARCH=HPPA
4192         EPM_FLAGS="-a hppa"
4193         PLATFORMID=linux_hppa
4194         ;;
4195     i*86)
4196         CPUNAME=INTEL
4197         RTL_ARCH=x86
4198         PLATFORMID=linux_x86
4199         ;;
4200     ia64)
4201         CPUNAME=IA64
4202         RTL_ARCH=IA64
4203         PLATFORMID=linux_ia64
4204         ;;
4205     mips)
4206         CPUNAME=GODSON
4207         RTL_ARCH=MIPS_EB
4208         EPM_FLAGS="-a mips"
4209         PLATFORMID=linux_mips_eb
4210         ;;
4211     mips64)
4212         CPUNAME=GODSON64
4213         RTL_ARCH=MIPS64_EB
4214         EPM_FLAGS="-a mips64"
4215         PLATFORMID=linux_mips64_eb
4216         ;;
4217     mips64el)
4218         CPUNAME=GODSON64
4219         RTL_ARCH=MIPS64_EL
4220         EPM_FLAGS="-a mips64el"
4221         PLATFORMID=linux_mips64_el
4222         ;;
4223     mipsel)
4224         CPUNAME=GODSON
4225         RTL_ARCH=MIPS_EL
4226         EPM_FLAGS="-a mipsel"
4227         PLATFORMID=linux_mips_el
4228         ;;
4229     m68k)
4230         CPUNAME=M68K
4231         RTL_ARCH=M68K
4232         PLATFORMID=linux_m68k
4233         ;;
4234     powerpc)
4235         CPUNAME=POWERPC
4236         RTL_ARCH=PowerPC
4237         PLATFORMID=linux_powerpc
4238         ;;
4239     powerpc64)
4240         CPUNAME=POWERPC64
4241         RTL_ARCH=PowerPC_64
4242         PLATFORMID=linux_powerpc64
4243         ;;
4244     powerpc64le)
4245         CPUNAME=POWERPC64
4246         RTL_ARCH=PowerPC_64_LE
4247         PLATFORMID=linux_powerpc64_le
4248         ;;
4249     sparc)
4250         CPUNAME=SPARC
4251         RTL_ARCH=SPARC
4252         PLATFORMID=linux_sparc
4253         ;;
4254     sparc64)
4255         CPUNAME=SPARC64
4256         RTL_ARCH=SPARC64
4257         PLATFORMID=linux_sparc64
4258         ;;
4259     s390)
4260         CPUNAME=S390
4261         RTL_ARCH=S390
4262         PLATFORMID=linux_s390
4263         ;;
4264     s390x)
4265         CPUNAME=S390X
4266         RTL_ARCH=S390x
4267         PLATFORMID=linux_s390x
4268         ;;
4269     x86_64)
4270         CPUNAME=X86_64
4271         RTL_ARCH=X86_64
4272         PLATFORMID=linux_x86_64
4273         ;;
4274     *)
4275         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4276         ;;
4277     esac
4278     ;;
4280 linux-android*)
4281     COM=GCC
4282     USING_X11=
4283     OS=ANDROID
4284     RTL_OS=Android
4285     P_SEP=:
4287     case "$host_cpu" in
4289     arm|armel)
4290         CPUNAME=ARM
4291         RTL_ARCH=ARM_EABI
4292         PLATFORMID=android_arm_eabi
4293         ;;
4294     aarch64)
4295         CPUNAME=AARCH64
4296         RTL_ARCH=AARCH64
4297         PLATFORMID=android_aarch64
4298         ;;
4299     mips|mipsel)
4300         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4301         RTL_ARCH=MIPS_EL
4302         PLATFORMID=android_mips_el
4303         ;;
4304     i*86)
4305         CPUNAME=INTEL
4306         RTL_ARCH=x86
4307         PLATFORMID=android_x86
4308         ;;
4309     *)
4310         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4311         ;;
4312     esac
4313     ;;
4315 *netbsd*)
4316     COM=GCC
4317     USING_X11=TRUE
4318     OS=NETBSD
4319     RTL_OS=NetBSD
4320     P_SEP=:
4322     case "$host_cpu" in
4323     i*86)
4324         CPUNAME=INTEL
4325         RTL_ARCH=x86
4326         PLATFORMID=netbsd_x86
4327         ;;
4328     powerpc)
4329         CPUNAME=POWERPC
4330         RTL_ARCH=PowerPC
4331         PLATFORMID=netbsd_powerpc
4332         ;;
4333     sparc)
4334         CPUNAME=SPARC
4335         RTL_ARCH=SPARC
4336         PLATFORMID=netbsd_sparc
4337         ;;
4338     x86_64)
4339         CPUNAME=X86_64
4340         RTL_ARCH=X86_64
4341         PLATFORMID=netbsd_x86_64
4342         ;;
4343     *)
4344         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4345         ;;
4346     esac
4347     ;;
4349 openbsd*)
4350     COM=GCC
4351     USING_X11=TRUE
4352     OS=OPENBSD
4353     RTL_OS=OpenBSD
4354     P_SEP=:
4356     case "$host_cpu" in
4357     i*86)
4358         CPUNAME=INTEL
4359         RTL_ARCH=x86
4360         PLATFORMID=openbsd_x86
4361         ;;
4362     x86_64)
4363         CPUNAME=X86_64
4364         RTL_ARCH=X86_64
4365         PLATFORMID=openbsd_x86_64
4366         ;;
4367     *)
4368         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4369         ;;
4370     esac
4371     SOLARINC="$SOLARINC -I/usr/local/include"
4372     ;;
4374 solaris*)
4375     COM=GCC
4376     USING_X11=TRUE
4377     OS=SOLARIS
4378     RTL_OS=Solaris
4379     P_SEP=:
4381     case "$host_cpu" in
4382     i*86)
4383         CPUNAME=INTEL
4384         RTL_ARCH=x86
4385         PLATFORMID=solaris_x86
4386         ;;
4387     sparc)
4388         CPUNAME=SPARC
4389         RTL_ARCH=SPARC
4390         PLATFORMID=solaris_sparc
4391         ;;
4392     sparc64)
4393         CPUNAME=SPARC64
4394         RTL_ARCH=SPARC64
4395         PLATFORMID=solaris_sparc64
4396         ;;
4397     *)
4398         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4399         ;;
4400     esac
4401     SOLARINC="$SOLARINC -I/usr/local/include"
4402     ;;
4405     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4406     ;;
4407 esac
4409 if test "$with_x" = "no"; then
4410     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4413 DISABLE_GUI=""
4414 if test "$enable_gui" = "no"; then
4415     if test "$USING_X11" != TRUE; then
4416         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4417     fi
4418     USING_X11=
4419     DISABLE_GUI=TRUE
4420     AC_DEFINE(HAVE_FEATURE_UI,0)
4421     test_cairo=yes
4423 AC_SUBST(DISABLE_GUI)
4425 WORKDIR="${BUILDDIR}/workdir"
4426 INSTDIR="${BUILDDIR}/instdir"
4427 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4428 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4429 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4430 AC_SUBST(COM)
4431 AC_SUBST(CPUNAME)
4432 AC_SUBST(RTL_OS)
4433 AC_SUBST(RTL_ARCH)
4434 AC_SUBST(EPM_FLAGS)
4435 AC_SUBST(USING_X11)
4436 AC_SUBST([INSTDIR])
4437 AC_SUBST([INSTROOT])
4438 AC_SUBST([INSTROOTBASE])
4439 AC_SUBST(OS)
4440 AC_SUBST(P_SEP)
4441 AC_SUBST(WORKDIR)
4442 AC_SUBST(PLATFORMID)
4443 AC_SUBST(WINDOWS_X64)
4444 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4446 dnl ===================================================================
4447 dnl Test which package format to use
4448 dnl ===================================================================
4449 AC_MSG_CHECKING([which package format to use])
4450 if test -n "$with_package_format" -a "$with_package_format" != no; then
4451     for i in $with_package_format; do
4452         case "$i" in
4453         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4454             ;;
4455         *)
4456             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4457 aix - AIX software distribution
4458 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4459 deb - Debian software distribution
4460 pkg - Solaris software distribution
4461 rpm - RedHat software distribution
4463 LibreOffice additionally supports:
4464 archive - .tar.gz or .zip
4465 dmg - Mac OS X .dmg
4466 installed - installation tree
4467 msi - Windows .msi
4468         ])
4469             ;;
4470         esac
4471     done
4472     # fakeroot is needed to ensure correct file ownerships/permissions
4473     # inside deb packages and tar archives created on Linux and Solaris.
4474     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4475         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4476         if test "$FAKEROOT" = "no"; then
4477             AC_MSG_ERROR(
4478                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4479         fi
4480     fi
4481     PKGFORMAT="$with_package_format"
4482     AC_MSG_RESULT([$PKGFORMAT])
4483 else
4484     PKGFORMAT=
4485     AC_MSG_RESULT([none])
4487 AC_SUBST(PKGFORMAT)
4489 dnl ===================================================================
4490 dnl Set up a different compiler to produce tools to run on the build
4491 dnl machine when doing cross-compilation
4492 dnl ===================================================================
4494 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4495 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4496 if test "$cross_compiling" = "yes"; then
4497     AC_MSG_CHECKING([for BUILD platform configuration])
4498     echo
4499     rm -rf CONF-FOR-BUILD config_build.mk
4500     mkdir CONF-FOR-BUILD
4501     # Here must be listed all files needed when running the configure script. In particular, also
4502     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4503     # keep them in the same order as there.
4504     (cd $SRC_ROOT && tar cf - \
4505         config.guess \
4506         bin/get_config_variables \
4507         solenv/bin/getcompver.awk \
4508         solenv/inc/langlist.mk \
4509         download.lst \
4510         config_host.mk.in \
4511         config_host_lang.mk.in \
4512         Makefile.in \
4513         lo.xcent.in \
4514         bin/bffvalidator.sh.in \
4515         bin/odfvalidator.sh.in \
4516         bin/officeotron.sh.in \
4517         instsetoo_native/util/openoffice.lst.in \
4518         config_host/*.in \
4519         sysui/desktop/macosx/Info.plist.in) \
4520     | (cd CONF-FOR-BUILD && tar xf -)
4521     cp configure CONF-FOR-BUILD
4522     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4523     (
4524     unset COM USING_X11 OS CPUNAME
4525     unset CC CXX SYSBASE CFLAGS
4526     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4527     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4528     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4529     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4530     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4531     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4532     cd CONF-FOR-BUILD
4533     sub_conf_opts=""
4534     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4535     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4536     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4537     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4538     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4539     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4540     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4541     # Don't bother having configure look for stuff not needed for the build platform anyway
4542     ./configure \
4543         --disable-cups \
4544         --disable-gtk3 \
4545         --disable-pdfimport \
4546         --disable-postgresql-sdbc \
4547         --with-parallelism="$with_parallelism" \
4548         --without-doxygen \
4549         --without-java \
4550         $sub_conf_opts \
4551         --srcdir=$srcdir \
4552         2>&1 | sed -e 's/^/    /'
4553     test -f ./config_host.mk 2>/dev/null || exit
4554     cp config_host.mk ../config_build.mk
4555     cp config_host_lang.mk ../config_build_lang.mk
4556     mv config.log ../config.Build.log
4557     mkdir -p ../config_build
4558     mv config_host/*.h ../config_build
4559     . ./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
4561     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
4562         VV='$'$V
4563         VV=`eval "echo $VV"`
4564         if test -n "$VV"; then
4565             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4566             echo "$line" >>build-config
4567         fi
4568     done
4570     for V in INSTDIR INSTROOT WORKDIR; do
4571         VV='$'$V
4572         VV=`eval "echo $VV"`
4573         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4574         if test -n "$VV"; then
4575             line="${V}_FOR_BUILD='$VV'"
4576             echo "$line" >>build-config
4577         fi
4578     done
4580     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4581     echo "$line" >>build-config
4583     )
4584     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4585     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])
4586     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4587              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4589     eval `cat CONF-FOR-BUILD/build-config`
4591     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4593     rm -rf CONF-FOR-BUILD
4594 else
4595     OS_FOR_BUILD="$OS"
4596     CC_FOR_BUILD="$CC"
4597     CXX_FOR_BUILD="$CXX"
4598     INSTDIR_FOR_BUILD="$INSTDIR"
4599     INSTROOT_FOR_BUILD="$INSTROOT"
4600     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4601     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4602     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4603     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4604     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4605     WORKDIR_FOR_BUILD="$WORKDIR"
4607 AC_SUBST(OS_FOR_BUILD)
4608 AC_SUBST(INSTDIR_FOR_BUILD)
4609 AC_SUBST(INSTROOT_FOR_BUILD)
4610 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4611 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4612 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4613 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4614 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4615 AC_SUBST(WORKDIR_FOR_BUILD)
4617 dnl ===================================================================
4618 dnl Check for syslog header
4619 dnl ===================================================================
4620 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4622 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4623 dnl ===================================================================
4624 AC_MSG_CHECKING([whether to turn warnings to errors])
4625 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4626     ENABLE_WERROR="TRUE"
4627     AC_MSG_RESULT([yes])
4628 else
4629     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4630         ENABLE_WERROR="TRUE"
4631         AC_MSG_RESULT([yes])
4632     else
4633         AC_MSG_RESULT([no])
4634     fi
4636 AC_SUBST(ENABLE_WERROR)
4638 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4639 dnl ===================================================================
4640 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4641 if test -z "$enable_assert_always_abort"; then
4642    if test "$ENABLE_DEBUG" = TRUE; then
4643        enable_assert_always_abort=yes
4644    else
4645        enable_assert_always_abort=no
4646    fi
4648 if test "$enable_assert_always_abort" = "yes"; then
4649     ASSERT_ALWAYS_ABORT="TRUE"
4650     AC_MSG_RESULT([yes])
4651 else
4652     ASSERT_ALWAYS_ABORT="FALSE"
4653     AC_MSG_RESULT([no])
4655 AC_SUBST(ASSERT_ALWAYS_ABORT)
4657 # Determine whether to use ooenv for the instdir installation
4658 # ===================================================================
4659 if test $_os != "WINNT" -a $_os != "Darwin"; then
4660     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4661     if test "$enable_ooenv" = "no"; then
4662         AC_MSG_RESULT([no])
4663     else
4664         ENABLE_OOENV="TRUE"
4665         AC_MSG_RESULT([yes])
4666     fi
4668 AC_SUBST(ENABLE_OOENV)
4670 if test "$USING_X11" != TRUE; then
4671     # be sure to do not mess with unneeded stuff
4672     test_randr=no
4673     test_xrender=no
4674     test_cups=no
4675     test_dbus=no
4676     test_gtk=no
4677     build_gstreamer_1_0=no
4678     build_gstreamer_0_10=no
4679     test_kde4=no
4680     test_kde5=no
4681     test_qt5=no
4682     test_gtk3_kde5=no
4683     enable_cairo_canvas=no
4686 if test "$OS" = "HAIKU"; then
4687     enable_cairo_canvas=yes
4688     test_kde5=yes
4691 if test "$test_kde5" = "yes"; then
4692     test_qt5=yes
4695 if test "$test_kde5" = "yes" -a  "$enable_kde5" = "yes"; then
4696     if test "$enable_qt5" = "no"; then
4697         AC_MSG_ERROR([KDE5 support depends on QT5, so it conflicts with --disable-qt5])
4698     else
4699         enable_qt5=yes
4700     fi
4703 dnl ===================================================================
4704 dnl check for cups support
4705 dnl ===================================================================
4706 ENABLE_CUPS=""
4708 if test "$enable_cups" = "no"; then
4709     test_cups=no
4712 AC_MSG_CHECKING([whether to enable CUPS support])
4713 if test "$test_cups" = "yes"; then
4714     ENABLE_CUPS="TRUE"
4715     AC_MSG_RESULT([yes])
4717     AC_MSG_CHECKING([whether cups support is present])
4718     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4719     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4720     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4721         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4722     fi
4724 else
4725     AC_MSG_RESULT([no])
4728 AC_SUBST(ENABLE_CUPS)
4730 # fontconfig checks
4731 if test "$test_fontconfig" = "yes"; then
4732     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4733     SYSTEM_FONTCONFIG=TRUE
4734     FilterLibs "${FONTCONFIG_LIBS}"
4735     FONTCONFIG_LIBS="${filteredlibs}"
4737 AC_SUBST(FONTCONFIG_CFLAGS)
4738 AC_SUBST(FONTCONFIG_LIBS)
4739 AC_SUBST([SYSTEM_FONTCONFIG])
4741 dnl whether to find & fetch external tarballs?
4742 dnl ===================================================================
4743 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4744    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4745        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4746    else
4747        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4748    fi
4750 if test -z "$TARFILE_LOCATION"; then
4751     if test -d "$SRC_ROOT/src" ; then
4752         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4753         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4754     fi
4755     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4756 else
4757     AbsolutePath "$TARFILE_LOCATION"
4758     PathFormat "${absolute_path}"
4759     TARFILE_LOCATION="${formatted_path}"
4761 AC_SUBST(TARFILE_LOCATION)
4763 AC_MSG_CHECKING([whether we want to fetch tarballs])
4764 if test "$enable_fetch_external" != "no"; then
4765     if test "$with_all_tarballs" = "yes"; then
4766         AC_MSG_RESULT([yes, all of them])
4767         DO_FETCH_TARBALLS="ALL"
4768     else
4769         AC_MSG_RESULT([yes, if we use them])
4770         DO_FETCH_TARBALLS="TRUE"
4771     fi
4772 else
4773     AC_MSG_RESULT([no])
4774     DO_FETCH_TARBALLS=
4776 AC_SUBST(DO_FETCH_TARBALLS)
4778 AC_MSG_CHECKING([whether to build help])
4779 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4780     BUILD_TYPE="$BUILD_TYPE HELP"
4781     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4782     case "$with_help" in
4783     "html")
4784         ENABLE_HTMLHELP=TRUE
4785         SCPDEFS="$SCPDEFS -DWITH_HELP"
4786         AC_MSG_RESULT([HTML])
4787         ;;
4788     "online")
4789         ENABLE_HTMLHELP=TRUE
4790         HELP_ONLINE=TRUE
4791         AC_MSG_RESULT([HTML])
4792         ;;
4793     yes)
4794         SCPDEFS="$SCPDEFS -DWITH_HELP"
4795         AC_MSG_RESULT([yes])
4796         ;;
4797     *)
4798         AC_MSG_ERROR([Unknown --with-help=$with_help])
4799         ;;
4800     esac
4801 else
4802     AC_MSG_RESULT([no])
4804 AC_SUBST([ENABLE_HTMLHELP])
4805 AC_SUBST([HELP_ONLINE])
4807 dnl Test whether to include MySpell dictionaries
4808 dnl ===================================================================
4809 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4810 if test "$with_myspell_dicts" = "yes"; then
4811     AC_MSG_RESULT([yes])
4812     WITH_MYSPELL_DICTS=TRUE
4813     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4814     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4815 else
4816     AC_MSG_RESULT([no])
4817     WITH_MYSPELL_DICTS=
4819 AC_SUBST(WITH_MYSPELL_DICTS)
4821 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4822 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4823     if test "$with_system_dicts" = yes; then
4824         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4825     fi
4826     with_system_dicts=no
4829 AC_MSG_CHECKING([whether to use dicts from external paths])
4830 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4831     AC_MSG_RESULT([yes])
4832     SYSTEM_DICTS=TRUE
4833     AC_MSG_CHECKING([for spelling dictionary directory])
4834     if test -n "$with_external_dict_dir"; then
4835         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4836     else
4837         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4838         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4839             DICT_SYSTEM_DIR=file:///usr/share/myspell
4840         fi
4841     fi
4842     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4843     AC_MSG_CHECKING([for hyphenation patterns directory])
4844     if test -n "$with_external_hyph_dir"; then
4845         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4846     else
4847         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4848     fi
4849     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4850     AC_MSG_CHECKING([for thesaurus directory])
4851     if test -n "$with_external_thes_dir"; then
4852         THES_SYSTEM_DIR=file://$with_external_thes_dir
4853     else
4854         THES_SYSTEM_DIR=file:///usr/share/mythes
4855     fi
4856     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4857 else
4858     AC_MSG_RESULT([no])
4859     SYSTEM_DICTS=
4861 AC_SUBST(SYSTEM_DICTS)
4862 AC_SUBST(DICT_SYSTEM_DIR)
4863 AC_SUBST(HYPH_SYSTEM_DIR)
4864 AC_SUBST(THES_SYSTEM_DIR)
4866 dnl ===================================================================
4867 dnl enable pch by default on windows
4868 dnl enable it explicitly otherwise
4869 ENABLE_PCH=""
4870 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4871     if test -z "$libo_fuzzed_enable_pch"; then
4872         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4873     else
4874         AC_MSG_NOTICE([Resetting --enable-pch=no])
4875         enable_pch=no
4876     fi
4879 AC_MSG_CHECKING([whether to enable pch feature])
4880 if test "$enable_pch" != "no"; then
4881     if test "$_os" = "WINNT"; then
4882         ENABLE_PCH="TRUE"
4883         AC_MSG_RESULT([yes])
4884     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4885         ENABLE_PCH="TRUE"
4886         AC_MSG_RESULT([yes])
4887     elif test -n "$enable_pch"; then
4888         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4889     else
4890         AC_MSG_RESULT([no])
4891     fi
4892 else
4893     AC_MSG_RESULT([no])
4895 AC_SUBST(ENABLE_PCH)
4897 TAB=`printf '\t'`
4899 AC_MSG_CHECKING([the GNU Make version])
4900 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4901 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4902 if test "$_make_longver" -ge "038200"; then
4903     AC_MSG_RESULT([$GNUMAKE $_make_version])
4905 elif test "$_make_longver" -ge "038100"; then
4906     if test "$build_os" = "cygwin"; then
4907         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4908     fi
4909     AC_MSG_RESULT([$GNUMAKE $_make_version])
4911     dnl ===================================================================
4912     dnl Search all the common names for sha1sum
4913     dnl ===================================================================
4914     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4915     if test -z "$SHA1SUM"; then
4916         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4917     elif test "$SHA1SUM" = "openssl"; then
4918         SHA1SUM="openssl sha1"
4919     fi
4920     AC_MSG_CHECKING([for GNU Make bug 20033])
4921     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4922     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4923 A := \$(wildcard *.a)
4925 .PHONY: all
4926 all: \$(A:.a=.b)
4927 <TAB>@echo survived bug20033.
4929 .PHONY: setup
4930 setup:
4931 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4933 define d1
4934 @echo lala \$(1)
4935 @sleep 1
4936 endef
4938 define d2
4939 @echo tyty \$(1)
4940 @sleep 1
4941 endef
4943 %.b : %.a
4944 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4945 <TAB>\$(call d1,\$(CHECKSUM)),\
4946 <TAB>\$(call d2,\$(CHECKSUM)))
4948     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4949         no_parallelism_make="YES"
4950         AC_MSG_RESULT([yes, disable parallelism])
4951     else
4952         AC_MSG_RESULT([no, keep parallelism enabled])
4953     fi
4954     rm -rf $TESTGMAKEBUG20033
4955 else
4956     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4959 # find if gnumake support file function
4960 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4961 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4962 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4963     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4965 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4966 \$(file >test.txt,Success )
4968 .PHONY: all
4969 all:
4970 <TAB>@cat test.txt
4973 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4974 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4975     HAVE_GNUMAKE_FILE_FUNC=TRUE
4976     AC_MSG_RESULT([yes])
4977 else
4978     AC_MSG_RESULT([no])
4980 rm -rf $TESTGMAKEFILEFUNC
4981 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4982 AC_SUBST(GNUMAKE_WIN_NATIVE)
4984 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4985 STALE_MAKE=
4986 if test "$_make_ver_check" = ""; then
4987    STALE_MAKE=TRUE
4990 HAVE_LD_HASH_STYLE=FALSE
4991 WITH_LINKER_HASH_STYLE=
4992 AC_MSG_CHECKING([for --hash-style gcc linker support])
4993 if test "$GCC" = "yes"; then
4994     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4995         hash_styles="gnu sysv"
4996     elif test "$with_linker_hash_style" = "no"; then
4997         hash_styles=
4998     else
4999         hash_styles="$with_linker_hash_style"
5000     fi
5002     for hash_style in $hash_styles; do
5003         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5004         hash_style_ldflags_save=$LDFLAGS
5005         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5007         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5008             [
5009 #include <stdio.h>
5010             ],[
5011 printf ("");
5012             ])],
5013             [
5014                   HAVE_LD_HASH_STYLE=TRUE
5015                   WITH_LINKER_HASH_STYLE=$hash_style
5016             ],
5017             [HAVE_LD_HASH_STYLE=FALSE],
5018             [HAVE_LD_HASH_STYLE=FALSE])
5019         LDFLAGS=$hash_style_ldflags_save
5020     done
5022     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5023         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5024     else
5025         AC_MSG_RESULT( no )
5026     fi
5027     LDFLAGS=$hash_style_ldflags_save
5028 else
5029     AC_MSG_RESULT( no )
5031 AC_SUBST(HAVE_LD_HASH_STYLE)
5032 AC_SUBST(WITH_LINKER_HASH_STYLE)
5034 dnl ===================================================================
5035 dnl Check whether there's a Perl version available.
5036 dnl ===================================================================
5037 if test -z "$with_perl_home"; then
5038     AC_PATH_PROG(PERL, perl)
5039 else
5040     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5041     _perl_path="$with_perl_home/bin/perl"
5042     if test -x "$_perl_path"; then
5043         PERL=$_perl_path
5044     else
5045         AC_MSG_ERROR([$_perl_path not found])
5046     fi
5049 dnl ===================================================================
5050 dnl Testing for Perl version 5 or greater.
5051 dnl $] is the Perl version variable, it is returned as an integer
5052 dnl ===================================================================
5053 if test "$PERL"; then
5054     AC_MSG_CHECKING([the Perl version])
5055     ${PERL} -e "exit($]);"
5056     _perl_version=$?
5057     if test "$_perl_version" -lt 5; then
5058         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5059     fi
5060     AC_MSG_RESULT([Perl $_perl_version])
5061 else
5062     AC_MSG_ERROR([Perl not found, install Perl 5])
5065 dnl ===================================================================
5066 dnl Testing for required Perl modules
5067 dnl ===================================================================
5069 AC_MSG_CHECKING([for required Perl modules])
5070 perl_use_string="use Cwd ; use Digest::MD5"
5071 if test "$_os" = "WINNT"; then
5072     if test -n "$PKGFORMAT"; then
5073         for i in $PKGFORMAT; do
5074             case "$i" in
5075             msi)
5076                 # for getting fonts versions to use in MSI
5077                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5078                 ;;
5079             esac
5080         done
5081     fi
5083 if test "$with_system_hsqldb" = "yes"; then
5084         perl_use_string="$perl_use_string ; use Archive::Zip"
5086 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5087     AC_MSG_RESULT([all modules found])
5088 else
5089     AC_MSG_RESULT([failed to find some modules])
5090     # Find out which modules are missing.
5091     for i in $perl_use_string; do
5092         if test "$i" != "use" -a "$i" != ";"; then
5093             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5094                 missing_perl_modules="$missing_perl_modules $i"
5095             fi
5096         fi
5097     done
5098     AC_MSG_ERROR([
5099     The missing Perl modules are: $missing_perl_modules
5100     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5103 dnl ===================================================================
5104 dnl Check for pkg-config
5105 dnl ===================================================================
5106 if test "$_os" != "WINNT"; then
5107     PKG_PROG_PKG_CONFIG
5110 if test "$_os" != "WINNT"; then
5112     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5113     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5114     # explicitly. Or put /path/to/compiler in PATH yourself.
5116     # Use wrappers for LTO
5117     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5118         AC_CHECK_TOOL(AR,gcc-ar)
5119         AC_CHECK_TOOL(NM,gcc-nm)
5120         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5121     else
5122         AC_CHECK_TOOL(AR,ar)
5123         AC_CHECK_TOOL(NM,nm)
5124         AC_CHECK_TOOL(RANLIB,ranlib)
5125     fi
5126     AC_CHECK_TOOL(OBJDUMP,objdump)
5127     AC_CHECK_TOOL(READELF,readelf)
5128     AC_CHECK_TOOL(STRIP,strip)
5129     if test "$_os" = "WINNT"; then
5130         AC_CHECK_TOOL(DLLTOOL,dlltool)
5131         AC_CHECK_TOOL(WINDRES,windres)
5132     fi
5134 AC_SUBST(AR)
5135 AC_SUBST(DLLTOOL)
5136 AC_SUBST(NM)
5137 AC_SUBST(OBJDUMP)
5138 AC_SUBST(PKG_CONFIG)
5139 AC_SUBST(RANLIB)
5140 AC_SUBST(READELF)
5141 AC_SUBST(STRIP)
5142 AC_SUBST(WINDRES)
5144 dnl ===================================================================
5145 dnl pkg-config checks on Mac OS X
5146 dnl ===================================================================
5148 if test $_os = Darwin; then
5149     AC_MSG_CHECKING([for bogus pkg-config])
5150     if test -n "$PKG_CONFIG"; then
5151         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5152             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5153         else
5154             if test "$enable_bogus_pkg_config" = "yes"; then
5155                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5156             else
5157                 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.])
5158             fi
5159         fi
5160     else
5161         AC_MSG_RESULT([no, good])
5162     fi
5165 find_csc()
5167     # Return value: $csctest
5169     unset csctest
5171     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5172     if test -n "$regvalue"; then
5173         csctest=$regvalue
5174         return
5175     fi
5178 find_al()
5180     # Return value: $altest
5182     unset altest
5184     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5185         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5186         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5187             altest=$regvalue
5188             return
5189         fi
5190     done
5192     # We need this additional check to detect 4.6.1 or above.
5193     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5194         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5195         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5196             altest=$regvalue
5197             return
5198         fi
5200         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5201         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5202             altest=$regvalue
5203             return
5204         fi
5205     done
5208 find_dotnetsdk46()
5210     unset frametest
5212     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5213         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5214         if test -n "$regvalue"; then
5215             frametest=$regvalue
5216             return
5217         fi
5218         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5219         if test -n "$regvalue"; then
5220             frametest=$regvalue
5221             return
5222         fi
5223     done
5226 find_winsdk_version()
5228     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5229     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5231     unset winsdktest winsdkbinsubdir winsdklibsubdir
5233     case "$1" in
5234     7.*)
5235         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5236         if test -n "$regvalue"; then
5237             winsdktest=$regvalue
5238             winsdklibsubdir=.
5239             return
5240         fi
5241         ;;
5242     8.0|8.0A)
5243         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5244         if test -n "$regvalue"; then
5245             winsdktest=$regvalue
5246             winsdklibsubdir=win8
5247             return
5248         fi
5249         ;;
5250     8.1|8.1A)
5251         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5252         if test -n "$regvalue"; then
5253             winsdktest=$regvalue
5254             winsdklibsubdir=winv6.3
5255             return
5256         fi
5257         ;;
5258     10.0)
5259         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5260         if test -n "$regvalue"; then
5261             winsdktest=$regvalue
5262             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5263             if test -n "$regvalue"; then
5264                 winsdkbinsubdir="$regvalue".0
5265                 winsdklibsubdir=$winsdkbinsubdir
5266                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5267                 # test exist the SDK path
5268                 if test -d "$tmppath"; then
5269                    # when path is convertible to a short path then path is okay
5270                    if ! cygpath -d "$tmppath"; then
5271                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5272                    fi
5273                 else
5274                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5275                 fi
5276             fi
5277             return
5278         fi
5279         ;;
5280     esac
5283 find_winsdk()
5285     # Return value: From find_winsdk_version
5287     unset winsdktest
5289     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5290         find_winsdk_version $ver
5291         if test -n "$winsdktest"; then
5292             return
5293         fi
5294     done
5297 find_msms()
5299     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5300     if test $VCVER = 150; then
5301         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5302     fi
5303     AC_MSG_CHECKING([for ${my_msm_files}])
5304     msmdir=
5305     for ver in 14.0 15.0; do
5306         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5307         if test -n "$regvalue"; then
5308             for f in ${my_msm_files}; do
5309                 if test -e "$regvalue/${f}"; then
5310                     msmdir=$regvalue
5311                     break
5312                 fi
5313             done
5314         fi
5315     done
5316     dnl Is the following fallback really necessary, or was it added in response
5317     dnl to never having started Visual Studio on a given machine, so the
5318     dnl registry keys checked above had presumably not yet been created?
5319     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5320     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5321     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5322     dnl expanding to "C:\Program Files\Common Files"), which would need
5323     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5324     dnl obtain its value from cygwin:
5325     if test -z "$msmdir"; then
5326         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5327         for f in ${my_msm_files}; do
5328             if test -e "$my_msm_dir/${f}"; then
5329                 msmdir=$my_msm_dir
5330             fi
5331         done
5332     fi
5334     dnl Starting from MSVC 15.0, merge modules are located in different directory
5335     if test $VCVER = 150; then
5336         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5337             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5338             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5339             for f in ${my_msm_files}; do
5340                 if test -e "$my_msm_dir/${f}"; then
5341                     msmdir=$my_msm_dir
5342                     break
5343                 fi
5344             done
5345         done
5346     fi
5348     if test -n "$msmdir"; then
5349         msmdir=`cygpath -m "$msmdir"`
5350         AC_MSG_RESULT([$msmdir])
5351     else
5352         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5353             AC_MSG_ERROR([not found])
5354         else
5355             AC_MSG_WARN([not found])
5356             add_warning "MSM none of ${my_msm_files} found"
5357         fi
5358     fi
5361 find_msvc_x64_dlls()
5363     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5364     if test "$VCVER" = 150; then
5365         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5366             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5367             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5368                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5369                 break
5370             fi
5371             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5372                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5373                 break
5374             fi
5375         done
5376     fi
5377     msvcdlls="msvcp140.dll vcruntime140.dll"
5378     for dll in $msvcdlls; do
5379         if ! test -f "$msvcdllpath/$dll"; then
5380             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5381         fi
5382     done
5385 dnl =========================================
5386 dnl Check for the Windows  SDK.
5387 dnl =========================================
5388 if test "$_os" = "WINNT"; then
5389     AC_MSG_CHECKING([for Windows SDK])
5390     if test "$build_os" = "cygwin"; then
5391         find_winsdk
5392         WINDOWS_SDK_HOME=$winsdktest
5394         # normalize if found
5395         if test -n "$WINDOWS_SDK_HOME"; then
5396             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5397             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5398         fi
5400         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5401     fi
5403     if test -n "$WINDOWS_SDK_HOME"; then
5404         # Remove a possible trailing backslash
5405         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5407         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5408              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5409              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5410             have_windows_sdk_headers=yes
5411         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5412              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5413              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5414             have_windows_sdk_headers=yes
5415         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5416              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5417              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5418             have_windows_sdk_headers=yes
5419         else
5420             have_windows_sdk_headers=no
5421         fi
5423         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5424             have_windows_sdk_libs=yes
5425         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5426             have_windows_sdk_libs=yes
5427         else
5428             have_windows_sdk_libs=no
5429         fi
5431         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5432             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5433 the  Windows SDK are installed.])
5434         fi
5435     fi
5437     if test -z "$WINDOWS_SDK_HOME"; then
5438         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5439     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5440         WINDOWS_SDK_VERSION=70
5441         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5442     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5443         WINDOWS_SDK_VERSION=80
5444         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5445     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5446         WINDOWS_SDK_VERSION=81
5447         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5448     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5449         WINDOWS_SDK_VERSION=10
5450         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5451     else
5452         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5453     fi
5454     PathFormat "$WINDOWS_SDK_HOME"
5455     WINDOWS_SDK_HOME="$formatted_path"
5456     if test "$build_os" = "cygwin"; then
5457         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5458         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5459             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5460         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5461             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5462         fi
5463     fi
5465     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5466     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5467     dnl but not in v8.0), so allow this to be overridden with a
5468     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5469     dnl and configuration error if no WiLangId.vbs is found would arguably be
5470     dnl better, but I do not know under which conditions exactly it is needed by
5471     dnl msiglobal.pm:
5472     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5473         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5474         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5475             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5476         fi
5477         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5478             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5479         fi
5480         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5481             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5482         fi
5483     fi
5484     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5485         if test -n "$with_package_format" -a "$with_package_format" != no; then
5486             for i in "$with_package_format"; do
5487                 if test "$i" = "msi"; then
5488                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5489                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5490                     fi
5491                 fi
5492             done
5493         fi
5494     fi
5496 AC_SUBST(WINDOWS_SDK_HOME)
5497 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5498 AC_SUBST(WINDOWS_SDK_VERSION)
5499 AC_SUBST(WINDOWS_SDK_WILANGID)
5501 if test "$build_os" = "cygwin"; then
5502     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5503     dnl dir, it also determines that dir's path w/o an arch segment if any,
5504     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5505     AC_MSG_CHECKING([for midl.exe])
5507     find_winsdk
5508     if test -n "$winsdkbinsubdir" \
5509         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5510     then
5511         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5512         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5513     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5514         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5515         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5516     elif test -f "$winsdktest/Bin/midl.exe"; then
5517         MIDL_PATH=$winsdktest/Bin
5518         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5519     fi
5520     if test ! -f "$MIDL_PATH/midl.exe"; then
5521         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5522     else
5523         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5524     fi
5526     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5527     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5529     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5530          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5531          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5532          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5533     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5534          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5535          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5536          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5537     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5538          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5539          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5540          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5541     else
5542         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5543     fi
5545     dnl Check csc.exe
5546     AC_MSG_CHECKING([for csc.exe])
5547     find_csc
5548     if test -f "$csctest/csc.exe"; then
5549         CSC_PATH="$csctest"
5550     fi
5551     if test ! -f "$CSC_PATH/csc.exe"; then
5552         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5553     else
5554         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5555     fi
5557     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5559     dnl Check al.exe
5560     AC_MSG_CHECKING([for al.exe])
5561     find_winsdk
5562     if test -n "$winsdkbinsubdir" \
5563         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5564     then
5565         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5566     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5567         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5568     elif test -f "$winsdktest/Bin/al.exe"; then
5569         AL_PATH="$winsdktest/Bin"
5570     fi
5572     if test -z "$AL_PATH"; then
5573         find_al
5574         if test -f "$altest/bin/al.exe"; then
5575             AL_PATH="$altest/bin"
5576         elif test -f "$altest/al.exe"; then
5577             AL_PATH="$altest"
5578         fi
5579     fi
5580     if test ! -f "$AL_PATH/al.exe"; then
5581         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5582     else
5583         AC_MSG_RESULT([$AL_PATH/al.exe])
5584     fi
5586     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5588     dnl Check mscoree.lib / .NET Framework dir
5589     AC_MSG_CHECKING(.NET Framework)
5590     find_dotnetsdk46
5591     PathFormat "$frametest"
5592     frametest="$formatted_path"
5593     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5594         DOTNET_FRAMEWORK_HOME="$frametest"
5595     else
5596         find_winsdk
5597         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5598             DOTNET_FRAMEWORK_HOME="$winsdktest"
5599         fi
5600     fi
5601     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
5602         AC_MSG_ERROR([mscoree.lib not found])
5603     fi
5604     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5606     PathFormat "$MIDL_PATH"
5607     MIDL_PATH="$formatted_path"
5609     PathFormat "$AL_PATH"
5610     AL_PATH="$formatted_path"
5612     PathFormat "$DOTNET_FRAMEWORK_HOME"
5613     DOTNET_FRAMEWORK_HOME="$formatted_path"
5615     PathFormat "$CSC_PATH"
5616     CSC_PATH="$formatted_path"
5619 dnl ===================================================================
5620 dnl Check if stdc headers are available excluding MSVC.
5621 dnl ===================================================================
5622 if test "$_os" != "WINNT"; then
5623     AC_HEADER_STDC
5626 dnl ===================================================================
5627 dnl Testing for C++ compiler and version...
5628 dnl ===================================================================
5630 if test "$_os" != "WINNT"; then
5631     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5632     save_CXXFLAGS=$CXXFLAGS
5633     AC_PROG_CXX
5634     CXXFLAGS=$save_CXXFLAGS
5635 else
5636     if test -n "$CC" -a -z "$CXX"; then
5637         CXX="$CC"
5638     fi
5641 dnl check for GNU C++ compiler version
5642 if test "$GXX" = "yes"; then
5643     AC_MSG_CHECKING([the GNU C++ compiler version])
5645     _gpp_version=`$CXX -dumpversion`
5646     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5648     if test "$_gpp_majmin" -lt "401"; then
5649         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5650     else
5651         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5652     fi
5654     dnl see https://code.google.com/p/android/issues/detail?id=41770
5655     if test "$_gpp_majmin" -ge "401"; then
5656         glibcxx_threads=no
5657         AC_LANG_PUSH([C++])
5658         AC_REQUIRE_CPP
5659         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5660         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5661             #include <bits/c++config.h>]],[[
5662             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5663             && !defined(_GLIBCXX__PTHREADS) \
5664             && !defined(_GLIBCXX_HAS_GTHREADS)
5665             choke me
5666             #endif
5667         ]])],[AC_MSG_RESULT([yes])
5668         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5669         AC_LANG_POP([C++])
5670         if test $glibcxx_threads = yes; then
5671             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5672         fi
5673      fi
5675 AC_SUBST(BOOST_CXXFLAGS)
5678 # prefx CXX with ccache if needed
5680 if test "$CCACHE" != ""; then
5681     AC_MSG_CHECKING([whether $CXX is already ccached])
5682     AC_LANG_PUSH([C++])
5683     save_CXXFLAGS=$CXXFLAGS
5684     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5685     dnl an empty program will do, we're checking the compiler flags
5686     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5687                       [use_ccache=yes], [use_ccache=no])
5688     if test $use_ccache = yes; then
5689         AC_MSG_RESULT([yes])
5690     else
5691         CXX="$CCACHE $CXX"
5692         AC_MSG_RESULT([no])
5693     fi
5694     CXXFLAGS=$save_CXXFLAGS
5695     AC_LANG_POP([C++])
5698 dnl ===================================================================
5699 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5700 dnl ===================================================================
5702 if test "$_os" != "WINNT"; then
5703     AC_PROG_CXXCPP
5705     dnl Check whether there's a C pre-processor.
5706     AC_PROG_CPP
5710 dnl ===================================================================
5711 dnl Find integral type sizes and alignments
5712 dnl ===================================================================
5714 if test "$_os" != "WINNT"; then
5716 if test "$_os" == "iOS"; then
5717     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5718     ac_cv_sizeof_long=8
5719     ac_cv_sizeof_short=2
5720     ac_cv_sizeof_int=4
5721     ac_cv_sizeof_long_long=8
5722     ac_cv_sizeof_double=8
5723     ac_cv_sizeof_voidp=8
5724 else
5725     AC_CHECK_SIZEOF(long)
5726     AC_CHECK_SIZEOF(short)
5727     AC_CHECK_SIZEOF(int)
5728     AC_CHECK_SIZEOF(long long)
5729     AC_CHECK_SIZEOF(double)
5730     AC_CHECK_SIZEOF(void*)
5733     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5734     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5735     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5736     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5737     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5739     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5740     m4_pattern_allow([AC_CHECK_ALIGNOF])
5741     m4_ifdef([AC_CHECK_ALIGNOF],
5742         [
5743             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5744             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5745             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5746             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5747         ],
5748         [
5749             case "$_os-$host_cpu" in
5750             Linux-i686)
5751                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5752                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5753                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5754                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5755                 ;;
5756             Linux-x86_64)
5757                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5758                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5759                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5760                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5761                 ;;
5762             *)
5763                 if test -z "$ac_cv_alignof_short" -o \
5764                         -z "$ac_cv_alignof_int" -o \
5765                         -z "$ac_cv_alignof_long" -o \
5766                         -z "$ac_cv_alignof_double"; then
5767                    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.])
5768                 fi
5769                 ;;
5770             esac
5771         ])
5773     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5774     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5775     if test $ac_cv_sizeof_long -eq 8; then
5776         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5777     elif test $ac_cv_sizeof_double -eq 8; then
5778         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5779     else
5780         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5781     fi
5783     dnl Check for large file support
5784     AC_SYS_LARGEFILE
5785     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5786         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5787     fi
5788     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5789         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5790     fi
5791 else
5792     # Hardcode for MSVC
5793     SAL_TYPES_SIZEOFSHORT=2
5794     SAL_TYPES_SIZEOFINT=4
5795     SAL_TYPES_SIZEOFLONG=4
5796     SAL_TYPES_SIZEOFLONGLONG=8
5797     if test "$BITNESS_OVERRIDE" = ""; then
5798         SAL_TYPES_SIZEOFPOINTER=4
5799     else
5800         SAL_TYPES_SIZEOFPOINTER=8
5801     fi
5802     SAL_TYPES_ALIGNMENT2=2
5803     SAL_TYPES_ALIGNMENT4=4
5804     SAL_TYPES_ALIGNMENT8=8
5805     LFS_CFLAGS=''
5807 AC_SUBST(LFS_CFLAGS)
5809 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5810 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5811 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5812 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5813 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5814 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5815 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5816 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5818 dnl ===================================================================
5819 dnl Check whether to enable runtime optimizations
5820 dnl ===================================================================
5821 ENABLE_RUNTIME_OPTIMIZATIONS=
5822 AC_MSG_CHECKING([whether to enable runtime optimizations])
5823 if test -z "$enable_runtime_optimizations"; then
5824     for i in $CC; do
5825         case $i in
5826         -fsanitize=*)
5827             enable_runtime_optimizations=no
5828             break
5829             ;;
5830         esac
5831     done
5833 if test "$enable_runtime_optimizations" != no; then
5834     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5835     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5836     AC_MSG_RESULT([yes])
5837 else
5838     AC_MSG_RESULT([no])
5840 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5842 dnl ===================================================================
5843 dnl Check if valgrind headers are available
5844 dnl ===================================================================
5845 ENABLE_VALGRIND=
5846 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5847     prev_cppflags=$CPPFLAGS
5848     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5849     # or where does it come from?
5850     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5851     AC_CHECK_HEADER([valgrind/valgrind.h],
5852         [ENABLE_VALGRIND=TRUE])
5853     CPPFLAGS=$prev_cppflags
5855 AC_SUBST([ENABLE_VALGRIND])
5856 if test -z "$ENABLE_VALGRIND"; then
5857     if test "$with_valgrind" = yes; then
5858         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5859     fi
5860     VALGRIND_CFLAGS=
5862 AC_SUBST([VALGRIND_CFLAGS])
5865 dnl ===================================================================
5866 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5867 dnl ===================================================================
5869 # We need at least the sys/sdt.h include header.
5870 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5871 if test "$SDT_H_FOUND" = "TRUE"; then
5872     # Found sys/sdt.h header, now make sure the c++ compiler works.
5873     # Old g++ versions had problems with probes in constructors/destructors.
5874     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5875     AC_LANG_PUSH([C++])
5876     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5877     #include <sys/sdt.h>
5878     class ProbeClass
5879     {
5880     private:
5881       int& ref;
5882       const char *name;
5884     public:
5885       ProbeClass(int& v, const char *n) : ref(v), name(n)
5886       {
5887         DTRACE_PROBE2(_test_, cons, name, ref);
5888       }
5890       void method(int min)
5891       {
5892         DTRACE_PROBE3(_test_, meth, name, ref, min);
5893         ref -= min;
5894       }
5896       ~ProbeClass()
5897       {
5898         DTRACE_PROBE2(_test_, dest, name, ref);
5899       }
5900     };
5901     ]],[[
5902     int i = 64;
5903     DTRACE_PROBE1(_test_, call, i);
5904     ProbeClass inst = ProbeClass(i, "call");
5905     inst.method(24);
5906     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5907           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5908     AC_LANG_POP([C++])
5910 AC_CONFIG_HEADERS([config_host/config_probes.h])
5912 dnl ===================================================================
5913 dnl GCC features
5914 dnl ===================================================================
5915 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5916     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5917     save_CFLAGS=$CFLAGS
5918     CFLAGS="$CFLAGS -Werror -mno-avx"
5919     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5920     CFLAGS=$save_CFLAGS
5921     if test "$HAVE_GCC_AVX" = "TRUE"; then
5922         AC_MSG_RESULT([yes])
5923     else
5924         AC_MSG_RESULT([no])
5925     fi
5927     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5928     save_CFLAGS=$CFLAGS
5929     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5930     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5931     CFLAGS=$save_CFLAGS
5932     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5933         AC_MSG_RESULT([yes])
5934     else
5935         AC_MSG_RESULT([no])
5936     fi
5938     AC_MSG_CHECKING([whether $CC supports atomic functions])
5939     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5940     int v = 0;
5941     if (__sync_add_and_fetch(&v, 1) != 1 ||
5942         __sync_sub_and_fetch(&v, 1) != 0)
5943         return 1;
5944     __sync_synchronize();
5945     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5946         v != 1)
5947         return 1;
5948     return 0;
5949 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5950     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5951         AC_MSG_RESULT([yes])
5952         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5953     else
5954         AC_MSG_RESULT([no])
5955     fi
5957     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5958     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5959     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5960         AC_MSG_RESULT([yes])
5961         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5962     else
5963         AC_MSG_RESULT([no])
5964     fi
5966     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5967     save_CFLAGS=$CFLAGS
5968     CFLAGS="$CFLAGS -Werror"
5969     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5970             __attribute__((deprecated("test"))) void f();
5971         ])], [
5972             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5973             AC_MSG_RESULT([yes])
5974         ], [AC_MSG_RESULT([no])])
5975     CFLAGS=$save_CFLAGS
5977     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5978     AC_LANG_PUSH([C++])
5979     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5980             #include <cstddef>
5981             #include <cxxabi.h>
5982             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5983         ])], [
5984             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5985             AC_MSG_RESULT([yes])
5986         ], [AC_MSG_RESULT([no])])
5987     AC_LANG_POP([C++])
5989     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5990     AC_LANG_PUSH([C++])
5991     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5992             #include <cstddef>
5993             #include <cxxabi.h>
5994             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5995         ])], [
5996             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5997             AC_MSG_RESULT([yes])
5998         ], [AC_MSG_RESULT([no])])
5999     AC_LANG_POP([C++])
6001     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6002     AC_LANG_PUSH([C++])
6003     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6004             #include <cxxabi.h>
6005             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6006         ])], [
6007             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6008             AC_MSG_RESULT([yes])
6009         ], [AC_MSG_RESULT([no])])
6010     AC_LANG_POP([C++])
6012     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6013     AC_LANG_PUSH([C++])
6014     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6015             #include <cstddef>
6016             #include <cxxabi.h>
6017             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6018         ])], [
6019             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6020             AC_MSG_RESULT([yes])
6021         ], [AC_MSG_RESULT([no])])
6022     AC_LANG_POP([C++])
6024     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6025     AC_LANG_PUSH([C++])
6026     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6027             #include <cstddef>
6028             #include <cxxabi.h>
6029             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6030         ])], [
6031             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6032             AC_MSG_RESULT([yes])
6033         ], [AC_MSG_RESULT([no])])
6034     AC_LANG_POP([C++])
6036     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6037     AC_LANG_PUSH([C++])
6038     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6039             #include <cxxabi.h>
6040             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6041         ])], [
6042             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6043             AC_MSG_RESULT([yes])
6044         ], [AC_MSG_RESULT([no])])
6045     AC_LANG_POP([C++])
6047     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6048     AC_LANG_PUSH([C++])
6049     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6050             #include <cxxabi.h>
6051             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6052         ])], [
6053             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6054             AC_MSG_RESULT([yes])
6055         ], [AC_MSG_RESULT([no])])
6056     AC_LANG_POP([C++])
6058     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6059     AC_LANG_PUSH([C++])
6060     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6061             #include <cxxabi.h>
6062             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6063         ])], [
6064             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6065             AC_MSG_RESULT([yes])
6066         ], [AC_MSG_RESULT([no])])
6067     AC_LANG_POP([C++])
6069     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6070     AC_LANG_PUSH([C++])
6071     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6072             #include <cstddef>
6073             #include <cxxabi.h>
6074             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6075         ])], [
6076             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6077             AC_MSG_RESULT([yes])
6078         ], [AC_MSG_RESULT([no])])
6079     AC_LANG_POP([C++])
6081     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6082     AC_LANG_PUSH([C++])
6083     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6084             #include <cstddef>
6085             #include <cxxabi.h>
6086             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6087         ])], [
6088             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6089             AC_MSG_RESULT([yes])
6090         ], [AC_MSG_RESULT([no])])
6091     AC_LANG_POP([C++])
6093     dnl Available in GCC 4.9 and at least since Clang 3.4:
6094     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6095     AC_LANG_PUSH([C++])
6096     save_CXXFLAGS=$CXXFLAGS
6097     CXXFLAGS="$CXXFLAGS -Werror"
6098     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6099             struct __attribute__((warn_unused)) dummy {};
6100         ])], [
6101             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6102             AC_MSG_RESULT([yes])
6103         ], [AC_MSG_RESULT([no])])
6104     CXXFLAGS=$save_CXXFLAGS
6105 AC_LANG_POP([C++])
6108 AC_SUBST(HAVE_GCC_AVX)
6109 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6110 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6111 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6113 dnl ===================================================================
6114 dnl Identify the C++ library
6115 dnl ===================================================================
6117 AC_MSG_CHECKING([what the C++ library is])
6118 AC_LANG_PUSH([C++])
6119 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6120 #include <utility>
6121 #ifndef __GLIBCXX__
6122 foo bar
6123 #endif
6124 ]])],
6125     [CPP_LIBRARY=GLIBCXX
6126      cpp_library_name="GNU libstdc++"
6127     ],
6128     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6129 #include <utility>
6130 #ifndef _LIBCPP_VERSION
6131 foo bar
6132 #endif
6133 ]])],
6134     [CPP_LIBRARY=LIBCPP
6135      cpp_library_name="LLVM libc++"
6136      AC_DEFINE([HAVE_LIBCXX])
6137     ],
6138     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6139 #include <utility>
6140 #ifndef _MSC_VER
6141 foo bar
6142 #endif
6143 ]])],
6144     [CPP_LIBRARY=MSVCRT
6145      cpp_library_name="Microsoft"
6146     ],
6147     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6148 AC_MSG_RESULT([$cpp_library_name])
6149 AC_LANG_POP([C++])
6151 dnl ===================================================================
6152 dnl Check for gperf
6153 dnl ===================================================================
6154 AC_PATH_PROG(GPERF, gperf)
6155 if test -z "$GPERF"; then
6156     AC_MSG_ERROR([gperf not found but needed. Install it.])
6158 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6159     GPERF=`cygpath -m $GPERF`
6161 AC_MSG_CHECKING([gperf version])
6162 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6163     AC_MSG_RESULT([OK])
6164 else
6165     AC_MSG_ERROR([too old, you need at least 3.0.0])
6167 AC_SUBST(GPERF)
6169 dnl ===================================================================
6170 dnl Check for system libcmis
6171 dnl ===================================================================
6172 # libcmis requires curl and we can't build curl for iOS
6173 if test $_os != iOS; then
6174     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6175     ENABLE_LIBCMIS=TRUE
6176 else
6177     ENABLE_LIBCMIS=
6179 AC_SUBST(ENABLE_LIBCMIS)
6181 dnl ===================================================================
6182 dnl C++11
6183 dnl ===================================================================
6185 my_cxx17switches=
6186 libo_FUZZ_ARG_ENABLE(c++17,
6187     AS_HELP_STRING([--disable-c++17],
6188         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6191 AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6192 CXXFLAGS_CXX11=
6193 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6194     CXXFLAGS_CXX11=-std:c++17
6195 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6196     dnl But only use C++17 if the gperf that is being used knows not to emit
6197     dnl "register" in C++ output:
6198     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6199     my_flags='-std=gnu++14 -std=gnu++1y -std=c++14 -std=c++1y -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x'
6200     if test "$enable_c__17" != no; then
6201         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6202     fi
6203     for flag in $my_flags; do
6204         if test "$COM" = MSC; then
6205             flag="-Xclang $flag"
6206         fi
6207         save_CXXFLAGS=$CXXFLAGS
6208         CXXFLAGS="$CXXFLAGS $flag -Werror"
6209         if test "$SYSTEM_LIBCMIS" = TRUE; then
6210             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6211         fi
6212         AC_LANG_PUSH([C++])
6213         dnl Clang 3.9 supports __float128 since
6214         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6215         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6216         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6217         dnl $flag is supported below, so check this first):
6218         my_float128hack=
6219         my_float128hack_impl=-D__float128=void
6220         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6221             #include <vector>
6222             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6223             // (__float128)
6224             ]])
6225         ],,[
6226             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6227             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6228             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6229             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6230             dnl place where __float128 is used is in a template specialization, -D__float128=void
6231             dnl will avoid the problem there while still causing a problem if somebody actually uses
6232             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6233             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6234             dnl "fixed" with this hack):
6235             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6236             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6237                 #include <vector>
6238                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6239                 // (__float128)
6240                 ]])
6241             ],[my_float128hack=$my_float128hack_impl])
6242         ])
6243         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6244             #include <algorithm>
6245             #include <functional>
6246             #include <vector>
6248             #include <string.h>
6249             #pragma GCC diagnostic push
6250             #pragma GCC diagnostic ignored "-Wpragmas"
6251                 // make GCC not warn about next pragma
6252             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6253                 // make Clang with -std < C++17 not even warn about register
6254             #include "conftest.inc"
6255             #pragma GCC diagnostic pop
6257             #if defined SYSTEM_LIBCMIS
6258             // See ucb/source/ucp/cmis/auth_provider.hxx:
6259             #if __GNUC__ >= 7
6260             #pragma GCC diagnostic push
6261             #pragma GCC diagnostic ignored "-Wdeprecated"
6262             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6263             #endif
6264             #include <libcmis/libcmis.hxx>
6265             #if __GNUC__ >= 7
6266             #pragma GCC diagnostic pop
6267             #endif
6268             #endif
6270             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6271                 std::sort(v.begin(), v.end(), fn);
6272             }
6273             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6274         AC_LANG_POP([C++])
6275         CXXFLAGS=$save_CXXFLAGS
6276         if test -n "$CXXFLAGS_CXX11"; then
6277             break
6278         fi
6279     done
6280     rm conftest.inc
6282 if test -n "$CXXFLAGS_CXX11"; then
6283     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6284 else
6285     AC_MSG_ERROR(no)
6287 AC_SUBST(CXXFLAGS_CXX11)
6289 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6290 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6291 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6292 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6293 dnl again towards 4.7.2:
6294 if test $CPP_LIBRARY = GLIBCXX; then
6295     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6296     AC_LANG_PUSH([C++])
6297     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6298 #include <list>
6299 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6300     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6301     //   GCC 4.7.0: 20120322
6302     //   GCC 4.7.1: 20120614
6303     // and using a range check is not possible as the mapping between
6304     // __GLIBCXX__ values and GCC versions is not monotonic
6305 /* ok */
6306 #else
6307 abi broken
6308 #endif
6309         ]])], [AC_MSG_RESULT(no, ok)],
6310         [AC_MSG_ERROR(yes)])
6311     AC_LANG_POP([C++])
6314 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6315 save_CXXFLAGS=$CXXFLAGS
6316 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6317 AC_LANG_PUSH([C++])
6319 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6320 #include <stddef.h>
6322 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6324 namespace
6326         struct b
6327         {
6328                 int i;
6329                 int j;
6330         };
6332 ]], [[
6333 struct a
6335         int i;
6336         int j;
6338 a thinga[]={{0,0}, {1,1}};
6339 b thingb[]={{0,0}, {1,1}};
6340 size_t i = sizeof(sal_n_array_size(thinga));
6341 size_t j = sizeof(sal_n_array_size(thingb));
6342 return !(i != 0 && j != 0);
6344     ], [ AC_MSG_RESULT(yes) ],
6345     [ AC_MSG_ERROR(no)])
6346 AC_LANG_POP([C++])
6347 CXXFLAGS=$save_CXXFLAGS
6349 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6350 save_CXXFLAGS=$CXXFLAGS
6351 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6352 AC_LANG_PUSH([C++])
6353 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6354     // A somewhat over-complicated way of checking for
6355     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6356     // in constexpr function":
6357     #include <cassert>
6358     template<typename T> inline constexpr T f(T x) { return x; }
6359     template<typename T> inline constexpr T g(T x) {
6360         assert(f(static_cast<int>(x)));
6361         return x;
6362     }
6363     enum E { e };
6364     auto v = g(E::e);
6366     struct S {
6367         int n_;
6368         constexpr bool f() {
6369             int n = n_;
6370             int i = 0;
6371             while (n > 0) { --n; ++i; }
6372             assert(i >= 0);
6373             return i == 0;
6374         }
6375     };
6376     constexpr auto v2 = S{10}.f();
6377     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6378 AC_LANG_POP([C++])
6379 CXXFLAGS=$save_CXXFLAGS
6380 AC_MSG_RESULT([$cxx14_constexpr])
6381 if test "$cxx14_constexpr" = yes; then
6382     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6385 dnl _Pragma support (may require C++11)
6386 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6387     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6388     AC_LANG_PUSH([C++])
6389     save_CXXFLAGS=$CXXFLAGS
6390     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6391     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6392             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6393         ])], [
6394             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6395             AC_MSG_RESULT([yes])
6396         ], [AC_MSG_RESULT([no])])
6397     AC_LANG_POP([C++])
6398     CXXFLAGS=$save_CXXFLAGS
6401 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6402 if test "$GCC" = yes; then
6403     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6404     AC_LANG_PUSH([C++])
6405     save_CXXFLAGS=$CXXFLAGS
6406     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6407     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6408     CXXFLAGS=$save_CXXFLAGS
6409     AC_LANG_POP([C++])
6410     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6411         AC_MSG_RESULT([yes])
6412     else
6413         AC_MSG_RESULT([no])
6414     fi
6416 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6418 AC_MSG_CHECKING([[whether $CXX supports [[fallthrough]]]])
6419 AC_LANG_PUSH([C++])
6420 save_CXXFLAGS=$CXXFLAGS
6421 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6422 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6423 if test "$COM" = MSC; then
6424     CXXFLAGS="$CXXFLAGS /we5030"
6425 else
6426     CXXFLAGS="$CXXFLAGS -Werror"
6428 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6429         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6430         // by checking for __cplusplus:
6431         #if __cplusplus > 201703L
6432         #if !__has_cpp_attribute(fallthrough)
6433         #error
6434         #endif
6435         #else
6436         void f(int & x) {
6437             switch (x) {
6438             case 0:
6439                 ++x;
6440                 [[fallthrough]];
6441             default:
6442                 ++x;
6443             }
6444         }
6445         #endif
6446     ]])], [
6447         AC_DEFINE([HAVE_CPP_ATTRIBUTE_FALLTHROUGH],[1])
6448         AC_MSG_RESULT([yes])
6449     ], [AC_MSG_RESULT([no])])
6450 CXXFLAGS=$save_CXXFLAGS
6451 AC_LANG_POP([C++])
6453 AC_MSG_CHECKING([[whether $CXX supports [[nodiscard]]]])
6454 AC_LANG_PUSH([C++])
6455 save_CXXFLAGS=$CXXFLAGS
6456 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6457 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6458 if test "$COM" = MSC; then
6459     CXXFLAGS="$CXXFLAGS /we5030"
6460 else
6461     CXXFLAGS="$CXXFLAGS -Werror"
6463 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6464         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6465         // by checking for __cplusplus:
6466         #if __cplusplus > 201703L
6467         #if !__has_cpp_attribute(nodiscard)
6468         #error
6469         #endif
6470         #else
6471         [[nodiscard]] int f();
6472         #endif
6473     ]])], [
6474         AC_DEFINE([HAVE_CPP_ATTRIBUTE_NODISCARD],[1])
6475         AC_MSG_RESULT([yes])
6476     ], [AC_MSG_RESULT([no])])
6477 CXXFLAGS=$save_CXXFLAGS
6478 AC_LANG_POP([C++])
6480 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6481 AC_LANG_PUSH([C++])
6482 save_CXXFLAGS=$CXXFLAGS
6483 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6484 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6485         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6486         // supporting it:
6487         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6488         struct S {
6489         private:
6490             S(S const &);
6491         public:
6492             S();
6493             ~S();
6494         };
6495         S copy();
6496         void f() { S c(copy()); }
6497         #endif
6498     ])], [
6499         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6500         AC_MSG_RESULT([yes])
6501     ], [AC_MSG_RESULT([no])])
6502 CXXFLAGS=$save_CXXFLAGS
6503 AC_LANG_POP([C++])
6505 AC_MSG_CHECKING([whether $CXX has a fix for CWG1579])
6506 AC_LANG_PUSH([C++])
6507 save_CXXFLAGS=$CXXFLAGS
6508 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6509 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6510         #include <memory>
6511         struct S1 {};
6512         struct S2: S1 {};
6513         std::unique_ptr<S1> f() {
6514             std::unique_ptr<S2> s2(new S2);
6515             return s2;
6516         }
6517     ])], [
6518         AC_DEFINE([HAVE_CXX_CWG1579_FIX],[1])
6519         AC_MSG_RESULT([yes])
6520     ], [AC_MSG_RESULT([no])])
6521 CXXFLAGS=$save_CXXFLAGS
6522 AC_LANG_POP([C++])
6524 AC_MSG_CHECKING([whether $CXX has GCC bug 87150])
6525 AC_LANG_PUSH([C++])
6526 save_CXXFLAGS=$CXXFLAGS
6527 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6528 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6529         struct S1 { S1(S1 &&); };
6530         struct S2: S1 {};
6531         S1 f(S2 s) { return s; }
6532     ])], [
6533         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6534         AC_MSG_RESULT([yes])
6535     ], [AC_MSG_RESULT([no])])
6536 CXXFLAGS=$save_CXXFLAGS
6537 AC_LANG_POP([C++])
6539 dnl ===================================================================
6540 dnl system stl sanity tests
6541 dnl ===================================================================
6542 if test "$_os" != "WINNT"; then
6544     AC_LANG_PUSH([C++])
6546     save_CPPFLAGS="$CPPFLAGS"
6547     if test -n "$MACOSX_SDK_PATH"; then
6548         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6549     fi
6551     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6552     # only.
6553     if test "$CPP_LIBRARY" = GLIBCXX; then
6554         dnl gcc#19664, gcc#22482, rhbz#162935
6555         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6556         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6557         AC_MSG_RESULT([$stlvisok])
6558         if test "$stlvisok" = "no"; then
6559             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6560         fi
6561     fi
6563     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6564     # when we don't make any dynamic libraries?
6565     if test "$DISABLE_DYNLOADING" = ""; then
6566         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6567         cat > conftestlib1.cc <<_ACEOF
6568 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6569 struct S2: S1<int> { virtual ~S2(); };
6570 S2::~S2() {}
6571 _ACEOF
6572         cat > conftestlib2.cc <<_ACEOF
6573 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6574 struct S2: S1<int> { virtual ~S2(); };
6575 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6576 _ACEOF
6577         gccvisinlineshiddenok=yes
6578         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6579             gccvisinlineshiddenok=no
6580         else
6581             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6582             dnl known to not work with -z defs (unsetting which makes the test
6583             dnl moot, though):
6584             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6585             if test "$COM_IS_CLANG" = TRUE; then
6586                 for i in $CXX $CXXFLAGS; do
6587                     case $i in
6588                     -fsanitize=*)
6589                         my_linkflagsnoundefs=
6590                         break
6591                         ;;
6592                     esac
6593                 done
6594             fi
6595             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6596                 gccvisinlineshiddenok=no
6597             fi
6598         fi
6600         rm -fr libconftest*
6601         AC_MSG_RESULT([$gccvisinlineshiddenok])
6602         if test "$gccvisinlineshiddenok" = "no"; then
6603             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6604         fi
6605     fi
6607    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6608     cat >visibility.cxx <<_ACEOF
6609 #pragma GCC visibility push(hidden)
6610 struct __attribute__ ((visibility ("default"))) TestStruct {
6611   static void Init();
6613 __attribute__ ((visibility ("default"))) void TestFunc() {
6614   TestStruct::Init();
6616 _ACEOF
6617     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6618         gccvisbroken=yes
6619     else
6620         case "$host_cpu" in
6621         i?86|x86_64)
6622             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6623                 gccvisbroken=no
6624             else
6625                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6626                     gccvisbroken=no
6627                 else
6628                     gccvisbroken=yes
6629                 fi
6630             fi
6631             ;;
6632         *)
6633             gccvisbroken=no
6634             ;;
6635         esac
6636     fi
6637     rm -f visibility.s visibility.cxx
6639     AC_MSG_RESULT([$gccvisbroken])
6640     if test "$gccvisbroken" = "yes"; then
6641         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6642     fi
6644     CPPFLAGS="$save_CPPFLAGS"
6646     AC_LANG_POP([C++])
6649 dnl ===================================================================
6650 dnl  Clang++ tests
6651 dnl ===================================================================
6653 HAVE_GCC_FNO_DEFAULT_INLINE=
6654 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6655 if test "$GCC" = "yes"; then
6656     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6657     AC_LANG_PUSH([C++])
6658     save_CXXFLAGS=$CXXFLAGS
6659     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6660     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6661     CXXFLAGS=$save_CXXFLAGS
6662     AC_LANG_POP([C++])
6663     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6664         AC_MSG_RESULT([yes])
6665     else
6666         AC_MSG_RESULT([no])
6667     fi
6669     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6670     AC_LANG_PUSH([C++])
6671     save_CXXFLAGS=$CXXFLAGS
6672     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6673     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6674     CXXFLAGS=$save_CXXFLAGS
6675     AC_LANG_POP([C++])
6676     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6677         AC_MSG_RESULT([yes])
6678     else
6679         AC_MSG_RESULT([no])
6680     fi
6682 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6683 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6685 dnl ===================================================================
6686 dnl Compiler plugins
6687 dnl ===================================================================
6689 COMPILER_PLUGINS=
6690 # currently only Clang
6692 if test "$COM_IS_CLANG" != "TRUE"; then
6693     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6694         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6695         enable_compiler_plugins=no
6696     fi
6699 if test "$COM_IS_CLANG" = "TRUE"; then
6700     if test -n "$enable_compiler_plugins"; then
6701         compiler_plugins="$enable_compiler_plugins"
6702     elif test -n "$ENABLE_DBGUTIL"; then
6703         compiler_plugins=test
6704     else
6705         compiler_plugins=no
6706     fi
6707     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6708         if test "$compiler_plugins" = yes; then
6709             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6710         else
6711             compiler_plugins=no
6712         fi
6713     fi
6714     if test "$compiler_plugins" != "no"; then
6715         dnl The prefix where Clang resides, override to where Clang resides if
6716         dnl using a source build:
6717         if test -z "$CLANGDIR"; then
6718             CLANGDIR=/usr
6719         fi
6720         AC_LANG_PUSH([C++])
6721         save_CPPFLAGS=$CPPFLAGS
6722         save_CXX=$CXX
6723         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6724         : "${COMPILER_PLUGINS_CXX=g++}"
6725         CXX=$COMPILER_PLUGINS_CXX
6726         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6727         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6728             [COMPILER_PLUGINS=TRUE],
6729             [
6730             if test "$compiler_plugins" = "yes"; then
6731                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6732             else
6733                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6734                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6735             fi
6736             ])
6737         CXX=$save_CXX
6738         CPPFLAGS=$save_CPPFLAGS
6739         AC_LANG_POP([C++])
6740     fi
6741 else
6742     if test "$enable_compiler_plugins" = "yes"; then
6743         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6744     fi
6746 AC_SUBST(COMPILER_PLUGINS)
6747 AC_SUBST(COMPILER_PLUGINS_CXX)
6748 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6749 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6750 AC_SUBST(CLANGDIR)
6751 AC_SUBST(CLANGLIBDIR)
6753 # Plugin to help linker.
6754 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6755 # This makes --enable-lto build with clang work.
6756 AC_SUBST(LD_PLUGIN)
6758 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6759 AC_SUBST(HAVE_POSIX_FALLOCATE)
6761 dnl ===================================================================
6762 dnl Custom build version
6763 dnl ===================================================================
6765 AC_MSG_CHECKING([whether to add custom build version])
6766 if test "$with_build_version" != ""; then
6767     BUILD_VER_STRING=$with_build_version
6768     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6769 else
6770     BUILD_VER_STRING=
6771     AC_MSG_RESULT([no])
6773 AC_SUBST(BUILD_VER_STRING)
6775 JITC_PROCESSOR_TYPE=""
6776 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6777     # IBMs JDK needs this...
6778     JITC_PROCESSOR_TYPE=6
6779     export JITC_PROCESSOR_TYPE
6781 AC_SUBST([JITC_PROCESSOR_TYPE])
6783 # Misc Windows Stuff
6784 AC_ARG_WITH(ucrt-dir,
6785     AS_HELP_STRING([--with-ucrt-dir],
6786         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6787         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6788         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6789             Windows6.1-KB2999226-x64.msu
6790             Windows6.1-KB2999226-x86.msu
6791             Windows8.1-KB2999226-x64.msu
6792             Windows8.1-KB2999226-x86.msu
6793             Windows8-RT-KB2999226-x64.msu
6794             Windows8-RT-KB2999226-x86.msu
6795         A zip archive including those files is available from Microsoft site:
6796         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6798 UCRT_REDISTDIR="$with_ucrt_dir"
6799 if test $_os = "WINNT"; then
6800     find_msvc_x64_dlls
6801     find_msms
6802     MSVC_DLL_PATH="$msvcdllpath"
6803     MSVC_DLLS="$msvcdlls"
6804     MSM_PATH="$msmdir"
6805     # MSVC 15.3 changed it to VC141
6806     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6807         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6808     else
6809         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6810     fi
6811     if test "$UCRT_REDISTDIR" = "no"; then
6812         dnl explicitly disabled
6813         UCRT_REDISTDIR=""
6814     else
6815         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6816                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6817                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6818                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6819                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6820                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6821             UCRT_REDISTDIR=""
6822             if test -n "$PKGFORMAT"; then
6823                for i in $PKGFORMAT; do
6824                    case "$i" in
6825                    msi)
6826                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6827                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6828                        ;;
6829                    esac
6830                done
6831             fi
6832         fi
6833     fi
6836 AC_SUBST(UCRT_REDISTDIR)
6837 AC_SUBST(MSVC_DLL_PATH)
6838 AC_SUBST(MSVC_DLLS)
6839 AC_SUBST(MSM_PATH)
6841 dnl ===================================================================
6842 dnl Checks for Java
6843 dnl ===================================================================
6844 if test "$ENABLE_JAVA" != ""; then
6846     # Windows-specific tests
6847     if test "$build_os" = "cygwin"; then
6848         if test "$BITNESS_OVERRIDE" = 64; then
6849             bitness=64
6850         else
6851             bitness=32
6852         fi
6854         if test -z "$with_jdk_home"; then
6855             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6856             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6857             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6858             if test -n "$regvalue"; then
6859                 ver=$regvalue
6860                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6861                 _jdk_home=$regvalue
6862             fi
6863             if test -z "$with_jdk_home"; then
6864                 for ver in 1.8 1.7 1.6; do
6865                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6866                     if test -n "$regvalue"; then
6867                         _jdk_home=$regvalue
6868                         break
6869                     fi
6870                 done
6871             fi
6872             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6873                 with_jdk_home="$_jdk_home"
6874                 howfound="found automatically"
6875             else
6876                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6877             fi
6878         else
6879             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6880             howfound="you passed"
6881         fi
6882     fi
6884     # MacOS X: /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.
6885     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6886     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6887         with_jdk_home=`/usr/libexec/java_home`
6888     fi
6890     JAVA_HOME=; export JAVA_HOME
6891     if test -z "$with_jdk_home"; then
6892         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6893     else
6894         _java_path="$with_jdk_home/bin/$with_java"
6895         dnl Check if there is a Java interpreter at all.
6896         if test -x "$_java_path"; then
6897             JAVAINTERPRETER=$_java_path
6898         else
6899             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6900         fi
6901     fi
6903     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6904     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6905     dnl loaded by java to run JunitTests:
6906     if test "$build_os" = "cygwin"; then
6907         shortjdkhome=`cygpath -d "$with_jdk_home"`
6908         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
6909             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6910             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6911         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
6912             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6913             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6914         fi
6916         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6917             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6918         fi
6919         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6920     elif test "$cross_compiling" != "yes"; then
6921         case $CPUNAME in
6922             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6923                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6924                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6925                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6926                 fi
6927                 ;;
6928             *) # assumption: everything else 32-bit
6929                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6930                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6931                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6932                 fi
6933                 ;;
6934         esac
6935     fi
6938 HAVE_JAVA9=
6939 dnl ===================================================================
6940 dnl Checks for JDK.
6941 dnl ===================================================================
6943 # Note that JAVA_HOME as for now always means the *build* platform's
6944 # JAVA_HOME. Whether all the complexity here actually is needed any
6945 # more or not, no idea.
6947 if test "$ENABLE_JAVA" != ""; then
6948     _gij_longver=0
6949     AC_MSG_CHECKING([the installed JDK])
6950     if test -n "$JAVAINTERPRETER"; then
6951         dnl java -version sends output to stderr!
6952         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6953             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6954         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6955             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6956         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6957             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6958         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6959             JDK=ibm
6961             dnl IBM JDK specific tests
6962             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6963             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6965             if test "$_jdk_ver" -lt 10600; then
6966                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6967             fi
6969             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6971             if test "$with_jdk_home" = ""; then
6972                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6973 you must use the "--with-jdk-home" configure option explicitly])
6974             fi
6976             JAVA_HOME=$with_jdk_home
6977         else
6978             JDK=sun
6980             dnl Sun JDK specific tests
6981             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
6982             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6984             if test "$_jdk_ver" -lt 10600; then
6985                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6986             fi
6987             if test "$_jdk_ver" -gt 10600; then
6988                 JAVA_CLASSPATH_NOT_SET=TRUE
6989             fi
6990             if test "$_jdk_ver" -ge 10900; then
6991                 HAVE_JAVA9=TRUE
6992             fi
6994             AC_MSG_RESULT([checked (JDK $_jdk)])
6995             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6996             if test "$_os" = "WINNT"; then
6997                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6998             fi
7000             # set to limit VM usage for JunitTests
7001             JAVAIFLAGS=-Xmx64M
7002             # set to limit VM usage for javac
7003             JAVAFLAGS=-J-Xmx128M
7004         fi
7005     else
7006         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
7007     fi
7008 else
7009     dnl Java disabled
7010     JAVA_HOME=
7011     export JAVA_HOME
7014 dnl ===================================================================
7015 dnl Set target Java bytecode version
7016 dnl ===================================================================
7017 if test "$ENABLE_JAVA" != ""; then
7018     if test "$HAVE_JAVA9" = "TRUE"; then
7019         _java_target_ver="1.6"
7020     else
7021         _java_target_ver="1.5"
7022     fi
7023     JAVA_SOURCE_VER="$_java_target_ver"
7024     JAVA_TARGET_VER="$_java_target_ver"
7027 dnl ===================================================================
7028 dnl Checks for javac
7029 dnl ===================================================================
7030 if test "$ENABLE_JAVA" != ""; then
7031     javacompiler="javac"
7032     if test -z "$with_jdk_home"; then
7033         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7034     else
7035         _javac_path="$with_jdk_home/bin/$javacompiler"
7036         dnl Check if there is a Java compiler at all.
7037         if test -x "$_javac_path"; then
7038             JAVACOMPILER=$_javac_path
7039         fi
7040     fi
7041     if test -z "$JAVACOMPILER"; then
7042         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7043     fi
7044     if test "$build_os" = "cygwin"; then
7045         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7046             JAVACOMPILER="${JAVACOMPILER}.exe"
7047         fi
7048         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7049     fi
7052 dnl ===================================================================
7053 dnl Checks for javadoc
7054 dnl ===================================================================
7055 if test "$ENABLE_JAVA" != ""; then
7056     if test -z "$with_jdk_home"; then
7057         AC_PATH_PROG(JAVADOC, javadoc)
7058     else
7059         _javadoc_path="$with_jdk_home/bin/javadoc"
7060         dnl Check if there is a javadoc at all.
7061         if test -x "$_javadoc_path"; then
7062             JAVADOC=$_javadoc_path
7063         else
7064             AC_PATH_PROG(JAVADOC, javadoc)
7065         fi
7066     fi
7067     if test -z "$JAVADOC"; then
7068         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7069     fi
7070     if test "$build_os" = "cygwin"; then
7071         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7072             JAVADOC="${JAVADOC}.exe"
7073         fi
7074         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7075     fi
7077     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7078     JAVADOCISGJDOC="yes"
7079     fi
7081 AC_SUBST(JAVADOCISGJDOC)
7083 if test "$ENABLE_JAVA" != ""; then
7084     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7085     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7086         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7087            # try to recover first by looking whether we have a alternatives
7088            # system as in Debian or newer SuSEs where following /usr/bin/javac
7089            # over /etc/alternatives/javac leads to the right bindir where we
7090            # just need to strip a bit away to get a valid JAVA_HOME
7091            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7092         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7093             # maybe only one level of symlink (e.g. on Mac)
7094             JAVA_HOME=$(readlink $JAVACOMPILER)
7095             if test "$(dirname $JAVA_HOME)" = "."; then
7096                 # we've got no path to trim back
7097                 JAVA_HOME=""
7098             fi
7099         else
7100             # else warn
7101             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7102             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7103             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7104             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7105         fi
7106         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7107         if test "$JAVA_HOME" != "/usr"; then
7108             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7109                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7110                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7111                 dnl Tiger already returns a JDK path..
7112                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7113             else
7114                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7115                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7116                 dnl that checks which version to run
7117                 if test -f "$JAVA_HOME"; then
7118                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7119                 fi
7120             fi
7121         fi
7122     fi
7123     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7125     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7126     if test -z "$JAVA_HOME"; then
7127         if test "x$with_jdk_home" = "x"; then
7128             cat > findhome.java <<_ACEOF
7129 [import java.io.File;
7131 class findhome
7133     public static void main(String args[])
7134     {
7135         String jrelocation = System.getProperty("java.home");
7136         File jre = new File(jrelocation);
7137         System.out.println(jre.getParent());
7138     }
7140 _ACEOF
7141             AC_MSG_CHECKING([if javac works])
7142             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7143             AC_TRY_EVAL(javac_cmd)
7144             if test $? = 0 -a -f ./findhome.class; then
7145                 AC_MSG_RESULT([javac works])
7146             else
7147                 echo "configure: javac test failed" >&5
7148                 cat findhome.java >&5
7149                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7150             fi
7151             AC_MSG_CHECKING([if gij knows its java.home])
7152             JAVA_HOME=`$JAVAINTERPRETER findhome`
7153             if test $? = 0 -a "$JAVA_HOME" != ""; then
7154                 AC_MSG_RESULT([$JAVA_HOME])
7155             else
7156                 echo "configure: java test failed" >&5
7157                 cat findhome.java >&5
7158                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7159             fi
7160             # clean-up after ourselves
7161             rm -f ./findhome.java ./findhome.class
7162         else
7163             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7164         fi
7165     fi
7167     # now check if $JAVA_HOME is really valid
7168     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7169         case "${JAVA_HOME}" in
7170             /Library/Java/JavaVirtualMachines/*)
7171                 ;;
7172             *)
7173                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7174                 ;;
7175         esac
7176         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7177             JAVA_HOME_OK="NO"
7178         fi
7179     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7180         JAVA_HOME_OK="NO"
7181     fi
7182     if test "$JAVA_HOME_OK" = "NO"; then
7183         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7184         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7185         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7186         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7187         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7188         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7189     fi
7190     PathFormat "$JAVA_HOME"
7191     JAVA_HOME="$formatted_path"
7194 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7195     "$_os" != Darwin
7196 then
7197     AC_MSG_CHECKING([for JAWT lib])
7198     if test "$_os" = WINNT; then
7199         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7200         JAWTLIB=jawt.lib
7201     else
7202         case "$host_cpu" in
7203         arm*)
7204             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7205             JAVA_ARCH=$my_java_arch
7206             ;;
7207         i*86)
7208             my_java_arch=i386
7209             ;;
7210         m68k)
7211             my_java_arch=m68k
7212             ;;
7213         powerpc)
7214             my_java_arch=ppc
7215             ;;
7216         powerpc64)
7217             my_java_arch=ppc64
7218             ;;
7219         powerpc64le)
7220             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7221             JAVA_ARCH=$my_java_arch
7222             ;;
7223         sparc64)
7224             my_java_arch=sparcv9
7225             ;;
7226         x86_64)
7227             my_java_arch=amd64
7228             ;;
7229         *)
7230             my_java_arch=$host_cpu
7231             ;;
7232         esac
7233         # This is where JDK9 puts the library
7234         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7235             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7236         else
7237             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7238         fi
7239         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7240     fi
7241     AC_MSG_RESULT([$JAWTLIB])
7243 AC_SUBST(JAWTLIB)
7245 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7246     case "$host_os" in
7248     aix*)
7249         JAVAINC="-I$JAVA_HOME/include"
7250         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7251         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7252         ;;
7254     cygwin*)
7255         JAVAINC="-I$JAVA_HOME/include/win32"
7256         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7257         ;;
7259     darwin*)
7260         if test -d "$JAVA_HOME/include/darwin"; then
7261             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7262         else
7263             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7264         fi
7265         ;;
7267     dragonfly*)
7268         JAVAINC="-I$JAVA_HOME/include"
7269         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7270         ;;
7272     freebsd*)
7273         JAVAINC="-I$JAVA_HOME/include"
7274         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7275         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7276         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7277         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7278         ;;
7280     k*bsd*-gnu*)
7281         JAVAINC="-I$JAVA_HOME/include"
7282         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7283         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7284         ;;
7286     linux-gnu*)
7287         JAVAINC="-I$JAVA_HOME/include"
7288         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7289         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7290         ;;
7292     *netbsd*)
7293         JAVAINC="-I$JAVA_HOME/include"
7294         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7295         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7296        ;;
7298     openbsd*)
7299         JAVAINC="-I$JAVA_HOME/include"
7300         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7301         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7302         ;;
7304     solaris*)
7305         JAVAINC="-I$JAVA_HOME/include"
7306         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7307         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7308         ;;
7309     esac
7311 SOLARINC="$SOLARINC $JAVAINC"
7313 AC_SUBST(JAVACOMPILER)
7314 AC_SUBST(JAVADOC)
7315 AC_SUBST(JAVAINTERPRETER)
7316 AC_SUBST(JAVAIFLAGS)
7317 AC_SUBST(JAVAFLAGS)
7318 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7319 AC_SUBST(JAVA_HOME)
7320 AC_SUBST(JAVA_SOURCE_VER)
7321 AC_SUBST(JAVA_TARGET_VER)
7322 AC_SUBST(JDK)
7325 dnl ===================================================================
7326 dnl Export file validation
7327 dnl ===================================================================
7328 AC_MSG_CHECKING([whether to enable export file validation])
7329 if test "$with_export_validation" != "no"; then
7330     if test -z "$ENABLE_JAVA"; then
7331         if test "$with_export_validation" = "yes"; then
7332             AC_MSG_ERROR([requested, but Java is disabled])
7333         else
7334             AC_MSG_RESULT([no, as Java is disabled])
7335         fi
7336     elif test "$_jdk_ver" -lt 10800; then
7337         if test "$with_export_validation" = "yes"; then
7338             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7339         else
7340             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7341         fi
7342     else
7343         AC_MSG_RESULT([yes])
7344         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7346         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7347         if test -z "$ODFVALIDATOR"; then
7348             # remember to download the ODF toolkit with validator later
7349             AC_MSG_NOTICE([no odfvalidator found, will download it])
7350             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7351             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7353             # and fetch name of odfvalidator jar name from download.lst
7354             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7355             AC_SUBST(ODFVALIDATOR_JAR)
7357             if test -z "$ODFVALIDATOR_JAR"; then
7358                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7359             fi
7360         fi
7361         if test "$build_os" = "cygwin"; then
7362             # In case of Cygwin it will be executed from Windows,
7363             # so we need to run bash and absolute path to validator
7364             # so instead of "odfvalidator" it will be
7365             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7366             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7367         else
7368             ODFVALIDATOR="sh $ODFVALIDATOR"
7369         fi
7370         AC_SUBST(ODFVALIDATOR)
7373         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7374         if test -z "$OFFICEOTRON"; then
7375             # remember to download the officeotron with validator later
7376             AC_MSG_NOTICE([no officeotron found, will download it])
7377             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7378             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7380             # and fetch name of officeotron jar name from download.lst
7381             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7382             AC_SUBST(OFFICEOTRON_JAR)
7384             if test -z "$OFFICEOTRON_JAR"; then
7385                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7386             fi
7387         else
7388             # check version of existing officeotron
7389             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7390             if test 0"$OFFICEOTRON_VER" -lt 704; then
7391                 AC_MSG_ERROR([officeotron too old])
7392             fi
7393         fi
7394         if test "$build_os" = "cygwin"; then
7395             # In case of Cygwin it will be executed from Windows,
7396             # so we need to run bash and absolute path to validator
7397             # so instead of "odfvalidator" it will be
7398             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7399             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7400         else
7401             OFFICEOTRON="sh $OFFICEOTRON"
7402         fi
7403     fi
7404     AC_SUBST(OFFICEOTRON)
7405 else
7406     AC_MSG_RESULT([no])
7409 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7410 if test "$with_bffvalidator" != "no"; then
7411     AC_DEFINE(HAVE_BFFVALIDATOR)
7413     if test "$with_export_validation" = "no"; then
7414         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7415     fi
7417     if test "$with_bffvalidator" = "yes"; then
7418         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7419     else
7420         BFFVALIDATOR="$with_bffvalidator"
7421     fi
7423     if test "$build_os" = "cygwin"; then
7424         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7425             AC_MSG_RESULT($BFFVALIDATOR)
7426         else
7427             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7428         fi
7429     elif test -n "$BFFVALIDATOR"; then
7430         # We are not in Cygwin but need to run Windows binary with wine
7431         AC_PATH_PROGS(WINE, wine)
7433         # so swap in a shell wrapper that converts paths transparently
7434         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7435         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7436         AC_SUBST(BFFVALIDATOR_EXE)
7437         AC_MSG_RESULT($BFFVALIDATOR)
7438     else
7439         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7440     fi
7441     AC_SUBST(BFFVALIDATOR)
7442 else
7443     AC_MSG_RESULT([no])
7446 dnl ===================================================================
7447 dnl Check for C preprocessor to use
7448 dnl ===================================================================
7449 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7450 if test -n "$with_idlc_cpp"; then
7451     AC_MSG_RESULT([$with_idlc_cpp])
7452     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7453 else
7454     AC_MSG_RESULT([ucpp])
7455     AC_MSG_CHECKING([which ucpp tp use])
7456     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7457         AC_MSG_RESULT([external])
7458         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7459     else
7460         AC_MSG_RESULT([internal])
7461         BUILD_TYPE="$BUILD_TYPE UCPP"
7462     fi
7464 AC_SUBST(SYSTEM_UCPP)
7466 dnl ===================================================================
7467 dnl Check for epm (not needed for Windows)
7468 dnl ===================================================================
7469 AC_MSG_CHECKING([whether to enable EPM for packing])
7470 if test "$enable_epm" = "yes"; then
7471     AC_MSG_RESULT([yes])
7472     if test "$_os" != "WINNT"; then
7473         if test $_os = Darwin; then
7474             EPM=internal
7475         elif test -n "$with_epm"; then
7476             EPM=$with_epm
7477         else
7478             AC_PATH_PROG(EPM, epm, no)
7479         fi
7480         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7481             AC_MSG_NOTICE([EPM will be built.])
7482             BUILD_TYPE="$BUILD_TYPE EPM"
7483             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7484         else
7485             # Gentoo has some epm which is something different...
7486             AC_MSG_CHECKING([whether the found epm is the right epm])
7487             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7488                 AC_MSG_RESULT([yes])
7489             else
7490                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7491             fi
7492             AC_MSG_CHECKING([epm version])
7493             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7494             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7495                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7496                 AC_MSG_RESULT([OK, >= 3.7])
7497             else
7498                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7499                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7500             fi
7501         fi
7502     fi
7504     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7505         AC_MSG_CHECKING([for rpm])
7506         for a in "$RPM" rpmbuild rpm; do
7507             $a --usage >/dev/null 2> /dev/null
7508             if test $? -eq 0; then
7509                 RPM=$a
7510                 break
7511             else
7512                 $a --version >/dev/null 2> /dev/null
7513                 if test $? -eq 0; then
7514                     RPM=$a
7515                     break
7516                 fi
7517             fi
7518         done
7519         if test -z "$RPM"; then
7520             AC_MSG_ERROR([not found])
7521         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7522             RPM_PATH=`which $RPM`
7523             AC_MSG_RESULT([$RPM_PATH])
7524             SCPDEFS="$SCPDEFS -DWITH_RPM"
7525         else
7526             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7527         fi
7528     fi
7529     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7530         AC_PATH_PROG(DPKG, dpkg, no)
7531         if test "$DPKG" = "no"; then
7532             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7533         fi
7534     fi
7535     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7536        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7537         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7538             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7539                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7540                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7541                     AC_MSG_RESULT([yes])
7542                 else
7543                     AC_MSG_RESULT([no])
7544                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7545                         _pt="rpm"
7546                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7547                         add_warning "the rpms will need to be installed with --nodeps"
7548                     else
7549                         _pt="pkg"
7550                     fi
7551                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7552                     add_warning "the ${_pt}s will not be relocatable"
7553                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7554                                  relocation will work, you need to patch your epm with the
7555                                  patch in epm/epm-3.7.patch or build with
7556                                  --with-epm=internal which will build a suitable epm])
7557                 fi
7558             fi
7559         fi
7560     fi
7561     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7562         AC_PATH_PROG(PKGMK, pkgmk, no)
7563         if test "$PKGMK" = "no"; then
7564             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7565         fi
7566     fi
7567     AC_SUBST(RPM)
7568     AC_SUBST(DPKG)
7569     AC_SUBST(PKGMK)
7570 else
7571     for i in $PKGFORMAT; do
7572         case "$i" in
7573         aix | bsd | deb | pkg | rpm | native | portable)
7574             AC_MSG_ERROR(
7575                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7576             ;;
7577         esac
7578     done
7579     AC_MSG_RESULT([no])
7580     EPM=NO
7582 AC_SUBST(EPM)
7584 ENABLE_LWP=
7585 if test "$enable_lotuswordpro" = "yes"; then
7586     ENABLE_LWP="TRUE"
7588 AC_SUBST(ENABLE_LWP)
7590 dnl ===================================================================
7591 dnl Check for building ODK
7592 dnl ===================================================================
7593 if test "$enable_odk" = no; then
7594     unset DOXYGEN
7595 else
7596     if test "$with_doxygen" = no; then
7597         AC_MSG_CHECKING([for doxygen])
7598         unset DOXYGEN
7599         AC_MSG_RESULT([no])
7600     else
7601         if test "$with_doxygen" = yes; then
7602             AC_PATH_PROG([DOXYGEN], [doxygen])
7603             if test -z "$DOXYGEN"; then
7604                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7605             fi
7606             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7607                 if ! dot -V 2>/dev/null; then
7608                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7609                 fi
7610             fi
7611         else
7612             AC_MSG_CHECKING([for doxygen])
7613             DOXYGEN=$with_doxygen
7614             AC_MSG_RESULT([$DOXYGEN])
7615         fi
7616         if test -n "$DOXYGEN"; then
7617             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7618             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7619             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7620                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7621             fi
7622         fi
7623     fi
7625 AC_SUBST([DOXYGEN])
7627 AC_MSG_CHECKING([whether to build the ODK])
7628 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7629     AC_MSG_RESULT([yes])
7631     if test "$with_java" != "no"; then
7632         AC_MSG_CHECKING([whether to build unowinreg.dll])
7633         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7634             # build on Win by default
7635             enable_build_unowinreg=yes
7636         fi
7637         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7638             AC_MSG_RESULT([no])
7639             BUILD_UNOWINREG=
7640         else
7641             AC_MSG_RESULT([yes])
7642             BUILD_UNOWINREG=TRUE
7643         fi
7644         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7645             if test -z "$with_mingw_cross_compiler"; then
7646                 dnl Guess...
7647                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7648             elif test -x "$with_mingw_cross_compiler"; then
7649                  MINGWCXX="$with_mingw_cross_compiler"
7650             else
7651                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7652             fi
7654             if test "$MINGWCXX" = "false"; then
7655                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7656             fi
7658             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7659             if test -x "$mingwstrip_test"; then
7660                 MINGWSTRIP="$mingwstrip_test"
7661             else
7662                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7663             fi
7665             if test "$MINGWSTRIP" = "false"; then
7666                 AC_MSG_ERROR(MinGW32 binutils not found.)
7667             fi
7668         fi
7669     fi
7670     BUILD_TYPE="$BUILD_TYPE ODK"
7671 else
7672     AC_MSG_RESULT([no])
7673     BUILD_UNOWINREG=
7675 AC_SUBST(BUILD_UNOWINREG)
7676 AC_SUBST(MINGWCXX)
7677 AC_SUBST(MINGWSTRIP)
7679 dnl ===================================================================
7680 dnl Check for system zlib
7681 dnl ===================================================================
7682 if test "$with_system_zlib" = "auto"; then
7683     case "$_os" in
7684     WINNT)
7685         with_system_zlib="$with_system_libs"
7686         ;;
7687     *)
7688         if test "$enable_fuzzers" != "yes"; then
7689             with_system_zlib=yes
7690         else
7691             with_system_zlib=no
7692         fi
7693         ;;
7694     esac
7697 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7698 dnl and has no pkg-config for it at least on some tinderboxes,
7699 dnl so leaving that out for now
7700 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7701 AC_MSG_CHECKING([which zlib to use])
7702 if test "$with_system_zlib" = "yes"; then
7703     AC_MSG_RESULT([external])
7704     SYSTEM_ZLIB=TRUE
7705     AC_CHECK_HEADER(zlib.h, [],
7706         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7707     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7708         [AC_MSG_ERROR(zlib not found or functional)], [])
7709 else
7710     AC_MSG_RESULT([internal])
7711     SYSTEM_ZLIB=
7712     BUILD_TYPE="$BUILD_TYPE ZLIB"
7713     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7714     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7716 AC_SUBST(ZLIB_CFLAGS)
7717 AC_SUBST(ZLIB_LIBS)
7718 AC_SUBST(SYSTEM_ZLIB)
7720 dnl ===================================================================
7721 dnl Check for system jpeg
7722 dnl ===================================================================
7723 AC_MSG_CHECKING([which libjpeg to use])
7724 if test "$with_system_jpeg" = "yes"; then
7725     AC_MSG_RESULT([external])
7726     SYSTEM_LIBJPEG=TRUE
7727     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7728         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7729     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7730         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7731 else
7732     SYSTEM_LIBJPEG=
7733     AC_MSG_RESULT([internal, libjpeg-turbo])
7734     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7735     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7736     if test "$COM" = "MSC"; then
7737         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7738     else
7739         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7740     fi
7742     case "$host_cpu" in
7743     x86_64 | amd64 | i*86 | x86 | ia32)
7744         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7745         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7746             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7747                 NASM="$LODE_HOME/opt/bin/nasm"
7748             elif test -x "/opt/lo/bin/nasm"; then
7749                 NASM="/opt/lo/bin/nasm"
7750             fi
7751         fi
7753         if test -n "$NASM"; then
7754             AC_MSG_CHECKING([for object file format of host system])
7755             case "$host_os" in
7756               cygwin* | mingw* | pw32* | interix*)
7757                 case "$host_cpu" in
7758                   x86_64)
7759                     objfmt='Win64-COFF'
7760                     ;;
7761                   *)
7762                     objfmt='Win32-COFF'
7763                     ;;
7764                 esac
7765               ;;
7766               msdosdjgpp* | go32*)
7767                 objfmt='COFF'
7768               ;;
7769               os2-emx*)                 # not tested
7770                 objfmt='MSOMF'          # obj
7771               ;;
7772               linux*coff* | linux*oldld*)
7773                 objfmt='COFF'           # ???
7774               ;;
7775               linux*aout*)
7776                 objfmt='a.out'
7777               ;;
7778               linux*)
7779                 case "$host_cpu" in
7780                   x86_64)
7781                     objfmt='ELF64'
7782                     ;;
7783                   *)
7784                     objfmt='ELF'
7785                     ;;
7786                 esac
7787               ;;
7788               kfreebsd* | freebsd* | netbsd* | openbsd*)
7789                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7790                   objfmt='BSD-a.out'
7791                 else
7792                   case "$host_cpu" in
7793                     x86_64 | amd64)
7794                       objfmt='ELF64'
7795                       ;;
7796                     *)
7797                       objfmt='ELF'
7798                       ;;
7799                   esac
7800                 fi
7801               ;;
7802               solaris* | sunos* | sysv* | sco*)
7803                 case "$host_cpu" in
7804                   x86_64)
7805                     objfmt='ELF64'
7806                     ;;
7807                   *)
7808                     objfmt='ELF'
7809                     ;;
7810                 esac
7811               ;;
7812               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7813                 case "$host_cpu" in
7814                   x86_64)
7815                     objfmt='Mach-O64'
7816                     ;;
7817                   *)
7818                     objfmt='Mach-O'
7819                     ;;
7820                 esac
7821               ;;
7822               *)
7823                 objfmt='ELF ?'
7824               ;;
7825             esac
7827             AC_MSG_RESULT([$objfmt])
7828             if test "$objfmt" = 'ELF ?'; then
7829               objfmt='ELF'
7830               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7831             fi
7833             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7834             case "$objfmt" in
7835               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7836               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7837               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7838               COFF)       NAFLAGS='-fcoff -DCOFF';;
7839               a.out)      NAFLAGS='-faout -DAOUT';;
7840               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7841               ELF)        NAFLAGS='-felf -DELF';;
7842               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7843               RDF)        NAFLAGS='-frdf -DRDF';;
7844               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7845               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7846             esac
7847             AC_MSG_RESULT([$NAFLAGS])
7849             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7850             cat > conftest.asm << EOF
7851             [%line __oline__ "configure"
7852                     section .text
7853                     global  _main,main
7854             _main:
7855             main:   xor     eax,eax
7856                     ret
7857             ]
7859             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7860             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7861               AC_MSG_RESULT(yes)
7862             else
7863               echo "configure: failed program was:" >&AC_FD_CC
7864               cat conftest.asm >&AC_FD_CC
7865               rm -rf conftest*
7866               AC_MSG_RESULT(no)
7867               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7868               NASM=""
7869             fi
7871         fi
7873         if test -z "$NASM"; then
7874 cat << _EOS
7875 ****************************************************************************
7876 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7877 To get one please:
7879 _EOS
7880             if test "$build_os" = "cygwin"; then
7881 cat << _EOS
7882 install a pre-compiled binary for Win32
7884 mkdir -p /opt/lo/bin
7885 cd /opt/lo/bin
7886 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7887 chmod +x nasm
7889 or get and install one from http://www.nasm.us/
7891 Then re-run autogen.sh
7893 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7894 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7896 _EOS
7897             else
7898 cat << _EOS
7899 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7901 _EOS
7902             fi
7903             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7904             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7905         fi
7906       ;;
7907     esac
7910 AC_SUBST(NASM)
7911 AC_SUBST(LIBJPEG_CFLAGS)
7912 AC_SUBST(LIBJPEG_LIBS)
7913 AC_SUBST(SYSTEM_LIBJPEG)
7915 dnl ===================================================================
7916 dnl Check for system clucene
7917 dnl ===================================================================
7918 dnl we should rather be using
7919 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7920 dnl but the contribs-lib check seems tricky
7921 AC_MSG_CHECKING([which clucene to use])
7922 if test "$with_system_clucene" = "yes"; then
7923     AC_MSG_RESULT([external])
7924     SYSTEM_CLUCENE=TRUE
7925     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7926     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7927     FilterLibs "${CLUCENE_LIBS}"
7928     CLUCENE_LIBS="${filteredlibs}"
7929     AC_LANG_PUSH([C++])
7930     save_CXXFLAGS=$CXXFLAGS
7931     save_CPPFLAGS=$CPPFLAGS
7932     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7933     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7934     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7935     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7936     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7937                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7938     CXXFLAGS=$save_CXXFLAGS
7939     CPPFLAGS=$save_CPPFLAGS
7940     AC_LANG_POP([C++])
7942     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7943 else
7944     AC_MSG_RESULT([internal])
7945     SYSTEM_CLUCENE=
7946     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7948 AC_SUBST(SYSTEM_CLUCENE)
7949 AC_SUBST(CLUCENE_CFLAGS)
7950 AC_SUBST(CLUCENE_LIBS)
7952 dnl ===================================================================
7953 dnl Check for system expat
7954 dnl ===================================================================
7955 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7957 dnl ===================================================================
7958 dnl Check for system xmlsec
7959 dnl ===================================================================
7960 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7962 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7963 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7964     ENABLE_EOT="TRUE"
7965     AC_DEFINE([ENABLE_EOT])
7966     AC_MSG_RESULT([yes])
7968     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7969 else
7970     ENABLE_EOT=
7971     AC_MSG_RESULT([no])
7973 AC_SUBST([ENABLE_EOT])
7975 dnl ===================================================================
7976 dnl Check for DLP libs
7977 dnl ===================================================================
7978 AS_IF([test "$COM" = "MSC"],
7979       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7980       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7982 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7984 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7986 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7988 AS_IF([test "$COM" = "MSC"],
7989       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7990       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7992 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7994 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7996 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7997 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
7999 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8001 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8003 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8005 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8006 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
8008 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8009 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8011 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8013 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8014 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8016 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8018 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8020 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8022 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8024 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8025 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8027 dnl ===================================================================
8028 dnl Check for system lcms2
8029 dnl ===================================================================
8030 if test "$with_system_lcms2" != "yes"; then
8031     SYSTEM_LCMS2=
8033 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8034 if test "$GCC" = "yes"; then
8035     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8037 if test "$COM" = "MSC"; then # override the above
8038     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8041 dnl ===================================================================
8042 dnl Check for system cppunit
8043 dnl ===================================================================
8044 if test "$_os" != "Android" ; then
8045     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8048 dnl ===================================================================
8049 dnl Check whether freetype is available
8050 dnl ===================================================================
8051 if test  "$test_freetype" = "yes"; then
8052     AC_MSG_CHECKING([whether freetype is available])
8053     # FreeType has 3 different kinds of versions
8054     # * release, like 2.4.10
8055     # * libtool, like 13.0.7 (this what pkg-config returns)
8056     # * soname
8057     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8058     #
8059     # 9.9.3 is 2.2.0
8060     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8061     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8062     FilterLibs "${FREETYPE_LIBS}"
8063     FREETYPE_LIBS="${filteredlibs}"
8064     SYSTEM_FREETYPE=TRUE
8065 else
8066     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8067     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8069 AC_SUBST(FREETYPE_CFLAGS)
8070 AC_SUBST(FREETYPE_LIBS)
8071 AC_SUBST([SYSTEM_FREETYPE])
8073 # ===================================================================
8074 # Check for system libxslt
8075 # to prevent incompatibilities between internal libxml2 and external libxslt,
8076 # or vice versa, use with_system_libxml here
8077 # ===================================================================
8078 if test "$with_system_libxml" = "auto"; then
8079     case "$_os" in
8080     WINNT|iOS|Android)
8081         with_system_libxml="$with_system_libs"
8082         ;;
8083     *)
8084         if test "$enable_fuzzers" != "yes"; then
8085             with_system_libxml=yes
8086         else
8087             with_system_libxml=no
8088         fi
8089         ;;
8090     esac
8093 AC_MSG_CHECKING([which libxslt to use])
8094 if test "$with_system_libxml" = "yes"; then
8095     AC_MSG_RESULT([external])
8096     SYSTEM_LIBXSLT=TRUE
8097     if test "$_os" = "Darwin"; then
8098         dnl make sure to use SDK path
8099         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8100         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8101         dnl omit -L/usr/lib
8102         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8103         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8104     else
8105         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8106         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8107         FilterLibs "${LIBXSLT_LIBS}"
8108         LIBXSLT_LIBS="${filteredlibs}"
8109         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8110         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8111         FilterLibs "${LIBEXSLT_LIBS}"
8112         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8113     fi
8115     dnl Check for xsltproc
8116     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8117     if test "$XSLTPROC" = "no"; then
8118         AC_MSG_ERROR([xsltproc is required])
8119     fi
8120 else
8121     AC_MSG_RESULT([internal])
8122     SYSTEM_LIBXSLT=
8123     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8125     if test "$cross_compiling" = "yes"; then
8126         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8127         if test "$XSLTPROC" = "no"; then
8128             AC_MSG_ERROR([xsltproc is required])
8129         fi
8130     fi
8132 AC_SUBST(SYSTEM_LIBXSLT)
8133 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8134     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8136 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8138 AC_SUBST(LIBEXSLT_CFLAGS)
8139 AC_SUBST(LIBEXSLT_LIBS)
8140 AC_SUBST(LIBXSLT_CFLAGS)
8141 AC_SUBST(LIBXSLT_LIBS)
8142 AC_SUBST(XSLTPROC)
8144 # ===================================================================
8145 # Check for system libxml
8146 # ===================================================================
8147 AC_MSG_CHECKING([which libxml to use])
8148 if test "$with_system_libxml" = "yes"; then
8149     AC_MSG_RESULT([external])
8150     SYSTEM_LIBXML=TRUE
8151     if test "$_os" = "Darwin"; then
8152         dnl make sure to use SDK path
8153         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8154         dnl omit -L/usr/lib
8155         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8156     elif test $_os = iOS; then
8157         dnl make sure to use SDK path
8158         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8159         LIBXML_CFLAGS="-I$usr/include/libxml2"
8160         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8161     else
8162         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8163         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8164         FilterLibs "${LIBXML_LIBS}"
8165         LIBXML_LIBS="${filteredlibs}"
8166     fi
8168     dnl Check for xmllint
8169     AC_PATH_PROG(XMLLINT, xmllint, no)
8170     if test "$XMLLINT" = "no"; then
8171         AC_MSG_ERROR([xmllint is required])
8172     fi
8173 else
8174     AC_MSG_RESULT([internal])
8175     SYSTEM_LIBXML=
8176     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8177     if test "$COM" = "MSC"; then
8178         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8179     fi
8180     if test "$COM" = "MSC"; then
8181         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8182     else
8183         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8184     fi
8185     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8187 AC_SUBST(SYSTEM_LIBXML)
8188 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8189     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8191 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8192 AC_SUBST(LIBXML_CFLAGS)
8193 AC_SUBST(LIBXML_LIBS)
8194 AC_SUBST(XMLLINT)
8196 # =====================================================================
8197 # Checking for a Python interpreter with version >= 2.7.
8198 # Build and runtime requires Python 3 compatible version (>= 2.7).
8199 # Optionally user can pass an option to configure, i. e.
8200 # ./configure PYTHON=/usr/bin/python
8201 # =====================================================================
8202 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8203     # This allows a lack of system python with no error, we use internal one in that case.
8204     AM_PATH_PYTHON([2.7],, [:])
8205     # Clean PYTHON_VERSION checked below if cross-compiling
8206     PYTHON_VERSION=""
8207     if test "$PYTHON" != ":"; then
8208         PYTHON_FOR_BUILD=$PYTHON
8209     fi
8211 AC_SUBST(PYTHON_FOR_BUILD)
8213 # Checks for Python to use for Pyuno
8214 AC_MSG_CHECKING([which Python to use for Pyuno])
8215 case "$enable_python" in
8216 no|disable)
8217     if test -z $PYTHON_FOR_BUILD; then
8218         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8219         # requirement from the choice whether to include Python stuff in the installer, but why
8220         # bother?
8221         AC_MSG_ERROR([Python is required at build time.])
8222     fi
8223     enable_python=no
8224     AC_MSG_RESULT([none])
8225     ;;
8226 ""|yes|auto)
8227     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8228         AC_MSG_RESULT([no, overridden by --disable-scripting])
8229         enable_python=no
8230     elif test $build_os = cygwin; then
8231         dnl When building on Windows we don't attempt to use any installed
8232         dnl "system"  Python.
8233         AC_MSG_RESULT([fully internal])
8234         enable_python=internal
8235     elif test "$cross_compiling" = yes; then
8236         AC_MSG_RESULT([system])
8237         enable_python=system
8238     else
8239         # Unset variables set by the above AM_PATH_PYTHON so that
8240         # we actually do check anew.
8241         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
8242         AM_PATH_PYTHON([3.3],, [:])
8243         if test "$PYTHON" = ":"; then
8244             if test -z "$PYTHON_FOR_BUILD"; then
8245                 AC_MSG_RESULT([fully internal])
8246             else
8247                 AC_MSG_RESULT([internal])
8248             fi
8249             enable_python=internal
8250         else
8251             AC_MSG_RESULT([system])
8252             enable_python=system
8253         fi
8254     fi
8255     ;;
8256 internal)
8257     AC_MSG_RESULT([internal])
8258     ;;
8259 fully-internal)
8260     AC_MSG_RESULT([fully internal])
8261     enable_python=internal
8262     ;;
8263 system)
8264     AC_MSG_RESULT([system])
8265     ;;
8267     AC_MSG_ERROR([Incorrect --enable-python option])
8268     ;;
8269 esac
8271 if test $enable_python != no; then
8272     BUILD_TYPE="$BUILD_TYPE PYUNO"
8275 if test $enable_python = system; then
8276     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8277         python_version=2.7
8278         PYTHON=python$python_version
8279         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8280             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8281             PYTHON_LIBS="-framework Python"
8282         else
8283             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8284             PYTHON_LIBS="`$PYTHON-config --libs`"
8285         fi
8286     fi
8287     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8288         # Fallback: Accept these in the environment, or as set above
8289         # for MacOSX.
8290         :
8291     elif test "$cross_compiling" != yes; then
8292         # Unset variables set by the above AM_PATH_PYTHON so that
8293         # we actually do check anew.
8294         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
8295         # This causes an error if no python command is found
8296         AM_PATH_PYTHON([3.3])
8297         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8298         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8299         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8300         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8301         if test -z "$PKG_CONFIG"; then
8302             PYTHON_CFLAGS="-I$python_include"
8303             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8304         elif $PKG_CONFIG --exists python-$python_version; then
8305             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8306             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8307         else
8308             PYTHON_CFLAGS="-I$python_include"
8309             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8310         fi
8311         FilterLibs "${PYTHON_LIBS}"
8312         PYTHON_LIBS="${filteredlibs}"
8313     else
8314         dnl How to find out the cross-compilation Python installation path?
8315         AC_MSG_CHECKING([for python version])
8316         AS_IF([test -n "$PYTHON_VERSION"],
8317               [AC_MSG_RESULT([$PYTHON_VERSION])],
8318               [AC_MSG_RESULT([not found])
8319                AC_MSG_ERROR([no usable python found])])
8320         test -n "$PYTHON_CFLAGS" && break
8321     fi
8323     dnl Check if the headers really work
8324     save_CPPFLAGS="$CPPFLAGS"
8325     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8326     AC_CHECK_HEADER(Python.h)
8327     CPPFLAGS="$save_CPPFLAGS"
8329     # let the PYTHON_FOR_BUILD match the same python installation that
8330     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8331     # better for PythonTests.
8332     PYTHON_FOR_BUILD=$PYTHON
8335 if test "$with_lxml" != no; then
8336     if test -z "$PYTHON_FOR_BUILD"; then
8337         case $build_os in
8338             cygwin)
8339                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8340                 ;;
8341             *)
8342                 if test "$cross_compiling" != yes ; then
8343                     BUILD_TYPE="$BUILD_TYPE LXML"
8344                 fi
8345                 ;;
8346         esac
8347     else
8348         AC_MSG_CHECKING([for python lxml])
8349         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8350             AC_MSG_RESULT([yes])
8351         else
8352             case $build_os in
8353                 cygwin)
8354                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8355                     ;;
8356                 *)
8357                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8358                         BUILD_TYPE="$BUILD_TYPE LXML"
8359                         AC_MSG_RESULT([no, using internal lxml])
8360                     else
8361                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8362                     fi
8363                     ;;
8364             esac
8365         fi
8366     fi
8369 dnl By now enable_python should be "system", "internal" or "no"
8370 case $enable_python in
8371 system)
8372     SYSTEM_PYTHON=TRUE
8374     if test "x$ac_cv_header_Python_h" != "xyes"; then
8375        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8376     fi
8378     AC_LANG_PUSH(C)
8379     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8380     AC_MSG_CHECKING([for correct python library version])
8381        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8382 #include <Python.h>
8384 int main(int argc, char **argv) {
8385    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8386        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8387    else return 1;
8389        ]])],[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])])
8390     CFLAGS=$save_CFLAGS
8391     AC_LANG_POP(C)
8393     dnl FIXME Check if the Python library can be linked with, too?
8394     ;;
8396 internal)
8397     SYSTEM_PYTHON=
8398     PYTHON_VERSION_MAJOR=3
8399     PYTHON_VERSION_MINOR=5
8400     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.5
8401     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8402         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8403     fi
8404     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8405     BUILD_TYPE="$BUILD_TYPE PYTHON"
8406     # Embedded Python dies without Home set
8407     if test "$HOME" = ""; then
8408         export HOME=""
8409     fi
8410     ;;
8412     DISABLE_PYTHON=TRUE
8413     SYSTEM_PYTHON=
8414     ;;
8416     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8417     ;;
8418 esac
8420 AC_SUBST(DISABLE_PYTHON)
8421 AC_SUBST(SYSTEM_PYTHON)
8422 AC_SUBST(PYTHON_CFLAGS)
8423 AC_SUBST(PYTHON_LIBS)
8424 AC_SUBST(PYTHON_VERSION)
8425 AC_SUBST(PYTHON_VERSION_MAJOR)
8426 AC_SUBST(PYTHON_VERSION_MINOR)
8428 ENABLE_MARIADBC=TRUE
8429 if test "$_os" = "Android" -o "$_os" = "iOS"; then
8430     ENABLE_MARIADBC=
8432 MARIADBC_MAJOR=1
8433 MARIADBC_MINOR=0
8434 MARIADBC_MICRO=2
8435 if test "$ENABLE_MARIADBC" = "TRUE"; then
8436     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8439 AC_SUBST(ENABLE_MARIADBC)
8440 AC_SUBST(MARIADBC_MAJOR)
8441 AC_SUBST(MARIADBC_MINOR)
8442 AC_SUBST(MARIADBC_MICRO)
8444 if test "$ENABLE_MARIADBC" = "TRUE"; then
8445     dnl ===================================================================
8446     dnl Check for system MariaDB
8447     dnl ===================================================================
8448     AC_MSG_CHECKING([which MariaDB to use])
8449     if test "$with_system_mariadb" = "yes"; then
8450         AC_MSG_RESULT([external])
8451         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8452         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8453         if test -z "$MARIADBCONFIG"; then
8454             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8455             if test -z "$MARIADBCONFIG"; then
8456                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8457                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8458             fi
8459         fi
8460         AC_MSG_CHECKING([MariaDB version])
8461         MARIADB_VERSION=`$MARIADBCONFIG --version`
8462         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8463         if test "$MARIADB_MAJOR" -ge "5"; then
8464             AC_MSG_RESULT([OK])
8465         else
8466             AC_MSG_ERROR([too old, use 5.0.x or later])
8467         fi
8468         AC_MSG_CHECKING([for MariaDB Client library])
8469         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8470         if test "$COM_IS_CLANG" = TRUE; then
8471             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8472         fi
8473         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8474         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8475         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8476         dnl linux32:
8477         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8478             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8479             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8480                 | sed -e 's|/lib64/|/lib/|')
8481         fi
8482         FilterLibs "${MARIADB_LIBS}"
8483         MARIADB_LIBS="${filteredlibs}"
8484         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8485         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8486         if test "$enable_bundle_mariadb" = "yes"; then
8487             AC_MSG_RESULT([yes])
8488             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8489             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8491 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8493 /g' | grep -E '(mysqlclient|mariadb)')
8494             if test "$_os" = "Darwin"; then
8495                 LIBMARIADB=${LIBMARIADB}.dylib
8496             elif test "$_os" = "WINNT"; then
8497                 LIBMARIADB=${LIBMARIADB}.dll
8498             else
8499                 LIBMARIADB=${LIBMARIADB}.so
8500             fi
8501             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8502             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8503             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8504                 AC_MSG_RESULT([found.])
8505                 PathFormat "$LIBMARIADB_PATH"
8506                 LIBMARIADB_PATH="$formatted_path"
8507             else
8508                 AC_MSG_ERROR([not found.])
8509             fi
8510         else
8511             AC_MSG_RESULT([no])
8512             BUNDLE_MARIADB_CONNECTOR_C=
8513         fi
8514     else
8515         AC_MSG_RESULT([internal])
8516         SYSTEM_MARIADB_CONNECTOR_C=
8517         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8518         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8519         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8520     fi
8522     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8523     AC_SUBST(MARIADB_CFLAGS)
8524     AC_SUBST(MARIADB_LIBS)
8525     AC_SUBST(LIBMARIADB)
8526     AC_SUBST(LIBMARIADB_PATH)
8527     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8530 dnl ===================================================================
8531 dnl Check for system hsqldb
8532 dnl ===================================================================
8533 if test "$with_java" != "no"; then
8534     HSQLDB_USE_JDBC_4_1=
8535     AC_MSG_CHECKING([which hsqldb to use])
8536     if test "$with_system_hsqldb" = "yes"; then
8537         AC_MSG_RESULT([external])
8538         SYSTEM_HSQLDB=TRUE
8539         if test -z $HSQLDB_JAR; then
8540             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8541         fi
8542         if ! test -f $HSQLDB_JAR; then
8543                AC_MSG_ERROR(hsqldb.jar not found.)
8544         fi
8545         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8546         export HSQLDB_JAR
8547         if $PERL -e \
8548            'use Archive::Zip;
8549             my $file = "$ENV{'HSQLDB_JAR'}";
8550             my $zip = Archive::Zip->new( $file );
8551             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8552             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8553             {
8554                 push @l, split(/\n/, $mf);
8555                 foreach my $line (@l)
8556                 {
8557                     if ($line =~ m/Specification-Version:/)
8558                     {
8559                         ($t, $version) = split (/:/,$line);
8560                         $version =~ s/^\s//;
8561                         ($a, $b, $c, $d) = split (/\./,$version);
8562                         if ($c == "0" && $d > "8")
8563                         {
8564                             exit 0;
8565                         }
8566                         else
8567                         {
8568                             exit 1;
8569                         }
8570                     }
8571                 }
8572             }
8573             else
8574             {
8575                 exit 1;
8576             }'; then
8577             AC_MSG_RESULT([yes])
8578         else
8579             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8580         fi
8581     else
8582         AC_MSG_RESULT([internal])
8583         SYSTEM_HSQLDB=
8584         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8585         NEED_ANT=TRUE
8586         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8587         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8588         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8589             AC_MSG_RESULT([yes])
8590             HSQLDB_USE_JDBC_4_1=TRUE
8591         else
8592             AC_MSG_RESULT([no])
8593         fi
8594     fi
8595     AC_SUBST(SYSTEM_HSQLDB)
8596     AC_SUBST(HSQLDB_JAR)
8597     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8600 dnl ===================================================================
8601 dnl Check for PostgreSQL stuff
8602 dnl ===================================================================
8603 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8604 if test "x$enable_postgresql_sdbc" != "xno"; then
8605     AC_MSG_RESULT([yes])
8606     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8608     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8609         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8610     fi
8611     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8612         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8613     fi
8615     postgres_interface=""
8616     if test "$with_system_postgresql" = "yes"; then
8617         postgres_interface="external PostgreSQL"
8618         SYSTEM_POSTGRESQL=TRUE
8619         if test "$_os" = Darwin; then
8620             supp_path=''
8621             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8622                 pg_supp_path="$P_SEP$d$pg_supp_path"
8623             done
8624         fi
8625         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8626         if test -z "$PGCONFIG"; then
8627             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8628         fi
8629         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8630         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8631         FilterLibs "${POSTGRESQL_LIB}"
8632         POSTGRESQL_LIB="${filteredlibs}"
8633     else
8634         # if/when anything else than PostgreSQL uses Kerberos,
8635         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8636         WITH_KRB5=
8637         WITH_GSSAPI=
8638         case "$_os" in
8639         Darwin)
8640             # MacOS X has system MIT Kerberos 5 since 10.4
8641             if test "$with_krb5" != "no"; then
8642                 WITH_KRB5=TRUE
8643                 save_LIBS=$LIBS
8644                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8645                 # that the libraries where these functions are located on macOS will change, is it?
8646                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8647                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8648                 KRB5_LIBS=$LIBS
8649                 LIBS=$save_LIBS
8650                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8651                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8652                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8653                 LIBS=$save_LIBS
8654             fi
8655             if test "$with_gssapi" != "no"; then
8656                 WITH_GSSAPI=TRUE
8657                 save_LIBS=$LIBS
8658                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8659                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8660                 GSSAPI_LIBS=$LIBS
8661                 LIBS=$save_LIBS
8662             fi
8663             ;;
8664         WINNT)
8665             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8666                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8667             fi
8668             ;;
8669         Linux|GNU|*BSD|DragonFly)
8670             if test "$with_krb5" != "no"; then
8671                 WITH_KRB5=TRUE
8672                 save_LIBS=$LIBS
8673                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8674                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8675                 KRB5_LIBS=$LIBS
8676                 LIBS=$save_LIBS
8677                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8678                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8679                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8680                 LIBS=$save_LIBS
8681             fi
8682             if test "$with_gssapi" != "no"; then
8683                 WITH_GSSAPI=TRUE
8684                 save_LIBS=$LIBS
8685                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8686                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8687                 GSSAPI_LIBS=$LIBS
8688                 LIBS=$save_LIBS
8689             fi
8690             ;;
8691         *)
8692             if test "$with_krb5" = "yes"; then
8693                 WITH_KRB5=TRUE
8694                 save_LIBS=$LIBS
8695                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8696                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8697                 KRB5_LIBS=$LIBS
8698                 LIBS=$save_LIBS
8699                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8700                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8701                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8702                 LIBS=$save_LIBS
8703             fi
8704             if test "$with_gssapi" = "yes"; then
8705                 WITH_GSSAPI=TRUE
8706                 save_LIBS=$LIBS
8707                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8708                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8709                 LIBS=$save_LIBS
8710                 GSSAPI_LIBS=$LIBS
8711             fi
8712         esac
8714         if test -n "$with_libpq_path"; then
8715             SYSTEM_POSTGRESQL=TRUE
8716             postgres_interface="external libpq"
8717             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8718             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8719         else
8720             SYSTEM_POSTGRESQL=
8721             postgres_interface="internal"
8722             POSTGRESQL_LIB=""
8723             POSTGRESQL_INC="%OVERRIDE_ME%"
8724             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8725         fi
8726     fi
8728     AC_MSG_CHECKING([PostgreSQL C interface])
8729     AC_MSG_RESULT([$postgres_interface])
8731     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8732         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8733         save_CFLAGS=$CFLAGS
8734         save_CPPFLAGS=$CPPFLAGS
8735         save_LIBS=$LIBS
8736         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8737         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8738         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8739         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8740             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8741         CFLAGS=$save_CFLAGS
8742         CPPFLAGS=$save_CPPFLAGS
8743         LIBS=$save_LIBS
8744     fi
8745     BUILD_POSTGRESQL_SDBC=TRUE
8746 else
8747     AC_MSG_RESULT([no])
8749 AC_SUBST(WITH_KRB5)
8750 AC_SUBST(WITH_GSSAPI)
8751 AC_SUBST(GSSAPI_LIBS)
8752 AC_SUBST(KRB5_LIBS)
8753 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8754 AC_SUBST(SYSTEM_POSTGRESQL)
8755 AC_SUBST(POSTGRESQL_INC)
8756 AC_SUBST(POSTGRESQL_LIB)
8758 dnl ===================================================================
8759 dnl Check for Firebird stuff
8760 dnl ===================================================================
8761 ENABLE_FIREBIRD_SDBC=""
8762 if test "$enable_firebird_sdbc" = "yes" ; then
8763     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8765     dnl ===================================================================
8766     dnl Check for system Firebird
8767     dnl ===================================================================
8768     AC_MSG_CHECKING([which Firebird to use])
8769     if test "$with_system_firebird" = "yes"; then
8770         AC_MSG_RESULT([external])
8771         SYSTEM_FIREBIRD=TRUE
8772         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8773         if test -z "$FIREBIRDCONFIG"; then
8774             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8775             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8776                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8777             ])
8778             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8779         else
8780             AC_MSG_NOTICE([fb_config found])
8781             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8782             AC_MSG_CHECKING([for Firebird Client library])
8783             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8784             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8785             FilterLibs "${FIREBIRD_LIBS}"
8786             FIREBIRD_LIBS="${filteredlibs}"
8787         fi
8788         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8789         AC_MSG_CHECKING([Firebird version])
8790         if test -n "${FIREBIRD_VERSION}"; then
8791             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8792             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8793             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8794                 AC_MSG_RESULT([OK])
8795             else
8796                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8797             fi
8798         else
8799             __save_CFLAGS="${CFLAGS}"
8800             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8801             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8802 #if defined(FB_API_VER) && FB_API_VER == 30
8803 int fb_api_is_30(void) { return 0; }
8804 #else
8805 #error "Wrong Firebird API version"
8806 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8807             CFLAGS="${__save_CFLAGS}"
8808         fi
8809         ENABLE_FIREBIRD_SDBC="TRUE"
8810     elif test "$enable_database_connectivity" != yes; then
8811         AC_MSG_RESULT([none])
8812     elif test "$cross_compiling" = "yes"; then
8813         AC_MSG_RESULT([none])
8814     else
8815         dnl Embedded Firebird has version 3.0
8816         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8817         dnl We need libatomic-ops for any non X86/X64 system
8818         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8819             dnl ===================================================================
8820             dnl Check for system libatomic-ops
8821             dnl ===================================================================
8822             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8823             if test "$with_system_libatomic_ops" = "yes"; then
8824                 SYSTEM_LIBATOMIC_OPS=TRUE
8825                 AC_CHECK_HEADERS(atomic_ops.h, [],
8826                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8827             else
8828                 SYSTEM_LIBATOMIC_OPS=
8829                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8830                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8831                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8832             fi
8833         fi
8835         AC_MSG_RESULT([internal])
8836         SYSTEM_FIREBIRD=
8837         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8838         FIREBIRD_LIBS="-lfbclient"
8840         if test "$with_system_libtommath" = "yes"; then
8841             SYSTEM_LIBTOMMATH=TRUE
8842             dnl check for tommath presence
8843             save_LIBS=$LIBS
8844             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8845             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8846             LIBS=$save_LIBS
8847         else
8848             SYSTEM_LIBTOMMATH=
8849             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8850             LIBTOMMATH_LIBS="-ltommath"
8851             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8852         fi
8854         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8855         ENABLE_FIREBIRD_SDBC="TRUE"
8856         AC_DEFINE(ENABLE_FIREBIRD_SDBC)
8857     fi
8859 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8860 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8861 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8862 AC_SUBST(LIBATOMIC_OPS_LIBS)
8863 AC_SUBST(SYSTEM_FIREBIRD)
8864 AC_SUBST(FIREBIRD_CFLAGS)
8865 AC_SUBST(FIREBIRD_LIBS)
8866 AC_SUBST([TOMMATH_CFLAGS])
8867 AC_SUBST([TOMMATH_LIBS])
8869 dnl ===================================================================
8870 dnl Check for system curl
8871 dnl ===================================================================
8872 AC_MSG_CHECKING([which libcurl to use])
8873 if test "$with_system_curl" = "auto"; then
8874     with_system_curl="$with_system_libs"
8877 if test "$with_system_curl" = "yes"; then
8878     AC_MSG_RESULT([external])
8879     SYSTEM_CURL=TRUE
8881     # First try PKGCONFIG and then fall back
8882     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8884     if test -n "$CURL_PKG_ERRORS"; then
8885         AC_PATH_PROG(CURLCONFIG, curl-config)
8886         if test -z "$CURLCONFIG"; then
8887             AC_MSG_ERROR([curl development files not found])
8888         fi
8889         CURL_LIBS=`$CURLCONFIG --libs`
8890         FilterLibs "${CURL_LIBS}"
8891         CURL_LIBS="${filteredlibs}"
8892         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8893         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8895         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8896         case $curl_version in
8897         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8898         dnl so they need to be doubled to end up in the configure script
8899         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8900             AC_MSG_RESULT([yes])
8901             ;;
8902         *)
8903             AC_MSG_ERROR([no, you have $curl_version])
8904             ;;
8905         esac
8906     fi
8908     ENABLE_CURL=TRUE
8909 elif test $_os = iOS; then
8910     # Let's see if we need curl, I think not?
8911     AC_MSG_RESULT([none])
8912     ENABLE_CURL=
8913 else
8914     AC_MSG_RESULT([internal])
8915     SYSTEM_CURL=
8916     BUILD_TYPE="$BUILD_TYPE CURL"
8917     ENABLE_CURL=TRUE
8919 AC_SUBST(SYSTEM_CURL)
8920 AC_SUBST(CURL_CFLAGS)
8921 AC_SUBST(CURL_LIBS)
8922 AC_SUBST(ENABLE_CURL)
8924 dnl ===================================================================
8925 dnl Check for system boost
8926 dnl ===================================================================
8927 AC_MSG_CHECKING([which boost to use])
8928 if test "$with_system_boost" = "yes"; then
8929     AC_MSG_RESULT([external])
8930     SYSTEM_BOOST=TRUE
8931     AX_BOOST_BASE(1.47)
8932     AX_BOOST_DATE_TIME
8933     AX_BOOST_FILESYSTEM
8934     AX_BOOST_IOSTREAMS
8935     AX_BOOST_LOCALE
8936     AC_LANG_PUSH([C++])
8937     save_CXXFLAGS=$CXXFLAGS
8938     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8939     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8940        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8941     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8942        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8943     CXXFLAGS=$save_CXXFLAGS
8944     AC_LANG_POP([C++])
8945     # this is in m4/ax_boost_base.m4
8946     FilterLibs "${BOOST_LDFLAGS}"
8947     BOOST_LDFLAGS="${filteredlibs}"
8948 else
8949     AC_MSG_RESULT([internal])
8950     BUILD_TYPE="$BUILD_TYPE BOOST"
8951     SYSTEM_BOOST=
8952     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8953         # use warning-suppressing wrapper headers
8954         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8955     else
8956         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8957     fi
8959 AC_SUBST(SYSTEM_BOOST)
8961 dnl ===================================================================
8962 dnl Check for system mdds
8963 dnl ===================================================================
8964 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8966 dnl ===================================================================
8967 dnl Check for system glm
8968 dnl ===================================================================
8969 AC_MSG_CHECKING([which glm to use])
8970 if test "$with_system_glm" = "yes"; then
8971     AC_MSG_RESULT([external])
8972     SYSTEM_GLM=TRUE
8973     AC_LANG_PUSH([C++])
8974     AC_CHECK_HEADER([glm/glm.hpp], [],
8975        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8976     AC_LANG_POP([C++])
8977 else
8978     AC_MSG_RESULT([internal])
8979     BUILD_TYPE="$BUILD_TYPE GLM"
8980     SYSTEM_GLM=
8981     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8983 AC_SUBST([GLM_CFLAGS])
8984 AC_SUBST([SYSTEM_GLM])
8986 dnl ===================================================================
8987 dnl Check for system odbc
8988 dnl ===================================================================
8989 AC_MSG_CHECKING([which odbc headers to use])
8990 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
8991     AC_MSG_RESULT([external])
8992     SYSTEM_ODBC_HEADERS=TRUE
8994     if test "$build_os" = "cygwin"; then
8995         save_CPPFLAGS=$CPPFLAGS
8996         find_winsdk
8997         PathFormat "$winsdktest"
8998         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"
8999         AC_CHECK_HEADER(sqlext.h, [],
9000             [AC_MSG_ERROR(odbc not found. install odbc)],
9001             [#include <windows.h>])
9002         CPPFLAGS=$save_CPPFLAGS
9003     else
9004         AC_CHECK_HEADER(sqlext.h, [],
9005             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9006     fi
9007 elif test "$enable_database_connectivity" != yes; then
9008     AC_MSG_RESULT([none])
9009 else
9010     AC_MSG_RESULT([internal])
9011     SYSTEM_ODBC_HEADERS=
9013 AC_SUBST(SYSTEM_ODBC_HEADERS)
9016 dnl ===================================================================
9017 dnl Check for system openldap
9018 dnl ===================================================================
9020 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9021 AC_MSG_CHECKING([which openldap library to use])
9022 if test "$with_system_openldap" = "yes"; then
9023     AC_MSG_RESULT([external])
9024     SYSTEM_OPENLDAP=TRUE
9025     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9026     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9027     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9028 else
9029     AC_MSG_RESULT([internal])
9030     SYSTEM_OPENLDAP=
9031     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9034 AC_SUBST(SYSTEM_OPENLDAP)
9036 dnl ===================================================================
9037 dnl Check for system NSS
9038 dnl ===================================================================
9039 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9040     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9041     AC_DEFINE(HAVE_FEATURE_NSS)
9042     ENABLE_NSS="TRUE"
9043     AC_DEFINE(ENABLE_NSS)
9044 elif test $_os != iOS ; then
9045     with_tls=openssl
9047 AC_SUBST(ENABLE_NSS)
9049 dnl ===================================================================
9050 dnl Check for TLS/SSL and cryptographic implementation to use
9051 dnl ===================================================================
9052 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9053 if test -n "$with_tls"; then
9054     case $with_tls in
9055     openssl)
9056         AC_DEFINE(USE_TLS_OPENSSL)
9057         TLS=OPENSSL
9059         if test "$enable_openssl" != "yes"; then
9060             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9061         fi
9063         # warn that OpenSSL has been selected but not all TLS code has this option
9064         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9065         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9066         ;;
9067     nss)
9068         AC_DEFINE(USE_TLS_NSS)
9069         TLS=NSS
9070         ;;
9071     no)
9072         AC_MSG_WARN([Skipping TLS/SSL])
9073         ;;
9074     *)
9075         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9076 openssl - OpenSSL
9077 nss - Mozilla's Network Security Services (NSS)
9078     ])
9079         ;;
9080     esac
9081 else
9082     # default to using NSS, it results in smaller oox lib
9083     AC_DEFINE(USE_TLS_NSS)
9084     TLS=NSS
9086 AC_MSG_RESULT([$TLS])
9087 AC_SUBST(TLS)
9089 dnl ===================================================================
9090 dnl Check for system sane
9091 dnl ===================================================================
9092 AC_MSG_CHECKING([which sane header to use])
9093 if test "$with_system_sane" = "yes"; then
9094     AC_MSG_RESULT([external])
9095     AC_CHECK_HEADER(sane/sane.h, [],
9096       [AC_MSG_ERROR(sane not found. install sane)], [])
9097 else
9098     AC_MSG_RESULT([internal])
9099     BUILD_TYPE="$BUILD_TYPE SANE"
9102 dnl ===================================================================
9103 dnl Check for system icu
9104 dnl ===================================================================
9105 SYSTEM_GENBRK=
9106 SYSTEM_GENCCODE=
9107 SYSTEM_GENCMN=
9109 ICU_MAJOR=62
9110 ICU_MINOR=1
9111 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9112 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9113 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9114 AC_MSG_CHECKING([which icu to use])
9115 if test "$with_system_icu" = "yes"; then
9116     AC_MSG_RESULT([external])
9117     SYSTEM_ICU=TRUE
9118     AC_LANG_PUSH([C++])
9119     AC_MSG_CHECKING([for unicode/rbbi.h])
9120     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9121     AC_LANG_POP([C++])
9123     if test "$cross_compiling" != "yes"; then
9124         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9125         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9126         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9127         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9128     fi
9130     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9131         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9132         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9133         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9134         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9135         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9136             AC_MSG_RESULT([yes])
9137         else
9138             AC_MSG_RESULT([no])
9139             if test "$with_system_icu_for_build" != "force"; then
9140                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9141 You can use --with-system-icu-for-build=force to use it anyway.])
9142             fi
9143         fi
9144     fi
9146     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9147         # using the system icu tools can lead to version confusion, use the
9148         # ones from the build environment when cross-compiling
9149         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9150         if test -z "$SYSTEM_GENBRK"; then
9151             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9152         fi
9153         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9154         if test -z "$SYSTEM_GENCCODE"; then
9155             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9156         fi
9157         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9158         if test -z "$SYSTEM_GENCMN"; then
9159             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9160         fi
9161         if test "$ICU_MAJOR" -ge "49"; then
9162             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9163             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9164             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9165         else
9166             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9167             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9168             ICU_RECLASSIFIED_HEBREW_LETTER=
9169         fi
9170     fi
9172     if test "$cross_compiling" = "yes"; then
9173         if test "$ICU_MAJOR" -ge "50"; then
9174             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9175             ICU_MINOR=""
9176         fi
9177     fi
9178 else
9179     AC_MSG_RESULT([internal])
9180     SYSTEM_ICU=
9181     BUILD_TYPE="$BUILD_TYPE ICU"
9182     # surprisingly set these only for "internal" (to be used by various other
9183     # external libs): the system icu-config is quite unhelpful and spits out
9184     # dozens of weird flags and also default path -I/usr/include
9185     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9186     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9188 if test "$ICU_MAJOR" -ge "59"; then
9189     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9190     # with -std=c++11 but not all external libraries can be built with that,
9191     # for those use a bit-compatible typedef uint16_t UChar; see
9192     # icu/source/common/unicode/umachine.h
9193     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9194 else
9195     ICU_UCHAR_TYPE=""
9197 AC_SUBST(SYSTEM_ICU)
9198 AC_SUBST(SYSTEM_GENBRK)
9199 AC_SUBST(SYSTEM_GENCCODE)
9200 AC_SUBST(SYSTEM_GENCMN)
9201 AC_SUBST(ICU_MAJOR)
9202 AC_SUBST(ICU_MINOR)
9203 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9204 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9205 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9206 AC_SUBST(ICU_CFLAGS)
9207 AC_SUBST(ICU_LIBS)
9208 AC_SUBST(ICU_UCHAR_TYPE)
9210 dnl ==================================================================
9211 dnl Breakpad
9212 dnl ==================================================================
9213 AC_MSG_CHECKING([whether to enable breakpad])
9214 if test "$enable_breakpad" != yes; then
9215     AC_MSG_RESULT([no])
9216 else
9217     AC_MSG_RESULT([yes])
9218     ENABLE_BREAKPAD="TRUE"
9219     AC_DEFINE(ENABLE_BREAKPAD)
9220     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9221     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9223     AC_MSG_CHECKING([for crashreport config])
9224     if test "$with_symbol_config" = "no"; then
9225         BREAKPAD_SYMBOL_CONFIG="invalid"
9226         AC_MSG_RESULT([no])
9227     else
9228         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9229         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9230         AC_MSG_RESULT([yes])
9231     fi
9232     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9234 AC_SUBST(ENABLE_BREAKPAD)
9236 dnl ==================================================================
9237 dnl libfuzzer
9238 dnl ==================================================================
9239 AC_MSG_CHECKING([whether to enable fuzzers])
9240 if test "$enable_fuzzers" != yes; then
9241     AC_MSG_RESULT([no])
9242 else
9243     AC_MSG_RESULT([yes])
9244     ENABLE_FUZZERS="TRUE"
9245     AC_DEFINE(ENABLE_FUZZERS)
9246     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9248 AC_SUBST(ENABLE_FUZZERS)
9250 dnl ===================================================================
9251 dnl Orcus
9252 dnl ===================================================================
9253 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9254 if test "$with_system_orcus" != "yes"; then
9255     if test "$SYSTEM_BOOST" = "TRUE"; then
9256         # ===========================================================
9257         # Determine if we are going to need to link with Boost.System
9258         # ===========================================================
9259         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9260         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9261         dnl in documentation has no effect.
9262         AC_MSG_CHECKING([if we need to link with Boost.System])
9263         AC_LANG_PUSH([C++])
9264         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9265                 @%:@include <boost/version.hpp>
9266             ]],[[
9267                 #if BOOST_VERSION >= 105000
9268                 #   error yes, we need to link with Boost.System
9269                 #endif
9270             ]])],[
9271                 AC_MSG_RESULT([no])
9272             ],[
9273                 AC_MSG_RESULT([yes])
9274                 AX_BOOST_SYSTEM
9275         ])
9276         AC_LANG_POP([C++])
9277     fi
9279 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9280 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9281 AC_SUBST([BOOST_SYSTEM_LIB])
9282 AC_SUBST(SYSTEM_LIBORCUS)
9284 dnl ===================================================================
9285 dnl HarfBuzz
9286 dnl ===================================================================
9287 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9288                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9289                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9291 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9292                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9293                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9295 if test "$COM" = "MSC"; then # override the above
9296     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9297     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9300 if test "$with_system_harfbuzz" = "yes"; then
9301     if test "$with_system_graphite" = "no"; then
9302         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9303     fi
9304     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9305     _save_libs="$LIBS"
9306     _save_cflags="$CFLAGS"
9307     LIBS="$LIBS $HARFBUZZ_LIBS"
9308     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9309     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9310     LIBS="$_save_libs"
9311     CFLAGS="$_save_cflags"
9312 else
9313     if test "$with_system_graphite" = "yes"; then
9314         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9315     fi
9318 AC_MSG_CHECKING([whether to use X11])
9319 dnl ***************************************
9320 dnl testing for X libraries and includes...
9321 dnl ***************************************
9322 if test "$USING_X11" = TRUE; then
9323     AC_DEFINE(HAVE_FEATURE_X11)
9325 AC_MSG_RESULT([$USING_X11])
9327 if test "$USING_X11" = TRUE; then
9328     AC_PATH_X
9329     AC_PATH_XTRA
9330     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9332     if test -z "$x_includes"; then
9333         x_includes="default_x_includes"
9334     fi
9335     if test -z "$x_libraries"; then
9336         x_libraries="default_x_libraries"
9337     fi
9338     CFLAGS="$CFLAGS $X_CFLAGS"
9339     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9340     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9341 else
9342     x_includes="no_x_includes"
9343     x_libraries="no_x_libraries"
9346 if test "$USING_X11" = TRUE; then
9347     dnl ===================================================================
9348     dnl Check for extension headers
9349     dnl ===================================================================
9350     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9351      [#include <X11/extensions/shape.h>])
9353     # vcl needs ICE and SM
9354     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9355     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9356         [AC_MSG_ERROR(ICE library not found)])
9357     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9358     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9359         [AC_MSG_ERROR(SM library not found)])
9362 dnl ===================================================================
9363 dnl Check for system Xrender
9364 dnl ===================================================================
9365 AC_MSG_CHECKING([whether to use Xrender])
9366 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9367     AC_MSG_RESULT([yes])
9368     PKG_CHECK_MODULES(XRENDER, xrender)
9369     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9370     FilterLibs "${XRENDER_LIBS}"
9371     XRENDER_LIBS="${filteredlibs}"
9372     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9373       [AC_MSG_ERROR(libXrender not found or functional)], [])
9374     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9375       [AC_MSG_ERROR(Xrender not found. install X)], [])
9376 else
9377     AC_MSG_RESULT([no])
9379 AC_SUBST(XRENDER_CFLAGS)
9380 AC_SUBST(XRENDER_LIBS)
9382 dnl ===================================================================
9383 dnl Check for XRandr
9384 dnl ===================================================================
9385 AC_MSG_CHECKING([whether to enable RandR support])
9386 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9387     AC_MSG_RESULT([yes])
9388     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9389     if test "$ENABLE_RANDR" != "TRUE"; then
9390         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9391                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9392         XRANDR_CFLAGS=" "
9393         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9394           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9395         XRANDR_LIBS="-lXrandr "
9396         ENABLE_RANDR="TRUE"
9397     fi
9398     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9399     FilterLibs "${XRANDR_LIBS}"
9400     XRANDR_LIBS="${filteredlibs}"
9401 else
9402     ENABLE_RANDR=""
9403     AC_MSG_RESULT([no])
9405 AC_SUBST(XRANDR_CFLAGS)
9406 AC_SUBST(XRANDR_LIBS)
9407 AC_SUBST(ENABLE_RANDR)
9409 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9410     WITH_WEBDAV="serf"
9412 if test $_os = iOS -o $_os = Android; then
9413     WITH_WEBDAV="no"
9415 AC_MSG_CHECKING([for webdav library])
9416 case "$WITH_WEBDAV" in
9417 serf)
9418     AC_MSG_RESULT([serf])
9419     # Check for system apr-util
9420     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9421                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9422                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9423     if test "$COM" = "MSC"; then
9424         APR_LIB_DIR="LibR"
9425         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9426         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9427     fi
9429     # Check for system serf
9430     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9431                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9432     if test "$COM" = "MSC"; then
9433         SERF_LIB_DIR="Release"
9434         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9435         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9436     fi
9437     ;;
9438 neon)
9439     AC_MSG_RESULT([neon])
9440     # Check for system neon
9441     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9442     if test "$with_system_neon" = "yes"; then
9443         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9444     else
9445         NEON_VERSION=0295
9446     fi
9447     AC_SUBST(NEON_VERSION)
9448     ;;
9450     AC_MSG_RESULT([none, disabled])
9451     WITH_WEBDAV=""
9452     ;;
9453 esac
9454 AC_SUBST(WITH_WEBDAV)
9456 dnl ===================================================================
9457 dnl Check for disabling cve_tests
9458 dnl ===================================================================
9459 AC_MSG_CHECKING([whether to execute CVE tests])
9460 # If not explicitly enabled or disabled, default
9461 if test -z "$enable_cve_tests"; then
9462     case "$OS" in
9463     WNT)
9464         # Default cves off for windows with its wild and wonderful
9465         # varienty of AV software kicking in and panicking
9466         enable_cve_tests=no
9467         ;;
9468     *)
9469         # otherwise yes
9470         enable_cve_tests=yes
9471         ;;
9472     esac
9474 if test "$enable_cve_tests" = "no"; then
9475     AC_MSG_RESULT([no])
9476     DISABLE_CVE_TESTS=TRUE
9477     AC_SUBST(DISABLE_CVE_TESTS)
9478 else
9479     AC_MSG_RESULT([yes])
9482 dnl ===================================================================
9483 dnl Check for enabling chart XShape tests
9484 dnl ===================================================================
9485 AC_MSG_CHECKING([whether to execute chart XShape tests])
9486 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9487     AC_MSG_RESULT([yes])
9488     ENABLE_CHART_TESTS=TRUE
9489     AC_SUBST(ENABLE_CHART_TESTS)
9490 else
9491     AC_MSG_RESULT([no])
9494 dnl ===================================================================
9495 dnl Check for system openssl
9496 dnl ===================================================================
9497 DISABLE_OPENSSL=
9498 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9499 if test "$enable_openssl" = "yes"; then
9500     AC_MSG_RESULT([no])
9501     if test "$_os" = Darwin ; then
9502         # OpenSSL is deprecated when building for 10.7 or later.
9503         #
9504         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9505         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9507         with_system_openssl=no
9508         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9509     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9510             && test "$with_system_openssl" != "no"; then
9511         with_system_openssl=yes
9512         SYSTEM_OPENSSL=TRUE
9513         OPENSSL_CFLAGS=
9514         OPENSSL_LIBS="-lssl -lcrypto"
9515     else
9516         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9517     fi
9518     if test "$with_system_openssl" = "yes"; then
9519         AC_MSG_CHECKING([whether openssl supports SHA512])
9520         AC_LANG_PUSH([C])
9521         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9522             SHA512_CTX context;
9523 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9524         AC_LANG_POP(C)
9525     fi
9526 else
9527     AC_MSG_RESULT([yes])
9528     DISABLE_OPENSSL=TRUE
9530     # warn that although OpenSSL is disabled, system libraries may depend on it
9531     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9532     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9535 AC_SUBST([DISABLE_OPENSSL])
9537 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9538     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9539         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9540         enable_cipher_openssl_backend=no
9541     else
9542         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9543     fi
9545 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9546 ENABLE_CIPHER_OPENSSL_BACKEND=
9547 if test "$enable_cipher_openssl_backend" = yes; then
9548     AC_MSG_RESULT([yes])
9549     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9550 else
9551     AC_MSG_RESULT([no])
9553 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9555 dnl ===================================================================
9556 dnl Check for building gnutls
9557 dnl ===================================================================
9558 AC_MSG_CHECKING([whether to use gnutls])
9559 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9560     AC_MSG_RESULT([yes])
9561     AM_PATH_LIBGCRYPT()
9562     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9563         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9564                       available in the system to use as replacement.]]))
9565     FilterLibs "${LIBGCRYPT_LIBS}"
9566     LIBGCRYPT_LIBS="${filteredlibs}"
9567 else
9568     AC_MSG_RESULT([no])
9571 AC_SUBST([LIBGCRYPT_CFLAGS])
9572 AC_SUBST([LIBGCRYPT_LIBS])
9574 dnl ===================================================================
9575 dnl Check for system redland
9576 dnl ===================================================================
9577 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9578 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9579 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9580 if test "$with_system_redland" = "yes"; then
9581     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9582             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9583 else
9584     RAPTOR_MAJOR="0"
9585     RASQAL_MAJOR="3"
9586     REDLAND_MAJOR="0"
9588 AC_SUBST(RAPTOR_MAJOR)
9589 AC_SUBST(RASQAL_MAJOR)
9590 AC_SUBST(REDLAND_MAJOR)
9592 dnl ===================================================================
9593 dnl Check for system hunspell
9594 dnl ===================================================================
9595 AC_MSG_CHECKING([which libhunspell to use])
9596 if test "$with_system_hunspell" = "yes"; then
9597     AC_MSG_RESULT([external])
9598     SYSTEM_HUNSPELL=TRUE
9599     AC_LANG_PUSH([C++])
9600     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9601     if test "$HUNSPELL_PC" != "TRUE"; then
9602         AC_CHECK_HEADER(hunspell.hxx, [],
9603             [
9604             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9605             [AC_MSG_ERROR(hunspell headers not found.)], [])
9606             ], [])
9607         AC_CHECK_LIB([hunspell], [main], [:],
9608            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9609         HUNSPELL_LIBS=-lhunspell
9610     fi
9611     AC_LANG_POP([C++])
9612     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9613     FilterLibs "${HUNSPELL_LIBS}"
9614     HUNSPELL_LIBS="${filteredlibs}"
9615 else
9616     AC_MSG_RESULT([internal])
9617     SYSTEM_HUNSPELL=
9618     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9619     if test "$COM" = "MSC"; then
9620         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9621     else
9622         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9623     fi
9624     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9626 AC_SUBST(SYSTEM_HUNSPELL)
9627 AC_SUBST(HUNSPELL_CFLAGS)
9628 AC_SUBST(HUNSPELL_LIBS)
9630 dnl ===================================================================
9631 dnl Checking for altlinuxhyph
9632 dnl ===================================================================
9633 AC_MSG_CHECKING([which altlinuxhyph to use])
9634 if test "$with_system_altlinuxhyph" = "yes"; then
9635     AC_MSG_RESULT([external])
9636     SYSTEM_HYPH=TRUE
9637     AC_CHECK_HEADER(hyphen.h, [],
9638        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9639     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9640        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9641        [#include <hyphen.h>])
9642     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9643         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9644     if test -z "$HYPHEN_LIB"; then
9645         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9646            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9647     fi
9648     if test -z "$HYPHEN_LIB"; then
9649         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9650            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9651     fi
9652 else
9653     AC_MSG_RESULT([internal])
9654     SYSTEM_HYPH=
9655     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9656     if test "$COM" = "MSC"; then
9657         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9658     else
9659         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9660     fi
9662 AC_SUBST(SYSTEM_HYPH)
9663 AC_SUBST(HYPHEN_LIB)
9665 dnl ===================================================================
9666 dnl Checking for mythes
9667 dnl ===================================================================
9668 AC_MSG_CHECKING([which mythes to use])
9669 if test "$with_system_mythes" = "yes"; then
9670     AC_MSG_RESULT([external])
9671     SYSTEM_MYTHES=TRUE
9672     AC_LANG_PUSH([C++])
9673     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9674     if test "$MYTHES_PKGCONFIG" = "no"; then
9675         AC_CHECK_HEADER(mythes.hxx, [],
9676             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9677         AC_CHECK_LIB([mythes-1.2], [main], [:],
9678             [ MYTHES_FOUND=no], [])
9679     if test "$MYTHES_FOUND" = "no"; then
9680         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9681                 [ MYTHES_FOUND=no], [])
9682     fi
9683     if test "$MYTHES_FOUND" = "no"; then
9684         AC_MSG_ERROR([mythes library not found!.])
9685     fi
9686     fi
9687     AC_LANG_POP([C++])
9688     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9689     FilterLibs "${MYTHES_LIBS}"
9690     MYTHES_LIBS="${filteredlibs}"
9691 else
9692     AC_MSG_RESULT([internal])
9693     SYSTEM_MYTHES=
9694     BUILD_TYPE="$BUILD_TYPE MYTHES"
9695     if test "$COM" = "MSC"; then
9696         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9697     else
9698         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9699     fi
9701 AC_SUBST(SYSTEM_MYTHES)
9702 AC_SUBST(MYTHES_CFLAGS)
9703 AC_SUBST(MYTHES_LIBS)
9705 dnl ===================================================================
9706 dnl How should we build the linear programming solver ?
9707 dnl ===================================================================
9709 ENABLE_COINMP=
9710 AC_MSG_CHECKING([whether to build with CoinMP])
9711 if test "$enable_coinmp" != "no"; then
9712     ENABLE_COINMP=TRUE
9713     AC_MSG_RESULT([yes])
9714     if test "$with_system_coinmp" = "yes"; then
9715         SYSTEM_COINMP=TRUE
9716         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9717         FilterLibs "${COINMP_LIBS}"
9718         COINMP_LIBS="${filteredlibs}"
9719     else
9720         BUILD_TYPE="$BUILD_TYPE COINMP"
9721     fi
9722 else
9723     AC_MSG_RESULT([no])
9725 AC_SUBST(ENABLE_COINMP)
9726 AC_SUBST(SYSTEM_COINMP)
9727 AC_SUBST(COINMP_CFLAGS)
9728 AC_SUBST(COINMP_LIBS)
9730 ENABLE_LPSOLVE=
9731 AC_MSG_CHECKING([whether to build with lpsolve])
9732 if test "$enable_lpsolve" != "no"; then
9733     ENABLE_LPSOLVE=TRUE
9734     AC_MSG_RESULT([yes])
9735 else
9736     AC_MSG_RESULT([no])
9738 AC_SUBST(ENABLE_LPSOLVE)
9740 if test "$ENABLE_LPSOLVE" = TRUE; then
9741     AC_MSG_CHECKING([which lpsolve to use])
9742     if test "$with_system_lpsolve" = "yes"; then
9743         AC_MSG_RESULT([external])
9744         SYSTEM_LPSOLVE=TRUE
9745         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9746            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9747         save_LIBS=$LIBS
9748         # some systems need this. Like Ubuntu....
9749         AC_CHECK_LIB(m, floor)
9750         AC_CHECK_LIB(dl, dlopen)
9751         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9752             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9753         LIBS=$save_LIBS
9754     else
9755         AC_MSG_RESULT([internal])
9756         SYSTEM_LPSOLVE=
9757         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9758     fi
9760 AC_SUBST(SYSTEM_LPSOLVE)
9762 dnl ===================================================================
9763 dnl Checking for libexttextcat
9764 dnl ===================================================================
9765 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9766 if test "$with_system_libexttextcat" = "yes"; then
9767     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9769 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9771 dnl ===================================================================
9772 dnl Checking for libnumbertext
9773 dnl ===================================================================
9774 AC_MSG_CHECKING([whether to use libnumbertext])
9775 if test "$enable_libnumbertext" = "no"; then
9776     AC_MSG_RESULT([no])
9777     ENABLE_LIBNUMBERTEXT=
9778     SYSTEM_LIBNUMBERTEXT=
9779 else
9780     AC_MSG_RESULT([yes])
9781     ENABLE_LIBNUMBERTEXT=TRUE
9782     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9783     if test "$with_system_libnumbertext" = "yes"; then
9784         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9785         SYSTEM_LIBNUMBERTEXT=YES
9786     else
9787         SYSTEM_LIBNUMBERTEXT=
9788         AC_LANG_PUSH([C++])
9789         save_CPPFLAGS=$CPPFLAGS
9790         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9791         AC_CHECK_HEADERS([codecvt regex])
9792         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9793                 [ ENABLE_LIBNUMBERTEXT=''
9794                   LIBNUMBERTEXT_CFLAGS=''
9795                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9796                                Enable libnumbertext fallback (missing number to number name conversion).])
9797                 ])
9798         CPPFLAGS=$save_CPPFLAGS
9799         AC_LANG_POP([C++])
9800     fi
9801     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9802         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9803     fi
9805 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9806 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9807 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9808 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9810 dnl ***************************************
9811 dnl testing libc version for Linux...
9812 dnl ***************************************
9813 if test "$_os" = "Linux"; then
9814     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9815     exec 6>/dev/null # no output
9816     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9817     exec 6>&1 # output on again
9818     if test "$HAVE_LIBC"; then
9819         AC_MSG_RESULT([yes])
9820     else
9821         AC_MSG_ERROR([no, upgrade libc])
9822     fi
9825 dnl =========================================
9826 dnl Check for uuidgen
9827 dnl =========================================
9828 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9829     # presence is already tested above in the WINDOWS_SDK_HOME check
9830     UUIDGEN=uuidgen.exe
9831     AC_SUBST(UUIDGEN)
9832 else
9833     AC_PATH_PROG([UUIDGEN], [uuidgen])
9834     if test -z "$UUIDGEN"; then
9835         AC_MSG_WARN([uuid is needed for building installation sets])
9836     fi
9839 dnl ***************************************
9840 dnl Checking for bison and flex
9841 dnl ***************************************
9842 AC_PATH_PROG(BISON, bison)
9843 if test -z "$BISON"; then
9844     AC_MSG_ERROR([no bison found in \$PATH, install it])
9845 else
9846     AC_MSG_CHECKING([the bison version])
9847     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9848     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9849     # Accept newer than 2.0
9850     if test "$_bison_longver" -lt 2000; then
9851         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9852     fi
9855 AC_PATH_PROG(FLEX, flex)
9856 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9857     FLEX=`cygpath -m $FLEX`
9859 if test -z "$FLEX"; then
9860     AC_MSG_ERROR([no flex found in \$PATH, install it])
9861 else
9862     AC_MSG_CHECKING([the flex version])
9863     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9864     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9865         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9866     fi
9868 AC_SUBST([FLEX])
9869 dnl ***************************************
9870 dnl Checking for patch
9871 dnl ***************************************
9872 AC_PATH_PROG(PATCH, patch)
9873 if test -z "$PATCH"; then
9874     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9877 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9878 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9879     if test -z "$with_gnu_patch"; then
9880         GNUPATCH=$PATCH
9881     else
9882         if test -x "$with_gnu_patch"; then
9883             GNUPATCH=$with_gnu_patch
9884         else
9885             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9886         fi
9887     fi
9889     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9890     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9891         AC_MSG_RESULT([yes])
9892     else
9893         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9894     fi
9895 else
9896     GNUPATCH=$PATCH
9899 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9900     GNUPATCH=`cygpath -m $GNUPATCH`
9903 dnl We also need to check for --with-gnu-cp
9905 if test -z "$with_gnu_cp"; then
9906     # check the place where the good stuff is hidden on Solaris...
9907     if test -x /usr/gnu/bin/cp; then
9908         GNUCP=/usr/gnu/bin/cp
9909     else
9910         AC_PATH_PROGS(GNUCP, gnucp cp)
9911     fi
9912     if test -z $GNUCP; then
9913         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9914     fi
9915 else
9916     if test -x "$with_gnu_cp"; then
9917         GNUCP=$with_gnu_cp
9918     else
9919         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9920     fi
9923 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9924     GNUCP=`cygpath -m $GNUCP`
9927 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9928 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9929     AC_MSG_RESULT([yes])
9930 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9931     AC_MSG_RESULT([yes])
9932 else
9933     case "$build_os" in
9934     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9935         x_GNUCP=[\#]
9936         GNUCP=''
9937         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9938         ;;
9939     *)
9940         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9941         ;;
9942     esac
9945 AC_SUBST(GNUPATCH)
9946 AC_SUBST(GNUCP)
9947 AC_SUBST(x_GNUCP)
9949 dnl ***************************************
9950 dnl testing assembler path
9951 dnl ***************************************
9952 ML_EXE=""
9953 if test "$_os" = "WINNT"; then
9954     if test "$BITNESS_OVERRIDE" = ""; then
9955         assembler=ml.exe
9956         assembler_bin=$CL_DIR
9957     else
9958         assembler=ml64.exe
9959         assembler_bin=$CL_DIR
9960     fi
9962     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9963     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9964         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9965         AC_MSG_RESULT([found])
9966         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9967     else
9968         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9969     fi
9971     PathFormat "$ASM_HOME"
9972     ASM_HOME="$formatted_path"
9973 else
9974     ASM_HOME=""
9977 AC_SUBST(ML_EXE)
9979 dnl ===================================================================
9980 dnl We need zip and unzip
9981 dnl ===================================================================
9982 AC_PATH_PROG(ZIP, zip)
9983 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9984 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9985     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],,)
9988 AC_PATH_PROG(UNZIP, unzip)
9989 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9991 dnl ===================================================================
9992 dnl Zip must be a specific type for different build types.
9993 dnl ===================================================================
9994 if test $build_os = cygwin; then
9995     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9996         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9997     fi
10000 dnl ===================================================================
10001 dnl We need touch with -h option support.
10002 dnl ===================================================================
10003 AC_PATH_PROG(TOUCH, touch)
10004 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10005 touch warn
10006 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10007     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],,)
10010 dnl ===================================================================
10011 dnl Check for system epoxy
10012 dnl ===================================================================
10013 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10015 dnl ===================================================================
10016 dnl Set vcl option: coordinate device in double or sal_Int32
10017 dnl ===================================================================
10019 dnl disabled for now, we don't want subtle differences between OSs
10020 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10021 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10022 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10023 dnl     AC_MSG_RESULT([double])
10024 dnl else
10025 dnl     AC_MSG_RESULT([sal_Int32])
10026 dnl fi
10028 dnl ===================================================================
10029 dnl Test which vclplugs have to be built.
10030 dnl ===================================================================
10031 R=""
10032 if test "$USING_X11" != TRUE; then
10033     enable_gtk=no
10034     enable_gtk3=no
10036 GTK3_CFLAGS=""
10037 GTK3_LIBS=""
10038 ENABLE_GTK3=""
10039 if test "x$enable_gtk3" = "xyes"; then
10040     if test "$with_system_cairo" = no; then
10041         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10042     fi
10043     : ${with_system_cairo:=yes}
10044     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="")
10045     if test "x$ENABLE_GTK3" = "xTRUE"; then
10046         R="gtk3"
10047         dnl Avoid installed by unpackaged files for now.
10048         if test -z "$PKGFORMAT"; then
10049             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10050         fi
10051     else
10052         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10053     fi
10054     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10055     FilterLibs "${GTK3_LIBS}"
10056     GTK3_LIBS="${filteredlibs}"
10058     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10059     if test "$with_system_epoxy" != "yes"; then
10060         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10061         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10062                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10063     fi
10065 AC_SUBST(GTK3_LIBS)
10066 AC_SUBST(GTK3_CFLAGS)
10067 AC_SUBST(ENABLE_GTK3)
10069 ENABLE_GTK=""
10070 if test "x$enable_gtk" = "xyes"; then
10071     if test "$with_system_cairo" = no; then
10072         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10073     fi
10074     : ${with_system_cairo:=yes}
10075     ENABLE_GTK="TRUE"
10076     AC_DEFINE(ENABLE_GTK)
10077     R="gtk $R"
10079 AC_SUBST(ENABLE_GTK)
10081 ENABLE_KDE4=""
10082 if test "x$enable_kde4" = "xyes"; then
10083     ENABLE_KDE4="TRUE"
10084     AC_DEFINE(ENABLE_KDE4)
10085     R="$R kde4"
10087 AC_SUBST(ENABLE_KDE4)
10089 ENABLE_QT5=""
10090 if test "x$enable_qt5" = "xyes"; then
10091     ENABLE_QT5="TRUE"
10092     AC_DEFINE(ENABLE_QT5)
10093     R="$R qt5"
10095 AC_SUBST(ENABLE_QT5)
10097 ENABLE_KDE5=""
10098 if test "x$enable_kde5" = "xyes"; then
10099     ENABLE_KDE5="TRUE"
10100     AC_DEFINE(ENABLE_KDE5)
10101     R="$R kde5"
10103 AC_SUBST(ENABLE_KDE5)
10105 ENABLE_GTK3_KDE5=""
10106 if test "x$enable_gtk3_kde5" = "xyes"; then
10107     ENABLE_GTK3_KDE5="TRUE"
10108     AC_DEFINE(ENABLE_GTK3_KDE5)
10109     R="$R gtk3_kde5"
10111 AC_SUBST(ENABLE_GTK3_KDE5)
10113 build_vcl_plugins="$R"
10114 if test -z "$build_vcl_plugins"; then
10115     build_vcl_plugins="none"
10117 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10119 dnl ===================================================================
10120 dnl check for dbus support
10121 dnl ===================================================================
10122 ENABLE_DBUS=""
10123 DBUS_CFLAGS=""
10124 DBUS_LIBS=""
10125 DBUS_GLIB_CFLAGS=""
10126 DBUS_GLIB_LIBS=""
10127 DBUS_HAVE_GLIB=""
10129 if test "$enable_dbus" = "no"; then
10130     test_dbus=no
10133 AC_MSG_CHECKING([whether to enable DBUS support])
10134 if test "$test_dbus" = "yes"; then
10135     ENABLE_DBUS="TRUE"
10136     AC_MSG_RESULT([yes])
10137     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10138     AC_DEFINE(ENABLE_DBUS)
10139     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10140     FilterLibs "${DBUS_LIBS}"
10141     DBUS_LIBS="${filteredlibs}"
10143     # Glib is needed for BluetoothServer
10144     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10145     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10146         [
10147             DBUS_HAVE_GLIB="TRUE"
10148             AC_DEFINE(DBUS_HAVE_GLIB,1)
10149         ],
10150         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10151     )
10152 else
10153     AC_MSG_RESULT([no])
10156 AC_SUBST(ENABLE_DBUS)
10157 AC_SUBST(DBUS_CFLAGS)
10158 AC_SUBST(DBUS_LIBS)
10159 AC_SUBST(DBUS_GLIB_CFLAGS)
10160 AC_SUBST(DBUS_GLIB_LIBS)
10161 AC_SUBST(DBUS_HAVE_GLIB)
10163 AC_MSG_CHECKING([whether to enable Impress remote control])
10164 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10165     AC_MSG_RESULT([yes])
10166     ENABLE_SDREMOTE=TRUE
10167     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10169     # If not explicitly enabled or disabled, default
10170     if test -z "$enable_sdremote_bluetooth"; then
10171         case "$OS" in
10172         LINUX|MACOSX|WNT)
10173             # Default to yes for these
10174             enable_sdremote_bluetooth=yes
10175             ;;
10176         *)
10177             # otherwise no
10178             enable_sdremote_bluetooth=no
10179             ;;
10180         esac
10181     fi
10182     # $enable_sdremote_bluetooth is guaranteed non-empty now
10184     if test "$enable_sdremote_bluetooth" != "no"; then
10185         if test "$OS" = "LINUX"; then
10186             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10187                 AC_MSG_RESULT([yes])
10188                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10189                 dnl ===================================================================
10190                 dnl Check for system bluez
10191                 dnl ===================================================================
10192                 AC_MSG_CHECKING([which Bluetooth header to use])
10193                 if test "$with_system_bluez" = "yes"; then
10194                     AC_MSG_RESULT([external])
10195                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10196                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10197                     SYSTEM_BLUEZ=TRUE
10198                 else
10199                     AC_MSG_RESULT([internal])
10200                     SYSTEM_BLUEZ=
10201                 fi
10202             else
10203                 AC_MSG_RESULT([no, dbus disabled])
10204                 ENABLE_SDREMOTE_BLUETOOTH=
10205                 SYSTEM_BLUEZ=
10206             fi
10207         else
10208             AC_MSG_RESULT([yes])
10209             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10210             SYSTEM_BLUEZ=
10211         fi
10212     else
10213         AC_MSG_RESULT([no])
10214         ENABLE_SDREMOTE_BLUETOOTH=
10215         SYSTEM_BLUEZ=
10216     fi
10217 else
10218     ENABLE_SDREMOTE=
10219     SYSTEM_BLUEZ=
10220     AC_MSG_RESULT([no])
10222 AC_SUBST(ENABLE_SDREMOTE)
10223 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10224 AC_SUBST(SYSTEM_BLUEZ)
10226 dnl ===================================================================
10227 dnl Check whether the gtk 2.0 libraries are available.
10228 dnl ===================================================================
10230 GTK_CFLAGS=""
10231 GTK_LIBS=""
10232 if test  "$test_gtk" = "yes"; then
10234     if test "$ENABLE_GTK" = "TRUE"; then
10235         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0 gdk-pixbuf-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10236         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10237         FilterLibs "${GTK_LIBS}"
10238         GTK_LIBS="${filteredlibs}"
10239         PKG_CHECK_MODULES(GTHREAD, gthread-2.0,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10240         BUILD_TYPE="$BUILD_TYPE GTK"
10241         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10242         FilterLibs "${GTHREAD_LIBS}"
10243         GTHREAD_LIBS="${filteredlibs}"
10245         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10246         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10247                           [ENABLE_GTK_PRINT="TRUE"],
10248                           [ENABLE_GTK_PRINT=""])
10249         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10250         FilterLibs "${GTK_PRINT_LIBS}"
10251         GTK_PRINT_LIBS="${filteredlibs}"
10252     fi
10254     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10255         AC_MSG_CHECKING([whether to enable GIO support])
10256         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10257             dnl Need at least 2.26 for the dbus support.
10258             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10259                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10260             if test "$ENABLE_GIO" = "TRUE"; then
10261                 AC_DEFINE(ENABLE_GIO)
10262                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10263                 FilterLibs "${GIO_LIBS}"
10264                 GIO_LIBS="${filteredlibs}"
10265             fi
10266         else
10267             AC_MSG_RESULT([no])
10268         fi
10269     fi
10271 AC_SUBST(ENABLE_GIO)
10272 AC_SUBST(GIO_CFLAGS)
10273 AC_SUBST(GIO_LIBS)
10274 AC_SUBST(GTK_CFLAGS)
10275 AC_SUBST(GTK_LIBS)
10276 AC_SUBST(GTHREAD_CFLAGS)
10277 AC_SUBST(GTHREAD_LIBS)
10278 AC_SUBST([ENABLE_GTK_PRINT])
10279 AC_SUBST([GTK_PRINT_CFLAGS])
10280 AC_SUBST([GTK_PRINT_LIBS])
10283 dnl ===================================================================
10285 SPLIT_APP_MODULES=""
10286 if test "$enable_split_app_modules" = "yes"; then
10287     SPLIT_APP_MODULES="TRUE"
10289 AC_SUBST(SPLIT_APP_MODULES)
10291 SPLIT_OPT_FEATURES=""
10292 if test "$enable_split_opt_features" = "yes"; then
10293     SPLIT_OPT_FEATURES="TRUE"
10295 AC_SUBST(SPLIT_OPT_FEATURES)
10297 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10298     if test "$enable_cairo_canvas" = yes; then
10299         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10300     fi
10301     enable_cairo_canvas=no
10302 elif test -z "$enable_cairo_canvas"; then
10303     enable_cairo_canvas=yes
10306 ENABLE_CAIRO_CANVAS=""
10307 if test "$enable_cairo_canvas" = "yes"; then
10308     test_cairo=yes
10309     ENABLE_CAIRO_CANVAS="TRUE"
10310     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10312 AC_SUBST(ENABLE_CAIRO_CANVAS)
10314 dnl ===================================================================
10315 dnl Check whether the GStreamer libraries are available.
10316 dnl It's possible to build avmedia with both GStreamer backends!
10317 dnl ===================================================================
10319 ENABLE_GSTREAMER_1_0=""
10321 if test "$build_gstreamer_1_0" = "yes"; then
10323     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10324     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10325         ENABLE_GSTREAMER_1_0="TRUE"
10326         AC_MSG_RESULT([yes])
10327         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10328         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10329         FilterLibs "${GSTREAMER_1_0_LIBS}"
10330         GSTREAMER_1_0_LIBS="${filteredlibs}"
10331     else
10332         AC_MSG_RESULT([no])
10333     fi
10335 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10336 AC_SUBST(GSTREAMER_1_0_LIBS)
10337 AC_SUBST(ENABLE_GSTREAMER_1_0)
10340 ENABLE_GSTREAMER_0_10=""
10341 if test "$build_gstreamer_0_10" = "yes"; then
10343     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10344     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10345         ENABLE_GSTREAMER_0_10="TRUE"
10346         AC_MSG_RESULT([yes])
10347         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10348             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10349         ])
10350         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10351         FilterLibs "${GSTREAMER_0_10_LIBS}"
10352         GSTREAMER_0_10_LIBS="${filteredlibs}"
10353     else
10354         AC_MSG_RESULT([no])
10355     fi
10358 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10359 AC_SUBST(GSTREAMER_0_10_LIBS)
10360 AC_SUBST(ENABLE_GSTREAMER_0_10)
10362 dnl ===================================================================
10363 dnl Check whether to build the VLC avmedia backend
10364 dnl ===================================================================
10366 ENABLE_VLC=""
10368 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10369 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10370     ENABLE_VLC="TRUE"
10371     AC_MSG_RESULT([yes])
10372 else
10373     AC_MSG_RESULT([no])
10375 AC_SUBST(ENABLE_VLC)
10377 ENABLE_OPENGL_TRANSITIONS=
10378 ENABLE_OPENGL_CANVAS=
10379 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10380    : # disable
10381 elif test "$_os" = "Darwin"; then
10382     # We use frameworks on Mac OS X, no need for detail checks
10383     ENABLE_OPENGL_TRANSITIONS=TRUE
10384     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10385     ENABLE_OPENGL_CANVAS=TRUE
10386 elif test $_os = WINNT; then
10387     ENABLE_OPENGL_TRANSITIONS=TRUE
10388     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10389     ENABLE_OPENGL_CANVAS=TRUE
10390 else
10391     if test "$USING_X11" = TRUE; then
10392         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10393         ENABLE_OPENGL_TRANSITIONS=TRUE
10394         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10395         ENABLE_OPENGL_CANVAS=TRUE
10396     fi
10399 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10400 AC_SUBST(ENABLE_OPENGL_CANVAS)
10402 dnl =================================================
10403 dnl Check whether to build with OpenCL support.
10404 dnl =================================================
10406 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10407     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10408     # platform (optional at run-time, used through clew).
10409     BUILD_TYPE="$BUILD_TYPE OPENCL"
10410     AC_DEFINE(HAVE_FEATURE_OPENCL)
10413 dnl =================================================
10414 dnl Check whether to build with dconf support.
10415 dnl =================================================
10417 if test "$enable_dconf" != no; then
10418     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10419         if test "$enable_dconf" = yes; then
10420             AC_MSG_ERROR([dconf not found])
10421         else
10422             enable_dconf=no
10423         fi])
10425 AC_MSG_CHECKING([whether to enable dconf])
10426 if test "$enable_dconf" = no; then
10427     DCONF_CFLAGS=
10428     DCONF_LIBS=
10429     ENABLE_DCONF=
10430     AC_MSG_RESULT([no])
10431 else
10432     ENABLE_DCONF=TRUE
10433     AC_DEFINE(ENABLE_DCONF)
10434     AC_MSG_RESULT([yes])
10436 AC_SUBST([DCONF_CFLAGS])
10437 AC_SUBST([DCONF_LIBS])
10438 AC_SUBST([ENABLE_DCONF])
10440 # pdf import?
10441 AC_MSG_CHECKING([whether to build the PDF import feature])
10442 ENABLE_PDFIMPORT=
10443 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10444     AC_MSG_RESULT([yes])
10445     ENABLE_PDFIMPORT=TRUE
10446     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10448     dnl ===================================================================
10449     dnl Check for system poppler
10450     dnl ===================================================================
10451     AC_MSG_CHECKING([which PDF import backend to use])
10452     if test "$with_system_poppler" = "yes"; then
10453         AC_MSG_RESULT([external])
10454         SYSTEM_POPPLER=TRUE
10455         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10456         AC_LANG_PUSH([C++])
10457         save_CXXFLAGS=$CXXFLAGS
10458         save_CPPFLAGS=$CPPFLAGS
10459         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10460         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10461         AC_CHECK_HEADER([cpp/poppler-version.h],
10462             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10463             [])
10464         CXXFLAGS=$save_CXXFLAGS
10465         CPPFLAGS=$save_CPPFLAGS
10466         AC_LANG_POP([C++])
10467         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10469         FilterLibs "${POPPLER_LIBS}"
10470         POPPLER_LIBS="${filteredlibs}"
10471     else
10472         AC_MSG_RESULT([internal])
10473         SYSTEM_POPPLER=
10474         BUILD_TYPE="$BUILD_TYPE POPPLER"
10475         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10476     fi
10477     AC_DEFINE([ENABLE_PDFIMPORT],1)
10478 else
10479     AC_MSG_RESULT([no])
10481 AC_SUBST(ENABLE_PDFIMPORT)
10482 AC_SUBST(SYSTEM_POPPLER)
10483 AC_SUBST(POPPLER_CFLAGS)
10484 AC_SUBST(POPPLER_LIBS)
10486 # pdf import?
10487 AC_MSG_CHECKING([whether to build PDFium])
10488 ENABLE_PDFIUM=
10489 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10490     AC_MSG_RESULT([yes])
10491     ENABLE_PDFIUM=TRUE
10492     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10493     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10494 else
10495     AC_MSG_RESULT([no])
10497 AC_SUBST(ENABLE_PDFIUM)
10499 SYSTEM_GPGMEPP=
10501 if test "$build_for_ios" = "YES"; then
10502     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10503     AC_MSG_RESULT([yes])
10504 elif test "$enable_mpl_subset" = "yes"; then
10505     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10506     AC_MSG_RESULT([yes])
10507 elif test "$enable_fuzzers" = "yes"; then
10508     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10509     AC_MSG_RESULT([yes])
10510 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10511     dnl ===================================================================
10512     dnl Check for system gpgme
10513     dnl ===================================================================
10514     AC_MSG_CHECKING([which gpgmepp to use])
10515     if test "$with_system_gpgmepp" = "yes"; then
10516         AC_MSG_RESULT([external])
10517         SYSTEM_GPGMEPP=TRUE
10519         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10520         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10521             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10522         # progress_callback is the only func with plain C linkage
10523         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10524         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10525             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10526         AC_CHECK_HEADER(gpgme.h, [],
10527             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10528     else
10529         AC_MSG_RESULT([internal])
10530         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10531         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10533         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10534         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10535         if test "$_os" != "WINNT"; then
10536             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10537             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10538         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10539             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10540         fi
10541     fi
10542     ENABLE_GPGMEPP=TRUE
10543     AC_DEFINE([HAVE_FEATURE_GPGME])
10544     AC_PATH_PROG(GPG, gpg)
10545     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10546     # so let's exclude that manually for the moment
10547     if test -n "$GPG" -a "$_os" != "WINNT"; then
10548         # make sure we not only have a working gpgme, but a full working
10549         # gpg installation to run OpenPGP signature verification
10550         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10551     fi
10552     if test "$_os" = "Linux"; then
10553       uid=`id -u`
10554       AC_MSG_CHECKING([for /run/user/$uid])
10555       if test -d /run/user/$uid; then
10556         AC_MSG_RESULT([yes])
10557         AC_PATH_PROG(GPGCONF, gpgconf)
10558         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10559         if $GPGCONF --dump-options > /dev/null ; then
10560           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10561             AC_MSG_RESULT([yes])
10562             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10563           else
10564             AC_MSG_RESULT([no])
10565           fi
10566         else
10567           AC_MSG_RESULT([no. missing or broken gpgconf?])
10568         fi
10569       else
10570         AC_MSG_RESULT([no])
10571      fi
10572    fi
10574 AC_SUBST(ENABLE_GPGMEPP)
10575 AC_SUBST(SYSTEM_GPGMEPP)
10576 AC_SUBST(GPG_ERROR_CFLAGS)
10577 AC_SUBST(GPG_ERROR_LIBS)
10578 AC_SUBST(LIBASSUAN_CFLAGS)
10579 AC_SUBST(LIBASSUAN_LIBS)
10580 AC_SUBST(GPGMEPP_CFLAGS)
10581 AC_SUBST(GPGMEPP_LIBS)
10582 AC_SUBST(GPGCONF)
10583 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10585 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10586 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10587     AC_MSG_RESULT([yes])
10588     ENABLE_MEDIAWIKI=TRUE
10589     BUILD_TYPE="$BUILD_TYPE XSLTML"
10590     if test  "x$with_java" = "xno"; then
10591         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10592     fi
10593 else
10594     AC_MSG_RESULT([no])
10595     ENABLE_MEDIAWIKI=
10596     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10598 AC_SUBST(ENABLE_MEDIAWIKI)
10600 AC_MSG_CHECKING([whether to build the Report Builder])
10601 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10602     AC_MSG_RESULT([yes])
10603     ENABLE_REPORTBUILDER=TRUE
10604     AC_MSG_CHECKING([which jfreereport libs to use])
10605     if test "$with_system_jfreereport" = "yes"; then
10606         SYSTEM_JFREEREPORT=TRUE
10607         AC_MSG_RESULT([external])
10608         if test -z $SAC_JAR; then
10609             SAC_JAR=/usr/share/java/sac.jar
10610         fi
10611         if ! test -f $SAC_JAR; then
10612              AC_MSG_ERROR(sac.jar not found.)
10613         fi
10615         if test -z $LIBXML_JAR; then
10616             if test -f /usr/share/java/libxml-1.0.0.jar; then
10617                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10618             elif test -f /usr/share/java/libxml.jar; then
10619                 LIBXML_JAR=/usr/share/java/libxml.jar
10620             else
10621                 AC_MSG_ERROR(libxml.jar replacement not found.)
10622             fi
10623         elif ! test -f $LIBXML_JAR; then
10624             AC_MSG_ERROR(libxml.jar not found.)
10625         fi
10627         if test -z $FLUTE_JAR; then
10628             if test -f/usr/share/java/flute-1.3.0.jar; then
10629                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10630             elif test -f /usr/share/java/flute.jar; then
10631                 FLUTE_JAR=/usr/share/java/flute.jar
10632             else
10633                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10634             fi
10635         elif ! test -f $FLUTE_JAR; then
10636             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10637         fi
10639         if test -z $JFREEREPORT_JAR; then
10640             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10641                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10642             elif test -f /usr/share/java/flow-engine.jar; then
10643                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10644             else
10645                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10646             fi
10647         elif ! test -f  $JFREEREPORT_JAR; then
10648                 AC_MSG_ERROR(jfreereport.jar not found.)
10649         fi
10651         if test -z $LIBLAYOUT_JAR; then
10652             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10653                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10654             elif test -f /usr/share/java/liblayout.jar; then
10655                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10656             else
10657                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10658             fi
10659         elif ! test -f $LIBLAYOUT_JAR; then
10660                 AC_MSG_ERROR(liblayout.jar not found.)
10661         fi
10663         if test -z $LIBLOADER_JAR; then
10664             if test -f /usr/share/java/libloader-1.0.0.jar; then
10665                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10666             elif test -f /usr/share/java/libloader.jar; then
10667                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10668             else
10669                 AC_MSG_ERROR(libloader.jar replacement not found.)
10670             fi
10671         elif ! test -f  $LIBLOADER_JAR; then
10672             AC_MSG_ERROR(libloader.jar not found.)
10673         fi
10675         if test -z $LIBFORMULA_JAR; then
10676             if test -f /usr/share/java/libformula-0.2.0.jar; then
10677                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10678             elif test -f /usr/share/java/libformula.jar; then
10679                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10680             else
10681                 AC_MSG_ERROR(libformula.jar replacement not found.)
10682             fi
10683         elif ! test -f $LIBFORMULA_JAR; then
10684                 AC_MSG_ERROR(libformula.jar not found.)
10685         fi
10687         if test -z $LIBREPOSITORY_JAR; then
10688             if test -f /usr/share/java/librepository-1.0.0.jar; then
10689                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10690             elif test -f /usr/share/java/librepository.jar; then
10691                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10692             else
10693                 AC_MSG_ERROR(librepository.jar replacement not found.)
10694             fi
10695         elif ! test -f $LIBREPOSITORY_JAR; then
10696             AC_MSG_ERROR(librepository.jar not found.)
10697         fi
10699         if test -z $LIBFONTS_JAR; then
10700             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10701                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10702             elif test -f /usr/share/java/libfonts.jar; then
10703                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10704             else
10705                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10706             fi
10707         elif ! test -f $LIBFONTS_JAR; then
10708                 AC_MSG_ERROR(libfonts.jar not found.)
10709         fi
10711         if test -z $LIBSERIALIZER_JAR; then
10712             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10713                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10714             elif test -f /usr/share/java/libserializer.jar; then
10715                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10716             else
10717                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10718             fi
10719         elif ! test -f $LIBSERIALIZER_JAR; then
10720                 AC_MSG_ERROR(libserializer.jar not found.)
10721         fi
10723         if test -z $LIBBASE_JAR; then
10724             if test -f /usr/share/java/libbase-1.0.0.jar; then
10725                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10726             elif test -f /usr/share/java/libbase.jar; then
10727                 LIBBASE_JAR=/usr/share/java/libbase.jar
10728             else
10729                 AC_MSG_ERROR(libbase.jar replacement not found.)
10730             fi
10731         elif ! test -f $LIBBASE_JAR; then
10732             AC_MSG_ERROR(libbase.jar not found.)
10733         fi
10735     else
10736         AC_MSG_RESULT([internal])
10737         SYSTEM_JFREEREPORT=
10738         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10739         NEED_ANT=TRUE
10740     fi
10741 else
10742     AC_MSG_RESULT([no])
10743     ENABLE_REPORTBUILDER=
10744     SYSTEM_JFREEREPORT=
10746 AC_SUBST(ENABLE_REPORTBUILDER)
10747 AC_SUBST(SYSTEM_JFREEREPORT)
10748 AC_SUBST(SAC_JAR)
10749 AC_SUBST(LIBXML_JAR)
10750 AC_SUBST(FLUTE_JAR)
10751 AC_SUBST(JFREEREPORT_JAR)
10752 AC_SUBST(LIBBASE_JAR)
10753 AC_SUBST(LIBLAYOUT_JAR)
10754 AC_SUBST(LIBLOADER_JAR)
10755 AC_SUBST(LIBFORMULA_JAR)
10756 AC_SUBST(LIBREPOSITORY_JAR)
10757 AC_SUBST(LIBFONTS_JAR)
10758 AC_SUBST(LIBSERIALIZER_JAR)
10760 # this has to be here because both the Wiki Publisher and the SRB use
10761 # commons-logging
10762 COMMONS_LOGGING_VERSION=1.2
10763 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10764     AC_MSG_CHECKING([which Apache commons-* libs to use])
10765     if test "$with_system_apache_commons" = "yes"; then
10766         SYSTEM_APACHE_COMMONS=TRUE
10767         AC_MSG_RESULT([external])
10768         if test -z $COMMONS_LOGGING_JAR; then
10769             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10770                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10771            elif test -f /usr/share/java/commons-logging.jar; then
10772                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10773             else
10774                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10775             fi
10776         elif ! test -f $COMMONS_LOGGING_JAR; then
10777             AC_MSG_ERROR(commons-logging.jar not found.)
10778         fi
10779     else
10780         AC_MSG_RESULT([internal])
10781         SYSTEM_APACHE_COMMONS=
10782         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10783         NEED_ANT=TRUE
10784     fi
10786 AC_SUBST(SYSTEM_APACHE_COMMONS)
10787 AC_SUBST(COMMONS_LOGGING_JAR)
10788 AC_SUBST(COMMONS_LOGGING_VERSION)
10790 # scripting provider for BeanShell?
10791 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10792 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10793     AC_MSG_RESULT([yes])
10794     ENABLE_SCRIPTING_BEANSHELL=TRUE
10796     dnl ===================================================================
10797     dnl Check for system beanshell
10798     dnl ===================================================================
10799     AC_MSG_CHECKING([which beanshell to use])
10800     if test "$with_system_beanshell" = "yes"; then
10801         AC_MSG_RESULT([external])
10802         SYSTEM_BSH=TRUE
10803         if test -z $BSH_JAR; then
10804             BSH_JAR=/usr/share/java/bsh.jar
10805         fi
10806         if ! test -f $BSH_JAR; then
10807             AC_MSG_ERROR(bsh.jar not found.)
10808         fi
10809     else
10810         AC_MSG_RESULT([internal])
10811         SYSTEM_BSH=
10812         BUILD_TYPE="$BUILD_TYPE BSH"
10813     fi
10814 else
10815     AC_MSG_RESULT([no])
10816     ENABLE_SCRIPTING_BEANSHELL=
10817     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10819 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10820 AC_SUBST(SYSTEM_BSH)
10821 AC_SUBST(BSH_JAR)
10823 # scripting provider for JavaScript?
10824 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10825 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10826     AC_MSG_RESULT([yes])
10827     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10829     dnl ===================================================================
10830     dnl Check for system rhino
10831     dnl ===================================================================
10832     AC_MSG_CHECKING([which rhino to use])
10833     if test "$with_system_rhino" = "yes"; then
10834         AC_MSG_RESULT([external])
10835         SYSTEM_RHINO=TRUE
10836         if test -z $RHINO_JAR; then
10837             RHINO_JAR=/usr/share/java/js.jar
10838         fi
10839         if ! test -f $RHINO_JAR; then
10840             AC_MSG_ERROR(js.jar not found.)
10841         fi
10842     else
10843         AC_MSG_RESULT([internal])
10844         SYSTEM_RHINO=
10845         BUILD_TYPE="$BUILD_TYPE RHINO"
10846         NEED_ANT=TRUE
10847     fi
10848 else
10849     AC_MSG_RESULT([no])
10850     ENABLE_SCRIPTING_JAVASCRIPT=
10851     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10853 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10854 AC_SUBST(SYSTEM_RHINO)
10855 AC_SUBST(RHINO_JAR)
10857 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10858 # paths should be added to library search path. So lets put all 64-bit
10859 # platforms there.
10860 supports_multilib=
10861 case "$host_cpu" in
10862 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10863     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10864         supports_multilib="yes"
10865     fi
10866     ;;
10868     ;;
10869 esac
10871 dnl ===================================================================
10872 dnl KDE4 Integration
10873 dnl ===================================================================
10875 KDE4_CFLAGS=""
10876 KDE4_LIBS=""
10877 QMAKE4="qmake"
10878 MOC4="moc"
10879 KDE4_GLIB_CFLAGS=""
10880 KDE4_GLIB_LIBS=""
10881 KDE4_HAVE_GLIB=""
10882 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10883     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10884     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10886     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10887     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10889     if test -n "$supports_multilib"; then
10890         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10891         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10892     fi
10894     if test -n "$QTDIR"; then
10895         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10896         if test -z "$supports_multilib"; then
10897             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10898         else
10899             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10900         fi
10901     fi
10902     if test -n "$QT4DIR"; then
10903         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10904         if test -z "$supports_multilib"; then
10905             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10906         else
10907             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10908         fi
10909     fi
10911     if test -n "$KDEDIR"; then
10912         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10913         if test -z "$supports_multilib"; then
10914             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10915         else
10916             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10917         fi
10918     fi
10919     if test -n "$KDE4DIR"; then
10920         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10921         if test -z "$supports_multilib"; then
10922             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10923         else
10924             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10925         fi
10926     fi
10928     qt4_test_include="Qt/qobject.h"
10929     qt4_test_library="libQtNetwork.so"
10930     kde4_test_include="kwindowsystem.h"
10931     kde4_test_library="libsolid.so"
10933     AC_MSG_CHECKING([for Qt4 headers])
10934     qt4_header_dir="no"
10935     for inc_dir in $qt4_incdirs; do
10936         if test -r "$inc_dir/$qt4_test_include"; then
10937             qt4_header_dir="$inc_dir"
10938             break
10939         fi
10940     done
10942     AC_MSG_RESULT([$qt4_header_dir])
10943     if test "x$qt4_header_dir" = "xno"; then
10944         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10945     fi
10947     dnl Check for qmake
10948     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10949     if test "$QMAKE4" = "no"; then
10950         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10951     else
10952         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10953         if test -z "$qmake4_test_ver"; then
10954             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10955         fi
10956     fi
10958     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10959     AC_MSG_CHECKING([for Qt4 libraries])
10960     qt4_lib_dir="no"
10961     for lib_dir in $qt4_libdirs; do
10962         if test -r "$lib_dir/$qt4_test_library"; then
10963             qt4_lib_dir="$lib_dir"
10964             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10965             break
10966         fi
10967     done
10969     AC_MSG_RESULT([$qt4_lib_dir])
10971     if test "x$qt4_lib_dir" = "xno"; then
10972         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10973     fi
10975     dnl Check for Meta Object Compiler
10977     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10978     MOC4="$MOCQT4"
10979     if test "$MOC4" = "no"; then
10980         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10981         if test "$MOC4" = "no"; then
10982             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10983 the root of your Qt installation by exporting QT4DIR before running "configure".])
10984         fi
10985     fi
10987     dnl Check for KDE4 headers
10988     AC_MSG_CHECKING([for KDE4 headers])
10989     kde4_incdir="no"
10990     for kde4_check in $kde4_incdirs; do
10991         if test -r "$kde4_check/$kde4_test_include"; then
10992             kde4_incdir="$kde4_check"
10993             break
10994         fi
10995     done
10996     AC_MSG_RESULT([$kde4_incdir])
10997     if test "x$kde4_incdir" = "xno"; then
10998         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10999     fi
11000     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
11002     dnl Check for KDE4 libraries
11003     AC_MSG_CHECKING([for KDE4 libraries])
11004     kde4_libdir="no"
11005     for kde4_check in $kde4_libdirs; do
11006         if test -r "$kde4_check/$kde4_test_library"; then
11007             kde4_libdir="$kde4_check"
11008             break
11009         fi
11010     done
11012     AC_MSG_RESULT([$kde4_libdir])
11013     if test "x$kde4_libdir" = "xno"; then
11014         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11015     fi
11017     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11018     if ! test -z "$kde4_incdir"; then
11019         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11020     else
11021         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11022     fi
11024     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11025     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11026     FilterLibs "$KDE4_LIBS"
11027     KDE4_LIBS="$filteredlibs"
11029     AC_LANG_PUSH([C++])
11030     save_CXXFLAGS=$CXXFLAGS
11031     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11032     AC_MSG_CHECKING([whether KDE is >= 4.2])
11033        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11034 #include <kdeversion.h>
11036 int main(int argc, char **argv) {
11037        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11038        else return 1;
11040 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11041     CXXFLAGS=$save_CXXFLAGS
11042     AC_LANG_POP([C++])
11044     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11045     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11046     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11047         [
11048             KDE4_HAVE_GLIB=TRUE
11049             AC_DEFINE(KDE4_HAVE_GLIB,1)
11050             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11051             FilterLibs "${KDE4_GLIB_LIBS}"
11052             KDE4_GLIB_LIBS="${filteredlibs}"
11054             qt4_fix_warning=
11056             AC_LANG_PUSH([C++])
11057             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11058             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11059             #  02 00 80 3a  90 8a 4e d2 3a 00 00 00  f0 b4 b9 a7 ff 7f 00 00  00 00 00 00 00 00 00 00  20 d8 4e d2
11060             #               ^~~~~~~~~~~~~~~~~~~~~~~
11061             #               vptr for 'QObjectPrivate'
11062             # so temporarily ignore here whichever way would be used to make such errors fatal
11063             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
11064             save_CXX=$CXX
11065             CXX=$(printf %s "$CXX" \
11066                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11067             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
11068             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
11069             save_CXXFLAGS=$CXXFLAGS
11070             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11071             save_LIBS=$LIBS
11072             LIBS="$LIBS $KDE4_LIBS"
11073             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11075             # Prepare meta object data
11076             TSTBASE="tst_exclude_socket_notifiers"
11077             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11078             ln -fs "${TSTMOC}.hxx"
11079             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11081             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11082 #include <cstdlib>
11083 #include "tst_exclude_socket_notifiers.moc"
11085 int main(int argc, char *argv[])
11087     QCoreApplication app(argc, argv);
11088     exit(tst_processEventsExcludeSocket());
11089     return 0;
11091             ]])],[
11092                 AC_MSG_RESULT([yes])
11093             ],[
11094                 AC_MSG_RESULT([no])
11095                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11096                 if test -z "$qt4_fix_warning"; then
11097                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11098                 fi
11099                 qt4_fix_warning=1
11100                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11101                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11103             # Remove meta object data
11104             rm -f "${TSTBASE}."*
11106             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11108             # Prepare meta object data
11109             TSTBASE="tst_exclude_posted_events"
11110             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11111             ln -fs "${TSTMOC}.hxx"
11112             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11114             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11115 #include <cstdlib>
11116 #include "tst_exclude_posted_events.moc"
11118 int main(int argc, char *argv[])
11120     QCoreApplication app(argc, argv);
11121     exit(tst_excludePostedEvents());
11122     return 0;
11124             ]])],[
11125                 AC_MSG_RESULT([yes])
11126             ],[
11127                 AC_MSG_RESULT([no])
11128                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11129                 if test -z "$qt4_fix_warning"; then
11130                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11131                 fi
11132                 qt4_fix_warning=1
11133                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11134             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11136             # Remove meta object data
11137             rm -f "${TSTBASE}."*
11139             if test -n "$qt4_fix_warning"; then
11140                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11141             fi
11143             LIBS=$save_LIBS
11144             CXXFLAGS=$save_CXXFLAGS
11145             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11146             CXX=$save_CXX
11147             AC_LANG_POP([C++])
11148         ],
11149         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11151 AC_SUBST(KDE4_CFLAGS)
11152 AC_SUBST(KDE4_LIBS)
11153 AC_SUBST(MOC4)
11154 AC_SUBST(KDE4_GLIB_CFLAGS)
11155 AC_SUBST(KDE4_GLIB_LIBS)
11156 AC_SUBST(KDE4_HAVE_GLIB)
11158 dnl ===================================================================
11159 dnl QT5 Integration
11160 dnl ===================================================================
11162 QT5_CFLAGS=""
11163 QT5_LIBS=""
11164 QMAKE5="qmake"
11165 MOC5="moc"
11166 QT5_GLIB_CFLAGS=""
11167 QT5_GLIB_LIBS=""
11168 QT5_HAVE_GLIB=""
11169 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11170         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11171         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11172 then
11173     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11174     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11176     if test -n "$supports_multilib"; then
11177         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11178     fi
11180     qt5_test_include="QtWidgets/qapplication.h"
11181     qt5_test_library="libQt5Widgets.so"
11183     dnl Check for qmake5
11184     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11185     if test "$QMAKE5" = "no"; then
11186         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11187     else
11188         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11189         if test -z "$qmake5_test_ver"; then
11190             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11191         fi
11192         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11193         qt5_minimal_minor="6"
11194         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11195             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11196         else
11197             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11198         fi
11199     fi
11201     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11202     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11204     AC_MSG_CHECKING([for Qt5 headers])
11205     qt5_incdir="no"
11206     for inc_dir in $qt5_incdirs; do
11207         if test -r "$inc_dir/$qt5_test_include"; then
11208             qt5_incdir="$inc_dir"
11209             break
11210         fi
11211     done
11212     AC_MSG_RESULT([$qt5_incdir])
11213     if test "x$qt5_incdir" = "xno"; then
11214         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11215     fi
11217     AC_MSG_CHECKING([for Qt5 libraries])
11218     qt5_libdir="no"
11219     for lib_dir in $qt5_libdirs; do
11220         if test -r "$lib_dir/$qt5_test_library"; then
11221             qt5_libdir="$lib_dir"
11222             break
11223         fi
11224     done
11225     AC_MSG_RESULT([$qt5_libdir])
11226     if test "x$qt5_libdir" = "xno"; then
11227         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11228     fi
11230     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11231     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11232     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11234     dnl Check for Meta Object Compiler
11236     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11237     if test "$MOC5" = "no"; then
11238         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11239 the root of your Qt installation by exporting QT5DIR before running "configure".])
11240     fi
11242     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11243     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11244     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11245         [
11246             QT5_HAVE_GLIB=1
11247             AC_DEFINE(QT5_HAVE_GLIB,1)
11248         ],
11249         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11250     )
11252 AC_SUBST(QT5_CFLAGS)
11253 AC_SUBST(QT5_LIBS)
11254 AC_SUBST(MOC5)
11255 AC_SUBST(QT5_GLIB_CFLAGS)
11256 AC_SUBST(QT5_GLIB_LIBS)
11257 AC_SUBST(QT5_HAVE_GLIB)
11259 dnl ===================================================================
11260 dnl KDE5 Integration
11261 dnl ===================================================================
11263 KF5_CFLAGS=""
11264 KF5_LIBS=""
11265 KF5_CONFIG="kf5-config"
11266 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11267         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11268         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11269 then
11270     if test "$OS" = "HAIKU"; then
11271         haiku_arch="`echo $RTL_ARCH | tr X x`"
11272         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11273         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11274     fi
11276     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11277     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11278     if test -n "$supports_multilib"; then
11279         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11280     fi
11282     kf5_test_include="KF5/kcoreaddons_version.h"
11283     kf5_test_library="libKF5CoreAddons.so"
11284     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11286     dnl kf5 KDE4 support compatibility installed
11287     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11288     if test "$KF5_CONFIG" != "no"; then
11289         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11290         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11291     fi
11293     dnl Check for KF5 headers
11294     AC_MSG_CHECKING([for KF5 headers])
11295     kf5_incdir="no"
11296     for kf5_check in $kf5_incdirs; do
11297         if test -r "$kf5_check/$kf5_test_include"; then
11298             kf5_incdir="$kf5_check/KF5"
11299             break
11300         fi
11301     done
11302     AC_MSG_RESULT([$kf5_incdir])
11303     if test "x$kf5_incdir" = "xno"; then
11304         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11305     fi
11307     dnl Check for KF5 libraries
11308     AC_MSG_CHECKING([for KF5 libraries])
11309     kf5_libdir="no"
11310     for kf5_check in $kf5_libdirs; do
11311         if test -r "$kf5_check/$kf5_test_library"; then
11312             kf5_libdir="$kf5_check"
11313             break
11314         fi
11315     done
11317     AC_MSG_RESULT([$kf5_libdir])
11318     if test "x$kf5_libdir" = "xno"; then
11319         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11320     fi
11322     if test "$USING_X11" = TRUE; then
11323         PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11324     fi
11326     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 $KF5_XCB_CFLAGS"
11327     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11328     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11330     if test "$USING_X11" = TRUE; then
11331         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11332     fi
11334     AC_LANG_PUSH([C++])
11335     save_CXXFLAGS=$CXXFLAGS
11336     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11337     AC_MSG_CHECKING([whether KDE is >= 5.0])
11338        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11339 #include <kcoreaddons_version.h>
11341 int main(int argc, char **argv) {
11342        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11343        else return 1;
11345        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11346     CXXFLAGS=$save_CXXFLAGS
11347     AC_LANG_POP([C++])
11349 AC_SUBST(KF5_CFLAGS)
11350 AC_SUBST(KF5_LIBS)
11352 dnl ===================================================================
11353 dnl Test whether to include Evolution 2 support
11354 dnl ===================================================================
11355 AC_MSG_CHECKING([whether to enable evolution 2 support])
11356 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11357     AC_MSG_RESULT([yes])
11358     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11359     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11360     FilterLibs "${GOBJECT_LIBS}"
11361     GOBJECT_LIBS="${filteredlibs}"
11362     ENABLE_EVOAB2="TRUE"
11363 else
11364     ENABLE_EVOAB2=""
11365     AC_MSG_RESULT([no])
11367 AC_SUBST(ENABLE_EVOAB2)
11368 AC_SUBST(GOBJECT_CFLAGS)
11369 AC_SUBST(GOBJECT_LIBS)
11371 dnl ===================================================================
11372 dnl Test which themes to include
11373 dnl ===================================================================
11374 AC_MSG_CHECKING([which themes to include])
11375 # if none given use default subset of available themes
11376 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11377     with_theme="breeze breeze_dark colibre elementary karasa_jaga sifr sifr_dark tango"
11380 WITH_THEMES=""
11381 if test "x$with_theme" != "xno"; then
11382     for theme in $with_theme; do
11383         case $theme in
11384         breeze|breeze_dark|colibre|elementary|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11385         default) real_theme=colibre ;;
11386         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11387         esac
11388         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11389     done
11391 AC_MSG_RESULT([$WITH_THEMES])
11392 AC_SUBST([WITH_THEMES])
11393 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11394 for theme in $with_theme; do
11395     case $theme in
11396     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11397     *) ;;
11398     esac
11399 done
11401 dnl ===================================================================
11402 dnl Test whether to integrate helppacks into the product's installer
11403 dnl ===================================================================
11404 AC_MSG_CHECKING([for helppack integration])
11405 if test "$with_helppack_integration" = "no"; then
11406     AC_MSG_RESULT([no integration])
11407 else
11408     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11409     AC_MSG_RESULT([integration])
11412 ###############################################################################
11413 # Extensions checking
11414 ###############################################################################
11415 AC_MSG_CHECKING([for extensions integration])
11416 if test "x$enable_extension_integration" != "xno"; then
11417     WITH_EXTENSION_INTEGRATION=TRUE
11418     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11419     AC_MSG_RESULT([yes, use integration])
11420 else
11421     WITH_EXTENSION_INTEGRATION=
11422     AC_MSG_RESULT([no, do not integrate])
11424 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11426 dnl Should any extra extensions be included?
11427 dnl There are standalone tests for each of these below.
11428 WITH_EXTRA_EXTENSIONS=
11429 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11431 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11432 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11433 if test "x$with_java" != "xno"; then
11434     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11435     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11438 AC_MSG_CHECKING([whether to build opens___.ttf])
11439 if test "$enable_build_opensymbol" = "yes"; then
11440     AC_MSG_RESULT([yes])
11441     AC_PATH_PROG(FONTFORGE, fontforge)
11442     if test -z "$FONTFORGE"; then
11443         AC_MSG_ERROR([fontforge not installed])
11444     fi
11445 else
11446     AC_MSG_RESULT([no])
11447     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11448     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11450 AC_SUBST(OPENSYMBOL_TTF)
11451 AC_SUBST(FONTFORGE)
11453 dnl ===================================================================
11454 dnl Test whether to include fonts
11455 dnl ===================================================================
11456 AC_MSG_CHECKING([whether to include third-party fonts])
11457 if test "$with_fonts" != "no"; then
11458     AC_MSG_RESULT([yes])
11459     WITH_FONTS=TRUE
11460     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11461     AC_DEFINE(HAVE_MORE_FONTS)
11462 else
11463     AC_MSG_RESULT([no])
11464     WITH_FONTS=
11465     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11467 AC_SUBST(WITH_FONTS)
11470 dnl ===================================================================
11471 dnl Test whether to enable online update service
11472 dnl ===================================================================
11473 AC_MSG_CHECKING([whether to enable online update])
11474 ENABLE_ONLINE_UPDATE=
11475 ENABLE_ONLINE_UPDATE_MAR=
11476 UPDATE_CONFIG=
11477 if test "$enable_online_update" = ""; then
11478     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11479         AC_MSG_RESULT([yes])
11480         ENABLE_ONLINE_UPDATE="TRUE"
11481     else
11482         AC_MSG_RESULT([no])
11483     fi
11484 else
11485     if test "$enable_online_update" = "mar"; then
11486         AC_MSG_RESULT([yes - MAR-based online update])
11487         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11488         if test "$with_update_config" = ""; then
11489             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11490         fi
11491         UPDATE_CONFIG="$with_update_config"
11492         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11493     elif test "$enable_online_update" = "yes"; then
11494         AC_MSG_RESULT([yes])
11495         ENABLE_ONLINE_UPDATE="TRUE"
11496     else
11497         AC_MSG_RESULT([no])
11498     fi
11500 AC_SUBST(ENABLE_ONLINE_UPDATE)
11501 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11502 AC_SUBST(UPDATE_CONFIG)
11504 dnl ===================================================================
11505 dnl Test whether we need bzip2
11506 dnl ===================================================================
11507 SYSTEM_BZIP2=
11508 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11509     AC_MSG_CHECKING([whether to use system bzip2])
11510     if test "$with_system_bzip2" = yes; then
11511         SYSTEM_BZIP2=TRUE
11512         AC_MSG_RESULT([yes])
11513         PKG_CHECK_MODULES(BZIP2, bzip2)
11514         FilterLibs "${BZIP2_LIBS}"
11515         BZIP2_LIBS="${filteredlibs}"
11516     else
11517         AC_MSG_RESULT([no])
11518         BUILD_TYPE="$BUILD_TYPE BZIP2"
11519     fi
11521 AC_SUBST(SYSTEM_BZIP2)
11522 AC_SUBST(BZIP2_CFLAGS)
11523 AC_SUBST(BZIP2_LIBS)
11525 dnl ===================================================================
11526 dnl Test whether to enable extension update
11527 dnl ===================================================================
11528 AC_MSG_CHECKING([whether to enable extension update])
11529 ENABLE_EXTENSION_UPDATE=
11530 if test "x$enable_extension_update" = "xno"; then
11531     AC_MSG_RESULT([no])
11532 else
11533     AC_MSG_RESULT([yes])
11534     ENABLE_EXTENSION_UPDATE="TRUE"
11535     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11536     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11538 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11541 dnl ===================================================================
11542 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11543 dnl ===================================================================
11544 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11545 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11546     AC_MSG_RESULT([no])
11547     ENABLE_SILENT_MSI=
11548 else
11549     AC_MSG_RESULT([yes])
11550     ENABLE_SILENT_MSI=TRUE
11551     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11553 AC_SUBST(ENABLE_SILENT_MSI)
11555 AC_MSG_CHECKING([whether and how to use Xinerama])
11556 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11557     if test "$x_libraries" = "default_x_libraries"; then
11558         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11559         if test "x$XINERAMALIB" = x; then
11560            XINERAMALIB="/usr/lib"
11561         fi
11562     else
11563         XINERAMALIB="$x_libraries"
11564     fi
11565     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11566         # we have both versions, let the user decide but use the dynamic one
11567         # per default
11568         USE_XINERAMA=TRUE
11569         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11570             XINERAMA_LINK=dynamic
11571         else
11572             XINERAMA_LINK=static
11573         fi
11574     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11575         # we have only the dynamic version
11576         USE_XINERAMA=TRUE
11577         XINERAMA_LINK=dynamic
11578     elif test -e "$XINERAMALIB/libXinerama.a"; then
11579         # static version
11580         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11581             USE_XINERAMA=TRUE
11582             XINERAMA_LINK=static
11583         else
11584             USE_XINERAMA=
11585             XINERAMA_LINK=none
11586         fi
11587     else
11588         # no Xinerama
11589         USE_XINERAMA=
11590         XINERAMA_LINK=none
11591     fi
11592     if test "$USE_XINERAMA" = "TRUE"; then
11593         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11594         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11595             [AC_MSG_ERROR(Xinerama header not found.)], [])
11596         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11597         if test "x$XEXTLIB" = x; then
11598            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11599         fi
11600         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11601         if test "$_os" = "FreeBSD"; then
11602             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11603         fi
11604         if test "$_os" = "Linux"; then
11605             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11606         fi
11607         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11608             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11609     else
11610         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11611     fi
11612 else
11613     USE_XINERAMA=
11614     XINERAMA_LINK=none
11615     AC_MSG_RESULT([no])
11617 AC_SUBST(USE_XINERAMA)
11618 AC_SUBST(XINERAMA_LINK)
11620 dnl ===================================================================
11621 dnl Test whether to build cairo or rely on the system version
11622 dnl ===================================================================
11624 if test "$USING_X11" = TRUE; then
11625     # Used in vcl/Library_vclplug_gen.mk
11626     test_cairo=yes
11629 if test "$test_cairo" = "yes"; then
11630     AC_MSG_CHECKING([whether to use the system cairo])
11632     : ${with_system_cairo:=$with_system_libs}
11633     if test "$with_system_cairo" = "yes"; then
11634         SYSTEM_CAIRO=TRUE
11635         AC_MSG_RESULT([yes])
11637         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11638         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11639         FilterLibs "${CAIRO_LIBS}"
11640         CAIRO_LIBS="${filteredlibs}"
11642         if test "$test_xrender" = "yes"; then
11643             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11644             AC_LANG_PUSH([C])
11645             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11646 #ifdef PictStandardA8
11647 #else
11648       return fail;
11649 #endif
11650 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11652             AC_LANG_POP([C])
11653         fi
11654     else
11655         SYSTEM_CAIRO=
11656         AC_MSG_RESULT([no])
11658         BUILD_TYPE="$BUILD_TYPE CAIRO"
11659     fi
11662 AC_SUBST(SYSTEM_CAIRO)
11663 AC_SUBST(CAIRO_CFLAGS)
11664 AC_SUBST(CAIRO_LIBS)
11666 dnl ===================================================================
11667 dnl Test whether to use avahi
11668 dnl ===================================================================
11669 if test "$_os" = "WINNT"; then
11670     # Windows uses bundled mDNSResponder
11671     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11672 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11673     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11674                       [ENABLE_AVAHI="TRUE"])
11675     AC_DEFINE(HAVE_FEATURE_AVAHI)
11676     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11677     FilterLibs "${AVAHI_LIBS}"
11678     AVAHI_LIBS="${filteredlibs}"
11681 AC_SUBST(ENABLE_AVAHI)
11682 AC_SUBST(AVAHI_CFLAGS)
11683 AC_SUBST(AVAHI_LIBS)
11685 dnl ===================================================================
11686 dnl Test whether to use liblangtag
11687 dnl ===================================================================
11688 SYSTEM_LIBLANGTAG=
11689 AC_MSG_CHECKING([whether to use system liblangtag])
11690 if test "$with_system_liblangtag" = yes; then
11691     SYSTEM_LIBLANGTAG=TRUE
11692     AC_MSG_RESULT([yes])
11693     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11694     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11695     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11696     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11697     FilterLibs "${LIBLANGTAG_LIBS}"
11698     LIBLANGTAG_LIBS="${filteredlibs}"
11699 else
11700     SYSTEM_LIBLANGTAG=
11701     AC_MSG_RESULT([no])
11702     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11703     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11704     if test "$COM" = "MSC"; then
11705         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11706     else
11707         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11708     fi
11710 AC_SUBST(SYSTEM_LIBLANGTAG)
11711 AC_SUBST(LIBLANGTAG_CFLAGS)
11712 AC_SUBST(LIBLANGTAG_LIBS)
11714 dnl ===================================================================
11715 dnl Test whether to build libpng or rely on the system version
11716 dnl ===================================================================
11718 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11720 dnl ===================================================================
11721 dnl Check for runtime JVM search path
11722 dnl ===================================================================
11723 if test "$ENABLE_JAVA" != ""; then
11724     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11725     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11726         AC_MSG_RESULT([yes])
11727         if ! test -d "$with_jvm_path"; then
11728             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11729         fi
11730         if ! test -d "$with_jvm_path"jvm; then
11731             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11732         fi
11733         JVM_ONE_PATH_CHECK="$with_jvm_path"
11734         AC_SUBST(JVM_ONE_PATH_CHECK)
11735     else
11736         AC_MSG_RESULT([no])
11737     fi
11740 dnl ===================================================================
11741 dnl Test for the presence of Ant and that it works
11742 dnl ===================================================================
11744 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11745     ANT_HOME=; export ANT_HOME
11746     WITH_ANT_HOME=; export WITH_ANT_HOME
11747     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11748         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11749             if test "$_os" = "WINNT"; then
11750                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11751             else
11752                 with_ant_home="$LODE_HOME/opt/ant"
11753             fi
11754         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11755             with_ant_home="$LODE_HOME/opt/ant"
11756         fi
11757     fi
11758     if test -z "$with_ant_home"; then
11759         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11760     else
11761         if test "$_os" = "WINNT"; then
11762             # AC_PATH_PROGS needs unix path
11763             with_ant_home=`cygpath -u "$with_ant_home"`
11764         fi
11765         AbsolutePath "$with_ant_home"
11766         with_ant_home=$absolute_path
11767         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11768         WITH_ANT_HOME=$with_ant_home
11769         ANT_HOME=$with_ant_home
11770     fi
11772     if test -z "$ANT"; then
11773         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11774     else
11775         # resolve relative or absolute symlink
11776         while test -h "$ANT"; do
11777             a_cwd=`pwd`
11778             a_basename=`basename "$ANT"`
11779             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11780             cd "`dirname "$ANT"`"
11781             cd "`dirname "$a_script"`"
11782             ANT="`pwd`"/"`basename "$a_script"`"
11783             cd "$a_cwd"
11784         done
11786         AC_MSG_CHECKING([if $ANT works])
11787         mkdir -p conftest.dir
11788         a_cwd=$(pwd)
11789         cd conftest.dir
11790         cat > conftest.java << EOF
11791         public class conftest {
11792             int testmethod(int a, int b) {
11793                     return a + b;
11794             }
11795         }
11798         cat > conftest.xml << EOF
11799         <project name="conftest" default="conftest">
11800         <target name="conftest">
11801             <javac srcdir="." includes="conftest.java">
11802             </javac>
11803         </target>
11804         </project>
11807         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11808         if test $? = 0 -a -f ./conftest.class; then
11809             AC_MSG_RESULT([Ant works])
11810             if test -z "$WITH_ANT_HOME"; then
11811                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11812                 if test -z "$ANT_HOME"; then
11813                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11814                 fi
11815             else
11816                 ANT_HOME="$WITH_ANT_HOME"
11817             fi
11818         else
11819             echo "configure: Ant test failed" >&5
11820             cat conftest.java >&5
11821             cat conftest.xml >&5
11822             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11823         fi
11824         cd "$a_cwd"
11825         rm -fr conftest.dir
11826     fi
11827     if test -z "$ANT_HOME"; then
11828         ANT_HOME="NO_ANT_HOME"
11829     else
11830         PathFormat "$ANT_HOME"
11831         ANT_HOME="$formatted_path"
11832         PathFormat "$ANT"
11833         ANT="$formatted_path"
11834     fi
11835     AC_SUBST(ANT_HOME)
11836     AC_SUBST(ANT)
11838     dnl Checking for ant.jar
11839     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11840         AC_MSG_CHECKING([Ant lib directory])
11841         if test -f $ANT_HOME/lib/ant.jar; then
11842             ANT_LIB="$ANT_HOME/lib"
11843         else
11844             if test -f $ANT_HOME/ant.jar; then
11845                 ANT_LIB="$ANT_HOME"
11846             else
11847                 if test -f /usr/share/java/ant.jar; then
11848                     ANT_LIB=/usr/share/java
11849                 else
11850                     if test -f /usr/share/ant-core/lib/ant.jar; then
11851                         ANT_LIB=/usr/share/ant-core/lib
11852                     else
11853                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11854                             ANT_LIB="$ANT_HOME/lib/ant"
11855                         else
11856                             if test -f /usr/share/lib/ant/ant.jar; then
11857                                 ANT_LIB=/usr/share/lib/ant
11858                             else
11859                                 AC_MSG_ERROR([Ant libraries not found!])
11860                             fi
11861                         fi
11862                     fi
11863                 fi
11864             fi
11865         fi
11866         PathFormat "$ANT_LIB"
11867         ANT_LIB="$formatted_path"
11868         AC_MSG_RESULT([Ant lib directory found.])
11869     fi
11870     AC_SUBST(ANT_LIB)
11872     ant_minver=1.6.0
11873     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11875     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11876     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11877     ant_version_major=`echo $ant_version | cut -d. -f1`
11878     ant_version_minor=`echo $ant_version | cut -d. -f2`
11879     echo "configure: ant_version $ant_version " >&5
11880     echo "configure: ant_version_major $ant_version_major " >&5
11881     echo "configure: ant_version_minor $ant_version_minor " >&5
11882     if test "$ant_version_major" -ge "2"; then
11883         AC_MSG_RESULT([yes, $ant_version])
11884     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11885         AC_MSG_RESULT([yes, $ant_version])
11886     else
11887         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11888     fi
11890     rm -f conftest* core core.* *.core
11893 OOO_JUNIT_JAR=
11894 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11895     AC_MSG_CHECKING([for JUnit 4])
11896     if test "$with_junit" = "yes"; then
11897         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11898             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11899         elif test -e /usr/share/java/junit4.jar; then
11900             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11901         else
11902            if test -e /usr/share/lib/java/junit.jar; then
11903               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11904            else
11905               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11906            fi
11907         fi
11908     else
11909         OOO_JUNIT_JAR=$with_junit
11910     fi
11911     if test "$_os" = "WINNT"; then
11912         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11913     fi
11914     printf 'import org.junit.Before;' > conftest.java
11915     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11916         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11917     else
11918         AC_MSG_ERROR(
11919 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11920  specify its pathname via --with-junit=..., or disable it via --without-junit])
11921     fi
11922     rm -f conftest.class conftest.java
11923     if test $OOO_JUNIT_JAR != ""; then
11924     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11925     fi
11927 AC_SUBST(OOO_JUNIT_JAR)
11929 HAMCREST_JAR=
11930 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11931     AC_MSG_CHECKING([for included Hamcrest])
11932     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11933     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11934         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11935     else
11936         AC_MSG_RESULT([Not included])
11937         AC_MSG_CHECKING([for standalone hamcrest jar.])
11938         if test "$with_hamcrest" = "yes"; then
11939             if test -e /usr/share/lib/java/hamcrest.jar; then
11940                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11941             elif test -e /usr/share/java/hamcrest/core.jar; then
11942                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11943             else
11944                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11945             fi
11946         else
11947             HAMCREST_JAR=$with_hamcrest
11948         fi
11949         if test "$_os" = "WINNT"; then
11950             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11951         fi
11952         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11953             AC_MSG_RESULT([$HAMCREST_JAR])
11954         else
11955             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),
11956                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11957         fi
11958     fi
11959     rm -f conftest.class conftest.java
11961 AC_SUBST(HAMCREST_JAR)
11964 AC_SUBST(SCPDEFS)
11967 # check for wget and curl
11969 WGET=
11970 CURL=
11972 if test "$enable_fetch_external" != "no"; then
11974 CURL=`which curl 2>/dev/null`
11976 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11977     # wget new enough?
11978     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11979     if test $? -eq 0; then
11980         WGET=$i
11981         break
11982     fi
11983 done
11985 if test -z "$WGET" -a -z "$CURL"; then
11986     AC_MSG_ERROR([neither wget nor curl found!])
11991 AC_SUBST(WGET)
11992 AC_SUBST(CURL)
11995 # check for sha256sum
11997 SHA256SUM=
11999 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12000     eval "$i -a 256 --version" > /dev/null 2>&1
12001     ret=$?
12002     if test $ret -eq 0; then
12003         SHA256SUM="$i -a 256"
12004         break
12005     fi
12006 done
12008 if test -z "$SHA256SUM"; then
12009     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12010         eval "$i --version" > /dev/null 2>&1
12011         ret=$?
12012         if test $ret -eq 0; then
12013             SHA256SUM=$i
12014             break
12015         fi
12016     done
12019 if test -z "$SHA256SUM"; then
12020     AC_MSG_ERROR([no sha256sum found!])
12023 AC_SUBST(SHA256SUM)
12025 dnl ===================================================================
12026 dnl Dealing with l10n options
12027 dnl ===================================================================
12028 AC_MSG_CHECKING([which languages to be built])
12029 # get list of all languages
12030 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12031 # the sed command does the following:
12032 #   + if a line ends with a backslash, append the next line to it
12033 #   + adds " on the beginning of the value (after =)
12034 #   + adds " at the end of the value
12035 #   + removes en-US; we want to put it on the beginning
12036 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12037 [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)]
12038 ALL_LANGS="en-US $completelangiso"
12039 # check the configured localizations
12040 WITH_LANG="$with_lang"
12042 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12043 # (Norwegian is "nb" and "nn".)
12044 if test "$WITH_LANG" = "no"; then
12045     WITH_LANG=
12048 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12049     AC_MSG_RESULT([en-US])
12050 else
12051     AC_MSG_RESULT([$WITH_LANG])
12052     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12053     if test -z "$MSGFMT"; then
12054         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12055             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12056         elif test -x "/opt/lo/bin/msgfmt"; then
12057             MSGFMT="/opt/lo/bin/msgfmt"
12058         else
12059             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12060             if test -z "$MSGFMT"; then
12061                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12062             fi
12063         fi
12064     fi
12065     if test -z "$MSGUNIQ"; then
12066         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12067             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12068         elif test -x "/opt/lo/bin/msguniq"; then
12069             MSGUNIQ="/opt/lo/bin/msguniq"
12070         else
12071             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12072             if test -z "$MSGUNIQ"; then
12073                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12074             fi
12075         fi
12076     fi
12078 AC_SUBST(MSGFMT)
12079 AC_SUBST(MSGUNIQ)
12080 # check that the list is valid
12081 for lang in $WITH_LANG; do
12082     test "$lang" = "ALL" && continue
12083     # need to check for the exact string, so add space before and after the list of all languages
12084     for vl in $ALL_LANGS; do
12085         if test "$vl" = "$lang"; then
12086            break
12087         fi
12088     done
12089     if test "$vl" != "$lang"; then
12090         # if you're reading this - you prolly quoted your languages remove the quotes ...
12091         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12092     fi
12093 done
12094 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12095     echo $WITH_LANG | grep -q en-US
12096     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12098 # list with substituted ALL
12099 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12100 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12101 test "$WITH_LANG" = "en-US" && WITH_LANG=
12102 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12103     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12104     ALL_LANGS=`echo $ALL_LANGS qtz`
12106 AC_SUBST(ALL_LANGS)
12107 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12108 AC_SUBST(WITH_LANG)
12109 AC_SUBST(WITH_LANG_LIST)
12110 AC_SUBST(GIT_NEEDED_SUBMODULES)
12112 WITH_POOR_HELP_LOCALIZATIONS=
12113 if test -d "$SRC_ROOT/translations/source"; then
12114     for l in `ls -1 $SRC_ROOT/translations/source`; do
12115         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12116             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12117         fi
12118     done
12120 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12122 if test -n "$with_locales"; then
12123     WITH_LOCALES="$with_locales"
12125     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12126     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12127     # config_host/config_locales.h.in
12128     for locale in $WITH_LOCALES; do
12129         lang=${locale%_*}
12131         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12133         case $lang in
12134         hi|mr*ne)
12135             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12136             ;;
12137         bg|ru)
12138             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12139             ;;
12140         esac
12141     done
12142 else
12143     AC_DEFINE(WITH_LOCALE_ALL)
12145 AC_SUBST(WITH_LOCALES)
12147 dnl git submodule update --reference
12148 dnl ===================================================================
12149 if test -n "${GIT_REFERENCE_SRC}"; then
12150     for repo in ${GIT_NEEDED_SUBMODULES}; do
12151         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12152             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12153         fi
12154     done
12156 AC_SUBST(GIT_REFERENCE_SRC)
12158 dnl git submodules linked dirs
12159 dnl ===================================================================
12160 if test -n "${GIT_LINK_SRC}"; then
12161     for repo in ${GIT_NEEDED_SUBMODULES}; do
12162         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12163             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12164         fi
12165     done
12167 AC_SUBST(GIT_LINK_SRC)
12169 dnl branding
12170 dnl ===================================================================
12171 AC_MSG_CHECKING([for alternative branding images directory])
12172 # initialize mapped arrays
12173 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12174 brand_files="$BRAND_INTRO_IMAGES about.svg"
12176 if test -z "$with_branding" -o "$with_branding" = "no"; then
12177     AC_MSG_RESULT([none])
12178     DEFAULT_BRAND_IMAGES="$brand_files"
12179 else
12180     if ! test -d $with_branding ; then
12181         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12182     else
12183         AC_MSG_RESULT([$with_branding])
12184         CUSTOM_BRAND_DIR="$with_branding"
12185         for lfile in $brand_files
12186         do
12187             if ! test -f $with_branding/$lfile ; then
12188                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12189                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12190             else
12191                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12192             fi
12193         done
12194         check_for_progress="yes"
12195     fi
12197 AC_SUBST([BRAND_INTRO_IMAGES])
12198 AC_SUBST([CUSTOM_BRAND_DIR])
12199 AC_SUBST([CUSTOM_BRAND_IMAGES])
12200 AC_SUBST([DEFAULT_BRAND_IMAGES])
12203 AC_MSG_CHECKING([for 'intro' progress settings])
12204 PROGRESSBARCOLOR=
12205 PROGRESSSIZE=
12206 PROGRESSPOSITION=
12207 PROGRESSFRAMECOLOR=
12208 PROGRESSTEXTCOLOR=
12209 PROGRESSTEXTBASELINE=
12211 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12212     source "$with_branding/progress.conf"
12213     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12214 else
12215     AC_MSG_RESULT([none])
12218 AC_SUBST(PROGRESSBARCOLOR)
12219 AC_SUBST(PROGRESSSIZE)
12220 AC_SUBST(PROGRESSPOSITION)
12221 AC_SUBST(PROGRESSFRAMECOLOR)
12222 AC_SUBST(PROGRESSTEXTCOLOR)
12223 AC_SUBST(PROGRESSTEXTBASELINE)
12226 AC_MSG_CHECKING([for extra build ID])
12227 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12228     EXTRA_BUILDID="$with_extra_buildid"
12230 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12231 if test -n "$EXTRA_BUILDID" ; then
12232     AC_MSG_RESULT([$EXTRA_BUILDID])
12233 else
12234     AC_MSG_RESULT([not set])
12236 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12238 OOO_VENDOR=
12239 AC_MSG_CHECKING([for vendor])
12240 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12241     OOO_VENDOR="$USERNAME"
12243     if test -z "$OOO_VENDOR"; then
12244         OOO_VENDOR="$USER"
12245     fi
12247     if test -z "$OOO_VENDOR"; then
12248         OOO_VENDOR="`id -u -n`"
12249     fi
12251     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12252 else
12253     OOO_VENDOR="$with_vendor"
12254     AC_MSG_RESULT([$OOO_VENDOR])
12256 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12257 AC_SUBST(OOO_VENDOR)
12259 if test "$_os" = "Android" ; then
12260     ANDROID_PACKAGE_NAME=
12261     AC_MSG_CHECKING([for Android package name])
12262     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12263         if test -n "$ENABLE_DEBUG"; then
12264             # Default to the package name that makes ndk-gdb happy.
12265             ANDROID_PACKAGE_NAME="org.libreoffice"
12266         else
12267             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12268         fi
12270         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12271     else
12272         ANDROID_PACKAGE_NAME="$with_android_package_name"
12273         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12274     fi
12275     AC_SUBST(ANDROID_PACKAGE_NAME)
12278 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12279 if test "$with_compat_oowrappers" = "yes"; then
12280     WITH_COMPAT_OOWRAPPERS=TRUE
12281     AC_MSG_RESULT(yes)
12282 else
12283     WITH_COMPAT_OOWRAPPERS=
12284     AC_MSG_RESULT(no)
12286 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12288 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12289 AC_MSG_CHECKING([for install dirname])
12290 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12291     INSTALLDIRNAME="$with_install_dirname"
12293 AC_MSG_RESULT([$INSTALLDIRNAME])
12294 AC_SUBST(INSTALLDIRNAME)
12296 AC_MSG_CHECKING([for prefix])
12297 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12298 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12299 PREFIXDIR="$prefix"
12300 AC_MSG_RESULT([$PREFIXDIR])
12301 AC_SUBST(PREFIXDIR)
12303 LIBDIR=[$(eval echo $(eval echo $libdir))]
12304 AC_SUBST(LIBDIR)
12306 DATADIR=[$(eval echo $(eval echo $datadir))]
12307 AC_SUBST(DATADIR)
12309 MANDIR=[$(eval echo $(eval echo $mandir))]
12310 AC_SUBST(MANDIR)
12312 DOCDIR=[$(eval echo $(eval echo $docdir))]
12313 AC_SUBST(DOCDIR)
12315 BINDIR=[$(eval echo $(eval echo $bindir))]
12316 AC_SUBST(BINDIR)
12318 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12319 AC_SUBST(INSTALLDIR)
12321 TESTINSTALLDIR="${BUILDDIR}/test-install"
12322 AC_SUBST(TESTINSTALLDIR)
12325 # ===================================================================
12326 # OAuth2 id and secrets
12327 # ===================================================================
12329 AC_MSG_CHECKING([for Google Drive client id and secret])
12330 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12331     AC_MSG_RESULT([not set])
12332     GDRIVE_CLIENT_ID="\"\""
12333     GDRIVE_CLIENT_SECRET="\"\""
12334 else
12335     AC_MSG_RESULT([set])
12336     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12337     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12339 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12340 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12342 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12343 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12344     AC_MSG_RESULT([not set])
12345     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12346     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12347 else
12348     AC_MSG_RESULT([set])
12349     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12350     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12352 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12353 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12355 AC_MSG_CHECKING([for OneDrive client id and secret])
12356 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12357     AC_MSG_RESULT([not set])
12358     ONEDRIVE_CLIENT_ID="\"\""
12359     ONEDRIVE_CLIENT_SECRET="\"\""
12360 else
12361     AC_MSG_RESULT([set])
12362     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12363     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12365 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12366 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12369 dnl ===================================================================
12370 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12371 dnl --enable-dependency-tracking configure option
12372 dnl ===================================================================
12373 AC_MSG_CHECKING([whether to enable dependency tracking])
12374 if test "$enable_dependency_tracking" = "no"; then
12375     nodep=TRUE
12376     AC_MSG_RESULT([no])
12377 else
12378     AC_MSG_RESULT([yes])
12380 AC_SUBST(nodep)
12382 dnl ===================================================================
12383 dnl Number of CPUs to use during the build
12384 dnl ===================================================================
12385 AC_MSG_CHECKING([for number of processors to use])
12386 # plain --with-parallelism is just the default
12387 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12388     if test "$with_parallelism" = "no"; then
12389         PARALLELISM=0
12390     else
12391         PARALLELISM=$with_parallelism
12392     fi
12393 else
12394     if test "$enable_icecream" = "yes"; then
12395         PARALLELISM="10"
12396     else
12397         case `uname -s` in
12399         Darwin|FreeBSD|NetBSD|OpenBSD)
12400             PARALLELISM=`sysctl -n hw.ncpu`
12401             ;;
12403         Linux)
12404             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12405         ;;
12406         # what else than above does profit here *and* has /proc?
12407         *)
12408             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12409             ;;
12410         esac
12412         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12413         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12414     fi
12417 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12418     if test -z "$with_parallelism"; then
12419             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12420             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12421             PARALLELISM="1"
12422     else
12423         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."
12424     fi
12427 if test $PARALLELISM -eq 0; then
12428     AC_MSG_RESULT([explicit make -j option needed])
12429 else
12430     AC_MSG_RESULT([$PARALLELISM])
12432 AC_SUBST(PARALLELISM)
12434 IWYU_PATH="$with_iwyu"
12435 AC_SUBST(IWYU_PATH)
12436 if test ! -z "$IWYU_PATH"; then
12437     if test ! -f "$IWYU_PATH"; then
12438         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12439     fi
12443 # Set up ILIB for MSVC build
12445 ILIB1=
12446 if test "$build_os" = "cygwin"; then
12447     ILIB="."
12448     if test -n "$JAVA_HOME"; then
12449         ILIB="$ILIB;$JAVA_HOME/lib"
12450     fi
12451     ILIB1=-link
12452     if test "$BITNESS_OVERRIDE" = 64; then
12453         ILIB="$ILIB;$COMPATH/lib/x64"
12454         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12455         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12456         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12457         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12458             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12459             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12460         fi
12461         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12462         ucrtlibpath_formatted=$formatted_path
12463         ILIB="$ILIB;$ucrtlibpath_formatted"
12464         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12465     else
12466         ILIB="$ILIB;$COMPATH/lib/x86"
12467         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12468         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12469         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12470         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12471             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12472             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12473         fi
12474         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12475         ucrtlibpath_formatted=$formatted_path
12476         ILIB="$ILIB;$ucrtlibpath_formatted"
12477         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12478     fi
12479     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12480         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12481     else
12482         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12483     fi
12485     AC_SUBST(ILIB)
12488 AC_MSG_CHECKING([whether $CXX supports inline variables])
12489 AC_LANG_PUSH([C++])
12490 save_CXXFLAGS=$CXXFLAGS
12491 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12492 if test "$build_os" = cygwin; then
12493     save_LIB=$LIB
12494     export LIB=$ILIB
12496 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
12497         #if !defined __cpp_inline_variables
12498         // This tests for one specific aspect of inline variables that is actually used by
12499         // ORegistry::ROOT (registry/source/regimpl.cxx):
12500         struct S { constexpr S() {} };
12501         struct T { static constexpr S s{}; };
12502         S const * f() { return &T::s; }
12503         #endif
12504     ]])], [
12505         AC_DEFINE([HAVE_CPP_INLINE_VARIABLES],[1])
12506         AC_MSG_RESULT([yes])
12507     ], [AC_MSG_RESULT([no])])
12508 CXXFLAGS=$save_CXXFLAGS
12509 if test "$build_os" = cygwin; then
12510     LIB=$save_LIB
12512 AC_LANG_POP([C++])
12514 dnl We should be able to drop the below check when bumping the GCC baseline to
12515 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12516 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12517 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12518 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12519 AC_MSG_CHECKING(
12520     [whether C++11 use of const_iterator in standard containers is broken])
12521 save_CXXFLAGS=$CXXFLAGS
12522 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12523 AC_LANG_PUSH([C++])
12524 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12525     #include <list>
12526     ]],[[
12527         std::list<int> l;
12528         l.erase(l.cbegin());
12529     ]])],
12530     [broken=no], [broken=yes])
12531 AC_LANG_POP([C++])
12532 CXXFLAGS=$save_CXXFLAGS
12533 AC_MSG_RESULT([$broken])
12534 if test "$broken" = yes; then
12535     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12539 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12540 save_CXXFLAGS=$CXXFLAGS
12541 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12542 save_LIBS=$LIBS
12543 if test -n "$ILIB1"; then
12544     LIBS="$LIBS $ILIB1"
12546 AC_LANG_PUSH([C++])
12547 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12548     // Exit with failure if the static initializer_list is stored on the
12549     // stack (as done by Clang < 3.4):
12550     #include <initializer_list>
12551     struct S {};
12552     bool g(void const * p1, void const * p2) {
12553         int n;
12554         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12555     }
12556     bool f(void const * p1) {
12557         static std::initializer_list<S> s { S() };
12558         return g(p1, s.begin());
12559     }
12560     ]],[[
12561         int n;
12562         return f(&n) ? 0 : 1;
12563     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12564 AC_LANG_POP([C++])
12565 LIBS=$save_LIBS
12566 CXXFLAGS=$save_CXXFLAGS
12567 AC_MSG_RESULT([$broken])
12568 if test "$broken" = yes -a "$_os" != "iOS"; then
12569     AC_MSG_ERROR([working support for static initializer_list needed])
12573 # ===================================================================
12574 # Creating bigger shared library to link against
12575 # ===================================================================
12576 AC_MSG_CHECKING([whether to create huge library])
12577 MERGELIBS=
12579 if test $_os = iOS -o $_os = Android; then
12580     # Never any point in mergelibs for these as we build just static
12581     # libraries anyway...
12582     enable_mergelibs=no
12585 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12586     if test $_os != Linux -a $_os != WINNT; then
12587         add_warning "--enable-mergelibs is not tested for this platform"
12588     fi
12589     MERGELIBS="TRUE"
12590     AC_MSG_RESULT([yes])
12591 else
12592     AC_MSG_RESULT([no])
12594 AC_SUBST([MERGELIBS])
12596 dnl ===================================================================
12597 dnl icerun is a wrapper that stops us spawning tens of processes
12598 dnl locally - for tools that can't be executed on the compile cluster
12599 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12600 dnl ===================================================================
12601 AC_MSG_CHECKING([whether to use icerun wrapper])
12602 ICECREAM_RUN=
12603 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12604     ICECREAM_RUN=icerun
12605     AC_MSG_RESULT([yes])
12606 else
12607     AC_MSG_RESULT([no])
12609 AC_SUBST(ICECREAM_RUN)
12611 dnl ===================================================================
12612 dnl Setup the ICECC_VERSION for the build the same way it was set for
12613 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12614 dnl ===================================================================
12615 x_ICECC_VERSION=[\#]
12616 if test -n "$ICECC_VERSION" ; then
12617     x_ICECC_VERSION=
12619 AC_SUBST(x_ICECC_VERSION)
12620 AC_SUBST(ICECC_VERSION)
12622 dnl ===================================================================
12624 AC_MSG_CHECKING([MPL subset])
12625 MPL_SUBSET=
12627 if test "$enable_mpl_subset" = "yes"; then
12628     warn_report=false
12629     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12630         warn_report=true
12631     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12632         warn_report=true
12633     fi
12634     if test "$warn_report" = "true"; then
12635         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12636     fi
12637     if test "x$enable_postgresql_sdbc" != "xno"; then
12638         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12639     fi
12640     if test "$enable_lotuswordpro" = "yes"; then
12641         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12642     fi
12643     if test "$WITH_WEBDAV" = "neon"; then
12644         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12645     fi
12646     if test -n "$ENABLE_PDFIMPORT"; then
12647         if test "x$SYSTEM_POPPLER" = "x"; then
12648             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12649         fi
12650     fi
12651     # cf. m4/libo_check_extension.m4
12652     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12653         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12654     fi
12655     for theme in $WITH_THEMES; do
12656         case $theme in
12657         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12658             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12659         *) : ;;
12660         esac
12661     done
12663     ENABLE_OPENGL_TRANSITIONS=
12665     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12666         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12667     fi
12669     MPL_SUBSET="TRUE"
12670     AC_DEFINE(MPL_HAVE_SUBSET)
12671     AC_MSG_RESULT([only])
12672 else
12673     AC_MSG_RESULT([no restrictions])
12675 AC_SUBST(MPL_SUBSET)
12677 dnl ===================================================================
12679 AC_MSG_CHECKING([formula logger])
12680 ENABLE_FORMULA_LOGGER=
12682 if test "x$enable_formula_logger" = "xyes"; then
12683     AC_MSG_RESULT([yes])
12684     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12685     ENABLE_FORMULA_LOGGER=TRUE
12686 elif test -n "$ENABLE_DBGUTIL" ; then
12687     AC_MSG_RESULT([yes])
12688     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12689     ENABLE_FORMULA_LOGGER=TRUE
12690 else
12691     AC_MSG_RESULT([no])
12694 AC_SUBST(ENABLE_FORMULA_LOGGER)
12696 dnl ===================================================================
12697 dnl Setting up the environment.
12698 dnl ===================================================================
12699 AC_MSG_NOTICE([setting up the build environment variables...])
12701 AC_SUBST(COMPATH)
12703 if test "$build_os" = "cygwin"; then
12704     if test -d "$COMPATH/atlmfc/lib"; then
12705         ATL_LIB="$COMPATH/atlmfc/lib"
12706         ATL_INCLUDE="$COMPATH/atlmfc/include"
12707     else
12708         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12709         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12710     fi
12711     if test "$BITNESS_OVERRIDE" = 64; then
12712         if test $VCVER = "150"; then
12713             ATL_LIB="$ATL_LIB/x64"
12714         else
12715             ATL_LIB="$ATL_LIB/amd64"
12716         fi
12717     else
12718         if test $VCVER = "150"; then
12719             ATL_LIB="$ATL_LIB/x86"
12720         fi
12721     fi
12722     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12723     PathFormat "/usr/bin/find.exe"
12724     FIND="$formatted_path"
12725     PathFormat "/usr/bin/sort.exe"
12726     SORT="$formatted_path"
12727     PathFormat "/usr/bin/grep.exe"
12728     WIN_GREP="$formatted_path"
12729     PathFormat "/usr/bin/ls.exe"
12730     WIN_LS="$formatted_path"
12731     PathFormat "/usr/bin/touch.exe"
12732     WIN_TOUCH="$formatted_path"
12733 else
12734     FIND=find
12735     SORT=sort
12738 AC_SUBST(ATL_INCLUDE)
12739 AC_SUBST(ATL_LIB)
12740 AC_SUBST(FIND)
12741 AC_SUBST(SORT)
12742 AC_SUBST(WIN_GREP)
12743 AC_SUBST(WIN_LS)
12744 AC_SUBST(WIN_TOUCH)
12746 AC_SUBST(BUILD_TYPE)
12748 AC_SUBST(SOLARINC)
12750 PathFormat "$PERL"
12751 PERL="$formatted_path"
12752 AC_SUBST(PERL)
12754 if test -n "$TMPDIR"; then
12755     TEMP_DIRECTORY="$TMPDIR"
12756 else
12757     TEMP_DIRECTORY="/tmp"
12759 if test "$build_os" = "cygwin"; then
12760     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12762 AC_SUBST(TEMP_DIRECTORY)
12764 # setup the PATH for the environment
12765 if test -n "$LO_PATH_FOR_BUILD"; then
12766     LO_PATH="$LO_PATH_FOR_BUILD"
12767 else
12768     LO_PATH="$PATH"
12770     case "$host_os" in
12772     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12773         if test "$ENABLE_JAVA" != ""; then
12774             pathmunge "$JAVA_HOME/bin" "after"
12775         fi
12776         ;;
12778     cygwin*)
12779         # Win32 make needs native paths
12780         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12781             LO_PATH=`cygpath -p -m "$PATH"`
12782         fi
12783         if test "$BITNESS_OVERRIDE" = 64; then
12784             # needed for msi packaging
12785             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12786         fi
12787         # .NET 4.6 and higher don't have bin directory
12788         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12789             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12790         fi
12791         pathmunge "$ASM_HOME" "before"
12792         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12793         pathmunge "$CSC_PATH" "before"
12794         pathmunge "$MIDL_PATH" "before"
12795         pathmunge "$AL_PATH" "before"
12796         pathmunge "$MSPDB_PATH" "before"
12797         if test -n "$MSBUILD_PATH" ; then
12798             pathmunge "$MSBUILD_PATH" "before"
12799         fi
12800         if test "$BITNESS_OVERRIDE" = 64; then
12801             pathmunge "$COMPATH/bin/amd64" "before"
12802             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12803         else
12804             pathmunge "$COMPATH/bin" "before"
12805             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12806         fi
12807         if test "$ENABLE_JAVA" != ""; then
12808             if test -d "$JAVA_HOME/jre/bin/client"; then
12809                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12810             fi
12811             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12812                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12813             fi
12814             pathmunge "$JAVA_HOME/bin" "before"
12815         fi
12816         ;;
12818     solaris*)
12819         pathmunge "/usr/css/bin" "before"
12820         if test "$ENABLE_JAVA" != ""; then
12821             pathmunge "$JAVA_HOME/bin" "after"
12822         fi
12823         ;;
12824     esac
12827 AC_SUBST(LO_PATH)
12829 libo_FUZZ_SUMMARY
12831 # Generate a configuration sha256 we can use for deps
12832 if test -f config_host.mk; then
12833     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12835 if test -f config_host_lang.mk; then
12836     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12839 CFLAGS=$my_original_CFLAGS
12840 CXXFLAGS=$my_original_CXXFLAGS
12841 CPPFLAGS=$my_original_CPPFLAGS
12843 AC_CONFIG_FILES([config_host.mk
12844                  config_host_lang.mk
12845                  Makefile
12846                  lo.xcent
12847                  bin/bffvalidator.sh
12848                  bin/odfvalidator.sh
12849                  bin/officeotron.sh
12850                  instsetoo_native/util/openoffice.lst
12851                  sysui/desktop/macosx/Info.plist])
12852 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12853 AC_CONFIG_HEADERS([config_host/config_clang.h])
12854 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12855 AC_CONFIG_HEADERS([config_host/config_eot.h])
12856 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12857 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12858 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12859 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12860 AC_CONFIG_HEADERS([config_host/config_features.h])
12861 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12862 AC_CONFIG_HEADERS([config_host/config_folders.h])
12863 AC_CONFIG_HEADERS([config_host/config_gio.h])
12864 AC_CONFIG_HEADERS([config_host/config_global.h])
12865 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12866 AC_CONFIG_HEADERS([config_host/config_java.h])
12867 AC_CONFIG_HEADERS([config_host/config_langs.h])
12868 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12869 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12870 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12871 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12872 AC_CONFIG_HEADERS([config_host/config_locales.h])
12873 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12874 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12875 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12876 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12877 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12878 AC_CONFIG_HEADERS([config_host/config_oox.h])
12879 AC_CONFIG_HEADERS([config_host/config_options.h])
12880 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12881 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12882 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12883 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12884 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12885 AC_CONFIG_HEADERS([config_host/config_version.h])
12886 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12887 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12888 AC_CONFIG_HEADERS([config_host/config_python.h])
12889 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12890 AC_OUTPUT
12892 if test "$CROSS_COMPILING" = TRUE; then
12893     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12896 # touch the config timestamp file
12897 if test ! -f config_host.mk.stamp; then
12898     echo > config_host.mk.stamp
12899 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12900     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12901 else
12902     echo > config_host.mk.stamp
12905 # touch the config lang timestamp file
12906 if test ! -f config_host_lang.mk.stamp; then
12907     echo > config_host_lang.mk.stamp
12908 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12909     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12910 else
12911     echo > config_host_lang.mk.stamp
12915 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12917 cat << _EOS
12918 ****************************************************************************
12919 WARNING:
12920 Your make version is known to be horribly slow, and hard to debug
12921 problems with. To get a reasonably functional make please do:
12923 to install a pre-compiled binary make for Win32
12925  mkdir -p /opt/lo/bin
12926  cd /opt/lo/bin
12927  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12928  cp make-85047eb-msvc.exe make
12929  chmod +x make
12931 to install from source:
12932 place yourself in a working directory of you choice.
12934  git clone git://git.savannah.gnu.org/make.git
12936  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12937  set PATH=%PATH%;C:\Cygwin\bin
12938  [or Cygwin64, if that is what you have]
12939  cd path-to-make-repo-you-cloned-above
12940  build_w32.bat --without-guile
12942 should result in a WinRel/gnumake.exe.
12943 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12945 Then re-run autogen.sh
12947 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12948 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12950 _EOS
12953 cat << _EOF
12954 ****************************************************************************
12956 To build, run:
12957 $GNUMAKE
12959 To view some help, run:
12960 $GNUMAKE help
12962 _EOF
12964 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12965     cat << _EOF
12966 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12967 _EOF
12969     if test $_os = Darwin; then
12970         echo open instdir/$PRODUCTNAME.app
12971     else
12972         echo instdir/program/soffice
12973     fi
12974     cat << _EOF
12976 If you want to run the smoketest, run:
12977 $GNUMAKE check
12979 _EOF
12982 if test -f warn; then
12983     cat warn
12984     rm warn
12987 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: