sw: new unit test for XCloseable
[LibreOffice.git] / configure.ac
blobbc165bd6b31a6fcfbb203b2300fe4628dd3f3b0b
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.3.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 habit of letting a lot of 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_ppds=no
668         if test "$enable_ios_simulator" = "yes"; then
669             host=x86_64-apple-darwin
670         fi
671     else
672         _os=Darwin
673         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
674         INSTROOTCONTENTSUFFIX=/Contents
675         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
676     fi
677     # See comment above the case "$host_os"
678     LINKFLAGSSHL="-dynamiclib -single_module"
680     # -fPIC is default
681     PICSWITCH=""
683     DLLPOST=".dylib"
685     # -undefined error is the default
686     LINKFLAGSNOUNDEFS=""
689 freebsd*)
690     test_gtk=yes
691     build_gstreamer_1_0=yes
692     build_gstreamer_0_10=yes
693     test_kde4=yes
694     test_kde5=yes
695     test_gtk3_kde5=yes
696     test_freetype=yes
697     AC_MSG_CHECKING([the FreeBSD operating system release])
698     if test -n "$with_os_version"; then
699         OSVERSION="$with_os_version"
700     else
701         OSVERSION=`/sbin/sysctl -n kern.osreldate`
702     fi
703     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
704     AC_MSG_CHECKING([which thread library to use])
705     if test "$OSVERSION" -lt "500016"; then
706         PTHREAD_CFLAGS="-D_THREAD_SAFE"
707         PTHREAD_LIBS="-pthread"
708     elif test "$OSVERSION" -lt "502102"; then
709         PTHREAD_CFLAGS="-D_THREAD_SAFE"
710         PTHREAD_LIBS="-lc_r"
711     else
712         PTHREAD_CFLAGS=""
713         PTHREAD_LIBS="-pthread"
714     fi
715     AC_MSG_RESULT([$PTHREAD_LIBS])
716     _os=FreeBSD
717     ;;
719 *netbsd*)
720     test_gtk=yes
721     build_gstreamer_1_0=yes
722     build_gstreamer_0_10=yes
723     test_kde4=yes
724     test_kde5=yes
725     test_gtk3_kde5=yes
726     test_freetype=yes
727     PTHREAD_LIBS="-pthread -lpthread"
728     _os=NetBSD
729     ;;
731 aix*)
732     test_randr=no
733     test_freetype=yes
734     PTHREAD_LIBS=-pthread
735     _os=AIX
736     ;;
738 openbsd*)
739     test_gtk=yes
740     test_freetype=yes
741     PTHREAD_CFLAGS="-D_THREAD_SAFE"
742     PTHREAD_LIBS="-pthread"
743     _os=OpenBSD
744     ;;
746 dragonfly*)
747     test_gtk=yes
748     build_gstreamer_1_0=yes
749     build_gstreamer_0_10=yes
750     test_kde4=yes
751     test_kde5=yes
752     test_gtk3_kde5=yes
753     test_freetype=yes
754     PTHREAD_LIBS="-pthread"
755     _os=DragonFly
756     ;;
758 linux-android*)
759     build_gstreamer_1_0=no
760     build_gstreamer_0_10=no
761     enable_lotuswordpro=no
762     enable_mpl_subset=yes
763     enable_coinmp=yes
764     enable_lpsolve=no
765     enable_report_builder=no
766     enable_odk=no
767     enable_postgresql_sdbc=no
768     enable_python=no
769     with_theme="tango"
770     test_cups=no
771     test_dbus=no
772     test_fontconfig=no
773     test_freetype=no
774     test_gtk=no
775     test_kde4=no
776     test_kde5=no
777     test_gtk3_kde5=no
778     test_randr=no
779     test_xrender=no
780     _os=Android
782     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
783     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
784     ;;
786 haiku*)
787     test_cups=no
788     test_dbus=no
789     test_randr=no
790     test_xrender=no
791     test_freetype=yes
792     enable_odk=no
793     enable_gstreamer_0_10=no
794     enable_gstreamer_1_0=no
795     enable_vlc=no
796     enable_coinmp=no
797     enable_pdfium=no
798     enable_sdremote=no
799     enable_postgresql_sdbc=no
800     enable_firebird_sdbc=no
801     _os=Haiku
802     ;;
805     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
806     ;;
807 esac
809 if test "$_os" != "WINNT"; then
810 AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
811 else
812 ENDIANNESS=little
814 AC_SUBST(ENDIANNESS)
816 if test "$_os" = "Android" ; then
817     # Verify that the NDK and SDK options are proper
818     if test -z "$with_android_ndk"; then
819         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
820     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
821         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
822     fi
824     if test -z "$ANDROID_SDK_HOME"; then
825         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
826     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
827         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
828     fi
830     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
831     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
832         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
833                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
834                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
835         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
836         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
837         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
838     fi
839     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
840         AC_MSG_WARN([android support repository not found - install with
841                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
842                      to allow the build to download the specified version of the android support libraries])
843         add_warning "android support repository not found - install with"
844         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
845         add_warning "to allow the build to download the specified version of the android support libraries"
846     fi
849 if test "$_os" = "AIX"; then
850     AC_PATH_PROG(GAWK, gawk)
851     if test -z "$GAWK"; then
852         AC_MSG_ERROR([gawk not found in \$PATH])
853     fi
856 AC_SUBST(SDKDIRNAME)
858 AC_SUBST(PTHREAD_CFLAGS)
859 AC_SUBST(PTHREAD_LIBS)
861 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
862 # By default use the ones specified by our build system,
863 # but explicit override is possible.
864 AC_MSG_CHECKING(for explicit AFLAGS)
865 if test -n "$AFLAGS"; then
866     AC_MSG_RESULT([$AFLAGS])
867     x_AFLAGS=
868 else
869     AC_MSG_RESULT(no)
870     x_AFLAGS=[\#]
872 AC_MSG_CHECKING(for explicit CFLAGS)
873 if test -n "$CFLAGS"; then
874     AC_MSG_RESULT([$CFLAGS])
875     x_CFLAGS=
876 else
877     AC_MSG_RESULT(no)
878     x_CFLAGS=[\#]
880 AC_MSG_CHECKING(for explicit CXXFLAGS)
881 if test -n "$CXXFLAGS"; then
882     AC_MSG_RESULT([$CXXFLAGS])
883     x_CXXFLAGS=
884 else
885     AC_MSG_RESULT(no)
886     x_CXXFLAGS=[\#]
888 AC_MSG_CHECKING(for explicit OBJCFLAGS)
889 if test -n "$OBJCFLAGS"; then
890     AC_MSG_RESULT([$OBJCFLAGS])
891     x_OBJCFLAGS=
892 else
893     AC_MSG_RESULT(no)
894     x_OBJCFLAGS=[\#]
896 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
897 if test -n "$OBJCXXFLAGS"; then
898     AC_MSG_RESULT([$OBJCXXFLAGS])
899     x_OBJCXXFLAGS=
900 else
901     AC_MSG_RESULT(no)
902     x_OBJCXXFLAGS=[\#]
904 AC_MSG_CHECKING(for explicit LDFLAGS)
905 if test -n "$LDFLAGS"; then
906     AC_MSG_RESULT([$LDFLAGS])
907     x_LDFLAGS=
908 else
909     AC_MSG_RESULT(no)
910     x_LDFLAGS=[\#]
912 AC_SUBST(AFLAGS)
913 AC_SUBST(CFLAGS)
914 AC_SUBST(CXXFLAGS)
915 AC_SUBST(OBJCFLAGS)
916 AC_SUBST(OBJCXXFLAGS)
917 AC_SUBST(LDFLAGS)
918 AC_SUBST(x_AFLAGS)
919 AC_SUBST(x_CFLAGS)
920 AC_SUBST(x_CXXFLAGS)
921 AC_SUBST(x_OBJCFLAGS)
922 AC_SUBST(x_OBJCXXFLAGS)
923 AC_SUBST(x_LDFLAGS)
925 dnl These are potentially set for MSVC, in the code checking for UCRT below:
926 my_original_CFLAGS=$CFLAGS
927 my_original_CXXFLAGS=$CXXFLAGS
928 my_original_CPPFLAGS=$CPPFLAGS
930 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
931 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
932 dnl AC_PROG_CC internally.
933 if test "$_os" != "WINNT"; then
934     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
935     save_CFLAGS=$CFLAGS
936     AC_PROG_CC
937     CFLAGS=$save_CFLAGS
940 if test $_os != "WINNT"; then
941     save_LIBS="$LIBS"
942     AC_SEARCH_LIBS([dlsym], [dl],
943         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
944         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
945     LIBS="$save_LIBS"
947 AC_SUBST(DLOPEN_LIBS)
949 AC_ARG_ENABLE(ios-simulator,
950     AS_HELP_STRING([--enable-ios-simulator],
951         [build i386 or x86_64 for ios simulator])
954 AC_ARG_ENABLE(ios-libreofficelight-app,
955     AS_HELP_STRING([--enable-ios-libreofficelight-app],
956         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
957          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
958          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
961 ENABLE_IOS_LIBREOFFICELIGHT_APP=
962 if test "$enable_ios_libreofficelight_app" = yes; then
963     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
965 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
967 ###############################################################################
968 # Extensions switches --enable/--disable
969 ###############################################################################
970 # By default these should be enabled unless having extra dependencies.
971 # If there is extra dependency over configure options then the enable should
972 # be automagic based on whether the requiring feature is enabled or not.
973 # All this options change anything only with --enable-extension-integration.
975 # The name of this option and its help string makes it sound as if
976 # extensions are built anyway, just not integrated in the installer,
977 # if you use --disable-extension-integration. Is that really the
978 # case?
980 libo_FUZZ_ARG_ENABLE(extension-integration,
981     AS_HELP_STRING([--disable-extension-integration],
982         [Disable integration of the built extensions in the installer of the
983          product. Use this switch to disable the integration.])
986 AC_ARG_ENABLE(avmedia,
987     AS_HELP_STRING([--disable-avmedia],
988         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
991 AC_ARG_ENABLE(database-connectivity,
992     AS_HELP_STRING([--disable-database-connectivity],
993         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
996 # This doesn't mean not building (or "integrating") extensions
997 # (although it probably should; i.e. it should imply
998 # --disable-extension-integration I guess), it means not supporting
999 # any extension mechanism at all
1000 libo_FUZZ_ARG_ENABLE(extensions,
1001     AS_HELP_STRING([--disable-extensions],
1002         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1005 AC_ARG_ENABLE(scripting,
1006     AS_HELP_STRING([--disable-scripting],
1007         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1010 # This is mainly for Android and iOS, but could potentially be used in some
1011 # special case otherwise, too, so factored out as a separate setting
1013 AC_ARG_ENABLE(dynamic-loading,
1014     AS_HELP_STRING([--disable-dynamic-loading],
1015         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1018 libo_FUZZ_ARG_ENABLE(report-builder,
1019     AS_HELP_STRING([--disable-report-builder],
1020         [Disable the Report Builder.])
1023 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1024     AS_HELP_STRING([--enable-ext-wiki-publisher],
1025         [Enable the Wiki Publisher extension.])
1028 libo_FUZZ_ARG_ENABLE(lpsolve,
1029     AS_HELP_STRING([--disable-lpsolve],
1030         [Disable compilation of the lp solve solver ])
1032 libo_FUZZ_ARG_ENABLE(coinmp,
1033     AS_HELP_STRING([--disable-coinmp],
1034         [Disable compilation of the CoinMP solver ])
1037 libo_FUZZ_ARG_ENABLE(pdfimport,
1038     AS_HELP_STRING([--disable-pdfimport],
1039         [Disable building the PDF import feature.])
1042 libo_FUZZ_ARG_ENABLE(pdfium,
1043     AS_HELP_STRING([--disable-pdfium],
1044         [Disable building PDFium.])
1047 ###############################################################################
1049 dnl ---------- *** ----------
1051 libo_FUZZ_ARG_ENABLE(mergelibs,
1052     AS_HELP_STRING([--enable-mergelibs],
1053         [Merge several of the smaller libraries into one big, "merged", one.])
1056 libo_FUZZ_ARG_ENABLE(breakpad,
1057     AS_HELP_STRING([--enable-breakpad],
1058         [Enables breakpad for crash reporting.])
1061 AC_ARG_ENABLE(fetch-external,
1062     AS_HELP_STRING([--disable-fetch-external],
1063         [Disables fetching external tarballs from web sources.])
1066 AC_ARG_ENABLE(fuzzers,
1067     AS_HELP_STRING([--enable-fuzzers],
1068         [Enables building libfuzzer targets for fuzz testing.])
1071 libo_FUZZ_ARG_ENABLE(pch,
1072     AS_HELP_STRING([--enable-pch],
1073         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1076 libo_FUZZ_ARG_ENABLE(epm,
1077     AS_HELP_STRING([--enable-epm],
1078         [LibreOffice includes self-packaging code, that requires epm, however epm is
1079          useless for large scale package building.])
1082 libo_FUZZ_ARG_ENABLE(odk,
1083     AS_HELP_STRING([--disable-odk],
1084         [LibreOffice includes an ODK, office development kit which some packagers may
1085          wish to build without.])
1088 AC_ARG_ENABLE(mpl-subset,
1089     AS_HELP_STRING([--enable-mpl-subset],
1090         [Don't compile any pieces which are not MPL or more liberally licensed])
1093 libo_FUZZ_ARG_ENABLE(evolution2,
1094     AS_HELP_STRING([--enable-evolution2],
1095         [Allows the built-in evolution 2 addressbook connectivity build to be
1096          enabled.])
1099 AC_ARG_ENABLE(avahi,
1100     AS_HELP_STRING([--enable-avahi],
1101         [Determines whether to use Avahi to advertise Impress to remote controls.])
1104 libo_FUZZ_ARG_ENABLE(werror,
1105     AS_HELP_STRING([--enable-werror],
1106         [Turn warnings to errors. (Has no effect in modules where the treating
1107          of warnings as errors is disabled explicitly.)]),
1110 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1111     AS_HELP_STRING([--enable-assert-always-abort],
1112         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1115 libo_FUZZ_ARG_ENABLE(dbgutil,
1116     AS_HELP_STRING([--enable-dbgutil],
1117         [Provide debugging support from --enable-debug and include additional debugging
1118          utilities such as object counting or more expensive checks.
1119          This is the recommended option for developers.
1120          Note that this makes the build ABI incompatible, it is not possible to mix object
1121          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1123 libo_FUZZ_ARG_ENABLE(debug,
1124     AS_HELP_STRING([--enable-debug],
1125         [Include debugging information, disable compiler optimization and inlining plus
1126          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1128 libo_FUZZ_ARG_ENABLE(split-debug,
1129     AS_HELP_STRING([--enable-split-debug],
1130         [Uses split debug information (-gsplit-dwarf compile flag). Saves disk space and build time,
1131          but requires tools that support it (both build tools and debuggers).]))
1133 libo_FUZZ_ARG_ENABLE(gdb-index,
1134     AS_HELP_STRING([--enable-gdb-index],
1135         [Creates debug information in the gdb index format, which makes gdb start faster.
1136          Requires the gold or lld linker.]))
1138 libo_FUZZ_ARG_ENABLE(sal-log,
1139     AS_HELP_STRING([--enable-sal-log],
1140         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1142 AC_ARG_ENABLE(selective-debuginfo,
1143     AS_HELP_STRING([--enable-selective-debuginfo],
1144         [If --enable-debug or --enable-dbgutil is used, build debugging information
1145          (-g compiler flag) only for the specified gbuild build targets
1146          (where all means everything, - prepended means not to enable, / appended means
1147          everything in the directory; there is no ordering, more specific overrides
1148          more general, and disabling takes precedence).
1149          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1151 libo_FUZZ_ARG_ENABLE(symbols,
1152     AS_HELP_STRING([--enable-symbols],
1153         [Generate debug information.
1154          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1155          otherwise.]))
1157 libo_FUZZ_ARG_ENABLE(optimized,
1158     AS_HELP_STRING([--disable-optimized],
1159         [Whether to compile with optimization flags.
1160          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1161          otherwise.]))
1163 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1164     AS_HELP_STRING([--disable-runtime-optimizations],
1165         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1166          JVM JIT) that are known to interact badly with certain dynamic analysis
1167          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1168          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1169          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1171 AC_ARG_WITH(valgrind,
1172     AS_HELP_STRING([--with-valgrind],
1173         [Make availability of Valgrind headers a hard requirement.]))
1175 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1176     AS_HELP_STRING([--enable-compiler-plugins],
1177         [Enable compiler plugins that will perform additional checks during
1178          building. Enabled automatically by --enable-dbgutil.
1179          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1180 COMPILER_PLUGINS_DEBUG=
1181 if test "$enable_compiler_plugins" = debug; then
1182     enable_compiler_plugins=yes
1183     COMPILER_PLUGINS_DEBUG=TRUE
1186 libo_FUZZ_ARG_ENABLE(ooenv,
1187     AS_HELP_STRING([--disable-ooenv],
1188         [Disable ooenv for the instdir installation.]))
1190 libo_FUZZ_ARG_ENABLE(libnumbertext,
1191     AS_HELP_STRING([--disable-libnumbertext],
1192         [Disable use of numbertext external library.]))
1194 AC_ARG_ENABLE(lto,
1195     AS_HELP_STRING([--enable-lto],
1196         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1197          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1198          linker. For MSVC, this option is broken at the moment. This is experimental work
1199          in progress that shouldn't be used unless you are working on it.)]))
1201 AC_ARG_ENABLE(python,
1202     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1203         [Enables or disables Python support at run-time.
1204          Also specifies what Python to use. 'auto' is the default.
1205          'fully-internal' even forces the internal version for uses of Python
1206          during the build.]))
1208 libo_FUZZ_ARG_ENABLE(gtk,
1209     AS_HELP_STRING([--disable-gtk],
1210         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1211 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1213 libo_FUZZ_ARG_ENABLE(gtk3,
1214     AS_HELP_STRING([--disable-gtk3],
1215         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1216 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1218 AC_ARG_ENABLE(split-app-modules,
1219     AS_HELP_STRING([--enable-split-app-modules],
1220         [Split file lists for app modules, e.g. base, calc.
1221          Has effect only with make distro-pack-install]),
1224 AC_ARG_ENABLE(split-opt-features,
1225     AS_HELP_STRING([--enable-split-opt-features],
1226         [Split file lists for some optional features, e.g. pyuno, testtool.
1227          Has effect only with make distro-pack-install]),
1230 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1231     AS_HELP_STRING([--disable-cairo-canvas],
1232         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1235 libo_FUZZ_ARG_ENABLE(dbus,
1236     AS_HELP_STRING([--disable-dbus],
1237         [Determines whether to enable features that depend on dbus.
1238          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1239 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1241 libo_FUZZ_ARG_ENABLE(sdremote,
1242     AS_HELP_STRING([--disable-sdremote],
1243         [Determines whether to enable Impress remote control (i.e. the server component).]),
1244 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1246 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1247     AS_HELP_STRING([--disable-sdremote-bluetooth],
1248         [Determines whether to build sdremote with bluetooth support.
1249          Requires dbus on Linux.]))
1251 libo_FUZZ_ARG_ENABLE(gio,
1252     AS_HELP_STRING([--disable-gio],
1253         [Determines whether to use the GIO support.]),
1254 ,test "${enable_gio+set}" = set || enable_gio=yes)
1256 AC_ARG_ENABLE(kde4,
1257     AS_HELP_STRING([--enable-kde4],
1258         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1259          KDE4 are available.]),
1262 AC_ARG_ENABLE(qt5,
1263     AS_HELP_STRING([--enable-qt5],
1264         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1265          available.]),
1268 AC_ARG_ENABLE(kde5,
1269     AS_HELP_STRING([--enable-kde5],
1270         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1271          KF5 are available.]),
1274 AC_ARG_ENABLE(gtk3_kde5,
1275     AS_HELP_STRING([--enable-gtk3-kde5],
1276         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1277          platforms where Gtk3, Qt5 and Plasma is available.]),
1280 libo_FUZZ_ARG_ENABLE(gui,
1281     AS_HELP_STRING([--disable-gui],
1282         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1283          command-line option. Not related to LibreOffice Online functionality. Don't use
1284          unless you are certain you need to. Nobody will help you if you insist on trying
1285          this and run into problems.]),
1286 ,test "${enable_gui+set}" = set || enable_gui=yes)
1288 libo_FUZZ_ARG_ENABLE(randr,
1289     AS_HELP_STRING([--disable-randr],
1290         [Disable RandR support in the vcl project.]),
1291 ,test "${enable_randr+set}" = set || enable_randr=yes)
1293 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1294     AS_HELP_STRING([--disable-gstreamer-1-0],
1295         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1296 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1298 AC_ARG_ENABLE(gstreamer-0-10,
1299     AS_HELP_STRING([--enable-gstreamer-0-10],
1300         [Enable building with the gstreamer 0.10 avmedia backend.]),
1301 ,enable_gstreamer_0_10=no)
1303 libo_FUZZ_ARG_ENABLE(vlc,
1304     AS_HELP_STRING([--enable-vlc],
1305         [Enable building with the (experimental) VLC avmedia backend.]),
1306 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1308 libo_FUZZ_ARG_ENABLE(neon,
1309     AS_HELP_STRING([--disable-neon],
1310         [Disable neon and the compilation of webdav binding.]),
1313 libo_FUZZ_ARG_ENABLE([eot],
1314     [AS_HELP_STRING([--enable-eot],
1315         [Enable support for Embedded OpenType fonts.])],
1316 ,test "${enable_eot+set}" = set || enable_eot=no)
1318 libo_FUZZ_ARG_ENABLE(cve-tests,
1319     AS_HELP_STRING([--disable-cve-tests],
1320         [Prevent CVE tests to be executed]),
1323 libo_FUZZ_ARG_ENABLE(chart-tests,
1324     AS_HELP_STRING([--enable-chart-tests],
1325         [Executes chart XShape tests. In a perfect world these tests would be
1326          stable and everyone could run them, in reality it is best to run them
1327          only on a few machines that are known to work and maintained by people
1328          who can judge if a test failure is a regression or not.]),
1331 AC_ARG_ENABLE(build-unowinreg,
1332     AS_HELP_STRING([--enable-build-unowinreg],
1333         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1334          compiler is needed on Linux.]),
1337 AC_ARG_ENABLE(build-opensymbol,
1338     AS_HELP_STRING([--enable-build-opensymbol],
1339         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1340          fontforge installed.]),
1343 AC_ARG_ENABLE(dependency-tracking,
1344     AS_HELP_STRING([--enable-dependency-tracking],
1345         [Do not reject slow dependency extractors.])[
1346   --disable-dependency-tracking
1347                           Disables generation of dependency information.
1348                           Speed up one-time builds.],
1351 AC_ARG_ENABLE(icecream,
1352     AS_HELP_STRING([--enable-icecream],
1353         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1354          It defaults to /opt/icecream for the location of the icecream gcc/g++
1355          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1358 AC_ARG_ENABLE(ld,
1359     AS_HELP_STRING([--enable-ld=<linker>],
1360         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.]),
1363 libo_FUZZ_ARG_ENABLE(cups,
1364     AS_HELP_STRING([--disable-cups],
1365         [Do not build cups support.])
1368 AC_ARG_ENABLE(ccache,
1369     AS_HELP_STRING([--disable-ccache],
1370         [Do not try to use ccache automatically.
1371          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1372          CC/CXX are not yet set, and --enable-icecream is not given, we
1373          attempt to use ccache. --disable-ccache disables ccache completely.
1377 AC_ARG_ENABLE(64-bit,
1378     AS_HELP_STRING([--enable-64-bit],
1379         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1380          At the moment meaningful only for Windows.]), ,)
1382 libo_FUZZ_ARG_ENABLE(online-update,
1383     AS_HELP_STRING([--enable-online-update],
1384         [Enable the online update service that will check for new versions of
1385          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1386          If the value is "mar", the experimental Mozilla-like update will be
1387          enabled instead of the traditional update mechanism.]),
1390 AC_ARG_WITH(update-config,
1391     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1392                    [Path to the update config ini file]))
1394 libo_FUZZ_ARG_ENABLE(extension-update,
1395     AS_HELP_STRING([--disable-extension-update],
1396         [Disable possibility to update installed extensions.]),
1399 libo_FUZZ_ARG_ENABLE(release-build,
1400     AS_HELP_STRING([--enable-release-build],
1401         [Enable release build. Note that the "release build" choice is orthogonal to
1402          whether symbols are present, debug info is generated, or optimization
1403          is done.
1404          See http://wiki.documentfoundation.org/Development/DevBuild]),
1407 AC_ARG_ENABLE(windows-build-signing,
1408     AS_HELP_STRING([--enable-windows-build-signing],
1409         [Enable signing of windows binaries (*.exe, *.dll)]),
1412 AC_ARG_ENABLE(silent-msi,
1413     AS_HELP_STRING([--enable-silent-msi],
1414         [Enable MSI with LIMITUI=1 (silent install).]),
1417 AC_ARG_ENABLE(macosx-code-signing,
1418     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1419         [Sign executables, dylibs, frameworks and the app bundle. If you
1420          don't provide an identity the first suitable certificate
1421          in your keychain is used.]),
1424 AC_ARG_ENABLE(macosx-package-signing,
1425     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1426         [Create a .pkg suitable for uploading to the Mac App Store and sign
1427          it. If you don't provide an identity the first suitable certificate
1428          in your keychain is used.]),
1431 AC_ARG_ENABLE(macosx-sandbox,
1432     AS_HELP_STRING([--enable-macosx-sandbox],
1433         [Make the app bundle run in a sandbox. Requires code signing.
1434          Is required by apps distributed in the Mac App Store, and implies
1435          adherence to App Store rules.]),
1438 AC_ARG_WITH(macosx-bundle-identifier,
1439     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1440         [Define the OS X bundle identifier. Default is the somewhat weird
1441          org.libreoffice.script ("script", huh?).]),
1442 ,with_macosx_bundle_identifier=org.libreoffice.script)
1444 AC_ARG_WITH(product-name,
1445     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1446         [Define the product name. Default is AC_PACKAGE_NAME.]),
1447 ,with_product_name=$PRODUCTNAME)
1449 AC_ARG_WITH(package-version,
1450     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1451         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1454 libo_FUZZ_ARG_ENABLE(readonly-installset,
1455     AS_HELP_STRING([--enable-readonly-installset],
1456         [Prevents any attempts by LibreOffice to write into its installation. That means
1457          at least that no "system-wide" extensions can be added. Partly experimental work in
1458          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1461 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1462     AS_HELP_STRING([--disable-postgresql-sdbc],
1463         [Disable the build of the PostgreSQL-SDBC driver.])
1466 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1467     AS_HELP_STRING([--disable-lotuswordpro],
1468         [Disable the build of the Lotus Word Pro filter.]),
1469 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1471 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1472     AS_HELP_STRING([--disable-firebird-sdbc],
1473         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1474 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1476 AC_ARG_ENABLE(bogus-pkg-config,
1477     AS_HELP_STRING([--enable-bogus-pkg-config],
1478         [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.]),
1481 AC_ARG_ENABLE(openssl,
1482     AS_HELP_STRING([--disable-openssl],
1483         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1484          components will either use GNUTLS or NSS. Work in progress,
1485          use only if you are hacking on it.]),
1486 ,enable_openssl=yes)
1488 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1489     AS_HELP_STRING([--enable-cipher-openssl-backend],
1490         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1491          Requires --enable-openssl.]))
1493 AC_ARG_ENABLE(library-bin-tar,
1494     AS_HELP_STRING([--enable-library-bin-tar],
1495         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1496         Some libraries can save their build result in a tarball
1497         stored in TARFILE_LOCATION. That binary tarball is
1498         uniquely identified by the source tarball,
1499         the content of the config_host.mk file and the content
1500         of the top-level directory in core for that library
1501         If this option is enabled, then if such a tarfile exist, it will be untarred
1502         instead of the source tarfile, and the build step will be skipped for that
1503         library.
1504         If a proper tarfile does not exist, then the normal source-based
1505         build is done for that library and a proper binary tarfile is created
1506         for the next time.]),
1509 AC_ARG_ENABLE(dconf,
1510     AS_HELP_STRING([--disable-dconf],
1511         [Disable the dconf configuration backend (enabled by default where
1512          available).]))
1514 libo_FUZZ_ARG_ENABLE(formula-logger,
1515     AS_HELP_STRING(
1516         [--enable-formula-logger],
1517         [Enable formula logger for logging formula calculation flow in Calc.]
1518     )
1521 dnl ===================================================================
1522 dnl Optional Packages (--with/without-)
1523 dnl ===================================================================
1525 AC_ARG_WITH(gcc-home,
1526     AS_HELP_STRING([--with-gcc-home],
1527         [Specify the location of gcc/g++ manually. This can be used in conjunction
1528          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1529          non-default path.]),
1532 AC_ARG_WITH(gnu-patch,
1533     AS_HELP_STRING([--with-gnu-patch],
1534         [Specify location of GNU patch on Solaris or FreeBSD.]),
1537 AC_ARG_WITH(build-platform-configure-options,
1538     AS_HELP_STRING([--with-build-platform-configure-options],
1539         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1542 AC_ARG_WITH(gnu-cp,
1543     AS_HELP_STRING([--with-gnu-cp],
1544         [Specify location of GNU cp on Solaris or FreeBSD.]),
1547 AC_ARG_WITH(external-tar,
1548     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1549         [Specify an absolute path of where to find (and store) tarfiles.]),
1550     TARFILE_LOCATION=$withval ,
1553 AC_ARG_WITH(referenced-git,
1554     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1555         [Specify another checkout directory to reference. This makes use of
1556                  git submodule update --reference, and saves a lot of diskspace
1557                  when having multiple trees side-by-side.]),
1558     GIT_REFERENCE_SRC=$withval ,
1561 AC_ARG_WITH(linked-git,
1562     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1563         [Specify a directory where the repositories of submodules are located.
1564          This uses a method similar to git-new-workdir to get submodules.]),
1565     GIT_LINK_SRC=$withval ,
1568 AC_ARG_WITH(galleries,
1569     AS_HELP_STRING([--with-galleries],
1570         [Specify how galleries should be built. It is possible either to
1571          build these internally from source ("build"),
1572          or to disable them ("no")]),
1575 AC_ARG_WITH(theme,
1576     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1577         [Choose which themes to include. By default those themes with an '*' are included.
1578          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1579          *elementary_svg, *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="0,0,0" 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 specifically 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 minimum 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.1
2952     older_sdk_vers="12.0 11.4"
2953     if test "$enable_ios_simulator" = "yes"; then
2954         platform=iPhoneSimulator
2955         versionmin=-mios-simulator-version-min=11.0
2956     else
2957         platform=iPhoneOS
2958         versionmin=-miphoneos-version-min=11.0
2959     fi
2960     xcode_developer=`xcode-select -print-path`
2962     for sdkver in $current_sdk_ver $older_sdk_vers; do
2963         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2964         if test -d $t; then
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     # LTO is not really recommended for iOS builds,
2977     # the link time will be astronomical
2978     if test "$ENABLE_LTO" = TRUE; then
2979         lto=-flto
2980     fi
2982     stdlib="-stdlib=libc++"
2984     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2985     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2987     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2988     AR=`xcrun -find ar`
2989     NM=`xcrun -find nm`
2990     STRIP=`xcrun -find strip`
2991     LIBTOOL=`xcrun -find libtool`
2992     RANLIB=`xcrun -find ranlib`
2995 AC_MSG_CHECKING([whether to treat the installation as read-only])
2997 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2998         "$enable_extensions" != yes; then
2999     enable_readonly_installset=yes
3001 if test "$enable_readonly_installset" = yes; then
3002     AC_MSG_RESULT([yes])
3003     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3004 else
3005     AC_MSG_RESULT([no])
3008 dnl ===================================================================
3009 dnl Structure of install set
3010 dnl ===================================================================
3012 if test $_os = Darwin; then
3013     LIBO_BIN_FOLDER=MacOS
3014     LIBO_ETC_FOLDER=Resources
3015     LIBO_LIBEXEC_FOLDER=MacOS
3016     LIBO_LIB_FOLDER=Frameworks
3017     LIBO_LIB_PYUNO_FOLDER=Resources
3018     LIBO_SHARE_FOLDER=Resources
3019     LIBO_SHARE_HELP_FOLDER=Resources/help
3020     LIBO_SHARE_JAVA_FOLDER=Resources/java
3021     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3022     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3023     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3024     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3025     LIBO_URE_BIN_FOLDER=MacOS
3026     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3027     LIBO_URE_LIB_FOLDER=Frameworks
3028     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3029     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3030 elif test $_os = WINNT; then
3031     LIBO_BIN_FOLDER=program
3032     LIBO_ETC_FOLDER=program
3033     LIBO_LIBEXEC_FOLDER=program
3034     LIBO_LIB_FOLDER=program
3035     LIBO_LIB_PYUNO_FOLDER=program
3036     LIBO_SHARE_FOLDER=share
3037     LIBO_SHARE_HELP_FOLDER=help
3038     LIBO_SHARE_JAVA_FOLDER=program/classes
3039     LIBO_SHARE_PRESETS_FOLDER=presets
3040     LIBO_SHARE_READMES_FOLDER=readmes
3041     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3042     LIBO_SHARE_SHELL_FOLDER=program/shell
3043     LIBO_URE_BIN_FOLDER=program
3044     LIBO_URE_ETC_FOLDER=program
3045     LIBO_URE_LIB_FOLDER=program
3046     LIBO_URE_MISC_FOLDER=program
3047     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3048 else
3049     LIBO_BIN_FOLDER=program
3050     LIBO_ETC_FOLDER=program
3051     LIBO_LIBEXEC_FOLDER=program
3052     LIBO_LIB_FOLDER=program
3053     LIBO_LIB_PYUNO_FOLDER=program
3054     LIBO_SHARE_FOLDER=share
3055     LIBO_SHARE_HELP_FOLDER=help
3056     LIBO_SHARE_JAVA_FOLDER=program/classes
3057     LIBO_SHARE_PRESETS_FOLDER=presets
3058     LIBO_SHARE_READMES_FOLDER=readmes
3059     if test "$enable_fuzzers" != yes; then
3060         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3061     else
3062         LIBO_SHARE_RESOURCE_FOLDER=resource
3063     fi
3064     LIBO_SHARE_SHELL_FOLDER=program/shell
3065     LIBO_URE_BIN_FOLDER=program
3066     LIBO_URE_ETC_FOLDER=program
3067     LIBO_URE_LIB_FOLDER=program
3068     LIBO_URE_MISC_FOLDER=program
3069     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3071 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3072 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3073 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3074 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3075 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3076 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3077 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3078 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3079 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3080 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3081 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3088 # Not all of them needed in config_host.mk, add more if need arises
3089 AC_SUBST(LIBO_BIN_FOLDER)
3090 AC_SUBST(LIBO_ETC_FOLDER)
3091 AC_SUBST(LIBO_LIB_FOLDER)
3092 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3093 AC_SUBST(LIBO_SHARE_FOLDER)
3094 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3095 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3096 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3097 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3098 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3099 AC_SUBST(LIBO_URE_BIN_FOLDER)
3100 AC_SUBST(LIBO_URE_ETC_FOLDER)
3101 AC_SUBST(LIBO_URE_LIB_FOLDER)
3102 AC_SUBST(LIBO_URE_MISC_FOLDER)
3103 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3105 dnl ===================================================================
3106 dnl Windows specific tests and stuff
3107 dnl ===================================================================
3109 reg_get_value()
3111     # Return value: $regvalue
3112     unset regvalue
3114     local _regentry="/proc/registry${1}/${2}"
3115     if test -f "$_regentry"; then
3116         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3117         # Registry keys read via /proc/registry* are always \0 terminated!
3118         local _regvalue=$(tr -d '\0' < "$_regentry")
3119         if test $? -eq 0; then
3120             regvalue=$_regvalue
3121         fi
3122     fi
3125 # Get a value from the 32-bit side of the Registry
3126 reg_get_value_32()
3128     reg_get_value "32" "$1"
3131 # Get a value from the 64-bit side of the Registry
3132 reg_get_value_64()
3134     reg_get_value "64" "$1"
3137 if test "$_os" = "WINNT"; then
3138     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3139     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3140         AC_MSG_RESULT([no])
3141         WINDOWS_SDK_ARCH="x86"
3142     else
3143         AC_MSG_RESULT([yes])
3144         WINDOWS_SDK_ARCH="x64"
3145         BITNESS_OVERRIDE=64
3146     fi
3148 if test "$_os" = "iOS"; then
3149     cross_compiling="yes"
3152 if test "$cross_compiling" = "yes"; then
3153     export CROSS_COMPILING=TRUE
3154 else
3155     CROSS_COMPILING=
3156     BUILD_TYPE="$BUILD_TYPE NATIVE"
3158 AC_SUBST(CROSS_COMPILING)
3160 USE_LD=
3161 if test -n "$enable_ld" -a "$enable_ld" != "no"; then
3162     AC_MSG_CHECKING([for -fuse-ld=$enable_ld linker support])
3163     if test "$GCC" = "yes"; then
3164         ldflags_save=$LDFLAGS
3165         LDFLAGS="$LDFLAGS -fuse-ld=$enable_ld"
3166         AC_LINK_IFELSE([AC_LANG_PROGRAM([
3167 #include <stdio.h>
3168             ],[
3169 printf ("hello world\n");
3170             ])], USE_LD=$enable_ld, [])
3171         if test -n "$USE_LD"; then
3172             AC_MSG_RESULT( yes )
3173             LDFLAGS="$ldflags_save -fuse-ld=$enable_ld"
3174         else
3175             AC_MSG_ERROR( no )
3176         fi
3177     else
3178         AC_MSG_ERROR( not supported )
3179     fi
3181 AC_SUBST(USE_LD)
3183 ENABLE_GDB_INDEX=
3184 if test "$enable_gdb_index" = "yes"; then
3185     AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
3186     save_CFLAGS=$CFLAGS
3187     CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
3188     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ AC_MSG_RESULT( yes )],[ AC_MSG_ERROR( no )])
3190     AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
3191     ldflags_save=$LDFLAGS
3192     LDFLAGS="$LDFLAGS -Wl,--gdb-index"
3193     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3194 #include <stdio.h>
3195         ],[
3196 printf ("hello world\n");
3197         ])], ENABLE_GDB_INDEX=TRUE, [])
3198     if test "$ENABLE_GDB_INDEX" = "TRUE"; then
3199         AC_MSG_RESULT( yes )
3200     else
3201         AC_MSG_ERROR( no )
3202     fi
3203     CFLAGS=$save_CFLAGS
3204     LDFLAGS=$ldflags_save
3206 AC_SUBST(ENABLE_GDB_INDEX)
3208 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3209 if test "$GCC" = "yes"; then
3210     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3211     bsymbolic_functions_ldflags_save=$LDFLAGS
3212     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
3213     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3214 #include <stdio.h>
3215         ],[
3216 printf ("hello world\n");
3217         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3218     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3219         AC_MSG_RESULT( found )
3220     else
3221         AC_MSG_RESULT( not found )
3222     fi
3223     LDFLAGS=$bsymbolic_functions_ldflags_save
3225 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3227 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3228 # NOTE: must _not_ be used for bundled external libraries!
3229 ISYSTEM=
3230 if test "$GCC" = "yes"; then
3231     AC_MSG_CHECKING( for -isystem )
3232     save_CFLAGS=$CFLAGS
3233     CFLAGS="$CFLAGS -Werror"
3234     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3235     CFLAGS=$save_CFLAGS
3236     if test -n "$ISYSTEM"; then
3237         AC_MSG_RESULT(yes)
3238     else
3239         AC_MSG_RESULT(no)
3240     fi
3242 if test -z "$ISYSTEM"; then
3243     # fall back to using -I
3244     ISYSTEM=-I
3246 AC_SUBST(ISYSTEM)
3248 dnl ===================================================================
3249 dnl  Check which Visual Studio compiler is used
3250 dnl ===================================================================
3252 map_vs_year_to_version()
3254     # Return value: $vsversion
3256     unset vsversion
3258     case $1 in
3259     2017)
3260         vsversion=15.0;;
3261     *)
3262         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3263     esac
3266 vs_versions_to_check()
3268     # Args: $1 (optional) : versions to check, in the order of preference
3269     # Return value: $vsversions
3271     unset vsversions
3273     if test -n "$1"; then
3274         map_vs_year_to_version "$1"
3275         vsversions=$vsversion
3276     else
3277         # We accept only 2017
3278         vsversions="15.0"
3279     fi
3282 win_get_env_from_vsvars32bat()
3284     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3285     # Also seems to be located in another directory under the same name: vsvars32.bat
3286     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3287     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3288     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3289     chmod +x $WRAPPERBATCHFILEPATH
3290     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3291     rm -f $WRAPPERBATCHFILEPATH
3292     printf '%s' "$_win_get_env_from_vsvars32bat"
3295 find_ucrt()
3297     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3298     if test -n "$regvalue"; then
3299         PathFormat "$regvalue"
3300         UCRTSDKDIR=$formatted_path
3301         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3302         UCRTVERSION=$regvalue
3303         # Rest if not exist
3304         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3305           UCRTSDKDIR=
3306         fi
3307     fi
3308     if test -z "$UCRTSDKDIR"; then
3309         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3310         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3311         if test -f "$ide_env_file"; then
3312             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3313             UCRTSDKDIR=$formatted_path
3314             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3315             dnl Hack needed at least by tml:
3316             if test "$UCRTVERSION" = 10.0.15063.0 \
3317                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3318                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3319             then
3320                 UCRTVERSION=10.0.14393.0
3321             fi
3322         else
3323           AC_MSG_ERROR([No UCRT found])
3324         fi
3325     fi
3328 find_msvc()
3330     # Find Visual C++ 2017
3331     # Args: $1 (optional) : The VS version year
3332     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3334     unset vctest vcnum vcnumwithdot vcbuildnumber
3336     vs_versions_to_check "$1"
3338     for ver in $vsversions; do
3339         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3340         if test -n "$regvalue"; then
3341             vctest=$regvalue
3342             break
3343         fi
3344         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3345         if test -n "$regvalue"; then
3346             AC_MSG_RESULT([found: $regvalue])
3347             PathFormat "$regvalue"
3348             vctest=$formatted_path
3349             break
3350         fi
3351     done
3352     if test -n "$vctest"; then
3353         vcnumwithdot=$ver
3354         case "$vcnumwithdot" in
3355         15.0)
3356             vcyear=2017
3357             vcnum=150
3358             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3359             ;;
3360         esac
3361     fi
3364 SOLARINC=
3365 MSBUILD_PATH=
3366 DEVENV=
3367 if test "$_os" = "WINNT"; then
3368     AC_MSG_CHECKING([Visual C++])
3370     find_msvc "$with_visual_studio"
3371     if test -z "$vctest"; then
3372         if test -n "$with_visual_studio"; then
3373             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3374         else
3375             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3376         fi
3377     fi
3379     if test "$BITNESS_OVERRIDE" = ""; then
3380         if test -f "$vctest/bin/cl.exe"; then
3381             VC_PRODUCT_DIR=$vctest
3382         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3383             VC_PRODUCT_DIR=$vctest/VC
3384         else
3385             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3386         fi
3387     else
3388         if test -f "$vctest/bin/amd64/cl.exe"; then
3389             VC_PRODUCT_DIR=$vctest
3390         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3391             VC_PRODUCT_DIR=$vctest/VC
3392         else
3393             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])
3394         fi
3395     fi
3397     AC_MSG_CHECKING([for short pathname of VC product directory])
3398     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3399     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3401     UCRTSDKDIR=
3402     UCRTVERSION=
3404     AC_MSG_CHECKING([for UCRT location])
3405     find_ucrt
3406     # find_ucrt errors out if it doesn't find it
3407     AC_MSG_RESULT([found])
3408     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3409     ucrtincpath_formatted=$formatted_path
3410     # SOLARINC is used for external modules and must be set too.
3411     # And no, it's not sufficient to set SOLARINC only, as configure
3412     # itself doesn't honour it.
3413     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3414     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3415     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3416     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3418     AC_SUBST(UCRTSDKDIR)
3419     AC_SUBST(UCRTVERSION)
3421     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3422     # Find the proper version of MSBuild.exe to use based on the VS version
3423     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3424     if test -n "$regvalue" ; then
3425         AC_MSG_RESULT([found: $regvalue])
3426         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3427     else
3428         if test "$BITNESS_OVERRIDE" = ""; then
3429             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3430         else
3431             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3432         fi
3433         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3434         AC_MSG_RESULT([$regvalue])
3435     fi
3437     # Find the version of devenv.exe
3438     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3439     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3440     if test ! -e "$DEVENV"; then
3441         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3442     fi
3444     dnl ===========================================================
3445     dnl  Check for the corresponding mspdb*.dll
3446     dnl ===========================================================
3448     MSPDB_PATH=
3449     CL_DIR=
3450     CL_LIB=
3452     if test "$BITNESS_OVERRIDE" = ""; then
3453         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3454         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3455     else
3456         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3457         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3458     fi
3460     # MSVC 15.0 has libraries from 14.0?
3461     mspdbnum="140"
3463     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3464         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3465     fi
3467     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3468     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3470     dnl The path needs to be added before cl is called
3471     PATH="$MSPDB_PATH:$PATH"
3473     AC_MSG_CHECKING([cl.exe])
3475     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3476     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3477     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3478     # is not enough?
3480     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3481     dnl needed when building CLR code:
3482     if test -z "$MSVC_CXX"; then
3483         if test "$BITNESS_OVERRIDE" = ""; then
3484             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3485                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3486             fi
3487         else
3488             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3489                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3490             fi
3491         fi
3493         # This gives us a posix path with 8.3 filename restrictions
3494         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3495     fi
3497     if test -z "$CC"; then
3498         CC=$MSVC_CXX
3499     fi
3500     if test "$BITNESS_OVERRIDE" = ""; then
3501         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3502         MSVC_CXX="$MSVC_CXX -arch:SSE"
3503     fi
3505     if test -n "$CC"; then
3506         # Remove /cl.exe from CC case insensitive
3507         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3508         if test "$BITNESS_OVERRIDE" = ""; then
3509            COMPATH="$VC_PRODUCT_DIR"
3510         else
3511             if test -n "$VC_PRODUCT_DIR"; then
3512                 COMPATH=$VC_PRODUCT_DIR
3513             fi
3514         fi
3515         if test "$BITNESS_OVERRIDE" = ""; then
3516             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3517             CC="$CC -arch:SSE"
3518         fi
3520         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3522         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3524         PathFormat "$COMPATH"
3525         COMPATH="$formatted_path"
3527         VCVER=$vcnum
3528         MSVSVER=$vcyear
3530         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3531         # are always "better", we list them in reverse chronological order.
3533         case $vcnum in
3534         150)
3535             COMEX=19
3536             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3537             ;;
3538         esac
3540         # The expectation is that --with-windows-sdk should not need to be used
3541         if test -n "$with_windows_sdk"; then
3542             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3543             *" "$with_windows_sdk" "*)
3544                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3545                 ;;
3546             *)
3547                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3548                 ;;
3549             esac
3550         fi
3552         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3553         ac_objext=obj
3554         ac_exeext=exe
3556     else
3557         AC_MSG_ERROR([Visual C++ not found after all, huh])
3558     fi
3560     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3561     # version of the Explorer extension (and maybe other small
3562     # bits, too) needed when installing a 32-bit LibreOffice on a
3563     # 64-bit OS. The 64-bit Explorer extension is a feature that
3564     # has been present since long in OOo. Don't confuse it with
3565     # building LibreOffice itself as 64-bit code.
3567     BUILD_X64=
3568     CXX_X64_BINARY=
3569     LINK_X64_BINARY=
3571     if test "$BITNESS_OVERRIDE" = ""; then
3572         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3573         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3574             # Prefer native x64 compiler to cross-compiler, in case we are running
3575             # the build on a 64-bit OS.
3576             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3577                 BUILD_X64=TRUE
3578                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3579                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3580             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3581                 BUILD_X64=TRUE
3582                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3583                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3584             fi
3585         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3586             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3587             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3588                 BUILD_X64=TRUE
3589                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3590                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3591             fi
3592         fi
3593         if test "$BUILD_X64" = TRUE; then
3594             AC_MSG_RESULT([found])
3595         else
3596             AC_MSG_RESULT([not found])
3597             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3598         fi
3599     fi
3600     AC_SUBST(BUILD_X64)
3602     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3603     AC_SUBST(CXX_X64_BINARY)
3604     AC_SUBST(LINK_X64_BINARY)
3606 AC_SUBST(VCVER)
3607 AC_SUBST(DEVENV)
3608 PathFormat "$MSPDB_PATH"
3609 MSPDB_PATH="$formatted_path"
3610 AC_SUBST(MSVC_CXX)
3613 # unowinreg.dll
3615 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3616 AC_SUBST(UNOWINREG_DLL)
3618 COM_IS_CLANG=
3619 AC_MSG_CHECKING([whether the compiler is actually Clang])
3620 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3621     #ifndef __clang__
3622     you lose
3623     #endif
3624     int foo=42;
3625     ]])],
3626     [AC_MSG_RESULT([yes])
3627      COM_IS_CLANG=TRUE],
3628     [AC_MSG_RESULT([no])])
3630 CC_PLAIN=$CC
3631 if test "$COM_IS_CLANG" = TRUE; then
3632     AC_MSG_CHECKING([the Clang version])
3633     if test "$_os" = WINNT; then
3634         dnl In which case, assume clang-cl:
3635         my_args="/EP /TC"
3636         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3637         dnl clang-cl:
3638         CC_PLAIN=
3639         for i in $CC; do
3640             case $i in
3641             -FIIntrin.h)
3642                 ;;
3643             *)
3644                 CC_PLAIN="$CC_PLAIN $i"
3645                 ;;
3646             esac
3647         done
3648     else
3649         my_args="-E -P"
3650     fi
3651     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3652     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3653     CLANGVER=`echo $clang_version \
3654         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3655     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3656     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3657     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3659 AC_SUBST(COM_IS_CLANG)
3660 AC_SUBST(CLANGVER)
3662 SHOWINCLUDES_PREFIX=
3663 if test "$_os" = WINNT; then
3664     dnl We need to guess the prefix of the -showIncludes output, it can be
3665     dnl localized
3666     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3667     echo "#include <stdlib.h>" > conftest.c
3668     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3669         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3670     rm -f conftest.c conftest.obj
3671     if test -z "$SHOWINCLUDES_PREFIX"; then
3672         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3673     else
3674         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3675     fi
3677 AC_SUBST(SHOWINCLUDES_PREFIX)
3680 # prefix C with ccache if needed
3682 if test "$CCACHE" != ""; then
3683     AC_MSG_CHECKING([whether $CC is already ccached])
3685     AC_LANG_PUSH([C])
3686     save_CFLAGS=$CFLAGS
3687     CFLAGS="$CFLAGS --ccache-skip -O2"
3688     dnl an empty program will do, we're checking the compiler flags
3689     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3690                       [use_ccache=yes], [use_ccache=no])
3691     if test $use_ccache = yes; then
3692         AC_MSG_RESULT([yes])
3693     else
3694         CC="$CCACHE $CC"
3695         AC_MSG_RESULT([no])
3696     fi
3697     CFLAGS=$save_CFLAGS
3698     AC_LANG_POP([C])
3701 # ===================================================================
3702 # check various GCC options that Clang does not support now but maybe
3703 # will somewhen in the future, check them even for GCC, so that the
3704 # flags are set
3705 # ===================================================================
3707 HAVE_GCC_GGDB2=
3708 HAVE_GCC_FINLINE_LIMIT=
3709 HAVE_GCC_FNO_INLINE=
3710 if test "$GCC" = "yes"; then
3711     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3712     save_CFLAGS=$CFLAGS
3713     CFLAGS="$CFLAGS -Werror -ggdb2"
3714     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3715     CFLAGS=$save_CFLAGS
3716     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3717         AC_MSG_RESULT([yes])
3718     else
3719         AC_MSG_RESULT([no])
3720     fi
3722     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3723     save_CFLAGS=$CFLAGS
3724     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3725     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3726     CFLAGS=$save_CFLAGS
3727     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3728         AC_MSG_RESULT([yes])
3729     else
3730         AC_MSG_RESULT([no])
3731     fi
3733     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3734     save_CFLAGS=$CFLAGS
3735     CFLAGS="$CFLAGS -Werror -fno-inline"
3736     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3737     CFLAGS=$save_CFLAGS
3738     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3739         AC_MSG_RESULT([yes])
3740     else
3741         AC_MSG_RESULT([no])
3742     fi
3744     if test "$host_cpu" = "m68k"; then
3745         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3746         save_CFLAGS=$CFLAGS
3747         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3748         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3749         CFLAGS=$save_CFLAGS
3750         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3751             AC_MSG_RESULT([yes])
3752         else
3753             AC_MSG_ERROR([no])
3754         fi
3755     fi
3757 AC_SUBST(HAVE_GCC_GGDB2)
3758 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3759 AC_SUBST(HAVE_GCC_FNO_INLINE)
3761 dnl ===================================================================
3762 dnl  Test the gcc version
3763 dnl ===================================================================
3764 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3765     AC_MSG_CHECKING([the GCC version])
3766     _gcc_version=`$CC -dumpversion`
3767     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3768         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3769     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3771     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3773     if test "$gcc_full_version" -lt 40801; then
3774         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3775     fi
3776 else
3777     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3778     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3779     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3780     # (which reports itself as GCC 4.2.1).
3781     GCC_VERSION=
3783 AC_SUBST(GCC_VERSION)
3785 dnl Set the ENABLE_DBGUTIL variable
3786 dnl ===================================================================
3787 AC_MSG_CHECKING([whether to build with additional debug utilities])
3788 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3789     ENABLE_DBGUTIL="TRUE"
3790     # this is an extra var so it can have different default on different MSVC
3791     # versions (in case there are version specific problems with it)
3792     MSVC_USE_DEBUG_RUNTIME="TRUE"
3794     AC_MSG_RESULT([yes])
3795     # cppunit and graphite expose STL in public headers
3796     if test "$with_system_cppunit" = "yes"; then
3797         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3798     else
3799         with_system_cppunit=no
3800     fi
3801     if test "$with_system_graphite" = "yes"; then
3802         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3803     else
3804         with_system_graphite=no
3805     fi
3806     if test "$with_system_orcus" = "yes"; then
3807         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3808     else
3809         with_system_orcus=no
3810     fi
3811     if test "$with_system_libcmis" = "yes"; then
3812         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3813     else
3814         with_system_libcmis=no
3815     fi
3816     if test "$with_system_hunspell" = "yes"; then
3817         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3818     else
3819         with_system_hunspell=no
3820     fi
3821     if test "$with_system_gpgmepp" = "yes"; then
3822         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3823     else
3824         with_system_gpgmepp=no
3825     fi
3826     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3827     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3828     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3829     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3830     # of those two is using the system variant:
3831     if test "$with_system_libnumbertext" = "yes"; then
3832         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3833     else
3834         with_system_libnumbertext=no
3835     fi
3836     if test "$with_system_libwps" = "yes"; then
3837         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3838     else
3839         with_system_libwps=no
3840     fi
3841 else
3842     ENABLE_DBGUTIL=""
3843     MSVC_USE_DEBUG_RUNTIME=""
3844     AC_MSG_RESULT([no])
3846 AC_SUBST(ENABLE_DBGUTIL)
3847 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3849 dnl Set the ENABLE_DEBUG variable.
3850 dnl ===================================================================
3851 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3852     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3854 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3855     if test -z "$libo_fuzzed_enable_debug"; then
3856         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3857     else
3858         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3859         enable_debug=yes
3860     fi
3863 AC_MSG_CHECKING([whether to do a debug build])
3864 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3865     ENABLE_DEBUG="TRUE"
3866     if test -n "$ENABLE_DBGUTIL" ; then
3867         AC_MSG_RESULT([yes (dbgutil)])
3868     else
3869         AC_MSG_RESULT([yes])
3870     fi
3871 else
3872     ENABLE_DEBUG=""
3873     AC_MSG_RESULT([no])
3875 AC_SUBST(ENABLE_DEBUG)
3877 if test "$enable_split_debug" = yes; then
3878     HAVE_GSPLIT_DWARF=
3879     if test "$GCC" = "yes"; then
3880         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
3881         save_CFLAGS=$CFLAGS
3882         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
3883         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
3884         CFLAGS=$save_CFLAGS
3885         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
3886             AC_MSG_RESULT([yes])
3887         else
3888             AC_MSG_RESULT([no])
3889         fi
3890     fi
3891     AC_SUBST(HAVE_GCC_SPLIT_DWARF)
3894 if test "$enable_sal_log" = yes; then
3895     ENABLE_SAL_LOG=TRUE
3897 AC_SUBST(ENABLE_SAL_LOG)
3899 dnl Selective debuginfo
3900 ENABLE_DEBUGINFO_FOR=
3901 if test -n "$ENABLE_DEBUG"; then
3902     AC_MSG_CHECKING([whether to use selective debuginfo])
3903     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3904         if test "$enable_selective_debuginfo" = "yes"; then
3905             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3906         fi
3907         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3908         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3909     else
3910         ENABLE_DEBUGINFO_FOR=all
3911         AC_MSG_RESULT([no, for all])
3912     fi
3913 else
3914     if test -n "$enable_selective_debuginfo"; then
3915         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3916     fi
3918 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3920 dnl Check for enable symbols option
3921 dnl ===================================================================
3922 AC_MSG_CHECKING([whether to generate debug information])
3923 if test -z "$enable_symbols"; then
3924     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3925         enable_symbols=yes
3926     else
3927         enable_symbols=no
3928     fi
3930 if test "$enable_symbols" != no; then
3931     ENABLE_SYMBOLS=TRUE
3932     AC_MSG_RESULT([yes])
3933 else
3934     ENABLE_SYMBOLS=
3935     AC_MSG_RESULT([no])
3937 AC_SUBST(ENABLE_SYMBOLS)
3939 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3940     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3941     AC_MSG_CHECKING([whether enough memory is available for linking])
3942     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3943     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3944     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3945         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3946     else
3947         AC_MSG_RESULT([yes])
3948     fi
3951 AC_MSG_CHECKING([whether to compile with optimization flags])
3952 if test -z "$enable_optimized"; then
3953     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3954         enable_optimized=no
3955     else
3956         enable_optimized=yes
3957     fi
3959 if test "$enable_optimized" != no; then
3960     ENABLE_OPTIMIZED=TRUE
3961     AC_MSG_RESULT([yes])
3962 else
3963     ENABLE_OPTIMIZED=
3964     AC_MSG_RESULT([no])
3966 AC_SUBST(ENABLE_OPTIMIZED)
3969 # determine CPUNAME, OS, ...
3970 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3972 case "$host_os" in
3974 aix*)
3975     COM=GCC
3976     CPUNAME=POWERPC
3977     USING_X11=TRUE
3978     OS=AIX
3979     RTL_OS=AIX
3980     RTL_ARCH=PowerPC
3981     PLATFORMID=aix_powerpc
3982     P_SEP=:
3983     ;;
3985 cygwin*)
3986     COM=MSC
3987     USING_X11=
3988     OS=WNT
3989     RTL_OS=Windows
3990     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3991         P_SEP=";"
3992     else
3993         P_SEP=:
3994     fi
3995     case "$host_cpu" in
3996     i*86|x86_64)
3997         if test "$BITNESS_OVERRIDE" = 64; then
3998             CPUNAME=X86_64
3999             RTL_ARCH=X86_64
4000             PLATFORMID=windows_x86_64
4001             WINDOWS_X64=1
4002             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4003         else
4004             CPUNAME=INTEL
4005             RTL_ARCH=x86
4006             PLATFORMID=windows_x86
4007         fi
4008         ;;
4009     *)
4010         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4011         ;;
4012     esac
4013     SCPDEFS="$SCPDEFS -D_MSC_VER"
4014     ;;
4016 darwin*)
4017     COM=GCC
4018     USING_X11=
4019     OS=MACOSX
4020     RTL_OS=MacOSX
4021     P_SEP=:
4023     case "$host_cpu" in
4024     arm)
4025         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4026         ;;
4027     arm64)
4028         OS=iOS
4029         if test "$enable_ios_simulator" = "yes"; then
4030             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4031         else
4032             CPUNAME=ARM64
4033             RTL_ARCH=ARM_EABI
4034             PLATFORMID=ios_arm64
4035         fi
4036         ;;
4037     i*86)
4038         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4039         ;;
4040     x86_64)
4041         if test "$enable_ios_simulator" = "yes"; then
4042             OS=iOS
4043         fi
4044         CPUNAME=X86_64
4045         RTL_ARCH=X86_64
4046         PLATFORMID=macosx_x86_64
4047         ;;
4048     *)
4049         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4050         ;;
4051     esac
4052     ;;
4054 dragonfly*)
4055     COM=GCC
4056     USING_X11=TRUE
4057     OS=DRAGONFLY
4058     RTL_OS=DragonFly
4059     P_SEP=:
4061     case "$host_cpu" in
4062     i*86)
4063         CPUNAME=INTEL
4064         RTL_ARCH=x86
4065         PLATFORMID=dragonfly_x86
4066         ;;
4067     x86_64)
4068         CPUNAME=X86_64
4069         RTL_ARCH=X86_64
4070         PLATFORMID=dragonfly_x86_64
4071         ;;
4072     *)
4073         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4074         ;;
4075     esac
4076     ;;
4078 freebsd*)
4079     COM=GCC
4080     USING_X11=TRUE
4081     RTL_OS=FreeBSD
4082     OS=FREEBSD
4083     P_SEP=:
4085     case "$host_cpu" in
4086     i*86)
4087         CPUNAME=INTEL
4088         RTL_ARCH=x86
4089         PLATFORMID=freebsd_x86
4090         ;;
4091     x86_64|amd64)
4092         CPUNAME=X86_64
4093         RTL_ARCH=X86_64
4094         PLATFORMID=freebsd_x86_64
4095         ;;
4096     *)
4097         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4098         ;;
4099     esac
4100     ;;
4102 haiku*)
4103     COM=GCC
4104     USING_X11=
4105     GUIBASE=haiku
4106     RTL_OS=Haiku
4107     OS=HAIKU
4108     P_SEP=:
4110     case "$host_cpu" in
4111     i*86)
4112         CPUNAME=INTEL
4113         RTL_ARCH=x86
4114         PLATFORMID=haiku_x86
4115         ;;
4116     x86_64|amd64)
4117         CPUNAME=X86_64
4118         RTL_ARCH=X86_64
4119         PLATFORMID=haiku_x86_64
4120         ;;
4121     *)
4122         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4123         ;;
4124     esac
4125     ;;
4127 kfreebsd*)
4128     COM=GCC
4129     USING_X11=TRUE
4130     OS=LINUX
4131     RTL_OS=kFreeBSD
4132     P_SEP=:
4134     case "$host_cpu" in
4136     i*86)
4137         CPUNAME=INTEL
4138         RTL_ARCH=x86
4139         PLATFORMID=kfreebsd_x86
4140         ;;
4141     x86_64)
4142         CPUNAME=X86_64
4143         RTL_ARCH=X86_64
4144         PLATFORMID=kfreebsd_x86_64
4145         ;;
4146     *)
4147         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4148         ;;
4149     esac
4150     ;;
4152 linux-gnu*)
4153     COM=GCC
4154     USING_X11=TRUE
4155     OS=LINUX
4156     RTL_OS=Linux
4157     P_SEP=:
4159     case "$host_cpu" in
4161     aarch64)
4162         CPUNAME=AARCH64
4163         PLATFORMID=linux_aarch64
4164         RTL_ARCH=AARCH64
4165         ;;
4166     alpha)
4167         CPUNAME=AXP
4168         RTL_ARCH=ALPHA
4169         PLATFORMID=linux_alpha
4170         ;;
4171     arm*)
4172         CPUNAME=ARM
4173         EPM_FLAGS="-a arm"
4174         RTL_ARCH=ARM_EABI
4175         PLATFORMID=linux_arm_eabi
4176         case "$host_cpu" in
4177         arm*-linux)
4178             RTL_ARCH=ARM_OABI
4179             PLATFORMID=linux_arm_oabi
4180             ;;
4181         esac
4182         ;;
4183     hppa)
4184         CPUNAME=HPPA
4185         RTL_ARCH=HPPA
4186         EPM_FLAGS="-a hppa"
4187         PLATFORMID=linux_hppa
4188         ;;
4189     i*86)
4190         CPUNAME=INTEL
4191         RTL_ARCH=x86
4192         PLATFORMID=linux_x86
4193         ;;
4194     ia64)
4195         CPUNAME=IA64
4196         RTL_ARCH=IA64
4197         PLATFORMID=linux_ia64
4198         ;;
4199     mips)
4200         CPUNAME=GODSON
4201         RTL_ARCH=MIPS_EB
4202         EPM_FLAGS="-a mips"
4203         PLATFORMID=linux_mips_eb
4204         ;;
4205     mips64)
4206         CPUNAME=GODSON64
4207         RTL_ARCH=MIPS64_EB
4208         EPM_FLAGS="-a mips64"
4209         PLATFORMID=linux_mips64_eb
4210         ;;
4211     mips64el)
4212         CPUNAME=GODSON64
4213         RTL_ARCH=MIPS64_EL
4214         EPM_FLAGS="-a mips64el"
4215         PLATFORMID=linux_mips64_el
4216         ;;
4217     mipsel)
4218         CPUNAME=GODSON
4219         RTL_ARCH=MIPS_EL
4220         EPM_FLAGS="-a mipsel"
4221         PLATFORMID=linux_mips_el
4222         ;;
4223     m68k)
4224         CPUNAME=M68K
4225         RTL_ARCH=M68K
4226         PLATFORMID=linux_m68k
4227         ;;
4228     powerpc)
4229         CPUNAME=POWERPC
4230         RTL_ARCH=PowerPC
4231         PLATFORMID=linux_powerpc
4232         ;;
4233     powerpc64)
4234         CPUNAME=POWERPC64
4235         RTL_ARCH=PowerPC_64
4236         PLATFORMID=linux_powerpc64
4237         ;;
4238     powerpc64le)
4239         CPUNAME=POWERPC64
4240         RTL_ARCH=PowerPC_64_LE
4241         PLATFORMID=linux_powerpc64_le
4242         ;;
4243     sparc)
4244         CPUNAME=SPARC
4245         RTL_ARCH=SPARC
4246         PLATFORMID=linux_sparc
4247         ;;
4248     sparc64)
4249         CPUNAME=SPARC64
4250         RTL_ARCH=SPARC64
4251         PLATFORMID=linux_sparc64
4252         ;;
4253     s390)
4254         CPUNAME=S390
4255         RTL_ARCH=S390
4256         PLATFORMID=linux_s390
4257         ;;
4258     s390x)
4259         CPUNAME=S390X
4260         RTL_ARCH=S390x
4261         PLATFORMID=linux_s390x
4262         ;;
4263     x86_64)
4264         CPUNAME=X86_64
4265         RTL_ARCH=X86_64
4266         PLATFORMID=linux_x86_64
4267         ;;
4268     *)
4269         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4270         ;;
4271     esac
4272     ;;
4274 linux-android*)
4275     COM=GCC
4276     USING_X11=
4277     OS=ANDROID
4278     RTL_OS=Android
4279     P_SEP=:
4281     case "$host_cpu" in
4283     arm|armel)
4284         CPUNAME=ARM
4285         RTL_ARCH=ARM_EABI
4286         PLATFORMID=android_arm_eabi
4287         ;;
4288     aarch64)
4289         CPUNAME=AARCH64
4290         RTL_ARCH=AARCH64
4291         PLATFORMID=android_aarch64
4292         ;;
4293     mips|mipsel)
4294         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4295         RTL_ARCH=MIPS_EL
4296         PLATFORMID=android_mips_el
4297         ;;
4298     i*86)
4299         CPUNAME=INTEL
4300         RTL_ARCH=x86
4301         PLATFORMID=android_x86
4302         ;;
4303     *)
4304         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4305         ;;
4306     esac
4307     ;;
4309 *netbsd*)
4310     COM=GCC
4311     USING_X11=TRUE
4312     OS=NETBSD
4313     RTL_OS=NetBSD
4314     P_SEP=:
4316     case "$host_cpu" in
4317     i*86)
4318         CPUNAME=INTEL
4319         RTL_ARCH=x86
4320         PLATFORMID=netbsd_x86
4321         ;;
4322     powerpc)
4323         CPUNAME=POWERPC
4324         RTL_ARCH=PowerPC
4325         PLATFORMID=netbsd_powerpc
4326         ;;
4327     sparc)
4328         CPUNAME=SPARC
4329         RTL_ARCH=SPARC
4330         PLATFORMID=netbsd_sparc
4331         ;;
4332     x86_64)
4333         CPUNAME=X86_64
4334         RTL_ARCH=X86_64
4335         PLATFORMID=netbsd_x86_64
4336         ;;
4337     *)
4338         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4339         ;;
4340     esac
4341     ;;
4343 openbsd*)
4344     COM=GCC
4345     USING_X11=TRUE
4346     OS=OPENBSD
4347     RTL_OS=OpenBSD
4348     P_SEP=:
4350     case "$host_cpu" in
4351     i*86)
4352         CPUNAME=INTEL
4353         RTL_ARCH=x86
4354         PLATFORMID=openbsd_x86
4355         ;;
4356     x86_64)
4357         CPUNAME=X86_64
4358         RTL_ARCH=X86_64
4359         PLATFORMID=openbsd_x86_64
4360         ;;
4361     *)
4362         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4363         ;;
4364     esac
4365     SOLARINC="$SOLARINC -I/usr/local/include"
4366     ;;
4368 solaris*)
4369     COM=GCC
4370     USING_X11=TRUE
4371     OS=SOLARIS
4372     RTL_OS=Solaris
4373     P_SEP=:
4375     case "$host_cpu" in
4376     i*86)
4377         CPUNAME=INTEL
4378         RTL_ARCH=x86
4379         PLATFORMID=solaris_x86
4380         ;;
4381     sparc)
4382         CPUNAME=SPARC
4383         RTL_ARCH=SPARC
4384         PLATFORMID=solaris_sparc
4385         ;;
4386     sparc64)
4387         CPUNAME=SPARC64
4388         RTL_ARCH=SPARC64
4389         PLATFORMID=solaris_sparc64
4390         ;;
4391     *)
4392         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4393         ;;
4394     esac
4395     SOLARINC="$SOLARINC -I/usr/local/include"
4396     ;;
4399     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4400     ;;
4401 esac
4403 if test "$with_x" = "no"; then
4404     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4407 DISABLE_GUI=""
4408 if test "$enable_gui" = "no"; then
4409     if test "$USING_X11" != TRUE; then
4410         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4411     fi
4412     USING_X11=
4413     DISABLE_GUI=TRUE
4414     AC_DEFINE(HAVE_FEATURE_UI,0)
4415     test_cairo=yes
4417 AC_SUBST(DISABLE_GUI)
4419 WORKDIR="${BUILDDIR}/workdir"
4420 INSTDIR="${BUILDDIR}/instdir"
4421 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4422 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4423 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4424 AC_SUBST(COM)
4425 AC_SUBST(CPUNAME)
4426 AC_SUBST(RTL_OS)
4427 AC_SUBST(RTL_ARCH)
4428 AC_SUBST(EPM_FLAGS)
4429 AC_SUBST(USING_X11)
4430 AC_SUBST([INSTDIR])
4431 AC_SUBST([INSTROOT])
4432 AC_SUBST([INSTROOTBASE])
4433 AC_SUBST(OS)
4434 AC_SUBST(P_SEP)
4435 AC_SUBST(WORKDIR)
4436 AC_SUBST(PLATFORMID)
4437 AC_SUBST(WINDOWS_X64)
4438 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4440 dnl ===================================================================
4441 dnl Test which package format to use
4442 dnl ===================================================================
4443 AC_MSG_CHECKING([which package format to use])
4444 if test -n "$with_package_format" -a "$with_package_format" != no; then
4445     for i in $with_package_format; do
4446         case "$i" in
4447         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4448             ;;
4449         *)
4450             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4451 aix - AIX software distribution
4452 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4453 deb - Debian software distribution
4454 pkg - Solaris software distribution
4455 rpm - RedHat software distribution
4457 LibreOffice additionally supports:
4458 archive - .tar.gz or .zip
4459 dmg - Mac OS X .dmg
4460 installed - installation tree
4461 msi - Windows .msi
4462         ])
4463             ;;
4464         esac
4465     done
4466     # fakeroot is needed to ensure correct file ownerships/permissions
4467     # inside deb packages and tar archives created on Linux and Solaris.
4468     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4469         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4470         if test "$FAKEROOT" = "no"; then
4471             AC_MSG_ERROR(
4472                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4473         fi
4474     fi
4475     PKGFORMAT="$with_package_format"
4476     AC_MSG_RESULT([$PKGFORMAT])
4477 else
4478     PKGFORMAT=
4479     AC_MSG_RESULT([none])
4481 AC_SUBST(PKGFORMAT)
4483 dnl ===================================================================
4484 dnl Set up a different compiler to produce tools to run on the build
4485 dnl machine when doing cross-compilation
4486 dnl ===================================================================
4488 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4489 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4490 if test "$cross_compiling" = "yes"; then
4491     AC_MSG_CHECKING([for BUILD platform configuration])
4492     echo
4493     rm -rf CONF-FOR-BUILD config_build.mk
4494     mkdir CONF-FOR-BUILD
4495     # Here must be listed all files needed when running the configure script. In particular, also
4496     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4497     # keep them in the same order as there.
4498     (cd $SRC_ROOT && tar cf - \
4499         config.guess \
4500         bin/get_config_variables \
4501         solenv/bin/getcompver.awk \
4502         solenv/inc/langlist.mk \
4503         download.lst \
4504         config_host.mk.in \
4505         config_host_lang.mk.in \
4506         Makefile.in \
4507         lo.xcent.in \
4508         bin/bffvalidator.sh.in \
4509         bin/odfvalidator.sh.in \
4510         bin/officeotron.sh.in \
4511         instsetoo_native/util/openoffice.lst.in \
4512         config_host/*.in \
4513         sysui/desktop/macosx/Info.plist.in) \
4514     | (cd CONF-FOR-BUILD && tar xf -)
4515     cp configure CONF-FOR-BUILD
4516     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4517     (
4518     unset COM USING_X11 OS CPUNAME
4519     unset CC CXX SYSBASE CFLAGS
4520     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4521     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4522     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4523     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4524     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4525     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4526     cd CONF-FOR-BUILD
4527     sub_conf_opts=""
4528     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4529     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4530     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4531     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4532     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4533     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4534     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4535     # Don't bother having configure look for stuff not needed for the build platform anyway
4536     ./configure \
4537         --disable-cups \
4538         --disable-gtk3 \
4539         --disable-pdfimport \
4540         --disable-postgresql-sdbc \
4541         --with-parallelism="$with_parallelism" \
4542         --without-doxygen \
4543         --without-java \
4544         $sub_conf_opts \
4545         --srcdir=$srcdir \
4546         2>&1 | sed -e 's/^/    /'
4547     test -f ./config_host.mk 2>/dev/null || exit
4548     cp config_host.mk ../config_build.mk
4549     cp config_host_lang.mk ../config_build_lang.mk
4550     mv config.log ../config.Build.log
4551     mkdir -p ../config_build
4552     mv config_host/*.h ../config_build
4553     . ./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
4555     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
4556         VV='$'$V
4557         VV=`eval "echo $VV"`
4558         if test -n "$VV"; then
4559             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4560             echo "$line" >>build-config
4561         fi
4562     done
4564     for V in INSTDIR INSTROOT WORKDIR; do
4565         VV='$'$V
4566         VV=`eval "echo $VV"`
4567         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4568         if test -n "$VV"; then
4569             line="${V}_FOR_BUILD='$VV'"
4570             echo "$line" >>build-config
4571         fi
4572     done
4574     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4575     echo "$line" >>build-config
4577     )
4578     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4579     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])
4580     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4581              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4583     eval `cat CONF-FOR-BUILD/build-config`
4585     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4587     rm -rf CONF-FOR-BUILD
4588 else
4589     OS_FOR_BUILD="$OS"
4590     CC_FOR_BUILD="$CC"
4591     CXX_FOR_BUILD="$CXX"
4592     INSTDIR_FOR_BUILD="$INSTDIR"
4593     INSTROOT_FOR_BUILD="$INSTROOT"
4594     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4595     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4596     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4597     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4598     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4599     WORKDIR_FOR_BUILD="$WORKDIR"
4601 AC_SUBST(OS_FOR_BUILD)
4602 AC_SUBST(INSTDIR_FOR_BUILD)
4603 AC_SUBST(INSTROOT_FOR_BUILD)
4604 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4605 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4606 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4607 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4608 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4609 AC_SUBST(WORKDIR_FOR_BUILD)
4611 dnl ===================================================================
4612 dnl Check for syslog header
4613 dnl ===================================================================
4614 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4616 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4617 dnl ===================================================================
4618 AC_MSG_CHECKING([whether to turn warnings to errors])
4619 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4620     ENABLE_WERROR="TRUE"
4621     AC_MSG_RESULT([yes])
4622 else
4623     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4624         ENABLE_WERROR="TRUE"
4625         AC_MSG_RESULT([yes])
4626     else
4627         AC_MSG_RESULT([no])
4628     fi
4630 AC_SUBST(ENABLE_WERROR)
4632 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4633 dnl ===================================================================
4634 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4635 if test -z "$enable_assert_always_abort"; then
4636    if test "$ENABLE_DEBUG" = TRUE; then
4637        enable_assert_always_abort=yes
4638    else
4639        enable_assert_always_abort=no
4640    fi
4642 if test "$enable_assert_always_abort" = "yes"; then
4643     ASSERT_ALWAYS_ABORT="TRUE"
4644     AC_MSG_RESULT([yes])
4645 else
4646     ASSERT_ALWAYS_ABORT="FALSE"
4647     AC_MSG_RESULT([no])
4649 AC_SUBST(ASSERT_ALWAYS_ABORT)
4651 # Determine whether to use ooenv for the instdir installation
4652 # ===================================================================
4653 if test $_os != "WINNT" -a $_os != "Darwin"; then
4654     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4655     if test "$enable_ooenv" = "no"; then
4656         AC_MSG_RESULT([no])
4657     else
4658         ENABLE_OOENV="TRUE"
4659         AC_MSG_RESULT([yes])
4660     fi
4662 AC_SUBST(ENABLE_OOENV)
4664 if test "$USING_X11" != TRUE; then
4665     # be sure to do not mess with unneeded stuff
4666     test_randr=no
4667     test_xrender=no
4668     test_cups=no
4669     test_dbus=no
4670     test_gtk=no
4671     build_gstreamer_1_0=no
4672     build_gstreamer_0_10=no
4673     test_kde4=no
4674     test_kde5=no
4675     test_qt5=no
4676     test_gtk3_kde5=no
4677     enable_cairo_canvas=no
4680 if test "$OS" = "HAIKU"; then
4681     enable_cairo_canvas=yes
4682     test_kde5=yes
4685 if test "$test_kde5" = "yes"; then
4686     test_qt5=yes
4689 if test "$test_kde5" = "yes" -a  "$enable_kde5" = "yes"; then
4690     if test "$enable_qt5" = "no"; then
4691         AC_MSG_ERROR([KDE5 support depends on QT5, so it conflicts with --disable-qt5])
4692     else
4693         enable_qt5=yes
4694     fi
4697 dnl ===================================================================
4698 dnl check for cups support
4699 dnl ===================================================================
4700 ENABLE_CUPS=""
4702 if test "$enable_cups" = "no"; then
4703     test_cups=no
4706 AC_MSG_CHECKING([whether to enable CUPS support])
4707 if test "$test_cups" = "yes"; then
4708     ENABLE_CUPS="TRUE"
4709     AC_MSG_RESULT([yes])
4711     AC_MSG_CHECKING([whether cups support is present])
4712     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4713     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4714     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4715         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4716     fi
4718 else
4719     AC_MSG_RESULT([no])
4722 AC_SUBST(ENABLE_CUPS)
4724 # fontconfig checks
4725 if test "$test_fontconfig" = "yes"; then
4726     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4727     SYSTEM_FONTCONFIG=TRUE
4728     FilterLibs "${FONTCONFIG_LIBS}"
4729     FONTCONFIG_LIBS="${filteredlibs}"
4731 AC_SUBST(FONTCONFIG_CFLAGS)
4732 AC_SUBST(FONTCONFIG_LIBS)
4733 AC_SUBST([SYSTEM_FONTCONFIG])
4735 dnl whether to find & fetch external tarballs?
4736 dnl ===================================================================
4737 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4738    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4739        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4740    else
4741        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4742    fi
4744 if test -z "$TARFILE_LOCATION"; then
4745     if test -d "$SRC_ROOT/src" ; then
4746         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4747         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4748     fi
4749     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4750 else
4751     AbsolutePath "$TARFILE_LOCATION"
4752     PathFormat "${absolute_path}"
4753     TARFILE_LOCATION="${formatted_path}"
4755 AC_SUBST(TARFILE_LOCATION)
4757 AC_MSG_CHECKING([whether we want to fetch tarballs])
4758 if test "$enable_fetch_external" != "no"; then
4759     if test "$with_all_tarballs" = "yes"; then
4760         AC_MSG_RESULT([yes, all of them])
4761         DO_FETCH_TARBALLS="ALL"
4762     else
4763         AC_MSG_RESULT([yes, if we use them])
4764         DO_FETCH_TARBALLS="TRUE"
4765     fi
4766 else
4767     AC_MSG_RESULT([no])
4768     DO_FETCH_TARBALLS=
4770 AC_SUBST(DO_FETCH_TARBALLS)
4772 AC_MSG_CHECKING([whether to build help])
4773 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4774     BUILD_TYPE="$BUILD_TYPE HELP"
4775     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4776     case "$with_help" in
4777     "html")
4778         ENABLE_HTMLHELP=TRUE
4779         SCPDEFS="$SCPDEFS -DWITH_HELP"
4780         AC_MSG_RESULT([HTML])
4781         ;;
4782     "online")
4783         ENABLE_HTMLHELP=TRUE
4784         HELP_ONLINE=TRUE
4785         AC_MSG_RESULT([HTML])
4786         ;;
4787     yes)
4788         SCPDEFS="$SCPDEFS -DWITH_HELP"
4789         AC_MSG_RESULT([yes])
4790         ;;
4791     *)
4792         AC_MSG_ERROR([Unknown --with-help=$with_help])
4793         ;;
4794     esac
4795 else
4796     AC_MSG_RESULT([no])
4798 AC_SUBST([ENABLE_HTMLHELP])
4799 AC_SUBST([HELP_ONLINE])
4801 dnl Test whether to include MySpell dictionaries
4802 dnl ===================================================================
4803 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4804 if test "$with_myspell_dicts" = "yes"; then
4805     AC_MSG_RESULT([yes])
4806     WITH_MYSPELL_DICTS=TRUE
4807     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4808     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4809 else
4810     AC_MSG_RESULT([no])
4811     WITH_MYSPELL_DICTS=
4813 AC_SUBST(WITH_MYSPELL_DICTS)
4815 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4816 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4817     if test "$with_system_dicts" = yes; then
4818         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4819     fi
4820     with_system_dicts=no
4823 AC_MSG_CHECKING([whether to use dicts from external paths])
4824 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4825     AC_MSG_RESULT([yes])
4826     SYSTEM_DICTS=TRUE
4827     AC_MSG_CHECKING([for spelling dictionary directory])
4828     if test -n "$with_external_dict_dir"; then
4829         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4830     else
4831         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4832         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4833             DICT_SYSTEM_DIR=file:///usr/share/myspell
4834         fi
4835     fi
4836     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4837     AC_MSG_CHECKING([for hyphenation patterns directory])
4838     if test -n "$with_external_hyph_dir"; then
4839         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4840     else
4841         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4842     fi
4843     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4844     AC_MSG_CHECKING([for thesaurus directory])
4845     if test -n "$with_external_thes_dir"; then
4846         THES_SYSTEM_DIR=file://$with_external_thes_dir
4847     else
4848         THES_SYSTEM_DIR=file:///usr/share/mythes
4849     fi
4850     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4851 else
4852     AC_MSG_RESULT([no])
4853     SYSTEM_DICTS=
4855 AC_SUBST(SYSTEM_DICTS)
4856 AC_SUBST(DICT_SYSTEM_DIR)
4857 AC_SUBST(HYPH_SYSTEM_DIR)
4858 AC_SUBST(THES_SYSTEM_DIR)
4860 dnl ===================================================================
4861 dnl enable pch by default on windows
4862 dnl enable it explicitly otherwise
4863 ENABLE_PCH=""
4864 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4865     if test -z "$libo_fuzzed_enable_pch"; then
4866         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4867     else
4868         AC_MSG_NOTICE([Resetting --enable-pch=no])
4869         enable_pch=no
4870     fi
4873 AC_MSG_CHECKING([whether to enable pch feature])
4874 if test "$enable_pch" != "no"; then
4875     if test "$_os" = "WINNT"; then
4876         ENABLE_PCH="TRUE"
4877         AC_MSG_RESULT([yes])
4878     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4879         ENABLE_PCH="TRUE"
4880         AC_MSG_RESULT([yes])
4881     elif test -n "$enable_pch"; then
4882         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4883     else
4884         AC_MSG_RESULT([no])
4885     fi
4886 else
4887     AC_MSG_RESULT([no])
4889 AC_SUBST(ENABLE_PCH)
4891 TAB=`printf '\t'`
4893 AC_MSG_CHECKING([the GNU Make version])
4894 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4895 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4896 if test "$_make_longver" -ge "038200"; then
4897     AC_MSG_RESULT([$GNUMAKE $_make_version])
4899 elif test "$_make_longver" -ge "038100"; then
4900     if test "$build_os" = "cygwin"; then
4901         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4902     fi
4903     AC_MSG_RESULT([$GNUMAKE $_make_version])
4905     dnl ===================================================================
4906     dnl Search all the common names for sha1sum
4907     dnl ===================================================================
4908     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4909     if test -z "$SHA1SUM"; then
4910         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4911     elif test "$SHA1SUM" = "openssl"; then
4912         SHA1SUM="openssl sha1"
4913     fi
4914     AC_MSG_CHECKING([for GNU Make bug 20033])
4915     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4916     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4917 A := \$(wildcard *.a)
4919 .PHONY: all
4920 all: \$(A:.a=.b)
4921 <TAB>@echo survived bug20033.
4923 .PHONY: setup
4924 setup:
4925 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4927 define d1
4928 @echo lala \$(1)
4929 @sleep 1
4930 endef
4932 define d2
4933 @echo tyty \$(1)
4934 @sleep 1
4935 endef
4937 %.b : %.a
4938 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4939 <TAB>\$(call d1,\$(CHECKSUM)),\
4940 <TAB>\$(call d2,\$(CHECKSUM)))
4942     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4943         no_parallelism_make="YES"
4944         AC_MSG_RESULT([yes, disable parallelism])
4945     else
4946         AC_MSG_RESULT([no, keep parallelism enabled])
4947     fi
4948     rm -rf $TESTGMAKEBUG20033
4949 else
4950     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4953 # find if gnumake support file function
4954 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4955 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4956 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4957     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4959 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4960 \$(file >test.txt,Success )
4962 .PHONY: all
4963 all:
4964 <TAB>@cat test.txt
4967 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4968 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4969     HAVE_GNUMAKE_FILE_FUNC=TRUE
4970     AC_MSG_RESULT([yes])
4971 else
4972     AC_MSG_RESULT([no])
4974 rm -rf $TESTGMAKEFILEFUNC
4975 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4976 AC_SUBST(GNUMAKE_WIN_NATIVE)
4978 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4979 STALE_MAKE=
4980 if test "$_make_ver_check" = ""; then
4981    STALE_MAKE=TRUE
4984 HAVE_LD_HASH_STYLE=FALSE
4985 WITH_LINKER_HASH_STYLE=
4986 AC_MSG_CHECKING([for --hash-style gcc linker support])
4987 if test "$GCC" = "yes"; then
4988     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4989         hash_styles="gnu sysv"
4990     elif test "$with_linker_hash_style" = "no"; then
4991         hash_styles=
4992     else
4993         hash_styles="$with_linker_hash_style"
4994     fi
4996     for hash_style in $hash_styles; do
4997         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4998         hash_style_ldflags_save=$LDFLAGS
4999         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5001         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5002             [
5003 #include <stdio.h>
5004             ],[
5005 printf ("");
5006             ])],
5007             [
5008                   HAVE_LD_HASH_STYLE=TRUE
5009                   WITH_LINKER_HASH_STYLE=$hash_style
5010             ],
5011             [HAVE_LD_HASH_STYLE=FALSE],
5012             [HAVE_LD_HASH_STYLE=FALSE])
5013         LDFLAGS=$hash_style_ldflags_save
5014     done
5016     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5017         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5018     else
5019         AC_MSG_RESULT( no )
5020     fi
5021     LDFLAGS=$hash_style_ldflags_save
5022 else
5023     AC_MSG_RESULT( no )
5025 AC_SUBST(HAVE_LD_HASH_STYLE)
5026 AC_SUBST(WITH_LINKER_HASH_STYLE)
5028 dnl ===================================================================
5029 dnl Check whether there's a Perl version available.
5030 dnl ===================================================================
5031 if test -z "$with_perl_home"; then
5032     AC_PATH_PROG(PERL, perl)
5033 else
5034     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5035     _perl_path="$with_perl_home/bin/perl"
5036     if test -x "$_perl_path"; then
5037         PERL=$_perl_path
5038     else
5039         AC_MSG_ERROR([$_perl_path not found])
5040     fi
5043 dnl ===================================================================
5044 dnl Testing for Perl version 5 or greater.
5045 dnl $] is the Perl version variable, it is returned as an integer
5046 dnl ===================================================================
5047 if test "$PERL"; then
5048     AC_MSG_CHECKING([the Perl version])
5049     ${PERL} -e "exit($]);"
5050     _perl_version=$?
5051     if test "$_perl_version" -lt 5; then
5052         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5053     fi
5054     AC_MSG_RESULT([Perl $_perl_version])
5055 else
5056     AC_MSG_ERROR([Perl not found, install Perl 5])
5059 dnl ===================================================================
5060 dnl Testing for required Perl modules
5061 dnl ===================================================================
5063 AC_MSG_CHECKING([for required Perl modules])
5064 perl_use_string="use Cwd ; use Digest::MD5"
5065 if test "$_os" = "WINNT"; then
5066     if test -n "$PKGFORMAT"; then
5067         for i in $PKGFORMAT; do
5068             case "$i" in
5069             msi)
5070                 # for getting fonts versions to use in MSI
5071                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5072                 ;;
5073             esac
5074         done
5075     fi
5077 if test "$with_system_hsqldb" = "yes"; then
5078         perl_use_string="$perl_use_string ; use Archive::Zip"
5080 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5081     AC_MSG_RESULT([all modules found])
5082 else
5083     AC_MSG_RESULT([failed to find some modules])
5084     # Find out which modules are missing.
5085     for i in $perl_use_string; do
5086         if test "$i" != "use" -a "$i" != ";"; then
5087             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5088                 missing_perl_modules="$missing_perl_modules $i"
5089             fi
5090         fi
5091     done
5092     AC_MSG_ERROR([
5093     The missing Perl modules are: $missing_perl_modules
5094     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5097 dnl ===================================================================
5098 dnl Check for pkg-config
5099 dnl ===================================================================
5100 if test "$_os" != "WINNT"; then
5101     PKG_PROG_PKG_CONFIG
5104 if test "$_os" != "WINNT"; then
5106     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5107     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5108     # explicitly. Or put /path/to/compiler in PATH yourself.
5110     # Use wrappers for LTO
5111     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5112         AC_CHECK_TOOL(AR,gcc-ar)
5113         AC_CHECK_TOOL(NM,gcc-nm)
5114         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5115     else
5116         AC_CHECK_TOOL(AR,ar)
5117         AC_CHECK_TOOL(NM,nm)
5118         AC_CHECK_TOOL(RANLIB,ranlib)
5119     fi
5120     AC_CHECK_TOOL(OBJDUMP,objdump)
5121     AC_CHECK_TOOL(READELF,readelf)
5122     AC_CHECK_TOOL(STRIP,strip)
5123     if test "$_os" = "WINNT"; then
5124         AC_CHECK_TOOL(DLLTOOL,dlltool)
5125         AC_CHECK_TOOL(WINDRES,windres)
5126     fi
5128 AC_SUBST(AR)
5129 AC_SUBST(DLLTOOL)
5130 AC_SUBST(NM)
5131 AC_SUBST(OBJDUMP)
5132 AC_SUBST(PKG_CONFIG)
5133 AC_SUBST(RANLIB)
5134 AC_SUBST(READELF)
5135 AC_SUBST(STRIP)
5136 AC_SUBST(WINDRES)
5138 dnl ===================================================================
5139 dnl pkg-config checks on Mac OS X
5140 dnl ===================================================================
5142 if test $_os = Darwin; then
5143     AC_MSG_CHECKING([for bogus pkg-config])
5144     if test -n "$PKG_CONFIG"; then
5145         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5146             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5147         else
5148             if test "$enable_bogus_pkg_config" = "yes"; then
5149                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5150             else
5151                 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.])
5152             fi
5153         fi
5154     else
5155         AC_MSG_RESULT([no, good])
5156     fi
5159 find_csc()
5161     # Return value: $csctest
5163     unset csctest
5165     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5166     if test -n "$regvalue"; then
5167         csctest=$regvalue
5168         return
5169     fi
5172 find_al()
5174     # Return value: $altest
5176     unset altest
5178     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5179         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5180         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5181             altest=$regvalue
5182             return
5183         fi
5184     done
5186     # We need this additional check to detect 4.6.1 or above.
5187     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5188         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5189         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5190             altest=$regvalue
5191             return
5192         fi
5194         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5195         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5196             altest=$regvalue
5197             return
5198         fi
5199     done
5202 find_dotnetsdk46()
5204     unset frametest
5206     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5207         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5208         if test -n "$regvalue"; then
5209             frametest=$regvalue
5210             return
5211         fi
5212         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5213         if test -n "$regvalue"; then
5214             frametest=$regvalue
5215             return
5216         fi
5217     done
5220 find_winsdk_version()
5222     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5223     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5225     unset winsdktest winsdkbinsubdir winsdklibsubdir
5227     case "$1" in
5228     7.*)
5229         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5230         if test -n "$regvalue"; then
5231             winsdktest=$regvalue
5232             winsdklibsubdir=.
5233             return
5234         fi
5235         ;;
5236     8.0|8.0A)
5237         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5238         if test -n "$regvalue"; then
5239             winsdktest=$regvalue
5240             winsdklibsubdir=win8
5241             return
5242         fi
5243         ;;
5244     8.1|8.1A)
5245         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5246         if test -n "$regvalue"; then
5247             winsdktest=$regvalue
5248             winsdklibsubdir=winv6.3
5249             return
5250         fi
5251         ;;
5252     10.0)
5253         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5254         if test -n "$regvalue"; then
5255             winsdktest=$regvalue
5256             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5257             if test -n "$regvalue"; then
5258                 winsdkbinsubdir="$regvalue".0
5259                 winsdklibsubdir=$winsdkbinsubdir
5260                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5261                 # test exist the SDK path
5262                 if test -d "$tmppath"; then
5263                    # when path is convertible to a short path then path is okay
5264                    if ! cygpath -d "$tmppath"; then
5265                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5266                    fi
5267                 else
5268                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5269                 fi
5270             fi
5271             return
5272         fi
5273         ;;
5274     esac
5277 find_winsdk()
5279     # Return value: From find_winsdk_version
5281     unset winsdktest
5283     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5284         find_winsdk_version $ver
5285         if test -n "$winsdktest"; then
5286             return
5287         fi
5288     done
5291 find_msms()
5293     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5294     if test $VCVER = 150; then
5295         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5296     fi
5297     AC_MSG_CHECKING([for ${my_msm_files}])
5298     msmdir=
5299     for ver in 14.0 15.0; do
5300         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5301         if test -n "$regvalue"; then
5302             for f in ${my_msm_files}; do
5303                 if test -e "$regvalue/${f}"; then
5304                     msmdir=$regvalue
5305                     break
5306                 fi
5307             done
5308         fi
5309     done
5310     dnl Is the following fallback really necessary, or was it added in response
5311     dnl to never having started Visual Studio on a given machine, so the
5312     dnl registry keys checked above had presumably not yet been created?
5313     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5314     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5315     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5316     dnl expanding to "C:\Program Files\Common Files"), which would need
5317     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5318     dnl obtain its value from cygwin:
5319     if test -z "$msmdir"; then
5320         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5321         for f in ${my_msm_files}; do
5322             if test -e "$my_msm_dir/${f}"; then
5323                 msmdir=$my_msm_dir
5324             fi
5325         done
5326     fi
5328     dnl Starting from MSVC 15.0, merge modules are located in different directory
5329     if test $VCVER = 150; then
5330         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5331             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5332             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5333             for f in ${my_msm_files}; do
5334                 if test -e "$my_msm_dir/${f}"; then
5335                     msmdir=$my_msm_dir
5336                     break
5337                 fi
5338             done
5339         done
5340     fi
5342     if test -n "$msmdir"; then
5343         msmdir=`cygpath -m "$msmdir"`
5344         AC_MSG_RESULT([$msmdir])
5345     else
5346         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5347             AC_MSG_ERROR([not found])
5348         else
5349             AC_MSG_WARN([not found])
5350             add_warning "MSM none of ${my_msm_files} found"
5351         fi
5352     fi
5355 find_msvc_x64_dlls()
5357     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5358     if test "$VCVER" = 150; then
5359         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5360             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5361             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5362                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5363                 break
5364             fi
5365             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5366                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5367                 break
5368             fi
5369         done
5370     fi
5371     msvcdlls="msvcp140.dll vcruntime140.dll"
5372     for dll in $msvcdlls; do
5373         if ! test -f "$msvcdllpath/$dll"; then
5374             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5375         fi
5376     done
5379 dnl =========================================
5380 dnl Check for the Windows  SDK.
5381 dnl =========================================
5382 if test "$_os" = "WINNT"; then
5383     AC_MSG_CHECKING([for Windows SDK])
5384     if test "$build_os" = "cygwin"; then
5385         find_winsdk
5386         WINDOWS_SDK_HOME=$winsdktest
5388         # normalize if found
5389         if test -n "$WINDOWS_SDK_HOME"; then
5390             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5391             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5392         fi
5394         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5395     fi
5397     if test -n "$WINDOWS_SDK_HOME"; then
5398         # Remove a possible trailing backslash
5399         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5401         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5402              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5403              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5404             have_windows_sdk_headers=yes
5405         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5406              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5407              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5408             have_windows_sdk_headers=yes
5409         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5410              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5411              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5412             have_windows_sdk_headers=yes
5413         else
5414             have_windows_sdk_headers=no
5415         fi
5417         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5418             have_windows_sdk_libs=yes
5419         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5420             have_windows_sdk_libs=yes
5421         else
5422             have_windows_sdk_libs=no
5423         fi
5425         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5426             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5427 the  Windows SDK are installed.])
5428         fi
5429     fi
5431     if test -z "$WINDOWS_SDK_HOME"; then
5432         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5433     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5434         WINDOWS_SDK_VERSION=70
5435         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5436     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5437         WINDOWS_SDK_VERSION=80
5438         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5439     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5440         WINDOWS_SDK_VERSION=81
5441         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5442     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5443         WINDOWS_SDK_VERSION=10
5444         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5445     else
5446         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5447     fi
5448     PathFormat "$WINDOWS_SDK_HOME"
5449     WINDOWS_SDK_HOME="$formatted_path"
5450     if test "$build_os" = "cygwin"; then
5451         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5452         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5453             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5454         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5455             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5456         fi
5457     fi
5459     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5460     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5461     dnl but not in v8.0), so allow this to be overridden with a
5462     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5463     dnl and configuration error if no WiLangId.vbs is found would arguably be
5464     dnl better, but I do not know under which conditions exactly it is needed by
5465     dnl msiglobal.pm:
5466     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5467         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5468         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5469             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5470         fi
5471         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5472             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5473         fi
5474         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5475             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5476         fi
5477     fi
5478     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5479         if test -n "$with_package_format" -a "$with_package_format" != no; then
5480             for i in "$with_package_format"; do
5481                 if test "$i" = "msi"; then
5482                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5483                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5484                     fi
5485                 fi
5486             done
5487         fi
5488     fi
5490 AC_SUBST(WINDOWS_SDK_HOME)
5491 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5492 AC_SUBST(WINDOWS_SDK_VERSION)
5493 AC_SUBST(WINDOWS_SDK_WILANGID)
5495 if test "$build_os" = "cygwin"; then
5496     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5497     dnl dir, it also determines that dir's path w/o an arch segment if any,
5498     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5499     AC_MSG_CHECKING([for midl.exe])
5501     find_winsdk
5502     if test -n "$winsdkbinsubdir" \
5503         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5504     then
5505         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5506         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5507     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5508         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5509         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5510     elif test -f "$winsdktest/Bin/midl.exe"; then
5511         MIDL_PATH=$winsdktest/Bin
5512         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5513     fi
5514     if test ! -f "$MIDL_PATH/midl.exe"; then
5515         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5516     else
5517         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5518     fi
5520     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5521     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5523     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5524          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5525          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5526          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5527     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5528          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5529          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5530          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5531     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5532          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5533          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5534          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5535     else
5536         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5537     fi
5539     dnl Check csc.exe
5540     AC_MSG_CHECKING([for csc.exe])
5541     find_csc
5542     if test -f "$csctest/csc.exe"; then
5543         CSC_PATH="$csctest"
5544     fi
5545     if test ! -f "$CSC_PATH/csc.exe"; then
5546         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5547     else
5548         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5549     fi
5551     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5553     dnl Check al.exe
5554     AC_MSG_CHECKING([for al.exe])
5555     find_winsdk
5556     if test -n "$winsdkbinsubdir" \
5557         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5558     then
5559         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5560     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5561         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5562     elif test -f "$winsdktest/Bin/al.exe"; then
5563         AL_PATH="$winsdktest/Bin"
5564     fi
5566     if test -z "$AL_PATH"; then
5567         find_al
5568         if test -f "$altest/bin/al.exe"; then
5569             AL_PATH="$altest/bin"
5570         elif test -f "$altest/al.exe"; then
5571             AL_PATH="$altest"
5572         fi
5573     fi
5574     if test ! -f "$AL_PATH/al.exe"; then
5575         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5576     else
5577         AC_MSG_RESULT([$AL_PATH/al.exe])
5578     fi
5580     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5582     dnl Check mscoree.lib / .NET Framework dir
5583     AC_MSG_CHECKING(.NET Framework)
5584     find_dotnetsdk46
5585     PathFormat "$frametest"
5586     frametest="$formatted_path"
5587     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5588         DOTNET_FRAMEWORK_HOME="$frametest"
5589     else
5590         find_winsdk
5591         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5592             DOTNET_FRAMEWORK_HOME="$winsdktest"
5593         fi
5594     fi
5595     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
5596         AC_MSG_ERROR([mscoree.lib not found])
5597     fi
5598     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5600     PathFormat "$MIDL_PATH"
5601     MIDL_PATH="$formatted_path"
5603     PathFormat "$AL_PATH"
5604     AL_PATH="$formatted_path"
5606     PathFormat "$DOTNET_FRAMEWORK_HOME"
5607     DOTNET_FRAMEWORK_HOME="$formatted_path"
5609     PathFormat "$CSC_PATH"
5610     CSC_PATH="$formatted_path"
5613 dnl ===================================================================
5614 dnl Check if stdc headers are available excluding MSVC.
5615 dnl ===================================================================
5616 if test "$_os" != "WINNT"; then
5617     AC_HEADER_STDC
5620 dnl ===================================================================
5621 dnl Testing for C++ compiler and version...
5622 dnl ===================================================================
5624 if test "$_os" != "WINNT"; then
5625     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5626     save_CXXFLAGS=$CXXFLAGS
5627     AC_PROG_CXX
5628     CXXFLAGS=$save_CXXFLAGS
5629 else
5630     if test -n "$CC" -a -z "$CXX"; then
5631         CXX="$CC"
5632     fi
5635 dnl check for GNU C++ compiler version
5636 if test "$GXX" = "yes"; then
5637     AC_MSG_CHECKING([the GNU C++ compiler version])
5639     _gpp_version=`$CXX -dumpversion`
5640     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5642     if test "$_gpp_majmin" -lt "401"; then
5643         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5644     else
5645         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5646     fi
5648     dnl see https://code.google.com/p/android/issues/detail?id=41770
5649     if test "$_gpp_majmin" -ge "401"; then
5650         glibcxx_threads=no
5651         AC_LANG_PUSH([C++])
5652         AC_REQUIRE_CPP
5653         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5654         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5655             #include <bits/c++config.h>]],[[
5656             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5657             && !defined(_GLIBCXX__PTHREADS) \
5658             && !defined(_GLIBCXX_HAS_GTHREADS)
5659             choke me
5660             #endif
5661         ]])],[AC_MSG_RESULT([yes])
5662         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5663         AC_LANG_POP([C++])
5664         if test $glibcxx_threads = yes; then
5665             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5666         fi
5667      fi
5669 AC_SUBST(BOOST_CXXFLAGS)
5672 # prefx CXX with ccache if needed
5674 if test "$CCACHE" != ""; then
5675     AC_MSG_CHECKING([whether $CXX is already ccached])
5676     AC_LANG_PUSH([C++])
5677     save_CXXFLAGS=$CXXFLAGS
5678     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5679     dnl an empty program will do, we're checking the compiler flags
5680     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5681                       [use_ccache=yes], [use_ccache=no])
5682     if test $use_ccache = yes; then
5683         AC_MSG_RESULT([yes])
5684     else
5685         CXX="$CCACHE $CXX"
5686         AC_MSG_RESULT([no])
5687     fi
5688     CXXFLAGS=$save_CXXFLAGS
5689     AC_LANG_POP([C++])
5692 dnl ===================================================================
5693 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5694 dnl ===================================================================
5696 if test "$_os" != "WINNT"; then
5697     AC_PROG_CXXCPP
5699     dnl Check whether there's a C pre-processor.
5700     AC_PROG_CPP
5704 dnl ===================================================================
5705 dnl Find integral type sizes and alignments
5706 dnl ===================================================================
5708 if test "$_os" != "WINNT"; then
5710 if test "$_os" == "iOS"; then
5711     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5712     ac_cv_sizeof_long=8
5713     ac_cv_sizeof_short=2
5714     ac_cv_sizeof_int=4
5715     ac_cv_sizeof_long_long=8
5716     ac_cv_sizeof_double=8
5717     ac_cv_sizeof_voidp=8
5718 else
5719     AC_CHECK_SIZEOF(long)
5720     AC_CHECK_SIZEOF(short)
5721     AC_CHECK_SIZEOF(int)
5722     AC_CHECK_SIZEOF(long long)
5723     AC_CHECK_SIZEOF(double)
5724     AC_CHECK_SIZEOF(void*)
5727     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5728     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5729     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5730     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5731     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5733     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5734     m4_pattern_allow([AC_CHECK_ALIGNOF])
5735     m4_ifdef([AC_CHECK_ALIGNOF],
5736         [
5737             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5738             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5739             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5740             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5741         ],
5742         [
5743             case "$_os-$host_cpu" in
5744             Linux-i686)
5745                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5746                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5747                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5748                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5749                 ;;
5750             Linux-x86_64)
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=8
5754                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5755                 ;;
5756             *)
5757                 if test -z "$ac_cv_alignof_short" -o \
5758                         -z "$ac_cv_alignof_int" -o \
5759                         -z "$ac_cv_alignof_long" -o \
5760                         -z "$ac_cv_alignof_double"; then
5761                    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.])
5762                 fi
5763                 ;;
5764             esac
5765         ])
5767     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5768     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5769     if test $ac_cv_sizeof_long -eq 8; then
5770         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5771     elif test $ac_cv_sizeof_double -eq 8; then
5772         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5773     else
5774         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5775     fi
5777     dnl Check for large file support
5778     AC_SYS_LARGEFILE
5779     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5780         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5781     fi
5782     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5783         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5784     fi
5785 else
5786     # Hardcode for MSVC
5787     SAL_TYPES_SIZEOFSHORT=2
5788     SAL_TYPES_SIZEOFINT=4
5789     SAL_TYPES_SIZEOFLONG=4
5790     SAL_TYPES_SIZEOFLONGLONG=8
5791     if test "$BITNESS_OVERRIDE" = ""; then
5792         SAL_TYPES_SIZEOFPOINTER=4
5793     else
5794         SAL_TYPES_SIZEOFPOINTER=8
5795     fi
5796     SAL_TYPES_ALIGNMENT2=2
5797     SAL_TYPES_ALIGNMENT4=4
5798     SAL_TYPES_ALIGNMENT8=8
5799     LFS_CFLAGS=''
5801 AC_SUBST(LFS_CFLAGS)
5803 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5804 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5805 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5806 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5807 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5808 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5809 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5810 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5812 dnl ===================================================================
5813 dnl Check whether to enable runtime optimizations
5814 dnl ===================================================================
5815 ENABLE_RUNTIME_OPTIMIZATIONS=
5816 AC_MSG_CHECKING([whether to enable runtime optimizations])
5817 if test -z "$enable_runtime_optimizations"; then
5818     for i in $CC; do
5819         case $i in
5820         -fsanitize=*)
5821             enable_runtime_optimizations=no
5822             break
5823             ;;
5824         esac
5825     done
5827 if test "$enable_runtime_optimizations" != no; then
5828     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5829     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5830     AC_MSG_RESULT([yes])
5831 else
5832     AC_MSG_RESULT([no])
5834 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5836 dnl ===================================================================
5837 dnl Check if valgrind headers are available
5838 dnl ===================================================================
5839 ENABLE_VALGRIND=
5840 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5841     prev_cppflags=$CPPFLAGS
5842     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5843     # or where does it come from?
5844     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5845     AC_CHECK_HEADER([valgrind/valgrind.h],
5846         [ENABLE_VALGRIND=TRUE])
5847     CPPFLAGS=$prev_cppflags
5849 AC_SUBST([ENABLE_VALGRIND])
5850 if test -z "$ENABLE_VALGRIND"; then
5851     if test "$with_valgrind" = yes; then
5852         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5853     fi
5854     VALGRIND_CFLAGS=
5856 AC_SUBST([VALGRIND_CFLAGS])
5859 dnl ===================================================================
5860 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5861 dnl ===================================================================
5863 # We need at least the sys/sdt.h include header.
5864 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5865 if test "$SDT_H_FOUND" = "TRUE"; then
5866     # Found sys/sdt.h header, now make sure the c++ compiler works.
5867     # Old g++ versions had problems with probes in constructors/destructors.
5868     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5869     AC_LANG_PUSH([C++])
5870     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5871     #include <sys/sdt.h>
5872     class ProbeClass
5873     {
5874     private:
5875       int& ref;
5876       const char *name;
5878     public:
5879       ProbeClass(int& v, const char *n) : ref(v), name(n)
5880       {
5881         DTRACE_PROBE2(_test_, cons, name, ref);
5882       }
5884       void method(int min)
5885       {
5886         DTRACE_PROBE3(_test_, meth, name, ref, min);
5887         ref -= min;
5888       }
5890       ~ProbeClass()
5891       {
5892         DTRACE_PROBE2(_test_, dest, name, ref);
5893       }
5894     };
5895     ]],[[
5896     int i = 64;
5897     DTRACE_PROBE1(_test_, call, i);
5898     ProbeClass inst = ProbeClass(i, "call");
5899     inst.method(24);
5900     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5901           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5902     AC_LANG_POP([C++])
5904 AC_CONFIG_HEADERS([config_host/config_probes.h])
5906 dnl ===================================================================
5907 dnl GCC features
5908 dnl ===================================================================
5909 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5910     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5911     save_CFLAGS=$CFLAGS
5912     CFLAGS="$CFLAGS -Werror -mno-avx"
5913     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5914     CFLAGS=$save_CFLAGS
5915     if test "$HAVE_GCC_AVX" = "TRUE"; then
5916         AC_MSG_RESULT([yes])
5917     else
5918         AC_MSG_RESULT([no])
5919     fi
5921     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5922     save_CFLAGS=$CFLAGS
5923     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
5924     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5925     CFLAGS=$save_CFLAGS
5926     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5927         AC_MSG_RESULT([yes])
5928     else
5929         AC_MSG_RESULT([no])
5930     fi
5932     AC_MSG_CHECKING([whether $CC supports atomic functions])
5933     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5934     int v = 0;
5935     if (__sync_add_and_fetch(&v, 1) != 1 ||
5936         __sync_sub_and_fetch(&v, 1) != 0)
5937         return 1;
5938     __sync_synchronize();
5939     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5940         v != 1)
5941         return 1;
5942     return 0;
5943 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5944     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5945         AC_MSG_RESULT([yes])
5946         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5947     else
5948         AC_MSG_RESULT([no])
5949     fi
5951     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5952     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5953     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5954         AC_MSG_RESULT([yes])
5955         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5956     else
5957         AC_MSG_RESULT([no])
5958     fi
5960     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5961     save_CFLAGS=$CFLAGS
5962     CFLAGS="$CFLAGS -Werror"
5963     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5964             __attribute__((deprecated("test"))) void f();
5965         ])], [
5966             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5967             AC_MSG_RESULT([yes])
5968         ], [AC_MSG_RESULT([no])])
5969     CFLAGS=$save_CFLAGS
5971     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5972     AC_LANG_PUSH([C++])
5973     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5974             #include <cstddef>
5975             #include <cxxabi.h>
5976             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5977         ])], [
5978             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5979             AC_MSG_RESULT([yes])
5980         ], [AC_MSG_RESULT([no])])
5981     AC_LANG_POP([C++])
5983     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5984     AC_LANG_PUSH([C++])
5985     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5986             #include <cstddef>
5987             #include <cxxabi.h>
5988             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5989         ])], [
5990             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5991             AC_MSG_RESULT([yes])
5992         ], [AC_MSG_RESULT([no])])
5993     AC_LANG_POP([C++])
5995     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5996     AC_LANG_PUSH([C++])
5997     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5998             #include <cxxabi.h>
5999             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6000         ])], [
6001             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6002             AC_MSG_RESULT([yes])
6003         ], [AC_MSG_RESULT([no])])
6004     AC_LANG_POP([C++])
6006     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6007     AC_LANG_PUSH([C++])
6008     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6009             #include <cstddef>
6010             #include <cxxabi.h>
6011             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6012         ])], [
6013             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6014             AC_MSG_RESULT([yes])
6015         ], [AC_MSG_RESULT([no])])
6016     AC_LANG_POP([C++])
6018     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6019     AC_LANG_PUSH([C++])
6020     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6021             #include <cstddef>
6022             #include <cxxabi.h>
6023             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6024         ])], [
6025             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6026             AC_MSG_RESULT([yes])
6027         ], [AC_MSG_RESULT([no])])
6028     AC_LANG_POP([C++])
6030     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6031     AC_LANG_PUSH([C++])
6032     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6033             #include <cxxabi.h>
6034             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6035         ])], [
6036             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6037             AC_MSG_RESULT([yes])
6038         ], [AC_MSG_RESULT([no])])
6039     AC_LANG_POP([C++])
6041     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6042     AC_LANG_PUSH([C++])
6043     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6044             #include <cxxabi.h>
6045             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6046         ])], [
6047             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6048             AC_MSG_RESULT([yes])
6049         ], [AC_MSG_RESULT([no])])
6050     AC_LANG_POP([C++])
6052     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6053     AC_LANG_PUSH([C++])
6054     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6055             #include <cxxabi.h>
6056             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6057         ])], [
6058             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6059             AC_MSG_RESULT([yes])
6060         ], [AC_MSG_RESULT([no])])
6061     AC_LANG_POP([C++])
6063     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6064     AC_LANG_PUSH([C++])
6065     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6066             #include <cstddef>
6067             #include <cxxabi.h>
6068             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6069         ])], [
6070             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6071             AC_MSG_RESULT([yes])
6072         ], [AC_MSG_RESULT([no])])
6073     AC_LANG_POP([C++])
6075     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6076     AC_LANG_PUSH([C++])
6077     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6078             #include <cstddef>
6079             #include <cxxabi.h>
6080             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6081         ])], [
6082             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6083             AC_MSG_RESULT([yes])
6084         ], [AC_MSG_RESULT([no])])
6085     AC_LANG_POP([C++])
6087     dnl Available in GCC 4.9 and at least since Clang 3.4:
6088     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6089     AC_LANG_PUSH([C++])
6090     save_CXXFLAGS=$CXXFLAGS
6091     CXXFLAGS="$CXXFLAGS -Werror"
6092     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6093             struct __attribute__((warn_unused)) dummy {};
6094         ])], [
6095             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6096             AC_MSG_RESULT([yes])
6097         ], [AC_MSG_RESULT([no])])
6098     CXXFLAGS=$save_CXXFLAGS
6099 AC_LANG_POP([C++])
6102 AC_SUBST(HAVE_GCC_AVX)
6103 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6104 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6105 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6107 dnl ===================================================================
6108 dnl Identify the C++ library
6109 dnl ===================================================================
6111 AC_MSG_CHECKING([what the C++ library is])
6112 AC_LANG_PUSH([C++])
6113 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6114 #include <utility>
6115 #ifndef __GLIBCXX__
6116 foo bar
6117 #endif
6118 ]])],
6119     [CPP_LIBRARY=GLIBCXX
6120      cpp_library_name="GNU libstdc++"
6121     ],
6122     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6123 #include <utility>
6124 #ifndef _LIBCPP_VERSION
6125 foo bar
6126 #endif
6127 ]])],
6128     [CPP_LIBRARY=LIBCPP
6129      cpp_library_name="LLVM libc++"
6130      AC_DEFINE([HAVE_LIBCXX])
6131     ],
6132     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6133 #include <utility>
6134 #ifndef _MSC_VER
6135 foo bar
6136 #endif
6137 ]])],
6138     [CPP_LIBRARY=MSVCRT
6139      cpp_library_name="Microsoft"
6140     ],
6141     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6142 AC_MSG_RESULT([$cpp_library_name])
6143 AC_LANG_POP([C++])
6145 dnl ===================================================================
6146 dnl Check for gperf
6147 dnl ===================================================================
6148 AC_PATH_PROG(GPERF, gperf)
6149 if test -z "$GPERF"; then
6150     AC_MSG_ERROR([gperf not found but needed. Install it.])
6152 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6153     GPERF=`cygpath -m $GPERF`
6155 AC_MSG_CHECKING([gperf version])
6156 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6157     AC_MSG_RESULT([OK])
6158 else
6159     AC_MSG_ERROR([too old, you need at least 3.0.0])
6161 AC_SUBST(GPERF)
6163 dnl ===================================================================
6164 dnl Check for system libcmis
6165 dnl ===================================================================
6166 # libcmis requires curl and we can't build curl for iOS
6167 if test $_os != iOS; then
6168     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6169     ENABLE_LIBCMIS=TRUE
6170 else
6171     ENABLE_LIBCMIS=
6173 AC_SUBST(ENABLE_LIBCMIS)
6175 dnl ===================================================================
6176 dnl C++11
6177 dnl ===================================================================
6179 my_cxx17switches=
6180 libo_FUZZ_ARG_ENABLE(c++17,
6181     AS_HELP_STRING([--disable-c++17],
6182         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6185 AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6186 CXXFLAGS_CXX11=
6187 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6188     CXXFLAGS_CXX11=-std:c++17
6189 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6190     dnl But only use C++17 if the gperf that is being used knows not to emit
6191     dnl "register" in C++ output:
6192     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6193     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'
6194     if test "$enable_c__17" != no; then
6195         my_flags="-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6196     fi
6197     for flag in $my_flags; do
6198         if test "$COM" = MSC; then
6199             flag="-Xclang $flag"
6200         fi
6201         save_CXXFLAGS=$CXXFLAGS
6202         CXXFLAGS="$CXXFLAGS $flag -Werror"
6203         if test "$SYSTEM_LIBCMIS" = TRUE; then
6204             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6205         fi
6206         AC_LANG_PUSH([C++])
6207         dnl Clang 3.9 supports __float128 since
6208         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6209         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6210         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6211         dnl $flag is supported below, so check this first):
6212         my_float128hack=
6213         my_float128hack_impl=-D__float128=void
6214         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6215             #include <vector>
6216             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6217             // (__float128)
6218             ]])
6219         ],,[
6220             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6221             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6222             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6223             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6224             dnl place where __float128 is used is in a template specialization, -D__float128=void
6225             dnl will avoid the problem there while still causing a problem if somebody actually uses
6226             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6227             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6228             dnl "fixed" with this hack):
6229             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6230             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6231                 #include <vector>
6232                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6233                 // (__float128)
6234                 ]])
6235             ],[my_float128hack=$my_float128hack_impl])
6236         ])
6237         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6238             #include <algorithm>
6239             #include <functional>
6240             #include <vector>
6242             #include <string.h>
6243             #pragma GCC diagnostic push
6244             #pragma GCC diagnostic ignored "-Wpragmas"
6245                 // make GCC not warn about next pragma
6246             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6247                 // make Clang with -std < C++17 not even warn about register
6248             #include "conftest.inc"
6249             #pragma GCC diagnostic pop
6251             #if defined SYSTEM_LIBCMIS
6252             // See ucb/source/ucp/cmis/auth_provider.hxx:
6253             #if __GNUC__ >= 7
6254             #pragma GCC diagnostic push
6255             #pragma GCC diagnostic ignored "-Wdeprecated"
6256             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6257             #endif
6258             #include <libcmis/libcmis.hxx>
6259             #if __GNUC__ >= 7
6260             #pragma GCC diagnostic pop
6261             #endif
6262             #endif
6264             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6265                 std::sort(v.begin(), v.end(), fn);
6266             }
6267             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6268         AC_LANG_POP([C++])
6269         CXXFLAGS=$save_CXXFLAGS
6270         if test -n "$CXXFLAGS_CXX11"; then
6271             break
6272         fi
6273     done
6274     rm conftest.inc
6276 if test -n "$CXXFLAGS_CXX11"; then
6277     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6278 else
6279     AC_MSG_ERROR(no)
6281 AC_SUBST(CXXFLAGS_CXX11)
6283 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6284 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6285 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6286 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6287 dnl again towards 4.7.2:
6288 if test $CPP_LIBRARY = GLIBCXX; then
6289     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6290     AC_LANG_PUSH([C++])
6291     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6292 #include <list>
6293 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6294     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6295     //   GCC 4.7.0: 20120322
6296     //   GCC 4.7.1: 20120614
6297     // and using a range check is not possible as the mapping between
6298     // __GLIBCXX__ values and GCC versions is not monotonic
6299 /* ok */
6300 #else
6301 abi broken
6302 #endif
6303         ]])], [AC_MSG_RESULT(no, ok)],
6304         [AC_MSG_ERROR(yes)])
6305     AC_LANG_POP([C++])
6308 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6309 save_CXXFLAGS=$CXXFLAGS
6310 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6311 AC_LANG_PUSH([C++])
6313 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6314 #include <stddef.h>
6316 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6318 namespace
6320         struct b
6321         {
6322                 int i;
6323                 int j;
6324         };
6326 ]], [[
6327 struct a
6329         int i;
6330         int j;
6332 a thinga[]={{0,0}, {1,1}};
6333 b thingb[]={{0,0}, {1,1}};
6334 size_t i = sizeof(sal_n_array_size(thinga));
6335 size_t j = sizeof(sal_n_array_size(thingb));
6336 return !(i != 0 && j != 0);
6338     ], [ AC_MSG_RESULT(yes) ],
6339     [ AC_MSG_ERROR(no)])
6340 AC_LANG_POP([C++])
6341 CXXFLAGS=$save_CXXFLAGS
6343 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6344 save_CXXFLAGS=$CXXFLAGS
6345 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6346 AC_LANG_PUSH([C++])
6347 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6348     // A somewhat over-complicated way of checking for
6349     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6350     // in constexpr function":
6351     #include <cassert>
6352     template<typename T> inline constexpr T f(T x) { return x; }
6353     template<typename T> inline constexpr T g(T x) {
6354         assert(f(static_cast<int>(x)));
6355         return x;
6356     }
6357     enum E { e };
6358     auto v = g(E::e);
6360     struct S {
6361         int n_;
6362         constexpr bool f() {
6363             int n = n_;
6364             int i = 0;
6365             while (n > 0) { --n; ++i; }
6366             assert(i >= 0);
6367             return i == 0;
6368         }
6369     };
6370     constexpr auto v2 = S{10}.f();
6371     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6372 AC_LANG_POP([C++])
6373 CXXFLAGS=$save_CXXFLAGS
6374 AC_MSG_RESULT([$cxx14_constexpr])
6375 if test "$cxx14_constexpr" = yes; then
6376     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6379 dnl _Pragma support (may require C++11)
6380 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6381     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6382     AC_LANG_PUSH([C++])
6383     save_CXXFLAGS=$CXXFLAGS
6384     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6385     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6386             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6387         ])], [
6388             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6389             AC_MSG_RESULT([yes])
6390         ], [AC_MSG_RESULT([no])])
6391     AC_LANG_POP([C++])
6392     CXXFLAGS=$save_CXXFLAGS
6395 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6396 if test "$GCC" = yes; then
6397     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6398     AC_LANG_PUSH([C++])
6399     save_CXXFLAGS=$CXXFLAGS
6400     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6401     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6402     CXXFLAGS=$save_CXXFLAGS
6403     AC_LANG_POP([C++])
6404     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6405         AC_MSG_RESULT([yes])
6406     else
6407         AC_MSG_RESULT([no])
6408     fi
6410 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6412 AC_MSG_CHECKING([[whether $CXX supports [[fallthrough]]]])
6413 AC_LANG_PUSH([C++])
6414 save_CXXFLAGS=$CXXFLAGS
6415 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6416 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6417 if test "$COM" = MSC; then
6418     CXXFLAGS="$CXXFLAGS /we5030"
6419 else
6420     CXXFLAGS="$CXXFLAGS -Werror"
6422 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6423         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6424         // by checking for __cplusplus:
6425         #if __cplusplus > 201703L
6426         #if !__has_cpp_attribute(fallthrough)
6427         #error
6428         #endif
6429         #else
6430         void f(int & x) {
6431             switch (x) {
6432             case 0:
6433                 ++x;
6434                 [[fallthrough]];
6435             default:
6436                 ++x;
6437             }
6438         }
6439         #endif
6440     ]])], [
6441         AC_DEFINE([HAVE_CPP_ATTRIBUTE_FALLTHROUGH],[1])
6442         AC_MSG_RESULT([yes])
6443     ], [AC_MSG_RESULT([no])])
6444 CXXFLAGS=$save_CXXFLAGS
6445 AC_LANG_POP([C++])
6447 AC_MSG_CHECKING([[whether $CXX supports [[nodiscard]]]])
6448 AC_LANG_PUSH([C++])
6449 save_CXXFLAGS=$CXXFLAGS
6450 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6451 dnl Unknown attributes must be ignored by compilers, but they do emit warnings about them:
6452 if test "$COM" = MSC; then
6453     CXXFLAGS="$CXXFLAGS /we5030"
6454 else
6455     CXXFLAGS="$CXXFLAGS -Werror"
6457 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6458         // There appears to be no feature-test macro for __has_cpp_attribute in C++2a, approximate
6459         // by checking for __cplusplus:
6460         #if __cplusplus > 201703L
6461         #if !__has_cpp_attribute(nodiscard)
6462         #error
6463         #endif
6464         #else
6465         [[nodiscard]] int f();
6466         #endif
6467     ]])], [
6468         AC_DEFINE([HAVE_CPP_ATTRIBUTE_NODISCARD],[1])
6469         AC_MSG_RESULT([yes])
6470     ], [AC_MSG_RESULT([no])])
6471 CXXFLAGS=$save_CXXFLAGS
6472 AC_LANG_POP([C++])
6474 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6475 AC_LANG_PUSH([C++])
6476 save_CXXFLAGS=$CXXFLAGS
6477 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6478 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6479         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6480         // supporting it:
6481         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6482         struct S {
6483         private:
6484             S(S const &);
6485         public:
6486             S();
6487             ~S();
6488         };
6489         S copy();
6490         void f() { S c(copy()); }
6491         #endif
6492     ])], [
6493         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6494         AC_MSG_RESULT([yes])
6495     ], [AC_MSG_RESULT([no])])
6496 CXXFLAGS=$save_CXXFLAGS
6497 AC_LANG_POP([C++])
6499 AC_MSG_CHECKING([whether $CXX has a fix for CWG1579])
6500 AC_LANG_PUSH([C++])
6501 save_CXXFLAGS=$CXXFLAGS
6502 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6503 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6504         #include <memory>
6505         struct S1 {};
6506         struct S2: S1 {};
6507         std::unique_ptr<S1> f() {
6508             std::unique_ptr<S2> s2(new S2);
6509             return s2;
6510         }
6511     ])], [
6512         AC_DEFINE([HAVE_CXX_CWG1579_FIX],[1])
6513         AC_MSG_RESULT([yes])
6514     ], [AC_MSG_RESULT([no])])
6515 CXXFLAGS=$save_CXXFLAGS
6516 AC_LANG_POP([C++])
6518 AC_MSG_CHECKING([whether $CXX has GCC bug 87150])
6519 AC_LANG_PUSH([C++])
6520 save_CXXFLAGS=$CXXFLAGS
6521 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6522 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6523         struct S1 { S1(S1 &&); };
6524         struct S2: S1 {};
6525         S1 f(S2 s) { return s; }
6526     ])], [
6527         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6528         AC_MSG_RESULT([yes])
6529     ], [AC_MSG_RESULT([no])])
6530 CXXFLAGS=$save_CXXFLAGS
6531 AC_LANG_POP([C++])
6533 dnl ===================================================================
6534 dnl system stl sanity tests
6535 dnl ===================================================================
6536 if test "$_os" != "WINNT"; then
6538     AC_LANG_PUSH([C++])
6540     save_CPPFLAGS="$CPPFLAGS"
6541     if test -n "$MACOSX_SDK_PATH"; then
6542         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6543     fi
6545     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6546     # only.
6547     if test "$CPP_LIBRARY" = GLIBCXX; then
6548         dnl gcc#19664, gcc#22482, rhbz#162935
6549         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6550         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6551         AC_MSG_RESULT([$stlvisok])
6552         if test "$stlvisok" = "no"; then
6553             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6554         fi
6555     fi
6557     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6558     # when we don't make any dynamic libraries?
6559     if test "$DISABLE_DYNLOADING" = ""; then
6560         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6561         cat > conftestlib1.cc <<_ACEOF
6562 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6563 struct S2: S1<int> { virtual ~S2(); };
6564 S2::~S2() {}
6565 _ACEOF
6566         cat > conftestlib2.cc <<_ACEOF
6567 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6568 struct S2: S1<int> { virtual ~S2(); };
6569 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6570 _ACEOF
6571         gccvisinlineshiddenok=yes
6572         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6573             gccvisinlineshiddenok=no
6574         else
6575             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6576             dnl known to not work with -z defs (unsetting which makes the test
6577             dnl moot, though):
6578             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6579             if test "$COM_IS_CLANG" = TRUE; then
6580                 for i in $CXX $CXXFLAGS; do
6581                     case $i in
6582                     -fsanitize=*)
6583                         my_linkflagsnoundefs=
6584                         break
6585                         ;;
6586                     esac
6587                 done
6588             fi
6589             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6590                 gccvisinlineshiddenok=no
6591             fi
6592         fi
6594         rm -fr libconftest*
6595         AC_MSG_RESULT([$gccvisinlineshiddenok])
6596         if test "$gccvisinlineshiddenok" = "no"; then
6597             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6598         fi
6599     fi
6601    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6602     cat >visibility.cxx <<_ACEOF
6603 #pragma GCC visibility push(hidden)
6604 struct __attribute__ ((visibility ("default"))) TestStruct {
6605   static void Init();
6607 __attribute__ ((visibility ("default"))) void TestFunc() {
6608   TestStruct::Init();
6610 _ACEOF
6611     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6612         gccvisbroken=yes
6613     else
6614         case "$host_cpu" in
6615         i?86|x86_64)
6616             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6617                 gccvisbroken=no
6618             else
6619                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6620                     gccvisbroken=no
6621                 else
6622                     gccvisbroken=yes
6623                 fi
6624             fi
6625             ;;
6626         *)
6627             gccvisbroken=no
6628             ;;
6629         esac
6630     fi
6631     rm -f visibility.s visibility.cxx
6633     AC_MSG_RESULT([$gccvisbroken])
6634     if test "$gccvisbroken" = "yes"; then
6635         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6636     fi
6638     CPPFLAGS="$save_CPPFLAGS"
6640     AC_LANG_POP([C++])
6643 dnl ===================================================================
6644 dnl  Clang++ tests
6645 dnl ===================================================================
6647 HAVE_GCC_FNO_DEFAULT_INLINE=
6648 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6649 if test "$GCC" = "yes"; then
6650     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6651     AC_LANG_PUSH([C++])
6652     save_CXXFLAGS=$CXXFLAGS
6653     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6654     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6655     CXXFLAGS=$save_CXXFLAGS
6656     AC_LANG_POP([C++])
6657     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6658         AC_MSG_RESULT([yes])
6659     else
6660         AC_MSG_RESULT([no])
6661     fi
6663     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6664     AC_LANG_PUSH([C++])
6665     save_CXXFLAGS=$CXXFLAGS
6666     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6667     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6668     CXXFLAGS=$save_CXXFLAGS
6669     AC_LANG_POP([C++])
6670     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6671         AC_MSG_RESULT([yes])
6672     else
6673         AC_MSG_RESULT([no])
6674     fi
6676 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6677 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6679 dnl ===================================================================
6680 dnl Compiler plugins
6681 dnl ===================================================================
6683 COMPILER_PLUGINS=
6684 # currently only Clang
6686 if test "$COM_IS_CLANG" != "TRUE"; then
6687     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6688         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6689         enable_compiler_plugins=no
6690     fi
6693 if test "$COM_IS_CLANG" = "TRUE"; then
6694     if test -n "$enable_compiler_plugins"; then
6695         compiler_plugins="$enable_compiler_plugins"
6696     elif test -n "$ENABLE_DBGUTIL"; then
6697         compiler_plugins=test
6698     else
6699         compiler_plugins=no
6700     fi
6701     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6702         if test "$compiler_plugins" = yes; then
6703             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6704         else
6705             compiler_plugins=no
6706         fi
6707     fi
6708     if test "$compiler_plugins" != "no"; then
6709         dnl The prefix where Clang resides, override to where Clang resides if
6710         dnl using a source build:
6711         if test -z "$CLANGDIR"; then
6712             CLANGDIR=/usr
6713         fi
6714         AC_LANG_PUSH([C++])
6715         save_CPPFLAGS=$CPPFLAGS
6716         save_CXX=$CXX
6717         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6718         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
6719         CXX=$COMPILER_PLUGINS_CXX
6720         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6721         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6722             [COMPILER_PLUGINS=TRUE],
6723             [
6724             if test "$compiler_plugins" = "yes"; then
6725                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6726             else
6727                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6728                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6729             fi
6730             ])
6731         CXX=$save_CXX
6732         CPPFLAGS=$save_CPPFLAGS
6733         AC_LANG_POP([C++])
6734     fi
6735 else
6736     if test "$enable_compiler_plugins" = "yes"; then
6737         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6738     fi
6740 AC_SUBST(COMPILER_PLUGINS)
6741 AC_SUBST(COMPILER_PLUGINS_CXX)
6742 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6743 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6744 AC_SUBST(CLANGDIR)
6745 AC_SUBST(CLANGLIBDIR)
6747 # Plugin to help linker.
6748 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6749 # This makes --enable-lto build with clang work.
6750 AC_SUBST(LD_PLUGIN)
6752 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6753 AC_SUBST(HAVE_POSIX_FALLOCATE)
6755 dnl ===================================================================
6756 dnl Custom build version
6757 dnl ===================================================================
6759 AC_MSG_CHECKING([whether to add custom build version])
6760 if test "$with_build_version" != ""; then
6761     BUILD_VER_STRING=$with_build_version
6762     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6763 else
6764     BUILD_VER_STRING=
6765     AC_MSG_RESULT([no])
6767 AC_SUBST(BUILD_VER_STRING)
6769 JITC_PROCESSOR_TYPE=""
6770 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6771     # IBMs JDK needs this...
6772     JITC_PROCESSOR_TYPE=6
6773     export JITC_PROCESSOR_TYPE
6775 AC_SUBST([JITC_PROCESSOR_TYPE])
6777 # Misc Windows Stuff
6778 AC_ARG_WITH(ucrt-dir,
6779     AS_HELP_STRING([--with-ucrt-dir],
6780         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6781         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6782         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6783             Windows6.1-KB2999226-x64.msu
6784             Windows6.1-KB2999226-x86.msu
6785             Windows8.1-KB2999226-x64.msu
6786             Windows8.1-KB2999226-x86.msu
6787             Windows8-RT-KB2999226-x64.msu
6788             Windows8-RT-KB2999226-x86.msu
6789         A zip archive including those files is available from Microsoft site:
6790         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6792 UCRT_REDISTDIR="$with_ucrt_dir"
6793 if test $_os = "WINNT"; then
6794     find_msvc_x64_dlls
6795     find_msms
6796     MSVC_DLL_PATH="$msvcdllpath"
6797     MSVC_DLLS="$msvcdlls"
6798     MSM_PATH="$msmdir"
6799     # MSVC 15.3 changed it to VC141
6800     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6801         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6802     else
6803         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6804     fi
6805     if test "$UCRT_REDISTDIR" = "no"; then
6806         dnl explicitly disabled
6807         UCRT_REDISTDIR=""
6808     else
6809         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6810                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6811                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6812                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6813                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6814                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6815             UCRT_REDISTDIR=""
6816             if test -n "$PKGFORMAT"; then
6817                for i in $PKGFORMAT; do
6818                    case "$i" in
6819                    msi)
6820                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6821                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6822                        ;;
6823                    esac
6824                done
6825             fi
6826         fi
6827     fi
6830 AC_SUBST(UCRT_REDISTDIR)
6831 AC_SUBST(MSVC_DLL_PATH)
6832 AC_SUBST(MSVC_DLLS)
6833 AC_SUBST(MSM_PATH)
6835 dnl ===================================================================
6836 dnl Checks for Java
6837 dnl ===================================================================
6838 if test "$ENABLE_JAVA" != ""; then
6840     # Windows-specific tests
6841     if test "$build_os" = "cygwin"; then
6842         if test "$BITNESS_OVERRIDE" = 64; then
6843             bitness=64
6844         else
6845             bitness=32
6846         fi
6848         if test -z "$with_jdk_home"; then
6849             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6850             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6851             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6852             if test -n "$regvalue"; then
6853                 ver=$regvalue
6854                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6855                 _jdk_home=$regvalue
6856             fi
6857             if test -z "$with_jdk_home"; then
6858                 for ver in 1.8 1.7 1.6; do
6859                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6860                     if test -n "$regvalue"; then
6861                         _jdk_home=$regvalue
6862                         break
6863                     fi
6864                 done
6865             fi
6866             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6867                 with_jdk_home="$_jdk_home"
6868                 howfound="found automatically"
6869             else
6870                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6871             fi
6872         else
6873             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6874             howfound="you passed"
6875         fi
6876     fi
6878     # 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.
6879     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6880     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6881         with_jdk_home=`/usr/libexec/java_home`
6882     fi
6884     JAVA_HOME=; export JAVA_HOME
6885     if test -z "$with_jdk_home"; then
6886         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6887     else
6888         _java_path="$with_jdk_home/bin/$with_java"
6889         dnl Check if there is a Java interpreter at all.
6890         if test -x "$_java_path"; then
6891             JAVAINTERPRETER=$_java_path
6892         else
6893             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6894         fi
6895     fi
6897     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6898     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6899     dnl loaded by java to run JunitTests:
6900     if test "$build_os" = "cygwin"; then
6901         shortjdkhome=`cygpath -d "$with_jdk_home"`
6902         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
6903             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6904             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6905         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
6906             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6907             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6908         fi
6910         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6911             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6912         fi
6913         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6914     elif test "$cross_compiling" != "yes"; then
6915         case $CPUNAME in
6916             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6917                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6918                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6919                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6920                 fi
6921                 ;;
6922             *) # assumption: everything else 32-bit
6923                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6924                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6925                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6926                 fi
6927                 ;;
6928         esac
6929     fi
6932 HAVE_JAVA9=
6933 dnl ===================================================================
6934 dnl Checks for JDK.
6935 dnl ===================================================================
6937 # Note that JAVA_HOME as for now always means the *build* platform's
6938 # JAVA_HOME. Whether all the complexity here actually is needed any
6939 # more or not, no idea.
6941 if test "$ENABLE_JAVA" != ""; then
6942     _gij_longver=0
6943     AC_MSG_CHECKING([the installed JDK])
6944     if test -n "$JAVAINTERPRETER"; then
6945         dnl java -version sends output to stderr!
6946         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6947             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6948         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6949             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6950         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6951             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6952         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6953             JDK=ibm
6955             dnl IBM JDK specific tests
6956             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6957             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6959             if test "$_jdk_ver" -lt 10600; then
6960                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6961             fi
6963             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6965             if test "$with_jdk_home" = ""; then
6966                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6967 you must use the "--with-jdk-home" configure option explicitly])
6968             fi
6970             JAVA_HOME=$with_jdk_home
6971         else
6972             JDK=sun
6974             dnl Sun JDK specific tests
6975             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
6976             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6978             if test "$_jdk_ver" -lt 10600; then
6979                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6980             fi
6981             if test "$_jdk_ver" -gt 10600; then
6982                 JAVA_CLASSPATH_NOT_SET=TRUE
6983             fi
6984             if test "$_jdk_ver" -ge 10900; then
6985                 HAVE_JAVA9=TRUE
6986             fi
6988             AC_MSG_RESULT([checked (JDK $_jdk)])
6989             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6990             if test "$_os" = "WINNT"; then
6991                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6992             fi
6994             # set to limit VM usage for JunitTests
6995             JAVAIFLAGS=-Xmx64M
6996             # set to limit VM usage for javac
6997             JAVAFLAGS=-J-Xmx128M
6998         fi
6999     else
7000         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
7001     fi
7002 else
7003     dnl Java disabled
7004     JAVA_HOME=
7005     export JAVA_HOME
7008 dnl ===================================================================
7009 dnl Set target Java bytecode version
7010 dnl ===================================================================
7011 if test "$ENABLE_JAVA" != ""; then
7012     if test "$HAVE_JAVA9" = "TRUE"; then
7013         _java_target_ver="1.6"
7014     else
7015         _java_target_ver="1.5"
7016     fi
7017     JAVA_SOURCE_VER="$_java_target_ver"
7018     JAVA_TARGET_VER="$_java_target_ver"
7021 dnl ===================================================================
7022 dnl Checks for javac
7023 dnl ===================================================================
7024 if test "$ENABLE_JAVA" != ""; then
7025     javacompiler="javac"
7026     if test -z "$with_jdk_home"; then
7027         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7028     else
7029         _javac_path="$with_jdk_home/bin/$javacompiler"
7030         dnl Check if there is a Java compiler at all.
7031         if test -x "$_javac_path"; then
7032             JAVACOMPILER=$_javac_path
7033         fi
7034     fi
7035     if test -z "$JAVACOMPILER"; then
7036         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7037     fi
7038     if test "$build_os" = "cygwin"; then
7039         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7040             JAVACOMPILER="${JAVACOMPILER}.exe"
7041         fi
7042         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7043     fi
7046 dnl ===================================================================
7047 dnl Checks for javadoc
7048 dnl ===================================================================
7049 if test "$ENABLE_JAVA" != ""; then
7050     if test -z "$with_jdk_home"; then
7051         AC_PATH_PROG(JAVADOC, javadoc)
7052     else
7053         _javadoc_path="$with_jdk_home/bin/javadoc"
7054         dnl Check if there is a javadoc at all.
7055         if test -x "$_javadoc_path"; then
7056             JAVADOC=$_javadoc_path
7057         else
7058             AC_PATH_PROG(JAVADOC, javadoc)
7059         fi
7060     fi
7061     if test -z "$JAVADOC"; then
7062         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7063     fi
7064     if test "$build_os" = "cygwin"; then
7065         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7066             JAVADOC="${JAVADOC}.exe"
7067         fi
7068         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7069     fi
7071     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7072     JAVADOCISGJDOC="yes"
7073     fi
7075 AC_SUBST(JAVADOCISGJDOC)
7077 if test "$ENABLE_JAVA" != ""; then
7078     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7079     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7080         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7081            # try to recover first by looking whether we have a alternatives
7082            # system as in Debian or newer SuSEs where following /usr/bin/javac
7083            # over /etc/alternatives/javac leads to the right bindir where we
7084            # just need to strip a bit away to get a valid JAVA_HOME
7085            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7086         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7087             # maybe only one level of symlink (e.g. on Mac)
7088             JAVA_HOME=$(readlink $JAVACOMPILER)
7089             if test "$(dirname $JAVA_HOME)" = "."; then
7090                 # we've got no path to trim back
7091                 JAVA_HOME=""
7092             fi
7093         else
7094             # else warn
7095             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7096             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7097             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7098             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7099         fi
7100         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7101         if test "$JAVA_HOME" != "/usr"; then
7102             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7103                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7104                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7105                 dnl Tiger already returns a JDK path..
7106                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7107             else
7108                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7109                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7110                 dnl that checks which version to run
7111                 if test -f "$JAVA_HOME"; then
7112                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7113                 fi
7114             fi
7115         fi
7116     fi
7117     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7119     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7120     if test -z "$JAVA_HOME"; then
7121         if test "x$with_jdk_home" = "x"; then
7122             cat > findhome.java <<_ACEOF
7123 [import java.io.File;
7125 class findhome
7127     public static void main(String args[])
7128     {
7129         String jrelocation = System.getProperty("java.home");
7130         File jre = new File(jrelocation);
7131         System.out.println(jre.getParent());
7132     }
7134 _ACEOF
7135             AC_MSG_CHECKING([if javac works])
7136             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7137             AC_TRY_EVAL(javac_cmd)
7138             if test $? = 0 -a -f ./findhome.class; then
7139                 AC_MSG_RESULT([javac works])
7140             else
7141                 echo "configure: javac test failed" >&5
7142                 cat findhome.java >&5
7143                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7144             fi
7145             AC_MSG_CHECKING([if gij knows its java.home])
7146             JAVA_HOME=`$JAVAINTERPRETER findhome`
7147             if test $? = 0 -a "$JAVA_HOME" != ""; then
7148                 AC_MSG_RESULT([$JAVA_HOME])
7149             else
7150                 echo "configure: java test failed" >&5
7151                 cat findhome.java >&5
7152                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7153             fi
7154             # clean-up after ourselves
7155             rm -f ./findhome.java ./findhome.class
7156         else
7157             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7158         fi
7159     fi
7161     # now check if $JAVA_HOME is really valid
7162     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7163         case "${JAVA_HOME}" in
7164             /Library/Java/JavaVirtualMachines/*)
7165                 ;;
7166             *)
7167                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7168                 ;;
7169         esac
7170         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7171             JAVA_HOME_OK="NO"
7172         fi
7173     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7174         JAVA_HOME_OK="NO"
7175     fi
7176     if test "$JAVA_HOME_OK" = "NO"; then
7177         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7178         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7179         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7180         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7181         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7182         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7183     fi
7184     PathFormat "$JAVA_HOME"
7185     JAVA_HOME="$formatted_path"
7188 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7189     "$_os" != Darwin
7190 then
7191     AC_MSG_CHECKING([for JAWT lib])
7192     if test "$_os" = WINNT; then
7193         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7194         JAWTLIB=jawt.lib
7195     else
7196         case "$host_cpu" in
7197         arm*)
7198             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7199             JAVA_ARCH=$my_java_arch
7200             ;;
7201         i*86)
7202             my_java_arch=i386
7203             ;;
7204         m68k)
7205             my_java_arch=m68k
7206             ;;
7207         powerpc)
7208             my_java_arch=ppc
7209             ;;
7210         powerpc64)
7211             my_java_arch=ppc64
7212             ;;
7213         powerpc64le)
7214             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7215             JAVA_ARCH=$my_java_arch
7216             ;;
7217         sparc64)
7218             my_java_arch=sparcv9
7219             ;;
7220         x86_64)
7221             my_java_arch=amd64
7222             ;;
7223         *)
7224             my_java_arch=$host_cpu
7225             ;;
7226         esac
7227         # This is where JDK9 puts the library
7228         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7229             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7230         else
7231             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7232         fi
7233         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7234     fi
7235     AC_MSG_RESULT([$JAWTLIB])
7237 AC_SUBST(JAWTLIB)
7239 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7240     case "$host_os" in
7242     aix*)
7243         JAVAINC="-I$JAVA_HOME/include"
7244         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7245         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7246         ;;
7248     cygwin*)
7249         JAVAINC="-I$JAVA_HOME/include/win32"
7250         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7251         ;;
7253     darwin*)
7254         if test -d "$JAVA_HOME/include/darwin"; then
7255             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7256         else
7257             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7258         fi
7259         ;;
7261     dragonfly*)
7262         JAVAINC="-I$JAVA_HOME/include"
7263         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7264         ;;
7266     freebsd*)
7267         JAVAINC="-I$JAVA_HOME/include"
7268         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7269         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7270         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7271         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7272         ;;
7274     k*bsd*-gnu*)
7275         JAVAINC="-I$JAVA_HOME/include"
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     linux-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     *netbsd*)
7287         JAVAINC="-I$JAVA_HOME/include"
7288         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7289         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7290        ;;
7292     openbsd*)
7293         JAVAINC="-I$JAVA_HOME/include"
7294         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7295         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7296         ;;
7298     solaris*)
7299         JAVAINC="-I$JAVA_HOME/include"
7300         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7301         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7302         ;;
7303     esac
7305 SOLARINC="$SOLARINC $JAVAINC"
7307 AC_SUBST(JAVACOMPILER)
7308 AC_SUBST(JAVADOC)
7309 AC_SUBST(JAVAINTERPRETER)
7310 AC_SUBST(JAVAIFLAGS)
7311 AC_SUBST(JAVAFLAGS)
7312 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7313 AC_SUBST(JAVA_HOME)
7314 AC_SUBST(JAVA_SOURCE_VER)
7315 AC_SUBST(JAVA_TARGET_VER)
7316 AC_SUBST(JDK)
7319 dnl ===================================================================
7320 dnl Export file validation
7321 dnl ===================================================================
7322 AC_MSG_CHECKING([whether to enable export file validation])
7323 if test "$with_export_validation" != "no"; then
7324     if test -z "$ENABLE_JAVA"; then
7325         if test "$with_export_validation" = "yes"; then
7326             AC_MSG_ERROR([requested, but Java is disabled])
7327         else
7328             AC_MSG_RESULT([no, as Java is disabled])
7329         fi
7330     elif test "$_jdk_ver" -lt 10800; then
7331         if test "$with_export_validation" = "yes"; then
7332             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7333         else
7334             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7335         fi
7336     else
7337         AC_MSG_RESULT([yes])
7338         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7340         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7341         if test -z "$ODFVALIDATOR"; then
7342             # remember to download the ODF toolkit with validator later
7343             AC_MSG_NOTICE([no odfvalidator found, will download it])
7344             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7345             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7347             # and fetch name of odfvalidator jar name from download.lst
7348             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7349             AC_SUBST(ODFVALIDATOR_JAR)
7351             if test -z "$ODFVALIDATOR_JAR"; then
7352                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7353             fi
7354         fi
7355         if test "$build_os" = "cygwin"; then
7356             # In case of Cygwin it will be executed from Windows,
7357             # so we need to run bash and absolute path to validator
7358             # so instead of "odfvalidator" it will be
7359             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7360             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7361         else
7362             ODFVALIDATOR="sh $ODFVALIDATOR"
7363         fi
7364         AC_SUBST(ODFVALIDATOR)
7367         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7368         if test -z "$OFFICEOTRON"; then
7369             # remember to download the officeotron with validator later
7370             AC_MSG_NOTICE([no officeotron found, will download it])
7371             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7372             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7374             # and fetch name of officeotron jar name from download.lst
7375             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7376             AC_SUBST(OFFICEOTRON_JAR)
7378             if test -z "$OFFICEOTRON_JAR"; then
7379                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7380             fi
7381         else
7382             # check version of existing officeotron
7383             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7384             if test 0"$OFFICEOTRON_VER" -lt 704; then
7385                 AC_MSG_ERROR([officeotron too old])
7386             fi
7387         fi
7388         if test "$build_os" = "cygwin"; then
7389             # In case of Cygwin it will be executed from Windows,
7390             # so we need to run bash and absolute path to validator
7391             # so instead of "odfvalidator" it will be
7392             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7393             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7394         else
7395             OFFICEOTRON="sh $OFFICEOTRON"
7396         fi
7397     fi
7398     AC_SUBST(OFFICEOTRON)
7399 else
7400     AC_MSG_RESULT([no])
7403 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7404 if test "$with_bffvalidator" != "no"; then
7405     AC_DEFINE(HAVE_BFFVALIDATOR)
7407     if test "$with_export_validation" = "no"; then
7408         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7409     fi
7411     if test "$with_bffvalidator" = "yes"; then
7412         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7413     else
7414         BFFVALIDATOR="$with_bffvalidator"
7415     fi
7417     if test "$build_os" = "cygwin"; then
7418         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7419             AC_MSG_RESULT($BFFVALIDATOR)
7420         else
7421             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7422         fi
7423     elif test -n "$BFFVALIDATOR"; then
7424         # We are not in Cygwin but need to run Windows binary with wine
7425         AC_PATH_PROGS(WINE, wine)
7427         # so swap in a shell wrapper that converts paths transparently
7428         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7429         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7430         AC_SUBST(BFFVALIDATOR_EXE)
7431         AC_MSG_RESULT($BFFVALIDATOR)
7432     else
7433         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7434     fi
7435     AC_SUBST(BFFVALIDATOR)
7436 else
7437     AC_MSG_RESULT([no])
7440 dnl ===================================================================
7441 dnl Check for C preprocessor to use
7442 dnl ===================================================================
7443 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7444 if test -n "$with_idlc_cpp"; then
7445     AC_MSG_RESULT([$with_idlc_cpp])
7446     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7447 else
7448     AC_MSG_RESULT([ucpp])
7449     AC_MSG_CHECKING([which ucpp tp use])
7450     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7451         AC_MSG_RESULT([external])
7452         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7453     else
7454         AC_MSG_RESULT([internal])
7455         BUILD_TYPE="$BUILD_TYPE UCPP"
7456     fi
7458 AC_SUBST(SYSTEM_UCPP)
7460 dnl ===================================================================
7461 dnl Check for epm (not needed for Windows)
7462 dnl ===================================================================
7463 AC_MSG_CHECKING([whether to enable EPM for packing])
7464 if test "$enable_epm" = "yes"; then
7465     AC_MSG_RESULT([yes])
7466     if test "$_os" != "WINNT"; then
7467         if test $_os = Darwin; then
7468             EPM=internal
7469         elif test -n "$with_epm"; then
7470             EPM=$with_epm
7471         else
7472             AC_PATH_PROG(EPM, epm, no)
7473         fi
7474         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7475             AC_MSG_NOTICE([EPM will be built.])
7476             BUILD_TYPE="$BUILD_TYPE EPM"
7477             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7478         else
7479             # Gentoo has some epm which is something different...
7480             AC_MSG_CHECKING([whether the found epm is the right epm])
7481             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7482                 AC_MSG_RESULT([yes])
7483             else
7484                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7485             fi
7486             AC_MSG_CHECKING([epm version])
7487             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7488             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7489                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7490                 AC_MSG_RESULT([OK, >= 3.7])
7491             else
7492                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7493                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7494             fi
7495         fi
7496     fi
7498     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7499         AC_MSG_CHECKING([for rpm])
7500         for a in "$RPM" rpmbuild rpm; do
7501             $a --usage >/dev/null 2> /dev/null
7502             if test $? -eq 0; then
7503                 RPM=$a
7504                 break
7505             else
7506                 $a --version >/dev/null 2> /dev/null
7507                 if test $? -eq 0; then
7508                     RPM=$a
7509                     break
7510                 fi
7511             fi
7512         done
7513         if test -z "$RPM"; then
7514             AC_MSG_ERROR([not found])
7515         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7516             RPM_PATH=`which $RPM`
7517             AC_MSG_RESULT([$RPM_PATH])
7518             SCPDEFS="$SCPDEFS -DWITH_RPM"
7519         else
7520             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7521         fi
7522     fi
7523     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7524         AC_PATH_PROG(DPKG, dpkg, no)
7525         if test "$DPKG" = "no"; then
7526             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7527         fi
7528     fi
7529     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7530        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7531         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7532             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7533                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7534                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7535                     AC_MSG_RESULT([yes])
7536                 else
7537                     AC_MSG_RESULT([no])
7538                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7539                         _pt="rpm"
7540                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7541                         add_warning "the rpms will need to be installed with --nodeps"
7542                     else
7543                         _pt="pkg"
7544                     fi
7545                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7546                     add_warning "the ${_pt}s will not be relocatable"
7547                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7548                                  relocation will work, you need to patch your epm with the
7549                                  patch in epm/epm-3.7.patch or build with
7550                                  --with-epm=internal which will build a suitable epm])
7551                 fi
7552             fi
7553         fi
7554     fi
7555     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7556         AC_PATH_PROG(PKGMK, pkgmk, no)
7557         if test "$PKGMK" = "no"; then
7558             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7559         fi
7560     fi
7561     AC_SUBST(RPM)
7562     AC_SUBST(DPKG)
7563     AC_SUBST(PKGMK)
7564 else
7565     for i in $PKGFORMAT; do
7566         case "$i" in
7567         aix | bsd | deb | pkg | rpm | native | portable)
7568             AC_MSG_ERROR(
7569                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7570             ;;
7571         esac
7572     done
7573     AC_MSG_RESULT([no])
7574     EPM=NO
7576 AC_SUBST(EPM)
7578 ENABLE_LWP=
7579 if test "$enable_lotuswordpro" = "yes"; then
7580     ENABLE_LWP="TRUE"
7582 AC_SUBST(ENABLE_LWP)
7584 dnl ===================================================================
7585 dnl Check for building ODK
7586 dnl ===================================================================
7587 if test "$enable_odk" = no; then
7588     unset DOXYGEN
7589 else
7590     if test "$with_doxygen" = no; then
7591         AC_MSG_CHECKING([for doxygen])
7592         unset DOXYGEN
7593         AC_MSG_RESULT([no])
7594     else
7595         if test "$with_doxygen" = yes; then
7596             AC_PATH_PROG([DOXYGEN], [doxygen])
7597             if test -z "$DOXYGEN"; then
7598                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7599             fi
7600             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7601                 if ! dot -V 2>/dev/null; then
7602                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7603                 fi
7604             fi
7605         else
7606             AC_MSG_CHECKING([for doxygen])
7607             DOXYGEN=$with_doxygen
7608             AC_MSG_RESULT([$DOXYGEN])
7609         fi
7610         if test -n "$DOXYGEN"; then
7611             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7612             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7613             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7614                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7615             fi
7616         fi
7617     fi
7619 AC_SUBST([DOXYGEN])
7621 AC_MSG_CHECKING([whether to build the ODK])
7622 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7623     AC_MSG_RESULT([yes])
7625     if test "$with_java" != "no"; then
7626         AC_MSG_CHECKING([whether to build unowinreg.dll])
7627         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7628             # build on Win by default
7629             enable_build_unowinreg=yes
7630         fi
7631         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7632             AC_MSG_RESULT([no])
7633             BUILD_UNOWINREG=
7634         else
7635             AC_MSG_RESULT([yes])
7636             BUILD_UNOWINREG=TRUE
7637         fi
7638         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7639             if test -z "$with_mingw_cross_compiler"; then
7640                 dnl Guess...
7641                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7642             elif test -x "$with_mingw_cross_compiler"; then
7643                  MINGWCXX="$with_mingw_cross_compiler"
7644             else
7645                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7646             fi
7648             if test "$MINGWCXX" = "false"; then
7649                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7650             fi
7652             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7653             if test -x "$mingwstrip_test"; then
7654                 MINGWSTRIP="$mingwstrip_test"
7655             else
7656                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7657             fi
7659             if test "$MINGWSTRIP" = "false"; then
7660                 AC_MSG_ERROR(MinGW32 binutils not found.)
7661             fi
7662         fi
7663     fi
7664     BUILD_TYPE="$BUILD_TYPE ODK"
7665 else
7666     AC_MSG_RESULT([no])
7667     BUILD_UNOWINREG=
7669 AC_SUBST(BUILD_UNOWINREG)
7670 AC_SUBST(MINGWCXX)
7671 AC_SUBST(MINGWSTRIP)
7673 dnl ===================================================================
7674 dnl Check for system zlib
7675 dnl ===================================================================
7676 if test "$with_system_zlib" = "auto"; then
7677     case "$_os" in
7678     WINNT)
7679         with_system_zlib="$with_system_libs"
7680         ;;
7681     *)
7682         if test "$enable_fuzzers" != "yes"; then
7683             with_system_zlib=yes
7684         else
7685             with_system_zlib=no
7686         fi
7687         ;;
7688     esac
7691 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7692 dnl and has no pkg-config for it at least on some tinderboxes,
7693 dnl so leaving that out for now
7694 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7695 AC_MSG_CHECKING([which zlib to use])
7696 if test "$with_system_zlib" = "yes"; then
7697     AC_MSG_RESULT([external])
7698     SYSTEM_ZLIB=TRUE
7699     AC_CHECK_HEADER(zlib.h, [],
7700         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7701     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7702         [AC_MSG_ERROR(zlib not found or functional)], [])
7703 else
7704     AC_MSG_RESULT([internal])
7705     SYSTEM_ZLIB=
7706     BUILD_TYPE="$BUILD_TYPE ZLIB"
7707     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7708     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7710 AC_SUBST(ZLIB_CFLAGS)
7711 AC_SUBST(ZLIB_LIBS)
7712 AC_SUBST(SYSTEM_ZLIB)
7714 dnl ===================================================================
7715 dnl Check for system jpeg
7716 dnl ===================================================================
7717 AC_MSG_CHECKING([which libjpeg to use])
7718 if test "$with_system_jpeg" = "yes"; then
7719     AC_MSG_RESULT([external])
7720     SYSTEM_LIBJPEG=TRUE
7721     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7722         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7723     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7724         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7725 else
7726     SYSTEM_LIBJPEG=
7727     AC_MSG_RESULT([internal, libjpeg-turbo])
7728     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7729     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7730     if test "$COM" = "MSC"; then
7731         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7732     else
7733         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7734     fi
7736     case "$host_cpu" in
7737     x86_64 | amd64 | i*86 | x86 | ia32)
7738         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7739         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7740             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7741                 NASM="$LODE_HOME/opt/bin/nasm"
7742             elif test -x "/opt/lo/bin/nasm"; then
7743                 NASM="/opt/lo/bin/nasm"
7744             fi
7745         fi
7747         if test -n "$NASM"; then
7748             AC_MSG_CHECKING([for object file format of host system])
7749             case "$host_os" in
7750               cygwin* | mingw* | pw32* | interix*)
7751                 case "$host_cpu" in
7752                   x86_64)
7753                     objfmt='Win64-COFF'
7754                     ;;
7755                   *)
7756                     objfmt='Win32-COFF'
7757                     ;;
7758                 esac
7759               ;;
7760               msdosdjgpp* | go32*)
7761                 objfmt='COFF'
7762               ;;
7763               os2-emx*)                 # not tested
7764                 objfmt='MSOMF'          # obj
7765               ;;
7766               linux*coff* | linux*oldld*)
7767                 objfmt='COFF'           # ???
7768               ;;
7769               linux*aout*)
7770                 objfmt='a.out'
7771               ;;
7772               linux*)
7773                 case "$host_cpu" in
7774                   x86_64)
7775                     objfmt='ELF64'
7776                     ;;
7777                   *)
7778                     objfmt='ELF'
7779                     ;;
7780                 esac
7781               ;;
7782               kfreebsd* | freebsd* | netbsd* | openbsd*)
7783                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7784                   objfmt='BSD-a.out'
7785                 else
7786                   case "$host_cpu" in
7787                     x86_64 | amd64)
7788                       objfmt='ELF64'
7789                       ;;
7790                     *)
7791                       objfmt='ELF'
7792                       ;;
7793                   esac
7794                 fi
7795               ;;
7796               solaris* | sunos* | sysv* | sco*)
7797                 case "$host_cpu" in
7798                   x86_64)
7799                     objfmt='ELF64'
7800                     ;;
7801                   *)
7802                     objfmt='ELF'
7803                     ;;
7804                 esac
7805               ;;
7806               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7807                 case "$host_cpu" in
7808                   x86_64)
7809                     objfmt='Mach-O64'
7810                     ;;
7811                   *)
7812                     objfmt='Mach-O'
7813                     ;;
7814                 esac
7815               ;;
7816               *)
7817                 objfmt='ELF ?'
7818               ;;
7819             esac
7821             AC_MSG_RESULT([$objfmt])
7822             if test "$objfmt" = 'ELF ?'; then
7823               objfmt='ELF'
7824               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7825             fi
7827             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7828             case "$objfmt" in
7829               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7830               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7831               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7832               COFF)       NAFLAGS='-fcoff -DCOFF';;
7833               a.out)      NAFLAGS='-faout -DAOUT';;
7834               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7835               ELF)        NAFLAGS='-felf -DELF';;
7836               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7837               RDF)        NAFLAGS='-frdf -DRDF';;
7838               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7839               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7840             esac
7841             AC_MSG_RESULT([$NAFLAGS])
7843             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7844             cat > conftest.asm << EOF
7845             [%line __oline__ "configure"
7846                     section .text
7847                     global  _main,main
7848             _main:
7849             main:   xor     eax,eax
7850                     ret
7851             ]
7853             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7854             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7855               AC_MSG_RESULT(yes)
7856             else
7857               echo "configure: failed program was:" >&AC_FD_CC
7858               cat conftest.asm >&AC_FD_CC
7859               rm -rf conftest*
7860               AC_MSG_RESULT(no)
7861               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7862               NASM=""
7863             fi
7865         fi
7867         if test -z "$NASM"; then
7868 cat << _EOS
7869 ****************************************************************************
7870 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7871 To get one please:
7873 _EOS
7874             if test "$build_os" = "cygwin"; then
7875 cat << _EOS
7876 install a pre-compiled binary for Win32
7878 mkdir -p /opt/lo/bin
7879 cd /opt/lo/bin
7880 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7881 chmod +x nasm
7883 or get and install one from http://www.nasm.us/
7885 Then re-run autogen.sh
7887 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7888 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7890 _EOS
7891             else
7892 cat << _EOS
7893 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7895 _EOS
7896             fi
7897             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7898             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7899         fi
7900       ;;
7901     esac
7904 AC_SUBST(NASM)
7905 AC_SUBST(LIBJPEG_CFLAGS)
7906 AC_SUBST(LIBJPEG_LIBS)
7907 AC_SUBST(SYSTEM_LIBJPEG)
7909 dnl ===================================================================
7910 dnl Check for system clucene
7911 dnl ===================================================================
7912 dnl we should rather be using
7913 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7914 dnl but the contribs-lib check seems tricky
7915 AC_MSG_CHECKING([which clucene to use])
7916 if test "$with_system_clucene" = "yes"; then
7917     AC_MSG_RESULT([external])
7918     SYSTEM_CLUCENE=TRUE
7919     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7920     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7921     FilterLibs "${CLUCENE_LIBS}"
7922     CLUCENE_LIBS="${filteredlibs}"
7923     AC_LANG_PUSH([C++])
7924     save_CXXFLAGS=$CXXFLAGS
7925     save_CPPFLAGS=$CPPFLAGS
7926     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7927     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7928     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7929     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7930     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7931                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7932     CXXFLAGS=$save_CXXFLAGS
7933     CPPFLAGS=$save_CPPFLAGS
7934     AC_LANG_POP([C++])
7936     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7937 else
7938     AC_MSG_RESULT([internal])
7939     SYSTEM_CLUCENE=
7940     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7942 AC_SUBST(SYSTEM_CLUCENE)
7943 AC_SUBST(CLUCENE_CFLAGS)
7944 AC_SUBST(CLUCENE_LIBS)
7946 dnl ===================================================================
7947 dnl Check for system expat
7948 dnl ===================================================================
7949 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7951 dnl ===================================================================
7952 dnl Check for system xmlsec
7953 dnl ===================================================================
7954 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7956 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7957 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7958     ENABLE_EOT="TRUE"
7959     AC_DEFINE([ENABLE_EOT])
7960     AC_MSG_RESULT([yes])
7962     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7963 else
7964     ENABLE_EOT=
7965     AC_MSG_RESULT([no])
7967 AC_SUBST([ENABLE_EOT])
7969 dnl ===================================================================
7970 dnl Check for DLP libs
7971 dnl ===================================================================
7972 AS_IF([test "$COM" = "MSC"],
7973       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7974       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7976 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7978 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7980 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7982 AS_IF([test "$COM" = "MSC"],
7983       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7984       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7986 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7988 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7990 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7991 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
7993 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7995 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7997 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7999 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8000 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
8002 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8003 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8005 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8007 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8008 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8010 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8012 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8014 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8016 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8018 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8019 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8021 dnl ===================================================================
8022 dnl Check for system lcms2
8023 dnl ===================================================================
8024 if test "$with_system_lcms2" != "yes"; then
8025     SYSTEM_LCMS2=
8027 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8028 if test "$GCC" = "yes"; then
8029     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8031 if test "$COM" = "MSC"; then # override the above
8032     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8035 dnl ===================================================================
8036 dnl Check for system cppunit
8037 dnl ===================================================================
8038 if test "$_os" != "Android" ; then
8039     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8042 dnl ===================================================================
8043 dnl Check whether freetype is available
8044 dnl ===================================================================
8045 if test  "$test_freetype" = "yes"; then
8046     AC_MSG_CHECKING([whether freetype is available])
8047     # FreeType has 3 different kinds of versions
8048     # * release, like 2.4.10
8049     # * libtool, like 13.0.7 (this what pkg-config returns)
8050     # * soname
8051     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8052     #
8053     # 9.9.3 is 2.2.0
8054     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8055     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8056     FilterLibs "${FREETYPE_LIBS}"
8057     FREETYPE_LIBS="${filteredlibs}"
8058     SYSTEM_FREETYPE=TRUE
8059 else
8060     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8061     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8063 AC_SUBST(FREETYPE_CFLAGS)
8064 AC_SUBST(FREETYPE_LIBS)
8065 AC_SUBST([SYSTEM_FREETYPE])
8067 # ===================================================================
8068 # Check for system libxslt
8069 # to prevent incompatibilities between internal libxml2 and external libxslt,
8070 # or vice versa, use with_system_libxml here
8071 # ===================================================================
8072 if test "$with_system_libxml" = "auto"; then
8073     case "$_os" in
8074     WINNT|iOS|Android)
8075         with_system_libxml="$with_system_libs"
8076         ;;
8077     *)
8078         if test "$enable_fuzzers" != "yes"; then
8079             with_system_libxml=yes
8080         else
8081             with_system_libxml=no
8082         fi
8083         ;;
8084     esac
8087 AC_MSG_CHECKING([which libxslt to use])
8088 if test "$with_system_libxml" = "yes"; then
8089     AC_MSG_RESULT([external])
8090     SYSTEM_LIBXSLT=TRUE
8091     if test "$_os" = "Darwin"; then
8092         dnl make sure to use SDK path
8093         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8094         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8095         dnl omit -L/usr/lib
8096         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8097         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8098     else
8099         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8100         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8101         FilterLibs "${LIBXSLT_LIBS}"
8102         LIBXSLT_LIBS="${filteredlibs}"
8103         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8104         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8105         FilterLibs "${LIBEXSLT_LIBS}"
8106         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8107     fi
8109     dnl Check for xsltproc
8110     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8111     if test "$XSLTPROC" = "no"; then
8112         AC_MSG_ERROR([xsltproc is required])
8113     fi
8114 else
8115     AC_MSG_RESULT([internal])
8116     SYSTEM_LIBXSLT=
8117     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8119     if test "$cross_compiling" = "yes"; then
8120         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8121         if test "$XSLTPROC" = "no"; then
8122             AC_MSG_ERROR([xsltproc is required])
8123         fi
8124     fi
8126 AC_SUBST(SYSTEM_LIBXSLT)
8127 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8128     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8130 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8132 AC_SUBST(LIBEXSLT_CFLAGS)
8133 AC_SUBST(LIBEXSLT_LIBS)
8134 AC_SUBST(LIBXSLT_CFLAGS)
8135 AC_SUBST(LIBXSLT_LIBS)
8136 AC_SUBST(XSLTPROC)
8138 # ===================================================================
8139 # Check for system libxml
8140 # ===================================================================
8141 AC_MSG_CHECKING([which libxml to use])
8142 if test "$with_system_libxml" = "yes"; then
8143     AC_MSG_RESULT([external])
8144     SYSTEM_LIBXML=TRUE
8145     if test "$_os" = "Darwin"; then
8146         dnl make sure to use SDK path
8147         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8148         dnl omit -L/usr/lib
8149         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8150     elif test $_os = iOS; then
8151         dnl make sure to use SDK path
8152         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8153         LIBXML_CFLAGS="-I$usr/include/libxml2"
8154         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8155     else
8156         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8157         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8158         FilterLibs "${LIBXML_LIBS}"
8159         LIBXML_LIBS="${filteredlibs}"
8160     fi
8162     dnl Check for xmllint
8163     AC_PATH_PROG(XMLLINT, xmllint, no)
8164     if test "$XMLLINT" = "no"; then
8165         AC_MSG_ERROR([xmllint is required])
8166     fi
8167 else
8168     AC_MSG_RESULT([internal])
8169     SYSTEM_LIBXML=
8170     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8171     if test "$COM" = "MSC"; then
8172         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8173     fi
8174     if test "$COM" = "MSC"; then
8175         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8176     else
8177         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8178     fi
8179     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8181 AC_SUBST(SYSTEM_LIBXML)
8182 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8183     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8185 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8186 AC_SUBST(LIBXML_CFLAGS)
8187 AC_SUBST(LIBXML_LIBS)
8188 AC_SUBST(XMLLINT)
8190 # =====================================================================
8191 # Checking for a Python interpreter with version >= 2.7.
8192 # Build and runtime requires Python 3 compatible version (>= 2.7).
8193 # Optionally user can pass an option to configure, i. e.
8194 # ./configure PYTHON=/usr/bin/python
8195 # =====================================================================
8196 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8197     # This allows a lack of system python with no error, we use internal one in that case.
8198     AM_PATH_PYTHON([2.7],, [:])
8199     # Clean PYTHON_VERSION checked below if cross-compiling
8200     PYTHON_VERSION=""
8201     if test "$PYTHON" != ":"; then
8202         PYTHON_FOR_BUILD=$PYTHON
8203     fi
8205 AC_SUBST(PYTHON_FOR_BUILD)
8207 # Checks for Python to use for Pyuno
8208 AC_MSG_CHECKING([which Python to use for Pyuno])
8209 case "$enable_python" in
8210 no|disable)
8211     if test -z $PYTHON_FOR_BUILD; then
8212         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8213         # requirement from the choice whether to include Python stuff in the installer, but why
8214         # bother?
8215         AC_MSG_ERROR([Python is required at build time.])
8216     fi
8217     enable_python=no
8218     AC_MSG_RESULT([none])
8219     ;;
8220 ""|yes|auto)
8221     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8222         AC_MSG_RESULT([no, overridden by --disable-scripting])
8223         enable_python=no
8224     elif test $build_os = cygwin; then
8225         dnl When building on Windows we don't attempt to use any installed
8226         dnl "system"  Python.
8227         AC_MSG_RESULT([fully internal])
8228         enable_python=internal
8229     elif test "$cross_compiling" = yes; then
8230         AC_MSG_RESULT([system])
8231         enable_python=system
8232     else
8233         # Unset variables set by the above AM_PATH_PYTHON so that
8234         # we actually do check anew.
8235         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
8236         AM_PATH_PYTHON([3.3],, [:])
8237         if test "$PYTHON" = ":"; then
8238             if test -z "$PYTHON_FOR_BUILD"; then
8239                 AC_MSG_RESULT([fully internal])
8240             else
8241                 AC_MSG_RESULT([internal])
8242             fi
8243             enable_python=internal
8244         else
8245             AC_MSG_RESULT([system])
8246             enable_python=system
8247         fi
8248     fi
8249     ;;
8250 internal)
8251     AC_MSG_RESULT([internal])
8252     ;;
8253 fully-internal)
8254     AC_MSG_RESULT([fully internal])
8255     enable_python=internal
8256     ;;
8257 system)
8258     AC_MSG_RESULT([system])
8259     ;;
8261     AC_MSG_ERROR([Incorrect --enable-python option])
8262     ;;
8263 esac
8265 if test $enable_python != no; then
8266     BUILD_TYPE="$BUILD_TYPE PYUNO"
8269 if test $enable_python = system; then
8270     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8271         python_version=2.7
8272         PYTHON=python$python_version
8273         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8274             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8275             PYTHON_LIBS="-framework Python"
8276         else
8277             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8278             PYTHON_LIBS="`$PYTHON-config --libs`"
8279         fi
8280     fi
8281     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8282         # Fallback: Accept these in the environment, or as set above
8283         # for MacOSX.
8284         :
8285     elif test "$cross_compiling" != yes; then
8286         # Unset variables set by the above AM_PATH_PYTHON so that
8287         # we actually do check anew.
8288         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
8289         # This causes an error if no python command is found
8290         AM_PATH_PYTHON([3.3])
8291         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8292         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8293         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8294         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8295         if test -z "$PKG_CONFIG"; then
8296             PYTHON_CFLAGS="-I$python_include"
8297             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8298         elif $PKG_CONFIG --exists python-$python_version; then
8299             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8300             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8301         else
8302             PYTHON_CFLAGS="-I$python_include"
8303             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8304         fi
8305         FilterLibs "${PYTHON_LIBS}"
8306         PYTHON_LIBS="${filteredlibs}"
8307     else
8308         dnl How to find out the cross-compilation Python installation path?
8309         AC_MSG_CHECKING([for python version])
8310         AS_IF([test -n "$PYTHON_VERSION"],
8311               [AC_MSG_RESULT([$PYTHON_VERSION])],
8312               [AC_MSG_RESULT([not found])
8313                AC_MSG_ERROR([no usable python found])])
8314         test -n "$PYTHON_CFLAGS" && break
8315     fi
8317     dnl Check if the headers really work
8318     save_CPPFLAGS="$CPPFLAGS"
8319     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8320     AC_CHECK_HEADER(Python.h)
8321     CPPFLAGS="$save_CPPFLAGS"
8323     # let the PYTHON_FOR_BUILD match the same python installation that
8324     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8325     # better for PythonTests.
8326     PYTHON_FOR_BUILD=$PYTHON
8329 if test "$with_lxml" != no; then
8330     if test -z "$PYTHON_FOR_BUILD"; then
8331         case $build_os in
8332             cygwin)
8333                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8334                 ;;
8335             *)
8336                 if test "$cross_compiling" != yes ; then
8337                     BUILD_TYPE="$BUILD_TYPE LXML"
8338                 fi
8339                 ;;
8340         esac
8341     else
8342         AC_MSG_CHECKING([for python lxml])
8343         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8344             AC_MSG_RESULT([yes])
8345         else
8346             case $build_os in
8347                 cygwin)
8348                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8349                     ;;
8350                 *)
8351                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8352                         BUILD_TYPE="$BUILD_TYPE LXML"
8353                         AC_MSG_RESULT([no, using internal lxml])
8354                     else
8355                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8356                     fi
8357                     ;;
8358             esac
8359         fi
8360     fi
8363 dnl By now enable_python should be "system", "internal" or "no"
8364 case $enable_python in
8365 system)
8366     SYSTEM_PYTHON=TRUE
8368     if test "x$ac_cv_header_Python_h" != "xyes"; then
8369        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8370     fi
8372     AC_LANG_PUSH(C)
8373     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8374     AC_MSG_CHECKING([for correct python library version])
8375        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8376 #include <Python.h>
8378 int main(int argc, char **argv) {
8379    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8380        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8381    else return 1;
8383        ]])],[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])])
8384     CFLAGS=$save_CFLAGS
8385     AC_LANG_POP(C)
8387     dnl FIXME Check if the Python library can be linked with, too?
8388     ;;
8390 internal)
8391     SYSTEM_PYTHON=
8392     PYTHON_VERSION_MAJOR=3
8393     PYTHON_VERSION_MINOR=5
8394     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.5
8395     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8396         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8397     fi
8398     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8399     BUILD_TYPE="$BUILD_TYPE PYTHON"
8400     # Embedded Python dies without Home set
8401     if test "$HOME" = ""; then
8402         export HOME=""
8403     fi
8404     ;;
8406     DISABLE_PYTHON=TRUE
8407     SYSTEM_PYTHON=
8408     ;;
8410     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8411     ;;
8412 esac
8414 AC_SUBST(DISABLE_PYTHON)
8415 AC_SUBST(SYSTEM_PYTHON)
8416 AC_SUBST(PYTHON_CFLAGS)
8417 AC_SUBST(PYTHON_LIBS)
8418 AC_SUBST(PYTHON_VERSION)
8419 AC_SUBST(PYTHON_VERSION_MAJOR)
8420 AC_SUBST(PYTHON_VERSION_MINOR)
8422 ENABLE_MARIADBC=TRUE
8423 if test "$_os" = "Android" -o "$_os" = "iOS"; then
8424     ENABLE_MARIADBC=
8426 MARIADBC_MAJOR=1
8427 MARIADBC_MINOR=0
8428 MARIADBC_MICRO=2
8429 if test "$ENABLE_MARIADBC" = "TRUE"; then
8430     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8433 AC_SUBST(ENABLE_MARIADBC)
8434 AC_SUBST(MARIADBC_MAJOR)
8435 AC_SUBST(MARIADBC_MINOR)
8436 AC_SUBST(MARIADBC_MICRO)
8438 if test "$ENABLE_MARIADBC" = "TRUE"; then
8439     dnl ===================================================================
8440     dnl Check for system MariaDB
8441     dnl ===================================================================
8442     AC_MSG_CHECKING([which MariaDB to use])
8443     if test "$with_system_mariadb" = "yes"; then
8444         AC_MSG_RESULT([external])
8445         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8446         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8447         if test -z "$MARIADBCONFIG"; then
8448             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8449             if test -z "$MARIADBCONFIG"; then
8450                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8451                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8452             fi
8453         fi
8454         AC_MSG_CHECKING([MariaDB version])
8455         MARIADB_VERSION=`$MARIADBCONFIG --version`
8456         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8457         if test "$MARIADB_MAJOR" -ge "5"; then
8458             AC_MSG_RESULT([OK])
8459         else
8460             AC_MSG_ERROR([too old, use 5.0.x or later])
8461         fi
8462         AC_MSG_CHECKING([for MariaDB Client library])
8463         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8464         if test "$COM_IS_CLANG" = TRUE; then
8465             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8466         fi
8467         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8468         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8469         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8470         dnl linux32:
8471         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8472             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8473             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8474                 | sed -e 's|/lib64/|/lib/|')
8475         fi
8476         FilterLibs "${MARIADB_LIBS}"
8477         MARIADB_LIBS="${filteredlibs}"
8478         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8479         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8480         if test "$enable_bundle_mariadb" = "yes"; then
8481             AC_MSG_RESULT([yes])
8482             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8483             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8485 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8487 /g' | grep -E '(mysqlclient|mariadb)')
8488             if test "$_os" = "Darwin"; then
8489                 LIBMARIADB=${LIBMARIADB}.dylib
8490             elif test "$_os" = "WINNT"; then
8491                 LIBMARIADB=${LIBMARIADB}.dll
8492             else
8493                 LIBMARIADB=${LIBMARIADB}.so
8494             fi
8495             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8496             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8497             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8498                 AC_MSG_RESULT([found.])
8499                 PathFormat "$LIBMARIADB_PATH"
8500                 LIBMARIADB_PATH="$formatted_path"
8501             else
8502                 AC_MSG_ERROR([not found.])
8503             fi
8504         else
8505             AC_MSG_RESULT([no])
8506             BUNDLE_MARIADB_CONNECTOR_C=
8507         fi
8508     else
8509         AC_MSG_RESULT([internal])
8510         SYSTEM_MARIADB_CONNECTOR_C=
8511         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8512         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8513         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8514     fi
8516     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8517     AC_SUBST(MARIADB_CFLAGS)
8518     AC_SUBST(MARIADB_LIBS)
8519     AC_SUBST(LIBMARIADB)
8520     AC_SUBST(LIBMARIADB_PATH)
8521     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8524 dnl ===================================================================
8525 dnl Check for system hsqldb
8526 dnl ===================================================================
8527 if test "$with_java" != "no"; then
8528     HSQLDB_USE_JDBC_4_1=
8529     AC_MSG_CHECKING([which hsqldb to use])
8530     if test "$with_system_hsqldb" = "yes"; then
8531         AC_MSG_RESULT([external])
8532         SYSTEM_HSQLDB=TRUE
8533         if test -z $HSQLDB_JAR; then
8534             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8535         fi
8536         if ! test -f $HSQLDB_JAR; then
8537                AC_MSG_ERROR(hsqldb.jar not found.)
8538         fi
8539         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8540         export HSQLDB_JAR
8541         if $PERL -e \
8542            'use Archive::Zip;
8543             my $file = "$ENV{'HSQLDB_JAR'}";
8544             my $zip = Archive::Zip->new( $file );
8545             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8546             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8547             {
8548                 push @l, split(/\n/, $mf);
8549                 foreach my $line (@l)
8550                 {
8551                     if ($line =~ m/Specification-Version:/)
8552                     {
8553                         ($t, $version) = split (/:/,$line);
8554                         $version =~ s/^\s//;
8555                         ($a, $b, $c, $d) = split (/\./,$version);
8556                         if ($c == "0" && $d > "8")
8557                         {
8558                             exit 0;
8559                         }
8560                         else
8561                         {
8562                             exit 1;
8563                         }
8564                     }
8565                 }
8566             }
8567             else
8568             {
8569                 exit 1;
8570             }'; then
8571             AC_MSG_RESULT([yes])
8572         else
8573             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8574         fi
8575     else
8576         AC_MSG_RESULT([internal])
8577         SYSTEM_HSQLDB=
8578         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8579         NEED_ANT=TRUE
8580         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8581         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8582         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8583             AC_MSG_RESULT([yes])
8584             HSQLDB_USE_JDBC_4_1=TRUE
8585         else
8586             AC_MSG_RESULT([no])
8587         fi
8588     fi
8589     AC_SUBST(SYSTEM_HSQLDB)
8590     AC_SUBST(HSQLDB_JAR)
8591     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8594 dnl ===================================================================
8595 dnl Check for PostgreSQL stuff
8596 dnl ===================================================================
8597 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8598 if test "x$enable_postgresql_sdbc" != "xno"; then
8599     AC_MSG_RESULT([yes])
8600     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8602     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8603         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8604     fi
8605     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8606         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8607     fi
8609     postgres_interface=""
8610     if test "$with_system_postgresql" = "yes"; then
8611         postgres_interface="external PostgreSQL"
8612         SYSTEM_POSTGRESQL=TRUE
8613         if test "$_os" = Darwin; then
8614             supp_path=''
8615             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8616                 pg_supp_path="$P_SEP$d$pg_supp_path"
8617             done
8618         fi
8619         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8620         if test -z "$PGCONFIG"; then
8621             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8622         fi
8623         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8624         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8625         FilterLibs "${POSTGRESQL_LIB}"
8626         POSTGRESQL_LIB="${filteredlibs}"
8627     else
8628         # if/when anything else than PostgreSQL uses Kerberos,
8629         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8630         WITH_KRB5=
8631         WITH_GSSAPI=
8632         case "$_os" in
8633         Darwin)
8634             # MacOS X has system MIT Kerberos 5 since 10.4
8635             if test "$with_krb5" != "no"; then
8636                 WITH_KRB5=TRUE
8637                 save_LIBS=$LIBS
8638                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8639                 # that the libraries where these functions are located on macOS will change, is it?
8640                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8641                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8642                 KRB5_LIBS=$LIBS
8643                 LIBS=$save_LIBS
8644                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8645                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8646                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8647                 LIBS=$save_LIBS
8648             fi
8649             if test "$with_gssapi" != "no"; then
8650                 WITH_GSSAPI=TRUE
8651                 save_LIBS=$LIBS
8652                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8653                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8654                 GSSAPI_LIBS=$LIBS
8655                 LIBS=$save_LIBS
8656             fi
8657             ;;
8658         WINNT)
8659             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8660                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8661             fi
8662             ;;
8663         Linux|GNU|*BSD|DragonFly)
8664             if test "$with_krb5" != "no"; then
8665                 WITH_KRB5=TRUE
8666                 save_LIBS=$LIBS
8667                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8668                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8669                 KRB5_LIBS=$LIBS
8670                 LIBS=$save_LIBS
8671                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8672                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8673                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8674                 LIBS=$save_LIBS
8675             fi
8676             if test "$with_gssapi" != "no"; then
8677                 WITH_GSSAPI=TRUE
8678                 save_LIBS=$LIBS
8679                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8680                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8681                 GSSAPI_LIBS=$LIBS
8682                 LIBS=$save_LIBS
8683             fi
8684             ;;
8685         *)
8686             if test "$with_krb5" = "yes"; then
8687                 WITH_KRB5=TRUE
8688                 save_LIBS=$LIBS
8689                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8690                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8691                 KRB5_LIBS=$LIBS
8692                 LIBS=$save_LIBS
8693                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8694                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8695                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8696                 LIBS=$save_LIBS
8697             fi
8698             if test "$with_gssapi" = "yes"; then
8699                 WITH_GSSAPI=TRUE
8700                 save_LIBS=$LIBS
8701                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8702                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8703                 LIBS=$save_LIBS
8704                 GSSAPI_LIBS=$LIBS
8705             fi
8706         esac
8708         if test -n "$with_libpq_path"; then
8709             SYSTEM_POSTGRESQL=TRUE
8710             postgres_interface="external libpq"
8711             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8712             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8713         else
8714             SYSTEM_POSTGRESQL=
8715             postgres_interface="internal"
8716             POSTGRESQL_LIB=""
8717             POSTGRESQL_INC="%OVERRIDE_ME%"
8718             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8719         fi
8720     fi
8722     AC_MSG_CHECKING([PostgreSQL C interface])
8723     AC_MSG_RESULT([$postgres_interface])
8725     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8726         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8727         save_CFLAGS=$CFLAGS
8728         save_CPPFLAGS=$CPPFLAGS
8729         save_LIBS=$LIBS
8730         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8731         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8732         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8733         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8734             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8735         CFLAGS=$save_CFLAGS
8736         CPPFLAGS=$save_CPPFLAGS
8737         LIBS=$save_LIBS
8738     fi
8739     BUILD_POSTGRESQL_SDBC=TRUE
8740 else
8741     AC_MSG_RESULT([no])
8743 AC_SUBST(WITH_KRB5)
8744 AC_SUBST(WITH_GSSAPI)
8745 AC_SUBST(GSSAPI_LIBS)
8746 AC_SUBST(KRB5_LIBS)
8747 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8748 AC_SUBST(SYSTEM_POSTGRESQL)
8749 AC_SUBST(POSTGRESQL_INC)
8750 AC_SUBST(POSTGRESQL_LIB)
8752 dnl ===================================================================
8753 dnl Check for Firebird stuff
8754 dnl ===================================================================
8755 ENABLE_FIREBIRD_SDBC=
8756 if test "$enable_firebird_sdbc" = "yes" ; then
8757     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8759     dnl ===================================================================
8760     dnl Check for system Firebird
8761     dnl ===================================================================
8762     AC_MSG_CHECKING([which Firebird to use])
8763     if test "$with_system_firebird" = "yes"; then
8764         AC_MSG_RESULT([external])
8765         SYSTEM_FIREBIRD=TRUE
8766         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8767         if test -z "$FIREBIRDCONFIG"; then
8768             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8769             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8770                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8771             ])
8772             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8773         else
8774             AC_MSG_NOTICE([fb_config found])
8775             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8776             AC_MSG_CHECKING([for Firebird Client library])
8777             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8778             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8779             FilterLibs "${FIREBIRD_LIBS}"
8780             FIREBIRD_LIBS="${filteredlibs}"
8781         fi
8782         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8783         AC_MSG_CHECKING([Firebird version])
8784         if test -n "${FIREBIRD_VERSION}"; then
8785             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8786             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8787             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8788                 AC_MSG_RESULT([OK])
8789             else
8790                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8791             fi
8792         else
8793             __save_CFLAGS="${CFLAGS}"
8794             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8795             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8796 #if defined(FB_API_VER) && FB_API_VER == 30
8797 int fb_api_is_30(void) { return 0; }
8798 #else
8799 #error "Wrong Firebird API version"
8800 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8801             CFLAGS="${__save_CFLAGS}"
8802         fi
8803         ENABLE_FIREBIRD_SDBC=TRUE
8804         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8805     elif test "$enable_database_connectivity" != yes; then
8806         AC_MSG_RESULT([none])
8807     elif test "$cross_compiling" = "yes"; then
8808         AC_MSG_RESULT([none])
8809     else
8810         dnl Embedded Firebird has version 3.0
8811         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8812         dnl We need libatomic-ops for any non X86/X64 system
8813         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8814             dnl ===================================================================
8815             dnl Check for system libatomic-ops
8816             dnl ===================================================================
8817             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8818             if test "$with_system_libatomic_ops" = "yes"; then
8819                 SYSTEM_LIBATOMIC_OPS=TRUE
8820                 AC_CHECK_HEADERS(atomic_ops.h, [],
8821                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8822             else
8823                 SYSTEM_LIBATOMIC_OPS=
8824                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8825                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8826                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8827             fi
8828         fi
8830         AC_MSG_RESULT([internal])
8831         SYSTEM_FIREBIRD=
8832         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8833         FIREBIRD_LIBS="-lfbclient"
8835         if test "$with_system_libtommath" = "yes"; then
8836             SYSTEM_LIBTOMMATH=TRUE
8837             dnl check for tommath presence
8838             save_LIBS=$LIBS
8839             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8840             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8841             LIBS=$save_LIBS
8842         else
8843             SYSTEM_LIBTOMMATH=
8844             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8845             LIBTOMMATH_LIBS="-ltommath"
8846             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8847         fi
8849         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8850         ENABLE_FIREBIRD_SDBC=TRUE
8851         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
8852     fi
8854 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8855 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8856 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8857 AC_SUBST(LIBATOMIC_OPS_LIBS)
8858 AC_SUBST(SYSTEM_FIREBIRD)
8859 AC_SUBST(FIREBIRD_CFLAGS)
8860 AC_SUBST(FIREBIRD_LIBS)
8861 AC_SUBST([TOMMATH_CFLAGS])
8862 AC_SUBST([TOMMATH_LIBS])
8864 dnl ===================================================================
8865 dnl Check for system curl
8866 dnl ===================================================================
8867 AC_MSG_CHECKING([which libcurl to use])
8868 if test "$with_system_curl" = "auto"; then
8869     with_system_curl="$with_system_libs"
8872 if test "$with_system_curl" = "yes"; then
8873     AC_MSG_RESULT([external])
8874     SYSTEM_CURL=TRUE
8876     # First try PKGCONFIG and then fall back
8877     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8879     if test -n "$CURL_PKG_ERRORS"; then
8880         AC_PATH_PROG(CURLCONFIG, curl-config)
8881         if test -z "$CURLCONFIG"; then
8882             AC_MSG_ERROR([curl development files not found])
8883         fi
8884         CURL_LIBS=`$CURLCONFIG --libs`
8885         FilterLibs "${CURL_LIBS}"
8886         CURL_LIBS="${filteredlibs}"
8887         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8888         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8890         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8891         case $curl_version in
8892         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8893         dnl so they need to be doubled to end up in the configure script
8894         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8895             AC_MSG_RESULT([yes])
8896             ;;
8897         *)
8898             AC_MSG_ERROR([no, you have $curl_version])
8899             ;;
8900         esac
8901     fi
8903     ENABLE_CURL=TRUE
8904 elif test $_os = iOS; then
8905     # Let's see if we need curl, I think not?
8906     AC_MSG_RESULT([none])
8907     ENABLE_CURL=
8908 else
8909     AC_MSG_RESULT([internal])
8910     SYSTEM_CURL=
8911     BUILD_TYPE="$BUILD_TYPE CURL"
8912     ENABLE_CURL=TRUE
8914 AC_SUBST(SYSTEM_CURL)
8915 AC_SUBST(CURL_CFLAGS)
8916 AC_SUBST(CURL_LIBS)
8917 AC_SUBST(ENABLE_CURL)
8919 dnl ===================================================================
8920 dnl Check for system boost
8921 dnl ===================================================================
8922 AC_MSG_CHECKING([which boost to use])
8923 if test "$with_system_boost" = "yes"; then
8924     AC_MSG_RESULT([external])
8925     SYSTEM_BOOST=TRUE
8926     AX_BOOST_BASE(1.47)
8927     AX_BOOST_DATE_TIME
8928     AX_BOOST_FILESYSTEM
8929     AX_BOOST_IOSTREAMS
8930     AX_BOOST_LOCALE
8931     AC_LANG_PUSH([C++])
8932     save_CXXFLAGS=$CXXFLAGS
8933     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8934     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8935        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8936     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8937        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8938     CXXFLAGS=$save_CXXFLAGS
8939     AC_LANG_POP([C++])
8940     # this is in m4/ax_boost_base.m4
8941     FilterLibs "${BOOST_LDFLAGS}"
8942     BOOST_LDFLAGS="${filteredlibs}"
8943 else
8944     AC_MSG_RESULT([internal])
8945     BUILD_TYPE="$BUILD_TYPE BOOST"
8946     SYSTEM_BOOST=
8947     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8948         # use warning-suppressing wrapper headers
8949         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8950     else
8951         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8952     fi
8954 AC_SUBST(SYSTEM_BOOST)
8956 dnl ===================================================================
8957 dnl Check for system mdds
8958 dnl ===================================================================
8959 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8961 dnl ===================================================================
8962 dnl Check for system glm
8963 dnl ===================================================================
8964 AC_MSG_CHECKING([which glm to use])
8965 if test "$with_system_glm" = "yes"; then
8966     AC_MSG_RESULT([external])
8967     SYSTEM_GLM=TRUE
8968     AC_LANG_PUSH([C++])
8969     AC_CHECK_HEADER([glm/glm.hpp], [],
8970        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8971     AC_LANG_POP([C++])
8972 else
8973     AC_MSG_RESULT([internal])
8974     BUILD_TYPE="$BUILD_TYPE GLM"
8975     SYSTEM_GLM=
8976     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8978 AC_SUBST([GLM_CFLAGS])
8979 AC_SUBST([SYSTEM_GLM])
8981 dnl ===================================================================
8982 dnl Check for system odbc
8983 dnl ===================================================================
8984 AC_MSG_CHECKING([which odbc headers to use])
8985 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
8986     AC_MSG_RESULT([external])
8987     SYSTEM_ODBC_HEADERS=TRUE
8989     if test "$build_os" = "cygwin"; then
8990         save_CPPFLAGS=$CPPFLAGS
8991         find_winsdk
8992         PathFormat "$winsdktest"
8993         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"
8994         AC_CHECK_HEADER(sqlext.h, [],
8995             [AC_MSG_ERROR(odbc not found. install odbc)],
8996             [#include <windows.h>])
8997         CPPFLAGS=$save_CPPFLAGS
8998     else
8999         AC_CHECK_HEADER(sqlext.h, [],
9000             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9001     fi
9002 elif test "$enable_database_connectivity" != yes; then
9003     AC_MSG_RESULT([none])
9004 else
9005     AC_MSG_RESULT([internal])
9006     SYSTEM_ODBC_HEADERS=
9008 AC_SUBST(SYSTEM_ODBC_HEADERS)
9011 dnl ===================================================================
9012 dnl Check for system openldap
9013 dnl ===================================================================
9015 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9016 AC_MSG_CHECKING([which openldap library to use])
9017 if test "$with_system_openldap" = "yes"; then
9018     AC_MSG_RESULT([external])
9019     SYSTEM_OPENLDAP=TRUE
9020     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9021     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9022     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9023 else
9024     AC_MSG_RESULT([internal])
9025     SYSTEM_OPENLDAP=
9026     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9029 AC_SUBST(SYSTEM_OPENLDAP)
9031 dnl ===================================================================
9032 dnl Check for system NSS
9033 dnl ===================================================================
9034 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9035     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9036     AC_DEFINE(HAVE_FEATURE_NSS)
9037     ENABLE_NSS="TRUE"
9038     AC_DEFINE(ENABLE_NSS)
9039 elif test $_os != iOS ; then
9040     with_tls=openssl
9042 AC_SUBST(ENABLE_NSS)
9044 dnl ===================================================================
9045 dnl Check for TLS/SSL and cryptographic implementation to use
9046 dnl ===================================================================
9047 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9048 if test -n "$with_tls"; then
9049     case $with_tls in
9050     openssl)
9051         AC_DEFINE(USE_TLS_OPENSSL)
9052         TLS=OPENSSL
9054         if test "$enable_openssl" != "yes"; then
9055             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9056         fi
9058         # warn that OpenSSL has been selected but not all TLS code has this option
9059         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9060         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9061         ;;
9062     nss)
9063         AC_DEFINE(USE_TLS_NSS)
9064         TLS=NSS
9065         ;;
9066     no)
9067         AC_MSG_WARN([Skipping TLS/SSL])
9068         ;;
9069     *)
9070         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9071 openssl - OpenSSL
9072 nss - Mozilla's Network Security Services (NSS)
9073     ])
9074         ;;
9075     esac
9076 else
9077     # default to using NSS, it results in smaller oox lib
9078     AC_DEFINE(USE_TLS_NSS)
9079     TLS=NSS
9081 AC_MSG_RESULT([$TLS])
9082 AC_SUBST(TLS)
9084 dnl ===================================================================
9085 dnl Check for system sane
9086 dnl ===================================================================
9087 AC_MSG_CHECKING([which sane header to use])
9088 if test "$with_system_sane" = "yes"; then
9089     AC_MSG_RESULT([external])
9090     AC_CHECK_HEADER(sane/sane.h, [],
9091       [AC_MSG_ERROR(sane not found. install sane)], [])
9092 else
9093     AC_MSG_RESULT([internal])
9094     BUILD_TYPE="$BUILD_TYPE SANE"
9097 dnl ===================================================================
9098 dnl Check for system icu
9099 dnl ===================================================================
9100 SYSTEM_GENBRK=
9101 SYSTEM_GENCCODE=
9102 SYSTEM_GENCMN=
9104 ICU_MAJOR=63
9105 ICU_MINOR=1
9106 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9107 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9108 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9109 AC_MSG_CHECKING([which icu to use])
9110 if test "$with_system_icu" = "yes"; then
9111     AC_MSG_RESULT([external])
9112     SYSTEM_ICU=TRUE
9113     AC_LANG_PUSH([C++])
9114     AC_MSG_CHECKING([for unicode/rbbi.h])
9115     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9116     AC_LANG_POP([C++])
9118     if test "$cross_compiling" != "yes"; then
9119         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9120         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9121         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9122         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9123     fi
9125     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9126         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9127         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9128         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9129         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9130         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9131             AC_MSG_RESULT([yes])
9132         else
9133             AC_MSG_RESULT([no])
9134             if test "$with_system_icu_for_build" != "force"; then
9135                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9136 You can use --with-system-icu-for-build=force to use it anyway.])
9137             fi
9138         fi
9139     fi
9141     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9142         # using the system icu tools can lead to version confusion, use the
9143         # ones from the build environment when cross-compiling
9144         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9145         if test -z "$SYSTEM_GENBRK"; then
9146             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9147         fi
9148         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9149         if test -z "$SYSTEM_GENCCODE"; then
9150             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9151         fi
9152         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9153         if test -z "$SYSTEM_GENCMN"; then
9154             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9155         fi
9156         if test "$ICU_MAJOR" -ge "49"; then
9157             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9158             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9159             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9160         else
9161             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9162             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9163             ICU_RECLASSIFIED_HEBREW_LETTER=
9164         fi
9165     fi
9167     if test "$cross_compiling" = "yes"; then
9168         if test "$ICU_MAJOR" -ge "50"; then
9169             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9170             ICU_MINOR=""
9171         fi
9172     fi
9173 else
9174     AC_MSG_RESULT([internal])
9175     SYSTEM_ICU=
9176     BUILD_TYPE="$BUILD_TYPE ICU"
9177     # surprisingly set these only for "internal" (to be used by various other
9178     # external libs): the system icu-config is quite unhelpful and spits out
9179     # dozens of weird flags and also default path -I/usr/include
9180     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9181     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9183 if test "$ICU_MAJOR" -ge "59"; then
9184     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9185     # with -std=c++11 but not all external libraries can be built with that,
9186     # for those use a bit-compatible typedef uint16_t UChar; see
9187     # icu/source/common/unicode/umachine.h
9188     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9189 else
9190     ICU_UCHAR_TYPE=""
9192 AC_SUBST(SYSTEM_ICU)
9193 AC_SUBST(SYSTEM_GENBRK)
9194 AC_SUBST(SYSTEM_GENCCODE)
9195 AC_SUBST(SYSTEM_GENCMN)
9196 AC_SUBST(ICU_MAJOR)
9197 AC_SUBST(ICU_MINOR)
9198 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9199 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9200 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9201 AC_SUBST(ICU_CFLAGS)
9202 AC_SUBST(ICU_LIBS)
9203 AC_SUBST(ICU_UCHAR_TYPE)
9205 dnl ==================================================================
9206 dnl Breakpad
9207 dnl ==================================================================
9208 AC_MSG_CHECKING([whether to enable breakpad])
9209 if test "$enable_breakpad" != yes; then
9210     AC_MSG_RESULT([no])
9211 else
9212     AC_MSG_RESULT([yes])
9213     ENABLE_BREAKPAD="TRUE"
9214     AC_DEFINE(ENABLE_BREAKPAD)
9215     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9216     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9218     AC_MSG_CHECKING([for crashreport config])
9219     if test "$with_symbol_config" = "no"; then
9220         BREAKPAD_SYMBOL_CONFIG="invalid"
9221         AC_MSG_RESULT([no])
9222     else
9223         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9224         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9225         AC_MSG_RESULT([yes])
9226     fi
9227     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9229 AC_SUBST(ENABLE_BREAKPAD)
9231 dnl ==================================================================
9232 dnl libfuzzer
9233 dnl ==================================================================
9234 AC_MSG_CHECKING([whether to enable fuzzers])
9235 if test "$enable_fuzzers" != yes; then
9236     AC_MSG_RESULT([no])
9237 else
9238     AC_MSG_RESULT([yes])
9239     ENABLE_FUZZERS="TRUE"
9240     AC_DEFINE([ENABLE_FUZZERS],1)
9241     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9243 AC_SUBST(ENABLE_FUZZERS)
9245 dnl ===================================================================
9246 dnl Orcus
9247 dnl ===================================================================
9248 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9249 if test "$with_system_orcus" != "yes"; then
9250     if test "$SYSTEM_BOOST" = "TRUE"; then
9251         # ===========================================================
9252         # Determine if we are going to need to link with Boost.System
9253         # ===========================================================
9254         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9255         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9256         dnl in documentation has no effect.
9257         AC_MSG_CHECKING([if we need to link with Boost.System])
9258         AC_LANG_PUSH([C++])
9259         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9260                 @%:@include <boost/version.hpp>
9261             ]],[[
9262                 #if BOOST_VERSION >= 105000
9263                 #   error yes, we need to link with Boost.System
9264                 #endif
9265             ]])],[
9266                 AC_MSG_RESULT([no])
9267             ],[
9268                 AC_MSG_RESULT([yes])
9269                 AX_BOOST_SYSTEM
9270         ])
9271         AC_LANG_POP([C++])
9272     fi
9274 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9275 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9276 AC_SUBST([BOOST_SYSTEM_LIB])
9277 AC_SUBST(SYSTEM_LIBORCUS)
9279 dnl ===================================================================
9280 dnl HarfBuzz
9281 dnl ===================================================================
9282 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9283                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9284                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9286 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9287                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9288                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9290 if test "$COM" = "MSC"; then # override the above
9291     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9292     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9295 if test "$with_system_harfbuzz" = "yes"; then
9296     if test "$with_system_graphite" = "no"; then
9297         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9298     fi
9299     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9300     _save_libs="$LIBS"
9301     _save_cflags="$CFLAGS"
9302     LIBS="$LIBS $HARFBUZZ_LIBS"
9303     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9304     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9305     LIBS="$_save_libs"
9306     CFLAGS="$_save_cflags"
9307 else
9308     if test "$with_system_graphite" = "yes"; then
9309         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9310     fi
9313 AC_MSG_CHECKING([whether to use X11])
9314 dnl ***************************************
9315 dnl testing for X libraries and includes...
9316 dnl ***************************************
9317 if test "$USING_X11" = TRUE; then
9318     AC_DEFINE(HAVE_FEATURE_X11)
9320 AC_MSG_RESULT([$USING_X11])
9322 if test "$USING_X11" = TRUE; then
9323     AC_PATH_X
9324     AC_PATH_XTRA
9325     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9327     if test -z "$x_includes"; then
9328         x_includes="default_x_includes"
9329     fi
9330     if test -z "$x_libraries"; then
9331         x_libraries="default_x_libraries"
9332     fi
9333     CFLAGS="$CFLAGS $X_CFLAGS"
9334     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9335     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9336 else
9337     x_includes="no_x_includes"
9338     x_libraries="no_x_libraries"
9341 if test "$USING_X11" = TRUE; then
9342     dnl ===================================================================
9343     dnl Check for extension headers
9344     dnl ===================================================================
9345     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9346      [#include <X11/extensions/shape.h>])
9348     # vcl needs ICE and SM
9349     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9350     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9351         [AC_MSG_ERROR(ICE library not found)])
9352     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9353     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9354         [AC_MSG_ERROR(SM library not found)])
9357 dnl ===================================================================
9358 dnl Check for system Xrender
9359 dnl ===================================================================
9360 AC_MSG_CHECKING([whether to use Xrender])
9361 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9362     AC_MSG_RESULT([yes])
9363     PKG_CHECK_MODULES(XRENDER, xrender)
9364     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9365     FilterLibs "${XRENDER_LIBS}"
9366     XRENDER_LIBS="${filteredlibs}"
9367     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9368       [AC_MSG_ERROR(libXrender not found or functional)], [])
9369     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9370       [AC_MSG_ERROR(Xrender not found. install X)], [])
9371 else
9372     AC_MSG_RESULT([no])
9374 AC_SUBST(XRENDER_CFLAGS)
9375 AC_SUBST(XRENDER_LIBS)
9377 dnl ===================================================================
9378 dnl Check for XRandr
9379 dnl ===================================================================
9380 AC_MSG_CHECKING([whether to enable RandR support])
9381 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9382     AC_MSG_RESULT([yes])
9383     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9384     if test "$ENABLE_RANDR" != "TRUE"; then
9385         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9386                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9387         XRANDR_CFLAGS=" "
9388         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9389           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9390         XRANDR_LIBS="-lXrandr "
9391         ENABLE_RANDR="TRUE"
9392     fi
9393     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9394     FilterLibs "${XRANDR_LIBS}"
9395     XRANDR_LIBS="${filteredlibs}"
9396 else
9397     ENABLE_RANDR=""
9398     AC_MSG_RESULT([no])
9400 AC_SUBST(XRANDR_CFLAGS)
9401 AC_SUBST(XRANDR_LIBS)
9402 AC_SUBST(ENABLE_RANDR)
9404 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9405     WITH_WEBDAV="serf"
9407 if test $_os = iOS -o $_os = Android; then
9408     WITH_WEBDAV="no"
9410 AC_MSG_CHECKING([for webdav library])
9411 case "$WITH_WEBDAV" in
9412 serf)
9413     AC_MSG_RESULT([serf])
9414     # Check for system apr-util
9415     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9416                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9417                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9418     if test "$COM" = "MSC"; then
9419         APR_LIB_DIR="LibR"
9420         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9421         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9422     fi
9424     # Check for system serf
9425     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9426                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9427     if test "$COM" = "MSC"; then
9428         SERF_LIB_DIR="Release"
9429         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9430         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9431     fi
9432     ;;
9433 neon)
9434     AC_MSG_RESULT([neon])
9435     # Check for system neon
9436     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9437     if test "$with_system_neon" = "yes"; then
9438         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9439     else
9440         NEON_VERSION=0295
9441     fi
9442     AC_SUBST(NEON_VERSION)
9443     ;;
9445     AC_MSG_RESULT([none, disabled])
9446     WITH_WEBDAV=""
9447     ;;
9448 esac
9449 AC_SUBST(WITH_WEBDAV)
9451 dnl ===================================================================
9452 dnl Check for disabling cve_tests
9453 dnl ===================================================================
9454 AC_MSG_CHECKING([whether to execute CVE tests])
9455 # If not explicitly enabled or disabled, default
9456 if test -z "$enable_cve_tests"; then
9457     case "$OS" in
9458     WNT)
9459         # Default cves off for windows with its wild and wonderful
9460         # varienty of AV software kicking in and panicking
9461         enable_cve_tests=no
9462         ;;
9463     *)
9464         # otherwise yes
9465         enable_cve_tests=yes
9466         ;;
9467     esac
9469 if test "$enable_cve_tests" = "no"; then
9470     AC_MSG_RESULT([no])
9471     DISABLE_CVE_TESTS=TRUE
9472     AC_SUBST(DISABLE_CVE_TESTS)
9473 else
9474     AC_MSG_RESULT([yes])
9477 dnl ===================================================================
9478 dnl Check for enabling chart XShape tests
9479 dnl ===================================================================
9480 AC_MSG_CHECKING([whether to execute chart XShape tests])
9481 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9482     AC_MSG_RESULT([yes])
9483     ENABLE_CHART_TESTS=TRUE
9484     AC_SUBST(ENABLE_CHART_TESTS)
9485 else
9486     AC_MSG_RESULT([no])
9489 dnl ===================================================================
9490 dnl Check for system openssl
9491 dnl ===================================================================
9492 DISABLE_OPENSSL=
9493 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9494 if test "$enable_openssl" = "yes"; then
9495     AC_MSG_RESULT([no])
9496     if test "$_os" = Darwin ; then
9497         # OpenSSL is deprecated when building for 10.7 or later.
9498         #
9499         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9500         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9502         with_system_openssl=no
9503         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9504     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9505             && test "$with_system_openssl" != "no"; then
9506         with_system_openssl=yes
9507         SYSTEM_OPENSSL=TRUE
9508         OPENSSL_CFLAGS=
9509         OPENSSL_LIBS="-lssl -lcrypto"
9510     else
9511         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9512     fi
9513     if test "$with_system_openssl" = "yes"; then
9514         AC_MSG_CHECKING([whether openssl supports SHA512])
9515         AC_LANG_PUSH([C])
9516         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9517             SHA512_CTX context;
9518 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9519         AC_LANG_POP(C)
9520     fi
9521 else
9522     AC_MSG_RESULT([yes])
9523     DISABLE_OPENSSL=TRUE
9525     # warn that although OpenSSL is disabled, system libraries may depend on it
9526     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9527     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9530 AC_SUBST([DISABLE_OPENSSL])
9532 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9533     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9534         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9535         enable_cipher_openssl_backend=no
9536     else
9537         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9538     fi
9540 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9541 ENABLE_CIPHER_OPENSSL_BACKEND=
9542 if test "$enable_cipher_openssl_backend" = yes; then
9543     AC_MSG_RESULT([yes])
9544     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9545 else
9546     AC_MSG_RESULT([no])
9548 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9550 dnl ===================================================================
9551 dnl Check for building gnutls
9552 dnl ===================================================================
9553 AC_MSG_CHECKING([whether to use gnutls])
9554 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9555     AC_MSG_RESULT([yes])
9556     AM_PATH_LIBGCRYPT()
9557     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9558         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9559                       available in the system to use as replacement.]]))
9560     FilterLibs "${LIBGCRYPT_LIBS}"
9561     LIBGCRYPT_LIBS="${filteredlibs}"
9562 else
9563     AC_MSG_RESULT([no])
9566 AC_SUBST([LIBGCRYPT_CFLAGS])
9567 AC_SUBST([LIBGCRYPT_LIBS])
9569 dnl ===================================================================
9570 dnl Check for system redland
9571 dnl ===================================================================
9572 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9573 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9574 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9575 if test "$with_system_redland" = "yes"; then
9576     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9577             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9578 else
9579     RAPTOR_MAJOR="0"
9580     RASQAL_MAJOR="3"
9581     REDLAND_MAJOR="0"
9583 AC_SUBST(RAPTOR_MAJOR)
9584 AC_SUBST(RASQAL_MAJOR)
9585 AC_SUBST(REDLAND_MAJOR)
9587 dnl ===================================================================
9588 dnl Check for system hunspell
9589 dnl ===================================================================
9590 AC_MSG_CHECKING([which libhunspell to use])
9591 if test "$with_system_hunspell" = "yes"; then
9592     AC_MSG_RESULT([external])
9593     SYSTEM_HUNSPELL=TRUE
9594     AC_LANG_PUSH([C++])
9595     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9596     if test "$HUNSPELL_PC" != "TRUE"; then
9597         AC_CHECK_HEADER(hunspell.hxx, [],
9598             [
9599             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9600             [AC_MSG_ERROR(hunspell headers not found.)], [])
9601             ], [])
9602         AC_CHECK_LIB([hunspell], [main], [:],
9603            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9604         HUNSPELL_LIBS=-lhunspell
9605     fi
9606     AC_LANG_POP([C++])
9607     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9608     FilterLibs "${HUNSPELL_LIBS}"
9609     HUNSPELL_LIBS="${filteredlibs}"
9610 else
9611     AC_MSG_RESULT([internal])
9612     SYSTEM_HUNSPELL=
9613     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9614     if test "$COM" = "MSC"; then
9615         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9616     else
9617         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
9618     fi
9619     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9621 AC_SUBST(SYSTEM_HUNSPELL)
9622 AC_SUBST(HUNSPELL_CFLAGS)
9623 AC_SUBST(HUNSPELL_LIBS)
9625 dnl ===================================================================
9626 dnl Checking for altlinuxhyph
9627 dnl ===================================================================
9628 AC_MSG_CHECKING([which altlinuxhyph to use])
9629 if test "$with_system_altlinuxhyph" = "yes"; then
9630     AC_MSG_RESULT([external])
9631     SYSTEM_HYPH=TRUE
9632     AC_CHECK_HEADER(hyphen.h, [],
9633        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9634     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9635        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9636        [#include <hyphen.h>])
9637     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9638         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9639     if test -z "$HYPHEN_LIB"; then
9640         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9641            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9642     fi
9643     if test -z "$HYPHEN_LIB"; then
9644         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9645            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9646     fi
9647 else
9648     AC_MSG_RESULT([internal])
9649     SYSTEM_HYPH=
9650     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9651     if test "$COM" = "MSC"; then
9652         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9653     else
9654         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9655     fi
9657 AC_SUBST(SYSTEM_HYPH)
9658 AC_SUBST(HYPHEN_LIB)
9660 dnl ===================================================================
9661 dnl Checking for mythes
9662 dnl ===================================================================
9663 AC_MSG_CHECKING([which mythes to use])
9664 if test "$with_system_mythes" = "yes"; then
9665     AC_MSG_RESULT([external])
9666     SYSTEM_MYTHES=TRUE
9667     AC_LANG_PUSH([C++])
9668     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9669     if test "$MYTHES_PKGCONFIG" = "no"; then
9670         AC_CHECK_HEADER(mythes.hxx, [],
9671             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9672         AC_CHECK_LIB([mythes-1.2], [main], [:],
9673             [ MYTHES_FOUND=no], [])
9674     if test "$MYTHES_FOUND" = "no"; then
9675         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9676                 [ MYTHES_FOUND=no], [])
9677     fi
9678     if test "$MYTHES_FOUND" = "no"; then
9679         AC_MSG_ERROR([mythes library not found!.])
9680     fi
9681     fi
9682     AC_LANG_POP([C++])
9683     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9684     FilterLibs "${MYTHES_LIBS}"
9685     MYTHES_LIBS="${filteredlibs}"
9686 else
9687     AC_MSG_RESULT([internal])
9688     SYSTEM_MYTHES=
9689     BUILD_TYPE="$BUILD_TYPE MYTHES"
9690     if test "$COM" = "MSC"; then
9691         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9692     else
9693         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9694     fi
9696 AC_SUBST(SYSTEM_MYTHES)
9697 AC_SUBST(MYTHES_CFLAGS)
9698 AC_SUBST(MYTHES_LIBS)
9700 dnl ===================================================================
9701 dnl How should we build the linear programming solver ?
9702 dnl ===================================================================
9704 ENABLE_COINMP=
9705 AC_MSG_CHECKING([whether to build with CoinMP])
9706 if test "$enable_coinmp" != "no"; then
9707     ENABLE_COINMP=TRUE
9708     AC_MSG_RESULT([yes])
9709     if test "$with_system_coinmp" = "yes"; then
9710         SYSTEM_COINMP=TRUE
9711         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9712         FilterLibs "${COINMP_LIBS}"
9713         COINMP_LIBS="${filteredlibs}"
9714     else
9715         BUILD_TYPE="$BUILD_TYPE COINMP"
9716     fi
9717 else
9718     AC_MSG_RESULT([no])
9720 AC_SUBST(ENABLE_COINMP)
9721 AC_SUBST(SYSTEM_COINMP)
9722 AC_SUBST(COINMP_CFLAGS)
9723 AC_SUBST(COINMP_LIBS)
9725 ENABLE_LPSOLVE=
9726 AC_MSG_CHECKING([whether to build with lpsolve])
9727 if test "$enable_lpsolve" != "no"; then
9728     ENABLE_LPSOLVE=TRUE
9729     AC_MSG_RESULT([yes])
9730 else
9731     AC_MSG_RESULT([no])
9733 AC_SUBST(ENABLE_LPSOLVE)
9735 if test "$ENABLE_LPSOLVE" = TRUE; then
9736     AC_MSG_CHECKING([which lpsolve to use])
9737     if test "$with_system_lpsolve" = "yes"; then
9738         AC_MSG_RESULT([external])
9739         SYSTEM_LPSOLVE=TRUE
9740         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9741            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9742         save_LIBS=$LIBS
9743         # some systems need this. Like Ubuntu....
9744         AC_CHECK_LIB(m, floor)
9745         AC_CHECK_LIB(dl, dlopen)
9746         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9747             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9748         LIBS=$save_LIBS
9749     else
9750         AC_MSG_RESULT([internal])
9751         SYSTEM_LPSOLVE=
9752         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9753     fi
9755 AC_SUBST(SYSTEM_LPSOLVE)
9757 dnl ===================================================================
9758 dnl Checking for libexttextcat
9759 dnl ===================================================================
9760 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9761 if test "$with_system_libexttextcat" = "yes"; then
9762     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9764 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9766 dnl ===================================================================
9767 dnl Checking for libnumbertext
9768 dnl ===================================================================
9769 AC_MSG_CHECKING([whether to use libnumbertext])
9770 if test "$enable_libnumbertext" = "no"; then
9771     AC_MSG_RESULT([no])
9772     ENABLE_LIBNUMBERTEXT=
9773     SYSTEM_LIBNUMBERTEXT=
9774 else
9775     AC_MSG_RESULT([yes])
9776     ENABLE_LIBNUMBERTEXT=TRUE
9777     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9778     if test "$with_system_libnumbertext" = "yes"; then
9779         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9780         SYSTEM_LIBNUMBERTEXT=YES
9781     else
9782         SYSTEM_LIBNUMBERTEXT=
9783         AC_LANG_PUSH([C++])
9784         save_CPPFLAGS=$CPPFLAGS
9785         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9786         AC_CHECK_HEADERS([codecvt regex])
9787         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9788                 [ ENABLE_LIBNUMBERTEXT=''
9789                   LIBNUMBERTEXT_CFLAGS=''
9790                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9791                                Enable libnumbertext fallback (missing number to number name conversion).])
9792                 ])
9793         CPPFLAGS=$save_CPPFLAGS
9794         AC_LANG_POP([C++])
9795     fi
9796     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9797         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9798     fi
9800 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9801 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9802 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9803 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9805 dnl ***************************************
9806 dnl testing libc version for Linux...
9807 dnl ***************************************
9808 if test "$_os" = "Linux"; then
9809     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9810     exec 6>/dev/null # no output
9811     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9812     exec 6>&1 # output on again
9813     if test "$HAVE_LIBC"; then
9814         AC_MSG_RESULT([yes])
9815     else
9816         AC_MSG_ERROR([no, upgrade libc])
9817     fi
9820 dnl =========================================
9821 dnl Check for uuidgen
9822 dnl =========================================
9823 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9824     # presence is already tested above in the WINDOWS_SDK_HOME check
9825     UUIDGEN=uuidgen.exe
9826     AC_SUBST(UUIDGEN)
9827 else
9828     AC_PATH_PROG([UUIDGEN], [uuidgen])
9829     if test -z "$UUIDGEN"; then
9830         AC_MSG_WARN([uuid is needed for building installation sets])
9831     fi
9834 dnl ***************************************
9835 dnl Checking for bison and flex
9836 dnl ***************************************
9837 AC_PATH_PROG(BISON, bison)
9838 if test -z "$BISON"; then
9839     AC_MSG_ERROR([no bison found in \$PATH, install it])
9840 else
9841     AC_MSG_CHECKING([the bison version])
9842     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9843     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9844     # Accept newer than 2.0
9845     if test "$_bison_longver" -lt 2000; then
9846         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9847     fi
9850 AC_PATH_PROG(FLEX, flex)
9851 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9852     FLEX=`cygpath -m $FLEX`
9854 if test -z "$FLEX"; then
9855     AC_MSG_ERROR([no flex found in \$PATH, install it])
9856 else
9857     AC_MSG_CHECKING([the flex version])
9858     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9859     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9860         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9861     fi
9863 AC_SUBST([FLEX])
9864 dnl ***************************************
9865 dnl Checking for patch
9866 dnl ***************************************
9867 AC_PATH_PROG(PATCH, patch)
9868 if test -z "$PATCH"; then
9869     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9872 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9873 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9874     if test -z "$with_gnu_patch"; then
9875         GNUPATCH=$PATCH
9876     else
9877         if test -x "$with_gnu_patch"; then
9878             GNUPATCH=$with_gnu_patch
9879         else
9880             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9881         fi
9882     fi
9884     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9885     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9886         AC_MSG_RESULT([yes])
9887     else
9888         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9889     fi
9890 else
9891     GNUPATCH=$PATCH
9894 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9895     GNUPATCH=`cygpath -m $GNUPATCH`
9898 dnl We also need to check for --with-gnu-cp
9900 if test -z "$with_gnu_cp"; then
9901     # check the place where the good stuff is hidden on Solaris...
9902     if test -x /usr/gnu/bin/cp; then
9903         GNUCP=/usr/gnu/bin/cp
9904     else
9905         AC_PATH_PROGS(GNUCP, gnucp cp)
9906     fi
9907     if test -z $GNUCP; then
9908         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9909     fi
9910 else
9911     if test -x "$with_gnu_cp"; then
9912         GNUCP=$with_gnu_cp
9913     else
9914         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9915     fi
9918 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9919     GNUCP=`cygpath -m $GNUCP`
9922 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9923 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9924     AC_MSG_RESULT([yes])
9925 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9926     AC_MSG_RESULT([yes])
9927 else
9928     case "$build_os" in
9929     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9930         x_GNUCP=[\#]
9931         GNUCP=''
9932         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9933         ;;
9934     *)
9935         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9936         ;;
9937     esac
9940 AC_SUBST(GNUPATCH)
9941 AC_SUBST(GNUCP)
9942 AC_SUBST(x_GNUCP)
9944 dnl ***************************************
9945 dnl testing assembler path
9946 dnl ***************************************
9947 ML_EXE=""
9948 if test "$_os" = "WINNT"; then
9949     if test "$BITNESS_OVERRIDE" = ""; then
9950         assembler=ml.exe
9951         assembler_bin=$CL_DIR
9952     else
9953         assembler=ml64.exe
9954         assembler_bin=$CL_DIR
9955     fi
9957     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9958     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9959         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9960         AC_MSG_RESULT([found])
9961         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9962     else
9963         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9964     fi
9966     PathFormat "$ASM_HOME"
9967     ASM_HOME="$formatted_path"
9968 else
9969     ASM_HOME=""
9972 AC_SUBST(ML_EXE)
9974 dnl ===================================================================
9975 dnl We need zip and unzip
9976 dnl ===================================================================
9977 AC_PATH_PROG(ZIP, zip)
9978 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9979 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9980     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],,)
9983 AC_PATH_PROG(UNZIP, unzip)
9984 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9986 dnl ===================================================================
9987 dnl Zip must be a specific type for different build types.
9988 dnl ===================================================================
9989 if test $build_os = cygwin; then
9990     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9991         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9992     fi
9995 dnl ===================================================================
9996 dnl We need touch with -h option support.
9997 dnl ===================================================================
9998 AC_PATH_PROG(TOUCH, touch)
9999 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10000 touch warn
10001 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10002     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],,)
10005 dnl ===================================================================
10006 dnl Check for system epoxy
10007 dnl ===================================================================
10008 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10010 dnl ===================================================================
10011 dnl Set vcl option: coordinate device in double or sal_Int32
10012 dnl ===================================================================
10014 dnl disabled for now, we don't want subtle differences between OSs
10015 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10016 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10017 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10018 dnl     AC_MSG_RESULT([double])
10019 dnl else
10020 dnl     AC_MSG_RESULT([sal_Int32])
10021 dnl fi
10023 dnl ===================================================================
10024 dnl Test which vclplugs have to be built.
10025 dnl ===================================================================
10026 R=""
10027 if test "$USING_X11" != TRUE; then
10028     enable_gtk=no
10029     enable_gtk3=no
10031 GTK3_CFLAGS=""
10032 GTK3_LIBS=""
10033 ENABLE_GTK3=""
10034 if test "x$enable_gtk3" = "xyes"; then
10035     if test "$with_system_cairo" = no; then
10036         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10037     fi
10038     : ${with_system_cairo:=yes}
10039     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="")
10040     if test "x$ENABLE_GTK3" = "xTRUE"; then
10041         R="gtk3"
10042         dnl Avoid installed by unpackaged files for now.
10043         if test -z "$PKGFORMAT"; then
10044             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10045         fi
10046     else
10047         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10048     fi
10049     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10050     FilterLibs "${GTK3_LIBS}"
10051     GTK3_LIBS="${filteredlibs}"
10053     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10054     if test "$with_system_epoxy" != "yes"; then
10055         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10056         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10057                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10058     fi
10060 AC_SUBST(GTK3_LIBS)
10061 AC_SUBST(GTK3_CFLAGS)
10062 AC_SUBST(ENABLE_GTK3)
10064 ENABLE_GTK=""
10065 if test "x$enable_gtk" = "xyes"; then
10066     if test "$with_system_cairo" = no; then
10067         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10068     fi
10069     : ${with_system_cairo:=yes}
10070     ENABLE_GTK="TRUE"
10071     AC_DEFINE(ENABLE_GTK)
10072     R="gtk $R"
10074 AC_SUBST(ENABLE_GTK)
10076 ENABLE_KDE4=""
10077 if test "x$enable_kde4" = "xyes"; then
10078     ENABLE_KDE4="TRUE"
10079     AC_DEFINE(ENABLE_KDE4)
10080     R="$R kde4"
10082 AC_SUBST(ENABLE_KDE4)
10084 ENABLE_QT5=""
10085 if test "x$enable_qt5" = "xyes"; then
10086     ENABLE_QT5="TRUE"
10087     AC_DEFINE(ENABLE_QT5)
10088     R="$R qt5"
10090 AC_SUBST(ENABLE_QT5)
10092 ENABLE_KDE5=""
10093 if test "x$enable_kde5" = "xyes"; then
10094     ENABLE_KDE5="TRUE"
10095     AC_DEFINE(ENABLE_KDE5)
10096     R="$R kde5"
10098 AC_SUBST(ENABLE_KDE5)
10100 ENABLE_GTK3_KDE5=""
10101 if test "x$enable_gtk3_kde5" = "xyes"; then
10102     ENABLE_GTK3_KDE5="TRUE"
10103     AC_DEFINE(ENABLE_GTK3_KDE5)
10104     R="$R gtk3_kde5"
10106 AC_SUBST(ENABLE_GTK3_KDE5)
10108 build_vcl_plugins="$R"
10109 if test -z "$build_vcl_plugins"; then
10110     build_vcl_plugins="none"
10112 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10114 dnl ===================================================================
10115 dnl check for dbus support
10116 dnl ===================================================================
10117 ENABLE_DBUS=""
10118 DBUS_CFLAGS=""
10119 DBUS_LIBS=""
10120 DBUS_GLIB_CFLAGS=""
10121 DBUS_GLIB_LIBS=""
10122 DBUS_HAVE_GLIB=""
10124 if test "$enable_dbus" = "no"; then
10125     test_dbus=no
10128 AC_MSG_CHECKING([whether to enable DBUS support])
10129 if test "$test_dbus" = "yes"; then
10130     ENABLE_DBUS="TRUE"
10131     AC_MSG_RESULT([yes])
10132     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10133     AC_DEFINE(ENABLE_DBUS)
10134     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10135     FilterLibs "${DBUS_LIBS}"
10136     DBUS_LIBS="${filteredlibs}"
10138     # Glib is needed for BluetoothServer
10139     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10140     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10141         [
10142             DBUS_HAVE_GLIB="TRUE"
10143             AC_DEFINE(DBUS_HAVE_GLIB,1)
10144         ],
10145         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10146     )
10147 else
10148     AC_MSG_RESULT([no])
10151 AC_SUBST(ENABLE_DBUS)
10152 AC_SUBST(DBUS_CFLAGS)
10153 AC_SUBST(DBUS_LIBS)
10154 AC_SUBST(DBUS_GLIB_CFLAGS)
10155 AC_SUBST(DBUS_GLIB_LIBS)
10156 AC_SUBST(DBUS_HAVE_GLIB)
10158 AC_MSG_CHECKING([whether to enable Impress remote control])
10159 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10160     AC_MSG_RESULT([yes])
10161     ENABLE_SDREMOTE=TRUE
10162     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10164     # If not explicitly enabled or disabled, default
10165     if test -z "$enable_sdremote_bluetooth"; then
10166         case "$OS" in
10167         LINUX|MACOSX|WNT)
10168             # Default to yes for these
10169             enable_sdremote_bluetooth=yes
10170             ;;
10171         *)
10172             # otherwise no
10173             enable_sdremote_bluetooth=no
10174             ;;
10175         esac
10176     fi
10177     # $enable_sdremote_bluetooth is guaranteed non-empty now
10179     if test "$enable_sdremote_bluetooth" != "no"; then
10180         if test "$OS" = "LINUX"; then
10181             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10182                 AC_MSG_RESULT([yes])
10183                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10184                 dnl ===================================================================
10185                 dnl Check for system bluez
10186                 dnl ===================================================================
10187                 AC_MSG_CHECKING([which Bluetooth header to use])
10188                 if test "$with_system_bluez" = "yes"; then
10189                     AC_MSG_RESULT([external])
10190                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10191                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10192                     SYSTEM_BLUEZ=TRUE
10193                 else
10194                     AC_MSG_RESULT([internal])
10195                     SYSTEM_BLUEZ=
10196                 fi
10197             else
10198                 AC_MSG_RESULT([no, dbus disabled])
10199                 ENABLE_SDREMOTE_BLUETOOTH=
10200                 SYSTEM_BLUEZ=
10201             fi
10202         else
10203             AC_MSG_RESULT([yes])
10204             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10205             SYSTEM_BLUEZ=
10206         fi
10207     else
10208         AC_MSG_RESULT([no])
10209         ENABLE_SDREMOTE_BLUETOOTH=
10210         SYSTEM_BLUEZ=
10211     fi
10212 else
10213     ENABLE_SDREMOTE=
10214     SYSTEM_BLUEZ=
10215     AC_MSG_RESULT([no])
10217 AC_SUBST(ENABLE_SDREMOTE)
10218 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10219 AC_SUBST(SYSTEM_BLUEZ)
10221 dnl ===================================================================
10222 dnl Check whether the gtk 2.0 libraries are available.
10223 dnl ===================================================================
10225 GTK_CFLAGS=""
10226 GTK_LIBS=""
10227 if test  "$test_gtk" = "yes"; then
10229     if test "$ENABLE_GTK" = "TRUE"; then
10230         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]))
10231         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10232         FilterLibs "${GTK_LIBS}"
10233         GTK_LIBS="${filteredlibs}"
10234         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]))
10235         BUILD_TYPE="$BUILD_TYPE GTK"
10236         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10237         FilterLibs "${GTHREAD_LIBS}"
10238         GTHREAD_LIBS="${filteredlibs}"
10240         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10241         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10242                           [ENABLE_GTK_PRINT="TRUE"],
10243                           [ENABLE_GTK_PRINT=""])
10244         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10245         FilterLibs "${GTK_PRINT_LIBS}"
10246         GTK_PRINT_LIBS="${filteredlibs}"
10247     fi
10249     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10250         AC_MSG_CHECKING([whether to enable GIO support])
10251         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10252             dnl Need at least 2.26 for the dbus support.
10253             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10254                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10255             if test "$ENABLE_GIO" = "TRUE"; then
10256                 AC_DEFINE(ENABLE_GIO)
10257                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10258                 FilterLibs "${GIO_LIBS}"
10259                 GIO_LIBS="${filteredlibs}"
10260             fi
10261         else
10262             AC_MSG_RESULT([no])
10263         fi
10264     fi
10266 AC_SUBST(ENABLE_GIO)
10267 AC_SUBST(GIO_CFLAGS)
10268 AC_SUBST(GIO_LIBS)
10269 AC_SUBST(GTK_CFLAGS)
10270 AC_SUBST(GTK_LIBS)
10271 AC_SUBST(GTHREAD_CFLAGS)
10272 AC_SUBST(GTHREAD_LIBS)
10273 AC_SUBST([ENABLE_GTK_PRINT])
10274 AC_SUBST([GTK_PRINT_CFLAGS])
10275 AC_SUBST([GTK_PRINT_LIBS])
10278 dnl ===================================================================
10280 SPLIT_APP_MODULES=""
10281 if test "$enable_split_app_modules" = "yes"; then
10282     SPLIT_APP_MODULES="TRUE"
10284 AC_SUBST(SPLIT_APP_MODULES)
10286 SPLIT_OPT_FEATURES=""
10287 if test "$enable_split_opt_features" = "yes"; then
10288     SPLIT_OPT_FEATURES="TRUE"
10290 AC_SUBST(SPLIT_OPT_FEATURES)
10292 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10293     if test "$enable_cairo_canvas" = yes; then
10294         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10295     fi
10296     enable_cairo_canvas=no
10297 elif test -z "$enable_cairo_canvas"; then
10298     enable_cairo_canvas=yes
10301 ENABLE_CAIRO_CANVAS=""
10302 if test "$enable_cairo_canvas" = "yes"; then
10303     test_cairo=yes
10304     ENABLE_CAIRO_CANVAS="TRUE"
10305     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10307 AC_SUBST(ENABLE_CAIRO_CANVAS)
10309 dnl ===================================================================
10310 dnl Check whether the GStreamer libraries are available.
10311 dnl It's possible to build avmedia with both GStreamer backends!
10312 dnl ===================================================================
10314 ENABLE_GSTREAMER_1_0=""
10316 if test "$build_gstreamer_1_0" = "yes"; then
10318     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10319     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10320         ENABLE_GSTREAMER_1_0="TRUE"
10321         AC_MSG_RESULT([yes])
10322         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10323         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10324         FilterLibs "${GSTREAMER_1_0_LIBS}"
10325         GSTREAMER_1_0_LIBS="${filteredlibs}"
10326     else
10327         AC_MSG_RESULT([no])
10328     fi
10330 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10331 AC_SUBST(GSTREAMER_1_0_LIBS)
10332 AC_SUBST(ENABLE_GSTREAMER_1_0)
10335 ENABLE_GSTREAMER_0_10=""
10336 if test "$build_gstreamer_0_10" = "yes"; then
10338     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10339     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10340         ENABLE_GSTREAMER_0_10="TRUE"
10341         AC_MSG_RESULT([yes])
10342         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10343             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10344         ])
10345         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10346         FilterLibs "${GSTREAMER_0_10_LIBS}"
10347         GSTREAMER_0_10_LIBS="${filteredlibs}"
10348     else
10349         AC_MSG_RESULT([no])
10350     fi
10353 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10354 AC_SUBST(GSTREAMER_0_10_LIBS)
10355 AC_SUBST(ENABLE_GSTREAMER_0_10)
10357 dnl ===================================================================
10358 dnl Check whether to build the VLC avmedia backend
10359 dnl ===================================================================
10361 ENABLE_VLC=""
10363 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10364 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10365     ENABLE_VLC="TRUE"
10366     AC_MSG_RESULT([yes])
10367 else
10368     AC_MSG_RESULT([no])
10370 AC_SUBST(ENABLE_VLC)
10372 ENABLE_OPENGL_TRANSITIONS=
10373 ENABLE_OPENGL_CANVAS=
10374 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10375    : # disable
10376 elif test "$_os" = "Darwin"; then
10377     # We use frameworks on Mac OS X, no need for detail checks
10378     ENABLE_OPENGL_TRANSITIONS=TRUE
10379     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10380     ENABLE_OPENGL_CANVAS=TRUE
10381 elif test $_os = WINNT; then
10382     ENABLE_OPENGL_TRANSITIONS=TRUE
10383     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10384     ENABLE_OPENGL_CANVAS=TRUE
10385 else
10386     if test "$USING_X11" = TRUE; then
10387         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10388         ENABLE_OPENGL_TRANSITIONS=TRUE
10389         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10390         ENABLE_OPENGL_CANVAS=TRUE
10391     fi
10394 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10395 AC_SUBST(ENABLE_OPENGL_CANVAS)
10397 dnl =================================================
10398 dnl Check whether to build with OpenCL support.
10399 dnl =================================================
10401 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10402     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10403     # platform (optional at run-time, used through clew).
10404     BUILD_TYPE="$BUILD_TYPE OPENCL"
10405     AC_DEFINE(HAVE_FEATURE_OPENCL)
10408 dnl =================================================
10409 dnl Check whether to build with dconf support.
10410 dnl =================================================
10412 if test "$enable_dconf" != no; then
10413     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10414         if test "$enable_dconf" = yes; then
10415             AC_MSG_ERROR([dconf not found])
10416         else
10417             enable_dconf=no
10418         fi])
10420 AC_MSG_CHECKING([whether to enable dconf])
10421 if test "$enable_dconf" = no; then
10422     DCONF_CFLAGS=
10423     DCONF_LIBS=
10424     ENABLE_DCONF=
10425     AC_MSG_RESULT([no])
10426 else
10427     ENABLE_DCONF=TRUE
10428     AC_DEFINE(ENABLE_DCONF)
10429     AC_MSG_RESULT([yes])
10431 AC_SUBST([DCONF_CFLAGS])
10432 AC_SUBST([DCONF_LIBS])
10433 AC_SUBST([ENABLE_DCONF])
10435 # pdf import?
10436 AC_MSG_CHECKING([whether to build the PDF import feature])
10437 ENABLE_PDFIMPORT=
10438 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10439     AC_MSG_RESULT([yes])
10440     ENABLE_PDFIMPORT=TRUE
10441     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10443     dnl ===================================================================
10444     dnl Check for system poppler
10445     dnl ===================================================================
10446     AC_MSG_CHECKING([which PDF import backend to use])
10447     if test "$with_system_poppler" = "yes"; then
10448         AC_MSG_RESULT([external])
10449         SYSTEM_POPPLER=TRUE
10450         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10451         AC_LANG_PUSH([C++])
10452         save_CXXFLAGS=$CXXFLAGS
10453         save_CPPFLAGS=$CPPFLAGS
10454         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10455         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10456         AC_CHECK_HEADER([cpp/poppler-version.h],
10457             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10458             [])
10459         CXXFLAGS=$save_CXXFLAGS
10460         CPPFLAGS=$save_CPPFLAGS
10461         AC_LANG_POP([C++])
10462         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10464         FilterLibs "${POPPLER_LIBS}"
10465         POPPLER_LIBS="${filteredlibs}"
10466     else
10467         AC_MSG_RESULT([internal])
10468         SYSTEM_POPPLER=
10469         BUILD_TYPE="$BUILD_TYPE POPPLER"
10470         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10471     fi
10472     AC_DEFINE([ENABLE_PDFIMPORT],1)
10473 else
10474     AC_MSG_RESULT([no])
10476 AC_SUBST(ENABLE_PDFIMPORT)
10477 AC_SUBST(SYSTEM_POPPLER)
10478 AC_SUBST(POPPLER_CFLAGS)
10479 AC_SUBST(POPPLER_LIBS)
10481 # pdf import?
10482 AC_MSG_CHECKING([whether to build PDFium])
10483 ENABLE_PDFIUM=
10484 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10485     AC_MSG_RESULT([yes])
10486     ENABLE_PDFIUM=TRUE
10487     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10488     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10489 else
10490     AC_MSG_RESULT([no])
10492 AC_SUBST(ENABLE_PDFIUM)
10494 SYSTEM_GPGMEPP=
10496 if test "$build_for_ios" = "YES"; then
10497     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10498     AC_MSG_RESULT([yes])
10499 elif test "$enable_mpl_subset" = "yes"; then
10500     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10501     AC_MSG_RESULT([yes])
10502 elif test "$enable_fuzzers" = "yes"; then
10503     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10504     AC_MSG_RESULT([yes])
10505 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10506     dnl ===================================================================
10507     dnl Check for system gpgme
10508     dnl ===================================================================
10509     AC_MSG_CHECKING([which gpgmepp to use])
10510     if test "$with_system_gpgmepp" = "yes"; then
10511         AC_MSG_RESULT([external])
10512         SYSTEM_GPGMEPP=TRUE
10514         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10515         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10516             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10517         # progress_callback is the only func with plain C linkage
10518         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10519         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10520             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10521         AC_CHECK_HEADER(gpgme.h, [],
10522             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10523     else
10524         AC_MSG_RESULT([internal])
10525         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10526         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10528         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10529         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10530         if test "$_os" != "WINNT"; then
10531             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10532             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10533         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10534             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10535         fi
10536     fi
10537     ENABLE_GPGMEPP=TRUE
10538     AC_DEFINE([HAVE_FEATURE_GPGME])
10539     AC_PATH_PROG(GPG, gpg)
10540     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10541     # so let's exclude that manually for the moment
10542     if test -n "$GPG" -a "$_os" != "WINNT"; then
10543         # make sure we not only have a working gpgme, but a full working
10544         # gpg installation to run OpenPGP signature verification
10545         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10546     fi
10547     if test "$_os" = "Linux"; then
10548       uid=`id -u`
10549       AC_MSG_CHECKING([for /run/user/$uid])
10550       if test -d /run/user/$uid; then
10551         AC_MSG_RESULT([yes])
10552         AC_PATH_PROG(GPGCONF, gpgconf)
10553         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10554         if $GPGCONF --dump-options > /dev/null ; then
10555           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10556             AC_MSG_RESULT([yes])
10557             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10558             AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10559           else
10560             AC_MSG_RESULT([no])
10561           fi
10562         else
10563           AC_MSG_RESULT([no. missing or broken gpgconf?])
10564         fi
10565       else
10566         AC_MSG_RESULT([no])
10567      fi
10568    fi
10570 AC_SUBST(ENABLE_GPGMEPP)
10571 AC_SUBST(SYSTEM_GPGMEPP)
10572 AC_SUBST(GPG_ERROR_CFLAGS)
10573 AC_SUBST(GPG_ERROR_LIBS)
10574 AC_SUBST(LIBASSUAN_CFLAGS)
10575 AC_SUBST(LIBASSUAN_LIBS)
10576 AC_SUBST(GPGMEPP_CFLAGS)
10577 AC_SUBST(GPGMEPP_LIBS)
10579 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10580 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10581     AC_MSG_RESULT([yes])
10582     ENABLE_MEDIAWIKI=TRUE
10583     BUILD_TYPE="$BUILD_TYPE XSLTML"
10584     if test  "x$with_java" = "xno"; then
10585         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10586     fi
10587 else
10588     AC_MSG_RESULT([no])
10589     ENABLE_MEDIAWIKI=
10590     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10592 AC_SUBST(ENABLE_MEDIAWIKI)
10594 AC_MSG_CHECKING([whether to build the Report Builder])
10595 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10596     AC_MSG_RESULT([yes])
10597     ENABLE_REPORTBUILDER=TRUE
10598     AC_MSG_CHECKING([which jfreereport libs to use])
10599     if test "$with_system_jfreereport" = "yes"; then
10600         SYSTEM_JFREEREPORT=TRUE
10601         AC_MSG_RESULT([external])
10602         if test -z $SAC_JAR; then
10603             SAC_JAR=/usr/share/java/sac.jar
10604         fi
10605         if ! test -f $SAC_JAR; then
10606              AC_MSG_ERROR(sac.jar not found.)
10607         fi
10609         if test -z $LIBXML_JAR; then
10610             if test -f /usr/share/java/libxml-1.0.0.jar; then
10611                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10612             elif test -f /usr/share/java/libxml.jar; then
10613                 LIBXML_JAR=/usr/share/java/libxml.jar
10614             else
10615                 AC_MSG_ERROR(libxml.jar replacement not found.)
10616             fi
10617         elif ! test -f $LIBXML_JAR; then
10618             AC_MSG_ERROR(libxml.jar not found.)
10619         fi
10621         if test -z $FLUTE_JAR; then
10622             if test -f/usr/share/java/flute-1.3.0.jar; then
10623                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10624             elif test -f /usr/share/java/flute.jar; then
10625                 FLUTE_JAR=/usr/share/java/flute.jar
10626             else
10627                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10628             fi
10629         elif ! test -f $FLUTE_JAR; then
10630             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10631         fi
10633         if test -z $JFREEREPORT_JAR; then
10634             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10635                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10636             elif test -f /usr/share/java/flow-engine.jar; then
10637                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10638             else
10639                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10640             fi
10641         elif ! test -f  $JFREEREPORT_JAR; then
10642                 AC_MSG_ERROR(jfreereport.jar not found.)
10643         fi
10645         if test -z $LIBLAYOUT_JAR; then
10646             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10647                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10648             elif test -f /usr/share/java/liblayout.jar; then
10649                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10650             else
10651                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10652             fi
10653         elif ! test -f $LIBLAYOUT_JAR; then
10654                 AC_MSG_ERROR(liblayout.jar not found.)
10655         fi
10657         if test -z $LIBLOADER_JAR; then
10658             if test -f /usr/share/java/libloader-1.0.0.jar; then
10659                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10660             elif test -f /usr/share/java/libloader.jar; then
10661                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10662             else
10663                 AC_MSG_ERROR(libloader.jar replacement not found.)
10664             fi
10665         elif ! test -f  $LIBLOADER_JAR; then
10666             AC_MSG_ERROR(libloader.jar not found.)
10667         fi
10669         if test -z $LIBFORMULA_JAR; then
10670             if test -f /usr/share/java/libformula-0.2.0.jar; then
10671                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10672             elif test -f /usr/share/java/libformula.jar; then
10673                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10674             else
10675                 AC_MSG_ERROR(libformula.jar replacement not found.)
10676             fi
10677         elif ! test -f $LIBFORMULA_JAR; then
10678                 AC_MSG_ERROR(libformula.jar not found.)
10679         fi
10681         if test -z $LIBREPOSITORY_JAR; then
10682             if test -f /usr/share/java/librepository-1.0.0.jar; then
10683                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10684             elif test -f /usr/share/java/librepository.jar; then
10685                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10686             else
10687                 AC_MSG_ERROR(librepository.jar replacement not found.)
10688             fi
10689         elif ! test -f $LIBREPOSITORY_JAR; then
10690             AC_MSG_ERROR(librepository.jar not found.)
10691         fi
10693         if test -z $LIBFONTS_JAR; then
10694             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10695                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10696             elif test -f /usr/share/java/libfonts.jar; then
10697                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10698             else
10699                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10700             fi
10701         elif ! test -f $LIBFONTS_JAR; then
10702                 AC_MSG_ERROR(libfonts.jar not found.)
10703         fi
10705         if test -z $LIBSERIALIZER_JAR; then
10706             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10707                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10708             elif test -f /usr/share/java/libserializer.jar; then
10709                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10710             else
10711                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10712             fi
10713         elif ! test -f $LIBSERIALIZER_JAR; then
10714                 AC_MSG_ERROR(libserializer.jar not found.)
10715         fi
10717         if test -z $LIBBASE_JAR; then
10718             if test -f /usr/share/java/libbase-1.0.0.jar; then
10719                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10720             elif test -f /usr/share/java/libbase.jar; then
10721                 LIBBASE_JAR=/usr/share/java/libbase.jar
10722             else
10723                 AC_MSG_ERROR(libbase.jar replacement not found.)
10724             fi
10725         elif ! test -f $LIBBASE_JAR; then
10726             AC_MSG_ERROR(libbase.jar not found.)
10727         fi
10729     else
10730         AC_MSG_RESULT([internal])
10731         SYSTEM_JFREEREPORT=
10732         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10733         NEED_ANT=TRUE
10734     fi
10735 else
10736     AC_MSG_RESULT([no])
10737     ENABLE_REPORTBUILDER=
10738     SYSTEM_JFREEREPORT=
10740 AC_SUBST(ENABLE_REPORTBUILDER)
10741 AC_SUBST(SYSTEM_JFREEREPORT)
10742 AC_SUBST(SAC_JAR)
10743 AC_SUBST(LIBXML_JAR)
10744 AC_SUBST(FLUTE_JAR)
10745 AC_SUBST(JFREEREPORT_JAR)
10746 AC_SUBST(LIBBASE_JAR)
10747 AC_SUBST(LIBLAYOUT_JAR)
10748 AC_SUBST(LIBLOADER_JAR)
10749 AC_SUBST(LIBFORMULA_JAR)
10750 AC_SUBST(LIBREPOSITORY_JAR)
10751 AC_SUBST(LIBFONTS_JAR)
10752 AC_SUBST(LIBSERIALIZER_JAR)
10754 # this has to be here because both the Wiki Publisher and the SRB use
10755 # commons-logging
10756 COMMONS_LOGGING_VERSION=1.2
10757 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10758     AC_MSG_CHECKING([which Apache commons-* libs to use])
10759     if test "$with_system_apache_commons" = "yes"; then
10760         SYSTEM_APACHE_COMMONS=TRUE
10761         AC_MSG_RESULT([external])
10762         if test -z $COMMONS_LOGGING_JAR; then
10763             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10764                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10765            elif test -f /usr/share/java/commons-logging.jar; then
10766                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10767             else
10768                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10769             fi
10770         elif ! test -f $COMMONS_LOGGING_JAR; then
10771             AC_MSG_ERROR(commons-logging.jar not found.)
10772         fi
10773     else
10774         AC_MSG_RESULT([internal])
10775         SYSTEM_APACHE_COMMONS=
10776         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10777         NEED_ANT=TRUE
10778     fi
10780 AC_SUBST(SYSTEM_APACHE_COMMONS)
10781 AC_SUBST(COMMONS_LOGGING_JAR)
10782 AC_SUBST(COMMONS_LOGGING_VERSION)
10784 # scripting provider for BeanShell?
10785 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10786 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10787     AC_MSG_RESULT([yes])
10788     ENABLE_SCRIPTING_BEANSHELL=TRUE
10790     dnl ===================================================================
10791     dnl Check for system beanshell
10792     dnl ===================================================================
10793     AC_MSG_CHECKING([which beanshell to use])
10794     if test "$with_system_beanshell" = "yes"; then
10795         AC_MSG_RESULT([external])
10796         SYSTEM_BSH=TRUE
10797         if test -z $BSH_JAR; then
10798             BSH_JAR=/usr/share/java/bsh.jar
10799         fi
10800         if ! test -f $BSH_JAR; then
10801             AC_MSG_ERROR(bsh.jar not found.)
10802         fi
10803     else
10804         AC_MSG_RESULT([internal])
10805         SYSTEM_BSH=
10806         BUILD_TYPE="$BUILD_TYPE BSH"
10807     fi
10808 else
10809     AC_MSG_RESULT([no])
10810     ENABLE_SCRIPTING_BEANSHELL=
10811     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10813 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10814 AC_SUBST(SYSTEM_BSH)
10815 AC_SUBST(BSH_JAR)
10817 # scripting provider for JavaScript?
10818 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10819 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10820     AC_MSG_RESULT([yes])
10821     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10823     dnl ===================================================================
10824     dnl Check for system rhino
10825     dnl ===================================================================
10826     AC_MSG_CHECKING([which rhino to use])
10827     if test "$with_system_rhino" = "yes"; then
10828         AC_MSG_RESULT([external])
10829         SYSTEM_RHINO=TRUE
10830         if test -z $RHINO_JAR; then
10831             RHINO_JAR=/usr/share/java/js.jar
10832         fi
10833         if ! test -f $RHINO_JAR; then
10834             AC_MSG_ERROR(js.jar not found.)
10835         fi
10836     else
10837         AC_MSG_RESULT([internal])
10838         SYSTEM_RHINO=
10839         BUILD_TYPE="$BUILD_TYPE RHINO"
10840         NEED_ANT=TRUE
10841     fi
10842 else
10843     AC_MSG_RESULT([no])
10844     ENABLE_SCRIPTING_JAVASCRIPT=
10845     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10847 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10848 AC_SUBST(SYSTEM_RHINO)
10849 AC_SUBST(RHINO_JAR)
10851 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10852 # paths should be added to library search path. So lets put all 64-bit
10853 # platforms there.
10854 supports_multilib=
10855 case "$host_cpu" in
10856 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10857     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10858         supports_multilib="yes"
10859     fi
10860     ;;
10862     ;;
10863 esac
10865 dnl ===================================================================
10866 dnl KDE4 Integration
10867 dnl ===================================================================
10869 KDE4_CFLAGS=""
10870 KDE4_LIBS=""
10871 QMAKE4="qmake"
10872 MOC4="moc"
10873 KDE4_GLIB_CFLAGS=""
10874 KDE4_GLIB_LIBS=""
10875 KDE4_HAVE_GLIB=""
10876 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10877     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10878     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10880     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10881     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10883     if test -n "$supports_multilib"; then
10884         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10885         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10886     fi
10888     if test -n "$QTDIR"; then
10889         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10890         if test -z "$supports_multilib"; then
10891             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10892         else
10893             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10894         fi
10895     fi
10896     if test -n "$QT4DIR"; then
10897         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10898         if test -z "$supports_multilib"; then
10899             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10900         else
10901             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10902         fi
10903     fi
10905     if test -n "$KDEDIR"; then
10906         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10907         if test -z "$supports_multilib"; then
10908             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10909         else
10910             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10911         fi
10912     fi
10913     if test -n "$KDE4DIR"; then
10914         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10915         if test -z "$supports_multilib"; then
10916             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10917         else
10918             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10919         fi
10920     fi
10922     qt4_test_include="Qt/qobject.h"
10923     qt4_test_library="libQtNetwork.so"
10924     kde4_test_include="kwindowsystem.h"
10925     kde4_test_library="libsolid.so"
10927     AC_MSG_CHECKING([for Qt4 headers])
10928     qt4_header_dir="no"
10929     for inc_dir in $qt4_incdirs; do
10930         if test -r "$inc_dir/$qt4_test_include"; then
10931             qt4_header_dir="$inc_dir"
10932             break
10933         fi
10934     done
10936     AC_MSG_RESULT([$qt4_header_dir])
10937     if test "x$qt4_header_dir" = "xno"; then
10938         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10939     fi
10941     dnl Check for qmake
10942     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10943     if test "$QMAKE4" = "no"; then
10944         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10945     else
10946         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10947         if test -z "$qmake4_test_ver"; then
10948             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10949         fi
10950     fi
10952     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10953     AC_MSG_CHECKING([for Qt4 libraries])
10954     qt4_lib_dir="no"
10955     for lib_dir in $qt4_libdirs; do
10956         if test -r "$lib_dir/$qt4_test_library"; then
10957             qt4_lib_dir="$lib_dir"
10958             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10959             break
10960         fi
10961     done
10963     AC_MSG_RESULT([$qt4_lib_dir])
10965     if test "x$qt4_lib_dir" = "xno"; then
10966         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10967     fi
10969     dnl Check for Meta Object Compiler
10971     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10972     MOC4="$MOCQT4"
10973     if test "$MOC4" = "no"; then
10974         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10975         if test "$MOC4" = "no"; then
10976             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10977 the root of your Qt installation by exporting QT4DIR before running "configure".])
10978         fi
10979     fi
10981     dnl Check for KDE4 headers
10982     AC_MSG_CHECKING([for KDE4 headers])
10983     kde4_incdir="no"
10984     for kde4_check in $kde4_incdirs; do
10985         if test -r "$kde4_check/$kde4_test_include"; then
10986             kde4_incdir="$kde4_check"
10987             break
10988         fi
10989     done
10990     AC_MSG_RESULT([$kde4_incdir])
10991     if test "x$kde4_incdir" = "xno"; then
10992         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10993     fi
10994     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10996     dnl Check for KDE4 libraries
10997     AC_MSG_CHECKING([for KDE4 libraries])
10998     kde4_libdir="no"
10999     for kde4_check in $kde4_libdirs; do
11000         if test -r "$kde4_check/$kde4_test_library"; then
11001             kde4_libdir="$kde4_check"
11002             break
11003         fi
11004     done
11006     AC_MSG_RESULT([$kde4_libdir])
11007     if test "x$kde4_libdir" = "xno"; then
11008         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11009     fi
11011     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11012     if ! test -z "$kde4_incdir"; then
11013         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11014     else
11015         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11016     fi
11018     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11019     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11020     FilterLibs "$KDE4_LIBS"
11021     KDE4_LIBS="$filteredlibs"
11023     AC_LANG_PUSH([C++])
11024     save_CXXFLAGS=$CXXFLAGS
11025     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11026     AC_MSG_CHECKING([whether KDE is >= 4.2])
11027        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11028 #include <kdeversion.h>
11030 int main(int argc, char **argv) {
11031        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11032        else return 1;
11034 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11035     CXXFLAGS=$save_CXXFLAGS
11036     AC_LANG_POP([C++])
11038     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11039     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11040     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11041         [
11042             KDE4_HAVE_GLIB=TRUE
11043             AC_DEFINE(KDE4_HAVE_GLIB,1)
11044             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11045             FilterLibs "${KDE4_GLIB_LIBS}"
11046             KDE4_GLIB_LIBS="${filteredlibs}"
11048             qt4_fix_warning=
11050             AC_LANG_PUSH([C++])
11051             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11052             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11053             #  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
11054             #               ^~~~~~~~~~~~~~~~~~~~~~~
11055             #               vptr for 'QObjectPrivate'
11056             # so temporarily ignore here whichever way would be used to make such errors fatal
11057             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
11058             save_CXX=$CXX
11059             CXX=$(printf %s "$CXX" \
11060                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11061             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
11062             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
11063             save_CXXFLAGS=$CXXFLAGS
11064             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11065             save_LIBS=$LIBS
11066             LIBS="$LIBS $KDE4_LIBS"
11067             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11069             # Prepare meta object data
11070             TSTBASE="tst_exclude_socket_notifiers"
11071             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11072             ln -fs "${TSTMOC}.hxx"
11073             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11075             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11076 #include <cstdlib>
11077 #include "tst_exclude_socket_notifiers.moc"
11079 int main(int argc, char *argv[])
11081     QCoreApplication app(argc, argv);
11082     exit(tst_processEventsExcludeSocket());
11083     return 0;
11085             ]])],[
11086                 AC_MSG_RESULT([yes])
11087             ],[
11088                 AC_MSG_RESULT([no])
11089                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11090                 if test -z "$qt4_fix_warning"; then
11091                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11092                 fi
11093                 qt4_fix_warning=1
11094                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11095                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11097             # Remove meta object data
11098             rm -f "${TSTBASE}."*
11100             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11102             # Prepare meta object data
11103             TSTBASE="tst_exclude_posted_events"
11104             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11105             ln -fs "${TSTMOC}.hxx"
11106             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11108             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11109 #include <cstdlib>
11110 #include "tst_exclude_posted_events.moc"
11112 int main(int argc, char *argv[])
11114     QCoreApplication app(argc, argv);
11115     exit(tst_excludePostedEvents());
11116     return 0;
11118             ]])],[
11119                 AC_MSG_RESULT([yes])
11120             ],[
11121                 AC_MSG_RESULT([no])
11122                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11123                 if test -z "$qt4_fix_warning"; then
11124                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11125                 fi
11126                 qt4_fix_warning=1
11127                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11128             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11130             # Remove meta object data
11131             rm -f "${TSTBASE}."*
11133             if test -n "$qt4_fix_warning"; then
11134                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11135             fi
11137             LIBS=$save_LIBS
11138             CXXFLAGS=$save_CXXFLAGS
11139             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11140             CXX=$save_CXX
11141             AC_LANG_POP([C++])
11142         ],
11143         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11145 AC_SUBST(KDE4_CFLAGS)
11146 AC_SUBST(KDE4_LIBS)
11147 AC_SUBST(MOC4)
11148 AC_SUBST(KDE4_GLIB_CFLAGS)
11149 AC_SUBST(KDE4_GLIB_LIBS)
11150 AC_SUBST(KDE4_HAVE_GLIB)
11152 dnl ===================================================================
11153 dnl QT5 Integration
11154 dnl ===================================================================
11156 QT5_CFLAGS=""
11157 QT5_LIBS=""
11158 QMAKE5="qmake"
11159 MOC5="moc"
11160 QT5_GLIB_CFLAGS=""
11161 QT5_GLIB_LIBS=""
11162 QT5_HAVE_GLIB=""
11163 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11164         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11165         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11166 then
11167     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11168     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11170     if test -n "$supports_multilib"; then
11171         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11172     fi
11174     qt5_test_include="QtWidgets/qapplication.h"
11175     qt5_test_library="libQt5Widgets.so"
11177     dnl Check for qmake5
11178     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11179     if test "$QMAKE5" = "no"; then
11180         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11181     else
11182         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11183         if test -z "$qmake5_test_ver"; then
11184             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11185         fi
11186         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11187         qt5_minimal_minor="6"
11188         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11189             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11190         else
11191             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11192         fi
11193     fi
11195     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11196     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11198     AC_MSG_CHECKING([for Qt5 headers])
11199     qt5_incdir="no"
11200     for inc_dir in $qt5_incdirs; do
11201         if test -r "$inc_dir/$qt5_test_include"; then
11202             qt5_incdir="$inc_dir"
11203             break
11204         fi
11205     done
11206     AC_MSG_RESULT([$qt5_incdir])
11207     if test "x$qt5_incdir" = "xno"; then
11208         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11209     fi
11211     AC_MSG_CHECKING([for Qt5 libraries])
11212     qt5_libdir="no"
11213     for lib_dir in $qt5_libdirs; do
11214         if test -r "$lib_dir/$qt5_test_library"; then
11215             qt5_libdir="$lib_dir"
11216             break
11217         fi
11218     done
11219     AC_MSG_RESULT([$qt5_libdir])
11220     if test "x$qt5_libdir" = "xno"; then
11221         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11222     fi
11224     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11225     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11226     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11228     dnl Check for Meta Object Compiler
11230     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11231     if test "$MOC5" = "no"; then
11232         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11233 the root of your Qt installation by exporting QT5DIR before running "configure".])
11234     fi
11236     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11237     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11238     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11239         [
11240             QT5_HAVE_GLIB=1
11241             AC_DEFINE(QT5_HAVE_GLIB,1)
11242         ],
11243         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11244     )
11246 AC_SUBST(QT5_CFLAGS)
11247 AC_SUBST(QT5_LIBS)
11248 AC_SUBST(MOC5)
11249 AC_SUBST(QT5_GLIB_CFLAGS)
11250 AC_SUBST(QT5_GLIB_LIBS)
11251 AC_SUBST(QT5_HAVE_GLIB)
11253 dnl ===================================================================
11254 dnl KDE5 Integration
11255 dnl ===================================================================
11257 KF5_CFLAGS=""
11258 KF5_LIBS=""
11259 KF5_CONFIG="kf5-config"
11260 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11261         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11262         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11263 then
11264     if test "$OS" = "HAIKU"; then
11265         haiku_arch="`echo $RTL_ARCH | tr X x`"
11266         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11267         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11268     fi
11270     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11271     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11272     if test -n "$supports_multilib"; then
11273         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11274     fi
11276     kf5_test_include="KF5/kcoreaddons_version.h"
11277     kf5_test_library="libKF5CoreAddons.so"
11278     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11280     dnl kf5 KDE4 support compatibility installed
11281     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11282     if test "$KF5_CONFIG" != "no"; then
11283         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11284         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11285     fi
11287     dnl Check for KF5 headers
11288     AC_MSG_CHECKING([for KF5 headers])
11289     kf5_incdir="no"
11290     for kf5_check in $kf5_incdirs; do
11291         if test -r "$kf5_check/$kf5_test_include"; then
11292             kf5_incdir="$kf5_check/KF5"
11293             break
11294         fi
11295     done
11296     AC_MSG_RESULT([$kf5_incdir])
11297     if test "x$kf5_incdir" = "xno"; then
11298         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11299     fi
11301     dnl Check for KF5 libraries
11302     AC_MSG_CHECKING([for KF5 libraries])
11303     kf5_libdir="no"
11304     for kf5_check in $kf5_libdirs; do
11305         if test -r "$kf5_check/$kf5_test_library"; then
11306             kf5_libdir="$kf5_check"
11307             break
11308         fi
11309     done
11311     AC_MSG_RESULT([$kf5_libdir])
11312     if test "x$kf5_libdir" = "xno"; then
11313         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11314     fi
11316     if test "$USING_X11" = TRUE; then
11317         PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11318     fi
11320     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"
11321     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11322     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11324     if test "$USING_X11" = TRUE; then
11325         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11326     fi
11328     AC_LANG_PUSH([C++])
11329     save_CXXFLAGS=$CXXFLAGS
11330     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11331     AC_MSG_CHECKING([whether KDE is >= 5.0])
11332        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11333 #include <kcoreaddons_version.h>
11335 int main(int argc, char **argv) {
11336        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11337        else return 1;
11339        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11340     CXXFLAGS=$save_CXXFLAGS
11341     AC_LANG_POP([C++])
11343 AC_SUBST(KF5_CFLAGS)
11344 AC_SUBST(KF5_LIBS)
11346 dnl ===================================================================
11347 dnl Test whether to include Evolution 2 support
11348 dnl ===================================================================
11349 AC_MSG_CHECKING([whether to enable evolution 2 support])
11350 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11351     AC_MSG_RESULT([yes])
11352     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11353     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11354     FilterLibs "${GOBJECT_LIBS}"
11355     GOBJECT_LIBS="${filteredlibs}"
11356     ENABLE_EVOAB2="TRUE"
11357 else
11358     ENABLE_EVOAB2=""
11359     AC_MSG_RESULT([no])
11361 AC_SUBST(ENABLE_EVOAB2)
11362 AC_SUBST(GOBJECT_CFLAGS)
11363 AC_SUBST(GOBJECT_LIBS)
11365 dnl ===================================================================
11366 dnl Test which themes to include
11367 dnl ===================================================================
11368 AC_MSG_CHECKING([which themes to include])
11369 # if none given use default subset of available themes
11370 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11371     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga sifr sifr_dark tango"
11374 WITH_THEMES=""
11375 if test "x$with_theme" != "xno"; then
11376     for theme in $with_theme; do
11377         case $theme in
11378         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11379         default) real_theme=colibre ;;
11380         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11381         esac
11382         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11383     done
11385 AC_MSG_RESULT([$WITH_THEMES])
11386 AC_SUBST([WITH_THEMES])
11387 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11388 for theme in $with_theme; do
11389     case $theme in
11390     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11391     *) ;;
11392     esac
11393 done
11395 dnl ===================================================================
11396 dnl Test whether to integrate helppacks into the product's installer
11397 dnl ===================================================================
11398 AC_MSG_CHECKING([for helppack integration])
11399 if test "$with_helppack_integration" = "no"; then
11400     AC_MSG_RESULT([no integration])
11401 else
11402     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11403     AC_MSG_RESULT([integration])
11406 ###############################################################################
11407 # Extensions checking
11408 ###############################################################################
11409 AC_MSG_CHECKING([for extensions integration])
11410 if test "x$enable_extension_integration" != "xno"; then
11411     WITH_EXTENSION_INTEGRATION=TRUE
11412     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11413     AC_MSG_RESULT([yes, use integration])
11414 else
11415     WITH_EXTENSION_INTEGRATION=
11416     AC_MSG_RESULT([no, do not integrate])
11418 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11420 dnl Should any extra extensions be included?
11421 dnl There are standalone tests for each of these below.
11422 WITH_EXTRA_EXTENSIONS=
11423 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11425 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11426 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11427 if test "x$with_java" != "xno"; then
11428     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11429     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11432 AC_MSG_CHECKING([whether to build opens___.ttf])
11433 if test "$enable_build_opensymbol" = "yes"; then
11434     AC_MSG_RESULT([yes])
11435     AC_PATH_PROG(FONTFORGE, fontforge)
11436     if test -z "$FONTFORGE"; then
11437         AC_MSG_ERROR([fontforge not installed])
11438     fi
11439 else
11440     AC_MSG_RESULT([no])
11441     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11442     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11444 AC_SUBST(OPENSYMBOL_TTF)
11445 AC_SUBST(FONTFORGE)
11447 dnl ===================================================================
11448 dnl Test whether to include fonts
11449 dnl ===================================================================
11450 AC_MSG_CHECKING([whether to include third-party fonts])
11451 if test "$with_fonts" != "no"; then
11452     AC_MSG_RESULT([yes])
11453     WITH_FONTS=TRUE
11454     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11455     AC_DEFINE(HAVE_MORE_FONTS)
11456 else
11457     AC_MSG_RESULT([no])
11458     WITH_FONTS=
11459     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11461 AC_SUBST(WITH_FONTS)
11464 dnl ===================================================================
11465 dnl Test whether to enable online update service
11466 dnl ===================================================================
11467 AC_MSG_CHECKING([whether to enable online update])
11468 ENABLE_ONLINE_UPDATE=
11469 ENABLE_ONLINE_UPDATE_MAR=
11470 UPDATE_CONFIG=
11471 if test "$enable_online_update" = ""; then
11472     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11473         AC_MSG_RESULT([yes])
11474         ENABLE_ONLINE_UPDATE="TRUE"
11475     else
11476         AC_MSG_RESULT([no])
11477     fi
11478 else
11479     if test "$enable_online_update" = "mar"; then
11480         AC_MSG_RESULT([yes - MAR-based online update])
11481         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11482         if test "$with_update_config" = ""; then
11483             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11484         fi
11485         UPDATE_CONFIG="$with_update_config"
11486         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11487     elif test "$enable_online_update" = "yes"; then
11488         AC_MSG_RESULT([yes])
11489         ENABLE_ONLINE_UPDATE="TRUE"
11490     else
11491         AC_MSG_RESULT([no])
11492     fi
11494 AC_SUBST(ENABLE_ONLINE_UPDATE)
11495 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11496 AC_SUBST(UPDATE_CONFIG)
11498 dnl ===================================================================
11499 dnl Test whether we need bzip2
11500 dnl ===================================================================
11501 SYSTEM_BZIP2=
11502 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11503     AC_MSG_CHECKING([whether to use system bzip2])
11504     if test "$with_system_bzip2" = yes; then
11505         SYSTEM_BZIP2=TRUE
11506         AC_MSG_RESULT([yes])
11507         PKG_CHECK_MODULES(BZIP2, bzip2)
11508         FilterLibs "${BZIP2_LIBS}"
11509         BZIP2_LIBS="${filteredlibs}"
11510     else
11511         AC_MSG_RESULT([no])
11512         BUILD_TYPE="$BUILD_TYPE BZIP2"
11513     fi
11515 AC_SUBST(SYSTEM_BZIP2)
11516 AC_SUBST(BZIP2_CFLAGS)
11517 AC_SUBST(BZIP2_LIBS)
11519 dnl ===================================================================
11520 dnl Test whether to enable extension update
11521 dnl ===================================================================
11522 AC_MSG_CHECKING([whether to enable extension update])
11523 ENABLE_EXTENSION_UPDATE=
11524 if test "x$enable_extension_update" = "xno"; then
11525     AC_MSG_RESULT([no])
11526 else
11527     AC_MSG_RESULT([yes])
11528     ENABLE_EXTENSION_UPDATE="TRUE"
11529     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11530     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11532 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11535 dnl ===================================================================
11536 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11537 dnl ===================================================================
11538 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11539 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11540     AC_MSG_RESULT([no])
11541     ENABLE_SILENT_MSI=
11542 else
11543     AC_MSG_RESULT([yes])
11544     ENABLE_SILENT_MSI=TRUE
11545     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11547 AC_SUBST(ENABLE_SILENT_MSI)
11549 AC_MSG_CHECKING([whether and how to use Xinerama])
11550 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11551     if test "$x_libraries" = "default_x_libraries"; then
11552         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11553         if test "x$XINERAMALIB" = x; then
11554            XINERAMALIB="/usr/lib"
11555         fi
11556     else
11557         XINERAMALIB="$x_libraries"
11558     fi
11559     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11560         # we have both versions, let the user decide but use the dynamic one
11561         # per default
11562         USE_XINERAMA=TRUE
11563         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11564             XINERAMA_LINK=dynamic
11565         else
11566             XINERAMA_LINK=static
11567         fi
11568     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11569         # we have only the dynamic version
11570         USE_XINERAMA=TRUE
11571         XINERAMA_LINK=dynamic
11572     elif test -e "$XINERAMALIB/libXinerama.a"; then
11573         # static version
11574         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11575             USE_XINERAMA=TRUE
11576             XINERAMA_LINK=static
11577         else
11578             USE_XINERAMA=
11579             XINERAMA_LINK=none
11580         fi
11581     else
11582         # no Xinerama
11583         USE_XINERAMA=
11584         XINERAMA_LINK=none
11585     fi
11586     if test "$USE_XINERAMA" = "TRUE"; then
11587         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11588         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11589             [AC_MSG_ERROR(Xinerama header not found.)], [])
11590         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11591         if test "x$XEXTLIB" = x; then
11592            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11593         fi
11594         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11595         if test "$_os" = "FreeBSD"; then
11596             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11597         fi
11598         if test "$_os" = "Linux"; then
11599             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11600         fi
11601         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11602             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11603     else
11604         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11605     fi
11606 else
11607     USE_XINERAMA=
11608     XINERAMA_LINK=none
11609     AC_MSG_RESULT([no])
11611 AC_SUBST(USE_XINERAMA)
11612 AC_SUBST(XINERAMA_LINK)
11614 dnl ===================================================================
11615 dnl Test whether to build cairo or rely on the system version
11616 dnl ===================================================================
11618 if test "$USING_X11" = TRUE; then
11619     # Used in vcl/Library_vclplug_gen.mk
11620     test_cairo=yes
11623 if test "$test_cairo" = "yes"; then
11624     AC_MSG_CHECKING([whether to use the system cairo])
11626     : ${with_system_cairo:=$with_system_libs}
11627     if test "$with_system_cairo" = "yes"; then
11628         SYSTEM_CAIRO=TRUE
11629         AC_MSG_RESULT([yes])
11631         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11632         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11633         FilterLibs "${CAIRO_LIBS}"
11634         CAIRO_LIBS="${filteredlibs}"
11636         if test "$test_xrender" = "yes"; then
11637             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11638             AC_LANG_PUSH([C])
11639             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11640 #ifdef PictStandardA8
11641 #else
11642       return fail;
11643 #endif
11644 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11646             AC_LANG_POP([C])
11647         fi
11648     else
11649         SYSTEM_CAIRO=
11650         AC_MSG_RESULT([no])
11652         BUILD_TYPE="$BUILD_TYPE CAIRO"
11653     fi
11656 AC_SUBST(SYSTEM_CAIRO)
11657 AC_SUBST(CAIRO_CFLAGS)
11658 AC_SUBST(CAIRO_LIBS)
11660 dnl ===================================================================
11661 dnl Test whether to use avahi
11662 dnl ===================================================================
11663 if test "$_os" = "WINNT"; then
11664     # Windows uses bundled mDNSResponder
11665     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11666 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11667     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11668                       [ENABLE_AVAHI="TRUE"])
11669     AC_DEFINE(HAVE_FEATURE_AVAHI)
11670     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11671     FilterLibs "${AVAHI_LIBS}"
11672     AVAHI_LIBS="${filteredlibs}"
11675 AC_SUBST(ENABLE_AVAHI)
11676 AC_SUBST(AVAHI_CFLAGS)
11677 AC_SUBST(AVAHI_LIBS)
11679 dnl ===================================================================
11680 dnl Test whether to use liblangtag
11681 dnl ===================================================================
11682 SYSTEM_LIBLANGTAG=
11683 AC_MSG_CHECKING([whether to use system liblangtag])
11684 if test "$with_system_liblangtag" = yes; then
11685     SYSTEM_LIBLANGTAG=TRUE
11686     AC_MSG_RESULT([yes])
11687     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11688     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11689     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11690     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11691     FilterLibs "${LIBLANGTAG_LIBS}"
11692     LIBLANGTAG_LIBS="${filteredlibs}"
11693 else
11694     SYSTEM_LIBLANGTAG=
11695     AC_MSG_RESULT([no])
11696     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11697     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11698     if test "$COM" = "MSC"; then
11699         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11700     else
11701         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11702     fi
11704 AC_SUBST(SYSTEM_LIBLANGTAG)
11705 AC_SUBST(LIBLANGTAG_CFLAGS)
11706 AC_SUBST(LIBLANGTAG_LIBS)
11708 dnl ===================================================================
11709 dnl Test whether to build libpng or rely on the system version
11710 dnl ===================================================================
11712 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11714 dnl ===================================================================
11715 dnl Check for runtime JVM search path
11716 dnl ===================================================================
11717 if test "$ENABLE_JAVA" != ""; then
11718     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11719     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11720         AC_MSG_RESULT([yes])
11721         if ! test -d "$with_jvm_path"; then
11722             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11723         fi
11724         if ! test -d "$with_jvm_path"jvm; then
11725             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11726         fi
11727         JVM_ONE_PATH_CHECK="$with_jvm_path"
11728         AC_SUBST(JVM_ONE_PATH_CHECK)
11729     else
11730         AC_MSG_RESULT([no])
11731     fi
11734 dnl ===================================================================
11735 dnl Test for the presence of Ant and that it works
11736 dnl ===================================================================
11738 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11739     ANT_HOME=; export ANT_HOME
11740     WITH_ANT_HOME=; export WITH_ANT_HOME
11741     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11742         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11743             if test "$_os" = "WINNT"; then
11744                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11745             else
11746                 with_ant_home="$LODE_HOME/opt/ant"
11747             fi
11748         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11749             with_ant_home="$LODE_HOME/opt/ant"
11750         fi
11751     fi
11752     if test -z "$with_ant_home"; then
11753         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11754     else
11755         if test "$_os" = "WINNT"; then
11756             # AC_PATH_PROGS needs unix path
11757             with_ant_home=`cygpath -u "$with_ant_home"`
11758         fi
11759         AbsolutePath "$with_ant_home"
11760         with_ant_home=$absolute_path
11761         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11762         WITH_ANT_HOME=$with_ant_home
11763         ANT_HOME=$with_ant_home
11764     fi
11766     if test -z "$ANT"; then
11767         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11768     else
11769         # resolve relative or absolute symlink
11770         while test -h "$ANT"; do
11771             a_cwd=`pwd`
11772             a_basename=`basename "$ANT"`
11773             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11774             cd "`dirname "$ANT"`"
11775             cd "`dirname "$a_script"`"
11776             ANT="`pwd`"/"`basename "$a_script"`"
11777             cd "$a_cwd"
11778         done
11780         AC_MSG_CHECKING([if $ANT works])
11781         mkdir -p conftest.dir
11782         a_cwd=$(pwd)
11783         cd conftest.dir
11784         cat > conftest.java << EOF
11785         public class conftest {
11786             int testmethod(int a, int b) {
11787                     return a + b;
11788             }
11789         }
11792         cat > conftest.xml << EOF
11793         <project name="conftest" default="conftest">
11794         <target name="conftest">
11795             <javac srcdir="." includes="conftest.java">
11796             </javac>
11797         </target>
11798         </project>
11801         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11802         if test $? = 0 -a -f ./conftest.class; then
11803             AC_MSG_RESULT([Ant works])
11804             if test -z "$WITH_ANT_HOME"; then
11805                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11806                 if test -z "$ANT_HOME"; then
11807                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11808                 fi
11809             else
11810                 ANT_HOME="$WITH_ANT_HOME"
11811             fi
11812         else
11813             echo "configure: Ant test failed" >&5
11814             cat conftest.java >&5
11815             cat conftest.xml >&5
11816             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11817         fi
11818         cd "$a_cwd"
11819         rm -fr conftest.dir
11820     fi
11821     if test -z "$ANT_HOME"; then
11822         ANT_HOME="NO_ANT_HOME"
11823     else
11824         PathFormat "$ANT_HOME"
11825         ANT_HOME="$formatted_path"
11826         PathFormat "$ANT"
11827         ANT="$formatted_path"
11828     fi
11829     AC_SUBST(ANT_HOME)
11830     AC_SUBST(ANT)
11832     dnl Checking for ant.jar
11833     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11834         AC_MSG_CHECKING([Ant lib directory])
11835         if test -f $ANT_HOME/lib/ant.jar; then
11836             ANT_LIB="$ANT_HOME/lib"
11837         else
11838             if test -f $ANT_HOME/ant.jar; then
11839                 ANT_LIB="$ANT_HOME"
11840             else
11841                 if test -f /usr/share/java/ant.jar; then
11842                     ANT_LIB=/usr/share/java
11843                 else
11844                     if test -f /usr/share/ant-core/lib/ant.jar; then
11845                         ANT_LIB=/usr/share/ant-core/lib
11846                     else
11847                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11848                             ANT_LIB="$ANT_HOME/lib/ant"
11849                         else
11850                             if test -f /usr/share/lib/ant/ant.jar; then
11851                                 ANT_LIB=/usr/share/lib/ant
11852                             else
11853                                 AC_MSG_ERROR([Ant libraries not found!])
11854                             fi
11855                         fi
11856                     fi
11857                 fi
11858             fi
11859         fi
11860         PathFormat "$ANT_LIB"
11861         ANT_LIB="$formatted_path"
11862         AC_MSG_RESULT([Ant lib directory found.])
11863     fi
11864     AC_SUBST(ANT_LIB)
11866     ant_minver=1.6.0
11867     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11869     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11870     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11871     ant_version_major=`echo $ant_version | cut -d. -f1`
11872     ant_version_minor=`echo $ant_version | cut -d. -f2`
11873     echo "configure: ant_version $ant_version " >&5
11874     echo "configure: ant_version_major $ant_version_major " >&5
11875     echo "configure: ant_version_minor $ant_version_minor " >&5
11876     if test "$ant_version_major" -ge "2"; then
11877         AC_MSG_RESULT([yes, $ant_version])
11878     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11879         AC_MSG_RESULT([yes, $ant_version])
11880     else
11881         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11882     fi
11884     rm -f conftest* core core.* *.core
11887 OOO_JUNIT_JAR=
11888 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11889     AC_MSG_CHECKING([for JUnit 4])
11890     if test "$with_junit" = "yes"; then
11891         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11892             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11893         elif test -e /usr/share/java/junit4.jar; then
11894             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11895         else
11896            if test -e /usr/share/lib/java/junit.jar; then
11897               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11898            else
11899               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11900            fi
11901         fi
11902     else
11903         OOO_JUNIT_JAR=$with_junit
11904     fi
11905     if test "$_os" = "WINNT"; then
11906         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11907     fi
11908     printf 'import org.junit.Before;' > conftest.java
11909     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11910         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11911     else
11912         AC_MSG_ERROR(
11913 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11914  specify its pathname via --with-junit=..., or disable it via --without-junit])
11915     fi
11916     rm -f conftest.class conftest.java
11917     if test $OOO_JUNIT_JAR != ""; then
11918     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11919     fi
11921 AC_SUBST(OOO_JUNIT_JAR)
11923 HAMCREST_JAR=
11924 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11925     AC_MSG_CHECKING([for included Hamcrest])
11926     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11927     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11928         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11929     else
11930         AC_MSG_RESULT([Not included])
11931         AC_MSG_CHECKING([for standalone hamcrest jar.])
11932         if test "$with_hamcrest" = "yes"; then
11933             if test -e /usr/share/lib/java/hamcrest.jar; then
11934                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11935             elif test -e /usr/share/java/hamcrest/core.jar; then
11936                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11937             else
11938                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11939             fi
11940         else
11941             HAMCREST_JAR=$with_hamcrest
11942         fi
11943         if test "$_os" = "WINNT"; then
11944             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11945         fi
11946         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11947             AC_MSG_RESULT([$HAMCREST_JAR])
11948         else
11949             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),
11950                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11951         fi
11952     fi
11953     rm -f conftest.class conftest.java
11955 AC_SUBST(HAMCREST_JAR)
11958 AC_SUBST(SCPDEFS)
11961 # check for wget and curl
11963 WGET=
11964 CURL=
11966 if test "$enable_fetch_external" != "no"; then
11968 CURL=`which curl 2>/dev/null`
11970 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11971     # wget new enough?
11972     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11973     if test $? -eq 0; then
11974         WGET=$i
11975         break
11976     fi
11977 done
11979 if test -z "$WGET" -a -z "$CURL"; then
11980     AC_MSG_ERROR([neither wget nor curl found!])
11985 AC_SUBST(WGET)
11986 AC_SUBST(CURL)
11989 # check for sha256sum
11991 SHA256SUM=
11993 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11994     eval "$i -a 256 --version" > /dev/null 2>&1
11995     ret=$?
11996     if test $ret -eq 0; then
11997         SHA256SUM="$i -a 256"
11998         break
11999     fi
12000 done
12002 if test -z "$SHA256SUM"; then
12003     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12004         eval "$i --version" > /dev/null 2>&1
12005         ret=$?
12006         if test $ret -eq 0; then
12007             SHA256SUM=$i
12008             break
12009         fi
12010     done
12013 if test -z "$SHA256SUM"; then
12014     AC_MSG_ERROR([no sha256sum found!])
12017 AC_SUBST(SHA256SUM)
12019 dnl ===================================================================
12020 dnl Dealing with l10n options
12021 dnl ===================================================================
12022 AC_MSG_CHECKING([which languages to be built])
12023 # get list of all languages
12024 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12025 # the sed command does the following:
12026 #   + if a line ends with a backslash, append the next line to it
12027 #   + adds " on the beginning of the value (after =)
12028 #   + adds " at the end of the value
12029 #   + removes en-US; we want to put it on the beginning
12030 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12031 [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)]
12032 ALL_LANGS="en-US $completelangiso"
12033 # check the configured localizations
12034 WITH_LANG="$with_lang"
12036 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12037 # (Norwegian is "nb" and "nn".)
12038 if test "$WITH_LANG" = "no"; then
12039     WITH_LANG=
12042 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12043     AC_MSG_RESULT([en-US])
12044 else
12045     AC_MSG_RESULT([$WITH_LANG])
12046     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12047     if test -z "$MSGFMT"; then
12048         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12049             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12050         elif test -x "/opt/lo/bin/msgfmt"; then
12051             MSGFMT="/opt/lo/bin/msgfmt"
12052         else
12053             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12054             if test -z "$MSGFMT"; then
12055                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12056             fi
12057         fi
12058     fi
12059     if test -z "$MSGUNIQ"; then
12060         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12061             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12062         elif test -x "/opt/lo/bin/msguniq"; then
12063             MSGUNIQ="/opt/lo/bin/msguniq"
12064         else
12065             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12066             if test -z "$MSGUNIQ"; then
12067                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12068             fi
12069         fi
12070     fi
12072 AC_SUBST(MSGFMT)
12073 AC_SUBST(MSGUNIQ)
12074 # check that the list is valid
12075 for lang in $WITH_LANG; do
12076     test "$lang" = "ALL" && continue
12077     # need to check for the exact string, so add space before and after the list of all languages
12078     for vl in $ALL_LANGS; do
12079         if test "$vl" = "$lang"; then
12080            break
12081         fi
12082     done
12083     if test "$vl" != "$lang"; then
12084         # if you're reading this - you prolly quoted your languages remove the quotes ...
12085         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12086     fi
12087 done
12088 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12089     echo $WITH_LANG | grep -q en-US
12090     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12092 # list with substituted ALL
12093 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12094 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12095 test "$WITH_LANG" = "en-US" && WITH_LANG=
12096 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12097     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12098     ALL_LANGS=`echo $ALL_LANGS qtz`
12100 AC_SUBST(ALL_LANGS)
12101 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12102 AC_SUBST(WITH_LANG)
12103 AC_SUBST(WITH_LANG_LIST)
12104 AC_SUBST(GIT_NEEDED_SUBMODULES)
12106 WITH_POOR_HELP_LOCALIZATIONS=
12107 if test -d "$SRC_ROOT/translations/source"; then
12108     for l in `ls -1 $SRC_ROOT/translations/source`; do
12109         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12110             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12111         fi
12112     done
12114 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12116 if test -n "$with_locales"; then
12117     WITH_LOCALES="$with_locales"
12119     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12120     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12121     # config_host/config_locales.h.in
12122     for locale in $WITH_LOCALES; do
12123         lang=${locale%_*}
12125         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12127         case $lang in
12128         hi|mr*ne)
12129             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12130             ;;
12131         bg|ru)
12132             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12133             ;;
12134         esac
12135     done
12136 else
12137     AC_DEFINE(WITH_LOCALE_ALL)
12139 AC_SUBST(WITH_LOCALES)
12141 dnl git submodule update --reference
12142 dnl ===================================================================
12143 if test -n "${GIT_REFERENCE_SRC}"; then
12144     for repo in ${GIT_NEEDED_SUBMODULES}; do
12145         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12146             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12147         fi
12148     done
12150 AC_SUBST(GIT_REFERENCE_SRC)
12152 dnl git submodules linked dirs
12153 dnl ===================================================================
12154 if test -n "${GIT_LINK_SRC}"; then
12155     for repo in ${GIT_NEEDED_SUBMODULES}; do
12156         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12157             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12158         fi
12159     done
12161 AC_SUBST(GIT_LINK_SRC)
12163 dnl branding
12164 dnl ===================================================================
12165 AC_MSG_CHECKING([for alternative branding images directory])
12166 # initialize mapped arrays
12167 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12168 brand_files="$BRAND_INTRO_IMAGES about.svg"
12170 if test -z "$with_branding" -o "$with_branding" = "no"; then
12171     AC_MSG_RESULT([none])
12172     DEFAULT_BRAND_IMAGES="$brand_files"
12173 else
12174     if ! test -d $with_branding ; then
12175         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12176     else
12177         AC_MSG_RESULT([$with_branding])
12178         CUSTOM_BRAND_DIR="$with_branding"
12179         for lfile in $brand_files
12180         do
12181             if ! test -f $with_branding/$lfile ; then
12182                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12183                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12184             else
12185                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12186             fi
12187         done
12188         check_for_progress="yes"
12189     fi
12191 AC_SUBST([BRAND_INTRO_IMAGES])
12192 AC_SUBST([CUSTOM_BRAND_DIR])
12193 AC_SUBST([CUSTOM_BRAND_IMAGES])
12194 AC_SUBST([DEFAULT_BRAND_IMAGES])
12197 AC_MSG_CHECKING([for 'intro' progress settings])
12198 PROGRESSBARCOLOR=
12199 PROGRESSSIZE=
12200 PROGRESSPOSITION=
12201 PROGRESSFRAMECOLOR=
12202 PROGRESSTEXTCOLOR=
12203 PROGRESSTEXTBASELINE=
12205 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12206     source "$with_branding/progress.conf"
12207     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12208 else
12209     AC_MSG_RESULT([none])
12212 AC_SUBST(PROGRESSBARCOLOR)
12213 AC_SUBST(PROGRESSSIZE)
12214 AC_SUBST(PROGRESSPOSITION)
12215 AC_SUBST(PROGRESSFRAMECOLOR)
12216 AC_SUBST(PROGRESSTEXTCOLOR)
12217 AC_SUBST(PROGRESSTEXTBASELINE)
12220 AC_MSG_CHECKING([for extra build ID])
12221 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12222     EXTRA_BUILDID="$with_extra_buildid"
12224 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12225 if test -n "$EXTRA_BUILDID" ; then
12226     AC_MSG_RESULT([$EXTRA_BUILDID])
12227 else
12228     AC_MSG_RESULT([not set])
12230 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12232 OOO_VENDOR=
12233 AC_MSG_CHECKING([for vendor])
12234 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12235     OOO_VENDOR="$USERNAME"
12237     if test -z "$OOO_VENDOR"; then
12238         OOO_VENDOR="$USER"
12239     fi
12241     if test -z "$OOO_VENDOR"; then
12242         OOO_VENDOR="`id -u -n`"
12243     fi
12245     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12246 else
12247     OOO_VENDOR="$with_vendor"
12248     AC_MSG_RESULT([$OOO_VENDOR])
12250 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12251 AC_SUBST(OOO_VENDOR)
12253 if test "$_os" = "Android" ; then
12254     ANDROID_PACKAGE_NAME=
12255     AC_MSG_CHECKING([for Android package name])
12256     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12257         if test -n "$ENABLE_DEBUG"; then
12258             # Default to the package name that makes ndk-gdb happy.
12259             ANDROID_PACKAGE_NAME="org.libreoffice"
12260         else
12261             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12262         fi
12264         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12265     else
12266         ANDROID_PACKAGE_NAME="$with_android_package_name"
12267         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12268     fi
12269     AC_SUBST(ANDROID_PACKAGE_NAME)
12272 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12273 if test "$with_compat_oowrappers" = "yes"; then
12274     WITH_COMPAT_OOWRAPPERS=TRUE
12275     AC_MSG_RESULT(yes)
12276 else
12277     WITH_COMPAT_OOWRAPPERS=
12278     AC_MSG_RESULT(no)
12280 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12282 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12283 AC_MSG_CHECKING([for install dirname])
12284 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12285     INSTALLDIRNAME="$with_install_dirname"
12287 AC_MSG_RESULT([$INSTALLDIRNAME])
12288 AC_SUBST(INSTALLDIRNAME)
12290 AC_MSG_CHECKING([for prefix])
12291 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12292 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12293 PREFIXDIR="$prefix"
12294 AC_MSG_RESULT([$PREFIXDIR])
12295 AC_SUBST(PREFIXDIR)
12297 LIBDIR=[$(eval echo $(eval echo $libdir))]
12298 AC_SUBST(LIBDIR)
12300 DATADIR=[$(eval echo $(eval echo $datadir))]
12301 AC_SUBST(DATADIR)
12303 MANDIR=[$(eval echo $(eval echo $mandir))]
12304 AC_SUBST(MANDIR)
12306 DOCDIR=[$(eval echo $(eval echo $docdir))]
12307 AC_SUBST(DOCDIR)
12309 BINDIR=[$(eval echo $(eval echo $bindir))]
12310 AC_SUBST(BINDIR)
12312 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12313 AC_SUBST(INSTALLDIR)
12315 TESTINSTALLDIR="${BUILDDIR}/test-install"
12316 AC_SUBST(TESTINSTALLDIR)
12319 # ===================================================================
12320 # OAuth2 id and secrets
12321 # ===================================================================
12323 AC_MSG_CHECKING([for Google Drive client id and secret])
12324 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12325     AC_MSG_RESULT([not set])
12326     GDRIVE_CLIENT_ID="\"\""
12327     GDRIVE_CLIENT_SECRET="\"\""
12328 else
12329     AC_MSG_RESULT([set])
12330     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12331     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12333 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12334 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12336 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12337 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12338     AC_MSG_RESULT([not set])
12339     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12340     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12341 else
12342     AC_MSG_RESULT([set])
12343     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12344     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12346 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12347 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12349 AC_MSG_CHECKING([for OneDrive client id and secret])
12350 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12351     AC_MSG_RESULT([not set])
12352     ONEDRIVE_CLIENT_ID="\"\""
12353     ONEDRIVE_CLIENT_SECRET="\"\""
12354 else
12355     AC_MSG_RESULT([set])
12356     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12357     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12359 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12360 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12363 dnl ===================================================================
12364 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12365 dnl --enable-dependency-tracking configure option
12366 dnl ===================================================================
12367 AC_MSG_CHECKING([whether to enable dependency tracking])
12368 if test "$enable_dependency_tracking" = "no"; then
12369     nodep=TRUE
12370     AC_MSG_RESULT([no])
12371 else
12372     AC_MSG_RESULT([yes])
12374 AC_SUBST(nodep)
12376 dnl ===================================================================
12377 dnl Number of CPUs to use during the build
12378 dnl ===================================================================
12379 AC_MSG_CHECKING([for number of processors to use])
12380 # plain --with-parallelism is just the default
12381 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12382     if test "$with_parallelism" = "no"; then
12383         PARALLELISM=0
12384     else
12385         PARALLELISM=$with_parallelism
12386     fi
12387 else
12388     if test "$enable_icecream" = "yes"; then
12389         PARALLELISM="10"
12390     else
12391         case `uname -s` in
12393         Darwin|FreeBSD|NetBSD|OpenBSD)
12394             PARALLELISM=`sysctl -n hw.ncpu`
12395             ;;
12397         Linux)
12398             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12399         ;;
12400         # what else than above does profit here *and* has /proc?
12401         *)
12402             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12403             ;;
12404         esac
12406         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12407         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12408     fi
12411 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12412     if test -z "$with_parallelism"; then
12413             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12414             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12415             PARALLELISM="1"
12416     else
12417         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."
12418     fi
12421 if test $PARALLELISM -eq 0; then
12422     AC_MSG_RESULT([explicit make -j option needed])
12423 else
12424     AC_MSG_RESULT([$PARALLELISM])
12426 AC_SUBST(PARALLELISM)
12428 IWYU_PATH="$with_iwyu"
12429 AC_SUBST(IWYU_PATH)
12430 if test ! -z "$IWYU_PATH"; then
12431     if test ! -f "$IWYU_PATH"; then
12432         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12433     fi
12437 # Set up ILIB for MSVC build
12439 ILIB1=
12440 if test "$build_os" = "cygwin"; then
12441     ILIB="."
12442     if test -n "$JAVA_HOME"; then
12443         ILIB="$ILIB;$JAVA_HOME/lib"
12444     fi
12445     ILIB1=-link
12446     if test "$BITNESS_OVERRIDE" = 64; then
12447         ILIB="$ILIB;$COMPATH/lib/x64"
12448         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12449         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12450         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12451         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12452             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12453             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12454         fi
12455         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12456         ucrtlibpath_formatted=$formatted_path
12457         ILIB="$ILIB;$ucrtlibpath_formatted"
12458         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12459     else
12460         ILIB="$ILIB;$COMPATH/lib/x86"
12461         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12462         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12463         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12464         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12465             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12466             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12467         fi
12468         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12469         ucrtlibpath_formatted=$formatted_path
12470         ILIB="$ILIB;$ucrtlibpath_formatted"
12471         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12472     fi
12473     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12474         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12475     else
12476         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12477     fi
12479     AC_SUBST(ILIB)
12482 AC_MSG_CHECKING([whether $CXX supports inline variables])
12483 AC_LANG_PUSH([C++])
12484 save_CXXFLAGS=$CXXFLAGS
12485 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12486 if test "$build_os" = cygwin; then
12487     save_LIB=$LIB
12488     export LIB=$ILIB
12490 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
12491         #if !defined __cpp_inline_variables
12492         // This tests for one specific aspect of inline variables that is actually used by
12493         // ORegistry::ROOT (registry/source/regimpl.cxx):
12494         struct S { constexpr S() {} };
12495         struct T { static constexpr S s{}; };
12496         S const * f() { return &T::s; }
12497         #endif
12498     ]])], [
12499         AC_DEFINE([HAVE_CPP_INLINE_VARIABLES],[1])
12500         AC_MSG_RESULT([yes])
12501     ], [AC_MSG_RESULT([no])])
12502 CXXFLAGS=$save_CXXFLAGS
12503 if test "$build_os" = cygwin; then
12504     LIB=$save_LIB
12506 AC_LANG_POP([C++])
12508 dnl We should be able to drop the below check when bumping the GCC baseline to
12509 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12510 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12511 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12512 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12513 AC_MSG_CHECKING(
12514     [whether C++11 use of const_iterator in standard containers is broken])
12515 save_CXXFLAGS=$CXXFLAGS
12516 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12517 AC_LANG_PUSH([C++])
12518 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12519     #include <list>
12520     ]],[[
12521         std::list<int> l;
12522         l.erase(l.cbegin());
12523     ]])],
12524     [broken=no], [broken=yes])
12525 AC_LANG_POP([C++])
12526 CXXFLAGS=$save_CXXFLAGS
12527 AC_MSG_RESULT([$broken])
12528 if test "$broken" = yes; then
12529     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12533 # ===================================================================
12534 # Creating bigger shared library to link against
12535 # ===================================================================
12536 AC_MSG_CHECKING([whether to create huge library])
12537 MERGELIBS=
12539 if test $_os = iOS -o $_os = Android; then
12540     # Never any point in mergelibs for these as we build just static
12541     # libraries anyway...
12542     enable_mergelibs=no
12545 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12546     if test $_os != Linux -a $_os != WINNT; then
12547         add_warning "--enable-mergelibs is not tested for this platform"
12548     fi
12549     MERGELIBS="TRUE"
12550     AC_MSG_RESULT([yes])
12551 else
12552     AC_MSG_RESULT([no])
12554 AC_SUBST([MERGELIBS])
12556 dnl ===================================================================
12557 dnl icerun is a wrapper that stops us spawning tens of processes
12558 dnl locally - for tools that can't be executed on the compile cluster
12559 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12560 dnl ===================================================================
12561 AC_MSG_CHECKING([whether to use icerun wrapper])
12562 ICECREAM_RUN=
12563 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12564     ICECREAM_RUN=icerun
12565     AC_MSG_RESULT([yes])
12566 else
12567     AC_MSG_RESULT([no])
12569 AC_SUBST(ICECREAM_RUN)
12571 dnl ===================================================================
12572 dnl Setup the ICECC_VERSION for the build the same way it was set for
12573 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12574 dnl ===================================================================
12575 x_ICECC_VERSION=[\#]
12576 if test -n "$ICECC_VERSION" ; then
12577     x_ICECC_VERSION=
12579 AC_SUBST(x_ICECC_VERSION)
12580 AC_SUBST(ICECC_VERSION)
12582 dnl ===================================================================
12584 AC_MSG_CHECKING([MPL subset])
12585 MPL_SUBSET=
12587 if test "$enable_mpl_subset" = "yes"; then
12588     warn_report=false
12589     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12590         warn_report=true
12591     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12592         warn_report=true
12593     fi
12594     if test "$warn_report" = "true"; then
12595         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12596     fi
12597     if test "x$enable_postgresql_sdbc" != "xno"; then
12598         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12599     fi
12600     if test "$enable_lotuswordpro" = "yes"; then
12601         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12602     fi
12603     if test "$WITH_WEBDAV" = "neon"; then
12604         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12605     fi
12606     if test -n "$ENABLE_PDFIMPORT"; then
12607         if test "x$SYSTEM_POPPLER" = "x"; then
12608             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12609         fi
12610     fi
12611     # cf. m4/libo_check_extension.m4
12612     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12613         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12614     fi
12615     for theme in $WITH_THEMES; do
12616         case $theme in
12617         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12618             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12619         *) : ;;
12620         esac
12621     done
12623     ENABLE_OPENGL_TRANSITIONS=
12625     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12626         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12627     fi
12629     MPL_SUBSET="TRUE"
12630     AC_DEFINE(MPL_HAVE_SUBSET)
12631     AC_MSG_RESULT([only])
12632 else
12633     AC_MSG_RESULT([no restrictions])
12635 AC_SUBST(MPL_SUBSET)
12637 dnl ===================================================================
12639 AC_MSG_CHECKING([formula logger])
12640 ENABLE_FORMULA_LOGGER=
12642 if test "x$enable_formula_logger" = "xyes"; then
12643     AC_MSG_RESULT([yes])
12644     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12645     ENABLE_FORMULA_LOGGER=TRUE
12646 elif test -n "$ENABLE_DBGUTIL" ; then
12647     AC_MSG_RESULT([yes])
12648     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12649     ENABLE_FORMULA_LOGGER=TRUE
12650 else
12651     AC_MSG_RESULT([no])
12654 AC_SUBST(ENABLE_FORMULA_LOGGER)
12656 dnl ===================================================================
12657 dnl Setting up the environment.
12658 dnl ===================================================================
12659 AC_MSG_NOTICE([setting up the build environment variables...])
12661 AC_SUBST(COMPATH)
12663 if test "$build_os" = "cygwin"; then
12664     if test -d "$COMPATH/atlmfc/lib"; then
12665         ATL_LIB="$COMPATH/atlmfc/lib"
12666         ATL_INCLUDE="$COMPATH/atlmfc/include"
12667     else
12668         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12669         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12670     fi
12671     if test "$BITNESS_OVERRIDE" = 64; then
12672         if test $VCVER = "150"; then
12673             ATL_LIB="$ATL_LIB/x64"
12674         else
12675             ATL_LIB="$ATL_LIB/amd64"
12676         fi
12677     else
12678         if test $VCVER = "150"; then
12679             ATL_LIB="$ATL_LIB/x86"
12680         fi
12681     fi
12682     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12683     PathFormat "/usr/bin/find.exe"
12684     FIND="$formatted_path"
12685     PathFormat "/usr/bin/sort.exe"
12686     SORT="$formatted_path"
12687     PathFormat "/usr/bin/grep.exe"
12688     WIN_GREP="$formatted_path"
12689     PathFormat "/usr/bin/ls.exe"
12690     WIN_LS="$formatted_path"
12691     PathFormat "/usr/bin/touch.exe"
12692     WIN_TOUCH="$formatted_path"
12693 else
12694     FIND=find
12695     SORT=sort
12698 AC_SUBST(ATL_INCLUDE)
12699 AC_SUBST(ATL_LIB)
12700 AC_SUBST(FIND)
12701 AC_SUBST(SORT)
12702 AC_SUBST(WIN_GREP)
12703 AC_SUBST(WIN_LS)
12704 AC_SUBST(WIN_TOUCH)
12706 AC_SUBST(BUILD_TYPE)
12708 AC_SUBST(SOLARINC)
12710 PathFormat "$PERL"
12711 PERL="$formatted_path"
12712 AC_SUBST(PERL)
12714 if test -n "$TMPDIR"; then
12715     TEMP_DIRECTORY="$TMPDIR"
12716 else
12717     TEMP_DIRECTORY="/tmp"
12719 if test "$build_os" = "cygwin"; then
12720     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12722 AC_SUBST(TEMP_DIRECTORY)
12724 # setup the PATH for the environment
12725 if test -n "$LO_PATH_FOR_BUILD"; then
12726     LO_PATH="$LO_PATH_FOR_BUILD"
12727 else
12728     LO_PATH="$PATH"
12730     case "$host_os" in
12732     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12733         if test "$ENABLE_JAVA" != ""; then
12734             pathmunge "$JAVA_HOME/bin" "after"
12735         fi
12736         ;;
12738     cygwin*)
12739         # Win32 make needs native paths
12740         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12741             LO_PATH=`cygpath -p -m "$PATH"`
12742         fi
12743         if test "$BITNESS_OVERRIDE" = 64; then
12744             # needed for msi packaging
12745             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12746         fi
12747         # .NET 4.6 and higher don't have bin directory
12748         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12749             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12750         fi
12751         pathmunge "$ASM_HOME" "before"
12752         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12753         pathmunge "$CSC_PATH" "before"
12754         pathmunge "$MIDL_PATH" "before"
12755         pathmunge "$AL_PATH" "before"
12756         pathmunge "$MSPDB_PATH" "before"
12757         if test -n "$MSBUILD_PATH" ; then
12758             pathmunge "$MSBUILD_PATH" "before"
12759         fi
12760         if test "$BITNESS_OVERRIDE" = 64; then
12761             pathmunge "$COMPATH/bin/amd64" "before"
12762             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12763         else
12764             pathmunge "$COMPATH/bin" "before"
12765             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12766         fi
12767         if test "$ENABLE_JAVA" != ""; then
12768             if test -d "$JAVA_HOME/jre/bin/client"; then
12769                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12770             fi
12771             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12772                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12773             fi
12774             pathmunge "$JAVA_HOME/bin" "before"
12775         fi
12776         ;;
12778     solaris*)
12779         pathmunge "/usr/css/bin" "before"
12780         if test "$ENABLE_JAVA" != ""; then
12781             pathmunge "$JAVA_HOME/bin" "after"
12782         fi
12783         ;;
12784     esac
12787 AC_SUBST(LO_PATH)
12789 libo_FUZZ_SUMMARY
12791 # Generate a configuration sha256 we can use for deps
12792 if test -f config_host.mk; then
12793     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12795 if test -f config_host_lang.mk; then
12796     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12799 CFLAGS=$my_original_CFLAGS
12800 CXXFLAGS=$my_original_CXXFLAGS
12801 CPPFLAGS=$my_original_CPPFLAGS
12803 AC_CONFIG_FILES([config_host.mk
12804                  config_host_lang.mk
12805                  Makefile
12806                  lo.xcent
12807                  bin/bffvalidator.sh
12808                  bin/odfvalidator.sh
12809                  bin/officeotron.sh
12810                  instsetoo_native/util/openoffice.lst
12811                  sysui/desktop/macosx/Info.plist])
12812 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12813 AC_CONFIG_HEADERS([config_host/config_clang.h])
12814 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12815 AC_CONFIG_HEADERS([config_host/config_eot.h])
12816 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12817 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12818 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12819 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12820 AC_CONFIG_HEADERS([config_host/config_features.h])
12821 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12822 AC_CONFIG_HEADERS([config_host/config_folders.h])
12823 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12824 AC_CONFIG_HEADERS([config_host/config_gio.h])
12825 AC_CONFIG_HEADERS([config_host/config_global.h])
12826 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12827 AC_CONFIG_HEADERS([config_host/config_java.h])
12828 AC_CONFIG_HEADERS([config_host/config_langs.h])
12829 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12830 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12831 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12832 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12833 AC_CONFIG_HEADERS([config_host/config_locales.h])
12834 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12835 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12836 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12837 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12838 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12839 AC_CONFIG_HEADERS([config_host/config_oox.h])
12840 AC_CONFIG_HEADERS([config_host/config_options.h])
12841 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12842 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12843 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12844 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12845 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12846 AC_CONFIG_HEADERS([config_host/config_version.h])
12847 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12848 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12849 AC_CONFIG_HEADERS([config_host/config_python.h])
12850 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12851 AC_OUTPUT
12853 if test "$CROSS_COMPILING" = TRUE; then
12854     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12857 # touch the config timestamp file
12858 if test ! -f config_host.mk.stamp; then
12859     echo > config_host.mk.stamp
12860 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12861     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12862 else
12863     echo > config_host.mk.stamp
12866 # touch the config lang timestamp file
12867 if test ! -f config_host_lang.mk.stamp; then
12868     echo > config_host_lang.mk.stamp
12869 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12870     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12871 else
12872     echo > config_host_lang.mk.stamp
12876 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12878 cat << _EOS
12879 ****************************************************************************
12880 WARNING:
12881 Your make version is known to be horribly slow, and hard to debug
12882 problems with. To get a reasonably functional make please do:
12884 to install a pre-compiled binary make for Win32
12886  mkdir -p /opt/lo/bin
12887  cd /opt/lo/bin
12888  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12889  cp make-85047eb-msvc.exe make
12890  chmod +x make
12892 to install from source:
12893 place yourself in a working directory of you choice.
12895  git clone git://git.savannah.gnu.org/make.git
12897  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12898  set PATH=%PATH%;C:\Cygwin\bin
12899  [or Cygwin64, if that is what you have]
12900  cd path-to-make-repo-you-cloned-above
12901  build_w32.bat --without-guile
12903 should result in a WinRel/gnumake.exe.
12904 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12906 Then re-run autogen.sh
12908 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12909 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12911 _EOS
12914 cat << _EOF
12915 ****************************************************************************
12917 To build, run:
12918 $GNUMAKE
12920 To view some help, run:
12921 $GNUMAKE help
12923 _EOF
12925 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12926     cat << _EOF
12927 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12928 _EOF
12930     if test $_os = Darwin; then
12931         echo open instdir/$PRODUCTNAME.app
12932     else
12933         echo instdir/program/soffice
12934     fi
12935     cat << _EOF
12937 If you want to run the smoketest, run:
12938 $GNUMAKE check
12940 _EOF
12943 if test -f warn; then
12944     cat warn
12945     rm warn
12948 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: