bump product version to 5.4.3.2
[LibreOffice.git] / configure.ac
blob93543ddccf4ef63a0e63f8e3a2d6cdff8879a468
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 argumemnt 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],[5.4.3.2],[],[],[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     fi
87 AbsolutePath()
89     # There appears to be no simple and portable method to get an absolute and
90     # canonical path, so we try creating the directory if does not exist and
91     # utilizing the shell and pwd.
92     rel="$1"
93     absolute_path=""
94     test ! -e "$rel" && mkdir -p "$rel"
95     if test -d "$rel" ; then
96         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
97         absolute_path="$(pwd)"
98         cd - > /dev/null
99     else
100         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
101     fi
104 rm -f warn
105 have_WARNINGS="no"
106 add_warning()
108     if test "$have_WARNINGS" = "no"; then
109         echo "*************************************" > warn
110         have_WARNINGS="yes"
111         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
112             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
113             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
114         else
115             COLORWARN="* WARNING :"
116         fi
117     fi
118     echo "$COLORWARN $@" >> warn
121 dnl Some Mac User have the bad habbit of letting a lot fo crap
122 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
123 dnl that confuse the build.
124 dnl For the ones that use LODE, let's be nice and protect them
125 dnl from themselves
127 mac_sanitize_path()
129     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
130 dnl a common but nevertheless necessary thing that may be in a fancy
131 dnl path location is git, so make sure we have it
132     mac_git_path=`which git 2>/dev/null`
133     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
134         mac_path="$mac_path:`dirname $mac_git_path`"
135     fi
136     PATH="$mac_path"
137     unset mac_path
138     unset git_mac_path
141 echo "********************************************************************"
142 echo "*"
143 echo "*   Running ${PACKAGE_NAME} build configuration."
144 echo "*"
145 echo "********************************************************************"
146 echo ""
148 dnl ===================================================================
149 dnl checks build and host OSes
150 dnl do this before argument processing to allow for platform dependent defaults
151 dnl ===================================================================
152 AC_CANONICAL_HOST
154 AC_MSG_CHECKING([for product name])
155 PRODUCTNAME="AC_PACKAGE_NAME"
156 if test -n "$with_product_name" -a "$with_product_name" != no; then
157     PRODUCTNAME="$with_product_name"
159 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
160     PRODUCTNAME="${PRODUCTNAME}Dev"
162 AC_MSG_RESULT([$PRODUCTNAME])
163 AC_SUBST(PRODUCTNAME)
164 PRODUCTNAME_WITHOUT_SPACES=${PRODUCTNAME// /}
165 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
167 dnl ===================================================================
168 dnl Our version is defined by the AC_INIT() at the top of this script.
169 dnl ===================================================================
171 AC_MSG_CHECKING([for package version])
172 if test -n "$with_package_version" -a "$with_package_version" != no; then
173     PACKAGE_VERSION="$with_package_version"
175 AC_MSG_RESULT([$PACKAGE_VERSION])
177 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
179 LIBO_VERSION_MAJOR=$1
180 LIBO_VERSION_MINOR=$2
181 LIBO_VERSION_MICRO=$3
182 LIBO_VERSION_PATCH=$4
184 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
185 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
186 # no way to encode that into an integer in general.
187 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
189 LIBO_VERSION_SUFFIX=$5
190 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
191 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
192 # they get undoubled before actually passed to sed.
193 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
194 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
195 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
196 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
198 AC_SUBST(LIBO_VERSION_MAJOR)
199 AC_SUBST(LIBO_VERSION_MINOR)
200 AC_SUBST(LIBO_VERSION_MICRO)
201 AC_SUBST(LIBO_VERSION_PATCH)
202 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
203 AC_SUBST(LIBO_VERSION_SUFFIX)
204 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
206 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
207 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
208 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
209 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
211 LIBO_THIS_YEAR=`date +%Y`
212 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
214 dnl ===================================================================
215 dnl Product version
216 dnl ===================================================================
217 AC_MSG_CHECKING([for product version])
218 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
219 AC_MSG_RESULT([$PRODUCTVERSION])
220 AC_SUBST(PRODUCTVERSION)
222 AC_PROG_EGREP
223 # AC_PROG_EGREP doesn't set GREP on all systems as well
224 AC_PATH_PROG(GREP, grep)
226 BUILDDIR=`pwd`
227 cd $srcdir
228 SRC_ROOT=`pwd`
229 cd $BUILDDIR
230 x_Cygwin=[\#]
232 dnl ======================================
233 dnl Required GObject introspection version
234 dnl ======================================
235 INTROSPECTION_REQUIRED_VERSION=1.32.0
237 dnl ===================================================================
238 dnl Search all the common names for GNU Make
239 dnl ===================================================================
240 AC_MSG_CHECKING([for GNU Make])
242 # try to use our own make if it is available and GNUMAKE was not already defined
243 if test -z "$GNUMAKE"; then
244     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
245         GNUMAKE="$LODE_HOME/opt/bin/make"
246     elif test -x "/opt/lo/bin/make"; then
247         GNUMAKE="/opt/lo/bin/make"
248     fi
251 GNUMAKE_WIN_NATIVE=
252 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
253     if test -n "$a"; then
254         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
255         if test $? -eq 0;  then
256             if test "$build_os" = "cygwin"; then
257                 if test -n "$($a -v | grep 'Built for Windows')" ; then
258                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
259                     GNUMAKE_WIN_NATIVE="TRUE"
260                 else
261                     GNUMAKE=`which $a`
262                 fi
263             else
264                 GNUMAKE=`which $a`
265             fi
266             break
267         fi
268     fi
269 done
270 AC_MSG_RESULT($GNUMAKE)
271 if test -z "$GNUMAKE"; then
272     AC_MSG_ERROR([not found. install GNU Make.])
273 else
274     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
275         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
276     fi
279 win_short_path_for_make()
281     local_short_path="$1"
282     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
283         cygpath -sm "$local_short_path"
284     else
285         cygpath -u "$(cygpath -d "$local_short_path")"
286     fi
290 if test "$build_os" = "cygwin"; then
291     PathFormat "$SRC_ROOT"
292     SRC_ROOT="$formatted_path"
293     PathFormat "$BUILDDIR"
294     BUILDDIR="$formatted_path"
295     x_Cygwin=
296     AC_MSG_CHECKING(for explicit COMSPEC)
297     if test -z "$COMSPEC"; then
298         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
299     else
300         AC_MSG_RESULT([found: $COMSPEC])
301     fi
304 AC_SUBST(SRC_ROOT)
305 AC_SUBST(BUILDDIR)
306 AC_SUBST(x_Cygwin)
307 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
308 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
310 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
311     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
314 # need sed in os checks...
315 AC_PATH_PROGS(SED, sed)
316 if test -z "$SED"; then
317     AC_MSG_ERROR([install sed to run this script])
320 # Set the ENABLE_LTO variable
321 # ===================================================================
322 AC_MSG_CHECKING([whether to use link-time optimization])
323 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
324     ENABLE_LTO="TRUE"
325     AC_MSG_RESULT([yes])
326     AC_DEFINE(STATIC_LINKING)
327 else
328     ENABLE_LTO=""
329     AC_MSG_RESULT([no])
331 AC_SUBST(ENABLE_LTO)
333 AC_ARG_ENABLE(fuzz-options,
334     AS_HELP_STRING([--enable-fuzz-options],
335         [Randomly enable or disable each of those configurable options
336          that are supposed to be freely selectable without interdependencies,
337          or where bad interaction from interdependencies is automatically avoided.])
340 dnl ===================================================================
341 dnl When building for Android, --with-android-ndk,
342 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
343 dnl mandatory
344 dnl ===================================================================
346 AC_ARG_WITH(android-ndk,
347     AS_HELP_STRING([--with-android-ndk],
348         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
351 AC_ARG_WITH(android-ndk-toolchain-version,
352     AS_HELP_STRING([--with-android-ndk-toolchain-version],
353         [Specify which toolchain version to use, of those present in the
354         Android NDK you are using. The default is 4.9 currently.]), ,)
356 AC_ARG_WITH(android-sdk,
357     AS_HELP_STRING([--with-android-sdk],
358         [Specify location of the Android SDK. Mandatory when building for Android,
359         or when building the Impress Remote Android app.]),
362 ANDROID_NDK_HOME=
363 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
364     with_android_ndk="$SRC_ROOT/external/android-ndk"
366 if test -n "$with_android_ndk"; then
367     ANDROID_NDK_HOME=$with_android_ndk
369     # Set up a lot of pre-canned defaults
371     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
372         if test ! -f $ANDROID_NDK_HOME/source.properties; then
373             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
374         fi
375         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
376     else
377         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
378     fi
379     if test -z "$ANDROID_NDK_VERSION";  then
380         AC_MSG_ERROR([Failed to determine android NDK version. Please check your installation.])
381     fi
382     case $ANDROID_NDK_VERSION in
383     r9*|r10*)
384         ;;
385     11.1.*|12.1.*|13.1.*)
386         ;;
387     *)
388         AC_MSG_WARN([Untested android NDK version $ANDROID_NDK_VERSION, only versions r9* til 13.1.* have been used successfully. Proceed at your own risk.])
389         add_warning "Untested android NDK version $ANDROID_NDK_VERSION, only versions r9* til 13.1.* have been used successfully. Proceed at your own risk."
390         ;;
391     esac
393     if test $host_cpu = arm; then
394         android_cpu=arm
395         android_platform_prefix=$android_cpu-linux-androideabi
396     elif test $host_cpu = aarch64; then
397         android_cpu=aarch64
398         android_platform_prefix=$android_cpu-linux-android
399     elif test $host_cpu = mips; then
400         android_cpu=mips
401         android_platform_prefix=$android_cpu-linux-androideabi
402     else
403         # host_cpu is something like "i386" or "i686" I guess, NDK uses
404         # "x86" in some contexts
405         android_cpu=x86
406         android_platform_prefix=$android_cpu
407     fi
409     if test -z "$with_android_ndk_toolchain_version"; then
410         # Default to gcc 4.9
411         with_android_ndk_toolchain_version=4.9
412     fi
414     case "$with_android_ndk_toolchain_version" in
415     4.6|4.7|4.8|4.9)
416         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
417         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
418         ;;
419     clang3.3|clang3.4)
420         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
421         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
422         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
423         ANDROID_USING_CLANG=true
424         ;;
425     *)
426         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
427     esac
429     if test ! -d $ANDROID_BINUTILS_DIR; then
430         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
431     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
432         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
433     fi
435     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
436     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
437     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
438     # manage to link the (app-specific) single huge .so that is built for the app in
439     # android/source/ if there is debug information in a significant part of the object files.
440     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
441     # all objects have been built with debug information.)
442     toolchain_system='*'
443     case $build_os in
444     linux-gnu*)
445         ndk_build_os=linux
446         ;;
447     darwin*)
448         ndk_build_os=darwin
449         ;;
450     *)
451         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
452         ;;
453     esac
455     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
456     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
457     if test $build_cpu = x86_64; then
458         if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
459             ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
460         fi
461         if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
462             ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
463         fi
464     fi
465     ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
467     # This stays empty if there is just one version of the toolchain in the NDK
468     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
469     if test ! -d "$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/libs" ; then
470         # nope, won't work if empty...
471         # as is the case when using the ndk-bundle as installed with android studio
472         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
473         if test -n "$ANDROID_USING_CLANG"; then
474             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
475         fi
476     fi
478     ANDROID_API_LEVEL=15
479     if test $host_cpu = arm; then
480         android_gnu_prefix=arm-linux-androideabi
481     elif test $host_cpu = aarch64; then
482         android_gnu_prefix=aarch64-linux-android
483         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
484         ANDROID_API_LEVEL=L
485     elif test $host_cpu = mips; then
486         android_gnu_prefix=mipsel-linux-android
487     elif test $ANDROID_NDK_VERSION = r8; then
488         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
489         android_gnu_prefix=i686-android-linux
490     else
491         android_gnu_prefix=i686-linux-android
492     fi
494     ANDROID_ARCH=$android_cpu
495     if test $host_cpu = arm; then
496         ANDROID_APP_ABI=armeabi-v7a
497         if test -n "$ANDROID_USING_CLANG"; then
498             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
499             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
500             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
501         else
502             :
503         fi
504         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
505         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
506         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
507     elif test $host_cpu = aarch64; then
508         ANDROID_APP_ABI=arm64-v8a
509         ANDROID_ARCH=arm64
510     elif test $host_cpu = mips; then
511         ANDROID_APP_ABI=mips
512         ANDROIDCFLAGS=""
513     else # x86
514         ANDROID_APP_ABI=x86
515         ANDROIDCFLAGS="-march=atom"
516     fi
517     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
518     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
519     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
520     export PKG_CONFIG_LIBDIR="$ANDROID_BINUTILS_PREBUILT_ROOT/lib/pkgconfig"
522     if test -n "$ANDROID_USING_CLANG"; then
523         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
524     else
525         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
526     fi
528     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
529     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
530     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
531     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
532     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
533     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
535     # When using the 4.6 or newer toolchain, use the gold linker
536     case "$with_android_ndk_toolchain_version" in
537     4.[[6789]]*|[[56789]].*|clang*)
538         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
539             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
540         fi
541         ;;
542     esac
544     if test "$ENABLE_LTO" = TRUE; then
545         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
546         # $CC and $CXX when building external libraries
547         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
548     fi
550     # gdbserver can be in different locations
551     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
552         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
553     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
554         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
555     elif test $android_cpu = aarch64; then
556         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
557     else
558         AC_MSG_ERROR([Can't find gdbserver for your Android target])
559     fi
561     if test $host_cpu = arm; then
562         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/armeabi-v7a/include"
563     elif test $host_cpu = mips; then
564         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/mips/include"
565     else # x86
566         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/x86/include"
567     fi
569     if test -z "$CC"; then
570         case "$with_android_ndk_toolchain_version" in
571         4.*)
572             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
573             ;;
574         clang*)
575             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
576         esac
577     fi
578     if test -z "$CXX"; then
579         case "$with_android_ndk_toolchain_version" in
580         4.*)
581             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
582             ;;
583         clang*)
584             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
585             ;;
586         esac
587     fi
589     # remember to download the ownCloud Android library later
590     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
592 AC_SUBST(ANDROID_NDK_GDBSERVER)
593 AC_SUBST(ANDROID_APP_ABI)
595 dnl ===================================================================
596 dnl --with-android-sdk
597 dnl ===================================================================
598 ANDROID_SDK_HOME=
599 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
600     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
602 if test -n "$with_android_sdk"; then
603     ANDROID_SDK_HOME=$with_android_sdk
604     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
606 AC_SUBST(ANDROID_SDK_HOME)
608 dnl ===================================================================
609 dnl The following is a list of supported systems.
610 dnl Sequential to keep the logic very simple
611 dnl These values may be checked and reset later.
612 dnl ===================================================================
613 #defaults unless the os test overrides this:
614 test_randr=yes
615 test_xrender=yes
616 test_cups=yes
617 test_dbus=yes
618 test_fontconfig=yes
619 test_cairo=no
621 # Default values, as such probably valid just for Linux, set
622 # differently below just for Mac OSX,but at least better than
623 # hardcoding these as we used to do. Much of this is duplicated also
624 # in solenv for old build system and for gbuild, ideally we should
625 # perhaps define stuff like this only here in configure.ac?
627 LINKFLAGSSHL="-shared"
628 PICSWITCH="-fpic"
629 DLLPOST=".so"
631 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
633 INSTROOTBASESUFFIX=
634 INSTROOTCONTENTSUFFIX=
635 SDKDIRNAME=sdk
637 case "$host_os" in
639 solaris*)
640     test_gtk=yes
641     build_gstreamer_1_0=yes
642     build_gstreamer_0_10=yes
643     test_tde=yes
644     test_freetype=yes
645     _os=SunOS
647     dnl ===========================================================
648     dnl Check whether we're using Solaris 10 - SPARC or Intel.
649     dnl ===========================================================
650     AC_MSG_CHECKING([the Solaris operating system release])
651     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
652     if test "$_os_release" -lt "10"; then
653         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
654     else
655         AC_MSG_RESULT([ok ($_os_release)])
656     fi
658     dnl Check whether we're using a SPARC or i386 processor
659     AC_MSG_CHECKING([the processor type])
660     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
661         AC_MSG_RESULT([ok ($host_cpu)])
662     else
663         AC_MSG_ERROR([only SPARC and i386 processors are supported])
664     fi
665     ;;
667 linux-gnu*|k*bsd*-gnu*)
668     test_gtk=yes
669     build_gstreamer_1_0=yes
670     build_gstreamer_0_10=yes
671     test_tde=yes
672     test_kde4=yes
673     if test "$enable_fuzzers" != yes; then
674         test_freetype=yes
675         test_fontconfig=yes
676     else
677         test_freetype=no
678         test_fontconfig=no
679         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
680     fi
681     _os=Linux
682     ;;
684 gnu)
685     test_randr=no
686     test_xrender=no
687     _os=GNU
688      ;;
690 cygwin*|interix*)
692     # When building on Windows normally with MSVC under Cygwin,
693     # configure thinks that the host platform (the platform the
694     # built code will run on) is Cygwin, even if it obviously is
695     # Windows, which in Autoconf terminology is called
696     # "mingw32". (Which is misleading as MinGW is the name of the
697     # tool-chain, not an operating system.)
699     # Somewhat confusing, yes. But this configure script doesn't
700     # look at $host etc that much, it mostly uses its own $_os
701     # variable, set here in this case statement.
703     test_cups=no
704     test_dbus=no
705     test_randr=no
706     test_xrender=no
707     test_freetype=no
708     test_fontconfig=no
709     _os=WINNT
711     DLLPOST=".dll"
712     LINKFLAGSNOUNDEFS=
713     ;;
715 darwin*) # Mac OS X or iOS
716     test_gtk=yes
717     test_randr=no
718     test_xrender=no
719     test_freetype=no
720     test_fontconfig=no
721     test_dbus=no
722     if test "$host_cpu" = "arm"; then
723         _os=iOS
724         test_gtk=no
725         test_cups=no
726     else
727         _os=Darwin
728         if test -n "$LODE_HOME" ; then
729             mac_sanitize_path
730             AC_MSG_NOTICE([sanitized the PATH to $PATH])
731         fi
732         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
733         INSTROOTCONTENTSUFFIX=/Contents
734         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
735     fi
736     enable_systray=no
737     # See comment above the case "$host_os"
738     LINKFLAGSSHL="-dynamiclib -single_module"
740     # -fPIC is default
741     PICSWITCH=""
743     DLLPOST=".dylib"
745     # -undefined error is the default
746     LINKFLAGSNOUNDEFS=""
749 freebsd*)
750     test_gtk=yes
751     build_gstreamer_1_0=yes
752     build_gstreamer_0_10=yes
753     test_tde=yes
754     test_kde4=yes
755     test_freetype=yes
756     AC_MSG_CHECKING([the FreeBSD operating system release])
757     if test -n "$with_os_version"; then
758         OSVERSION="$with_os_version"
759     else
760         OSVERSION=`/sbin/sysctl -n kern.osreldate`
761     fi
762     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
763     AC_MSG_CHECKING([which thread library to use])
764     if test "$OSVERSION" -lt "500016"; then
765         PTHREAD_CFLAGS="-D_THREAD_SAFE"
766         PTHREAD_LIBS="-pthread"
767     elif test "$OSVERSION" -lt "502102"; then
768         PTHREAD_CFLAGS="-D_THREAD_SAFE"
769         PTHREAD_LIBS="-lc_r"
770     else
771         PTHREAD_CFLAGS=""
772         PTHREAD_LIBS="-pthread"
773     fi
774     AC_MSG_RESULT([$PTHREAD_LIBS])
775     _os=FreeBSD
776     ;;
778 *netbsd*)
779     test_gtk=yes
780     build_gstreamer_1_0=yes
781     build_gstreamer_0_10=yes
782     test_tde=no
783     test_kde4=yes
784     test_freetype=yes
785     PTHREAD_LIBS="-pthread -lpthread"
786     _os=NetBSD
787     ;;
789 aix*)
790     test_randr=no
791     test_freetype=yes
792     PTHREAD_LIBS=-pthread
793     _os=AIX
794     ;;
796 openbsd*)
797     test_gtk=yes
798     test_tde=yes
799     test_freetype=yes
800     PTHREAD_CFLAGS="-D_THREAD_SAFE"
801     PTHREAD_LIBS="-pthread"
802     _os=OpenBSD
803     ;;
805 dragonfly*)
806     test_gtk=yes
807     build_gstreamer_1_0=yes
808     build_gstreamer_0_10=yes
809     test_tde=yes
810     test_kde4=yes
811     test_freetype=yes
812     PTHREAD_LIBS="-pthread"
813     _os=DragonFly
814     ;;
816 linux-android*)
817     build_gstreamer_1_0=no
818     build_gstreamer_0_10=no
819     enable_lotuswordpro=no
820     enable_mpl_subset=yes
821     enable_coinmp=yes
822     enable_lpsolve=no
823     enable_report_builder=no
824     enable_odk=no
825     enable_postgresql_sdbc=no
826     enable_python=no
827     with_theme="tango"
828     test_cups=no
829     test_dbus=no
830     test_fontconfig=no
831     test_freetype=no
832     test_gtk=no
833     test_tde=no
834     test_kde4=no
835     test_randr=no
836     test_xrender=no
837     _os=Android
839     if test -z "$with_android_ndk"; then
840         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
841     fi
843     if test -z "$with_android_ndk_toolchain_version"; then
844         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
845     fi
847     # Verify that the NDK and SDK options are proper
848     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
849         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
850     fi
852     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
853     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
854     ;;
857     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
858     ;;
859 esac
861 if echo "$host_os" | grep -q linux-android ; then
862     if test -z "$with_android_sdk"; then
863         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
864     fi
866     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
867         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
868     fi
870     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
871     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
872         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
873                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
874                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
875         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
876         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
877         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
878     fi
879     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
880         AC_MSG_WARN([android support repository not found - install with
881                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
882                      to allow the build to download the specified version of the android support libraries])
883         add_warning "android support repository not found - install with"
884         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
885         add_warning "to allow the build to download the specified version of the android support libraries"
886     fi
889 if test "$_os" = "AIX"; then
890     AC_PATH_PROG(GAWK, gawk)
891     if test -z "$GAWK"; then
892         AC_MSG_ERROR([gawk not found in \$PATH])
893     fi
896 AC_SUBST(SDKDIRNAME)
898 AC_SUBST(PTHREAD_CFLAGS)
899 AC_SUBST(PTHREAD_LIBS)
901 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
902 # By default use the ones specified by our build system,
903 # but explicit override is possible.
904 AC_MSG_CHECKING(for explicit AFLAGS)
905 if test -n "$AFLAGS"; then
906     AC_MSG_RESULT([$AFLAGS])
907     x_AFLAGS=
908 else
909     AC_MSG_RESULT(no)
910     x_AFLAGS=[\#]
912 AC_MSG_CHECKING(for explicit CFLAGS)
913 if test -n "$CFLAGS"; then
914     AC_MSG_RESULT([$CFLAGS])
915     x_CFLAGS=
916 else
917     AC_MSG_RESULT(no)
918     x_CFLAGS=[\#]
920 AC_MSG_CHECKING(for explicit CXXFLAGS)
921 if test -n "$CXXFLAGS"; then
922     AC_MSG_RESULT([$CXXFLAGS])
923     x_CXXFLAGS=
924 else
925     AC_MSG_RESULT(no)
926     x_CXXFLAGS=[\#]
928 AC_MSG_CHECKING(for explicit OBJCFLAGS)
929 if test -n "$OBJCFLAGS"; then
930     AC_MSG_RESULT([$OBJCFLAGS])
931     x_OBJCFLAGS=
932 else
933     AC_MSG_RESULT(no)
934     x_OBJCFLAGS=[\#]
936 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
937 if test -n "$OBJCXXFLAGS"; then
938     AC_MSG_RESULT([$OBJCXXFLAGS])
939     x_OBJCXXFLAGS=
940 else
941     AC_MSG_RESULT(no)
942     x_OBJCXXFLAGS=[\#]
944 AC_MSG_CHECKING(for explicit LDFLAGS)
945 if test -n "$LDFLAGS"; then
946     AC_MSG_RESULT([$LDFLAGS])
947     x_LDFLAGS=
948 else
949     AC_MSG_RESULT(no)
950     x_LDFLAGS=[\#]
952 AC_SUBST(AFLAGS)
953 AC_SUBST(CFLAGS)
954 AC_SUBST(CXXFLAGS)
955 AC_SUBST(OBJCFLAGS)
956 AC_SUBST(OBJCXXFLAGS)
957 AC_SUBST(LDFLAGS)
958 AC_SUBST(x_AFLAGS)
959 AC_SUBST(x_CFLAGS)
960 AC_SUBST(x_CXXFLAGS)
961 AC_SUBST(x_OBJCFLAGS)
962 AC_SUBST(x_OBJCXXFLAGS)
963 AC_SUBST(x_LDFLAGS)
965 dnl These are potentially set for MSVC, in the code checking for UCRT below:
966 my_original_CFLAGS=$CFLAGS
967 my_original_CXXFLAGS=$CXXFLAGS
968 my_original_CPPFLAGS=$CPPFLAGS
970 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
971 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
972 dnl AC_PROG_CC internally.
973 if test "$_os" != "WINNT"; then
974     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
975     save_CFLAGS=$CFLAGS
976     AC_PROG_CC
977     CFLAGS=$save_CFLAGS
980 if test $_os != "WINNT"; then
981     save_LIBS="$LIBS"
982     AC_SEARCH_LIBS([dlsym], [dl],
983         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
984         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
985     LIBS="$save_LIBS"
987 AC_SUBST(DLOPEN_LIBS)
989 ###############################################################################
990 # Extensions switches --enable/--disable
991 ###############################################################################
992 # By default these should be enabled unless having extra dependencies.
993 # If there is extra dependency over configure options then the enable should
994 # be automagic based on whether the requiring feature is enabled or not.
995 # All this options change anything only with --enable-extension-integration.
997 # The name of this option and its help string makes it sound as if
998 # extensions are built anyway, just not integrated in the installer,
999 # if you use --disable-extension-integration. Is that really the
1000 # case?
1002 libo_FUZZ_ARG_ENABLE(extension-integration,
1003     AS_HELP_STRING([--disable-extension-integration],
1004         [Disable integration of the built extensions in the installer of the
1005          product. Use this switch to disable the integration.])
1008 AC_ARG_ENABLE(avmedia,
1009     AS_HELP_STRING([--disable-avmedia],
1010         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1013 AC_ARG_ENABLE(database-connectivity,
1014     AS_HELP_STRING([--disable-database-connectivity],
1015         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1018 # This doesn't mean not building (or "integrating") extensions
1019 # (although it probably should; i.e. it should imply
1020 # --disable-extension-integration I guess), it means not supporting
1021 # any extension mechanism at all
1022 libo_FUZZ_ARG_ENABLE(extensions,
1023     AS_HELP_STRING([--disable-extensions],
1024         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1027 AC_ARG_ENABLE(scripting,
1028     AS_HELP_STRING([--disable-scripting],
1029         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1032 # This is mainly for Android and iOS, but could potentially be used in some
1033 # special case otherwise, too, so factored out as a separate setting
1035 AC_ARG_ENABLE(dynamic-loading,
1036     AS_HELP_STRING([--disable-dynamic-loading],
1037         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1040 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
1041     AS_HELP_STRING([--enable-ext-mariadb-connector],
1042         [Enable the build of the MariaDB/MySQL Connector extension.])
1045 libo_FUZZ_ARG_ENABLE(report-builder,
1046     AS_HELP_STRING([--disable-report-builder],
1047         [Disable the Report Builder.])
1050 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1051     AS_HELP_STRING([--enable-ext-wiki-publisher],
1052         [Enable the Wiki Publisher extension.])
1055 libo_FUZZ_ARG_ENABLE(lpsolve,
1056     AS_HELP_STRING([--disable-lpsolve],
1057         [Disable compilation of the lp solve solver ])
1059 libo_FUZZ_ARG_ENABLE(coinmp,
1060     AS_HELP_STRING([--disable-coinmp],
1061         [Disable compilation of the CoinMP solver ])
1064 libo_FUZZ_ARG_ENABLE(pdfimport,
1065     AS_HELP_STRING([--disable-pdfimport],
1066         [Disable building the PDF import feature.])
1069 libo_FUZZ_ARG_ENABLE(pdfium,
1070     AS_HELP_STRING([--disable-pdfium],
1071         [Disable building PDFium.])
1074 ###############################################################################
1076 dnl ---------- *** ----------
1078 libo_FUZZ_ARG_ENABLE(mergelibs,
1079     AS_HELP_STRING([--enable-mergelibs],
1080         [Merge several of the smaller libraries into one big, "merged", one.])
1083 libo_FUZZ_ARG_ENABLE(breakpad,
1084     AS_HELP_STRING([--enable-breakpad],
1085         [Enables breakpad for crash reporting.])
1088 AC_ARG_ENABLE(fetch-external,
1089     AS_HELP_STRING([--disable-fetch-external],
1090         [Disables fetching external tarballs from web sources.])
1093 AC_ARG_ENABLE(fuzzers,
1094     AS_HELP_STRING([--enable-fuzzers],
1095         [Enables building libfuzzer targets for fuzz testing.])
1098 libo_FUZZ_ARG_ENABLE(pch,
1099     AS_HELP_STRING([--enable-pch],
1100         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1103 libo_FUZZ_ARG_ENABLE(epm,
1104     AS_HELP_STRING([--enable-epm],
1105         [LibreOffice includes self-packaging code, that requires epm, however epm is
1106          useless for large scale package building.])
1109 libo_FUZZ_ARG_ENABLE(odk,
1110     AS_HELP_STRING([--disable-odk],
1111         [LibreOffice includes an ODK, office development kit which some packagers may
1112          wish to build without.])
1115 AC_ARG_ENABLE(mpl-subset,
1116     AS_HELP_STRING([--enable-mpl-subset],
1117         [Don't compile any pieces which are not MPL or more liberally licensed])
1120 libo_FUZZ_ARG_ENABLE(evolution2,
1121     AS_HELP_STRING([--enable-evolution2],
1122         [Allows the built-in evolution 2 addressbook connectivity build to be
1123          enabled.])
1126 libo_FUZZ_ARG_ENABLE(directx,
1127     AS_HELP_STRING([--disable-directx],
1128         [Remove DirectX implementation for the new XCanvas interface.
1129          The DirectX support requires more stuff installed on Windows to
1130          compile. (DirectX SDK, GDI+ libs)])
1133 AC_ARG_ENABLE(avahi,
1134     AS_HELP_STRING([--enable-avahi],
1135         [Determines whether to use Avahi to advertise Impress to remote controls.])
1138 libo_FUZZ_ARG_ENABLE(werror,
1139     AS_HELP_STRING([--enable-werror],
1140         [Turn warnings to errors. (Has no effect in modules where the treating
1141          of warnings as errors is disabled explicitly.)]),
1144 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1145     AS_HELP_STRING([--enable-assert-always-abort],
1146         [make assert() abort even in release code.]),
1149 libo_FUZZ_ARG_ENABLE(dbgutil,
1150     AS_HELP_STRING([--enable-dbgutil],
1151         [Provide debugging support from --enable-debug and include additional debugging
1152          utilities such as object counting or more expensive checks.
1153          This is the recommended option for developers.
1154          Note that this makes the build ABI incompatible, it is not possible to mix object
1155          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1157 libo_FUZZ_ARG_ENABLE(debug,
1158     AS_HELP_STRING([--enable-debug],
1159         [Include debugging information, disable compiler optimization and inlining plus
1160          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1162 libo_FUZZ_ARG_ENABLE(sal-log,
1163     AS_HELP_STRING([--enable-sal-log],
1164         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1166 AC_ARG_ENABLE(selective-debuginfo,
1167     AS_HELP_STRING([--enable-selective-debuginfo],
1168         [If --enable-debug or --enable-dbgutil is used, build debugging information
1169          (-g compiler flag) only for the specified gbuild build targets
1170          (where all means everything, - prepended means not to enable, / appended means
1171          everything in the directory; there is no ordering, more specific overrides
1172          more general, and disabling takes precedence).
1173          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1175 libo_FUZZ_ARG_ENABLE(symbols,
1176     AS_HELP_STRING([--enable-symbols],
1177         [Generate debug information.
1178          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1179          otherwise.]))
1181 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1182     AS_HELP_STRING([--disable-runtime-optimizations],
1183         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1184          JVM JIT) that are known to interact badly with certain dynamic analysis
1185          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1186          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1187          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1189 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1190     AS_HELP_STRING([--enable-compiler-plugins],
1191         [Enable compiler plugins that will perform additional checks during
1192          building. Enabled automatically by --enable-dbgutil.]))
1194 libo_FUZZ_ARG_ENABLE(ooenv,
1195     AS_HELP_STRING([--disable-ooenv],
1196         [Disable ooenv for the instdir installation.]))
1198 AC_ARG_ENABLE(lto,
1199     AS_HELP_STRING([--enable-lto],
1200         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1201          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1202          linker. For MSVC, this option is broken at the moment. This is experimental work
1203          in progress that shouldn't be used unless you are working on it.)]))
1205 AC_ARG_ENABLE(python,
1206     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1207         [Enables or disables Python support at run-time and build-time.
1208          Also specifies what Python to use. 'auto' is the default.
1209          'fully-internal' even forces the internal version for uses of Python
1210          during the build.]))
1212 libo_FUZZ_ARG_ENABLE(gtk,
1213     AS_HELP_STRING([--disable-gtk],
1214         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1215 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1217 libo_FUZZ_ARG_ENABLE(gtk3,
1218     AS_HELP_STRING([--disable-gtk3],
1219         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1220          This is experimental and may not work.]),
1221 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1223 libo_FUZZ_ARG_ENABLE(systray,
1224     AS_HELP_STRING([--disable-systray],
1225         [Determines whether to build the systray quickstarter.]),
1226 ,test "${enable_systray+set}" = set || enable_systray=yes)
1228 AC_ARG_ENABLE(split-app-modules,
1229     AS_HELP_STRING([--enable-split-app-modules],
1230         [Split file lists for app modules, e.g. base, calc.
1231          Has effect only with make distro-pack-install]),
1234 AC_ARG_ENABLE(split-opt-features,
1235     AS_HELP_STRING([--enable-split-opt-features],
1236         [Split file lists for some optional features, e.g. pyuno, testtool.
1237          Has effect only with make distro-pack-install]),
1240 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1241     AS_HELP_STRING([--disable-cairo-canvas],
1242         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1245 libo_FUZZ_ARG_ENABLE(dbus,
1246     AS_HELP_STRING([--disable-dbus],
1247         [Determines whether to enable features that depend on dbus.
1248          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1249 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1251 libo_FUZZ_ARG_ENABLE(sdremote,
1252     AS_HELP_STRING([--disable-sdremote],
1253         [Determines whether to enable Impress remote control (i.e. the server component).]),
1254 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1256 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1257     AS_HELP_STRING([--disable-sdremote-bluetooth],
1258         [Determines whether to build sdremote with bluetooth support.
1259          Requires dbus on Linux.]))
1261 libo_FUZZ_ARG_ENABLE(gio,
1262     AS_HELP_STRING([--disable-gio],
1263         [Determines whether to use the GIO support.]),
1264 ,test "${enable_gio+set}" = set || enable_gio=yes)
1266 AC_ARG_ENABLE(tde,
1267     AS_HELP_STRING([--enable-tde],
1268         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1269          TDE are available.]),
1272 AC_ARG_ENABLE(tdeab,
1273     AS_HELP_STRING([--disable-tdeab],
1274         [Disable the TDE address book support.]),
1276     if test "$enable_tde" = "yes"; then
1277         enable_tdeab=yes
1278     fi
1281 AC_ARG_ENABLE(kde4,
1282     AS_HELP_STRING([--enable-kde4],
1283         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1284          KDE4 are available.]),
1287 libo_FUZZ_ARG_ENABLE(gui,
1288     AS_HELP_STRING([--disable-gui],
1289         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1290          command-line option. Not related to LibreOffice Online functionality. Don't use
1291          unless you are certain you need to. Nobody will help you if you insist on trying
1292          this and run into problems.]),
1293 ,test "${enable_gui+set}" = set || enable_gui=yes)
1295 libo_FUZZ_ARG_ENABLE(randr,
1296     AS_HELP_STRING([--disable-randr],
1297         [Disable RandR support in the vcl project.]),
1298 ,test "${enable_randr+set}" = set || enable_randr=yes)
1300 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1301     AS_HELP_STRING([--disable-gstreamer-1-0],
1302         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1303 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1305 AC_ARG_ENABLE(gstreamer-0-10,
1306     AS_HELP_STRING([--enable-gstreamer-0-10],
1307         [Enable building with the gstreamer 0.10 avmedia backend.]),
1308 ,enable_gstreamer_0_10=no)
1310 libo_FUZZ_ARG_ENABLE(vlc,
1311     AS_HELP_STRING([--enable-vlc],
1312         [Enable building with the (experimental) VLC avmedia backend.]),
1313 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1315 libo_FUZZ_ARG_ENABLE(neon,
1316     AS_HELP_STRING([--disable-neon],
1317         [Disable neon and the compilation of webdav binding.]),
1320 libo_FUZZ_ARG_ENABLE([eot],
1321     [AS_HELP_STRING([--enable-eot],
1322         [Enable support for Embedded OpenType fonts.])],
1323 ,test "${enable_eot+set}" = set || enable_eot=no)
1325 libo_FUZZ_ARG_ENABLE(cve-tests,
1326     AS_HELP_STRING([--disable-cve-tests],
1327         [Prevent CVE tests to be executed]),
1330 libo_FUZZ_ARG_ENABLE(chart-tests,
1331     AS_HELP_STRING([--enable-chart-tests],
1332         [Executes chart XShape tests. In a perfect world these tests would be
1333          stable and everyone could run them, in reality it is best to run them
1334          only on a few machines that are known to work and maintained by people
1335          who can judge if a test failure is a regression or not.]),
1338 AC_ARG_ENABLE(build-unowinreg,
1339     AS_HELP_STRING([--enable-build-unowinreg],
1340         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1341          compiler is needed on Linux.]),
1344 AC_ARG_ENABLE(dependency-tracking,
1345     AS_HELP_STRING([--enable-dependency-tracking],
1346         [Do not reject slow dependency extractors.])[
1347   --disable-dependency-tracking
1348                           Disables generation of dependency information.
1349                           Speed up one-time builds.],
1352 AC_ARG_ENABLE(icecream,
1353     AS_HELP_STRING([--enable-icecream],
1354         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1355          It defaults to /opt/icecream for the location of the icecream gcc/g++
1356          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1359 libo_FUZZ_ARG_ENABLE(cups,
1360     AS_HELP_STRING([--disable-cups],
1361         [Do not build cups support.])
1364 AC_ARG_ENABLE(ccache,
1365     AS_HELP_STRING([--disable-ccache],
1366         [Do not try to use ccache automatically.
1367          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1368          CC/CXX are not yet set, and --enable-icecream is not given, we
1369          attempt to use ccache. --disable-ccache disables ccache completely.
1373 AC_ARG_ENABLE(64-bit,
1374     AS_HELP_STRING([--enable-64-bit],
1375         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1376          At the moment meaningful only for iOS and Windows.]), ,)
1378 libo_FUZZ_ARG_ENABLE(online-update,
1379     AS_HELP_STRING([--enable-online-update],
1380         [Enable the online update service that will check for new versions of
1381          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1382          If the value is "mar", the experimental Mozilla-like update will be
1383          enabled instead of the traditional update mechanism.]),
1386 libo_FUZZ_ARG_ENABLE(extension-update,
1387     AS_HELP_STRING([--disable-extension-update],
1388         [Disable possibility to update installed extensions.]),
1391 libo_FUZZ_ARG_ENABLE(release-build,
1392     AS_HELP_STRING([--enable-release-build],
1393         [Enable release build.
1394          See http://wiki.documentfoundation.org/Development/DevBuild]),
1397 AC_ARG_ENABLE(windows-build-signing,
1398     AS_HELP_STRING([--enable-windows-build-signing],
1399         [Enable signing of windows binaries (*.exe, *.dll)]),
1402 AC_ARG_ENABLE(silent-msi,
1403     AS_HELP_STRING([--enable-silent-msi],
1404         [Enable MSI with LIMITUI=1 (silent install).]),
1407 AC_ARG_ENABLE(macosx-code-signing,
1408     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1409         [Sign executables, dylibs, frameworks and the app bundle. If you
1410          don't provide an identity the first suitable certificate
1411          in your keychain is used.]),
1414 AC_ARG_ENABLE(macosx-package-signing,
1415     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1416         [Create a .pkg suitable for uploading to the Mac App Store and sign
1417          it. If you don't provide an identity the first suitable certificate
1418          in your keychain is used.]),
1421 AC_ARG_ENABLE(macosx-sandbox,
1422     AS_HELP_STRING([--enable-macosx-sandbox],
1423         [Make the app bundle run in a sandbox. Requires code signing.
1424          Is required by apps distributed in the Mac App Store, and implies
1425          adherence to App Store rules.]),
1428 AC_ARG_WITH(macosx-bundle-identifier,
1429     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1430         [Define the OS X bundle identifier. Default is the somewhat weird
1431          org.libreoffice.script ("script", huh?).]),
1432 ,with_macosx_bundle_identifier=org.libreoffice.script)
1434 AC_ARG_WITH(product-name,
1435     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1436         [Define the product name. Default is AC_PACKAGE_NAME.]),
1437 ,with_product_name=$PRODUCTNAME)
1439 AC_ARG_WITH(package-version,
1440     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1441         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1444 AC_ARG_ENABLE(ios-simulator,
1445     AS_HELP_STRING([--enable-ios-simulator],
1446         [Build for the iOS Simulator, not iOS device.]),
1449 libo_FUZZ_ARG_ENABLE(readonly-installset,
1450     AS_HELP_STRING([--enable-readonly-installset],
1451         [Prevents any attempts by LibreOffice to write into its installation. That means
1452          at least that no "system-wide" extensions can be added. Experimental work in
1453          progress.]),
1456 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1457     AS_HELP_STRING([--disable-postgresql-sdbc],
1458         [Disable the build of the PostgreSQL-SDBC driver.])
1461 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1462     AS_HELP_STRING([--disable-lotuswordpro],
1463         [Disable the build of the Lotus Word Pro filter.]),
1464 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1466 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1467     AS_HELP_STRING([--disable-firebird-sdbc],
1468         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1469 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1471 AC_ARG_ENABLE(bogus-pkg-config,
1472     AS_HELP_STRING([--enable-bogus-pkg-config],
1473         [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.]),
1476 AC_ARG_ENABLE(openssl,
1477     AS_HELP_STRING([--disable-openssl],
1478         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1479          components will either use GNUTLS or NSS. Work in progress,
1480          use only if you are hacking on it.]),
1481 ,enable_openssl=yes)
1483 AC_ARG_ENABLE(library-bin-tar,
1484     AS_HELP_STRING([--enable-library-bin-tar],
1485         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1486         Some libraries can save their build result in a tarball
1487         stored in TARFILE_LOCATION. That binary tarball is
1488         uniquely identified by the source tarball,
1489         the content of the config_host.mk file and the content
1490         of the top-level directory in core for that library
1491         If this option is enabled, then if such a tarfile exist, it will be untarred
1492         instead of the source tarfile, and the build step will be skipped for that
1493         library.
1494         If a proper tarfile does not exist, then the normal source-based
1495         build is done for that library and a proper binary tarfile is created
1496         for the next time.]),
1499 libo_FUZZ_ARG_ENABLE(gltf,
1500     AS_HELP_STRING([--disable-gltf],
1501         [Determines whether to build libraries related to glTF 3D model rendering.]))
1503 libo_FUZZ_ARG_ENABLE(collada,
1504     AS_HELP_STRING([--disable-collada],
1505         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1507 AC_ARG_ENABLE(dconf,
1508     AS_HELP_STRING([--disable-dconf],
1509         [Disable the dconf configuration backend (enabled by default where
1510          available).]))
1512 libo_FUZZ_ARG_ENABLE(formula-logger,
1513     AS_HELP_STRING(
1514         [--enable-formula-logger],
1515         [Enable formula logger for logging formula calculation flow in Calc.]
1516     )
1519 dnl ===================================================================
1520 dnl Optional Packages (--with/without-)
1521 dnl ===================================================================
1523 AC_ARG_WITH(gcc-home,
1524     AS_HELP_STRING([--with-gcc-home],
1525         [Specify the location of gcc/g++ manually. This can be used in conjunction
1526          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1527          non-default path.]),
1530 AC_ARG_WITH(gnu-patch,
1531     AS_HELP_STRING([--with-gnu-patch],
1532         [Specify location of GNU patch on Solaris or FreeBSD.]),
1535 AC_ARG_WITH(build-platform-configure-options,
1536     AS_HELP_STRING([--with-build-platform-configure-options],
1537         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1540 AC_ARG_WITH(gnu-cp,
1541     AS_HELP_STRING([--with-gnu-cp],
1542         [Specify location of GNU cp on Solaris or FreeBSD.]),
1545 AC_ARG_WITH(external-tar,
1546     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1547         [Specify an absolute path of where to find (and store) tarfiles.]),
1548     TARFILE_LOCATION=$withval ,
1551 AC_ARG_WITH(referenced-git,
1552     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1553         [Specify another checkout directory to reference. This makes use of
1554                  git submodule update --reference, and saves a lot of diskspace
1555                  when having multiple trees side-by-side.]),
1556     GIT_REFERENCE_SRC=$withval ,
1559 AC_ARG_WITH(linked-git,
1560     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1561         [Specify a directory where the repositories of submodules are located.
1562          This uses a method similar to git-new-workdir to get submodules.]),
1563     GIT_LINK_SRC=$withval ,
1566 AC_ARG_WITH(galleries,
1567     AS_HELP_STRING([--with-galleries],
1568         [Specify how galleries should be built. It is possible either to
1569          build these internally from source ("build"),
1570          or to disable them ("no")]),
1573 AC_ARG_WITH(theme,
1574     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1575         [Choose which themes to include. By default those themes with an '*' are included.
1576          Possible choices: *breeze, *breeze_dark, crystal, *galaxy, *hicontrast, oxygen, *sifr, *sifr_dark, *tango, *tango_testing.]),
1579 libo_FUZZ_ARG_WITH(helppack-integration,
1580     AS_HELP_STRING([--without-helppack-integration],
1581         [It will not integrate the helppacks to the installer
1582          of the product. Please use this switch to use the online help
1583          or separate help packages.]),
1586 libo_FUZZ_ARG_WITH(fonts,
1587     AS_HELP_STRING([--without-fonts],
1588         [LibreOffice includes some third-party fonts to provide a reliable basis for
1589          help content, templates, samples, etc. When these fonts are already
1590          known to be available on the system then you should use this option.]),
1593 AC_ARG_WITH(epm,
1594     AS_HELP_STRING([--with-epm],
1595         [Decides which epm to use. Default is to use the one from the system if
1596          one is built. When either this is not there or you say =internal epm
1597          will be built.]),
1600 AC_ARG_WITH(package-format,
1601     AS_HELP_STRING([--with-package-format],
1602         [Specify package format(s) for LibreOffice installation sets. The
1603          implicit --without-package-format leads to no installation sets being
1604          generated. Possible values: aix, archive, bsd, deb, dmg,
1605          installed, msi, pkg, and rpm.
1606          Example: --with-package-format='deb rpm']),
1609 AC_ARG_WITH(tls,
1610     AS_HELP_STRING([--with-tls],
1611         [Decides which TLS/SSL and cryptographic implementations to use for
1612          LibreOffice's code. Notice that this doesn't apply for depending
1613          libraries like "neon", for example. Default is to use OpenSSL
1614          although NSS is also possible. Notice that selecting NSS restricts
1615          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1616          restrict by now the usage of NSS in LO's code. Possible values:
1617          openssl, nss. Example: --with-tls="nss"]),
1620 AC_ARG_WITH(system-libs,
1621     AS_HELP_STRING([--with-system-libs],
1622         [Use libraries already on system -- enables all --with-system-* flags.]),
1625 AC_ARG_WITH(system-bzip2,
1626     AS_HELP_STRING([--with-system-bzip2],
1627         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1628     [with_system_bzip2="$with_system_libs"])
1630 AC_ARG_WITH(system-headers,
1631     AS_HELP_STRING([--with-system-headers],
1632         [Use headers already on system -- enables all --with-system-* flags for
1633          external packages whose headers are the only entities used i.e.
1634          boost/odbc/sane-header(s).]),,
1635     [with_system_headers="$with_system_libs"])
1637 AC_ARG_WITH(system-jars,
1638     AS_HELP_STRING([--without-system-jars],
1639         [When building with --with-system-libs, also the needed jars are expected
1640          on the system. Use this to disable that]),,
1641     [with_system_jars="$with_system_libs"])
1643 AC_ARG_WITH(system-cairo,
1644     AS_HELP_STRING([--with-system-cairo],
1645         [Use cairo libraries already on system.  Happens automatically for
1646          (implicit) --enable-gtk and for --enable-gtk3.]))
1648 AC_ARG_WITH(system-epoxy,
1649     AS_HELP_STRING([--with-system-epoxy],
1650         [Use epoxy libraries already on system.  Happens automatically for
1651          --enable-gtk3.]),,
1652        [with_system_epoxy="$with_system_libs"])
1654 AC_ARG_WITH(myspell-dicts,
1655     AS_HELP_STRING([--with-myspell-dicts],
1656         [Adds myspell dictionaries to the LibreOffice installation set]),
1659 AC_ARG_WITH(system-dicts,
1660     AS_HELP_STRING([--without-system-dicts],
1661         [Do not use dictionaries from system paths.]),
1664 AC_ARG_WITH(external-dict-dir,
1665     AS_HELP_STRING([--with-external-dict-dir],
1666         [Specify external dictionary dir.]),
1669 AC_ARG_WITH(external-hyph-dir,
1670     AS_HELP_STRING([--with-external-hyph-dir],
1671         [Specify external hyphenation pattern dir.]),
1674 AC_ARG_WITH(external-thes-dir,
1675     AS_HELP_STRING([--with-external-thes-dir],
1676         [Specify external thesaurus dir.]),
1679 AC_ARG_WITH(system-zlib,
1680     AS_HELP_STRING([--with-system-zlib],
1681         [Use zlib already on system.]),,
1682     [with_system_zlib=auto])
1684 AC_ARG_WITH(system-jpeg,
1685     AS_HELP_STRING([--with-system-jpeg],
1686         [Use jpeg already on system.]),,
1687     [with_system_jpeg="$with_system_libs"])
1689 AC_ARG_WITH(system-libgltf,
1690     AS_HELP_STRING([--with-system-libgltf],
1691         [Use libgltf already on system.]),,
1692     [with_system_libgltf="$with_system_libs"])
1694 AC_ARG_WITH(system-clucene,
1695     AS_HELP_STRING([--with-system-clucene],
1696         [Use clucene already on system.]),,
1697     [with_system_clucene="$with_system_libs"])
1699 AC_ARG_WITH(system-expat,
1700     AS_HELP_STRING([--with-system-expat],
1701         [Use expat already on system.]),,
1702     [with_system_expat="$with_system_libs"])
1704 AC_ARG_WITH(system-libxml,
1705     AS_HELP_STRING([--with-system-libxml],
1706         [Use libxml/libxslt already on system.]),,
1707     [with_system_libxml=auto])
1709 AC_ARG_WITH(system-icu,
1710     AS_HELP_STRING([--with-system-icu],
1711         [Use icu already on system.]),,
1712     [with_system_icu="$with_system_libs"])
1714 AC_ARG_WITH(system-ucpp,
1715     AS_HELP_STRING([--with-system-ucpp],
1716         [Use ucpp already on system.]),,
1717     [])
1719 AC_ARG_WITH(system-opencollada,
1720     AS_HELP_STRING([--with-system-opencollada],
1721         [Use openCOLLADA already on system.]),,
1722     [with_system_opencollada=no])
1724 AC_ARG_WITH(system-collada2gltf,
1725     AS_HELP_STRING([--with-system-collada2gltf],
1726         [Use collada2gltf already on system.]),,
1727     [with_system_collada2gltf=no])
1729 AC_ARG_WITH(system-openldap,
1730     AS_HELP_STRING([--with-system-openldap],
1731         [Use the OpenLDAP LDAP SDK already on system.]),,
1732     [with_system_openldap="$with_system_libs"])
1734 AC_ARG_WITH(system-poppler,
1735     AS_HELP_STRING([--with-system-poppler],
1736         [Use system poppler (only needed for PDF import).]),,
1737     [with_system_poppler="$with_system_libs"])
1739 AC_ARG_WITH(system-gpgmepp,
1740     AS_HELP_STRING([--with-system-gpgmepp],
1741         [Use gpgmepp already on system]),,
1742     [with_system_gpgmepp="$with_system_libs"])
1744 AC_ARG_WITH(system-apache-commons,
1745     AS_HELP_STRING([--with-system-apache-commons],
1746         [Use Apache commons libraries already on system.]),,
1747     [with_system_apache_commons="$with_system_jars"])
1749 AC_ARG_WITH(system-mariadb,
1750     AS_HELP_STRING([--with-system-mariadb],
1751         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1752          extension.]),,
1753     [with_system_mariadb="$with_system_libs"])
1755 AC_ARG_ENABLE(bundle-mariadb,
1756     AS_HELP_STRING([--enable-bundle-mariadb],
1757         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1760 AC_ARG_WITH(system-mysql-cppconn,
1761     AS_HELP_STRING([--with-system-mysql-cppconn],
1762         [Use MySQL C++ Connector libraries already on system.]),,
1763     [with_system_mysql_cppconn="$with_system_libs"])
1765 AC_ARG_WITH(system-postgresql,
1766     AS_HELP_STRING([--with-system-postgresql],
1767         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1768          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1769     [with_system_postgresql="$with_system_libs"])
1771 AC_ARG_WITH(libpq-path,
1772     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1773         [Use this PostgreSQL C interface (libpq) installation for building
1774          the PostgreSQL-SDBC extension.]),
1777 AC_ARG_WITH(system-firebird,
1778     AS_HELP_STRING([--with-system-firebird],
1779         [Use Firebird libraries already on system, for building the Firebird-SDBC
1780          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1781     [with_system_firebird="$with_system_libs"])
1783 AC_ARG_WITH(system-libtommath,
1784             AS_HELP_STRING([--with-system-libtommath],
1785                            [Use libtommath already on system]),,
1786             [with_system_libtommath="$with_system_libs"])
1788 AC_ARG_WITH(system-hsqldb,
1789     AS_HELP_STRING([--with-system-hsqldb],
1790         [Use hsqldb already on system.]))
1792 AC_ARG_WITH(hsqldb-jar,
1793     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1794         [Specify path to jarfile manually.]),
1795     HSQLDB_JAR=$withval)
1797 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1798     AS_HELP_STRING([--disable-scripting-beanshell],
1799         [Disable support for scripts in BeanShell.]),
1803 AC_ARG_WITH(system-beanshell,
1804     AS_HELP_STRING([--with-system-beanshell],
1805         [Use beanshell already on system.]),,
1806     [with_system_beanshell="$with_system_jars"])
1808 AC_ARG_WITH(beanshell-jar,
1809     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1810         [Specify path to jarfile manually.]),
1811     BSH_JAR=$withval)
1813 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1814     AS_HELP_STRING([--disable-scripting-javascript],
1815         [Disable support for scripts in JavaScript.]),
1819 AC_ARG_WITH(system-rhino,
1820     AS_HELP_STRING([--with-system-rhino],
1821         [Use rhino already on system.]),,)
1822 #    [with_system_rhino="$with_system_jars"])
1823 # Above is not used as we have different debug interface
1824 # patched into internal rhino. This code needs to be fixed
1825 # before we can enable it by default.
1827 AC_ARG_WITH(rhino-jar,
1828     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1829         [Specify path to jarfile manually.]),
1830     RHINO_JAR=$withval)
1832 AC_ARG_WITH(commons-codec-jar,
1833     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1834         [Specify path to jarfile manually.]),
1835     COMMONS_CODEC_JAR=$withval)
1837 AC_ARG_WITH(commons-lang-jar,
1838     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1839         [Specify path to jarfile manually.]),
1840     COMMONS_LANG_JAR=$withval)
1842 AC_ARG_WITH(commons-httpclient-jar,
1843     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1844         [Specify path to jarfile manually.]),
1845     COMMONS_HTTPCLIENT_JAR=$withval)
1847 AC_ARG_WITH(commons-logging-jar,
1848     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     COMMONS_LOGGING_JAR=$withval)
1852 AC_ARG_WITH(system-jfreereport,
1853     AS_HELP_STRING([--with-system-jfreereport],
1854         [Use JFreeReport already on system.]),,
1855     [with_system_jfreereport="$with_system_jars"])
1857 AC_ARG_WITH(sac-jar,
1858     AS_HELP_STRING([--with-sac-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     SAC_JAR=$withval)
1862 AC_ARG_WITH(libxml-jar,
1863     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     LIBXML_JAR=$withval)
1867 AC_ARG_WITH(flute-jar,
1868     AS_HELP_STRING([--with-flute-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     FLUTE_JAR=$withval)
1872 AC_ARG_WITH(jfreereport-jar,
1873     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     JFREEREPORT_JAR=$withval)
1877 AC_ARG_WITH(liblayout-jar,
1878     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     LIBLAYOUT_JAR=$withval)
1882 AC_ARG_WITH(libloader-jar,
1883     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     LIBLOADER_JAR=$withval)
1887 AC_ARG_WITH(libformula-jar,
1888     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBFORMULA_JAR=$withval)
1892 AC_ARG_WITH(librepository-jar,
1893     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1894         [Specify path to jarfile manually.]),
1895     LIBREPOSITORY_JAR=$withval)
1897 AC_ARG_WITH(libfonts-jar,
1898     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1899         [Specify path to jarfile manually.]),
1900     LIBFONTS_JAR=$withval)
1902 AC_ARG_WITH(libserializer-jar,
1903     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1904         [Specify path to jarfile manually.]),
1905     LIBSERIALIZER_JAR=$withval)
1907 AC_ARG_WITH(libbase-jar,
1908     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1909         [Specify path to jarfile manually.]),
1910     LIBBASE_JAR=$withval)
1912 AC_ARG_WITH(system-odbc,
1913     AS_HELP_STRING([--with-system-odbc],
1914         [Use the odbc headers already on system.]),,
1915     [with_system_odbc="auto"])
1917 AC_ARG_WITH(system-sane,
1918     AS_HELP_STRING([--with-system-sane],
1919         [Use sane.h already on system.]),,
1920     [with_system_sane="$with_system_headers"])
1922 AC_ARG_WITH(system-bluez,
1923     AS_HELP_STRING([--with-system-bluez],
1924         [Use bluetooth.h already on system.]),,
1925     [with_system_bluez="$with_system_headers"])
1927 AC_ARG_WITH(system-curl,
1928     AS_HELP_STRING([--with-system-curl],
1929         [Use curl already on system.]),,
1930     [with_system_curl=auto])
1932 AC_ARG_WITH(system-boost,
1933     AS_HELP_STRING([--with-system-boost],
1934         [Use boost already on system.]),,
1935     [with_system_boost="$with_system_headers"])
1937 AC_ARG_WITH(system-glm,
1938     AS_HELP_STRING([--with-system-glm],
1939         [Use glm already on system.]),,
1940     [with_system_glm="$with_system_headers"])
1942 AC_ARG_WITH(system-hunspell,
1943     AS_HELP_STRING([--with-system-hunspell],
1944         [Use libhunspell already on system.]),,
1945     [with_system_hunspell="$with_system_libs"])
1947 AC_ARG_WITH(system-mythes,
1948     AS_HELP_STRING([--with-system-mythes],
1949         [Use mythes already on system.]),,
1950     [with_system_mythes="$with_system_libs"])
1952 AC_ARG_WITH(system-altlinuxhyph,
1953     AS_HELP_STRING([--with-system-altlinuxhyph],
1954         [Use ALTLinuxhyph already on system.]),,
1955     [with_system_altlinuxhyph="$with_system_libs"])
1957 AC_ARG_WITH(system-lpsolve,
1958     AS_HELP_STRING([--with-system-lpsolve],
1959         [Use lpsolve already on system.]),,
1960     [with_system_lpsolve="$with_system_libs"])
1962 AC_ARG_WITH(system-coinmp,
1963     AS_HELP_STRING([--with-system-coinmp],
1964         [Use CoinMP already on system.]),,
1965     [with_system_coinmp="$with_system_libs"])
1967 AC_ARG_WITH(system-liblangtag,
1968     AS_HELP_STRING([--with-system-liblangtag],
1969         [Use liblangtag library already on system.]),,
1970     [with_system_liblangtag="$with_system_libs"])
1972 AC_ARG_WITH(webdav,
1973     AS_HELP_STRING([--with-webdav],
1974         [Specify which library to use for webdav implementation.
1975          Possible values: "neon", "serf", "no". The default value is "neon".
1976          Example: --with-webdav="serf"]),
1977     WITH_WEBDAV=$withval,
1978     WITH_WEBDAV="neon")
1980 AC_ARG_WITH(linker-hash-style,
1981     AS_HELP_STRING([--with-linker-hash-style],
1982         [Use linker with --hash-style=<style> when linking shared objects.
1983          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1984          if supported on the build system, and "sysv" otherwise.]))
1986 AC_ARG_WITH(jdk-home,
1987     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1988         [If you have installed JDK 1.3 or later on your system please supply the
1989          path here. Note that this is not the location of the java command but the
1990          location of the entire distribution.]),
1993 AC_ARG_WITH(help,
1994     AS_HELP_STRING([--with-help],
1995         [Enable the build of help. There is a special parameter "common" that
1996          can be used to bundle only the common part, .e.g help-specific icons.
1997          This is useful when you build the helpcontent separately.])
1998     [
1999                           Usage:     --with-help    build the entire local help
2000                                  --without-help     no local help (default)
2001                                  --with-help=common bundle common files for the local
2002                                                     help but do not build the whole help
2003     ],
2006 libo_FUZZ_ARG_WITH(java,
2007     AS_HELP_STRING([--with-java=<java command>],
2008         [Specify the name of the Java interpreter command. Typically "java"
2009          which is the default.
2011          To build without support for Java components, applets, accessibility
2012          or the XML filters written in Java, use --without-java or --with-java=no.]),
2013     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2014     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2017 AC_ARG_WITH(jvm-path,
2018     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2019         [Use a specific JVM search path at runtime.
2020          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2023 AC_ARG_WITH(ant-home,
2024     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2025         [If you have installed Jakarta Ant on your system, please supply the path here.
2026          Note that this is not the location of the Ant binary but the location
2027          of the entire distribution.]),
2030 AC_ARG_WITH(symbol-config,
2031     AS_HELP_STRING([--with-symbol-config],
2032         [Configuration for the crashreport symbol upload]),
2033         [],
2034         [with_symbol_config=no])
2036 AC_ARG_WITH(export-validation,
2037     AS_HELP_STRING([--without-export-validation],
2038         [Disable validating OOXML and ODF files as exported from in-tree tests.
2039          Use this option e.g. if your system only provides Java 5.]),
2040 ,with_export_validation=yes)
2042 AC_ARG_WITH(bffvalidator,
2043     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2044         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2045          Requires installed Microsoft Office Binary File Format Validator.
2046          Note: export-validation (--with-export-validation) is required to be turned on.
2047          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2048 ,with_bffvalidator=no)
2050 libo_FUZZ_ARG_WITH(junit,
2051     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2052         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2053          --without-junit disables those tests. Not relevant in the --without-java case.]),
2054 ,with_junit=yes)
2056 AC_ARG_WITH(hamcrest,
2057     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2058         [Specifies the hamcrest jar file to use for JUnit-based tests.
2059          --without-junit disables those tests. Not relevant in the --without-java case.]),
2060 ,with_hamcrest=yes)
2062 AC_ARG_WITH(perl-home,
2063     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2064         [If you have installed Perl 5 Distribution, on your system, please
2065          supply the path here. Note that this is not the location of the Perl
2066          binary but the location of the entire distribution.]),
2069 libo_FUZZ_ARG_WITH(doxygen,
2070     AS_HELP_STRING(
2071         [--with-doxygen=<absolute path to doxygen executable>],
2072         [Specifies the doxygen executable to use when generating ODK C/C++
2073          documentation. --without-doxygen disables generation of ODK C/C++
2074          documentation. Not relevant in the --disable-odk case.]),
2075 ,with_doxygen=yes)
2077 AC_ARG_WITH(visual-studio,
2078     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
2079         [Specify which Visual Studio version to use in case several are
2080          installed. If not specified, defaults to 2015.]),
2083 AC_ARG_WITH(windows-sdk,
2084     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2085         [Specify which Windows SDK, or "Windows Kit", version to use
2086          in case the one that came with the selected Visual Studio
2087          is not what you want for some reason. Note that not all compiler/SDK
2088          combinations are supported. The intent is that this option should not
2089          be needed.]),
2092 AC_ARG_WITH(lang,
2093     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2094         [Use this option to build LibreOffice with additional UI language support.
2095          English (US) is always included by default.
2096          Separate multiple languages with space.
2097          For all languages, use --with-lang=ALL.]),
2100 AC_ARG_WITH(locales,
2101     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2102         [Use this option to limit the locale information built in.
2103          Separate multiple locales with space.
2104          Very experimental and might well break stuff.
2105          Just a desperate measure to shrink code and data size.
2106          By default all the locales available is included.
2107          This option is completely unrelated to --with-lang.])
2108     [
2109                           Affects also our character encoding conversion
2110                           tables for encodings mainly targeted for a
2111                           particular locale, like EUC-CN and EUC-TW for
2112                           zh, ISO-2022-JP for ja.
2114                           Affects also our add-on break iterator data for
2115                           some languages.
2117                           For the default, all locales, don't use this switch at all.
2118                           Specifying just the language part of a locale means all matching
2119                           locales will be included.
2120     ],
2123 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2124 libo_FUZZ_ARG_WITH(krb5,
2125     AS_HELP_STRING([--with-krb5],
2126         [Enable MIT Kerberos 5 support in modules that support it.
2127          By default automatically enabled on platforms
2128          where a good system Kerberos 5 is available.]),
2131 libo_FUZZ_ARG_WITH(gssapi,
2132     AS_HELP_STRING([--with-gssapi],
2133         [Enable GSSAPI support in modules that support it.
2134          By default automatically enabled on platforms
2135          where a good system GSSAPI is available.]),
2138 AC_ARG_WITH(iwyu,
2139     AS_HELP_STRING([--with-iwyu],
2140         [Use given IWYU binary path to check unneeded includes instead of building.
2141          Use only if you are hacking on it.]),
2144 dnl ===================================================================
2145 dnl Branding
2146 dnl ===================================================================
2148 AC_ARG_WITH(branding,
2149     AS_HELP_STRING([--with-branding=/path/to/images],
2150         [Use given path to retrieve branding images set.])
2151     [
2152                           Search for intro.png about.svg and flat_logo.svg.
2153                           If any is missing, default ones will be used instead.
2155                           Search also progress.conf for progress
2156                           settings on intro screen :
2158                           PROGRESSBARCOLOR="255,255,255" Set color of
2159                           progress bar. Comma separated RGB decimal values.
2160                           PROGRESSSIZE="407,6" Set size of progress bar.
2161                           Comma separated decimal values (width, height).
2162                           PROGRESSPOSITION="61,317" Set position of progress
2163                           bar from left,top. Comma separated decimal values.
2164                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2165                           bar frame. Comma separated RGB decimal values.
2166                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2167                           bar text. Comma separated RGB decimal values.
2168                           PROGRESSTEXTBASELINE="287" Set vertical position of
2169                           progress bar text from top. Decimal value.
2171                           Default values will be used if not found.
2172     ],
2176 AC_ARG_WITH(extra-buildid,
2177     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2178         [Show addition build identification in about dialog.]),
2182 AC_ARG_WITH(vendor,
2183     AS_HELP_STRING([--with-vendor="John the Builder"],
2184         [Set vendor of the build.]),
2187 AC_ARG_WITH(android-package-name,
2188     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2189         [Set Android package name of the build.]),
2192 AC_ARG_WITH(compat-oowrappers,
2193     AS_HELP_STRING([--with-compat-oowrappers],
2194         [Install oo* wrappers in parallel with
2195          lo* ones to keep backward compatibility.
2196          Has effect only with make distro-pack-install]),
2199 AC_ARG_WITH(os-version,
2200     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2201         [For FreeBSD users, use this option option to override the detected OSVERSION.]),
2204 AC_ARG_WITH(mingw-cross-compiler,
2205     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2206         [Specify the MinGW cross-compiler to use.
2207          When building on the ODK on Unix and building unowinreg.dll,
2208          specify the MinGW C++ cross-compiler.]),
2211 AC_ARG_WITH(idlc-cpp,
2212     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2213         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2216 AC_ARG_WITH(build-version,
2217     AS_HELP_STRING([--with-build-version="Built by Jim"],
2218         [Allows the builder to add a custom version tag that will appear in the
2219          Help/About box for QA purposes.]),
2220 with_build_version=$withval,
2223 AC_ARG_WITH(alloc,
2224     AS_HELP_STRING([--with-alloc],
2225         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2226          Note that on FreeBSD/NetBSD system==jemalloc]),
2229 AC_ARG_WITH(parallelism,
2230     AS_HELP_STRING([--with-parallelism],
2231         [Number of jobs to run simultaneously during build. Parallel builds can
2232         save a lot of time on multi-cpu machines. Defaults to the number of
2233         CPUs on the machine, unless you configure --enable-icecream - then to
2234         10.]),
2237 AC_ARG_WITH(all-tarballs,
2238     AS_HELP_STRING([--with-all-tarballs],
2239         [Download all external tarballs unconditionally]))
2241 AC_ARG_WITH(gdrive-client-id,
2242     AS_HELP_STRING([--with-gdrive-client-id],
2243         [Provides the client id of the application for OAuth2 authentication
2244         on Google Drive. If either this or --with-gdrive-client-secret is
2245         empty, the feature will be disabled]),
2248 AC_ARG_WITH(gdrive-client-secret,
2249     AS_HELP_STRING([--with-gdrive-client-secret],
2250         [Provides the client secret of the application for OAuth2
2251         authentication on Google Drive. If either this or
2252         --with-gdrive-client-id is empty, the feature will be disabled]),
2255 AC_ARG_WITH(alfresco-cloud-client-id,
2256     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2257         [Provides the client id of the application for OAuth2 authentication
2258         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2259         empty, the feature will be disabled]),
2262 AC_ARG_WITH(alfresco-cloud-client-secret,
2263     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2264         [Provides the client secret of the application for OAuth2
2265         authentication on Alfresco Cloud. If either this or
2266         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2269 AC_ARG_WITH(onedrive-client-id,
2270     AS_HELP_STRING([--with-onedrive-client-id],
2271         [Provides the client id of the application for OAuth2 authentication
2272         on OneDrive. If either this or --with-onedrive-client-secret is
2273         empty, the feature will be disabled]),
2276 AC_ARG_WITH(onedrive-client-secret,
2277     AS_HELP_STRING([--with-onedrive-client-secret],
2278         [Provides the client secret of the application for OAuth2
2279         authentication on OneDrive. If either this or
2280         --with-onedrive-client-id is empty, the feature will be disabled]),
2282 dnl ===================================================================
2283 dnl Do we want to use pre-build binary tarball for recompile
2284 dnl ===================================================================
2286 if test "$enable_library_bin_tar" = "yes" ; then
2287     USE_LIBRARY_BIN_TAR=TRUE
2288 else
2289     USE_LIBRARY_BIN_TAR=
2291 AC_SUBST(USE_LIBRARY_BIN_TAR)
2293 dnl ===================================================================
2294 dnl Test whether build target is Release Build
2295 dnl ===================================================================
2296 AC_MSG_CHECKING([whether build target is Release Build])
2297 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2298     AC_MSG_RESULT([no])
2299     ENABLE_RELEASE_BUILD=
2300 else
2301     AC_MSG_RESULT([yes])
2302     ENABLE_RELEASE_BUILD=TRUE
2304 AC_SUBST(ENABLE_RELEASE_BUILD)
2306 dnl ===================================================================
2307 dnl Test whether to sign Windows Build
2308 dnl ===================================================================
2309 AC_MSG_CHECKING([whether to sign windows build])
2310 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2311     AC_MSG_RESULT([yes])
2312     WINDOWS_BUILD_SIGNING="TRUE"
2313 else
2314     AC_MSG_RESULT([no])
2315     WINDOWS_BUILD_SIGNING="FALSE"
2317 AC_SUBST(WINDOWS_BUILD_SIGNING)
2319 dnl ===================================================================
2320 dnl MacOSX build and runtime environment options
2321 dnl ===================================================================
2323 AC_ARG_WITH(macosx-sdk,
2324     AS_HELP_STRING([--with-macosx-sdk=<version>],
2325         [Prefer a specific SDK for building.])
2326     [
2327                           If the requested SDK is not available, a search for the oldest one will be done.
2328                           With current Xcode versions, only the latest SDK is included, so this option is
2329                           not terribly useful. It works fine to build with a new SDK and run the result
2330                           on an older OS.
2332                           e. g.: --with-macosx-sdk=10.9
2334                           there are 3 options to control the MacOSX build:
2335                           --with-macosx-sdk (referred as 'sdk' below)
2336                           --with-macosx-version-min-required (referred as 'min' below)
2337                           --with-macosx-version-max-allowed (referred as 'max' below)
2339                           the connection between these value and the default they take is as follow:
2340                           ( ? means not specified on the command line, s means the SDK version found,
2341                           constraint: 8 <= x <= y <= z)
2343                           ==========================================
2344                            command line      || config result
2345                           ==========================================
2346                           min  | max  | sdk  || min  | max  | sdk  |
2347                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2348                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2349                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2350                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2351                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2352                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2353                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2354                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2357                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2358                           for a detailed technical explanation of these variables
2360                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2361     ],
2364 AC_ARG_WITH(macosx-version-min-required,
2365     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2366         [set the minimum OS version needed to run the built LibreOffice])
2367     [
2368                           e. g.: --with-macos-version-min-required=10.9
2369                           see --with-macosx-sdk for more info
2370     ],
2373 AC_ARG_WITH(macosx-version-max-allowed,
2374     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2375         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2376     [
2377                           e. g.: --with-macos-version-max-allowed=10.9
2378                           see --with-macosx-sdk for more info
2379     ],
2383 dnl ===================================================================
2384 dnl options for stuff used during cross-compilation build
2385 dnl Not quite superseded by --with-build-platform-configure-options.
2386 dnl TODO: check, if the "force" option is still needed anywhere.
2387 dnl ===================================================================
2389 AC_ARG_WITH(system-icu-for-build,
2390     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2391         [Use icu already on system for build tools (cross-compilation only).]))
2394 dnl ===================================================================
2395 dnl Check for incompatible options set by fuzzing, and reset those
2396 dnl automatically to working combinations
2397 dnl ===================================================================
2399 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2400         "$enable_dbus" != "$enable_avahi"; then
2401     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2402     enable_avahi=$enable_dbus
2405 dnl ===================================================================
2406 dnl check for required programs (grep, awk, sed, bash)
2407 dnl ===================================================================
2409 pathmunge ()
2411     if test -n "$1"; then
2412         if test "$build_os" = "cygwin"; then
2413             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2414                 PathFormat "$1"
2415                 new_path=`cygpath -sm "$formatted_path"`
2416             else
2417                 PathFormat "$1"
2418                 new_path=`cygpath -u "$formatted_path"`
2419             fi
2420         else
2421             new_path="$1"
2422         fi
2423         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2424             if test "$2" = "after"; then
2425                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2426             else
2427                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2428             fi
2429         fi
2430         unset new_path
2431     fi
2434 AC_PROG_AWK
2435 AC_PATH_PROG( AWK, $AWK)
2436 if test -z "$AWK"; then
2437     AC_MSG_ERROR([install awk to run this script])
2440 AC_PATH_PROG(BASH, bash)
2441 if test -z "$BASH"; then
2442     AC_MSG_ERROR([bash not found in \$PATH])
2444 AC_SUBST(BASH)
2446 AC_MSG_CHECKING([for GNU or BSD tar])
2447 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2448     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2449     if test $? -eq 0;  then
2450         GNUTAR=$a
2451         break
2452     fi
2453 done
2454 AC_MSG_RESULT($GNUTAR)
2455 if test -z "$GNUTAR"; then
2456     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2458 AC_SUBST(GNUTAR)
2460 AC_MSG_CHECKING([for tar's option to strip components])
2461 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2462 if test $? -eq 0; then
2463     STRIP_COMPONENTS="--strip-components"
2464 else
2465     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2466     if test $? -eq 0; then
2467         STRIP_COMPONENTS="--strip-path"
2468     else
2469         STRIP_COMPONENTS="unsupported"
2470     fi
2472 AC_MSG_RESULT($STRIP_COMPONENTS)
2473 if test x$STRIP_COMPONENTS = xunsupported; then
2474     AC_MSG_ERROR([you need a tar that is able to strip components.])
2476 AC_SUBST(STRIP_COMPONENTS)
2478 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2479 dnl desktop OSes from "mobile" ones.
2481 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2482 dnl In other words, that when building for an OS that is not a
2483 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2485 dnl Note the direction of the implication; there is no assumption that
2486 dnl cross-compiling would imply a non-desktop OS.
2488 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2489     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2490     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2491     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2494 # Whether to build "avmedia" functionality or not.
2496 if test -z "$enable_avmedia"; then
2497     enable_avmedia=yes
2500 if test "$enable_avmedia" = yes; then
2501     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2502     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2505 # Decide whether to build database connectivity stuff (including
2506 # Base) or not. We probably don't want to on non-desktop OSes.
2508 if test -z "$enable_database_connectivity"; then
2509     # --disable-database-connectivity is unfinished work in progress
2510     # and the iOS test app doesn't link if we actually try to use it.
2511     # if test $_os != iOS -a $_os != Android; then
2512         enable_database_connectivity=yes
2513     # fi
2516 if test "$enable_database_connectivity" = yes; then
2517     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2518     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2521 if test -z "$enable_extensions"; then
2522     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2523     if test $_os != iOS -a $_os != Android; then
2524         enable_extensions=yes
2525     fi
2528 if test "$enable_extensions" = yes; then
2529     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2530     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2533 if test -z "$enable_scripting"; then
2534     # Disable scripting for iOS unless specifically overridden
2535     # with --enable-scripting.
2536     if test $_os != iOS; then
2537         enable_scripting=yes
2538     fi
2541 DISABLE_SCRIPTING=''
2542 if test "$enable_scripting" = yes; then
2543     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2544     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2545 else
2546     DISABLE_SCRIPTING='TRUE'
2547     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2550 if test $_os = iOS -o $_os = Android; then
2551     # Disable dynamic_loading always for iOS and Android
2552     enable_dynamic_loading=no
2553 elif test -z "$enable_dynamic_loading"; then
2554     # Otherwise enable it unless speficically disabled
2555     enable_dynamic_loading=yes
2558 DISABLE_DYNLOADING=''
2559 if test "$enable_dynamic_loading" = yes; then
2560     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2561 else
2562     DISABLE_DYNLOADING='TRUE'
2564 AC_SUBST(DISABLE_DYNLOADING)
2566 # remenber SYSBASE value
2567 AC_SUBST(SYSBASE)
2569 dnl ===================================================================
2570 dnl  Sort out various gallery compilation options
2571 dnl ===================================================================
2572 AC_MSG_CHECKING([how to build and package galleries])
2573 if test -n "${with_galleries}"; then
2574     if test "$with_galleries" = "build"; then
2575         WITH_GALLERY_BUILD=TRUE
2576         AC_MSG_RESULT([build from source images internally])
2577     elif test "$with_galleries" = "no"; then
2578         WITH_GALLERY_BUILD=
2579         AC_MSG_RESULT([disable non-internal gallery build])
2580     else
2581         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2582     fi
2583 else
2584     if test $_os != iOS -a $_os != Android; then
2585         WITH_GALLERY_BUILD=TRUE
2586         AC_MSG_RESULT([internal src images for desktop])
2587     else
2588         WITH_GALLERY_BUILD=
2589         AC_MSG_RESULT([disable src image build])
2590     fi
2592 AC_SUBST(WITH_GALLERY_BUILD)
2594 dnl ===================================================================
2595 dnl  Checks if ccache is available
2596 dnl ===================================================================
2597 if test "$_os" = "WINNT"; then
2598     # on windows/VC build do not use ccache
2599     CCACHE=""
2600 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2601     case "%$CC%$CXX%" in
2602     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2603     # assume that's good then
2604     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2605         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2606         ;;
2607     *)
2608         AC_PATH_PROG([CCACHE],[ccache],[not found])
2609         if test "$CCACHE" = "not found"; then
2610             CCACHE=""
2611         else
2612             # Need to check for ccache version: otherwise prevents
2613             # caching of the results (like "-x objective-c++" for Mac)
2614             if test $_os = Darwin -o $_os = iOS; then
2615                 # Check ccache version
2616                 AC_MSG_CHECKING([whether version of ccache is suitable])
2617                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2618                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2619                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2620                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2621                 else
2622                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2623                     CCACHE=""
2624                 fi
2625             fi
2626         fi
2627         ;;
2628     esac
2629 else
2630     CCACHE=""
2633 if test "$CCACHE" != ""; then
2634     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2635     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2636     if test "$ccache_size" = ""; then
2637         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2638         if test "$ccache_size" = ""; then
2639             ccache_size=0
2640         fi
2641         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2642         if test $ccache_size -lt 1024; then
2643             CCACHE=""
2644             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2645             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2646         else
2647             # warn that ccache may be too small for debug build
2648             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2649             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2650         fi
2651     else
2652         if test $ccache_size -lt 5; then
2653             #warn that ccache may be too small for debug build
2654             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2655             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2656         fi
2657     fi
2660 dnl ===================================================================
2661 dnl  Checks for C compiler,
2662 dnl  The check for the C++ compiler is later on.
2663 dnl ===================================================================
2664 if test "$_os" != "WINNT"; then
2665     GCC_HOME_SET="true"
2666     AC_MSG_CHECKING([gcc home])
2667     if test -z "$with_gcc_home"; then
2668         if test "$enable_icecream" = "yes"; then
2669             if test -d "/usr/lib/icecc/bin"; then
2670                 GCC_HOME="/usr/lib/icecc/"
2671             else
2672                 GCC_HOME="/opt/icecream/"
2673             fi
2674         else
2675             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2676             GCC_HOME_SET="false"
2677         fi
2678     else
2679         GCC_HOME="$with_gcc_home"
2680     fi
2681     AC_MSG_RESULT($GCC_HOME)
2682     AC_SUBST(GCC_HOME)
2684     if test "$GCC_HOME_SET" = "true"; then
2685         if test -z "$CC"; then
2686             CC="$GCC_HOME/bin/gcc"
2687         fi
2688         if test -z "$CXX"; then
2689             CXX="$GCC_HOME/bin/g++"
2690         fi
2691     fi
2694 COMPATH=`dirname "$CC"`
2695 if test "$COMPATH" = "."; then
2696     AC_PATH_PROGS(COMPATH, $CC)
2697     dnl double square bracket to get single because of M4 quote...
2698     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2700 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2702 dnl ===================================================================
2703 dnl Java support
2704 dnl ===================================================================
2705 AC_MSG_CHECKING([whether to build with Java support])
2706 if test "$with_java" != "no"; then
2707     if test "$DISABLE_SCRIPTING" = TRUE; then
2708         AC_MSG_RESULT([no, overridden by --disable-scripting])
2709         ENABLE_JAVA=""
2710         with_java=no
2711     else
2712         AC_MSG_RESULT([yes])
2713         ENABLE_JAVA="TRUE"
2714         AC_DEFINE(HAVE_FEATURE_JAVA)
2715     fi
2716 else
2717     AC_MSG_RESULT([no])
2718     ENABLE_JAVA=""
2721 AC_SUBST(ENABLE_JAVA)
2723 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2725 dnl ENABLE_JAVA="" indicate no Java support at all
2727 dnl ===================================================================
2728 dnl Check OS X SDK and compiler
2729 dnl ===================================================================
2731 if test $_os = Darwin; then
2733     # If no --with-macosx-sdk option is given, look for one
2735     # The intent is that for "most" Mac-based developers, a suitable
2736     # SDK will be found automatically without any configure options.
2738     # For developers with a current Xcode, the lowest-numbered SDK
2739     # higher than or equal to the minimum required should be found.
2741     AC_MSG_CHECKING([what Mac OS X SDK to use])
2743     for _macosx_sdk in $with_macosx_sdk 10.9 10.10 10.11 10.12 10.13; do
2744         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2745         if test -d "$MACOSX_SDK_PATH"; then
2746             with_macosx_sdk="${_macosx_sdk}"
2747             break
2748         else
2749             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2750             if test -d "$MACOSX_SDK_PATH"; then
2751                 with_macosx_sdk="${_macosx_sdk}"
2752                 break
2753             fi
2754         fi
2755     done
2756     if test ! -d "$MACOSX_SDK_PATH"; then
2757         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2758     fi
2759     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2761     case $with_macosx_sdk in
2762     10.9)
2763         MACOSX_SDK_VERSION=1090
2764         ;;
2765     10.10)
2766         MACOSX_SDK_VERSION=101000
2767         ;;
2768     10.11)
2769         MACOSX_SDK_VERSION=101100
2770         ;;
2771     10.12)
2772         MACOSX_SDK_VERSION=101200
2773         ;;
2774     10.13)
2775         MACOSX_SDK_VERSION=101300
2776         ;;
2777     *)
2778         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2779         ;;
2780     esac
2782     if test "$with_macosx_version_min_required" = "" ; then
2783         with_macosx_version_min_required="10.9";
2784     fi
2786     if test "$with_macosx_version_max_allowed" = "" ; then
2787         with_macosx_version_max_allowed="$with_macosx_sdk"
2788     fi
2790     # export this so that "xcrun" invocations later return matching values
2791     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2792     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2793     export DEVELOPER_DIR
2794     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2795     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2797     case "$with_macosx_version_min_required" in
2798     10.9)
2799         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2800         ;;
2801     10.10)
2802         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2803         ;;
2804     10.11)
2805         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2806         ;;
2807     10.12)
2808         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2809         ;;
2810     10.13)
2811         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2812         ;;
2813     *)
2814         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2815         ;;
2816     esac
2818     LIBTOOL=/usr/bin/libtool
2819     INSTALL_NAME_TOOL=install_name_tool
2820     if test -z "$save_CC"; then
2821         AC_MSG_CHECKING([what compiler to use])
2822         stdlib=-stdlib=libc++
2823         if test "$ENABLE_LTO" = TRUE; then
2824             lto=-flto
2825         fi
2826         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2827         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2828         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2829         AR=`xcrun -find ar`
2830         NM=`xcrun -find nm`
2831         STRIP=`xcrun -find strip`
2832         LIBTOOL=`xcrun -find libtool`
2833         RANLIB=`xcrun -find ranlib`
2834         AC_MSG_RESULT([$CC and $CXX])
2835     fi
2837     case "$with_macosx_version_max_allowed" in
2838     10.9)
2839         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2840         ;;
2841     10.10)
2842         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2843         ;;
2844     10.11)
2845         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2846         ;;
2847     10.12)
2848         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2849         ;;
2850     10.13)
2851         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2852         ;;
2853     *)
2854         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2855         ;;
2856     esac
2858     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2859     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2860         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2861     else
2862         AC_MSG_RESULT([ok])
2863     fi
2865     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2866     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2867         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2868     else
2869         AC_MSG_RESULT([ok])
2870     fi
2871     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2872     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2874     AC_MSG_CHECKING([whether to do code signing])
2876     if test "$enable_macosx_code_signing" = yes; then
2877         # By default use the first suitable certificate (?).
2879         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2880         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2881         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2882         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2883         # "Developer ID Application" one.
2885         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2886         if test -n "$identity"; then
2887             MACOSX_CODESIGNING_IDENTITY=$identity
2888             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2889             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2890         else
2891             AC_MSG_ERROR([cannot determine identity to use])
2892         fi
2893     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2894         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2895         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2896         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2897     else
2898         AC_MSG_RESULT([no])
2899     fi
2901     AC_MSG_CHECKING([whether to create a Mac App Store package])
2903     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2904         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2905     elif test "$enable_macosx_package_signing" = yes; then
2906         # By default use the first suitable certificate.
2907         # It should be a "3rd Party Mac Developer Installer" one
2909         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2910         if test -n "$identity"; then
2911             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2912             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2913             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2914         else
2915             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2916         fi
2917     elif test -n "$enable_macosx_package_signing"; then
2918         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2919         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2920         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2921     else
2922         AC_MSG_RESULT([no])
2923     fi
2925     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2926         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2927     fi
2929     AC_MSG_CHECKING([whether to sandbox the application])
2931     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2932         AC_MSG_ERROR([OS X sandboxing requires code signing])
2933     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2934         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2935     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2936         ENABLE_MACOSX_SANDBOX=TRUE
2937         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2938         AC_MSG_RESULT([yes])
2939     else
2940         AC_MSG_RESULT([no])
2941     fi
2943     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2944     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2945     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2947 AC_SUBST(MACOSX_SDK_PATH)
2948 AC_SUBST(MACOSX_SDK_VERSION)
2949 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2950 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2951 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2952 AC_SUBST(INSTALL_NAME_TOOL)
2953 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2954 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2955 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2956 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2957 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2959 dnl ===================================================================
2960 dnl Check iOS SDK and compiler
2961 dnl ===================================================================
2963 if test $_os = iOS; then
2965     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2966         :
2967     else
2968         BITNESS_OVERRIDE=64
2969     fi
2971     AC_MSG_CHECKING([what iOS SDK to use])
2973     if test "$enable_ios_simulator" = yes; then
2974         platform=iPhoneSimulator
2975     else
2976         platform=iPhoneOS
2977     fi
2979     xcode_developer=`xcode-select -print-path`
2981     current_sdk_ver=10.2
2982     for sdkver in 10.3 10.2 10.1 10.0 9.3; do
2983         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2984         if test -d $t; then
2985             ios_sdk=$sdkver
2986             sysroot=$t
2987             break
2988         fi
2989     done
2991     if test -z "$sysroot"; then
2992         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2993     fi
2995     AC_MSG_RESULT($sysroot)
2997     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2999     if test "$enable_ios_simulator" = yes; then
3000         if test "$BITNESS_OVERRIDE" = 64; then
3001             XCODE_ARCHS=x86_64
3002             versionmin=-mios-simulator-version-min=9.3
3003         else
3004             XCODE_ARCHS=i386
3005             versionmin=-mios-simulator-version-min=9.3
3006         fi
3007     else
3008         platform=iPhoneOS
3009         if test "$BITNESS_OVERRIDE" = 64; then
3010             XCODE_ARCHS=arm64
3011         else
3012             XCODE_ARCHS=armv7
3013         fi
3014         versionmin=-miphoneos-version-min=9.3
3015     fi
3017     # LTO is not really recommended for iOS builds,
3018     # the link time will be astronomical
3019     if test "$ENABLE_LTO" = TRUE; then
3020         lto=-flto
3021     fi
3022     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3023     # get compiled with it, to avoid ld warnings when linking all that together into one
3024     # executable.
3026     XCODE_CLANG_CXX_LIBRARY=libc++
3027     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3029     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3030     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3032     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3033     AR=`xcrun -find ar`
3034     NM=`xcrun -find nm`
3035     STRIP=`xcrun -find strip`
3036     LIBTOOL=`xcrun -find libtool`
3037     RANLIB=`xcrun -find ranlib`
3040 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3041 AC_SUBST(XCODE_ARCHS)
3042 AC_SUBST(XCODEBUILD_SDK)
3044 AC_MSG_CHECKING([whether to treat the installation as read-only])
3046 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3047         "$enable_extensions" != yes; then
3048     enable_readonly_installset=yes
3050 if test "$enable_readonly_installset" = yes; then
3051     AC_MSG_RESULT([yes])
3052     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3053 else
3054     AC_MSG_RESULT([no])
3057 dnl ===================================================================
3058 dnl Structure of install set
3059 dnl ===================================================================
3061 if test $_os = Darwin; then
3062     LIBO_BIN_FOLDER=MacOS
3063     LIBO_ETC_FOLDER=Resources
3064     LIBO_LIBEXEC_FOLDER=MacOS
3065     LIBO_LIB_FOLDER=Frameworks
3066     LIBO_LIB_PYUNO_FOLDER=Resources
3067     LIBO_SHARE_FOLDER=Resources
3068     LIBO_SHARE_HELP_FOLDER=Resources/help
3069     LIBO_SHARE_JAVA_FOLDER=Resources/java
3070     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3071     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3072     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3073     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3074     LIBO_URE_BIN_FOLDER=MacOS
3075     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3076     LIBO_URE_LIB_FOLDER=Frameworks
3077     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3078     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3079 elif test $_os = WINNT; then
3080     LIBO_BIN_FOLDER=program
3081     LIBO_ETC_FOLDER=program
3082     LIBO_LIBEXEC_FOLDER=program
3083     LIBO_LIB_FOLDER=program
3084     LIBO_LIB_PYUNO_FOLDER=program
3085     LIBO_SHARE_FOLDER=share
3086     LIBO_SHARE_HELP_FOLDER=help
3087     LIBO_SHARE_JAVA_FOLDER=program/classes
3088     LIBO_SHARE_PRESETS_FOLDER=presets
3089     LIBO_SHARE_READMES_FOLDER=readmes
3090     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3091     LIBO_SHARE_SHELL_FOLDER=program/shell
3092     LIBO_URE_BIN_FOLDER=program
3093     LIBO_URE_ETC_FOLDER=program
3094     LIBO_URE_LIB_FOLDER=program
3095     LIBO_URE_MISC_FOLDER=program
3096     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3097 else
3098     LIBO_BIN_FOLDER=program
3099     LIBO_ETC_FOLDER=program
3100     LIBO_LIBEXEC_FOLDER=program
3101     LIBO_LIB_FOLDER=program
3102     LIBO_LIB_PYUNO_FOLDER=program
3103     LIBO_SHARE_FOLDER=share
3104     LIBO_SHARE_HELP_FOLDER=help
3105     LIBO_SHARE_JAVA_FOLDER=program/classes
3106     LIBO_SHARE_PRESETS_FOLDER=presets
3107     LIBO_SHARE_READMES_FOLDER=readmes
3108     if test "$enable_fuzzers" != yes; then
3109         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3110     else
3111         LIBO_SHARE_RESOURCE_FOLDER=resource
3112     fi
3113     LIBO_SHARE_SHELL_FOLDER=program/shell
3114     LIBO_URE_BIN_FOLDER=program
3115     LIBO_URE_ETC_FOLDER=program
3116     LIBO_URE_LIB_FOLDER=program
3117     LIBO_URE_MISC_FOLDER=program
3118     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3120 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3121 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3122 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3123 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3124 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3125 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3126 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3127 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3128 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3129 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3130 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3131 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3132 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3133 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3134 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3135 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3137 # Not all of them needed in config_host.mk, add more if need arises
3138 AC_SUBST(LIBO_BIN_FOLDER)
3139 AC_SUBST(LIBO_ETC_FOLDER)
3140 AC_SUBST(LIBO_LIB_FOLDER)
3141 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3142 AC_SUBST(LIBO_SHARE_FOLDER)
3143 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3144 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3145 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3146 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3147 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3148 AC_SUBST(LIBO_URE_BIN_FOLDER)
3149 AC_SUBST(LIBO_URE_ETC_FOLDER)
3150 AC_SUBST(LIBO_URE_LIB_FOLDER)
3151 AC_SUBST(LIBO_URE_MISC_FOLDER)
3152 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3154 dnl ===================================================================
3155 dnl Windows specific tests and stuff
3156 dnl ===================================================================
3158 reg_get_value()
3160     # Return value: $regvalue
3161     unset regvalue
3163     local _regentry="/proc/registry${1}/${2}"
3164     if test -f "$_regentry"; then
3165         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3166         # Registry keys read via /proc/registry* are always \0 terminated!
3167         local _regvalue=$(tr -d '\0' < "$_regentry")
3168         if test $? -eq 0; then
3169             regvalue=$_regvalue
3170         fi
3171     fi
3174 # Get a value from the 32-bit side of the Registry
3175 reg_get_value_32()
3177     reg_get_value "32" "$1"
3180 # Get a value from the 64-bit side of the Registry
3181 reg_get_value_64()
3183     reg_get_value "64" "$1"
3186 if test "$_os" = "WINNT"; then
3187     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3188     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3189         AC_MSG_RESULT([no])
3190         WINDOWS_SDK_ARCH="x86"
3191     else
3192         AC_MSG_RESULT([yes])
3193         WINDOWS_SDK_ARCH="x64"
3194         BITNESS_OVERRIDE=64
3195     fi
3198 if test "$cross_compiling" = "yes"; then
3199     export CROSS_COMPILING=TRUE
3200 else
3201     CROSS_COMPILING=
3202     BUILD_TYPE="$BUILD_TYPE NATIVE"
3204 AC_SUBST(CROSS_COMPILING)
3206 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3207 if test "$GCC" = "yes"; then
3208     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3209     bsymbolic_functions_ldflags_save=$LDFLAGS
3210     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3211     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3212 #include <stdio.h>
3213         ],[
3214 printf ("hello world\n");
3215         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3216     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3217         AC_MSG_RESULT( found )
3218     else
3219         AC_MSG_RESULT( not found )
3220     fi
3221     LDFLAGS=$bsymbolic_functions_ldflags_save
3223 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3225 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3226 # NOTE: must _not_ be used for bundled external libraries!
3227 ISYSTEM=
3228 if test "$GCC" = "yes"; then
3229     AC_MSG_CHECKING( for -isystem )
3230     save_CFLAGS=$CFLAGS
3231     CFLAGS="$CFLAGS -Werror"
3232     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3233     CFLAGS=$save_CFLAGS
3234     if test -n "$ISYSTEM"; then
3235         AC_MSG_RESULT(yes)
3236     else
3237         AC_MSG_RESULT(no)
3238     fi
3240 if test -z "$ISYSTEM"; then
3241     # fall back to using -I
3242     ISYSTEM=-I
3244 AC_SUBST(ISYSTEM)
3246 dnl ===================================================================
3247 dnl  Check which Visual Studio compiler is used
3248 dnl ===================================================================
3250 map_vs_year_to_version()
3252     # Return value: $vsversion
3254     unset vsversion
3256     case $1 in
3257     2015)
3258         vsversion=14.0;;
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         # By default we prefer 2015/2017, in this order
3278         vsversions="14.0 15.0"
3279     fi
3282 win_get_env_from_vsvars32bat()
3284     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3285     if test $vcnum = "150"; then
3286       # Also seems to be located in another directory under the same name: vsvars32.bat
3287       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3288       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3289     else
3290       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3291     fi
3292     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3293     chmod +x $WRAPPERBATCHFILEPATH
3294     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3295     rm -f $WRAPPERBATCHFILEPATH
3296     printf '%s' "$_win_get_env_from_vsvars32bat"
3299 find_ucrt()
3301     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3302     if test -n "$regvalue"; then
3303         PathFormat "$regvalue"
3304         UCRTSDKDIR=$formatted_path
3305         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3306         UCRTVERSION=$regvalue
3307         # Rest if not exist
3308         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3309           UCRTSDKDIR=
3310         fi
3311     fi
3312     if test -z "$UCRTSDKDIR"; then
3313         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3314         if test "$vcnum" = "150"; then
3315           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3316         else
3317           ide_env_file="${ide_env_dir}/vsvars32.bat"
3318         fi
3319         if test -f "$ide_env_file"; then
3320             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3321             UCRTSDKDIR=$formatted_path
3322             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3323             dnl Hack needed at least by tml:
3324             if test "$UCRTVERSION" = 10.0.15063.0 \
3325                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3326                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3327             then
3328                 UCRTVERSION=10.0.14393.0
3329             fi
3330         else
3331           AC_MSG_ERROR([No UCRT found])
3332         fi
3333     fi
3336 find_msvc()
3338     # Find Visual C++ 2015/2017
3339     # Args: $1 (optional) : The VS version year
3340     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3342     unset vctest vcnum vcnumwithdot vcbuildnumber
3344     vs_versions_to_check "$1"
3346     for ver in $vsversions; do
3347         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3348         if test -n "$regvalue"; then
3349             vctest=$regvalue
3350             break
3351         fi
3352         # As always MSVC 15.0 is special here
3353         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3354         if test -n "$regvalue"; then
3355             AC_MSG_RESULT([found: $regvalue])
3356             PathFormat "$regvalue"
3357             vctest=$formatted_path
3358             break
3359         fi
3360     done
3361     if test -n "$vctest"; then
3362         vcnumwithdot=$ver
3363         case "$vcnumwithdot" in
3364         14.0)
3365             vcyear=2015
3366             vcnum=140
3367             ;;
3368         15.0)
3369             vcyear=2017
3370             vcnum=150
3371             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3372             ;;
3373         esac
3374     fi
3377 SOLARINC=
3378 SHOWINCLUDES_PREFIX=
3379 MSBUILD_PATH=
3380 DEVENV=
3381 if test "$_os" = "WINNT"; then
3382     AC_MSG_CHECKING([Visual C++])
3384     find_msvc "$with_visual_studio"
3385     if test -z "$vctest"; then
3386         if test -n "$with_visual_studio"; then
3387             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3388         else
3389             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3390         fi
3391     fi
3393     if test "$BITNESS_OVERRIDE" = ""; then
3394         if test -f "$vctest/bin/cl.exe"; then
3395             VC_PRODUCT_DIR=$vctest
3396         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3397             VC_PRODUCT_DIR=$vctest/VC
3398         else
3399             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3400         fi
3401     else
3402         if test -f "$vctest/bin/amd64/cl.exe"; then
3403             VC_PRODUCT_DIR=$vctest
3404         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3405             VC_PRODUCT_DIR=$vctest/VC
3406         else
3407             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])
3408         fi
3409     fi
3411     AC_MSG_CHECKING([for short pathname of VC product directory])
3412     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3413     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3415     UCRTSDKDIR=
3416     UCRTVERSION=
3418     AC_MSG_CHECKING([for UCRT location])
3419     find_ucrt
3420     # find_ucrt errors out if it doesn't find it
3421     AC_MSG_RESULT([found])
3422     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3423     ucrtincpath_formatted=$formatted_path
3424     # SOLARINC is used for external modules and must be set too.
3425     # And no, it's not sufficient to set SOLARINC only, as configure
3426     # itself doesn't honour it.
3427     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3428     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3429     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3430     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3432     AC_SUBST(UCRTSDKDIR)
3433     AC_SUBST(UCRTVERSION)
3435     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3436     # Find the proper version of MSBuild.exe to use based on the VS version
3437     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3438     if test -n "$regvalue" ; then
3439         AC_MSG_RESULT([found: $regvalue])
3440         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3441     else
3442         if test $vcnum = "150"; then
3443             if test "$BITNESS_OVERRIDE" = ""; then
3444                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3445             else
3446                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3447             fi
3448             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3449         else
3450             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3451         fi
3452         AC_MSG_RESULT([$regvalue])
3453     fi
3455     # Find the version of devenv.exe
3456     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3457     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3458     if test ! -e "$DEVENV"; then
3459         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3460     fi
3462     dnl ===========================================================
3463     dnl  Check for the corresponding mspdb*.dll
3464     dnl ===========================================================
3466     MSPDB_PATH=
3467     CL_DIR=
3468     CL_LIB=
3470     if test "$BITNESS_OVERRIDE" = ""; then
3471         if test "$vcnum" = "150"; then
3472             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3473             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3474         else
3475             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3476             CL_DIR=bin
3477         fi
3478     else
3479         if test "$vcnum" = "150"; then
3480             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3481             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3482         else
3483             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3484             CL_DIR=bin/amd64
3485         fi
3486     fi
3488     # MSVC 15.0 has libraries from 14.0?
3489     if test  "$vcnum" = "150"; then
3490         mspdbnum="140"
3491     else
3492         mspdbnum=$vcnum
3493     fi
3495     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3496         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3497     fi
3499     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3500     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3502     dnl The path needs to be added before cl is called
3503     PATH="$MSPDB_PATH:$PATH"
3505     AC_MSG_CHECKING([cl.exe])
3507     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3508     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3509     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3510     # is not enough?
3512     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3513     dnl needed when building CLR code:
3514     if test -z "$MSVC_CXX"; then
3515         if test "$BITNESS_OVERRIDE" = ""; then
3516             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3517                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3518             fi
3519         else
3520             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3521                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3522             fi
3523         fi
3525         # This gives us a posix path with 8.3 filename restrictions
3526         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3527     fi
3529     if test -z "$CC"; then
3530         CC=$MSVC_CXX
3531     fi
3532     if test "$BITNESS_OVERRIDE" = ""; then
3533         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3534         MSVC_CXX="$MSVC_CXX -arch:SSE"
3535     fi
3537     if test -n "$CC"; then
3538         # Remove /cl.exe from CC case insensitive
3539         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3540         if test "$BITNESS_OVERRIDE" = ""; then
3541            if test "$vcnum" = "150"; then
3542                COMPATH="$VC_PRODUCT_DIR"
3543            else
3544                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3545            fi
3546         else
3547             if test -n "$VC_PRODUCT_DIR"; then
3548                 COMPATH=$VC_PRODUCT_DIR
3549             fi
3550         fi
3551         if test "$BITNESS_OVERRIDE" = ""; then
3552             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3553             CC="$CC -arch:SSE"
3554         fi
3556         if test "$vcnum" = "150"; then
3557             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3558         fi
3560         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3562         PathFormat "$COMPATH"
3563         COMPATH="$formatted_path"
3565         VCVER=$vcnum
3566         MSVSVER=$vcyear
3568         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3569         # are always "better", we list them in reverse chronological order.
3571         case $vcnum in
3572         140)
3573             COMEX=19
3574             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3575             ;;
3576         150)
3577             COMEX=19
3578             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3579             ;;
3580         esac
3582         # The expectation is that --with-windows-sdk should not need to be used
3583         if test -n "$with_windows_sdk"; then
3584             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3585             *" "$with_windows_sdk" "*)
3586                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3587                 ;;
3588             *)
3589                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3590                 ;;
3591             esac
3592         fi
3594         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3595         ac_objext=obj
3596         ac_exeext=exe
3598     else
3599         AC_MSG_ERROR([Visual C++ not found after all, huh])
3600     fi
3602     dnl We need to guess the prefix of the -showIncludes output, it can be
3603     dnl localized
3604     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3605     echo "#include <stdlib.h>" > conftest.c
3606     dnl Filter out -FIIntrin.h when CC points at clang-cl.exe and needs to
3607     dnl explicitly state that argument:
3608     my_CC=
3609     for i in $CC; do
3610         case $i in
3611         -FIIntrin.h)
3612             ;;
3613         *)
3614             my_CC="$my_CC $i"
3615             ;;
3616         esac
3617     done
3618     SHOWINCLUDES_PREFIX=`$my_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3619         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3620     rm -f conftest.c conftest.obj
3621     if test -z "$SHOWINCLUDES_PREFIX"; then
3622         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3623     else
3624         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3625     fi
3627     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3628     # version of the Explorer extension (and maybe other small
3629     # bits, too) needed when installing a 32-bit LibreOffice on a
3630     # 64-bit OS. The 64-bit Explorer extension is a feature that
3631     # has been present since long in OOo. Don't confuse it with
3632     # building LibreOffice itself as 64-bit code.
3634     BUILD_X64=
3635     CXX_X64_BINARY=
3636     LINK_X64_BINARY=
3638     if test "$BITNESS_OVERRIDE" = ""; then
3639         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3640         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3641             # Prefer native x64 compiler to cross-compiler, in case we are running
3642             # the build on a 64-bit OS.
3643             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3644                 BUILD_X64=TRUE
3645                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3646                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3647             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3648                 BUILD_X64=TRUE
3649                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3650                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3651             fi
3652         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3653             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3654             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3655                 BUILD_X64=TRUE
3656                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3657                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3658             fi
3659         fi
3660         if test "$BUILD_X64" = TRUE; then
3661             AC_MSG_RESULT([found])
3662         else
3663             AC_MSG_RESULT([not found])
3664             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3665         fi
3666     fi
3667     AC_SUBST(BUILD_X64)
3669     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3670     AC_SUBST(CXX_X64_BINARY)
3671     AC_SUBST(LINK_X64_BINARY)
3673 AC_SUBST(VCVER)
3674 AC_SUBST(DEVENV)
3675 PathFormat "$MSPDB_PATH"
3676 MSPDB_PATH="$formatted_path"
3677 AC_SUBST(MSVC_CXX)
3678 AC_SUBST(SHOWINCLUDES_PREFIX)
3680 if test "$_os" = "WINNT"; then
3681     AC_MSG_CHECKING([whether to use DirectX])
3682     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3683         ENABLE_DIRECTX="TRUE"
3684         AC_MSG_RESULT([yes])
3685     else
3686         ENABLE_DIRECTX=""
3687         AC_MSG_RESULT([no])
3688     fi
3689 else
3690     ENABLE_DIRECTX=""
3693 AC_SUBST(ENABLE_DIRECTX)
3696 # unowinreg.dll
3698 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3699 AC_SUBST(UNOWINREG_DLL)
3701 COM_IS_CLANG=
3702 AC_MSG_CHECKING([whether the compiler is actually Clang])
3703 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3704     #ifndef __clang__
3705     you lose
3706     #endif
3707     int foo=42;
3708     ]])],
3709     [AC_MSG_RESULT([yes])
3710      COM_IS_CLANG=TRUE],
3711     [AC_MSG_RESULT([no])])
3713 if test "$COM_IS_CLANG" = TRUE; then
3714     AC_MSG_CHECKING([the Clang version])
3715     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | ${CC%-cl.exe*} -E -P -`
3716     CLANG_FULL_VERSION=`echo __clang_version__ | ${CC%-cl.exe*} -E -P -`
3717     CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3718     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3719     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3720     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3722 AC_SUBST(COM_IS_CLANG)
3725 # prefix C with ccache if needed
3727 if test "$CCACHE" != ""; then
3728     AC_MSG_CHECKING([whether $CC is already ccached])
3730     AC_LANG_PUSH([C])
3731     save_CFLAGS=$CFLAGS
3732     CFLAGS="$CFLAGS --ccache-skip -O2"
3733     dnl an empty program will do, we're checking the compiler flags
3734     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3735                       [use_ccache=yes], [use_ccache=no])
3736     if test $use_ccache = yes; then
3737         AC_MSG_RESULT([yes])
3738     else
3739         CC="$CCACHE $CC"
3740         AC_MSG_RESULT([no])
3741     fi
3742     CFLAGS=$save_CFLAGS
3743     AC_LANG_POP([C])
3746 # ===================================================================
3747 # check various GCC options that Clang does not support now but maybe
3748 # will somewhen in the future, check them even for GCC, so that the
3749 # flags are set
3750 # ===================================================================
3752 HAVE_GCC_GGDB2=
3753 HAVE_GCC_FINLINE_LIMIT=
3754 HAVE_GCC_FNO_INLINE=
3755 if test "$GCC" = "yes"; then
3756     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3757     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3758         # Option just ignored and silly warning that isn't a real
3759         # warning printed
3760         :
3761     else
3762         save_CFLAGS=$CFLAGS
3763         CFLAGS="$CFLAGS -Werror -ggdb2"
3764         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3765         CFLAGS=$save_CFLAGS
3766     fi
3767     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3768         AC_MSG_RESULT([yes])
3769     else
3770         AC_MSG_RESULT([no])
3771     fi
3773     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3774     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3775         # As above
3776         :
3777     else
3778         save_CFLAGS=$CFLAGS
3779         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3780         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3781         CFLAGS=$save_CFLAGS
3782     fi
3783     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3784         AC_MSG_RESULT([yes])
3785     else
3786         AC_MSG_RESULT([no])
3787     fi
3789     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3790     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3791         # Ditto
3792         :
3793     else
3794         save_CFLAGS=$CFLAGS
3795         CFLAGS="$CFLAGS -Werror -fno-inline"
3796         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3797         CFLAGS=$save_CFLAGS
3798     fi
3799     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3800         AC_MSG_RESULT([yes])
3801     else
3802         AC_MSG_RESULT([no])
3803     fi
3805     if test "$host_cpu" = "m68k"; then
3806         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3807         save_CFLAGS=$CFLAGS
3808         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3809         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3810         CFLAGS=$save_CFLAGS
3811         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3812             AC_MSG_RESULT([yes])
3813         else
3814             AC_MSG_ERROR([no])
3815         fi
3816     fi
3818 AC_SUBST(HAVE_GCC_GGDB2)
3819 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3820 AC_SUBST(HAVE_GCC_FNO_INLINE)
3822 dnl ===================================================================
3823 dnl  Test the gcc version
3824 dnl ===================================================================
3825 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3826     AC_MSG_CHECKING([the GCC version])
3827     _gcc_version=`$CC -dumpversion`
3828     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3830     AC_MSG_RESULT([gcc $_gcc_version])
3832     if test "$GCC_VERSION" -lt 0407; then
3833         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.7.0])
3834     fi
3835 else
3836     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3837     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3838     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3839     # (which reports itself as GCC 4.2.1).
3840     GCC_VERSION=
3842 AC_SUBST(GCC_VERSION)
3844 dnl Set the ENABLE_DBGUTIL variable
3845 dnl ===================================================================
3846 AC_MSG_CHECKING([whether to build with additional debug utilities])
3847 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3848     ENABLE_DBGUTIL="TRUE"
3849     # this is an extra var so it can have different default on different MSVC
3850     # versions (in case there are version specific problems with it)
3851     MSVC_USE_DEBUG_RUNTIME="TRUE"
3853     AC_MSG_RESULT([yes])
3854     # cppunit and graphite expose STL in public headers
3855     if test "$with_system_cppunit" = "yes"; then
3856         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3857     else
3858         with_system_cppunit=no
3859     fi
3860     if test "$with_system_graphite" = "yes"; then
3861         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3862     else
3863         with_system_graphite=no
3864     fi
3865     if test "$with_system_mysql_cppconn" = "yes"; then
3866         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3867     else
3868         with_system_mysql_cppconn=no
3869     fi
3870     if test "$with_system_orcus" = "yes"; then
3871         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3872     else
3873         with_system_orcus=no
3874     fi
3875     if test "$with_system_libcmis" = "yes"; then
3876         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3877     else
3878         with_system_libcmis=no
3879     fi
3880     if test "$with_system_libgltf" = "yes"; then
3881         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3882     else
3883         with_system_libgltf=no
3884     fi
3885     if test "$with_system_hunspell" = "yes"; then
3886         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3887     else
3888         with_system_hunspell=no
3889     fi
3890 else
3891     ENABLE_DBGUTIL=""
3892     MSVC_USE_DEBUG_RUNTIME=""
3893     AC_MSG_RESULT([no])
3895 AC_SUBST(ENABLE_DBGUTIL)
3896 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3898 dnl Set the ENABLE_DEBUG variable.
3899 dnl ===================================================================
3900 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3901     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3903 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3904     if test -z "$libo_fuzzed_enable_debug"; then
3905         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3906     else
3907         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3908         enable_debug=yes
3909     fi
3912 AC_MSG_CHECKING([whether to do a debug build])
3913 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3914     ENABLE_DEBUG="TRUE"
3915     if test -n "$ENABLE_DBGUTIL" ; then
3916         AC_MSG_RESULT([yes (dbgutil)])
3917     else
3918         AC_MSG_RESULT([yes])
3919     fi
3920 else
3921     ENABLE_DEBUG=""
3922     AC_MSG_RESULT([no])
3924 AC_SUBST(ENABLE_DEBUG)
3926 if test "$enable_sal_log" = yes; then
3927     ENABLE_SAL_LOG=TRUE
3929 AC_SUBST(ENABLE_SAL_LOG)
3931 dnl Selective debuginfo
3932 ENABLE_DEBUGINFO_FOR=
3933 if test -n "$ENABLE_DEBUG"; then
3934     AC_MSG_CHECKING([whether to use selective debuginfo])
3935     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3936         if test "$enable_selective_debuginfo" = "yes"; then
3937             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3938         fi
3939         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3940         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3941     else
3942         ENABLE_DEBUGINFO_FOR=all
3943         AC_MSG_RESULT([no, for all])
3944     fi
3945 else
3946     if test -n "$enable_selective_debuginfo"; then
3947         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3948     fi
3950 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3952 dnl Check for enable symbols option
3953 dnl ===================================================================
3954 AC_MSG_CHECKING([whether to generate debug information])
3955 if test -z "$enable_symbols"; then
3956     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3957         enable_symbols=yes
3958     else
3959         enable_symbols=no
3960     fi
3962 if test "$enable_symbols" != no; then
3963     ENABLE_SYMBOLS=TRUE
3964     AC_MSG_RESULT([yes])
3965 else
3966     ENABLE_SYMBOLS=
3967     AC_MSG_RESULT([no])
3969 AC_SUBST(ENABLE_SYMBOLS)
3971 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3972     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3973     AC_MSG_CHECKING([whether enough memory is available for linking])
3974     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3975     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3976     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3977         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3978     else
3979         AC_MSG_RESULT([yes])
3980     fi
3983 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3984 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3985 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3986 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3987 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3988     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
3990 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
3993 # determine CPUNAME, OS, ...
3994 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3996 case "$host_os" in
3998 aix*)
3999     COM=GCC
4000     CPUNAME=POWERPC
4001     USING_X11=TRUE
4002     OS=AIX
4003     RTL_OS=AIX
4004     RTL_ARCH=PowerPC
4005     PLATFORMID=aix_powerpc
4006     P_SEP=:
4007     ;;
4009 cygwin*)
4010     COM=MSC
4011     USING_X11=
4012     OS=WNT
4013     RTL_OS=Windows
4014     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4015         P_SEP=";"
4016     else
4017         P_SEP=:
4018     fi
4019     case "$host_cpu" in
4020     i*86|x86_64)
4021         if test "$BITNESS_OVERRIDE" = 64; then
4022             CPUNAME=X86_64
4023             RTL_ARCH=X86_64
4024             PLATFORMID=windows_x86_64
4025             WINDOWS_X64=1
4026             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4027         else
4028             CPUNAME=INTEL
4029             RTL_ARCH=x86
4030             PLATFORMID=windows_x86
4031         fi
4032         ;;
4033     *)
4034         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4035         ;;
4036     esac
4037     SCPDEFS="$SCPDEFS -D_MSC_VER"
4038     ;;
4040 darwin*)
4041     COM=GCC
4042     USING_X11=
4043     OS=MACOSX
4044     RTL_OS=MacOSX
4045     P_SEP=:
4047     case "$host_cpu" in
4048     arm*)
4049         CPUNAME=ARM
4050         RTL_ARCH=ARM_EABI
4051         PLATFORMID=ios_arm
4052         OS=IOS
4053         ;;
4054     i*86)
4055         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4056         ;;
4057     x86_64)
4058         CPUNAME=X86_64
4059         RTL_ARCH=X86_64
4060         PLATFORMID=macosx_x86_64
4061         ;;
4062     *)
4063         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4064         ;;
4065     esac
4066     ;;
4068 dragonfly*)
4069     COM=GCC
4070     USING_X11=TRUE
4071     OS=DRAGONFLY
4072     RTL_OS=DragonFly
4073     P_SEP=:
4075     case "$host_cpu" in
4076     i*86)
4077         CPUNAME=INTEL
4078         RTL_ARCH=x86
4079         PLATFORMID=dragonfly_x86
4080         ;;
4081     x86_64)
4082         CPUNAME=X86_64
4083         RTL_ARCH=X86_64
4084         PLATFORMID=dragonfly_x86_64
4085         ;;
4086     *)
4087         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4088         ;;
4089     esac
4090     ;;
4092 freebsd*)
4093     COM=GCC
4094     USING_X11=TRUE
4095     RTL_OS=FreeBSD
4096     OS=FREEBSD
4097     P_SEP=:
4099     case "$host_cpu" in
4100     i*86)
4101         CPUNAME=INTEL
4102         RTL_ARCH=x86
4103         PLATFORMID=freebsd_x86
4104         ;;
4105     x86_64|amd64)
4106         CPUNAME=X86_64
4107         RTL_ARCH=X86_64
4108         PLATFORMID=freebsd_x86_64
4109         ;;
4110     *)
4111         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4112         ;;
4113     esac
4114     ;;
4116 kfreebsd*)
4117     COM=GCC
4118     USING_X11=TRUE
4119     OS=LINUX
4120     RTL_OS=kFreeBSD
4121     P_SEP=:
4123     case "$host_cpu" in
4125     i*86)
4126         CPUNAME=INTEL
4127         RTL_ARCH=x86
4128         PLATFORMID=kfreebsd_x86
4129         ;;
4130     x86_64)
4131         CPUNAME=X86_64
4132         RTL_ARCH=X86_64
4133         PLATFORMID=kfreebsd_x86_64
4134         ;;
4135     *)
4136         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4137         ;;
4138     esac
4139     ;;
4141 linux-gnu*)
4142     COM=GCC
4143     USING_X11=TRUE
4144     OS=LINUX
4145     RTL_OS=Linux
4146     P_SEP=:
4148     case "$host_cpu" in
4150     aarch64)
4151         CPUNAME=AARCH64
4152         PLATFORMID=linux_aarch64
4153         RTL_ARCH=AARCH64
4154         ;;
4155     alpha)
4156         CPUNAME=AXP
4157         RTL_ARCH=ALPHA
4158         PLATFORMID=linux_alpha
4159         ;;
4160     arm*)
4161         CPUNAME=ARM
4162         EPM_FLAGS="-a arm"
4163         RTL_ARCH=ARM_EABI
4164         PLATFORMID=linux_arm_eabi
4165         case "$host_cpu" in
4166         arm*-linux)
4167             RTL_ARCH=ARM_OABI
4168             PLATFORMID=linux_arm_oabi
4169             ;;
4170         esac
4171         ;;
4172     hppa)
4173         CPUNAME=HPPA
4174         RTL_ARCH=HPPA
4175         EPM_FLAGS="-a hppa"
4176         PLATFORMID=linux_hppa
4177         ;;
4178     i*86)
4179         CPUNAME=INTEL
4180         RTL_ARCH=x86
4181         PLATFORMID=linux_x86
4182         ;;
4183     ia64)
4184         CPUNAME=IA64
4185         RTL_ARCH=IA64
4186         PLATFORMID=linux_ia64
4187         ;;
4188     mips)
4189         CPUNAME=GODSON
4190         RTL_ARCH=MIPS_EB
4191         EPM_FLAGS="-a mips"
4192         PLATFORMID=linux_mips_eb
4193         ;;
4194     mips64)
4195         CPUNAME=GODSON64
4196         RTL_ARCH=MIPS64_EB
4197         EPM_FLAGS="-a mips64"
4198         PLATFORMID=linux_mips64_eb
4199         ;;
4200     mips64el)
4201         CPUNAME=GODSON64
4202         RTL_ARCH=MIPS64_EL
4203         EPM_FLAGS="-a mips64el"
4204         PLATFORMID=linux_mips64_el
4205         ;;
4206     mipsel)
4207         CPUNAME=GODSON
4208         RTL_ARCH=MIPS_EL
4209         EPM_FLAGS="-a mipsel"
4210         PLATFORMID=linux_mips_el
4211         ;;
4212     m68k)
4213         CPUNAME=M68K
4214         RTL_ARCH=M68K
4215         PLATFORMID=linux_m68k
4216         ;;
4217     powerpc)
4218         CPUNAME=POWERPC
4219         RTL_ARCH=PowerPC
4220         PLATFORMID=linux_powerpc
4221         ;;
4222     powerpc64)
4223         CPUNAME=POWERPC64
4224         RTL_ARCH=PowerPC_64
4225         PLATFORMID=linux_powerpc64
4226         ;;
4227     powerpc64le)
4228         CPUNAME=POWERPC64
4229         RTL_ARCH=PowerPC_64_LE
4230         PLATFORMID=linux_powerpc64_le
4231         ;;
4232     sparc)
4233         CPUNAME=SPARC
4234         RTL_ARCH=SPARC
4235         PLATFORMID=linux_sparc
4236         ;;
4237     sparc64)
4238         CPUNAME=SPARC64
4239         RTL_ARCH=SPARC64
4240         PLATFORMID=linux_sparc64
4241         ;;
4242     s390)
4243         CPUNAME=S390
4244         RTL_ARCH=S390
4245         PLATFORMID=linux_s390
4246         ;;
4247     s390x)
4248         CPUNAME=S390X
4249         RTL_ARCH=S390x
4250         PLATFORMID=linux_s390x
4251         ;;
4252     x86_64)
4253         CPUNAME=X86_64
4254         RTL_ARCH=X86_64
4255         PLATFORMID=linux_x86_64
4256         ;;
4257     *)
4258         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4259         ;;
4260     esac
4261     ;;
4263 linux-android*)
4264     COM=GCC
4265     USING_X11=
4266     OS=ANDROID
4267     RTL_OS=Android
4268     P_SEP=:
4270     case "$host_cpu" in
4272     arm|armel)
4273         CPUNAME=ARM
4274         RTL_ARCH=ARM_EABI
4275         PLATFORMID=android_arm_eabi
4276         ;;
4277     aarch64)
4278         CPUNAME=AARCH64
4279         RTL_ARCH=AARCH64
4280         PLATFORMID=android_aarch64
4281         ;;
4282     mips|mipsel)
4283         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4284         RTL_ARCH=MIPS_EL
4285         PLATFORMID=android_mips_el
4286         ;;
4287     i*86)
4288         CPUNAME=INTEL
4289         RTL_ARCH=x86
4290         PLATFORMID=android_x86
4291         ;;
4292     *)
4293         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4294         ;;
4295     esac
4296     ;;
4298 *netbsd*)
4299     COM=GCC
4300     USING_X11=TRUE
4301     OS=NETBSD
4302     RTL_OS=NetBSD
4303     P_SEP=:
4305     case "$host_cpu" in
4306     i*86)
4307         CPUNAME=INTEL
4308         RTL_ARCH=x86
4309         PLATFORMID=netbsd_x86
4310         ;;
4311     powerpc)
4312         CPUNAME=POWERPC
4313         RTL_ARCH=PowerPC
4314         PLATFORMID=netbsd_powerpc
4315         ;;
4316     sparc)
4317         CPUNAME=SPARC
4318         RTL_ARCH=SPARC
4319         PLATFORMID=netbsd_sparc
4320         ;;
4321     x86_64)
4322         CPUNAME=X86_64
4323         RTL_ARCH=X86_64
4324         PLATFORMID=netbsd_x86_64
4325         ;;
4326     *)
4327         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4328         ;;
4329     esac
4330     ;;
4332 openbsd*)
4333     COM=GCC
4334     USING_X11=TRUE
4335     OS=OPENBSD
4336     RTL_OS=OpenBSD
4337     P_SEP=:
4339     case "$host_cpu" in
4340     i*86)
4341         CPUNAME=INTEL
4342         RTL_ARCH=x86
4343         PLATFORMID=openbsd_x86
4344         ;;
4345     x86_64)
4346         CPUNAME=X86_64
4347         RTL_ARCH=X86_64
4348         PLATFORMID=openbsd_x86_64
4349         ;;
4350     *)
4351         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4352         ;;
4353     esac
4354     SOLARINC="$SOLARINC -I/usr/local/include"
4355     ;;
4357 solaris*)
4358     COM=GCC
4359     USING_X11=TRUE
4360     OS=SOLARIS
4361     RTL_OS=Solaris
4362     P_SEP=:
4364     case "$host_cpu" in
4365     i*86)
4366         CPUNAME=INTEL
4367         RTL_ARCH=x86
4368         PLATFORMID=solaris_x86
4369         ;;
4370     sparc)
4371         CPUNAME=SPARC
4372         RTL_ARCH=SPARC
4373         PLATFORMID=solaris_sparc
4374         ;;
4375     sparc64)
4376         CPUNAME=SPARC64
4377         RTL_ARCH=SPARC64
4378         PLATFORMID=solaris_sparc64
4379         ;;
4380     *)
4381         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4382         ;;
4383     esac
4384     SOLARINC="$SOLARINC -I/usr/local/include"
4385     ;;
4388     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4389     ;;
4390 esac
4392 if test "$with_x" = "no"; then
4393     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4396 ENABLE_HEADLESS=""
4397 if test "$enable_gui" = "no"; then
4398     if test "$USING_X11" != TRUE; then
4399         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4400     fi
4401     USING_X11=
4402     ENABLE_HEADLESS=TRUE
4403     AC_DEFINE(HAVE_FEATURE_UI,0)
4404     test_cairo=yes
4406 AC_SUBST(ENABLE_HEADLESS)
4408 WORKDIR="${BUILDDIR}/workdir"
4409 INSTDIR="${BUILDDIR}/instdir"
4410 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4411 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4412 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4413 AC_SUBST(COM)
4414 AC_SUBST(CPUNAME)
4415 AC_SUBST(RTL_OS)
4416 AC_SUBST(RTL_ARCH)
4417 AC_SUBST(EPM_FLAGS)
4418 AC_SUBST(USING_X11)
4419 AC_SUBST([INSTDIR])
4420 AC_SUBST([INSTROOT])
4421 AC_SUBST([INSTROOTBASE])
4422 AC_SUBST(OS)
4423 AC_SUBST(P_SEP)
4424 AC_SUBST(WORKDIR)
4425 AC_SUBST(PLATFORMID)
4426 AC_SUBST(WINDOWS_X64)
4427 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4429 dnl ===================================================================
4430 dnl Test which package format to use
4431 dnl ===================================================================
4432 AC_MSG_CHECKING([which package format to use])
4433 if test -n "$with_package_format" -a "$with_package_format" != no; then
4434     for i in $with_package_format; do
4435         case "$i" in
4436         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4437             ;;
4438         *)
4439             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4440 aix - AIX software distribution
4441 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4442 deb - Debian software distribution
4443 pkg - Solaris software distribution
4444 rpm - RedHat software distribution
4446 LibreOffice additionally supports:
4447 archive - .tar.gz or .zip
4448 dmg - Mac OS X .dmg
4449 installed - installation tree
4450 msi - Windows .msi
4451         ])
4452             ;;
4453         esac
4454     done
4455     PKGFORMAT="$with_package_format"
4456     AC_MSG_RESULT([$PKGFORMAT])
4457 else
4458     PKGFORMAT=
4459     AC_MSG_RESULT([none])
4461 AC_SUBST(PKGFORMAT)
4463 dnl ===================================================================
4464 dnl Set up a different compiler to produce tools to run on the build
4465 dnl machine when doing cross-compilation
4466 dnl ===================================================================
4468 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4469 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4470 if test "$cross_compiling" = "yes"; then
4471     AC_MSG_CHECKING([for BUILD platform configuration])
4472     echo
4473     rm -rf CONF-FOR-BUILD config_build.mk
4474     mkdir CONF-FOR-BUILD
4475     # Here must be listed all files needed when running the configure script. In particular, also
4476     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4477     # keep them in the same order as there.
4478     (cd $SRC_ROOT && tar cf - \
4479         config.guess \
4480         bin/get_config_variables \
4481         solenv/bin/getcompver.awk \
4482         solenv/inc/langlist.mk \
4483         config_host.mk.in \
4484         config_host_lang.mk.in \
4485         Makefile.in \
4486         lo.xcent.in \
4487         bin/bffvalidator.sh.in \
4488         bin/odfvalidator.sh.in \
4489         bin/officeotron.sh.in \
4490         instsetoo_native/util/openoffice.lst.in \
4491         config_host/*.in \
4492         sysui/desktop/macosx/Info.plist.in \
4493         ios/lo.xcconfig.in) \
4494     | (cd CONF-FOR-BUILD && tar xf -)
4495     cp configure CONF-FOR-BUILD
4496     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4497     (
4498     unset COM USING_X11 OS CPUNAME
4499     unset CC CXX SYSBASE CFLAGS
4500     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4501     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4502     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4503     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4504     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4505     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4506     cd CONF-FOR-BUILD
4507     sub_conf_opts=""
4508     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4509     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4510     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4511     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4512     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4513     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4514     # Don't bother having configure look for stuff not needed for the build platform anyway
4515     ./configure \
4516         --disable-cups \
4517         --disable-gtk3 \
4518         --disable-pdfimport \
4519         --disable-postgresql-sdbc \
4520         --with-parallelism="$with_parallelism" \
4521         --without-doxygen \
4522         --without-java \
4523         $sub_conf_opts \
4524         --srcdir=$srcdir \
4525         2>&1 | sed -e 's/^/    /'
4526     test -f ./config_host.mk 2>/dev/null || exit
4527     cp config_host.mk ../config_build.mk
4528     cp config_host_lang.mk ../config_build_lang.mk
4529     mv config.log ../config.Build.log
4530     mkdir -p ../config_build
4531     mv config_host/*.h ../config_build
4532     . ./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
4534     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
4535         VV='$'$V
4536         VV=`eval "echo $VV"`
4537         if test -n "$VV"; then
4538             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4539             echo "$line" >>build-config
4540         fi
4541     done
4543     for V in INSTDIR INSTROOT WORKDIR; do
4544         VV='$'$V
4545         VV=`eval "echo $VV"`
4546         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4547         if test -n "$VV"; then
4548             line="${V}_FOR_BUILD='$VV'"
4549             echo "$line" >>build-config
4550         fi
4551     done
4553     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4554     echo "$line" >>build-config
4556     )
4557     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4558     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])
4559     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4560              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4562     eval `cat CONF-FOR-BUILD/build-config`
4564     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4566     rm -rf CONF-FOR-BUILD
4567 else
4568     OS_FOR_BUILD="$OS"
4569     CC_FOR_BUILD="$CC"
4570     CXX_FOR_BUILD="$CXX"
4571     INSTDIR_FOR_BUILD="$INSTDIR"
4572     INSTROOT_FOR_BUILD="$INSTROOT"
4573     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4574     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4575     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4576     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4577     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4578     WORKDIR_FOR_BUILD="$WORKDIR"
4580 AC_SUBST(OS_FOR_BUILD)
4581 AC_SUBST(INSTDIR_FOR_BUILD)
4582 AC_SUBST(INSTROOT_FOR_BUILD)
4583 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4584 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4585 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4586 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4587 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4588 AC_SUBST(WORKDIR_FOR_BUILD)
4590 dnl ===================================================================
4591 dnl Check for syslog header
4592 dnl ===================================================================
4593 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4595 # placeholder for future crash reporter feature
4596 ENABLE_CRASHDUMP=""
4597 AC_SUBST(ENABLE_CRASHDUMP)
4599 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4600 dnl ===================================================================
4601 AC_MSG_CHECKING([whether to turn warnings to errors])
4602 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4603     ENABLE_WERROR="TRUE"
4604     AC_MSG_RESULT([yes])
4605 else
4606     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4607         ENABLE_WERROR="TRUE"
4608         AC_MSG_RESULT([yes])
4609     else
4610         AC_MSG_RESULT([no])
4611     fi
4613 AC_SUBST(ENABLE_WERROR)
4615 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4616 dnl ===================================================================
4617 AC_MSG_CHECKING([whether to have assert to abort in release code])
4618 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4619     ASSERT_ALWAYS_ABORT="TRUE"
4620     AC_MSG_RESULT([yes])
4621 else
4622     ASSERT_ALWAYS_ABORT="FALSE"
4623     AC_MSG_RESULT([no])
4625 AC_SUBST(ASSERT_ALWAYS_ABORT)
4627 # Determine whether to use ooenv for the instdir installation
4628 # ===================================================================
4629 if test $_os != "WINNT" -a $_os != "Darwin"; then
4630     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4631     if test "$enable_ooenv" = "no"; then
4632         AC_MSG_RESULT([no])
4633     else
4634         ENABLE_OOENV="TRUE"
4635         AC_MSG_RESULT([yes])
4636     fi
4638 AC_SUBST(ENABLE_OOENV)
4640 if test "$USING_X11" != TRUE; then
4641     # be sure to do not mess with unneeded stuff
4642     test_randr=no
4643     test_xrender=no
4644     test_cups=no
4645     test_dbus=no
4646     test_gtk=no
4647     build_gstreamer_1_0=no
4648     build_gstreamer_0_10=no
4649     test_tde=no
4650     test_kde4=no
4651     enable_cairo_canvas=no
4654 dnl ===================================================================
4655 dnl check for cups support
4656 dnl ===================================================================
4657 ENABLE_CUPS=""
4659 if test "$enable_cups" = "no"; then
4660     test_cups=no
4663 AC_MSG_CHECKING([whether to enable CUPS support])
4664 if test "$test_cups" = "yes"; then
4665     ENABLE_CUPS="TRUE"
4666     AC_MSG_RESULT([yes])
4668     AC_MSG_CHECKING([whether cups support is present])
4669     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4670     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4671     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4672         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4673     fi
4675 else
4676     AC_MSG_RESULT([no])
4679 AC_SUBST(ENABLE_CUPS)
4681 # fontconfig checks
4682 if test "$test_fontconfig" = "yes"; then
4683     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4684     SYSTEM_FONTCONFIG=TRUE
4685     FilterLibs "${FONTCONFIG_LIBS}"
4686     FONTCONFIG_LIBS="${filteredlibs}"
4688 AC_SUBST(FONTCONFIG_CFLAGS)
4689 AC_SUBST(FONTCONFIG_LIBS)
4690 AC_SUBST([SYSTEM_FONTCONFIG])
4692 dnl whether to find & fetch external tarballs?
4693 dnl ===================================================================
4694 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4695    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4696        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4697    else
4698        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4699    fi
4701 if test -z "$TARFILE_LOCATION"; then
4702     if test -d "$SRC_ROOT/src" ; then
4703         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4704         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4705     fi
4706     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4707 else
4708     AbsolutePath "$TARFILE_LOCATION"
4709     PathFormat "${absolute_path}"
4710     TARFILE_LOCATION="${formatted_path}"
4712 AC_SUBST(TARFILE_LOCATION)
4714 AC_MSG_CHECKING([whether we want to fetch tarballs])
4715 if test "$enable_fetch_external" != "no"; then
4716     if test "$with_all_tarballs" = "yes"; then
4717         AC_MSG_RESULT([yes, all of them])
4718         DO_FETCH_TARBALLS="ALL"
4719     else
4720         AC_MSG_RESULT([yes, if we use them])
4721         DO_FETCH_TARBALLS="TRUE"
4722     fi
4723 else
4724     AC_MSG_RESULT([no])
4725     DO_FETCH_TARBALLS=
4727 AC_SUBST(DO_FETCH_TARBALLS)
4729 AC_MSG_CHECKING([whether to build help])
4730 HELP_COMMON_ONLY=FALSE
4731 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4732     BUILD_TYPE="$BUILD_TYPE HELP"
4733     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4734     if test "$with_help" = "common" ; then
4735         HELP_COMMON_ONLY=TRUE
4736         AC_MSG_RESULT([common only])
4737     else
4738         SCPDEFS="$SCPDEFS -DWITH_HELP"
4739         AC_MSG_RESULT([yes])
4740     fi
4741 else
4742     AC_MSG_RESULT([no])
4744 AC_SUBST(HELP_COMMON_ONLY)
4746 dnl Test whether to include MySpell dictionaries
4747 dnl ===================================================================
4748 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4749 if test "$with_myspell_dicts" = "yes"; then
4750     AC_MSG_RESULT([yes])
4751     WITH_MYSPELL_DICTS=TRUE
4752     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4753     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4754 else
4755     AC_MSG_RESULT([no])
4756     WITH_MYSPELL_DICTS=
4758 AC_SUBST(WITH_MYSPELL_DICTS)
4760 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4761 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4762     if test "$with_system_dicts" = yes; then
4763         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4764     fi
4765     with_system_dicts=no
4768 AC_MSG_CHECKING([whether to use dicts from external paths])
4769 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4770     AC_MSG_RESULT([yes])
4771     SYSTEM_DICTS=TRUE
4772     AC_MSG_CHECKING([for spelling dictionary directory])
4773     if test -n "$with_external_dict_dir"; then
4774         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4775     else
4776         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4777         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4778             DICT_SYSTEM_DIR=file:///usr/share/myspell
4779         fi
4780     fi
4781     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4782     AC_MSG_CHECKING([for hyphenation patterns directory])
4783     if test -n "$with_external_hyph_dir"; then
4784         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4785     else
4786         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4787     fi
4788     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4789     AC_MSG_CHECKING([for thesaurus directory])
4790     if test -n "$with_external_thes_dir"; then
4791         THES_SYSTEM_DIR=file://$with_external_thes_dir
4792     else
4793         THES_SYSTEM_DIR=file:///usr/share/mythes
4794     fi
4795     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4796 else
4797     AC_MSG_RESULT([no])
4798     SYSTEM_DICTS=
4800 AC_SUBST(SYSTEM_DICTS)
4801 AC_SUBST(DICT_SYSTEM_DIR)
4802 AC_SUBST(HYPH_SYSTEM_DIR)
4803 AC_SUBST(THES_SYSTEM_DIR)
4805 dnl ===================================================================
4806 dnl enable pch by default on windows
4807 dnl enable it explicitly otherwise
4808 ENABLE_PCH=""
4809 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4810     if test -z "$libo_fuzzed_enable_pch"; then
4811         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4812     else
4813         AC_MSG_NOTICE([Resetting --enable-pch=no])
4814         enable_pch=no
4815     fi
4818 AC_MSG_CHECKING([whether to enable pch feature])
4819 if test "$enable_pch" != "no"; then
4820     if test "$_os" = "WINNT"; then
4821         ENABLE_PCH="TRUE"
4822         AC_MSG_RESULT([yes])
4823     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4824         ENABLE_PCH="TRUE"
4825         AC_MSG_RESULT([yes])
4826     elif test -n "$enable_pch"; then
4827         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4828     else
4829         AC_MSG_RESULT([no])
4830     fi
4831 else
4832     AC_MSG_RESULT([no])
4834 AC_SUBST(ENABLE_PCH)
4836 TAB=`printf '\t'`
4838 AC_MSG_CHECKING([the GNU Make version])
4839 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4840 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4841 if test "$_make_longver" -ge "038200"; then
4842     AC_MSG_RESULT([$GNUMAKE $_make_version])
4844 elif test "$_make_longver" -ge "038100"; then
4845     if test "$build_os" = "cygwin"; then
4846         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4847     fi
4848     AC_MSG_RESULT([$GNUMAKE $_make_version])
4850     dnl ===================================================================
4851     dnl Search all the common names for sha1sum
4852     dnl ===================================================================
4853     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4854     if test -z "$SHA1SUM"; then
4855         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4856     elif test "$SHA1SUM" = "openssl"; then
4857         SHA1SUM="openssl sha1"
4858     fi
4859     AC_MSG_CHECKING([for GNU Make bug 20033])
4860     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4861     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4862 A := \$(wildcard *.a)
4864 .PHONY: all
4865 all: \$(A:.a=.b)
4866 <TAB>@echo survived bug20033.
4868 .PHONY: setup
4869 setup:
4870 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4872 define d1
4873 @echo lala \$(1)
4874 @sleep 1
4875 endef
4877 define d2
4878 @echo tyty \$(1)
4879 @sleep 1
4880 endef
4882 %.b : %.a
4883 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4884 <TAB>\$(call d1,\$(CHECKSUM)),\
4885 <TAB>\$(call d2,\$(CHECKSUM)))
4887     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4888         no_parallelism_make="YES"
4889         AC_MSG_RESULT([yes, disable parallelism])
4890     else
4891         AC_MSG_RESULT([no, keep parallelism enabled])
4892     fi
4893     rm -rf $TESTGMAKEBUG20033
4894 else
4895     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4898 # find if gnumake support file function
4899 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4900 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4901 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4902     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4904 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4905 \$(file >test.txt,Success )
4907 .PHONY: all
4908 all:
4909 <TAB>@cat test.txt
4912 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4913 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4914     HAVE_GNUMAKE_FILE_FUNC=TRUE
4915     AC_MSG_RESULT([yes])
4916 else
4917     AC_MSG_RESULT([no])
4919 rm -rf $TESTGMAKEFILEFUNC
4920 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4921 AC_SUBST(GNUMAKE_WIN_NATIVE)
4923 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4924 STALE_MAKE=
4925 if test "$_make_ver_check" = ""; then
4926    STALE_MAKE=TRUE
4929 HAVE_LD_HASH_STYLE=FALSE
4930 WITH_LINKER_HASH_STYLE=
4931 AC_MSG_CHECKING([for --hash-style gcc linker support])
4932 if test "$GCC" = "yes"; then
4933     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4934         hash_styles="gnu sysv"
4935     elif test "$with_linker_hash_style" = "no"; then
4936         hash_styles=
4937     else
4938         hash_styles="$with_linker_hash_style"
4939     fi
4941     for hash_style in $hash_styles; do
4942         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4943         hash_style_ldflags_save=$LDFLAGS
4944         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4946         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4947             [
4948 #include <stdio.h>
4949             ],[
4950 printf ("");
4951             ])],
4952             [
4953                   HAVE_LD_HASH_STYLE=TRUE
4954                   WITH_LINKER_HASH_STYLE=$hash_style
4955             ],
4956             [HAVE_LD_HASH_STYLE=FALSE],
4957             [HAVE_LD_HASH_STYLE=FALSE])
4958         LDFLAGS=$hash_style_ldflags_save
4959     done
4961     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4962         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4963     else
4964         AC_MSG_RESULT( no )
4965     fi
4966     LDFLAGS=$hash_style_ldflags_save
4967 else
4968     AC_MSG_RESULT( no )
4970 AC_SUBST(HAVE_LD_HASH_STYLE)
4971 AC_SUBST(WITH_LINKER_HASH_STYLE)
4973 dnl ===================================================================
4974 dnl Check whether there's a Perl version available.
4975 dnl ===================================================================
4976 if test -z "$with_perl_home"; then
4977     AC_PATH_PROG(PERL, perl)
4978 else
4979     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4980     _perl_path="$with_perl_home/bin/perl"
4981     if test -x "$_perl_path"; then
4982         PERL=$_perl_path
4983     else
4984         AC_MSG_ERROR([$_perl_path not found])
4985     fi
4988 dnl ===================================================================
4989 dnl Testing for Perl version 5 or greater.
4990 dnl $] is the Perl version variable, it is returned as an integer
4991 dnl ===================================================================
4992 if test "$PERL"; then
4993     AC_MSG_CHECKING([the Perl version])
4994     ${PERL} -e "exit($]);"
4995     _perl_version=$?
4996     if test "$_perl_version" -lt 5; then
4997         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
4998     fi
4999     AC_MSG_RESULT([Perl $_perl_version])
5000 else
5001     AC_MSG_ERROR([Perl not found, install Perl 5])
5004 dnl ===================================================================
5005 dnl Testing for required Perl modules
5006 dnl ===================================================================
5008 AC_MSG_CHECKING([for required Perl modules])
5009 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5010     AC_MSG_RESULT([all modules found])
5011 else
5012     AC_MSG_RESULT([failed to find some modules])
5013     # Find out which modules are missing.
5014     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5015         missing_perl_modules="$missing_perl_modules Cwd"
5016     fi
5017     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5018         missing_perl_modules="$missing_perl_modules Digest::MD5"
5019     fi
5020        AC_MSG_ERROR([
5021     The missing Perl modules are: $missing_perl_modules
5022     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5025 dnl ===================================================================
5026 dnl Check for pkg-config
5027 dnl ===================================================================
5028 if test "$_os" != "WINNT"; then
5029     PKG_PROG_PKG_CONFIG
5032 if test "$_os" != "WINNT"; then
5034     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5035     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5036     # explicitly. Or put /path/to/compiler in PATH yourself.
5038     # Use wrappers for LTO
5039     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5040         AC_CHECK_TOOL(AR,gcc-ar)
5041         AC_CHECK_TOOL(NM,gcc-nm)
5042         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5043     else
5044         AC_CHECK_TOOL(AR,ar)
5045         AC_CHECK_TOOL(NM,nm)
5046         AC_CHECK_TOOL(RANLIB,ranlib)
5047     fi
5048     AC_CHECK_TOOL(OBJDUMP,objdump)
5049     AC_CHECK_TOOL(READELF,readelf)
5050     AC_CHECK_TOOL(STRIP,strip)
5051     if test "$_os" = "WINNT"; then
5052         AC_CHECK_TOOL(DLLTOOL,dlltool)
5053         AC_CHECK_TOOL(WINDRES,windres)
5054     fi
5056 AC_SUBST(AR)
5057 AC_SUBST(DLLTOOL)
5058 AC_SUBST(NM)
5059 AC_SUBST(OBJDUMP)
5060 AC_SUBST(PKG_CONFIG)
5061 AC_SUBST(RANLIB)
5062 AC_SUBST(READELF)
5063 AC_SUBST(STRIP)
5064 AC_SUBST(WINDRES)
5066 dnl ===================================================================
5067 dnl pkg-config checks on Mac OS X
5068 dnl ===================================================================
5070 if test $_os = Darwin; then
5071     AC_MSG_CHECKING([for bogus pkg-config])
5072     if test -n "$PKG_CONFIG"; then
5073         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5074             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5075         else
5076             if test "$enable_bogus_pkg_config" = "yes"; then
5077                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5078             else
5079                 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.])
5080             fi
5081         fi
5082     else
5083         AC_MSG_RESULT([no, good])
5084     fi
5087 find_csc()
5089     # Return value: $csctest
5091     unset csctest
5093     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5094     if test -n "$regvalue"; then
5095         csctest=$regvalue
5096         return
5097     fi
5100 find_al()
5102     # Return value: $altest
5104     unset altest
5106     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5107         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5108         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5109             altest=$regvalue
5110             return
5111         fi
5112     done
5114     # We need this additional check to detect 4.6.2 or above.
5115     for ver in 4.7 4.6.2; do
5116         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5117         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5118             altest=$regvalue
5119             return
5120         fi
5121     done
5124 find_dotnetsdk()
5126     # Return value: $frametest (that's a silly name...)
5128     unset frametest
5130     for ver in 1.1 2.0; do
5131         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5132         if test -n "$regvalue"; then
5133             frametest=$regvalue
5134             return
5135         fi
5136     done
5139 find_dotnetsdk46()
5141     unset frametest
5143     for ver in 4.7 4.6.2 4.6.1 4.6; do
5144         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5145         if test -n "$regvalue"; then
5146             frametest=$regvalue
5147             return
5148         fi
5149         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5150         if test -n "$regvalue"; then
5151             frametest=$regvalue
5152             return
5153         fi
5154     done
5157 find_winsdk_version()
5159     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5160     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5162     unset winsdktest winsdkbinsubdir winsdklibsubdir
5164     case "$1" in
5165     7.*)
5166         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5167         if test -n "$regvalue"; then
5168             winsdktest=$regvalue
5169             winsdklibsubdir=.
5170             return
5171         fi
5172         ;;
5173     8.0|8.0A)
5174         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5175         if test -n "$regvalue"; then
5176             winsdktest=$regvalue
5177             winsdklibsubdir=win8
5178             return
5179         fi
5180         ;;
5181     8.1|8.1A)
5182         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5183         if test -n "$regvalue"; then
5184             winsdktest=$regvalue
5185             winsdklibsubdir=winv6.3
5186             return
5187         fi
5188         ;;
5189     10.0)
5190         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5191         if test -n "$regvalue"; then
5192             winsdktest=$regvalue
5193             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5194             if test -n "$regvalue"; then
5195                 winsdkbinsubdir="$regvalue".0
5196             fi
5197             winsdklibsubdir=$regvalue
5198             if test "$regvalue" = "10.0.14393"; then
5199                 winsdklibsubdir="10.0.14393.0"
5200             elif test "$regvalue" = "10.0.15063"; then
5201                 winsdklibsubdir="10.0.15063.0"
5202                 dnl Hack needed at least by tml:
5203                 if test ! -f "${winsdktest}/Include/10.0.15063.0/um/sqlext.h" \
5204                     -a -f "${winsdktest}/Include/10.0.14393.0/um/sqlext.h"
5205                 then
5206                     winsdklibsubdir="10.0.14393.0"
5207                 fi
5208             fi
5209             return
5210         fi
5211         ;;
5212     esac
5215 find_winsdk()
5217     # Return value: From find_winsdk_version
5219     unset winsdktest
5221     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5222         find_winsdk_version $ver
5223         if test -n "$winsdktest"; then
5224             return
5225         fi
5226     done
5229 find_msms()
5231     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5232     AC_MSG_CHECKING([for $my_msm_file])
5233     msmdir=
5234     for ver in 14.0 15.0; do
5235         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5236         if test -n "$regvalue"; then
5237             if test -e "$regvalue/$my_msm_file"; then
5238                 msmdir=$regvalue
5239                 break
5240             fi
5241         fi
5242     done
5243     dnl Is the following fallback really necessary, or was it added in response
5244     dnl to never having started Visual Studio on a given machine, so the
5245     dnl registry keys checked above had presumably not yet been created?
5246     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5247     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5248     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5249     dnl expanding to "C:\Program Files\Common Files"), which would need
5250     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5251     dnl obtain its value from cygwin:
5252     if test -z "$msmdir"; then
5253         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5254         if test -e "$my_msm_dir/$my_msm_file"; then
5255             msmdir=$my_msm_dir
5256         fi
5257     fi
5259     dnl Starting from MSVC 15.0, merge modules are located in different directory
5260     if test $VCVER = 150; then
5261         my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$vcbuildnumber/MergeModules/"
5262         if test -e "$my_msm_dir/$my_msm_file"; then
5263             msmdir=$my_msm_dir
5264         else
5265             # got everything in 14.10.15017 except the MSMS in 25008... huh?
5266             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/14.10.25008/MergeModules/"
5267             if test -e "$my_msm_dir/$my_msm_file"; then
5268                 msmdir=$my_msm_dir
5269             fi
5270         fi
5271     fi
5273     if test -n "$msmdir"; then
5274         msmdir=`cygpath -m "$msmdir"`
5275         AC_MSG_RESULT([$msmdir])
5276     else
5277         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5278             AC_MSG_ERROR([not found])
5279         else
5280             AC_MSG_WARN([not found])
5281             add_warning "MSM $my_msm_file not found"
5282         fi
5283     fi
5286 find_msvc_x64_dlls()
5288     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5289     if test "$VCVER" = 150; then
5290         if test $vcbuildnumber = 14.10.25017; then
5291             msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$vcbuildnumber/onecore/x64/Microsoft.VC${VCVER}.CRT"
5292         else
5293             msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$vcbuildnumber/x64/Microsoft.VC${VCVER}.CRT"
5294         fi
5295     fi
5296     # http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
5297     # Refactored C Runtime (CRT): This CTP contains the first preview of the substantially refactored CRT.
5298     # msvcr140.dll no longer exists. It is replaced by a trio of DLLs: vcruntime140.dll, appcrt140.dll,
5299     # and desktopcrt140.dll.
5301     if test "$VCVER" = 150; then
5302        msvcdlls="msvcp140.dll vcruntime140.dll"
5303     elif test "$VCVER" = 140; then
5304        msvcdlls="msvcp${VCVER}.dll vcruntime${VCVER}.dll"
5305     else
5306        msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5307     fi
5308     for dll in $msvcdlls; do
5309         if ! test -f "$msvcdllpath/$dll"; then
5310             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5311         fi
5312     done
5315 dnl =========================================
5316 dnl Check for the Windows  SDK.
5317 dnl =========================================
5318 if test "$_os" = "WINNT"; then
5319     AC_MSG_CHECKING([for Windows SDK])
5320     if test "$build_os" = "cygwin"; then
5321         find_winsdk
5322         WINDOWS_SDK_HOME=$winsdktest
5324         # normalize if found
5325         if test -n "$WINDOWS_SDK_HOME"; then
5326             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5327             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5328         fi
5330         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5331     fi
5333     if test -n "$WINDOWS_SDK_HOME"; then
5334         # Remove a possible trailing backslash
5335         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5337         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5338              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5339              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5340             have_windows_sdk_headers=yes
5341         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5342              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5343              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5344             have_windows_sdk_headers=yes
5345         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5346              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5347              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5348             have_windows_sdk_headers=yes
5349         else
5350             have_windows_sdk_headers=no
5351         fi
5353         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5354             have_windows_sdk_libs=yes
5355         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5356             have_windows_sdk_libs=yes
5357         else
5358             have_windows_sdk_libs=no
5359         fi
5361         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5362             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5363 the  Windows SDK are installed.])
5364         fi
5365     fi
5367     if test -z "$WINDOWS_SDK_HOME"; then
5368         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5369     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5370         WINDOWS_SDK_VERSION=70
5371         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5372     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5373         WINDOWS_SDK_VERSION=80
5374         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5375         dnl compatibility warning if not explicitly choosing the 80 SDK:
5376         if test -z "$with_windows_sdk"; then
5377             AC_MSG_WARN([If a build should run on Windows XP,])
5378             AC_MSG_WARN([use --with-windows-sdk=7.1A])
5379             add_warning "If a build should run on Windows XP,"
5380             add_warning "use --with-windows-sdk=7.1A"
5381         fi
5382     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5383         WINDOWS_SDK_VERSION=81
5384         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5385     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5386         WINDOWS_SDK_VERSION=10
5387         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5388     else
5389         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5390     fi
5391     PathFormat "$WINDOWS_SDK_HOME"
5392     WINDOWS_SDK_HOME="$formatted_path"
5393     if test "$build_os" = "cygwin"; then
5394         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5395         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5396             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5397         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5398             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5399         fi
5400     fi
5402     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5403     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5404     dnl but not in v8.0), so allow this to be overridden with a
5405     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5406     dnl and configuration error if no WiLangId.vbs is found would arguably be
5407     dnl better, but I do not know under which conditions exactly it is needed by
5408     dnl msiglobal.pm:
5409     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5410         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5411         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5412             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5413         fi
5414         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5415             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5416         fi
5417         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5418             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
5419             add_warning "WiLangId.vbs not found - building translated packages will fail"
5420         fi
5421     fi
5423 AC_SUBST(WINDOWS_SDK_HOME)
5424 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5425 AC_SUBST(WINDOWS_SDK_VERSION)
5426 AC_SUBST(WINDOWS_SDK_WILANGID)
5428 if test "$build_os" = "cygwin"; then
5429     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5430     dnl dir, it also determines that dir's path w/o an arch segment if any,
5431     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5432     AC_MSG_CHECKING([for midl.exe])
5434     find_winsdk
5435     if test -n "$winsdkbinsubdir" \
5436         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5437     then
5438         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5439         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5440     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5441         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5442         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5443     elif test -f "$winsdktest/Bin/midl.exe"; then
5444         MIDL_PATH=$winsdktest/Bin
5445         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5446     fi
5447     if test ! -f "$MIDL_PATH/midl.exe"; then
5448         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5449     else
5450         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5451     fi
5453     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5454     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5456     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5457          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5458          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5459          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5460     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5461          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5462          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5463          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5464     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5465          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5466          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5467          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5468     else
5469         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5470     fi
5472     dnl Check csc.exe
5473     AC_MSG_CHECKING([for csc.exe])
5474     find_csc
5475     if test -f "$csctest/csc.exe"; then
5476         CSC_PATH="$csctest"
5477     fi
5478     if test ! -f "$CSC_PATH/csc.exe"; then
5479         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5480     else
5481         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5482     fi
5484     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5486     dnl Check al.exe
5487     AC_MSG_CHECKING([for al.exe])
5488     find_winsdk
5489     if test -n "$winsdkbinsubdir" \
5490         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5491     then
5492         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5493     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5494         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5495     elif test -f "$winsdktest/Bin/al.exe"; then
5496         AL_PATH="$winsdktest/Bin"
5497     fi
5499     if test -z "$AL_PATH"; then
5500         find_al
5501         if test -f "$altest/bin/al.exe"; then
5502             AL_PATH="$altest/bin"
5503         elif test -f "$altest/al.exe"; then
5504             AL_PATH="$altest"
5505         fi
5506     fi
5507     if test ! -f "$AL_PATH/al.exe"; then
5508         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5509     else
5510         AC_MSG_RESULT([$AL_PATH/al.exe])
5511     fi
5513     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5515     dnl Check mscoree.lib / .NET Framework dir
5516     AC_MSG_CHECKING(.NET Framework)
5517     find_dotnetsdk
5518     if test -f "$frametest/lib/mscoree.lib"; then
5519         DOTNET_FRAMEWORK_HOME="$frametest"
5520     else
5521         find_winsdk
5522         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5523             DOTNET_FRAMEWORK_HOME="$winsdktest"
5524         else
5525             find_dotnetsdk46
5526             PathFormat "$frametest"
5527             frametest="$formatted_path"
5528             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5529                  DOTNET_FRAMEWORK_HOME="$frametest"
5530             fi
5531         fi
5532     fi
5534     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
5535         AC_MSG_ERROR([mscoree.lib not found])
5536     fi
5537     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5539     PathFormat "$MIDL_PATH"
5540     MIDL_PATH="$formatted_path"
5542     PathFormat "$AL_PATH"
5543     AL_PATH="$formatted_path"
5545     PathFormat "$DOTNET_FRAMEWORK_HOME"
5546     DOTNET_FRAMEWORK_HOME="$formatted_path"
5548     PathFormat "$CSC_PATH"
5549     CSC_PATH="$formatted_path"
5552 dnl ===================================================================
5553 dnl Check if stdc headers are available excluding MSVC.
5554 dnl ===================================================================
5555 if test "$_os" != "WINNT"; then
5556     AC_HEADER_STDC
5559 dnl ===================================================================
5560 dnl Testing for C++ compiler and version...
5561 dnl ===================================================================
5563 if test "$_os" != "WINNT"; then
5564     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5565     save_CXXFLAGS=$CXXFLAGS
5566     AC_PROG_CXX
5567     CXXFLAGS=$save_CXXFLAGS
5568 else
5569     if test -n "$CC" -a -z "$CXX"; then
5570         CXX="$CC"
5571     fi
5574 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5575 dnl ("implementation limitation" when defining OUStringLiteral variables in
5576 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5577 dnl probably a good idea to require that anyway.  A reliable way to check for
5578 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5579 dnl namespace definitions (which requires /std:c++latest to be enabled):
5580 if test "$COM" = MSC -a "$VCVER" = 140; then
5581     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5582     save_CXX=$CXX
5583     save_CXXFLAGS=$CXXFLAGS
5584     CXX=$MSVC_CXX
5585     CXXFLAGS="$CXXFLAGS /std:c++latest"
5586     AC_LANG_PUSH([C++])
5587     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5588         namespace A::B {}
5589     ]])], [good=yes], [good=no])
5590     AC_LANG_POP([C++])
5591     CXX=$save_CXX
5592     CXXFLAGS=$save_CXXFLAGS
5593     AC_MSG_RESULT([$good])
5594     if test "$good" = no; then
5595         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5596     fi
5599 dnl check for GNU C++ compiler version
5600 if test "$GXX" = "yes"; then
5601     AC_MSG_CHECKING([the GNU C++ compiler version])
5603     _gpp_version=`$CXX -dumpversion`
5604     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5606     if test "$_gpp_majmin" -lt "401"; then
5607         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5608     else
5609         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5610     fi
5612     dnl see https://code.google.com/p/android/issues/detail?id=41770
5613     if test "$_gpp_majmin" -ge "401"; then
5614         glibcxx_threads=no
5615         AC_LANG_PUSH([C++])
5616         AC_REQUIRE_CPP
5617         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5618         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5619             #include <bits/c++config.h>]],[[
5620             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5621             && !defined(_GLIBCXX__PTHREADS) \
5622             && !defined(_GLIBCXX_HAS_GTHREADS)
5623             choke me
5624             #endif
5625         ]])],[AC_MSG_RESULT([yes])
5626         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5627         AC_LANG_POP([C++])
5628         if test $glibcxx_threads = yes; then
5629             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5630         fi
5631      fi
5633 AC_SUBST(BOOST_CXXFLAGS)
5636 # prefx CXX with ccache if needed
5638 if test "$CCACHE" != ""; then
5639     AC_MSG_CHECKING([whether $CXX is already ccached])
5640     AC_LANG_PUSH([C++])
5641     save_CXXFLAGS=$CXXFLAGS
5642     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5643     dnl an empty program will do, we're checking the compiler flags
5644     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5645                       [use_ccache=yes], [use_ccache=no])
5646     if test $use_ccache = yes; then
5647         AC_MSG_RESULT([yes])
5648     else
5649         CXX="$CCACHE $CXX"
5650         AC_MSG_RESULT([no])
5651     fi
5652     CXXFLAGS=$save_CXXFLAGS
5653     AC_LANG_POP([C++])
5656 dnl ===================================================================
5657 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5658 dnl ===================================================================
5660 if test "$_os" != "WINNT"; then
5661     AC_PROG_CXXCPP
5663     dnl Check whether there's a C pre-processor.
5664     AC_PROG_CPP
5668 dnl ===================================================================
5669 dnl Find integral type sizes and alignments
5670 dnl ===================================================================
5672 if test "$_os" != "WINNT"; then
5674     AC_CHECK_SIZEOF(long)
5675     AC_CHECK_SIZEOF(short)
5676     AC_CHECK_SIZEOF(int)
5677     AC_CHECK_SIZEOF(long long)
5678     AC_CHECK_SIZEOF(double)
5679     AC_CHECK_SIZEOF(void*)
5681     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5682     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5683     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5684     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5685     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5687     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5688     m4_pattern_allow([AC_CHECK_ALIGNOF])
5689     m4_ifdef([AC_CHECK_ALIGNOF],
5690         [
5691             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5692             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5693             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5694             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5695         ],
5696         [
5697             case "$_os-$host_cpu" in
5698             Linux-i686)
5699                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5700                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5701                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5702                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5703                 ;;
5704             Linux-x86_64)
5705                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5706                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5707                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5708                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5709                 ;;
5710             *)
5711                 if test -z "$ac_cv_alignof_short" -o \
5712                         -z "$ac_cv_alignof_int" -o \
5713                         -z "$ac_cv_alignof_long" -o \
5714                         -z "$ac_cv_alignof_double"; then
5715                    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.])
5716                 fi
5717                 ;;
5718             esac
5719         ])
5721     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5722     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5723     if test $ac_cv_sizeof_long -eq 8; then
5724         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5725     elif test $ac_cv_sizeof_double -eq 8; then
5726         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5727     else
5728         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5729     fi
5731     dnl Check for large file support
5732     AC_SYS_LARGEFILE
5733     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5734         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5735     fi
5736     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5737         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5738     fi
5739 else
5740     # Hardcode for MSVC
5741     SAL_TYPES_SIZEOFSHORT=2
5742     SAL_TYPES_SIZEOFINT=4
5743     SAL_TYPES_SIZEOFLONG=4
5744     SAL_TYPES_SIZEOFLONGLONG=8
5745     if test "$BITNESS_OVERRIDE" = ""; then
5746         SAL_TYPES_SIZEOFPOINTER=4
5747     else
5748         SAL_TYPES_SIZEOFPOINTER=8
5749     fi
5750     SAL_TYPES_ALIGNMENT2=2
5751     SAL_TYPES_ALIGNMENT4=4
5752     SAL_TYPES_ALIGNMENT8=8
5753     LFS_CFLAGS=''
5755 AC_SUBST(LFS_CFLAGS)
5757 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5758 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5759 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5760 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5761 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5762 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5763 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5764 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5766 dnl ===================================================================
5767 dnl Check whether to enable runtime optimizations
5768 dnl ===================================================================
5769 ENABLE_RUNTIME_OPTIMIZATIONS=
5770 AC_MSG_CHECKING([whether to enable runtime optimizations])
5771 if test -z "$enable_runtime_optimizations"; then
5772     for i in $CC; do
5773         case $i in
5774         -fsanitize=*)
5775             enable_runtime_optimizations=no
5776             break
5777             ;;
5778         esac
5779     done
5781 if test "$enable_runtime_optimizations" != no; then
5782     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5783     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5784     AC_MSG_RESULT([yes])
5785 else
5786     AC_MSG_RESULT([no])
5788 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5790 dnl ===================================================================
5791 dnl Check if valgrind headers are available
5792 dnl ===================================================================
5793 ENABLE_VALGRIND=
5794 if test "$cross_compiling" != yes; then
5795     prev_cppflags=$CPPFLAGS
5796     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5797     # or where does it come from?
5798     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5799     AC_CHECK_HEADER([valgrind/valgrind.h],
5800         [ENABLE_VALGRIND=TRUE])
5801     CPPFLAGS=$prev_cppflags
5803 AC_SUBST([ENABLE_VALGRIND])
5804 if test -z "$ENABLE_VALGRIND"; then
5805     VALGRIND_CFLAGS=
5807 AC_SUBST([VALGRIND_CFLAGS])
5810 dnl ===================================================================
5811 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5812 dnl ===================================================================
5814 # We need at least the sys/sdt.h include header.
5815 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5816 if test "$SDT_H_FOUND" = "TRUE"; then
5817     # Found sys/sdt.h header, now make sure the c++ compiler works.
5818     # Old g++ versions had problems with probes in constructors/destructors.
5819     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5820     AC_LANG_PUSH([C++])
5821     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5822     #include <sys/sdt.h>
5823     class ProbeClass
5824     {
5825     private:
5826       int& ref;
5827       const char *name;
5829     public:
5830       ProbeClass(int& v, const char *n) : ref(v), name(n)
5831       {
5832         DTRACE_PROBE2(_test_, cons, name, ref);
5833       }
5835       void method(int min)
5836       {
5837         DTRACE_PROBE3(_test_, meth, name, ref, min);
5838         ref -= min;
5839       }
5841       ~ProbeClass()
5842       {
5843         DTRACE_PROBE2(_test_, dest, name, ref);
5844       }
5845     };
5846     ]],[[
5847     int i = 64;
5848     DTRACE_PROBE1(_test_, call, i);
5849     ProbeClass inst = ProbeClass(i, "call");
5850     inst.method(24);
5851     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5852           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5853     AC_LANG_POP([C++])
5855 AC_CONFIG_HEADERS([config_host/config_probes.h])
5857 dnl ===================================================================
5858 dnl thread-safe statics
5859 dnl ===================================================================
5860 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5861 unset HAVE_THREADSAFE_STATICS
5862 if test "$GCC" = "yes"; then
5863     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5864     dnl us.  However, some C++ runtimes use a single lock for all static
5865     dnl variables, which can cause deadlock in multi-threaded applications.
5866     dnl This is not easily tested here; for POSIX-based systems, if executing
5867     dnl the following C++ program does not terminate then the tool chain
5868     dnl apparently has this problem:
5869     dnl
5870     dnl   #include <pthread.h>
5871     dnl   int h() { return 0; }
5872     dnl   void * g(void * unused) {
5873     dnl     static int n = h();
5874     dnl     return &n;
5875     dnl   }
5876     dnl   int f() {
5877     dnl     pthread_t t;
5878     dnl     pthread_create(&t, 0, g, 0);
5879     dnl     pthread_join(t, 0);
5880     dnl     return 0;
5881     dnl   }
5882     dnl   int main() {
5883     dnl     static int n = f();
5884     dnl     return n;
5885     dnl   }
5886     dnl
5887     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5888     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5889     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5890     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5891     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5892     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5893     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5894     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5895     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5896     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5897     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5898     dnl "too old"):
5899     if test "$_os" = Darwin; then
5900         HAVE_THREADSAFE_STATICS=TRUE
5901     elif test "$_os" != Android; then
5902         if test "$COM_IS_CLANG" = TRUE; then
5903             AC_LANG_PUSH([C++])
5904             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5905 #include <list>
5906 #if defined __GLIBCXX__
5907 #if __GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306
5908 #error
5909 #endif
5910 #endif
5911                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5912             AC_LANG_POP([C++])
5913         else # known to work in GCC since version 4.3
5914             HAVE_THREADSAFE_STATICS=TRUE
5915         fi
5916     fi
5917     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5918         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5919         AC_MSG_RESULT([yes])
5920     else
5921         AC_MSG_RESULT([broken (i.e., no)])
5922     fi
5923 else
5924     # MSVC has sprouted C++11 thread-safe statics in 2015
5925     # http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
5926     # but it doesn't work on Windows XP, so don't use it for 32-bit builds baselined for Windows XP
5927     if test "$COM" = "MSC" -a "$VCVER" -ge "140" -a "$with_windows_sdk" != "7.1A"; then
5928         HAVE_THREADSAFE_STATICS=TRUE
5929         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5930         AC_MSG_RESULT([yes])
5931     else
5932         AC_MSG_RESULT([no])
5933     fi
5935 AC_SUBST(HAVE_THREADSAFE_STATICS)
5937 dnl ===================================================================
5938 dnl GCC features
5939 dnl ===================================================================
5940 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5941     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5942     save_CFLAGS=$CFLAGS
5943     CFLAGS="$CFLAGS -Werror -mno-avx"
5944     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5945     CFLAGS=$save_CFLAGS
5946     if test "$HAVE_GCC_AVX" = "TRUE"; then
5947         AC_MSG_RESULT([yes])
5948     else
5949         AC_MSG_RESULT([no])
5950     fi
5952     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5953     save_CFLAGS=$CFLAGS
5954     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5955     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5956     CFLAGS=$save_CFLAGS
5957     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5958         AC_MSG_RESULT([yes])
5959     else
5960         AC_MSG_RESULT([no])
5961     fi
5963     AC_MSG_CHECKING([whether $CC supports atomic functions])
5964     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5965     int v = 0;
5966     if (__sync_add_and_fetch(&v, 1) != 1 ||
5967         __sync_sub_and_fetch(&v, 1) != 0)
5968         return 1;
5969     __sync_synchronize();
5970     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5971         v != 1)
5972         return 1;
5973     return 0;
5974 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5975     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5976         AC_MSG_RESULT([yes])
5977         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5978     else
5979         AC_MSG_RESULT([no])
5980     fi
5982     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5983     save_CFLAGS=$CFLAGS
5984     CFLAGS="$CFLAGS -Werror"
5985     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5986             __attribute__((deprecated("test"))) void f();
5987         ])], [
5988             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5989             AC_MSG_RESULT([yes])
5990         ], [AC_MSG_RESULT([no])])
5991     CFLAGS=$save_CFLAGS
5993     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5994     AC_LANG_PUSH([C++])
5995     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5996             #include <cstddef>
5997             #include <cxxabi.h>
5998             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5999         ])], [
6000             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6001             AC_MSG_RESULT([yes])
6002         ], [AC_MSG_RESULT([no])])
6003     AC_LANG_POP([C++])
6005     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
6006     AC_LANG_PUSH([C++])
6007     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6008             #include <cstddef>
6009             #include <cxxabi.h>
6010             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6011         ])], [
6012             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6013             AC_MSG_RESULT([yes])
6014         ], [AC_MSG_RESULT([no])])
6015     AC_LANG_POP([C++])
6017     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6018     AC_LANG_PUSH([C++])
6019     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6020             #include <cxxabi.h>
6021             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6022         ])], [
6023             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6024             AC_MSG_RESULT([yes])
6025         ], [AC_MSG_RESULT([no])])
6026     AC_LANG_POP([C++])
6028     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6029     AC_LANG_PUSH([C++])
6030     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6031             #include <cstddef>
6032             #include <cxxabi.h>
6033             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6034         ])], [
6035             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6036             AC_MSG_RESULT([yes])
6037         ], [AC_MSG_RESULT([no])])
6038     AC_LANG_POP([C++])
6040     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6041     AC_LANG_PUSH([C++])
6042     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6043             #include <cstddef>
6044             #include <cxxabi.h>
6045             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6046         ])], [
6047             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6048             AC_MSG_RESULT([yes])
6049         ], [AC_MSG_RESULT([no])])
6050     AC_LANG_POP([C++])
6052     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6053     AC_LANG_PUSH([C++])
6054     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6055             #include <cxxabi.h>
6056             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6057         ])], [
6058             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6059             AC_MSG_RESULT([yes])
6060         ], [AC_MSG_RESULT([no])])
6061     AC_LANG_POP([C++])
6063     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6064     AC_LANG_PUSH([C++])
6065     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6066             #include <cxxabi.h>
6067             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6068         ])], [
6069             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6070             AC_MSG_RESULT([yes])
6071         ], [AC_MSG_RESULT([no])])
6072     AC_LANG_POP([C++])
6074     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6075     AC_LANG_PUSH([C++])
6076     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6077             #include <cstddef>
6078             #include <cxxabi.h>
6079             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6080         ])], [
6081             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6082             AC_MSG_RESULT([yes])
6083         ], [AC_MSG_RESULT([no])])
6084     AC_LANG_POP([C++])
6086     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6087     AC_LANG_PUSH([C++])
6088     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6089             #include <cstddef>
6090             #include <cxxabi.h>
6091             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6092         ])], [
6093             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6094             AC_MSG_RESULT([yes])
6095         ], [AC_MSG_RESULT([no])])
6096     AC_LANG_POP([C++])
6098     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6099     AC_LANG_PUSH([C++])
6100     save_CXXFLAGS=$CXXFLAGS
6101     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
6102     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6103             #include <string>
6104             void f() { std::string s; }
6105         ])], [
6106             AC_MSG_RESULT([no])
6107         ], [
6108             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6109             AC_MSG_RESULT([yes])])
6110     CXXFLAGS=$save_CXXFLAGS
6111     AC_LANG_POP([C++])
6113     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6114     AC_LANG_PUSH([C++])
6115     save_CXXFLAGS=$CXXFLAGS
6116     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
6117     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6118             struct __attribute__((warn_unused)) dummy {};
6119         ])], [
6120             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6121             AC_MSG_RESULT([yes])
6122         ], [AC_MSG_RESULT([no])])
6123     CXXFLAGS=$save_CXXFLAGS
6124 AC_LANG_POP([C++])
6127 AC_SUBST(HAVE_GCC_AVX)
6128 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6129 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6131 dnl ===================================================================
6132 dnl Identify the C++ library
6133 dnl ===================================================================
6135 AC_MSG_CHECKING([What the C++ library is])
6136 AC_LANG_PUSH([C++])
6137 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6138 #include <utility>
6139 #ifndef __GLIBCXX__
6140 foo bar
6141 #endif
6142 ]])],
6143     [CPP_LIBRARY=GLIBCXX
6144      cpp_library_name="GNU libstdc++"
6145     ],
6146     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6147 #include <utility>
6148 #ifndef _LIBCPP_VERSION
6149 foo bar
6150 #endif
6151 ]])],
6152     [CPP_LIBRARY=LIBCPP
6153      cpp_library_name="LLVM libc++"
6154     ],
6155     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6156 #include <utility>
6157 #ifndef _MSC_VER
6158 foo bar
6159 #endif
6160 ]])],
6161     [CPP_LIBRARY=MSVCRT
6162      cpp_library_name="Microsoft"
6163     ],
6164     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6165 AC_MSG_RESULT([$cpp_library_name])
6166 AC_LANG_POP([C++])
6168 dnl ===================================================================
6169 dnl C++11
6170 dnl ===================================================================
6172 CXXFLAGS_CXX11=
6173 if test "$COM" = MSC; then
6174     AC_MSG_CHECKING([whether $CXX supports C++11])
6175     AC_MSG_RESULT(yes)
6176     # MSVC supports (a subset of) CXX11 without any switch
6177 elif test "$GCC" = "yes"; then
6178     HAVE_CXX11=
6179     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
6180     for flag in -std=gnu++14 -std=gnu++1y -std=c++14 -std=c++1y -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
6181         save_CXXFLAGS=$CXXFLAGS
6182         CXXFLAGS="$CXXFLAGS $flag -Werror"
6183         AC_LANG_PUSH([C++])
6184         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6185             #include <algorithm>
6186             #include <functional>
6187             #include <vector>
6188             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6189                 std::sort(v.begin(), v.end(), fn);
6190             }
6191             ]])],[CXXFLAGS_CXX11=$flag])
6192         AC_LANG_POP([C++])
6193         CXXFLAGS=$save_CXXFLAGS
6194         if test -n "$CXXFLAGS_CXX11"; then
6195             HAVE_CXX11=TRUE
6196             break
6197         fi
6198     done
6199     if test "$HAVE_CXX11" = TRUE; then
6200         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6201     else
6202         AC_MSG_ERROR(no)
6203     fi
6206 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6207 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6208 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6209 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6210 dnl again towards 4.7.2:
6211 if test $CPP_LIBRARY = GLIBCXX; then
6212     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6213     AC_LANG_PUSH([C++])
6214     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6215 #include <list>
6216 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6217     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6218     //   GCC 4.7.0: 20120322
6219     //   GCC 4.7.1: 20120614
6220     // and using a range check is not possible as the mapping between
6221     // __GLIBCXX__ values and GCC versions is not monotonic
6222 /* ok */
6223 #else
6224 abi broken
6225 #endif
6226         ]])], [AC_MSG_RESULT(no, ok)],
6227         [AC_MSG_ERROR(yes)])
6228     AC_LANG_POP([C++])
6231 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6232 save_CXXFLAGS=$CXXFLAGS
6233 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6234 AC_LANG_PUSH([C++])
6236 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6237 #include <stddef.h>
6239 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6241 namespace
6243         struct b
6244         {
6245                 int i;
6246                 int j;
6247         };
6249 ]], [[
6250 struct a
6252         int i;
6253         int j;
6255 a thinga[]={{0,0}, {1,1}};
6256 b thingb[]={{0,0}, {1,1}};
6257 size_t i = sizeof(sal_n_array_size(thinga));
6258 size_t j = sizeof(sal_n_array_size(thingb));
6259 return !(i != 0 && j != 0);
6261     ], [ AC_MSG_RESULT(yes) ],
6262     [ AC_MSG_ERROR(no)])
6263 AC_LANG_POP([C++])
6264 CXXFLAGS=$save_CXXFLAGS
6266 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6267 save_CXXFLAGS=$CXXFLAGS
6268 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6269 AC_LANG_PUSH([C++])
6271 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6272 #include <vector>
6273     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6274     // (__float128)
6276     ],[ AC_MSG_RESULT(yes) ],
6277     [
6278         AC_MSG_RESULT(no)
6279         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6280         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6281         # __float128 is available during its build, but it's usually built using GCC,
6282         # and so c++config.h hardcodes __float128 being supported). As the only place
6283         # where __float128 is actually used is in a template specialization,
6284         # -D__float128=void will avoid the problem there while still causing a problem
6285         # if somebody actually uses the type.
6286         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6287         CXXFLAGS="$CXXFLAGS -D__float128=void"
6288         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6289 #include <vector>
6290     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6291     // (__float128)
6293     ],
6294     [
6295      AC_MSG_RESULT(yes)
6296      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6297     ],
6298     [
6299      AC_MSG_ERROR(no)
6300     ])
6303 AC_LANG_POP([C++])
6304 CXXFLAGS=$save_CXXFLAGS
6306 AC_SUBST(CXXFLAGS_CXX11)
6308 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6309 save_CXXFLAGS=$CXXFLAGS
6310 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6311 AC_LANG_PUSH([C++])
6312 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6313     struct S {
6314         int n_;
6315         constexpr S(int n): n_(n) {}
6316     };
6317     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6318 AC_LANG_POP([C++])
6319 CXXFLAGS=$save_CXXFLAGS
6320 AC_MSG_RESULT([$cxx11_constexpr])
6321 if test "$cxx11_constexpr" = no; then
6322     AC_MSG_ERROR([Your $CXX does not support 'constexpr'. This is no longer supported.])
6325 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6326 save_CXXFLAGS=$CXXFLAGS
6327 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6328 AC_LANG_PUSH([C++])
6329 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6330     // A somewhat over-complicated way of checking for
6331     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6332     // in constexpr function":
6333     #include <cassert>
6334     template<typename T> inline constexpr T f(T x) { return x; }
6335     template<typename T> inline constexpr T g(T x) {
6336         assert(f(static_cast<int>(x)));
6337         return x;
6338     }
6339     enum E { e };
6340     auto v = g(E::e);
6342     struct S {
6343         int n_;
6344         constexpr bool f() {
6345             int n = n_;
6346             int i = 0;
6347             while (n > 0) { --n; ++i; }
6348             assert(i >= 0);
6349             return i == 0;
6350         }
6351     };
6352     constexpr auto v2 = S{10}.f();
6353     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6354 AC_LANG_POP([C++])
6355 CXXFLAGS=$save_CXXFLAGS
6356 AC_MSG_RESULT([$cxx14_constexpr])
6357 if test "$cxx14_constexpr" = yes; then
6358     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6361 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6362 save_CXXFLAGS=$CXXFLAGS
6363 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6364 AC_LANG_PUSH([C++])
6365 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6366     struct S {
6367         void f() &;
6368         void f() &&;
6369     };
6370     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6371 AC_LANG_POP([C++])
6372 CXXFLAGS=$save_CXXFLAGS
6373 AC_MSG_RESULT([$cxx11_ref_qualifier])
6374 if test "$cxx11_ref_qualifier" = yes; then
6375     AC_DEFINE([HAVE_CXX11_REF_QUALIFIER])
6378 AC_MSG_CHECKING([whether $CXX supports C++11 char16_t string literals])
6379 save_CXXFLAGS=$CXXFLAGS
6380 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6381 AC_LANG_PUSH([C++])
6382 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6383     auto s = u"";
6384     ]])], [cxx11_utf16_string_literal=yes], [cxx11_utf16_string_literal=no])
6385 AC_LANG_POP([C++])
6386 CXXFLAGS=$save_CXXFLAGS
6387 AC_MSG_RESULT([$cxx11_utf16_string_literal])
6388 if test "$cxx11_utf16_string_literal" = no; then
6389     AC_MSG_ERROR([Your $CXX does not support UTF-16 string literals. This is no longer supported.])
6392 dnl _Pragma support (may require C++11)
6393 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6394     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6395     AC_LANG_PUSH([C++])
6396     save_CXXFLAGS=$CXXFLAGS
6397     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6398     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6399             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6400         ])], [
6401             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6402             AC_MSG_RESULT([yes])
6403         ], [AC_MSG_RESULT([no])])
6404     AC_LANG_POP([C++])
6405     CXXFLAGS=$save_CXXFLAGS
6408 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6409 if test "$GCC" = yes; then
6410     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6411     AC_LANG_PUSH([C++])
6412     save_CXXFLAGS=$CXXFLAGS
6413     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6414     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6415     CXXFLAGS=$save_CXXFLAGS
6416     AC_LANG_POP([C++])
6417     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6418         AC_MSG_RESULT([yes])
6419     else
6420         AC_MSG_RESULT([no])
6421     fi
6423 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6425 dnl ===================================================================
6426 dnl system stl sanity tests
6427 dnl ===================================================================
6428 if test "$_os" != "WINNT"; then
6430     AC_LANG_PUSH([C++])
6432     save_CPPFLAGS="$CPPFLAGS"
6433     if test -n "$MACOSX_SDK_PATH"; then
6434         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6435     fi
6437     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6438     # only.
6439     if test "$CPP_LIBRARY" = GLIBCXX; then
6440         dnl gcc#19664, gcc#22482, rhbz#162935
6441         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6442         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6443         AC_MSG_RESULT([$stlvisok])
6444         if test "$stlvisok" = "no"; then
6445             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6446         fi
6447     fi
6449     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6450     # when we don't make any dynamic libraries?
6451     if test "$DISABLE_DYNLOADING" = ""; then
6452         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6453         cat > conftestlib1.cc <<_ACEOF
6454 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6455 struct S2: S1<int> { virtual ~S2(); };
6456 S2::~S2() {}
6457 _ACEOF
6458         cat > conftestlib2.cc <<_ACEOF
6459 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6460 struct S2: S1<int> { virtual ~S2(); };
6461 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6462 _ACEOF
6463         gccvisinlineshiddenok=yes
6464         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6465             gccvisinlineshiddenok=no
6466         else
6467             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6468             dnl known to not work with -z defs (unsetting which makes the test
6469             dnl moot, though):
6470             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6471             if test "$COM_IS_CLANG" = TRUE; then
6472                 for i in $CXX $CXXFLAGS; do
6473                     case $i in
6474                     -fsanitize=*)
6475                         my_linkflagsnoundefs=
6476                         break
6477                         ;;
6478                     esac
6479                 done
6480             fi
6481             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6482                 gccvisinlineshiddenok=no
6483             fi
6484         fi
6486         rm -fr libconftest*
6487         AC_MSG_RESULT([$gccvisinlineshiddenok])
6488         if test "$gccvisinlineshiddenok" = "no"; then
6489             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6490         fi
6491     fi
6493     AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6494     cat >visibility.cxx <<_ACEOF
6495 #pragma GCC visibility push(hidden)
6496 struct __attribute__ ((visibility ("default"))) TestStruct {
6497   static void Init();
6499 __attribute__ ((visibility ("default"))) void TestFunc() {
6500   TestStruct::Init();
6502 _ACEOF
6503     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6504         gccvisbroken=yes
6505     else
6506         case "$host_cpu" in
6507         i?86|x86_64)
6508             if test "$_os" = "Darwin"; then
6509                 gccvisbroken=no
6510             else
6511                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6512                     gccvisbroken=no
6513                 else
6514                     gccvisbroken=yes
6515                 fi
6516             fi
6517             ;;
6518         *)
6519             gccvisbroken=no
6520             ;;
6521         esac
6522     fi
6523     rm -f visibility.s visibility.cxx
6525     AC_MSG_RESULT([$gccvisbroken])
6526     if test "$gccvisbroken" = "yes"; then
6527         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6528     fi
6530     CPPFLAGS="$save_CPPFLAGS"
6532     AC_LANG_POP([C++])
6535 dnl ===================================================================
6536 dnl  Clang++ tests
6537 dnl ===================================================================
6539 HAVE_GCC_FNO_DEFAULT_INLINE=
6540 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6541 if test "$GCC" = "yes"; then
6542     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6543     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6544         # Option just ignored and silly warning that isn't a real
6545         # warning printed
6546         :
6547     else
6548         AC_LANG_PUSH([C++])
6549         save_CXXFLAGS=$CXXFLAGS
6550         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6551         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6552         CXXFLAGS=$save_CXXFLAGS
6553         AC_LANG_POP([C++])
6554     fi
6555     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6556         AC_MSG_RESULT([yes])
6557     else
6558         AC_MSG_RESULT([no])
6559     fi
6561     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6562     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6563         # As above
6564         :
6565     else
6566         AC_LANG_PUSH([C++])
6567         save_CXXFLAGS=$CXXFLAGS
6568         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6569         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6570         CXXFLAGS=$save_CXXFLAGS
6571         AC_LANG_POP([C++])
6572     fi
6573     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6574         AC_MSG_RESULT([yes])
6575     else
6576         AC_MSG_RESULT([no])
6577     fi
6579 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6580 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6582 dnl ===================================================================
6583 dnl Compiler plugins
6584 dnl ===================================================================
6586 COMPILER_PLUGINS=
6587 # currently only Clang
6589 if test "$COM_IS_CLANG" != "TRUE"; then
6590     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6591         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6592         enable_compiler_plugins=no
6593     fi
6596 if test "$COM_IS_CLANG" = "TRUE"; then
6597     if test -n "$enable_compiler_plugins"; then
6598         compiler_plugins="$enable_compiler_plugins"
6599     elif test -n "$ENABLE_DBGUTIL"; then
6600         compiler_plugins=test
6601     else
6602         compiler_plugins=no
6603     fi
6604     if test "$compiler_plugins" != "no"; then
6605         dnl The prefix where Clang resides, override to where Clang resides if
6606         dnl using a source build:
6607         if test -z "$CLANGDIR"; then
6608             CLANGDIR=/usr
6609         fi
6610         AC_LANG_PUSH([C++])
6611         save_CPPFLAGS=$CPPFLAGS
6612         save_CXX=$CXX
6613         # compiler plugins must be built with "native" bitness of clang
6614         # because they link against clang libraries
6615         CXX=${COMPILER_PLUGINS_CXX-$(echo $CXX | sed -e s/-m64// -e s/-m32//)}
6616         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6617         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6618             [COMPILER_PLUGINS=TRUE],
6619             [
6620             if test "$compiler_plugins" = "yes"; then
6621                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6622             else
6623                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6624                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6625             fi
6626             ])
6627         CXX=$save_CXX
6628         CPPFLAGS=$save_CPPFLAGS
6629         AC_LANG_POP([C++])
6630     fi
6631 else
6632     if test "$enable_compiler_plugins" = "yes"; then
6633         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6634     fi
6636 AC_SUBST(COMPILER_PLUGINS)
6637 AC_SUBST(COMPILER_PLUGINS_CXX)
6638 AC_SUBST(CLANGDIR)
6640 # Plugin to help linker.
6641 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6642 # This makes --enable-lto build with clang work.
6643 AC_SUBST(LD_PLUGIN)
6645 dnl ===================================================================
6646 dnl allocator
6647 dnl ===================================================================
6648 AC_MSG_CHECKING([which memory allocator to use])
6649 if test "$with_alloc" = "system"; then
6650     AC_MSG_RESULT([system])
6651     ALLOC="SYS_ALLOC"
6653 if test "$with_alloc" = "tcmalloc"; then
6654     AC_MSG_RESULT(tcmalloc)
6655     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6656         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6657     fi
6658     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6659         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6660     ALLOC="TCMALLOC"
6662 if test "$with_alloc" = "jemalloc"; then
6663     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6664         AC_MSG_RESULT(jemalloc)
6665         save_CFLAGS=$CFLAGS
6666         CFLAGS="$CFLAGS -pthread"
6667         AC_CHECK_LIB([jemalloc], [malloc], [:],
6668             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6669         ALLOC="JEMALLOC"
6670         CFLAGS=$save_CFLAGS
6671     else
6672         AC_MSG_RESULT([system])
6673         ALLOC="SYS_ALLOC"
6674     fi
6676 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6677     AC_MSG_RESULT([internal])
6679 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6680 AC_SUBST(HAVE_POSIX_FALLOCATE)
6681 AC_SUBST(ALLOC)
6683 dnl ===================================================================
6684 dnl Custom build version
6685 dnl ===================================================================
6687 AC_MSG_CHECKING([whether to add custom build version])
6688 if test "$with_build_version" != ""; then
6689     BUILD_VER_STRING=$with_build_version
6690     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6691 else
6692     BUILD_VER_STRING=
6693     AC_MSG_RESULT([no])
6695 AC_SUBST(BUILD_VER_STRING)
6697 JITC_PROCESSOR_TYPE=""
6698 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6699     # IBMs JDK needs this...
6700     JITC_PROCESSOR_TYPE=6
6701     export JITC_PROCESSOR_TYPE
6703 AC_SUBST([JITC_PROCESSOR_TYPE])
6705 # Misc Windows Stuff
6706 AC_ARG_WITH(ucrt-dir,
6707     AS_HELP_STRING([--with-ucrt-dir],
6708         [path to the directory with the arch-specific subdirectories of the Windows Universtal CRT redistributables
6709         from the Windows 10 SDK for packaging into the installsets (without those the target system needs to install
6710         the Visual C++ Runtimes manually)]),
6712 UCRT_REDISTDIR="$with_ucrt_dir"
6713 if test $_os = "WINNT"; then
6714     find_msvc_x64_dlls
6715     find_msms
6716     MSVC_DLL_PATH="$msvcdllpath"
6717     MSVC_DLLS="$msvcdlls"
6718     MSM_PATH="$msmdir"
6719     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6720     if test "$UCRT_REDISTDIR" = "no"; then
6721         dnl explicitly disabled
6722         UCRT_REDISTDIR=""
6723     else
6724         UCRT_REDISTDIR="$UCRT_REDISTDIR/$WINDOWS_SDK_ARCH"
6725         # https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/
6726         # "note that the set of DLLs are necessary is different on different
6727         #  versions of Windows, so you must include all of the DLLs in order for
6728         #  your program to run on all supported versions of Windows"
6729         if test -f "$UCRT_REDISTDIR/ucrtbase.dll"; then
6730             cd "$UCRT_REDISTDIR";
6731             UCRT_DLLS=$(ls *.dll | paste -d " " -s)
6732             cd -
6733         else
6734             UCRT_REDISTDIR=""
6735             AC_MSG_WARN([No --with-ucrt-dir not specified or dlls not found - installer will have runtime dependency])
6736             add_warning "No --with-ucrt-dir not specified or dlls not found - installer will have runtime dependency"
6737         fi
6738     fi
6741 AC_SUBST(UCRT_REDISTDIR)
6742 AC_SUBST(UCRT_DLLS)
6743 AC_SUBST(MSVC_DLL_PATH)
6744 AC_SUBST(MSVC_DLLS)
6745 AC_SUBST(MSM_PATH)
6747 dnl ===================================================================
6748 dnl Checks for Java
6749 dnl ===================================================================
6750 if test "$ENABLE_JAVA" != ""; then
6752     # Windows-specific tests
6753     if test "$build_os" = "cygwin"; then
6754         if test "$BITNESS_OVERRIDE" = 64; then
6755             bitness=64
6756         else
6757             bitness=32
6758         fi
6760         if test -z "$with_jdk_home"; then
6761             for ver in 1.8 1.7 1.6; do
6762                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6763                 if test -n "$regvalue"; then
6764                     _jdk_home=$regvalue
6765                     break
6766                 fi
6767             done
6768             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6769                 with_jdk_home="$_jdk_home"
6770                 howfound="found automatically"
6771             else
6772                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6773             fi
6774         else
6775             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6776             howfound="you passed"
6777         fi
6778     fi
6780     # 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.
6781     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6782     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6783         with_jdk_home=`/usr/libexec/java_home`
6784     fi
6786     JAVA_HOME=; export JAVA_HOME
6787     if test -z "$with_jdk_home"; then
6788         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6789     else
6790         _java_path="$with_jdk_home/bin/$with_java"
6791         dnl Check if there is a Java interpreter at all.
6792         if test -x "$_java_path"; then
6793             JAVAINTERPRETER=$_java_path
6794         else
6795             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6796         fi
6797     fi
6799     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6800     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6801     dnl loaded by java to run JunitTests:
6802     if test "$build_os" = "cygwin"; then
6803         shortjdkhome=`cygpath -d "$with_jdk_home"`
6804         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
6805             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6806             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6807         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
6808             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6809             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6810         fi
6812         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6813             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6814         fi
6815         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6816     elif test "$cross_compiling" != "yes"; then
6817         case $CPUNAME in
6818             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6819                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6820                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6821                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6822                 fi
6823                 ;;
6824             *) # assumption: everything else 32-bit
6825                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6826                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6827                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6828                 fi
6829                 ;;
6830         esac
6831     fi
6834 HAVE_JAVA9=
6835 dnl ===================================================================
6836 dnl Checks for JDK.
6837 dnl ===================================================================
6839 # Note that JAVA_HOME as for now always means the *build* platform's
6840 # JAVA_HOME. Whether all the complexity here actually is needed any
6841 # more or not, no idea.
6843 if test "$ENABLE_JAVA" != ""; then
6844     _gij_longver=0
6845     AC_MSG_CHECKING([the installed JDK])
6846     if test -n "$JAVAINTERPRETER"; then
6847         dnl java -version sends output to stderr!
6848         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6849             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6850         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6851             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6852         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6853             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6854         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6855             JDK=ibm
6857             dnl IBM JDK specific tests
6858             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6859             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6861             if test "$_jdk_ver" -lt 10600; then
6862                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6863             fi
6865             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6867             if test "$with_jdk_home" = ""; then
6868                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6869 you must use the "--with-jdk-home" configure option explicitly])
6870             fi
6872             JAVA_HOME=$with_jdk_home
6873         else
6874             JDK=sun
6876             dnl Sun JDK specific tests
6877             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6878             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6880             if test "$_jdk_ver" -lt 10600; then
6881                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6882             fi
6883             if test "$_jdk_ver" -gt 10600; then
6884                 JAVA_CLASSPATH_NOT_SET=TRUE
6885             fi
6886             if test "$_jdk_ver" -ge 10900; then
6887                 HAVE_JAVA9=TRUE
6888             fi
6890             AC_MSG_RESULT([checked (JDK $_jdk)])
6891             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6892             if test "$_os" = "WINNT"; then
6893                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6894             fi
6896             # set to limit VM usage for JunitTests
6897             JAVAIFLAGS=-Xmx64M
6898             # set to limit VM usage for javac
6899             JAVAFLAGS=-J-Xmx128M
6900         fi
6901     else
6902         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6903     fi
6904 else
6905     dnl Java disabled
6906     JAVA_HOME=
6907     export JAVA_HOME
6910 dnl ===================================================================
6911 dnl Set target Java bytecode version
6912 dnl ===================================================================
6913 if test "$ENABLE_JAVA" != ""; then
6914     if test "$HAVE_JAVA9" = "TRUE"; then
6915         _java_target_ver="1.6"
6916     else
6917         _java_target_ver="1.5"
6918     fi
6919     JAVA_SOURCE_VER="$_java_target_ver"
6920     JAVA_TARGET_VER="$_java_target_ver"
6923 dnl ===================================================================
6924 dnl Checks for javac
6925 dnl ===================================================================
6926 if test "$ENABLE_JAVA" != ""; then
6927     javacompiler="javac"
6928     if test -z "$with_jdk_home"; then
6929         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6930     else
6931         _javac_path="$with_jdk_home/bin/$javacompiler"
6932         dnl Check if there is a Java compiler at all.
6933         if test -x "$_javac_path"; then
6934             JAVACOMPILER=$_javac_path
6935         fi
6936     fi
6937     if test -z "$JAVACOMPILER"; then
6938         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6939     fi
6940     if test "$build_os" = "cygwin"; then
6941         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6942             JAVACOMPILER="${JAVACOMPILER}.exe"
6943         fi
6944         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6945     fi
6948 dnl ===================================================================
6949 dnl Checks for javadoc
6950 dnl ===================================================================
6951 if test "$ENABLE_JAVA" != ""; then
6952     if test -z "$with_jdk_home"; then
6953         AC_PATH_PROG(JAVADOC, javadoc)
6954     else
6955         _javadoc_path="$with_jdk_home/bin/javadoc"
6956         dnl Check if there is a javadoc at all.
6957         if test -x "$_javadoc_path"; then
6958             JAVADOC=$_javadoc_path
6959         else
6960             AC_PATH_PROG(JAVADOC, javadoc)
6961         fi
6962     fi
6963     if test -z "$JAVADOC"; then
6964         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6965     fi
6966     if test "$build_os" = "cygwin"; then
6967         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6968             JAVADOC="${JAVADOC}.exe"
6969         fi
6970         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6971     fi
6973     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6974     JAVADOCISGJDOC="yes"
6975     fi
6977 AC_SUBST(JAVADOCISGJDOC)
6979 if test "$ENABLE_JAVA" != ""; then
6980     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6981     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6982         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6983            # try to recover first by looking whether we have a alternatives
6984            # system as in Debian or newer SuSEs where following /usr/bin/javac
6985            # over /etc/alternatives/javac leads to the right bindir where we
6986            # just need to strip a bit away to get a valid JAVA_HOME
6987            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6988         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6989             # maybe only one level of symlink (e.g. on Mac)
6990             JAVA_HOME=$(readlink $JAVACOMPILER)
6991             if test "$(dirname $JAVA_HOME)" = "."; then
6992                 # we've got no path to trim back
6993                 JAVA_HOME=""
6994             fi
6995         else
6996             # else warn
6997             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6998             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6999             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7000             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7001         fi
7002         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7003         if test "$JAVA_HOME" != "/usr"; then
7004             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7005                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7006                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7007                 dnl Tiger already returns a JDK path..
7008                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7009             else
7010                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7011                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7012                 dnl that checks which version to run
7013                 if test -f "$JAVA_HOME"; then
7014                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7015                 fi
7016             fi
7017         fi
7018     fi
7019     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7021     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7022     if test -z "$JAVA_HOME"; then
7023         if test "x$with_jdk_home" = "x"; then
7024             cat > findhome.java <<_ACEOF
7025 [import java.io.File;
7027 class findhome
7029     public static void main(String args[])
7030     {
7031         String jrelocation = System.getProperty("java.home");
7032         File jre = new File(jrelocation);
7033         System.out.println(jre.getParent());
7034     }
7036 _ACEOF
7037             AC_MSG_CHECKING([if javac works])
7038             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7039             AC_TRY_EVAL(javac_cmd)
7040             if test $? = 0 -a -f ./findhome.class; then
7041                 AC_MSG_RESULT([javac works])
7042             else
7043                 echo "configure: javac test failed" >&5
7044                 cat findhome.java >&5
7045                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7046             fi
7047             AC_MSG_CHECKING([if gij knows its java.home])
7048             JAVA_HOME=`$JAVAINTERPRETER findhome`
7049             if test $? = 0 -a "$JAVA_HOME" != ""; then
7050                 AC_MSG_RESULT([$JAVA_HOME])
7051             else
7052                 echo "configure: java test failed" >&5
7053                 cat findhome.java >&5
7054                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7055             fi
7056             # clean-up after ourselves
7057             rm -f ./findhome.java ./findhome.class
7058         else
7059             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7060         fi
7061     fi
7063     # now check if $JAVA_HOME is really valid
7064     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7065         case "${JAVA_HOME}" in
7066             /Library/Java/JavaVirtualMachines/*)
7067                 ;;
7068             *)
7069                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7070                 ;;
7071         esac
7072         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7073             JAVA_HOME_OK="NO"
7074         fi
7075     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7076         JAVA_HOME_OK="NO"
7077     fi
7078     if test "$JAVA_HOME_OK" = "NO"; then
7079         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7080         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7081         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7082         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7083         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7084         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7085     fi
7086     PathFormat "$JAVA_HOME"
7087     JAVA_HOME="$formatted_path"
7090 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7091     "$_os" != Darwin
7092 then
7093     AC_MSG_CHECKING([for JAWT lib])
7094     if test "$_os" = WINNT; then
7095         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7096         JAWTLIB=jawt.lib
7097     else
7098         case "$host_cpu" in
7099         arm*)
7100             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7101             JAVA_ARCH=$my_java_arch
7102             ;;
7103         i*86)
7104             my_java_arch=i386
7105             ;;
7106         m68k)
7107             my_java_arch=m68k
7108             ;;
7109         powerpc)
7110             my_java_arch=ppc
7111             ;;
7112         powerpc64)
7113             my_java_arch=ppc64
7114             ;;
7115         powerpc64le)
7116             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7117             JAVA_ARCH=$my_java_arch
7118             ;;
7119         sparc64)
7120             my_java_arch=sparcv9
7121             ;;
7122         x86_64)
7123             my_java_arch=amd64
7124             ;;
7125         *)
7126             my_java_arch=$host_cpu
7127             ;;
7128         esac
7129         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7130         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7131     fi
7132     AC_MSG_RESULT([$JAWTLIB])
7134 AC_SUBST(JAWTLIB)
7136 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7137     case "$host_os" in
7139     aix*)
7140         JAVAINC="-I$JAVA_HOME/include"
7141         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7142         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7143         ;;
7145     cygwin*)
7146         JAVAINC="-I$JAVA_HOME/include/win32"
7147         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7148         ;;
7150     darwin*)
7151         if test -d "$JAVA_HOME/include/darwin"; then
7152             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7153         else
7154             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7155         fi
7156         ;;
7158     dragonfly*)
7159         JAVAINC="-I$JAVA_HOME/include"
7160         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7161         ;;
7163     freebsd*)
7164         JAVAINC="-I$JAVA_HOME/include"
7165         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7166         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7167         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7168         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7169         ;;
7171     k*bsd*-gnu*)
7172         JAVAINC="-I$JAVA_HOME/include"
7173         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7174         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7175         ;;
7177     linux-gnu*)
7178         JAVAINC="-I$JAVA_HOME/include"
7179         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7180         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7181         ;;
7183     *netbsd*)
7184         JAVAINC="-I$JAVA_HOME/include"
7185         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7186         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7187        ;;
7189     openbsd*)
7190         JAVAINC="-I$JAVA_HOME/include"
7191         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7192         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7193         ;;
7195     solaris*)
7196         JAVAINC="-I$JAVA_HOME/include"
7197         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7198         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7199         ;;
7200     esac
7202 SOLARINC="$SOLARINC $JAVAINC"
7204 AC_SUBST(JAVACOMPILER)
7205 AC_SUBST(JAVADOC)
7206 AC_SUBST(JAVAINTERPRETER)
7207 AC_SUBST(JAVAIFLAGS)
7208 AC_SUBST(JAVAFLAGS)
7209 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7210 AC_SUBST(JAVA_HOME)
7211 AC_SUBST(JAVA_SOURCE_VER)
7212 AC_SUBST(JAVA_TARGET_VER)
7213 AC_SUBST(JDK)
7216 dnl ===================================================================
7217 dnl Export file validation
7218 dnl ===================================================================
7219 AC_MSG_CHECKING([whether to enable export file validation])
7220 if test "$with_export_validation" = yes; then
7221     if test -z "$ENABLE_JAVA"; then
7222         AC_MSG_RESULT([no, as Java is disabled])
7223     else
7224         AC_MSG_RESULT([yes])
7225         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7227         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7228         if test -z "$ODFVALIDATOR"; then
7229             # remember to download the ODF toolkit with validator later
7230             AC_MSG_NOTICE([no odfvalidator found, will download it])
7231             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7232             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7234             # and fetch name of odfvalidator jar name from download.lst
7235             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7236             AC_SUBST(ODFVALIDATOR_JAR)
7238             if test -z "$ODFVALIDATOR_JAR"; then
7239                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7240             fi
7241         fi
7242         if test "$build_os" = "cygwin"; then
7243             # In case of Cygwin it will be executed from Windows,
7244             # so we need to run bash and absolute path to validator
7245             # so instead of "odfvalidator" it will be
7246             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7247             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7248         else
7249             ODFVALIDATOR="sh $ODFVALIDATOR"
7250         fi
7251         AC_SUBST(ODFVALIDATOR)
7254         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7255         if test -z "$OFFICEOTRON"; then
7256             # remember to download the officeotron with validator later
7257             AC_MSG_NOTICE([no officeotron found, will download it])
7258             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7259             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7261             # and fetch name of officeotron jar name from download.lst
7262             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7263             AC_SUBST(OFFICEOTRON_JAR)
7265             if test -z "$OFFICEOTRON_JAR"; then
7266                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7267             fi
7268         else
7269             # check version of existing officeotron
7270             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7271             if test 0"$OFFICEOTRON_VER" -lt 704; then
7272                 AC_MSG_ERROR([officeotron too old])
7273             fi
7274         fi
7275         if test "$build_os" = "cygwin"; then
7276             # In case of Cygwin it will be executed from Windows,
7277             # so we need to run bash and absolute path to validator
7278             # so instead of "odfvalidator" it will be
7279             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7280             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7281         else
7282             OFFICEOTRON="sh $OFFICEOTRON"
7283         fi
7284     fi
7285     AC_SUBST(OFFICEOTRON)
7286 else
7287     AC_MSG_RESULT([no])
7290 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7291 if test "$with_bffvalidator" != "no"; then
7292     AC_DEFINE(HAVE_BFFVALIDATOR)
7294     if test "$with_export_validation" != "yes"; then
7295         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7296     fi
7298     if test "$with_bffvalidator" = "yes"; then
7299         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7300     else
7301         BFFVALIDATOR="$with_bffvalidator"
7302     fi
7304     if test "$build_os" = "cygwin"; then
7305         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7306             AC_MSG_RESULT($BFFVALIDATOR)
7307         else
7308             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7309         fi
7310     elif test -n "$BFFVALIDATOR"; then
7311         # We are not in Cygwin but need to run Windows binary with wine
7312         AC_PATH_PROGS(WINE, wine)
7314         # so swap in a shell wrapper that converts paths transparently
7315         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7316         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7317         AC_SUBST(BFFVALIDATOR_EXE)
7318         AC_MSG_RESULT($BFFVALIDATOR)
7319     else
7320         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7321     fi
7322     AC_SUBST(BFFVALIDATOR)
7323 else
7324     AC_MSG_RESULT([no])
7327 dnl ===================================================================
7328 dnl Check for C preprocessor to use
7329 dnl ===================================================================
7330 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7331 if test -n "$with_idlc_cpp"; then
7332     AC_MSG_RESULT([$with_idlc_cpp])
7333     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7334 else
7335     AC_MSG_RESULT([ucpp])
7336     AC_MSG_CHECKING([which ucpp tp use])
7337     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7338         AC_MSG_RESULT([external])
7339         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7340     else
7341         AC_MSG_RESULT([internal])
7342         BUILD_TYPE="$BUILD_TYPE UCPP"
7343     fi
7345 AC_SUBST(SYSTEM_UCPP)
7347 dnl ===================================================================
7348 dnl Check for epm (not needed for Windows)
7349 dnl ===================================================================
7350 AC_MSG_CHECKING([whether to enable EPM for packing])
7351 if test "$enable_epm" = "yes"; then
7352     AC_MSG_RESULT([yes])
7353     if test "$_os" != "WINNT"; then
7354         if test $_os = Darwin; then
7355             EPM=internal
7356         elif test -n "$with_epm"; then
7357             EPM=$with_epm
7358         else
7359             AC_PATH_PROG(EPM, epm, no)
7360         fi
7361         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7362             AC_MSG_NOTICE([EPM will be built.])
7363             BUILD_TYPE="$BUILD_TYPE EPM"
7364             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7365         else
7366             # Gentoo has some epm which is something different...
7367             AC_MSG_CHECKING([whether the found epm is the right epm])
7368             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7369                 AC_MSG_RESULT([yes])
7370             else
7371                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7372             fi
7373             AC_MSG_CHECKING([epm version])
7374             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7375             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7376                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7377                 AC_MSG_RESULT([OK, >= 3.7])
7378             else
7379                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7380                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7381             fi
7382         fi
7383     fi
7385     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7386         AC_MSG_CHECKING([for rpm])
7387         for a in "$RPM" rpmbuild rpm; do
7388             $a --usage >/dev/null 2> /dev/null
7389             if test $? -eq 0; then
7390                 RPM=$a
7391                 break
7392             else
7393                 $a --version >/dev/null 2> /dev/null
7394                 if test $? -eq 0; then
7395                     RPM=$a
7396                     break
7397                 fi
7398             fi
7399         done
7400         if test -z "$RPM"; then
7401             AC_MSG_ERROR([not found])
7402         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7403             RPM_PATH=`which $RPM`
7404             AC_MSG_RESULT([$RPM_PATH])
7405             SCPDEFS="$SCPDEFS -DWITH_RPM"
7406         else
7407             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7408         fi
7409     fi
7410     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7411         AC_PATH_PROG(DPKG, dpkg, no)
7412         if test "$DPKG" = "no"; then
7413             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7414         fi
7415     fi
7416     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7417        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7418         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7419             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7420                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7421                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7422                     AC_MSG_RESULT([yes])
7423                 else
7424                     AC_MSG_RESULT([no])
7425                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7426                         _pt="rpm"
7427                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7428                         add_warning "the rpms will need to be installed with --nodeps"
7429                     else
7430                         _pt="pkg"
7431                     fi
7432                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7433                     add_warning "the ${_pt}s will not be relocateable"
7434                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7435                                  relocation will work, you need to patch your epm with the
7436                                  patch in epm/epm-3.7.patch or build with
7437                                  --with-epm=internal which will build a suitable epm])
7438                 fi
7439             fi
7440         fi
7441     fi
7442     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7443         AC_PATH_PROG(PKGMK, pkgmk, no)
7444         if test "$PKGMK" = "no"; then
7445             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7446         fi
7447     fi
7448     AC_SUBST(RPM)
7449     AC_SUBST(DPKG)
7450     AC_SUBST(PKGMK)
7451 else
7452     for i in $PKGFORMAT; do
7453         case "$i" in
7454         aix | bsd | deb | pkg | rpm | native | portable)
7455             AC_MSG_ERROR(
7456                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7457             ;;
7458         esac
7459     done
7460     AC_MSG_RESULT([no])
7461     EPM=NO
7463 AC_SUBST(EPM)
7465 if test $_os = iOS; then
7466     enable_mpl_subset=yes
7467     enable_lotuswordpro=no
7468     enable_coinmp=yes
7469     enable_lpsolve=no
7470     enable_postgresql_sdbc=no
7471     enable_extension_integration=no
7472     enable_report_builder=no
7473     with_theme="tango"
7474     with_ppds=no
7477 ENABLE_LWP=
7478 if test "$enable_lotuswordpro" = "yes"; then
7479     ENABLE_LWP="TRUE"
7481 AC_SUBST(ENABLE_LWP)
7483 dnl ===================================================================
7484 dnl Check for gperf
7485 dnl ===================================================================
7486 AC_PATH_PROG(GPERF, gperf)
7487 if test -z "$GPERF"; then
7488     AC_MSG_ERROR([gperf not found but needed. Install it.])
7490 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7491     GPERF=`cygpath -m $GPERF`
7493 AC_MSG_CHECKING([gperf version])
7494 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7495     AC_MSG_RESULT([OK])
7496 else
7497     AC_MSG_ERROR([too old, you need at least 3.0.0])
7499 AC_SUBST(GPERF)
7501 dnl ===================================================================
7502 dnl Check for building ODK
7503 dnl ===================================================================
7504 if test "$enable_odk" = no; then
7505     unset DOXYGEN
7506 else
7507     if test "$with_doxygen" = no; then
7508         AC_MSG_CHECKING([for doxygen])
7509         unset DOXYGEN
7510         AC_MSG_RESULT([no])
7511     else
7512         if test "$with_doxygen" = yes; then
7513             AC_PATH_PROG([DOXYGEN], [doxygen])
7514             if test -z "$DOXYGEN"; then
7515                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7516             fi
7517         else
7518             AC_MSG_CHECKING([for doxygen])
7519             DOXYGEN=$with_doxygen
7520             AC_MSG_RESULT([$DOXYGEN])
7521         fi
7522         if test -n "$DOXYGEN"; then
7523             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7524             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7525             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7526                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7527             fi
7528         fi
7529     fi
7531 AC_SUBST([DOXYGEN])
7533 AC_MSG_CHECKING([whether to build the ODK])
7534 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7535     AC_MSG_RESULT([yes])
7537     if test "$with_java" != "no"; then
7538         AC_MSG_CHECKING([whether to build unowinreg.dll])
7539         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7540             # build on Win by default
7541             enable_build_unowinreg=yes
7542         fi
7543         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7544             AC_MSG_RESULT([no])
7545             BUILD_UNOWINREG=
7546         else
7547             AC_MSG_RESULT([yes])
7548             BUILD_UNOWINREG=TRUE
7549         fi
7550         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7551             if test -z "$with_mingw_cross_compiler"; then
7552                 dnl Guess...
7553                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7554             elif test -x "$with_mingw_cross_compiler"; then
7555                  MINGWCXX="$with_mingw_cross_compiler"
7556             else
7557                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7558             fi
7560             if test "$MINGWCXX" = "false"; then
7561                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7562             fi
7564             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7565             if test -x "$mingwstrip_test"; then
7566                 MINGWSTRIP="$mingwstrip_test"
7567             else
7568                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7569             fi
7571             if test "$MINGWSTRIP" = "false"; then
7572                 AC_MSG_ERROR(MinGW32 binutils not found.)
7573             fi
7574         fi
7575     fi
7576     BUILD_TYPE="$BUILD_TYPE ODK"
7577 else
7578     AC_MSG_RESULT([no])
7579     BUILD_UNOWINREG=
7581 AC_SUBST(BUILD_UNOWINREG)
7582 AC_SUBST(MINGWCXX)
7583 AC_SUBST(MINGWSTRIP)
7585 dnl ===================================================================
7586 dnl Check for system zlib
7587 dnl ===================================================================
7588 if test "$with_system_zlib" = "auto"; then
7589     case "$_os" in
7590     WINNT)
7591         with_system_zlib="$with_system_libs"
7592         ;;
7593     *)
7594         if test "$enable_fuzzers" != "yes"; then
7595             with_system_zlib=yes
7596         else
7597             with_system_zlib=no
7598         fi
7599         ;;
7600     esac
7603 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7604 dnl and has no pkg-config for it at least on some tinderboxes,
7605 dnl so leaving that out for now
7606 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7607 AC_MSG_CHECKING([which zlib to use])
7608 if test "$with_system_zlib" = "yes"; then
7609     AC_MSG_RESULT([external])
7610     SYSTEM_ZLIB=TRUE
7611     AC_CHECK_HEADER(zlib.h, [],
7612         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7613     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7614         [AC_MSG_ERROR(zlib not found or functional)], [])
7615 else
7616     AC_MSG_RESULT([internal])
7617     SYSTEM_ZLIB=
7618     BUILD_TYPE="$BUILD_TYPE ZLIB"
7619     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7620     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7622 AC_SUBST(ZLIB_CFLAGS)
7623 AC_SUBST(ZLIB_LIBS)
7624 AC_SUBST(SYSTEM_ZLIB)
7626 dnl ===================================================================
7627 dnl Check for system jpeg
7628 dnl ===================================================================
7629 AC_MSG_CHECKING([which libjpeg to use])
7630 if test "$with_system_jpeg" = "yes"; then
7631     AC_MSG_RESULT([external])
7632     SYSTEM_JPEG=TRUE
7633     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7634         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7635     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7636         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7637 else
7638     SYSTEM_JPEG=
7639     AC_MSG_RESULT([internal, jpeg-turbo])
7640     BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7641     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg-turbo"
7642     if test "$COM" = "MSC"; then
7643         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs/libjpeg.lib"
7644     else
7645         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs -ljpeg"
7646     fi
7648     case "$host_cpu" in
7649     x86_64 | amd64 | i*86 | x86 | ia32)
7650         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7651         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7652             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7653                 NASM="$LODE_HOME/opt/bin/nasm"
7654             elif test -x "/opt/lo/bin/nasm"; then
7655                 NASM="/opt/lo/bin/nasm"
7656             fi
7657         fi
7659         if test -n "$NASM"; then
7660             AC_MSG_CHECKING([for object file format of host system])
7661             case "$host_os" in
7662               cygwin* | mingw* | pw32* | interix*)
7663                 case "$host_cpu" in
7664                   x86_64)
7665                     objfmt='Win64-COFF'
7666                     ;;
7667                   *)
7668                     objfmt='Win32-COFF'
7669                     ;;
7670                 esac
7671               ;;
7672               msdosdjgpp* | go32*)
7673                 objfmt='COFF'
7674               ;;
7675               os2-emx*)                 # not tested
7676                 objfmt='MSOMF'          # obj
7677               ;;
7678               linux*coff* | linux*oldld*)
7679                 objfmt='COFF'           # ???
7680               ;;
7681               linux*aout*)
7682                 objfmt='a.out'
7683               ;;
7684               linux*)
7685                 case "$host_cpu" in
7686                   x86_64)
7687                     objfmt='ELF64'
7688                     ;;
7689                   *)
7690                     objfmt='ELF'
7691                     ;;
7692                 esac
7693               ;;
7694               kfreebsd* | freebsd* | netbsd* | openbsd*)
7695                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7696                   objfmt='BSD-a.out'
7697                 else
7698                   case "$host_cpu" in
7699                     x86_64 | amd64)
7700                       objfmt='ELF64'
7701                       ;;
7702                     *)
7703                       objfmt='ELF'
7704                       ;;
7705                   esac
7706                 fi
7707               ;;
7708               solaris* | sunos* | sysv* | sco*)
7709                 case "$host_cpu" in
7710                   x86_64)
7711                     objfmt='ELF64'
7712                     ;;
7713                   *)
7714                     objfmt='ELF'
7715                     ;;
7716                 esac
7717               ;;
7718               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7719                 case "$host_cpu" in
7720                   x86_64)
7721                     objfmt='Mach-O64'
7722                     ;;
7723                   *)
7724                     objfmt='Mach-O'
7725                     ;;
7726                 esac
7727               ;;
7728               *)
7729                 objfmt='ELF ?'
7730               ;;
7731             esac
7733             AC_MSG_RESULT([$objfmt])
7734             if test "$objfmt" = 'ELF ?'; then
7735               objfmt='ELF'
7736               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7737             fi
7739             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7740             case "$objfmt" in
7741               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7742               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7743               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7744               COFF)       NAFLAGS='-fcoff -DCOFF';;
7745               a.out)      NAFLAGS='-faout -DAOUT';;
7746               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7747               ELF)        NAFLAGS='-felf -DELF';;
7748               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7749               RDF)        NAFLAGS='-frdf -DRDF';;
7750               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7751               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7752             esac
7753             AC_MSG_RESULT([$NAFLAGS])
7755             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7756             cat > conftest.asm << EOF
7757             [%line __oline__ "configure"
7758                     section .text
7759                     global  _main,main
7760             _main:
7761             main:   xor     eax,eax
7762                     ret
7763             ]
7765             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7766             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7767               AC_MSG_RESULT(yes)
7768             else
7769               echo "configure: failed program was:" >&AC_FD_CC
7770               cat conftest.asm >&AC_FD_CC
7771               rm -rf conftest*
7772               AC_MSG_RESULT(no)
7773               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7774               NASM=""
7775             fi
7777         fi
7779         if test -z "$NASM"; then
7780 cat << _EOS
7781 ****************************************************************************
7782 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7783 To get one please:
7785 _EOS
7786             if test "$build_os" = "cygwin"; then
7787 cat << _EOS
7788 install a pre-compiled binary for Win32
7790 mkdir -p /opt/lo/bin
7791 cd /opt/lo/bin
7792 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7793 chmod +x nasm
7795 or get and install one from http://www.nasm.us/
7797 Then re-run autogen.sh
7799 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7800 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7802 _EOS
7803             else
7804 cat << _EOS
7805 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7807 _EOS
7808             fi
7809             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7810             add_warning "no suitable nasm (Netwide Assembler) found for internal jpeg-turbo"
7811         fi
7812       ;;
7813     esac
7816 AC_SUBST(NASM)
7817 AC_SUBST(LIBJPEG_CFLAGS)
7818 AC_SUBST(LIBJPEG_LIBS)
7819 AC_SUBST(SYSTEM_JPEG)
7821 dnl ===================================================================
7822 dnl Check for system clucene
7823 dnl ===================================================================
7824 dnl we should rather be using
7825 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7826 dnl but the contribs-lib check seems tricky
7827 AC_MSG_CHECKING([which clucene to use])
7828 if test "$with_system_clucene" = "yes"; then
7829     AC_MSG_RESULT([external])
7830     SYSTEM_CLUCENE=TRUE
7831     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7832     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7833     FilterLibs "${CLUCENE_LIBS}"
7834     CLUCENE_LIBS="${filteredlibs}"
7835     AC_LANG_PUSH([C++])
7836     save_CXXFLAGS=$CXXFLAGS
7837     save_CPPFLAGS=$CPPFLAGS
7838     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7839     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7840     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7841     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7842     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7843                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7844     CXXFLAGS=$save_CXXFLAGS
7845     CPPFLAGS=$save_CPPFLAGS
7846     AC_LANG_POP([C++])
7848     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7849 else
7850     AC_MSG_RESULT([internal])
7851     SYSTEM_CLUCENE=
7852     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7854 AC_SUBST(SYSTEM_CLUCENE)
7855 AC_SUBST(CLUCENE_CFLAGS)
7856 AC_SUBST(CLUCENE_LIBS)
7858 dnl ===================================================================
7859 dnl Check for system expat
7860 dnl ===================================================================
7861 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7863 dnl ===================================================================
7864 dnl Check for system xmlsec
7865 dnl ===================================================================
7866 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7868 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7869 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7870     ENABLE_EOT="TRUE"
7871     AC_DEFINE([ENABLE_EOT])
7872     AC_MSG_RESULT([yes])
7874     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7875 else
7876     ENABLE_EOT=
7877     AC_MSG_RESULT([no])
7879 AC_SUBST([ENABLE_EOT])
7881 dnl ===================================================================
7882 dnl Check for DLP libs
7883 dnl ===================================================================
7884 AS_IF([test "$COM" = "MSC"],
7885       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7886       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7888 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7890 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7892 AS_IF([test "$COM" = "MSC"],
7893       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7894       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7896 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7898 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7900 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7901 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.6])
7903 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7905 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7907 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7909 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7910 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.11])
7912 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7913 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
7915 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7917 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7918 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7920 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7922 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7924 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7926 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7927 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.3])
7929 dnl ===================================================================
7930 dnl Check for system libcmis
7931 dnl ===================================================================
7932 # libcmis requires curl and we can't build curl for iOS
7933 if test $_os != iOS; then
7934     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7935     ENABLE_CMIS=TRUE
7936 else
7937     ENABLE_CMIS=
7939 AC_SUBST(ENABLE_CMIS)
7941 dnl ===================================================================
7942 dnl Check for system lcms2
7943 dnl ===================================================================
7944 if test "$with_system_lcms2" != "yes"; then
7945     SYSTEM_LCMS2=
7947 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7948 if test "$GCC" = "yes"; then
7949     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7951 if test "$COM" = "MSC"; then # override the above
7952     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7955 dnl ===================================================================
7956 dnl Check for system cppunit
7957 dnl ===================================================================
7958 if test "$cross_compiling" != "yes"; then
7959     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7962 dnl ===================================================================
7963 dnl Check whether freetype is available
7964 dnl ===================================================================
7965 if test  "$test_freetype" = "yes"; then
7966     AC_MSG_CHECKING([whether freetype is available])
7967     # FreeType has 3 different kinds of versions
7968     # * release, like 2.4.10
7969     # * libtool, like 13.0.7 (this what pkg-config returns)
7970     # * soname
7971     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7972     #
7973     # 9.9.3 is 2.2.0
7974     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7975     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7976     FilterLibs "${FREETYPE_LIBS}"
7977     FREETYPE_LIBS="${filteredlibs}"
7978     SYSTEM_FREETYPE=TRUE
7979 else
7980     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7981     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7983 AC_SUBST(FREETYPE_CFLAGS)
7984 AC_SUBST(FREETYPE_LIBS)
7985 AC_SUBST([SYSTEM_FREETYPE])
7987 # ===================================================================
7988 # Check for system libxslt
7989 # to prevent incompatibilities between internal libxml2 and external libxslt,
7990 # or vice versa, use with_system_libxml here
7991 # ===================================================================
7992 if test "$with_system_libxml" = "auto"; then
7993     case "$_os" in
7994     WINNT|iOS|Android)
7995         with_system_libxml="$with_system_libs"
7996         ;;
7997     *)
7998         if test "$enable_fuzzers" != "yes"; then
7999             with_system_libxml=yes
8000         else
8001             with_system_libxml=no
8002         fi
8003         ;;
8004     esac
8007 AC_MSG_CHECKING([which libxslt to use])
8008 if test "$with_system_libxml" = "yes"; then
8009     AC_MSG_RESULT([external])
8010     SYSTEM_LIBXSLT=TRUE
8011     if test "$_os" = "Darwin"; then
8012         dnl make sure to use SDK path
8013         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8014         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8015         dnl omit -L/usr/lib
8016         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8017         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8018     else
8019         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8020         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8021         FilterLibs "${LIBXSLT_LIBS}"
8022         LIBXSLT_LIBS="${filteredlibs}"
8023         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8024         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8025         FilterLibs "${LIBEXSLT_LIBS}"
8026         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8027     fi
8029     dnl Check for xsltproc
8030     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8031     if test "$XSLTPROC" = "no"; then
8032         AC_MSG_ERROR([xsltproc is required])
8033     fi
8034 else
8035     AC_MSG_RESULT([internal])
8036     SYSTEM_LIBXSLT=
8037     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8039     if test "$cross_compiling" = "yes"; then
8040         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8041         if test "$XSLTPROC" = "no"; then
8042             AC_MSG_ERROR([xsltproc is required])
8043         fi
8044     fi
8046 AC_SUBST(SYSTEM_LIBXSLT)
8047 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8048     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8050 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8052 AC_SUBST(LIBEXSLT_CFLAGS)
8053 AC_SUBST(LIBEXSLT_LIBS)
8054 AC_SUBST(LIBXSLT_CFLAGS)
8055 AC_SUBST(LIBXSLT_LIBS)
8056 AC_SUBST(XSLTPROC)
8058 # ===================================================================
8059 # Check for system libxml
8060 # ===================================================================
8061 AC_MSG_CHECKING([which libxml to use])
8062 if test "$with_system_libxml" = "yes"; then
8063     AC_MSG_RESULT([external])
8064     SYSTEM_LIBXML=TRUE
8065     if test "$_os" = "Darwin"; then
8066         dnl make sure to use SDK path
8067         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8068         dnl omit -L/usr/lib
8069         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8070     elif test $_os = iOS; then
8071         dnl make sure to use SDK path
8072         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8073         LIBXML_CFLAGS="-I$usr/include/libxml2"
8074         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8075     else
8076         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8077         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8078         FilterLibs "${LIBXML_LIBS}"
8079         LIBXML_LIBS="${filteredlibs}"
8080     fi
8082     dnl Check for xmllint
8083     AC_PATH_PROG(XMLLINT, xmllint, no)
8084     if test "$XMLLINT" = "no"; then
8085         AC_MSG_ERROR([xmllint is required])
8086     fi
8087 else
8088     AC_MSG_RESULT([internal])
8089     SYSTEM_LIBXML=
8090     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
8091     if test "$COM" = "MSC"; then
8092         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8093     fi
8094     if test "$COM" = "MSC"; then
8095         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
8096     else
8097         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
8098     fi
8099     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8101 AC_SUBST(SYSTEM_LIBXML)
8102 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8103     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8105 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8106 AC_SUBST(LIBXML_CFLAGS)
8107 AC_SUBST(LIBXML_LIBS)
8108 AC_SUBST(XMLLINT)
8110 # =====================================================================
8111 # Checking for a Python interpreter with version >= 2.6.
8112 # Build and runtime requires Python 3 compatible version (>= 2.6).
8113 # Optionally user can pass an option to configure, i. e.
8114 # ./configure PYTHON=/usr/bin/python
8115 # =====================================================================
8116 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8117     # This allows a lack of system python with no error, we use internal one in that case.
8118     AM_PATH_PYTHON([2.6],, [:])
8119     # Clean PYTHON_VERSION checked below if cross-compiling
8120     PYTHON_VERSION=""
8121     if test "$PYTHON" != ":"; then
8122         PYTHON_FOR_BUILD=$PYTHON
8123     fi
8125 AC_SUBST(PYTHON_FOR_BUILD)
8127 # Checks for Python to use for Pyuno
8128 AC_MSG_CHECKING([which Python to use for Pyuno])
8129 case "$enable_python" in
8130 no|disable)
8131     if test -z $PYTHON_FOR_BUILD; then
8132         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8133         # requirement from the choice whether to include Python stuff in the installer, but why
8134         # bother?
8135         AC_MSG_ERROR([Python is required at build time.])
8136     fi
8137     enable_python=no
8138     AC_MSG_RESULT([none])
8139     ;;
8140 ""|yes|auto)
8141     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8142         AC_MSG_RESULT([no, overridden by --disable-scripting])
8143         enable_python=no
8144     elif test $build_os = cygwin; then
8145         dnl When building on Windows we don't attempt to use any installed
8146         dnl "system"  Python.
8147         AC_MSG_RESULT([fully internal])
8148         enable_python=internal
8149     elif test "$cross_compiling" = yes; then
8150         AC_MSG_RESULT([system])
8151         enable_python=system
8152     else
8153         # Unset variables set by the above AM_PATH_PYTHON so that
8154         # we actually do check anew.
8155         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
8156         AM_PATH_PYTHON([3.3],, [:])
8157         if test "$PYTHON" = ":"; then
8158             if test -z "$PYTHON_FOR_BUILD"; then
8159                 AC_MSG_RESULT([fully internal])
8160             else
8161                 AC_MSG_RESULT([internal])
8162             fi
8163             enable_python=internal
8164         else
8165             AC_MSG_RESULT([system])
8166             enable_python=system
8167         fi
8168     fi
8169     ;;
8170 internal)
8171     AC_MSG_RESULT([internal])
8172     ;;
8173 fully-internal)
8174     AC_MSG_RESULT([fully internal])
8175     enable_python=internal
8176     ;;
8177 system)
8178     AC_MSG_RESULT([system])
8179     ;;
8181     AC_MSG_ERROR([Incorrect --enable-python option])
8182     ;;
8183 esac
8185 if test $enable_python != no; then
8186     BUILD_TYPE="$BUILD_TYPE PYUNO"
8189 if test $enable_python = system; then
8190     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8191         python_version=2.7
8192         PYTHON=python$python_version
8193         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8194             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8195             PYTHON_LIBS="-framework Python"
8196         else
8197             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8198             PYTHON_LIBS="`$PYTHON-config --libs`"
8199         fi
8200     fi
8201     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8202         # Fallback: Accept these in the environment, or as set above
8203         # for MacOSX.
8204         :
8205     elif test "$cross_compiling" != yes; then
8206         # Unset variables set by the above AM_PATH_PYTHON so that
8207         # we actually do check anew.
8208         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
8209         # This causes an error if no python command is found
8210         AM_PATH_PYTHON([3.3])
8211         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8212         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8213         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8214         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8215         if test -z "$PKG_CONFIG"; then
8216             PYTHON_CFLAGS="-I$python_include"
8217             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8218         elif $PKG_CONFIG --exists python-$python_version; then
8219             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8220             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8221         else
8222             PYTHON_CFLAGS="-I$python_include"
8223             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8224         fi
8225         FilterLibs "${PYTHON_LIBS}"
8226         PYTHON_LIBS="${filteredlibs}"
8227     else
8228         dnl How to find out the cross-compilation Python installation path?
8229         AC_MSG_CHECKING([for python version])
8230         AS_IF([test -n "$PYTHON_VERSION"],
8231               [AC_MSG_RESULT([$PYTHON_VERSION])],
8232               [AC_MSG_RESULT([not found])
8233                AC_MSG_ERROR([no usable python found])])
8234         test -n "$PYTHON_CFLAGS" && break
8235     fi
8236     # let the PYTHON_FOR_BUILD match the same python installation that
8237     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8238     # better for PythonTests.
8239     PYTHON_FOR_BUILD=$PYTHON
8242 dnl By now enable_python should be "system", "internal" or "no"
8243 case $enable_python in
8244 system)
8245     SYSTEM_PYTHON=TRUE
8247     dnl Check if the headers really work
8248     save_CPPFLAGS="$CPPFLAGS"
8249     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8250     AC_CHECK_HEADER(Python.h, [],
8251        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8252        [])
8253     CPPFLAGS="$save_CPPFLAGS"
8255     AC_LANG_PUSH(C)
8256     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8257     AC_MSG_CHECKING([for correct python library version])
8258        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8259 #include <Python.h>
8261 int main(int argc, char **argv) {
8262    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8263        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8264    else return 1;
8266        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.6 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8267     CFLAGS=$save_CFLAGS
8268     AC_LANG_POP(C)
8270     dnl FIXME Check if the Python library can be linked with, too?
8271     ;;
8273 internal)
8274     SYSTEM_PYTHON=
8275     PYTHON_VERSION_MAJOR=3
8276     PYTHON_VERSION_MINOR=5
8277     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
8278     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8279     BUILD_TYPE="$BUILD_TYPE PYTHON"
8280     # Embedded Python dies without Home set
8281     if test "$HOME" = ""; then
8282         export HOME=""
8283     fi
8284     # bz2 tarball and bzip2 is not standard
8285     if test -z "$BZIP2"; then
8286         AC_PATH_PROG( BZIP2, bzip2)
8287         if test -z "$BZIP2"; then
8288             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8289         fi
8290     fi
8291     ;;
8293     DISABLE_PYTHON=TRUE
8294     SYSTEM_PYTHON=
8295     ;;
8297     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8298     ;;
8299 esac
8301 AC_SUBST(DISABLE_PYTHON)
8302 AC_SUBST(SYSTEM_PYTHON)
8303 AC_SUBST(PYTHON_CFLAGS)
8304 AC_SUBST(PYTHON_LIBS)
8305 AC_SUBST(PYTHON_VERSION)
8306 AC_SUBST(PYTHON_VERSION_MAJOR)
8307 AC_SUBST(PYTHON_VERSION_MINOR)
8309 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8310 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8311     AC_MSG_RESULT([yes])
8312     ENABLE_MARIADBC=TRUE
8313     MARIADBC_MAJOR=1
8314     MARIADBC_MINOR=0
8315     MARIADBC_MICRO=2
8316     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8317 else
8318     AC_MSG_RESULT([no])
8319     ENABLE_MARIADBC=
8321 AC_SUBST(ENABLE_MARIADBC)
8322 AC_SUBST(MARIADBC_MAJOR)
8323 AC_SUBST(MARIADBC_MINOR)
8324 AC_SUBST(MARIADBC_MICRO)
8326 if test "$ENABLE_MARIADBC" = "TRUE"; then
8328     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8330     dnl ===================================================================
8331     dnl Check for system MariaDB
8332     dnl ===================================================================
8333     AC_MSG_CHECKING([which MariaDB to use])
8334     if test "$with_system_mariadb" = "yes"; then
8335         AC_MSG_RESULT([external])
8336         SYSTEM_MARIADB=TRUE
8337         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8338         if test -z "$MARIADBCONFIG"; then
8339             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8340             if test -z "$MARIADBCONFIG"; then
8341                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8342                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8343             fi
8344         fi
8345         AC_MSG_CHECKING([MariaDB version])
8346         MARIADB_VERSION=`$MARIADBCONFIG --version`
8347         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8348         if test "$MARIADB_MAJOR" -ge "5"; then
8349             AC_MSG_RESULT([OK])
8350         else
8351             AC_MSG_ERROR([too old, use 5.0.x or later])
8352         fi
8353         AC_MSG_CHECKING([for MariaDB Client library])
8354         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8355         if test "$COM_IS_CLANG" = TRUE; then
8356             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8357         fi
8358         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8359         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8360         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8361         dnl linux32:
8362         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8363             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8364             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8365                 | sed -e 's|/lib64/|/lib/|')
8366         fi
8367         FilterLibs "${MARIADB_LIBS}"
8368         MARIADB_LIBS="${filteredlibs}"
8369         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8370         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8371         if test "$enable_bundle_mariadb" = "yes"; then
8372             AC_MSG_RESULT([yes])
8373             BUNDLE_MARIADB=TRUE
8374             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8376 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8378 /g' | grep -E '(mysqlclient|mariadb)')
8379             if test "$_os" = "Darwin"; then
8380                 LIBMARIADB=${LIBMARIADB}.dylib
8381             elif test "$_os" = "WINNT"; then
8382                 LIBMARIADB=${LIBMARIADB}.dll
8383             else
8384                 LIBMARIADB=${LIBMARIADB}.so
8385             fi
8386             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8387             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8388             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8389                 AC_MSG_RESULT([found.])
8390                 PathFormat "$LIBMARIADB_PATH"
8391                 LIBMARIADB_PATH="$formatted_path"
8392             else
8393                 AC_MSG_ERROR([not found.])
8394             fi
8395         else
8396             AC_MSG_RESULT([no])
8397             BUNDLE_MARIADB=
8398         fi
8399     else
8400         AC_MSG_RESULT([internal])
8401         SYSTEM_MARIADB=
8402         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8403         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8404         BUILD_TYPE="$BUILD_TYPE MARIADB"
8405     fi
8407     AC_SUBST(SYSTEM_MARIADB)
8408     AC_SUBST(MARIADB_CFLAGS)
8409     AC_SUBST(MARIADB_LIBS)
8410     AC_SUBST(LIBMARIADB)
8411     AC_SUBST(LIBMARIADB_PATH)
8412     AC_SUBST(BUNDLE_MARIADB)
8414     AC_LANG_PUSH([C++])
8415     dnl ===================================================================
8416     dnl Check for system MySQL C++ Connector
8417     dnl ===================================================================
8418     # FIXME!
8419     # who thought this too-generic cppconn dir was a good idea?
8420     AC_MSG_CHECKING([MySQL Connector/C++])
8421     if test "$with_system_mysql_cppconn" = "yes"; then
8422         AC_MSG_RESULT([external])
8423         SYSTEM_MYSQL_CPPCONN=TRUE
8424         AC_LANG_PUSH([C++])
8425         AC_CHECK_HEADER(mysql_driver.h, [],
8426                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8427         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8428                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8429         save_LIBS=$LIBS
8430         LIBS="$LIBS -lmysqlcppconn"
8431         AC_MSG_CHECKING([version])
8432         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8433 #include <mysql_driver.h>
8435 int main(int argc, char **argv) {
8436     sql::Driver *driver;
8437     driver = get_driver_instance();
8438     if (driver->getMajorVersion() > 1 || \
8439        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8440        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8441         return 0;
8442       else
8443         return 1;
8445       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[AC_MSG_ERROR([MySQL C++ Connecter not tested with cross-compilation])])
8447         AC_LANG_POP([C++])
8448         LIBS=$save_LIBS
8449     else
8450         AC_MSG_RESULT([internal])
8451         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8452         SYSTEM_MYSQL_CPPCONN=
8453     fi
8454     AC_LANG_POP([C++])
8456 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8458 dnl ===================================================================
8459 dnl Check for system hsqldb
8460 dnl ===================================================================
8461 if test "$with_java" != "no"; then
8462     HSQLDB_USE_JDBC_4_1=
8463     AC_MSG_CHECKING([which hsqldb to use])
8464     if test "$with_system_hsqldb" = "yes"; then
8465         AC_MSG_RESULT([external])
8466         SYSTEM_HSQLDB=TRUE
8467         if test -z $HSQLDB_JAR; then
8468             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8469         fi
8470         if ! test -f $HSQLDB_JAR; then
8471                AC_MSG_ERROR(hsqldb.jar not found.)
8472         fi
8473         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8474         export HSQLDB_JAR
8475         if $PERL -e \
8476            'use Archive::Zip;
8477             my $file = "$ENV{'HSQLDB_JAR'}";
8478             my $zip = Archive::Zip->new( $file );
8479             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8480             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8481             {
8482                 push @l, split(/\n/, $mf);
8483                 foreach my $line (@l)
8484                 {
8485                     if ($line =~ m/Specification-Version:/)
8486                     {
8487                         ($t, $version) = split (/:/,$line);
8488                         $version =~ s/^\s//;
8489                         ($a, $b, $c, $d) = split (/\./,$version);
8490                         if ($c == "0" && $d > "8")
8491                         {
8492                             exit 0;
8493                         }
8494                         else
8495                         {
8496                             exit 1;
8497                         }
8498                     }
8499                 }
8500             }
8501             else
8502             {
8503                 exit 1;
8504             }'; then
8505             AC_MSG_RESULT([yes])
8506         else
8507             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8508         fi
8509     else
8510         AC_MSG_RESULT([internal])
8511         SYSTEM_HSQLDB=
8512         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8513         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8514         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8515         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8516             AC_MSG_RESULT([yes])
8517             HSQLDB_USE_JDBC_4_1=TRUE
8518         else
8519             AC_MSG_RESULT([no])
8520         fi
8521     fi
8522     AC_SUBST(SYSTEM_HSQLDB)
8523     AC_SUBST(HSQLDB_JAR)
8524     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8527 dnl ===================================================================
8528 dnl Check for PostgreSQL stuff
8529 dnl ===================================================================
8530 if test "x$enable_postgresql_sdbc" != "xno"; then
8531     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8533     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8534         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8535     fi
8536     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8537         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8538     fi
8540     postgres_interface=""
8541     if test "$with_system_postgresql" = "yes"; then
8542         postgres_interface="external PostgreSQL"
8543         SYSTEM_POSTGRESQL=TRUE
8544         if test "$_os" = Darwin; then
8545             supp_path=''
8546             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8547                 pg_supp_path="$P_SEP$d$pg_supp_path"
8548             done
8549         fi
8550         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8551         if test -z "$PGCONFIG"; then
8552             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8553         fi
8554         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8555         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8556         FilterLibs "${POSTGRESQL_LIB}"
8557         POSTGRESQL_LIB="${filteredlibs}"
8558     else
8559         # if/when anything else than PostgreSQL uses Kerberos,
8560         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8561         WITH_KRB5=
8562         WITH_GSSAPI=
8563         case "$_os" in
8564         Darwin)
8565             # MacOS X has system MIT Kerberos 5 since 10.4
8566             if test "$with_krb5" != "no"; then
8567                 WITH_KRB5=TRUE
8568                 save_LIBS=$LIBS
8569                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8570                 # that the libraries where these functions are located on macOS will change, is it?
8571                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8572                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8573                 KRB5_LIBS=$LIBS
8574                 LIBS=$save_LIBS
8575                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8576                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8577                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8578                 LIBS=$save_LIBS
8579             fi
8580             if test "$with_gssapi" != "no"; then
8581                 WITH_GSSAPI=TRUE
8582                 save_LIBS=$LIBS
8583                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8584                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8585                 GSSAPI_LIBS=$LIBS
8586                 LIBS=$save_LIBS
8587             fi
8588             ;;
8589         WINNT)
8590             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8591                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8592             fi
8593             ;;
8594         Linux|GNU|*BSD|DragonFly)
8595             if test "$with_krb5" != "no"; then
8596                 WITH_KRB5=TRUE
8597                 save_LIBS=$LIBS
8598                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8599                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8600                 KRB5_LIBS=$LIBS
8601                 LIBS=$save_LIBS
8602                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8603                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8604                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8605                 LIBS=$save_LIBS
8606             fi
8607             if test "$with_gssapi" != "no"; then
8608                 WITH_GSSAPI=TRUE
8609                 save_LIBS=$LIBS
8610                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8611                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8612                 GSSAPI_LIBS=$LIBS
8613                 LIBS=$save_LIBS
8614             fi
8615             ;;
8616         *)
8617             if test "$with_krb5" = "yes"; then
8618                 WITH_KRB5=TRUE
8619                 save_LIBS=$LIBS
8620                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8621                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8622                 KRB5_LIBS=$LIBS
8623                 LIBS=$save_LIBS
8624                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8625                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8626                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8627                 LIBS=$save_LIBS
8628             fi
8629             if test "$with_gssapi" = "yes"; then
8630                 WITH_GSSAPI=TRUE
8631                 save_LIBS=$LIBS
8632                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8633                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8634                 LIBS=$save_LIBS
8635                 GSSAPI_LIBS=$LIBS
8636             fi
8637         esac
8639         if test -n "$with_libpq_path"; then
8640             SYSTEM_POSTGRESQL=TRUE
8641             postgres_interface="external libpq"
8642             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8643             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8644         else
8645             SYSTEM_POSTGRESQL=
8646             postgres_interface="internal"
8647             POSTGRESQL_LIB=""
8648             POSTGRESQL_INC="%OVERRIDE_ME%"
8649             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8650         fi
8651     fi
8653     AC_MSG_CHECKING([PostgreSQL C interface])
8654     AC_MSG_RESULT([$postgres_interface])
8656     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8657         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8658         save_CFLAGS=$CFLAGS
8659         save_CPPFLAGS=$CPPFLAGS
8660         save_LIBS=$LIBS
8661         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8662         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8663         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8664         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8665             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8666         CFLAGS=$save_CFLAGS
8667         CPPFLAGS=$save_CPPFLAGS
8668         LIBS=$save_LIBS
8669     fi
8670     BUILD_POSTGRESQL_SDBC=TRUE
8672 AC_SUBST(WITH_KRB5)
8673 AC_SUBST(WITH_GSSAPI)
8674 AC_SUBST(GSSAPI_LIBS)
8675 AC_SUBST(KRB5_LIBS)
8676 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8677 AC_SUBST(SYSTEM_POSTGRESQL)
8678 AC_SUBST(POSTGRESQL_INC)
8679 AC_SUBST(POSTGRESQL_LIB)
8681 dnl ===================================================================
8682 dnl Check for Firebird stuff
8683 dnl ===================================================================
8684 ENABLE_FIREBIRD_SDBC=""
8685 if test "$enable_firebird_sdbc" = "yes" ; then
8686     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8688     dnl ===================================================================
8689     dnl Check for system Firebird
8690     dnl ===================================================================
8691     AC_MSG_CHECKING([which Firebird to use])
8692     if test "$with_system_firebird" = "yes"; then
8693         AC_MSG_RESULT([external])
8694         SYSTEM_FIREBIRD=TRUE
8695         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8696         if test -z "$FIREBIRDCONFIG"; then
8697             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8698             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8699                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8700             ])
8701             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8702         else
8703             AC_MSG_NOTICE([fb_config found])
8704             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8705             AC_MSG_CHECKING([for Firebird Client library])
8706             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8707             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8708             FilterLibs "${FIREBIRD_LIBS}"
8709             FIREBIRD_LIBS="${filteredlibs}"
8710         fi
8711         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8712         AC_MSG_CHECKING([Firebird version])
8713         if test -n "${FIREBIRD_VERSION}"; then
8714             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8715             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8716             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8717                 AC_MSG_RESULT([OK])
8718             else
8719                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8720             fi
8721         else
8722             __save_CFLAGS="${CFLAGS}"
8723             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8724             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8725 #if defined(FB_API_VER) && FB_API_VER == 30
8726 int fb_api_is_30(void) { return 0; }
8727 #else
8728 #error "Wrong Firebird API version"
8729 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8730             CFLAGS="${__save_CFLAGS}"
8731         fi
8732         ENABLE_FIREBIRD_SDBC="TRUE"
8733     elif test "$enable_database_connectivity" != yes; then
8734         AC_MSG_RESULT([none])
8735     elif test "$cross_compiling" = "yes"; then
8736         AC_MSG_RESULT([none])
8737     else
8738         dnl Embedded Firebird has version 3.0
8739         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8740         dnl We need libatomic-ops for any non X86/X64 system
8741         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8742             dnl ===================================================================
8743             dnl Check for system libatomic-ops
8744             dnl ===================================================================
8745             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8746             if test "$with_system_libatomic_ops" = "yes"; then
8747                 SYSTEM_LIBATOMIC_OPS=TRUE
8748                 AC_CHECK_HEADERS(atomic_ops.h, [],
8749                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8750             else
8751                 SYSTEM_LIBATOMIC_OPS=
8752                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8753                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8754                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8755             fi
8756         fi
8758         AC_MSG_RESULT([internal])
8759         SYSTEM_FIREBIRD=
8760         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8761         FIREBIRD_LIBS="-lfbclient"
8763         if test "$with_system_libtommath" = "yes"; then
8764             SYSTEM_LIBTOMMATH=TRUE
8765             dnl check for tommath presence
8766             save_LIBS=$LIBS
8767             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8768             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8769             LIBS=$save_LIBS
8770         else
8771             SYSTEM_LIBTOMMATH=
8772             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8773             LIBTOMMATH_LIBS="-ltommath"
8774             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8775         fi
8777         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8778         ENABLE_FIREBIRD_SDBC="TRUE"
8779     fi
8781 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8782 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8783 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8784 AC_SUBST(LIBATOMIC_OPS_LIBS)
8785 AC_SUBST(SYSTEM_FIREBIRD)
8786 AC_SUBST(FIREBIRD_CFLAGS)
8787 AC_SUBST(FIREBIRD_LIBS)
8788 AC_SUBST([TOMMATH_CFLAGS])
8789 AC_SUBST([TOMMATH_LIBS])
8791 dnl ===================================================================
8792 dnl Check for system curl
8793 dnl ===================================================================
8794 AC_MSG_CHECKING([which libcurl to use])
8795 if test "$with_system_curl" = "auto"; then
8796     with_system_curl="$with_system_libs"
8799 if test "$with_system_curl" = "yes"; then
8800     AC_MSG_RESULT([external])
8801     SYSTEM_CURL=TRUE
8803     # First try PKGCONFIG and then fall back
8804     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8806     if test -n "$CURL_PKG_ERRORS"; then
8807         AC_PATH_PROG(CURLCONFIG, curl-config)
8808         if test -z "$CURLCONFIG"; then
8809             AC_MSG_ERROR([curl development files not found])
8810         fi
8811         CURL_LIBS=`$CURLCONFIG --libs`
8812         FilterLibs "${CURL_LIBS}"
8813         CURL_LIBS="${filteredlibs}"
8814         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8815         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8817         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8818         case $curl_version in
8819         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8820         dnl so they need to be doubled to end up in the configure script
8821         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8822             AC_MSG_RESULT([yes])
8823             ;;
8824         *)
8825             AC_MSG_ERROR([no, you have $curl_version])
8826             ;;
8827         esac
8828     fi
8830     ENABLE_CURL=TRUE
8831 elif test $_os = iOS; then
8832     # Let's see if we need curl, I think not?
8833     AC_MSG_RESULT([none])
8834     ENABLE_CURL=
8835 else
8836     AC_MSG_RESULT([internal])
8837     SYSTEM_CURL=
8838     BUILD_TYPE="$BUILD_TYPE CURL"
8839     ENABLE_CURL=TRUE
8841 AC_SUBST(SYSTEM_CURL)
8842 AC_SUBST(CURL_CFLAGS)
8843 AC_SUBST(CURL_LIBS)
8844 AC_SUBST(ENABLE_CURL)
8846 dnl ===================================================================
8847 dnl Check for system boost
8848 dnl ===================================================================
8849 AC_MSG_CHECKING([which boost to use])
8850 if test "$with_system_boost" = "yes"; then
8851     AC_MSG_RESULT([external])
8852     SYSTEM_BOOST=TRUE
8853     AX_BOOST_BASE(1.47)
8854     AX_BOOST_DATE_TIME
8855     AX_BOOST_FILESYSTEM
8856     AX_BOOST_IOSTREAMS
8857     AX_BOOST_LOCALE
8858     AC_LANG_PUSH([C++])
8859     save_CXXFLAGS=$CXXFLAGS
8860     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8861     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8862        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8863     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8864        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8865     CXXFLAGS=$save_CXXFLAGS
8866     AC_LANG_POP([C++])
8867     # this is in m4/ax_boost_base.m4
8868     FilterLibs "${BOOST_LDFLAGS}"
8869     BOOST_LDFLAGS="${filteredlibs}"
8870 else
8871     AC_MSG_RESULT([internal])
8872     BUILD_TYPE="$BUILD_TYPE BOOST"
8873     SYSTEM_BOOST=
8874     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8875         # use warning-suppressing wrapper headers
8876         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8877     else
8878         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8879     fi
8881 AC_SUBST(SYSTEM_BOOST)
8883 dnl ===================================================================
8884 dnl Check for system mdds
8885 dnl ===================================================================
8886 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8888 dnl ===================================================================
8889 dnl Check for system glm
8890 dnl ===================================================================
8891 AC_MSG_CHECKING([which glm to use])
8892 if test "$with_system_glm" = "yes"; then
8893     AC_MSG_RESULT([external])
8894     SYSTEM_GLM=TRUE
8895     AC_LANG_PUSH([C++])
8896     AC_CHECK_HEADER([glm/glm.hpp], [],
8897        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8898     AC_LANG_POP([C++])
8899 else
8900     AC_MSG_RESULT([internal])
8901     BUILD_TYPE="$BUILD_TYPE GLM"
8902     SYSTEM_GLM=
8903     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8905 AC_SUBST([GLM_CFLAGS])
8906 AC_SUBST([SYSTEM_GLM])
8908 dnl ===================================================================
8909 dnl Check for system odbc
8910 dnl ===================================================================
8911 AC_MSG_CHECKING([which odbc headers to use])
8912 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
8913     AC_MSG_RESULT([external])
8914     SYSTEM_ODBC_HEADERS=TRUE
8916     if test "$build_os" = "cygwin"; then
8917         save_CPPFLAGS=$CPPFLAGS
8918         find_winsdk
8919         PathFormat "$winsdktest"
8920         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"
8921         AC_CHECK_HEADER(sqlext.h, [],
8922             [AC_MSG_ERROR(odbc not found. install odbc)],
8923             [#include <windows.h>])
8924         CPPFLAGS=$save_CPPFLAGS
8925     else
8926         AC_CHECK_HEADER(sqlext.h, [],
8927             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8928     fi
8929 elif test "$enable_database_connectivity" != yes; then
8930     AC_MSG_RESULT([none])
8931 else
8932     AC_MSG_RESULT([internal])
8933     SYSTEM_ODBC_HEADERS=
8935 AC_SUBST(SYSTEM_ODBC_HEADERS)
8938 dnl ===================================================================
8939 dnl Check for system openldap
8940 dnl ===================================================================
8942 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8943 AC_MSG_CHECKING([which openldap library to use])
8944 if test "$with_system_openldap" = "yes"; then
8945     AC_MSG_RESULT([external])
8946     SYSTEM_OPENLDAP=TRUE
8947     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8948     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8949     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8950 else
8951     AC_MSG_RESULT([internal])
8952     SYSTEM_OPENLDAP=
8953     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8956 AC_SUBST(SYSTEM_OPENLDAP)
8958 dnl ===================================================================
8959 dnl Check for system NSS
8960 dnl ===================================================================
8961 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
8962     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8963     AC_DEFINE(HAVE_FEATURE_NSS)
8964     ENABLE_NSS="TRUE"
8965     AC_DEFINE(ENABLE_NSS)
8966 else
8967     with_tls=openssl
8969 AC_SUBST(ENABLE_NSS)
8971 dnl ===================================================================
8972 dnl Check for TLS/SSL and cryptographic implementation to use
8973 dnl ===================================================================
8974 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8975 if test -n "$with_tls"; then
8976     case $with_tls in
8977     openssl)
8978         AC_DEFINE(USE_TLS_OPENSSL)
8979         TLS=OPENSSL
8981         if test "$enable_openssl" != "yes"; then
8982             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8983         fi
8985         # warn that OpenSSL has been selected but not all TLS code has this option
8986         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8987         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8988         ;;
8989     nss)
8990         AC_DEFINE(USE_TLS_NSS)
8991         TLS=NSS
8992         ;;
8993     *)
8994         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8995 openssl - OpenSSL
8996 nss - Mozilla's Network Security Services (NSS)
8997     ])
8998         ;;
8999     esac
9000 else
9001     # default to using NSS, it results in smaller oox lib
9002     AC_DEFINE(USE_TLS_NSS)
9003     TLS=NSS
9005 AC_MSG_RESULT([$TLS])
9006 AC_SUBST(TLS)
9008 dnl ===================================================================
9009 dnl Check for system sane
9010 dnl ===================================================================
9011 AC_MSG_CHECKING([which sane header to use])
9012 if test "$with_system_sane" = "yes"; then
9013     AC_MSG_RESULT([external])
9014     AC_CHECK_HEADER(sane/sane.h, [],
9015       [AC_MSG_ERROR(sane not found. install sane)], [])
9016 else
9017     AC_MSG_RESULT([internal])
9018     BUILD_TYPE="$BUILD_TYPE SANE"
9021 dnl ===================================================================
9022 dnl Check for system icu
9023 dnl ===================================================================
9024 SYSTEM_GENBRK=
9025 SYSTEM_GENCCODE=
9026 SYSTEM_GENCMN=
9028 ICU_MAJOR=58
9029 ICU_MINOR=1
9030 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9031 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9032 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9033 AC_MSG_CHECKING([which icu to use])
9034 if test "$with_system_icu" = "yes"; then
9035     AC_MSG_RESULT([external])
9036     SYSTEM_ICU=TRUE
9037     AC_LANG_PUSH([C++])
9038     AC_MSG_CHECKING([for unicode/rbbi.h])
9039     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9040     AC_LANG_POP([C++])
9042     if test "$cross_compiling" != "yes"; then
9043         AC_PATH_PROG(ICUCONFIG,icu-config)
9045         AC_MSG_CHECKING([ICU version])
9046         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9047         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9048         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9050         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "6" \); then
9051             AC_MSG_RESULT([OK, $ICU_VERSION])
9052         else
9053             AC_MSG_ERROR([not suitable, only >= 4.6 supported currently])
9054         fi
9055     fi
9057     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9058         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9059         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9060         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9061         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9062         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9063         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9064             AC_MSG_RESULT([yes])
9065         else
9066             AC_MSG_RESULT([no])
9067             if test "$with_system_icu_for_build" != "force"; then
9068                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9069 You can use --with-system-icu-for-build=force to use it anyway.])
9070             fi
9071         fi
9072     fi
9074     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9075         # using the system icu tools can lead to version confusion, use the
9076         # ones from the build environment when cross-compiling
9077         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9078         if test -z "$SYSTEM_GENBRK"; then
9079             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9080         fi
9081         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9082         if test -z "$SYSTEM_GENCCODE"; then
9083             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9084         fi
9085         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9086         if test -z "$SYSTEM_GENCMN"; then
9087             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9088         fi
9089         if test "$ICU_MAJOR" -ge "49"; then
9090             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9091             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9092             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9093         else
9094             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9095             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9096             ICU_RECLASSIFIED_HEBREW_LETTER=
9097         fi
9098     fi
9100     if test "$cross_compiling" = "yes"; then
9101         if test "$ICU_MAJOR" -ge "50"; then
9102             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9103             ICU_MINOR=""
9104         fi
9105     fi
9106 else
9107     AC_MSG_RESULT([internal])
9108     SYSTEM_ICU=
9109     BUILD_TYPE="$BUILD_TYPE ICU"
9110     # surprisingly set these only for "internal" (to be used by various other
9111     # external libs): the system icu-config is quite unhelpful and spits out
9112     # dozens of weird flags and also default path -I/usr/include
9113     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9114     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9116 if test "$ICU_MAJOR" -ge "59"; then
9117     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9118     # with -std=c++11 but not all external libraries can be built with that,
9119     # for those use a bit-compatible typedef uint16_t UChar; see
9120     # icu/source/common/unicode/umachine.h
9121     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9122 else
9123     ICU_UCHAR_TYPE=""
9125 AC_SUBST(SYSTEM_ICU)
9126 AC_SUBST(SYSTEM_GENBRK)
9127 AC_SUBST(SYSTEM_GENCCODE)
9128 AC_SUBST(SYSTEM_GENCMN)
9129 AC_SUBST(ICU_MAJOR)
9130 AC_SUBST(ICU_MINOR)
9131 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9132 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9133 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9134 AC_SUBST(ICU_CFLAGS)
9135 AC_SUBST(ICU_LIBS)
9136 AC_SUBST(ICU_UCHAR_TYPE)
9138 dnl ==================================================================
9139 dnl Breakpad
9140 dnl ==================================================================
9141 AC_MSG_CHECKING([whether to enable breakpad])
9142 if test "$enable_breakpad" != yes; then
9143     AC_MSG_RESULT([no])
9144 else
9145     AC_MSG_RESULT([yes])
9146     ENABLE_BREAKPAD="TRUE"
9147     AC_DEFINE(ENABLE_BREAKPAD)
9148     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9149     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9151     AC_MSG_CHECKING([for crashreport config])
9152     if test "$with_symbol_config" = "no"; then
9153         BREAKPAD_SYMBOL_CONFIG="invalid"
9154         AC_MSG_RESULT([no])
9155     else
9156         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9157         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9158         AC_MSG_RESULT([yes])
9159     fi
9160     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9162 AC_SUBST(ENABLE_BREAKPAD)
9164 dnl ==================================================================
9165 dnl libfuzzer
9166 dnl ==================================================================
9167 AC_MSG_CHECKING([whether to enable fuzzers])
9168 if test "$enable_fuzzers" != yes; then
9169     AC_MSG_RESULT([no])
9170 else
9171     AC_MSG_RESULT([yes])
9172     ENABLE_FUZZERS="TRUE"
9173     AC_DEFINE(ENABLE_FUZZERS)
9174     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9176 AC_SUBST(ENABLE_FUZZERS)
9178 dnl ===================================================================
9179 dnl Orcus
9180 dnl ===================================================================
9181 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.12 >= 0.12.0])
9182 if test "$with_system_orcus" != "yes"; then
9183     if test "$SYSTEM_BOOST" = "TRUE"; then
9184         # ===========================================================
9185         # Determine if we are going to need to link with Boost.System
9186         # ===========================================================
9187         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9188         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9189         dnl in documentation has no effect.
9190         AC_MSG_CHECKING([if we need to link with Boost.System])
9191         AC_LANG_PUSH([C++])
9192         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9193                 @%:@include <boost/version.hpp>
9194             ]],[[
9195                 #if BOOST_VERSION >= 105000
9196                 #   error yes, we need to link with Boost.System
9197                 #endif
9198             ]])],[
9199                 AC_MSG_RESULT([no])
9200             ],[
9201                 AC_MSG_RESULT([yes])
9202                 AX_BOOST_SYSTEM
9203         ])
9204         AC_LANG_POP([C++])
9205     fi
9207 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9208 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9209 AC_SUBST([BOOST_SYSTEM_LIB])
9210 AC_SUBST(SYSTEM_LIBORCUS)
9212 dnl ===================================================================
9213 dnl HarfBuzz
9214 dnl ===================================================================
9215 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9216                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9217                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9219 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9220                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9221                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9223 if test "$COM" = "MSC"; then # override the above
9224     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9225     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9228 if test "$with_system_harfbuzz" = "yes"; then
9229     if test "$with_system_graphite" = "no"; then
9230         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9231     fi
9232     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9233     _save_libs="$LIBS"
9234     _save_cflags="$CFLAGS"
9235     LIBS="$LIBS $HARFBUZZ_LIBS"
9236     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9237     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9238     LIBS="$_save_libs"
9239     CFLAGS="$_save_cflags"
9240 else
9241     if test "$with_system_graphite" = "yes"; then
9242         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9243     fi
9246 AC_MSG_CHECKING([whether to use X11])
9247 dnl ***************************************
9248 dnl testing for X libraries and includes...
9249 dnl ***************************************
9250 if test "$USING_X11" = TRUE; then
9251     AC_DEFINE(HAVE_FEATURE_X11)
9253 AC_MSG_RESULT([$USING_X11])
9255 if test "$USING_X11" = TRUE; then
9256     AC_PATH_X
9257     AC_PATH_XTRA
9258     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9260     if test -z "$x_includes"; then
9261         x_includes="default_x_includes"
9262     fi
9263     if test -z "$x_libraries"; then
9264         x_libraries="default_x_libraries"
9265     fi
9266     CFLAGS="$CFLAGS $X_CFLAGS"
9267     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9268     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9269 else
9270     x_includes="no_x_includes"
9271     x_libraries="no_x_libraries"
9274 if test "$USING_X11" = TRUE; then
9275     dnl ===================================================================
9276     dnl Check for Composite.h for Mozilla plugin
9277     dnl ===================================================================
9278     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9279      [#include <X11/Intrinsic.h>])
9281     dnl ===================================================================
9282     dnl Check for extension headers
9283     dnl ===================================================================
9284     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9285      [#include <X11/extensions/shape.h>])
9287     # vcl needs ICE and SM
9288     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9289     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9290         [AC_MSG_ERROR(ICE library not found)])
9291     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9292     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9293         [AC_MSG_ERROR(SM library not found)])
9296 dnl ===================================================================
9297 dnl Check for system Xrender
9298 dnl ===================================================================
9299 AC_MSG_CHECKING([whether to use Xrender])
9300 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9301     AC_MSG_RESULT([yes])
9302     PKG_CHECK_MODULES(XRENDER, xrender)
9303     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9304     FilterLibs "${XRENDER_LIBS}"
9305     XRENDER_LIBS="${filteredlibs}"
9306     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9307       [AC_MSG_ERROR(libXrender not found or functional)], [])
9308     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9309       [AC_MSG_ERROR(Xrender not found. install X)], [])
9310 else
9311     AC_MSG_RESULT([no])
9313 AC_SUBST(XRENDER_CFLAGS)
9314 AC_SUBST(XRENDER_LIBS)
9316 dnl ===================================================================
9317 dnl Check for XRandr
9318 dnl ===================================================================
9319 AC_MSG_CHECKING([whether to enable RandR support])
9320 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9321     AC_MSG_RESULT([yes])
9322     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9323     if test "$ENABLE_RANDR" != "TRUE"; then
9324         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9325                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9326         XRANDR_CFLAGS=" "
9327         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9328           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9329         XRANDR_LIBS="-lXrandr "
9330         ENABLE_RANDR="TRUE"
9331     fi
9332     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9333     FilterLibs "${XRANDR_LIBS}"
9334     XRANDR_LIBS="${filteredlibs}"
9335 else
9336     ENABLE_RANDR=""
9337     AC_MSG_RESULT([no])
9339 AC_SUBST(XRANDR_CFLAGS)
9340 AC_SUBST(XRANDR_LIBS)
9341 AC_SUBST(ENABLE_RANDR)
9343 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9344     WITH_WEBDAV="serf"
9346 if test $_os = iOS -o $_os = Android; then
9347     WITH_WEBDAV="no"
9349 AC_MSG_CHECKING([for webdav library])
9350 case "$WITH_WEBDAV" in
9351 serf)
9352     AC_MSG_RESULT([serf])
9353     # Check for system apr-util
9354     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9355                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9356                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9357     if test "$COM" = "MSC"; then
9358         APR_LIB_DIR="LibR"
9359         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9360         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9361     fi
9363     # Check for system serf
9364     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9365                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9366     if test "$COM" = "MSC"; then
9367         SERF_LIB_DIR="Release"
9368         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9369         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9370     fi
9371     ;;
9372 neon)
9373     AC_MSG_RESULT([neon])
9374     # Check for system neon
9375     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9376     if test "$with_system_neon" = "yes"; then
9377         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9378     else
9379         NEON_VERSION=0295
9380     fi
9381     AC_SUBST(NEON_VERSION)
9382     ;;
9384     AC_MSG_RESULT([none, disabled])
9385     WITH_WEBDAV=""
9386     ;;
9387 esac
9388 AC_SUBST(WITH_WEBDAV)
9390 dnl ===================================================================
9391 dnl Check for disabling cve_tests
9392 dnl ===================================================================
9393 AC_MSG_CHECKING([whether to execute CVE tests])
9394 # If not explicitly enabled or disabled, default
9395 if test -z "$enable_cve_tests"; then
9396     case "$OS" in
9397     WNT)
9398         # Default cves off for windows with its wild and wonderful
9399         # varienty of AV software kicking in and panicing
9400         enable_cve_tests=no
9401         ;;
9402     *)
9403         # otherwise yes
9404         enable_cve_tests=yes
9405         ;;
9406     esac
9408 if test "$enable_cve_tests" = "no"; then
9409     AC_MSG_RESULT([no])
9410     DISABLE_CVE_TESTS=TRUE
9411     AC_SUBST(DISABLE_CVE_TESTS)
9412 else
9413     AC_MSG_RESULT([yes])
9416 dnl ===================================================================
9417 dnl Check for enabling chart XShape tests
9418 dnl ===================================================================
9419 AC_MSG_CHECKING([whether to execute chart XShape tests])
9420 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9421     AC_MSG_RESULT([yes])
9422     ENABLE_CHART_TESTS=TRUE
9423     AC_SUBST(ENABLE_CHART_TESTS)
9424 else
9425     AC_MSG_RESULT([no])
9428 dnl ===================================================================
9429 dnl Check for system openssl
9430 dnl ===================================================================
9431 DISABLE_OPENSSL=
9432 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9433 if test "$enable_openssl" = "yes"; then
9434     AC_MSG_RESULT([no])
9435     if test "$_os" = Darwin ; then
9436         # OpenSSL is deprecated when building for 10.7 or later.
9437         #
9438         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9439         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9441         with_system_openssl=no
9442         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9443     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9444             && test "$with_system_openssl" != "no"; then
9445         with_system_openssl=yes
9446         SYSTEM_OPENSSL=TRUE
9447         OPENSSL_CFLAGS=
9448         OPENSSL_LIBS="-lssl -lcrypto"
9449     else
9450         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9451     fi
9452     if test "$with_system_openssl" = "yes"; then
9453         AC_MSG_CHECKING([whether openssl supports SHA512])
9454         AC_LANG_PUSH([C])
9455         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9456             SHA512_CTX context;
9457 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9458         AC_LANG_POP(C)
9459     fi
9460 else
9461     AC_MSG_RESULT([yes])
9462     DISABLE_OPENSSL=TRUE
9464     # warn that although OpenSSL is disabled, system libraries may depend on it
9465     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9466     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9469 AC_SUBST([DISABLE_OPENSSL])
9471 dnl ===================================================================
9472 dnl Check for building gnutls
9473 dnl ===================================================================
9474 AC_MSG_CHECKING([whether to use gnutls])
9475 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9476     AC_MSG_RESULT([yes])
9477     AM_PATH_LIBGCRYPT()
9478     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9479         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9480                       available in the system to use as replacement.]]))
9481     FilterLibs "${LIBGCRYPT_LIBS}"
9482     LIBGCRYPT_LIBS="${filteredlibs}"
9483 else
9484     AC_MSG_RESULT([no])
9487 AC_SUBST([LIBGCRYPT_CFLAGS])
9488 AC_SUBST([LIBGCRYPT_LIBS])
9490 dnl ===================================================================
9491 dnl Check for system redland
9492 dnl ===================================================================
9493 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9494 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9495 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9496 if test "$with_system_redland" = "yes"; then
9497     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9498             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9499 else
9500     RAPTOR_MAJOR="0"
9501     RASQAL_MAJOR="3"
9502     REDLAND_MAJOR="0"
9504 AC_SUBST(RAPTOR_MAJOR)
9505 AC_SUBST(RASQAL_MAJOR)
9506 AC_SUBST(REDLAND_MAJOR)
9508 dnl ===================================================================
9509 dnl Check for system hunspell
9510 dnl ===================================================================
9511 AC_MSG_CHECKING([which libhunspell to use])
9512 if test "$with_system_hunspell" = "yes"; then
9513     AC_MSG_RESULT([external])
9514     SYSTEM_HUNSPELL=TRUE
9515     AC_LANG_PUSH([C++])
9516     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9517     if test "$HUNSPELL_PC" != "TRUE"; then
9518         AC_CHECK_HEADER(hunspell.hxx, [],
9519             [
9520             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9521             [AC_MSG_ERROR(hunspell headers not found.)], [])
9522             ], [])
9523         AC_CHECK_LIB([hunspell], [main], [:],
9524            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9525         HUNSPELL_LIBS=-lhunspell
9526     fi
9527     AC_LANG_POP([C++])
9528     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9529     FilterLibs "${HUNSPELL_LIBS}"
9530     HUNSPELL_LIBS="${filteredlibs}"
9531 else
9532     AC_MSG_RESULT([internal])
9533     SYSTEM_HUNSPELL=
9534     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9535     if test "$COM" = "MSC"; then
9536         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9537     else
9538         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9539     fi
9540     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9542 AC_SUBST(SYSTEM_HUNSPELL)
9543 AC_SUBST(HUNSPELL_CFLAGS)
9544 AC_SUBST(HUNSPELL_LIBS)
9546 dnl ===================================================================
9547 dnl Checking for altlinuxhyph
9548 dnl ===================================================================
9549 AC_MSG_CHECKING([which altlinuxhyph to use])
9550 if test "$with_system_altlinuxhyph" = "yes"; then
9551     AC_MSG_RESULT([external])
9552     SYSTEM_HYPH=TRUE
9553     AC_CHECK_HEADER(hyphen.h, [],
9554        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9555     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9556        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9557        [#include <hyphen.h>])
9558     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9559         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9560     if test -z "$HYPHEN_LIB"; then
9561         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9562            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9563     fi
9564     if test -z "$HYPHEN_LIB"; then
9565         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9566            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9567     fi
9568 else
9569     AC_MSG_RESULT([internal])
9570     SYSTEM_HYPH=
9571     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9572     if test "$COM" = "MSC"; then
9573         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9574     else
9575         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9576     fi
9578 AC_SUBST(SYSTEM_HYPH)
9579 AC_SUBST(HYPHEN_LIB)
9581 dnl ===================================================================
9582 dnl Checking for mythes
9583 dnl ===================================================================
9584 AC_MSG_CHECKING([which mythes to use])
9585 if test "$with_system_mythes" = "yes"; then
9586     AC_MSG_RESULT([external])
9587     SYSTEM_MYTHES=TRUE
9588     AC_LANG_PUSH([C++])
9589     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9590     if test "$MYTHES_PKGCONFIG" = "no"; then
9591         AC_CHECK_HEADER(mythes.hxx, [],
9592             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9593         AC_CHECK_LIB([mythes-1.2], [main], [:],
9594             [ MYTHES_FOUND=no], [])
9595     if test "$MYTHES_FOUND" = "no"; then
9596         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9597                 [ MYTHES_FOUND=no], [])
9598     fi
9599     if test "$MYTHES_FOUND" = "no"; then
9600         AC_MSG_ERROR([mythes library not found!.])
9601     fi
9602     fi
9603     AC_LANG_POP([C++])
9604     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9605     FilterLibs "${MYTHES_LIBS}"
9606     MYTHES_LIBS="${filteredlibs}"
9607 else
9608     AC_MSG_RESULT([internal])
9609     SYSTEM_MYTHES=
9610     BUILD_TYPE="$BUILD_TYPE MYTHES"
9611     if test "$COM" = "MSC"; then
9612         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9613     else
9614         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9615     fi
9617 AC_SUBST(SYSTEM_MYTHES)
9618 AC_SUBST(MYTHES_CFLAGS)
9619 AC_SUBST(MYTHES_LIBS)
9621 dnl ===================================================================
9622 dnl How should we build the linear programming solver ?
9623 dnl ===================================================================
9625 ENABLE_COINMP=
9626 AC_MSG_CHECKING([whether to build with CoinMP])
9627 if test "$enable_coinmp" != "no"; then
9628     ENABLE_COINMP=TRUE
9629     AC_MSG_RESULT([yes])
9630     if test "$with_system_coinmp" = "yes"; then
9631         SYSTEM_COINMP=TRUE
9632         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9633         FilterLibs "${COINMP_LIBS}"
9634         COINMP_LIBS="${filteredlibs}"
9635     else
9636         BUILD_TYPE="$BUILD_TYPE COINMP"
9637     fi
9638 else
9639     AC_MSG_RESULT([no])
9641 AC_SUBST(ENABLE_COINMP)
9642 AC_SUBST(SYSTEM_COINMP)
9643 AC_SUBST(COINMP_CFLAGS)
9644 AC_SUBST(COINMP_LIBS)
9646 ENABLE_LPSOLVE=
9647 AC_MSG_CHECKING([whether to build with lpsolve])
9648 if test "$enable_lpsolve" != "no"; then
9649     ENABLE_LPSOLVE=TRUE
9650     AC_MSG_RESULT([yes])
9651 else
9652     AC_MSG_RESULT([no])
9654 AC_SUBST(ENABLE_LPSOLVE)
9656 if test "$ENABLE_LPSOLVE" = TRUE; then
9657     AC_MSG_CHECKING([which lpsolve to use])
9658     if test "$with_system_lpsolve" = "yes"; then
9659         AC_MSG_RESULT([external])
9660         SYSTEM_LPSOLVE=TRUE
9661         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9662            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9663         save_LIBS=$LIBS
9664         # some systems need this. Like Ubuntu....
9665         AC_CHECK_LIB(m, floor)
9666         AC_CHECK_LIB(dl, dlopen)
9667         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9668             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9669         LIBS=$save_LIBS
9670     else
9671         AC_MSG_RESULT([internal])
9672         SYSTEM_LPSOLVE=
9673         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9674     fi
9676 AC_SUBST(SYSTEM_LPSOLVE)
9678 dnl ===================================================================
9679 dnl Checking for libexttextcat
9680 dnl ===================================================================
9681 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9682 if test "$with_system_libexttextcat" = "yes"; then
9683     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9685 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9687 dnl ***************************************
9688 dnl testing libc version for Linux...
9689 dnl ***************************************
9690 if test "$_os" = "Linux"; then
9691     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9692     exec 6>/dev/null # no output
9693     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9694     exec 6>&1 # output on again
9695     if test "$HAVE_LIBC"; then
9696         AC_MSG_RESULT([yes])
9697     else
9698         AC_MSG_ERROR([no, upgrade libc])
9699     fi
9702 dnl =========================================
9703 dnl Check for uuidgen
9704 dnl =========================================
9705 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9706     # presence is already tested above in the WINDOWS_SDK_HOME check
9707     UUIDGEN=uuidgen.exe
9708     AC_SUBST(UUIDGEN)
9709 else
9710     AC_PATH_PROG([UUIDGEN], [uuidgen])
9711     if test -z "$UUIDGEN"; then
9712         AC_MSG_WARN([uuid is needed for building installation sets])
9713     fi
9716 dnl ***************************************
9717 dnl Checking for bison and flex
9718 dnl ***************************************
9719 AC_PATH_PROG(BISON, bison)
9720 if test -z "$BISON"; then
9721     AC_MSG_ERROR([no bison found in \$PATH, install it])
9722 else
9723     AC_MSG_CHECKING([the bison version])
9724     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9725     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9726     # Accept newer than 2.0
9727     if test "$_bison_longver" -lt 2000; then
9728         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9729     fi
9732 AC_PATH_PROG(FLEX, flex)
9733 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9734     FLEX=`cygpath -m $FLEX`
9736 if test -z "$FLEX"; then
9737     AC_MSG_ERROR([no flex found in \$PATH, install it])
9738 else
9739     AC_MSG_CHECKING([the flex version])
9740     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9741     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9742         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9743     fi
9745 AC_SUBST([FLEX])
9746 dnl ***************************************
9747 dnl Checking for patch
9748 dnl ***************************************
9749 AC_PATH_PROG(PATCH, patch)
9750 if test -z "$PATCH"; then
9751     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9754 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9755 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9756     if test -z "$with_gnu_patch"; then
9757         GNUPATCH=$PATCH
9758     else
9759         if test -x "$with_gnu_patch"; then
9760             GNUPATCH=$with_gnu_patch
9761         else
9762             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9763         fi
9764     fi
9766     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9767     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9768         AC_MSG_RESULT([yes])
9769     else
9770         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9771     fi
9772 else
9773     GNUPATCH=$PATCH
9776 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9777     GNUPATCH=`cygpath -m $GNUPATCH`
9780 dnl We also need to check for --with-gnu-cp
9782 if test -z "$with_gnu_cp"; then
9783     # check the place where the good stuff is hidden on Solaris...
9784     if test -x /usr/gnu/bin/cp; then
9785         GNUCP=/usr/gnu/bin/cp
9786     else
9787         AC_PATH_PROGS(GNUCP, gnucp cp)
9788     fi
9789     if test -z $GNUCP; then
9790         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9791     fi
9792 else
9793     if test -x "$with_gnu_cp"; then
9794         GNUCP=$with_gnu_cp
9795     else
9796         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9797     fi
9800 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9801     GNUCP=`cygpath -m $GNUCP`
9804 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9805 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9806     AC_MSG_RESULT([yes])
9807 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9808     AC_MSG_RESULT([yes])
9809 else
9810     case "$build_os" in
9811     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9812         x_GNUCP=[\#]
9813         GNUCP=''
9814         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9815         ;;
9816     *)
9817         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9818         ;;
9819     esac
9822 AC_SUBST(GNUPATCH)
9823 AC_SUBST(GNUCP)
9824 AC_SUBST(x_GNUCP)
9826 dnl ***************************************
9827 dnl testing assembler path
9828 dnl ***************************************
9829 ML_EXE=""
9830 if test "$_os" = "WINNT"; then
9831     if test "$BITNESS_OVERRIDE" = ""; then
9832         assembler=ml.exe
9833         assembler_bin=$CL_DIR
9834     else
9835         assembler=ml64.exe
9836         assembler_bin=$CL_DIR
9837     fi
9839     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9840     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9841         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9842         AC_MSG_RESULT([found])
9843         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9844     else
9845         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9846     fi
9848     PathFormat "$ASM_HOME"
9849     ASM_HOME="$formatted_path"
9850 else
9851     ASM_HOME=""
9854 AC_SUBST(ML_EXE)
9856 dnl ===================================================================
9857 dnl We need zip and unzip
9858 dnl ===================================================================
9859 AC_PATH_PROG(ZIP, zip)
9860 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9861 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9862     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],,)
9865 AC_PATH_PROG(UNZIP, unzip)
9866 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9868 dnl ===================================================================
9869 dnl Zip must be a specific type for different build types.
9870 dnl ===================================================================
9871 if test $build_os = cygwin; then
9872     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9873         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9874     fi
9877 dnl ===================================================================
9878 dnl We need touch with -h option support.
9879 dnl ===================================================================
9880 AC_PATH_PROG(TOUCH, touch)
9881 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9882 touch warn
9883 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9884     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],,)
9887 dnl ===================================================================
9888 dnl Check for system epoxy
9889 dnl ===================================================================
9890 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9892 dnl ===================================================================
9893 dnl Set vcl option: coordinate device in double or sal_Int32
9894 dnl ===================================================================
9896 dnl disabled for now, we don't want subtle differences between OSs
9897 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9898 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9899 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9900 dnl     AC_MSG_RESULT([double])
9901 dnl else
9902 dnl     AC_MSG_RESULT([sal_Int32])
9903 dnl fi
9905 dnl ===================================================================
9906 dnl Test which vclplugs have to be built.
9907 dnl ===================================================================
9908 R=""
9909 if test "$USING_X11" != TRUE; then
9910     enable_gtk=no
9911     enable_gtk3=no
9913 GTK3_CFLAGS=""
9914 GTK3_LIBS=""
9915 ENABLE_GTK3=""
9916 if test "x$enable_gtk3" = "xyes"; then
9917     if test "$with_system_cairo" = no; then
9918         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9919     fi
9920     : ${with_system_cairo:=yes}
9921     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.8 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
9922     if test "x$ENABLE_GTK3" = "xTRUE"; then
9923         R="gtk3"
9924         dnl Avoid installed by unpackaged files for now.
9925         if test -z "$PKGFORMAT"; then
9926             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9927         fi
9928     else
9929         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9930     fi
9931     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9932     FilterLibs "${GTK3_LIBS}"
9933     GTK3_LIBS="${filteredlibs}"
9935     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9936     if test "$with_system_epoxy" != "yes"; then
9937         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9938     fi
9940 AC_SUBST(GTK3_LIBS)
9941 AC_SUBST(GTK3_CFLAGS)
9942 AC_SUBST(ENABLE_GTK3)
9944 ENABLE_GTK=""
9945 if test "x$enable_gtk" = "xyes"; then
9946     if test "$with_system_cairo" = no; then
9947         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9948     fi
9949     : ${with_system_cairo:=yes}
9950     ENABLE_GTK="TRUE"
9951     AC_DEFINE(ENABLE_GTK)
9952     R="gtk $R"
9954 AC_SUBST(ENABLE_GTK)
9956 ENABLE_TDE=""
9957 if test "x$enable_tde" = "xyes"; then
9958     ENABLE_TDE="TRUE"
9959     AC_DEFINE(ENABLE_TDE)
9960     R="$R tde"
9962 AC_SUBST(ENABLE_TDE)
9964 ENABLE_KDE4=""
9965 if test "x$enable_kde4" = "xyes"; then
9966     ENABLE_KDE4="TRUE"
9967     AC_DEFINE(ENABLE_KDE4)
9968     R="$R kde4"
9970 AC_SUBST(ENABLE_KDE4)
9973 build_vcl_plugins="$R"
9974 if test -z "$build_vcl_plugins"; then
9975     build_vcl_plugins="none"
9977 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
9979 dnl ===================================================================
9980 dnl check for dbus support
9981 dnl ===================================================================
9982 ENABLE_DBUS=""
9983 DBUS_CFLAGS=""
9984 DBUS_LIBS=""
9986 if test "$enable_dbus" = "no"; then
9987     test_dbus=no
9990 AC_MSG_CHECKING([whether to enable DBUS support])
9991 if test "$test_dbus" = "yes"; then
9992     ENABLE_DBUS="TRUE"
9993     AC_MSG_RESULT([yes])
9994     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9995     AC_DEFINE(ENABLE_DBUS)
9996     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9997     FilterLibs "${DBUS_LIBS}"
9998     DBUS_LIBS="${filteredlibs}"
9999 else
10000     AC_MSG_RESULT([no])
10003 AC_SUBST(ENABLE_DBUS)
10004 AC_SUBST(DBUS_CFLAGS)
10005 AC_SUBST(DBUS_LIBS)
10007 AC_MSG_CHECKING([whether to enable Impress remote control])
10008 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10009     AC_MSG_RESULT([yes])
10010     ENABLE_SDREMOTE=TRUE
10011     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10013     # If not explicitly enabled or disabled, default
10014     if test -z "$enable_sdremote_bluetooth"; then
10015         case "$OS" in
10016         LINUX|MACOSX|WNT)
10017             # Default to yes for these
10018             enable_sdremote_bluetooth=yes
10019             ;;
10020         *)
10021             # otherwise no
10022             enable_sdremote_bluetooth=no
10023             ;;
10024         esac
10025     fi
10026     # $enable_sdremote_bluetooth is guaranteed non-empty now
10028     if test "$enable_sdremote_bluetooth" != "no"; then
10029         if test "$OS" = "LINUX"; then
10030             if test "$ENABLE_DBUS" = "TRUE"; then
10031                 AC_MSG_RESULT([yes])
10032                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10033                 dnl ===================================================================
10034                 dnl Check for system bluez
10035                 dnl ===================================================================
10036                 AC_MSG_CHECKING([which Bluetooth header to use])
10037                 if test "$with_system_bluez" = "yes"; then
10038                     AC_MSG_RESULT([external])
10039                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10040                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10041                     SYSTEM_BLUEZ=TRUE
10042                 else
10043                     AC_MSG_RESULT([internal])
10044                     SYSTEM_BLUEZ=
10045                 fi
10046             else
10047                 AC_MSG_RESULT([no, dbus disabled])
10048                 ENABLE_SDREMOTE_BLUETOOTH=
10049                 SYSTEM_BLUEZ=
10050             fi
10051         else
10052             AC_MSG_RESULT([yes])
10053             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10054             SYSTEM_BLUEZ=
10055         fi
10056     else
10057         AC_MSG_RESULT([no])
10058         ENABLE_SDREMOTE_BLUETOOTH=
10059         SYSTEM_BLUEZ=
10060     fi
10061 else
10062     ENABLE_SDREMOTE=
10063     SYSTEM_BLUEZ=
10064     AC_MSG_RESULT([no])
10066 AC_SUBST(ENABLE_SDREMOTE)
10067 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10068 AC_SUBST(SYSTEM_BLUEZ)
10070 dnl ===================================================================
10071 dnl Check whether the gtk 2.0 libraries are available.
10072 dnl ===================================================================
10074 GTK_CFLAGS=""
10075 GTK_LIBS=""
10076 ENABLE_SYSTRAY_GTK=""
10077 if test  "$test_gtk" = "yes"; then
10079     if test "$ENABLE_GTK" = "TRUE"; then
10080         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]))
10081         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10082         FilterLibs "${GTK_LIBS}"
10083         GTK_LIBS="${filteredlibs}"
10084         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]))
10085         BUILD_TYPE="$BUILD_TYPE GTK"
10086         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10087         FilterLibs "${GTHREAD_LIBS}"
10088         GTHREAD_LIBS="${filteredlibs}"
10090         if test "x$enable_systray" = "xyes"; then
10091             ENABLE_SYSTRAY_GTK="TRUE"
10092         fi
10094         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10095         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10096                           [ENABLE_GTK_PRINT="TRUE"],
10097                           [ENABLE_GTK_PRINT=""])
10098         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10099         FilterLibs "${GTK_PRINT_LIBS}"
10100         GTK_PRINT_LIBS="${filteredlibs}"
10102         AC_MSG_CHECKING([whether to enable GIO support])
10103         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10104             dnl Need at least 2.26 for the dbus support.
10105             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10106                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10107             if test "$ENABLE_GIO" = "TRUE"; then
10108                 AC_DEFINE(ENABLE_GIO)
10109                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10110                 FilterLibs "${GIO_LIBS}"
10111                 GIO_LIBS="${filteredlibs}"
10112             fi
10113         else
10114             AC_MSG_RESULT([no])
10115         fi
10116     fi
10118 AC_SUBST(ENABLE_GIO)
10119 AC_SUBST(GIO_CFLAGS)
10120 AC_SUBST(GIO_LIBS)
10121 AC_SUBST(ENABLE_SYSTRAY_GTK)
10122 AC_SUBST(GTK_CFLAGS)
10123 AC_SUBST(GTK_LIBS)
10124 AC_SUBST(GTHREAD_CFLAGS)
10125 AC_SUBST(GTHREAD_LIBS)
10126 AC_SUBST([ENABLE_GTK_PRINT])
10127 AC_SUBST([GTK_PRINT_CFLAGS])
10128 AC_SUBST([GTK_PRINT_LIBS])
10131 dnl ===================================================================
10133 SPLIT_APP_MODULES=""
10134 if test "$enable_split_app_modules" = "yes"; then
10135     SPLIT_APP_MODULES="TRUE"
10137 AC_SUBST(SPLIT_APP_MODULES)
10139 SPLIT_OPT_FEATURES=""
10140 if test "$enable_split_opt_features" = "yes"; then
10141     SPLIT_OPT_FEATURES="TRUE"
10143 AC_SUBST(SPLIT_OPT_FEATURES)
10145 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10146     if test "$enable_cairo_canvas" = yes; then
10147         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10148     fi
10149     enable_cairo_canvas=no
10150 elif test -z "$enable_cairo_canvas"; then
10151     enable_cairo_canvas=yes
10154 ENABLE_CAIRO_CANVAS=""
10155 if test "$enable_cairo_canvas" = "yes"; then
10156     test_cairo=yes
10157     ENABLE_CAIRO_CANVAS="TRUE"
10158     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10160 AC_SUBST(ENABLE_CAIRO_CANVAS)
10162 dnl ===================================================================
10163 dnl Check whether the GStreamer libraries are available.
10164 dnl It's possible to build avmedia with both GStreamer backends!
10165 dnl ===================================================================
10167 ENABLE_GSTREAMER_1_0=""
10169 if test "$build_gstreamer_1_0" = "yes"; then
10171     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10172     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10173         ENABLE_GSTREAMER_1_0="TRUE"
10174         AC_MSG_RESULT([yes])
10175         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10176         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10177         FilterLibs "${GSTREAMER_1_0_LIBS}"
10178         GSTREAMER_1_0_LIBS="${filteredlibs}"
10179     else
10180         AC_MSG_RESULT([no])
10181     fi
10183 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10184 AC_SUBST(GSTREAMER_1_0_LIBS)
10185 AC_SUBST(ENABLE_GSTREAMER_1_0)
10188 ENABLE_GSTREAMER_0_10=""
10189 if test "$build_gstreamer_0_10" = "yes"; then
10191     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10192     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10193         ENABLE_GSTREAMER_0_10="TRUE"
10194         AC_MSG_RESULT([yes])
10195         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10196             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10197         ])
10198         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10199         FilterLibs "${GSTREAMER_0_10_LIBS}"
10200         GSTREAMER_0_10_LIBS="${filteredlibs}"
10201     else
10202         AC_MSG_RESULT([no])
10203     fi
10206 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10207 AC_SUBST(GSTREAMER_0_10_LIBS)
10208 AC_SUBST(ENABLE_GSTREAMER_0_10)
10210 dnl ===================================================================
10211 dnl Check whether to build the VLC avmedia backend
10212 dnl ===================================================================
10214 ENABLE_VLC=""
10216 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10217 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10218     ENABLE_VLC="TRUE"
10219     AC_MSG_RESULT([yes])
10220 else
10221     AC_MSG_RESULT([no])
10223 AC_SUBST(ENABLE_VLC)
10225 ENABLE_OPENGL_TRANSITIONS=
10226 ENABLE_OPENGL_CANVAS=
10227 if test $_os = iOS -o $_os = Android; then
10228    : # disable
10229 elif test "$_os" = "Darwin"; then
10230     # We use frameworks on Mac OS X, no need for detail checks
10231     ENABLE_OPENGL_TRANSITIONS=TRUE
10232     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10233     ENABLE_OPENGL_CANVAS=TRUE
10234 elif test $_os = WINNT; then
10235     ENABLE_OPENGL_TRANSITIONS=TRUE
10236     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10237     ENABLE_OPENGL_CANVAS=TRUE
10238 else
10239     if test "$USING_X11" = TRUE; then
10240         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10241         ENABLE_OPENGL_TRANSITIONS=TRUE
10242         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10243         ENABLE_OPENGL_CANVAS=TRUE
10244     fi
10247 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10248 AC_SUBST(ENABLE_OPENGL_CANVAS)
10250 dnl =================================================
10251 dnl Check whether to build with OpenCL support.
10252 dnl =================================================
10254 if test $_os != iOS -a $_os != Android; then
10255     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10256     # platform (optional at run-time, used through clew).
10257     BUILD_TYPE="$BUILD_TYPE OPENCL"
10258     AC_DEFINE(HAVE_FEATURE_OPENCL)
10261 dnl ===================================================================
10262 dnl Check whether to enable glTF support
10263 dnl ===================================================================
10264 AC_MSG_CHECKING([whether to enable glTF support])
10265 ENABLE_GLTF=
10266 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android -a "$ENABLE_HEADLESS" = ""; then
10267     ENABLE_GLTF=TRUE
10268     AC_MSG_RESULT([yes])
10269     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10270     if test "$with_system_libgltf" = "yes"; then
10271         SYSTEM_LIBGLTF=TRUE
10272         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.1 >= 0.1.0] )
10273         FilterLibs "${LIBGLTF_LIBS}"
10274         LIBGLTF_LIBS="${filteredlibs}"
10275     else
10276         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10277     fi
10278 else
10279     AC_MSG_RESULT([no])
10281 AC_SUBST(ENABLE_GLTF)
10282 AC_SUBST(SYSTEM_LIBGLTF)
10283 AC_SUBST(LIBGLTF_CFLAGS)
10284 AC_SUBST(LIBGLTF_LIBS)
10286 dnl ===================================================================
10287 dnl Check whether to enable COLLADA support
10288 dnl ===================================================================
10289 AC_MSG_CHECKING([whether to enable COLLADA support])
10290 ENABLE_COLLADA=
10291 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10292     AC_MSG_RESULT([yes])
10293     ENABLE_COLLADA=TRUE
10294     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10296     AC_MSG_CHECKING([which OPENCOLLADA to use])
10297     if test "$with_system_opencollada" = "yes"; then
10298         AC_MSG_RESULT([external])
10299         SYSTEM_OPENCOLLADA=TRUE
10300         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10301         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10302         AC_LANG_PUSH([C++])
10303         save_CXXFLAGS=$CXXFLAGS
10304         save_CPPFLAGS=$CPPFLAGS
10305         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10306         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10307         AC_CHECK_HEADERS(
10308                 COLLADABU.h \
10309                 COLLADAFW.h \
10310                 COLLADASaxFWLLoader.h \
10311                 GeneratedSaxParser.h,
10312             [],
10313             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10314             [])
10315         CXXFLAGS=$save_CXXFLAGS
10316         CPPFLAGS=$save_CPPFLAGS
10317         AC_LANG_POP([C++])
10318         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10319         FilterLibs "${OPENCOLLADA_LIBS}"
10320         OPENCOLLADA_LIBS="${filteredlibs}"
10321     else
10322         AC_MSG_RESULT([internal])
10323         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10324     fi
10326     AC_MSG_CHECKING([which collada2gltf to use])
10327     if test "$with_system_collada2gltf" = "yes"; then
10328         if test "$with_system_opencollada" = "no"; then
10329             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10330         fi
10331         AC_MSG_RESULT([external])
10332         SYSTEM_COLLADA2GLTF=TRUE
10333         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10334         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10335         AC_LANG_PUSH([C++])
10336         save_CXXFLAGS=$CXXFLAGS
10337         save_CPPFLAGS=$CPPFLAGS
10338         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10339         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10340         AC_CHECK_HEADERS(
10341                 GLTF.h \
10342                 encodingHelpers.h,
10343             [],
10344             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10345             [])
10346         CXXFLAGS=$save_CXXFLAGS
10347         CPPFLAGS=$save_CPPFLAGS
10348         AC_LANG_POP([C++])
10349         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10350         FilterLibs "${COLLADA2GLTF_LIBS}"
10351         COLLADA2GLTF_LIBS="${filteredlibs}"
10352     else
10353         AC_MSG_RESULT([internal])
10354         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10355     fi
10356 else
10357     AC_MSG_RESULT([no])
10359 AC_SUBST(ENABLE_COLLADA)
10360 AC_SUBST([OPENCOLLADA_CFLAGS])
10361 AC_SUBST([OPENCOLLADA_LIBS])
10362 AC_SUBST([SYSTEM_OPENCOLLADA])
10364 AC_SUBST([COLLADA2GLTF_CFLAGS])
10365 AC_SUBST([COLLADA2GLTF_LIBS])
10366 AC_SUBST([SYSTEM_COLLADA2GLTF])
10368 if test "$enable_dconf" != no; then
10369     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10370         if test "$enable_dconf" = yes; then
10371             AC_MSG_ERROR([dconf not found])
10372         else
10373             enable_dconf=no
10374         fi])
10376 AC_MSG_CHECKING([whether to enable dconf])
10377 if test "$enable_dconf" = no; then
10378     DCONF_CFLAGS=
10379     DCONF_LIBS=
10380     ENABLE_DCONF=
10381     AC_MSG_RESULT([no])
10382 else
10383     ENABLE_DCONF=TRUE
10384     AC_DEFINE(ENABLE_DCONF)
10385     AC_MSG_RESULT([yes])
10387 AC_SUBST([DCONF_CFLAGS])
10388 AC_SUBST([DCONF_LIBS])
10389 AC_SUBST([ENABLE_DCONF])
10391 # pdf import?
10392 AC_MSG_CHECKING([whether to build the PDF import feature])
10393 ENABLE_PDFIMPORT=
10394 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10395     AC_MSG_RESULT([yes])
10396     ENABLE_PDFIMPORT=TRUE
10397     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10399     dnl ===================================================================
10400     dnl Check for system poppler
10401     dnl ===================================================================
10402     AC_MSG_CHECKING([which PDF import backend to use])
10403     if test "$with_system_poppler" = "yes"; then
10404         AC_MSG_RESULT([external])
10405         SYSTEM_POPPLER=TRUE
10406         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10407         AC_LANG_PUSH([C++])
10408         save_CXXFLAGS=$CXXFLAGS
10409         save_CPPFLAGS=$CPPFLAGS
10410         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10411         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10412         AC_CHECK_HEADER([cpp/poppler-version.h],
10413             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10414             [])
10415         CXXFLAGS=$save_CXXFLAGS
10416         CPPFLAGS=$save_CPPFLAGS
10417         AC_LANG_POP([C++])
10418         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10420         FilterLibs "${POPPLER_LIBS}"
10421         POPPLER_LIBS="${filteredlibs}"
10422     else
10423         AC_MSG_RESULT([internal])
10424         SYSTEM_POPPLER=
10425         BUILD_TYPE="$BUILD_TYPE POPPLER"
10426         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10427     fi
10428     AC_DEFINE([ENABLE_PDFIMPORT],1)
10429 else
10430     AC_MSG_RESULT([no])
10432 AC_SUBST(ENABLE_PDFIMPORT)
10433 AC_SUBST(SYSTEM_POPPLER)
10434 AC_SUBST(POPPLER_CFLAGS)
10435 AC_SUBST(POPPLER_LIBS)
10437 # pdf import?
10438 AC_MSG_CHECKING([whether to build PDFium])
10439 ENABLE_PDFIUM=
10440 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10441     AC_MSG_RESULT([yes])
10442     ENABLE_PDFIUM=TRUE
10443     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10444     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10445 else
10446     AC_MSG_RESULT([no])
10448 AC_SUBST(ENABLE_PDFIUM)
10450 SYSTEM_GPGMEPP=
10451 if test "$_os" = "Linux"; then
10452     dnl ===================================================================
10453     dnl Check for system gpgme
10454     dnl ===================================================================
10455     AC_MSG_CHECKING([which gpgmepp to use])
10456     if test "$with_system_gpgmepp" = "yes"; then
10457         AC_MSG_RESULT([external])
10458         SYSTEM_GPGMEPP=TRUE
10460         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10461         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10462             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10463         # progress_callback is the only func with plain C linkage
10464         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10465         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10466             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10467         AC_CHECK_HEADER(gpgme.h, [],
10468             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10469     else
10470         AC_MSG_RESULT([internal])
10471         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10473         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10474         GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10475         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10476         LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10477     fi
10479 AC_SUBST(SYSTEM_GPGMEPP)
10480 AC_SUBST(GPG_ERROR_CFLAGS)
10481 AC_SUBST(GPG_ERROR_LIBS)
10482 AC_SUBST(LIBASSUAN_CFLAGS)
10483 AC_SUBST(LIBASSUAN_LIBS)
10484 AC_SUBST(GPGMEPP_CFLAGS)
10485 AC_SUBST(GPGMEPP_LIBS)
10487 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10488 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10489     AC_MSG_RESULT([yes])
10490     ENABLE_MEDIAWIKI=TRUE
10491     BUILD_TYPE="$BUILD_TYPE XSLTML"
10492     if test  "x$with_java" = "xno"; then
10493         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10494     fi
10495 else
10496     AC_MSG_RESULT([no])
10497     ENABLE_MEDIAWIKI=
10498     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10500 AC_SUBST(ENABLE_MEDIAWIKI)
10502 AC_MSG_CHECKING([whether to build the Report Builder])
10503 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10504     AC_MSG_RESULT([yes])
10505     ENABLE_REPORTBUILDER=TRUE
10506     AC_MSG_CHECKING([which jfreereport libs to use])
10507     if test "$with_system_jfreereport" = "yes"; then
10508         SYSTEM_JFREEREPORT=TRUE
10509         AC_MSG_RESULT([external])
10510         if test -z $SAC_JAR; then
10511             SAC_JAR=/usr/share/java/sac.jar
10512         fi
10513         if ! test -f $SAC_JAR; then
10514              AC_MSG_ERROR(sac.jar not found.)
10515         fi
10517         if test -z $LIBXML_JAR; then
10518             if test -f /usr/share/java/libxml-1.0.0.jar; then
10519                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10520             elif test -f /usr/share/java/libxml.jar; then
10521                 LIBXML_JAR=/usr/share/java/libxml.jar
10522             else
10523                 AC_MSG_ERROR(libxml.jar replacement not found.)
10524             fi
10525         elif ! test -f $LIBXML_JAR; then
10526             AC_MSG_ERROR(libxml.jar not found.)
10527         fi
10529         if test -z $FLUTE_JAR; then
10530             if test -f/usr/share/java/flute-1.3.0.jar; then
10531                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10532             elif test -f /usr/share/java/flute.jar; then
10533                 FLUTE_JAR=/usr/share/java/flute.jar
10534             else
10535                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10536             fi
10537         elif ! test -f $FLUTE_JAR; then
10538             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10539         fi
10541         if test -z $JFREEREPORT_JAR; then
10542             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10543                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10544             elif test -f /usr/share/java/flow-engine.jar; then
10545                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10546             else
10547                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10548             fi
10549         elif ! test -f  $JFREEREPORT_JAR; then
10550                 AC_MSG_ERROR(jfreereport.jar not found.)
10551         fi
10553         if test -z $LIBLAYOUT_JAR; then
10554             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10555                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10556             elif test -f /usr/share/java/liblayout.jar; then
10557                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10558             else
10559                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10560             fi
10561         elif ! test -f $LIBLAYOUT_JAR; then
10562                 AC_MSG_ERROR(liblayout.jar not found.)
10563         fi
10565         if test -z $LIBLOADER_JAR; then
10566             if test -f /usr/share/java/libloader-1.0.0.jar; then
10567                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10568             elif test -f /usr/share/java/libloader.jar; then
10569                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10570             else
10571                 AC_MSG_ERROR(libloader.jar replacement not found.)
10572             fi
10573         elif ! test -f  $LIBLOADER_JAR; then
10574             AC_MSG_ERROR(libloader.jar not found.)
10575         fi
10577         if test -z $LIBFORMULA_JAR; then
10578             if test -f /usr/share/java/libformula-0.2.0.jar; then
10579                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10580             elif test -f /usr/share/java/libformula.jar; then
10581                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10582             else
10583                 AC_MSG_ERROR(libformula.jar replacement not found.)
10584             fi
10585         elif ! test -f $LIBFORMULA_JAR; then
10586                 AC_MSG_ERROR(libformula.jar not found.)
10587         fi
10589         if test -z $LIBREPOSITORY_JAR; then
10590             if test -f /usr/share/java/librepository-1.0.0.jar; then
10591                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10592             elif test -f /usr/share/java/librepository.jar; then
10593                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10594             else
10595                 AC_MSG_ERROR(librepository.jar replacement not found.)
10596             fi
10597         elif ! test -f $LIBREPOSITORY_JAR; then
10598             AC_MSG_ERROR(librepository.jar not found.)
10599         fi
10601         if test -z $LIBFONTS_JAR; then
10602             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10603                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10604             elif test -f /usr/share/java/libfonts.jar; then
10605                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10606             else
10607                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10608             fi
10609         elif ! test -f $LIBFONTS_JAR; then
10610                 AC_MSG_ERROR(libfonts.jar not found.)
10611         fi
10613         if test -z $LIBSERIALIZER_JAR; then
10614             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10615                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10616             elif test -f /usr/share/java/libserializer.jar; then
10617                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10618             else
10619                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10620             fi
10621         elif ! test -f $LIBSERIALIZER_JAR; then
10622                 AC_MSG_ERROR(libserializer.jar not found.)
10623         fi
10625         if test -z $LIBBASE_JAR; then
10626             if test -f /usr/share/java/libbase-1.0.0.jar; then
10627                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10628             elif test -f /usr/share/java/libbase.jar; then
10629                 LIBBASE_JAR=/usr/share/java/libbase.jar
10630             else
10631                 AC_MSG_ERROR(libbase.jar replacement not found.)
10632             fi
10633         elif ! test -f $LIBBASE_JAR; then
10634             AC_MSG_ERROR(libbase.jar not found.)
10635         fi
10637     else
10638         AC_MSG_RESULT([internal])
10639         SYSTEM_JFREEREPORT=
10640         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10641     fi
10642 else
10643     AC_MSG_RESULT([no])
10644     ENABLE_REPORTBUILDER=
10645     SYSTEM_JFREEREPORT=
10647 AC_SUBST(ENABLE_REPORTBUILDER)
10648 AC_SUBST(SYSTEM_JFREEREPORT)
10649 AC_SUBST(SAC_JAR)
10650 AC_SUBST(LIBXML_JAR)
10651 AC_SUBST(FLUTE_JAR)
10652 AC_SUBST(JFREEREPORT_JAR)
10653 AC_SUBST(LIBBASE_JAR)
10654 AC_SUBST(LIBLAYOUT_JAR)
10655 AC_SUBST(LIBLOADER_JAR)
10656 AC_SUBST(LIBFORMULA_JAR)
10657 AC_SUBST(LIBREPOSITORY_JAR)
10658 AC_SUBST(LIBFONTS_JAR)
10659 AC_SUBST(LIBSERIALIZER_JAR)
10661 # this has to be here because both the Wiki Publisher and the SRB use
10662 # commons-logging
10663 COMMONS_LOGGING_VERSION=1.2
10664 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10665     AC_MSG_CHECKING([which Apache commons-* libs to use])
10666     if test "$with_system_apache_commons" = "yes"; then
10667         SYSTEM_APACHE_COMMONS=TRUE
10668         AC_MSG_RESULT([external])
10669         if test -z $COMMONS_LOGGING_JAR; then
10670             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10671                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10672            elif test -f /usr/share/java/commons-logging.jar; then
10673                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10674             else
10675                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10676             fi
10677         elif ! test -f $COMMONS_LOGGING_JAR; then
10678             AC_MSG_ERROR(commons-logging.jar not found.)
10679         fi
10680     else
10681         AC_MSG_RESULT([internal])
10682         SYSTEM_APACHE_COMMONS=
10683         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10684     fi
10686 AC_SUBST(SYSTEM_APACHE_COMMONS)
10687 AC_SUBST(COMMONS_LOGGING_JAR)
10688 AC_SUBST(COMMONS_LOGGING_VERSION)
10690 # scripting provider for BeanShell?
10691 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10692 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10693     AC_MSG_RESULT([yes])
10694     ENABLE_SCRIPTING_BEANSHELL=TRUE
10696     dnl ===================================================================
10697     dnl Check for system beanshell
10698     dnl ===================================================================
10699     AC_MSG_CHECKING([which beanshell to use])
10700     if test "$with_system_beanshell" = "yes"; then
10701         AC_MSG_RESULT([external])
10702         SYSTEM_BSH=TRUE
10703         if test -z $BSH_JAR; then
10704             BSH_JAR=/usr/share/java/bsh.jar
10705         fi
10706         if ! test -f $BSH_JAR; then
10707             AC_MSG_ERROR(bsh.jar not found.)
10708         fi
10709     else
10710         AC_MSG_RESULT([internal])
10711         SYSTEM_BSH=
10712         BUILD_TYPE="$BUILD_TYPE BSH"
10713     fi
10714 else
10715     AC_MSG_RESULT([no])
10716     ENABLE_SCRIPTING_BEANSHELL=
10717     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10719 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10720 AC_SUBST(SYSTEM_BSH)
10721 AC_SUBST(BSH_JAR)
10723 # scripting provider for JavaScript?
10724 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10725 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10726     AC_MSG_RESULT([yes])
10727     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10729     dnl ===================================================================
10730     dnl Check for system rhino
10731     dnl ===================================================================
10732     AC_MSG_CHECKING([which rhino to use])
10733     if test "$with_system_rhino" = "yes"; then
10734         AC_MSG_RESULT([external])
10735         SYSTEM_RHINO=TRUE
10736         if test -z $RHINO_JAR; then
10737             RHINO_JAR=/usr/share/java/js.jar
10738         fi
10739         if ! test -f $RHINO_JAR; then
10740             AC_MSG_ERROR(js.jar not found.)
10741         fi
10742     else
10743         AC_MSG_RESULT([internal])
10744         SYSTEM_RHINO=
10745         BUILD_TYPE="$BUILD_TYPE RHINO"
10746     fi
10747 else
10748     AC_MSG_RESULT([no])
10749     ENABLE_SCRIPTING_JAVASCRIPT=
10750     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10752 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10753 AC_SUBST(SYSTEM_RHINO)
10754 AC_SUBST(RHINO_JAR)
10756 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10757 # paths should be added to library search path. So lets put all 64-bit
10758 # platforms there.
10759 supports_multilib=
10760 case "$host_cpu" in
10761 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10762     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10763         supports_multilib="yes"
10764     fi
10765     ;;
10767     ;;
10768 esac
10770 dnl ===================================================================
10771 dnl Check whether the TQt and TDE libraries are available.
10772 dnl ===================================================================
10774 TDE_CFLAGS=""
10775 TDE_LIBS=""
10776 if test "$_os" != "OpenBSD"; then
10777     TDE_MOC="moc"
10779 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10780     dnl Search paths for TQt and TDE
10781     if test -z "$supports_multilib"; then
10782         tqt_incdirs="$QTINC /usr/local/tqt3/include /usr/include/tqt3 /usr/include /usr/X11R6/include/X11/tqt3 /usr/X11R6/include/tqt3 /usr/lib/tqt3/include /usr/lib/tqt3/include /usr/share/tqt3/include /usr/local/include/X11/tqt3 $x_includes"
10783         tqt_libdirs="$QTLIB /usr/local/tqt3/lib /usr/lib/tqt3 /usr/lib /usr/X11R6/lib/X11/tqt3 /usr/X11R6/lib/tqt3 /usr/lib/tqt3/lib /usr/lib/tqt3/lib /usr/share/tqt3/lib /usr/local/lib/tqt3 $x_libraries"
10784     else
10785         tqt_incdirs="$QTINC /usr/local/tqt3/include /usr/include/tqt3 /usr/include /usr/X11R6/include/X11/tqt3 /usr/X11R6/include/tqt3 /usr/lib64/tqt3/include /usr/lib64/tqt3/include /usr/share/tqt3/include /usr/lib/tqt3/include /usr/lib/tqt3/include /usr/local/include/X11/tqt3 $x_includes"
10786         tqt_libdirs="$QTLIB /usr/local/tqt3/lib64 /usr/lib64/tqt3 /usr/lib64 /usr/X11R6/lib64/X11/tqt3 /usr/X11R6/lib64/tqt3 /usr/lib64/tqt3/lib64 /usr/lib64/tqt3/lib64 /usr/share/tqt3/lib64 /usr/local/tqt3/lib /usr/lib/tqt3 /usr/lib /usr/X11R6/lib/X11/tqt3 /usr/X11R6/lib/tqt3 /usr/lib/tqt3/lib /usr/lib/tqt3/lib /usr/share/tqt3/lib /usr/local/lib/tqt3 $x_libraries"
10787     fi
10788     if test -n "$TQTDIR"; then
10789         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10790         if test -z "$supports_multilib"; then
10791             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10792         else
10793             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10794         fi
10795     fi
10796     if test -z "$supports_multilib"; then
10797         tde_incdirs="/usr/lib/trinity/include /usr/local/trinity/include /usr/local/include /usr/trinity/include /usr/include/trinity /opt/trinity/include /opt/trinity/include $x_includes"
10798         tde_libdirs="/usr/lib/trinity/lib /usr/local/trinity/lib /usr/trinity/lib /usr/lib/trinity /usr/lib/trinity /usr/X11R6/lib /usr/local/lib /opt/trinity/lib /opt/trinity/lib /usr/X11R6/trinity/lib /usr/lib $x_libraries"
10799     else
10800         tde_incdirs="/usr/lib64/trinity/include /usr/lib/trinity/include /usr/local/trinity/include /usr/local/include /usr/trinity/include /usr/include/trinity /opt/trinity/include /opt/trinity/include $x_includes"
10801         tde_libdirs="/usr/lib64/trinity/lib64 /usr/local/trinity/lib64 /usr/trinity/lib64 /usr/lib64/trinity /usr/lib64/trinity /usr/X11R6/lib64 /usr/local/lib64 /opt/trinity/lib64 /opt/trinity/lib64 /usr/X11R6/trinity/lib64 /usr/lib/trinity/lib /usr/local/trinity/lib /usr/trinity/lib /usr/lib/trinity /usr/lib/trinity /usr/lib /usr/X11R6/lib /usr/local/lib /opt/trinity/lib /opt/trinity/lib /usr/X11R6/trinity/lib /usr/lib64 $x_libraries"
10802     fi
10803     if test -n "$TDEDIR"; then
10804         tde_incdirs="$TDEDIR/include $tde_incdirs"
10805         if test -z "$supports_multilib"; then
10806             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10807         else
10808             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10809         fi
10810     fi
10812     dnl What to test
10813     tqt_test_include="ntqstyle.h"
10814     tde_test_include="kapp.h"
10816     if test "$_os" != "OpenBSD"; then
10817         tqt_test_library="libtqt-mt.so"
10818         tde_test_library="libDCOP.so"
10819     else
10820         tqt_test_library="libtqt-mt.so*"
10821         tde_test_library="libDCOP.so*"
10822     fi
10824     dnl Check for TQt headers
10825     AC_MSG_CHECKING([for TQt headers])
10826     tqt_incdir="no"
10827     for tde_check in $tqt_incdirs; do
10828         if test -r "$tde_check/$tqt_test_include"; then
10829             tqt_incdir="$tde_check"
10830             break
10831         fi
10832     done
10833     AC_MSG_RESULT([$tqt_incdir])
10834     if test "x$tqt_incdir" = "xno"; then
10835         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10836 your TQt installation by exporting TQTDIR before running "configure".])
10837     fi
10839     dnl Check for TQt libraries
10840     AC_MSG_CHECKING([for TQt libraries])
10841     tqt_libdir="no"
10842     for tqt_check in $tqt_libdirs; do
10843         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10844             tqt_libdir="$tqt_check"
10845             break
10846         fi
10847     done
10848     AC_MSG_RESULT([$tqt_libdir])
10849     if test "x$tqt_libdir" = "xno"; then
10850         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10851 your TQt installation by exporting TQTDIR before running "configure".])
10852     fi
10854     dnl Check for Meta Object Compiler
10855     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10856     if test "$MOC" = "no"; then
10857         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10858 the root of your TQt installation by exporting TQTDIR before running "configure".])
10859     fi
10861     dnl Check for TDE headers
10862     AC_MSG_CHECKING([for TDE headers])
10863     tde_incdir="no"
10864     for tde_check in $tde_incdirs; do
10865         if test -r "$tde_check/$tde_test_include"; then
10866             tde_incdir="$tde_check"
10867             break
10868         fi
10869     done
10870     AC_MSG_RESULT([$tde_incdir])
10871     if test "x$tde_incdir" = "xno"; then
10872         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10873 your TDE installation by exporting TDEDIR before running "configure".])
10874     fi
10876     dnl Check for TDE libraries
10877     AC_MSG_CHECKING([for TDE libraries])
10878     tde_libdir="no"
10879     for tde_check in $tde_libdirs; do
10880         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10881             tde_libdir="$tde_check"
10882             break
10883         fi
10884     done
10885     AC_MSG_RESULT([$tde_libdir])
10886     if test "x$tde_libdir" = "xno"; then
10887         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10888 your TDE installation by exporting TDEDIR before running "configure".])
10889     fi
10891     dnl Set the variables
10892     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10893     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10895 AC_SUBST(TDE_CFLAGS)
10896 AC_SUBST(TDE_LIBS)
10897 AC_SUBST(TDE_MOC)
10899 dnl ===================================================================
10900 dnl KDE4 Integration
10901 dnl ===================================================================
10903 KDE4_CFLAGS=""
10904 KDE4_LIBS=""
10905 QMAKE4="qmake"
10906 MOC4="moc"
10907 KDE4_GLIB_CFLAGS=""
10908 KDE4_GLIB_LIBS=""
10909 KDE4_HAVE_GLIB=""
10910 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10911     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10912     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10914     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10915     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10917     if test -n "$supports_multilib"; then
10918         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10919         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10920     fi
10922     if test -n "$QTDIR"; then
10923         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10924         if test -z "$supports_multilib"; then
10925             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10926         else
10927             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10928         fi
10929     fi
10930     if test -n "$QT4DIR"; then
10931         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10932         if test -z "$supports_multilib"; then
10933             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10934         else
10935             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10936         fi
10937     fi
10939     if test -n "$KDEDIR"; then
10940         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10941         if test -z "$supports_multilib"; then
10942             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10943         else
10944             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10945         fi
10946     fi
10947     if test -n "$KDE4DIR"; then
10948         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10949         if test -z "$supports_multilib"; then
10950             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10951         else
10952             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10953         fi
10954     fi
10956     qt4_test_include="Qt/qobject.h"
10957     qt4_test_library="libQtNetwork.so"
10958     kde4_test_include="kwindowsystem.h"
10959     kde4_test_library="libsolid.so"
10961     AC_MSG_CHECKING([for Qt4 headers])
10962     qt4_header_dir="no"
10963     for inc_dir in $qt4_incdirs; do
10964         if test -r "$inc_dir/$qt4_test_include"; then
10965             qt4_header_dir="$inc_dir"
10966             break
10967         fi
10968     done
10970     AC_MSG_RESULT([$qt4_header_dir])
10971     if test "x$qt4_header_dir" = "xno"; then
10972         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10973     fi
10975     dnl Check for qmake
10976     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10977     QMAKE4="$QMAKEQT4"
10978     if test "$QMAKE4" = "no"; then
10979         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10980         if test "$QMAKE4" = "no"; then
10981             AC_MSG_ERROR([Qmake not found.  Please specify
10982 the root of your Qt installation by exporting QT4DIR before running "configure".])
10983         fi
10984     fi
10986     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10987     AC_MSG_CHECKING([for Qt4 libraries])
10988     qt4_lib_dir="no"
10989     for lib_dir in $qt4_libdirs; do
10990         if test -r "$lib_dir/$qt4_test_library"; then
10991             qt4_lib_dir="$lib_dir"
10992             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10993             break
10994         fi
10995     done
10997     AC_MSG_RESULT([$qt4_lib_dir])
10999     if test "x$qt4_lib_dir" = "xno"; then
11000         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11001     fi
11003     dnl Check for Meta Object Compiler
11005     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11006     MOC4="$MOCQT4"
11007     if test "$MOC4" = "no"; then
11008         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11009         if test "$MOC4" = "no"; then
11010             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11011 the root of your Qt installation by exporting QT4DIR before running "configure".])
11012         fi
11013     fi
11015     dnl Check for KDE4 headers
11016     AC_MSG_CHECKING([for KDE4 headers])
11017     kde4_incdir="no"
11018     for kde4_check in $kde4_incdirs; do
11019         if test -r "$kde4_check/$kde4_test_include"; then
11020             kde4_incdir="$kde4_check"
11021             break
11022         fi
11023     done
11024     AC_MSG_RESULT([$kde4_incdir])
11025     if test "x$kde4_incdir" = "xno"; then
11026         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11027     fi
11028     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
11030     dnl Check for KDE4 libraries
11031     AC_MSG_CHECKING([for KDE4 libraries])
11032     kde4_libdir="no"
11033     for kde4_check in $kde4_libdirs; do
11034         if test -r "$kde4_check/$kde4_test_library"; then
11035             kde4_libdir="$kde4_check"
11036             break
11037         fi
11038     done
11040     AC_MSG_RESULT([$kde4_libdir])
11041     if test "x$kde4_libdir" = "xno"; then
11042         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11043     fi
11045     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11046     if ! test -z "$kde4_incdir"; then
11047         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11048     else
11049         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11050     fi
11052     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11053     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11054     FilterLibs "$KDE4_LIBS"
11055     KDE4_LIBS="$filteredlibs"
11057     AC_LANG_PUSH([C++])
11058     save_CXXFLAGS=$CXXFLAGS
11059     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11060     AC_MSG_CHECKING([whether KDE is >= 4.2])
11061        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11062 #include <kdeversion.h>
11064 int main(int argc, char **argv) {
11065        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11066        else return 1;
11068 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11069     CXXFLAGS=$save_CXXFLAGS
11070     AC_LANG_POP([C++])
11072     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11073     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11074     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11075         [
11076             KDE4_HAVE_GLIB=TRUE
11077             AC_DEFINE(KDE4_HAVE_GLIB,1)
11078             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11079             FilterLibs "${KDE4_GLIB_LIBS}"
11080             KDE4_GLIB_LIBS="${filteredlibs}"
11082             qt4_fix_warning=
11084             AC_LANG_PUSH([C++])
11085             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11086             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11087             #  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
11088             #               ^~~~~~~~~~~~~~~~~~~~~~~
11089             #               vptr for 'QObjectPrivate'
11090             save_CXX=$CXX
11091             CXX=$(printf %s "$CXX" \
11092                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11093             save_CXXFLAGS=$CXXFLAGS
11094             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11095             save_LIBS=$LIBS
11096             LIBS="$LIBS $KDE4_LIBS"
11097             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11099             # Prepare meta object data
11100             TSTBASE="tst_exclude_socket_notifiers"
11101             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11102             ln -fs "${TSTMOC}.hxx"
11103             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11105             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11106 #include <cstdlib>
11107 #include "tst_exclude_socket_notifiers.moc"
11109 int main(int argc, char *argv[])
11111     QCoreApplication app(argc, argv);
11112     exit(tst_processEventsExcludeSocket());
11113     return 0;
11115             ]])],[
11116                 AC_MSG_RESULT([yes])
11117             ],[
11118                 AC_MSG_RESULT([no])
11119                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11120                 if test -z "$qt4_fix_warning"; then
11121                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11122                 fi
11123                 qt4_fix_warning=1
11124                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11125                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11127             # Remove meta object data
11128             rm -f "${TSTBASE}."*
11130             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11132             # Prepare meta object data
11133             TSTBASE="tst_exclude_posted_events"
11134             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11135             ln -fs "${TSTMOC}.hxx"
11136             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11138             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11139 #include <cstdlib>
11140 #include "tst_exclude_posted_events.moc"
11142 int main(int argc, char *argv[])
11144     QCoreApplication app(argc, argv);
11145     exit(tst_excludePostedEvents());
11146     return 0;
11148             ]])],[
11149                 AC_MSG_RESULT([yes])
11150             ],[
11151                 AC_MSG_RESULT([no])
11152                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11153                 if test -z "$qt4_fix_warning"; then
11154                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11155                 fi
11156                 qt4_fix_warning=1
11157                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11158             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11160             # Remove meta object data
11161             rm -f "${TSTBASE}."*
11163             if test -n "$qt4_fix_warning"; then
11164                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11165             fi
11167             LIBS=$save_LIBS
11168             CXXFLAGS=$save_CXXFLAGS
11169             CXX=$save_CXX
11170             AC_LANG_POP([C++])
11171         ],
11172         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11174 AC_SUBST(KDE4_CFLAGS)
11175 AC_SUBST(KDE4_LIBS)
11176 AC_SUBST(MOC4)
11177 AC_SUBST(KDE4_GLIB_CFLAGS)
11178 AC_SUBST(KDE4_GLIB_LIBS)
11179 AC_SUBST(KDE4_HAVE_GLIB)
11181 dnl ===================================================================
11182 dnl Test whether to include Evolution 2 support
11183 dnl ===================================================================
11184 AC_MSG_CHECKING([whether to enable evolution 2 support])
11185 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11186     AC_MSG_RESULT([yes])
11187     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11188     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11189     FilterLibs "${GOBJECT_LIBS}"
11190     GOBJECT_LIBS="${filteredlibs}"
11191     ENABLE_EVOAB2="TRUE"
11192 else
11193     ENABLE_EVOAB2=""
11194     AC_MSG_RESULT([no])
11196 AC_SUBST(ENABLE_EVOAB2)
11197 AC_SUBST(GOBJECT_CFLAGS)
11198 AC_SUBST(GOBJECT_LIBS)
11200 dnl ===================================================================
11201 dnl Test whether to include TDE AB support
11202 dnl ===================================================================
11203 AC_MSG_CHECKING([whether to enable TDE address book support])
11204 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11205     AC_MSG_RESULT([yes])
11206     AC_LANG_PUSH([C++])
11207     save_CXXFLAGS=$CXXFLAGS
11208     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11209     AC_MSG_CHECKING([whether TDE is at least R14.0])
11210        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11211 #include <tdeversion.h>
11213 int main(int argc, char **argv) {
11214        if (TDE_VERSION_MAJOR >= 14) return 0;
11215        else return 1;
11217        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([TDE version too old or too recent, please use another version of TDE or disable TDE address book support])],
11218        [AC_MSG_ERROR([TDE support not tested with cross compilation])])
11219     CXXFLAGS=$save_CXXFLAGS
11220     AC_LANG_POP([C++])
11221     ENABLE_TDEAB=TRUE
11222 else
11223     AC_MSG_RESULT([no])
11224     ENABLE_TDEAB=
11226 AC_SUBST(ENABLE_TDEAB)
11228 dnl ===================================================================
11229 dnl Test which themes to include
11230 dnl ===================================================================
11231 AC_MSG_CHECKING([which themes to include])
11232 # if none given use default subset of available themes
11233 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11234     with_theme="breeze breeze_dark galaxy hicontrast sifr sifr_dark tango"
11235     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11238 WITH_THEMES=""
11239 if test "x$with_theme" != "xno"; then
11240     for theme in $with_theme; do
11241         case $theme in
11242         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|sifr_dark|tango|tango_testing) real_theme="$theme" ;;
11243         default) real_theme=galaxy ;;
11244         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11245         esac
11246         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11247     done
11249 AC_MSG_RESULT([$WITH_THEMES])
11250 AC_SUBST([WITH_THEMES])
11251 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11252 for theme in $with_theme; do
11253     case $theme in
11254     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11255     *) ;;
11256     esac
11257 done
11259 dnl ===================================================================
11260 dnl Test whether to integrate helppacks into the product's installer
11261 dnl ===================================================================
11262 AC_MSG_CHECKING([for helppack integration])
11263 if test "$with_helppack_integration" = "no"; then
11264     WITH_HELPPACK_INTEGRATION=
11265     AC_MSG_RESULT([no integration])
11266 else
11267     WITH_HELPPACK_INTEGRATION=TRUE
11268     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11269     AC_MSG_RESULT([integration])
11271 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11273 ###############################################################################
11274 # Extensions checking
11275 ###############################################################################
11276 AC_MSG_CHECKING([for extensions integration])
11277 if test "x$enable_extension_integration" != "xno"; then
11278     WITH_EXTENSION_INTEGRATION=TRUE
11279     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11280     AC_MSG_RESULT([yes, use integration])
11281 else
11282     WITH_EXTENSION_INTEGRATION=
11283     AC_MSG_RESULT([no, do not integrate])
11285 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11287 dnl Should any extra extensions be included?
11288 dnl There are standalone tests for each of these below.
11289 WITH_EXTRA_EXTENSIONS=
11290 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11292 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11293 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11294 if test "x$with_java" != "xno"; then
11295     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11296     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11299 TEST_FONTS_MISSING=0
11301 # $1  = font family
11302 # $2+ = accepted font mappings
11303 test_font_map()
11305     FONT="$1" ; shift
11306     AC_MSG_CHECKING([font mapping for '$FONT'])
11307     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11308     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11310     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11311     while test "$#" -ge 1 ; do
11312         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11313         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11314     done
11315     if test $TESTEXPR
11316     then
11317         AC_MSG_RESULT([ok])
11318     else
11319         AC_MSG_WARN([unknown ($FONTFILE)])
11320         add_warning "unknown ($FONTFILE)"
11321         TEST_FONTS_MISSING=1
11322     fi
11325 dnl ===================================================================
11326 dnl Test whether to include fonts
11327 dnl ===================================================================
11328 AC_MSG_CHECKING([whether to include third-party fonts])
11329 if test "$with_fonts" != "no"; then
11330     AC_MSG_RESULT([yes])
11331     WITH_FONTS=TRUE
11332     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11333     AC_DEFINE(HAVE_MORE_FONTS)
11334 else
11335     AC_MSG_RESULT([no])
11336     WITH_FONTS=
11337     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11338     if test "$test_fontconfig" = "yes"; then
11339         AC_PATH_PROG([FCMATCH], [fc-match])
11340         if test -z "$FCMATCH"; then
11341             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11342             TEST_FONTS_MISSING=1
11343         else
11344             test_font_map 'Calibri' 'Carlito'
11345             test_font_map 'DejaVuSans' 'DejaVuSans'
11346             if test ${TEST_FONTS_MISSING} -eq 1
11347             then
11348                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11349                 add_warning "Unknown font mappings - unit tests disabled."
11350             fi
11351         fi
11352     else
11353         TEST_FONTS_MISSING=0
11354     fi
11356 AC_SUBST(WITH_FONTS)
11357 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11360 dnl ===================================================================
11361 dnl Test whether to enable online update service
11362 dnl ===================================================================
11363 AC_MSG_CHECKING([whether to enable online update])
11364 ENABLE_ONLINE_UPDATE=
11365 ENABLE_ONLINE_UPDATE_MAR=
11366 if test "$enable_online_update" = ""; then
11367     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11368         AC_MSG_RESULT([yes])
11369         ENABLE_ONLINE_UPDATE="TRUE"
11370     else
11371         AC_MSG_RESULT([no])
11372     fi
11373 else
11374     if test "$enable_online_update" = "mar"; then
11375         AC_MSG_RESULT([yes - MAR-based online update])
11376         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11377     elif test "$enable_online_update" = "yes"; then
11378         AC_MSG_RESULT([yes])
11379         ENABLE_ONLINE_UPDATE="TRUE"
11380     else
11381         AC_MSG_RESULT([no])
11382     fi
11384 AC_SUBST(ENABLE_ONLINE_UPDATE)
11385 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11387 dnl ===================================================================
11388 dnl Test whether we need bzip2
11389 dnl ===================================================================
11390 SYSTEM_BZIP2=
11391 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11392     AC_MSG_CHECKING([whether to use system bzip2])
11393     if test "$with_system_bzip2" = yes; then
11394         SYSTEM_BZIP2=TRUE
11395         AC_MSG_RESULT([yes])
11396         PKG_CHECK_MODULES(BZIP2, bzip2)
11397         FilterLibs "${BZIP2_LIBS}"
11398         BZIP2_LIBS="${filteredlibs}"
11399     else
11400         AC_MSG_RESULT([no])
11401         BUILD_TYPE="$BUILD_TYPE BZIP2"
11402     fi
11404 AC_SUBST(SYSTEM_BZIP2)
11405 AC_SUBST(BZIP2_CFLAGS)
11406 AC_SUBST(BZIP2_LIBS)
11408 dnl ===================================================================
11409 dnl Test whether to enable extension update
11410 dnl ===================================================================
11411 AC_MSG_CHECKING([whether to enable extension update])
11412 ENABLE_EXTENSION_UPDATE=
11413 if test "x$enable_extension_update" = "xno"; then
11414     AC_MSG_RESULT([no])
11415 else
11416     AC_MSG_RESULT([yes])
11417     ENABLE_EXTENSION_UPDATE="TRUE"
11418     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11419     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11421 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11424 dnl ===================================================================
11425 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11426 dnl ===================================================================
11427 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11428 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11429     AC_MSG_RESULT([no])
11430     ENABLE_SILENT_MSI=
11431 else
11432     AC_MSG_RESULT([yes])
11433     ENABLE_SILENT_MSI=TRUE
11434     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11436 AC_SUBST(ENABLE_SILENT_MSI)
11438 AC_MSG_CHECKING([whether and how to use Xinerama])
11439 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11440     if test "$x_libraries" = "default_x_libraries"; then
11441         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11442         if test "x$XINERAMALIB" = x; then
11443            XINERAMALIB="/usr/lib"
11444         fi
11445     else
11446         XINERAMALIB="$x_libraries"
11447     fi
11448     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11449         # we have both versions, let the user decide but use the dynamic one
11450         # per default
11451         USE_XINERAMA=TRUE
11452         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11453             XINERAMA_LINK=dynamic
11454         else
11455             XINERAMA_LINK=static
11456         fi
11457     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11458         # we have only the dynamic version
11459         USE_XINERAMA=TRUE
11460         XINERAMA_LINK=dynamic
11461     elif test -e "$XINERAMALIB/libXinerama.a"; then
11462         # static version
11463         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11464             USE_XINERAMA=TRUE
11465             XINERAMA_LINK=static
11466         else
11467             USE_XINERAMA=
11468             XINERAMA_LINK=none
11469         fi
11470     else
11471         # no Xinerama
11472         USE_XINERAMA=
11473         XINERAMA_LINK=none
11474     fi
11475     if test "$USE_XINERAMA" = "TRUE"; then
11476         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11477         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11478             [AC_MSG_ERROR(Xinerama header not found.)], [])
11479         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11480         if test "x$XEXTLIB" = x; then
11481            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11482         fi
11483         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11484         if test "$_os" = "FreeBSD"; then
11485             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11486         fi
11487         if test "$_os" = "Linux"; then
11488             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11489         fi
11490         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11491             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11492     else
11493         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11494     fi
11495 else
11496     USE_XINERAMA=
11497     XINERAMA_LINK=none
11498     AC_MSG_RESULT([no])
11500 AC_SUBST(USE_XINERAMA)
11501 AC_SUBST(XINERAMA_LINK)
11503 dnl ===================================================================
11504 dnl Test whether to build cairo or rely on the system version
11505 dnl ===================================================================
11507 if test "$USING_X11" = TRUE; then
11508     # Used in vcl/Library_vclplug_gen.mk
11509     test_cairo=yes
11512 if test "$test_cairo" = "yes"; then
11513     AC_MSG_CHECKING([whether to use the system cairo])
11515     : ${with_system_cairo:=$with_system_libs}
11516     if test "$with_system_cairo" = "yes"; then
11517         SYSTEM_CAIRO=TRUE
11518         AC_MSG_RESULT([yes])
11520         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11521         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11522         FilterLibs "${CAIRO_LIBS}"
11523         CAIRO_LIBS="${filteredlibs}"
11525         if test "$test_xrender" = "yes"; then
11526             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11527             AC_LANG_PUSH([C])
11528             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11529 #ifdef PictStandardA8
11530 #else
11531       return fail;
11532 #endif
11533 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11535             AC_LANG_POP([C])
11536         fi
11537     else
11538         SYSTEM_CAIRO=
11539         AC_MSG_RESULT([no])
11541         BUILD_TYPE="$BUILD_TYPE CAIRO"
11542     fi
11545 AC_SUBST(SYSTEM_CAIRO)
11546 AC_SUBST(CAIRO_CFLAGS)
11547 AC_SUBST(CAIRO_LIBS)
11549 dnl ===================================================================
11550 dnl Test whether to use avahi
11551 dnl ===================================================================
11552 if test "$_os" = "WINNT"; then
11553     # Windows uses bundled mDNSResponder
11554     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11555 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11556     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11557                       [ENABLE_AVAHI="TRUE"])
11558     AC_DEFINE(HAVE_FEATURE_AVAHI)
11559     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11560     FilterLibs "${AVAHI_LIBS}"
11561     AVAHI_LIBS="${filteredlibs}"
11564 AC_SUBST(ENABLE_AVAHI)
11565 AC_SUBST(AVAHI_CFLAGS)
11566 AC_SUBST(AVAHI_LIBS)
11568 dnl ===================================================================
11569 dnl Test whether to use liblangtag
11570 dnl ===================================================================
11571 SYSTEM_LIBLANGTAG=
11572 AC_MSG_CHECKING([whether to use system liblangtag])
11573 if test "$with_system_liblangtag" = yes; then
11574     SYSTEM_LIBLANGTAG=TRUE
11575     AC_MSG_RESULT([yes])
11576     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11577     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11578     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11579     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11580     FilterLibs "${LIBLANGTAG_LIBS}"
11581     LIBLANGTAG_LIBS="${filteredlibs}"
11582 else
11583     SYSTEM_LIBLANGTAG=
11584     AC_MSG_RESULT([no])
11585     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11586     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/langtag"
11587     if test "$COM" = "MSC"; then
11588         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11589     else
11590         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11591     fi
11593 AC_SUBST(SYSTEM_LIBLANGTAG)
11594 AC_SUBST(LIBLANGTAG_CFLAGS)
11595 AC_SUBST(LIBLANGTAG_LIBS)
11597 dnl ===================================================================
11598 dnl Test whether to build libpng or rely on the system version
11599 dnl ===================================================================
11601 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11603 dnl ===================================================================
11604 dnl Check for runtime JVM search path
11605 dnl ===================================================================
11606 if test "$ENABLE_JAVA" != ""; then
11607     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11608     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11609         AC_MSG_RESULT([yes])
11610         if ! test -d "$with_jvm_path"; then
11611             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11612         fi
11613         if ! test -d "$with_jvm_path"jvm; then
11614             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11615         fi
11616         JVM_ONE_PATH_CHECK="$with_jvm_path"
11617         AC_SUBST(JVM_ONE_PATH_CHECK)
11618     else
11619         AC_MSG_RESULT([no])
11620     fi
11623 dnl ===================================================================
11624 dnl Test for the presence of Ant and that it works
11625 dnl ===================================================================
11627 if test "$ENABLE_JAVA" != ""; then
11628     ANT_HOME=; export ANT_HOME
11629     WITH_ANT_HOME=; export WITH_ANT_HOME
11630     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11631         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11632             if test "$_os" = "WINNT"; then
11633                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11634             else
11635                 with_ant_home="$LODE_HOME/opt/ant"
11636             fi
11637         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11638             with_ant_home="$LODE_HOME/opt/ant"
11639         fi
11640     fi
11641     if test -z "$with_ant_home"; then
11642         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11643     else
11644         if test "$_os" = "WINNT"; then
11645             # AC_PATH_PROGS needs unix path
11646             with_ant_home=`cygpath -u "$with_ant_home"`
11647         fi
11648         AbsolutePath "$with_ant_home"
11649         with_ant_home=$absolute_path
11650         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11651         WITH_ANT_HOME=$with_ant_home
11652         ANT_HOME=$with_ant_home
11653     fi
11655     if test -z "$ANT"; then
11656         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11657     else
11658         # resolve relative or absolute symlink
11659         while test -h "$ANT"; do
11660             a_cwd=`pwd`
11661             a_basename=`basename "$ANT"`
11662             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11663             cd "`dirname "$ANT"`"
11664             cd "`dirname "$a_script"`"
11665             ANT="`pwd`"/"`basename "$a_script"`"
11666             cd "$a_cwd"
11667         done
11669         AC_MSG_CHECKING([if $ANT works])
11670         cat > conftest.java << EOF
11671         public class conftest {
11672             int testmethod(int a, int b) {
11673                     return a + b;
11674             }
11675         }
11678         cat > conftest.xml << EOF
11679         <project name="conftest" default="conftest">
11680         <target name="conftest">
11681             <javac srcdir="." includes="conftest.java">
11682             </javac>
11683         </target>
11684         </project>
11687         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11688         if test $? = 0 -a -f ./conftest.class; then
11689             AC_MSG_RESULT([Ant works])
11690             if test -z "$WITH_ANT_HOME"; then
11691                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11692                 if test -z "$ANT_HOME"; then
11693                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11694                 fi
11695             else
11696                 ANT_HOME="$WITH_ANT_HOME"
11697             fi
11698         else
11699             echo "configure: Ant test failed" >&5
11700             cat conftest.java >&5
11701             cat conftest.xml >&5
11702             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11703         fi
11704         rm -f conftest* core core.* *.core
11705     fi
11706     if test -z "$ANT_HOME"; then
11707         ANT_HOME="NO_ANT_HOME"
11708     else
11709         PathFormat "$ANT_HOME"
11710         ANT_HOME="$formatted_path"
11711         PathFormat "$ANT"
11712         ANT="$formatted_path"
11713     fi
11714     AC_SUBST(ANT_HOME)
11715     AC_SUBST(ANT)
11717     dnl Checking for ant.jar
11718     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11719         AC_MSG_CHECKING([Ant lib directory])
11720         if test -f $ANT_HOME/lib/ant.jar; then
11721             ANT_LIB="$ANT_HOME/lib"
11722         else
11723             if test -f $ANT_HOME/ant.jar; then
11724                 ANT_LIB="$ANT_HOME"
11725             else
11726                 if test -f /usr/share/java/ant.jar; then
11727                     ANT_LIB=/usr/share/java
11728                 else
11729                     if test -f /usr/share/ant-core/lib/ant.jar; then
11730                         ANT_LIB=/usr/share/ant-core/lib
11731                     else
11732                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11733                             ANT_LIB="$ANT_HOME/lib/ant"
11734                         else
11735                             if test -f /usr/share/lib/ant/ant.jar; then
11736                                 ANT_LIB=/usr/share/lib/ant
11737                             else
11738                                 AC_MSG_ERROR([Ant libraries not found!])
11739                             fi
11740                         fi
11741                     fi
11742                 fi
11743             fi
11744         fi
11745         PathFormat "$ANT_LIB"
11746         ANT_LIB="$formatted_path"
11747         AC_MSG_RESULT([Ant lib directory found.])
11748     fi
11749     AC_SUBST(ANT_LIB)
11751     ant_minver=1.6.0
11752     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11754     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11755     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11756     ant_version_major=`echo $ant_version | cut -d. -f1`
11757     ant_version_minor=`echo $ant_version | cut -d. -f2`
11758     echo "configure: ant_version $ant_version " >&5
11759     echo "configure: ant_version_major $ant_version_major " >&5
11760     echo "configure: ant_version_minor $ant_version_minor " >&5
11761     if test "$ant_version_major" -ge "2"; then
11762         AC_MSG_RESULT([yes, $ant_version])
11763     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11764         AC_MSG_RESULT([yes, $ant_version])
11765     else
11766         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11767     fi
11769     rm -f conftest* core core.* *.core
11772 OOO_JUNIT_JAR=
11773 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11774     AC_MSG_CHECKING([for JUnit 4])
11775     if test "$with_junit" = "yes"; then
11776         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11777             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11778         elif test -e /usr/share/java/junit4.jar; then
11779             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11780         else
11781            if test -e /usr/share/lib/java/junit.jar; then
11782               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11783            else
11784               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11785            fi
11786         fi
11787     else
11788         OOO_JUNIT_JAR=$with_junit
11789     fi
11790     if test "$_os" = "WINNT"; then
11791         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11792     fi
11793     printf 'import org.junit.Before;' > conftest.java
11794     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11795         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11796     else
11797         AC_MSG_ERROR(
11798 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11799  specify its pathname via --with-junit=..., or disable it via --without-junit])
11800     fi
11801     rm -f conftest.class conftest.java
11802     if test $OOO_JUNIT_JAR != ""; then
11803     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11804     fi
11806 AC_SUBST(OOO_JUNIT_JAR)
11808 HAMCREST_JAR=
11809 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11810     AC_MSG_CHECKING([for included Hamcrest])
11811     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11812     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11813         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11814     else
11815         AC_MSG_RESULT([Not included])
11816         AC_MSG_CHECKING([for standalone hamcrest jar.])
11817         if test "$with_hamcrest" = "yes"; then
11818             if test -e /usr/share/lib/java/hamcrest.jar; then
11819                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11820             elif test -e /usr/share/java/hamcrest/core.jar; then
11821                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11822             else
11823                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11824             fi
11825         else
11826             HAMCREST_JAR=$with_hamcrest
11827         fi
11828         if test "$_os" = "WINNT"; then
11829             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11830         fi
11831         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11832             AC_MSG_RESULT([$HAMCREST_JAR])
11833         else
11834             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),
11835                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11836         fi
11837     fi
11838     rm -f conftest.class conftest.java
11840 AC_SUBST(HAMCREST_JAR)
11843 AC_SUBST(SCPDEFS)
11846 # check for wget and curl
11848 WGET=
11849 CURL=
11851 if test "$enable_fetch_external" != "no"; then
11853 CURL=`which curl 2>/dev/null`
11855 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11856     # wget new enough?
11857     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11858     if test $? -eq 0; then
11859         WGET=$i
11860         break
11861     fi
11862 done
11864 if test -z "$WGET" -a -z "$CURL"; then
11865     AC_MSG_ERROR([neither wget nor curl found!])
11870 AC_SUBST(WGET)
11871 AC_SUBST(CURL)
11874 # check for sha256sum
11876 SHA256SUM=
11878 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11879     eval "$i -a 256 --version" > /dev/null 2>&1
11880     ret=$?
11881     if test $ret -eq 0; then
11882         SHA256SUM="$i -a 256"
11883         break
11884     fi
11885 done
11887 if test -z "$SHA256SUM"; then
11888     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11889         eval "$i --version" > /dev/null 2>&1
11890         ret=$?
11891         if test $ret -eq 0; then
11892             SHA256SUM=$i
11893             break
11894         fi
11895     done
11898 if test -z "$SHA256SUM"; then
11899     AC_MSG_ERROR([no sha256sum found!])
11902 AC_SUBST(SHA256SUM)
11904 dnl ===================================================================
11905 dnl Dealing with l10n options
11906 dnl ===================================================================
11907 AC_MSG_CHECKING([which languages to be built])
11908 # get list of all languages
11909 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11910 # the sed command does the following:
11911 #   + if a line ends with a backslash, append the next line to it
11912 #   + adds " on the beginning of the value (after =)
11913 #   + adds " at the end of the value
11914 #   + removes en-US; we want to put it on the beginning
11915 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11916 [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)]
11917 ALL_LANGS="en-US $completelangiso"
11918 # check the configured localizations
11919 WITH_LANG="$with_lang"
11920 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11921     AC_MSG_RESULT([en-US])
11922 else
11923     AC_MSG_RESULT([$WITH_LANG])
11924     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11926 # check that the list is valid
11927 for lang in $WITH_LANG; do
11928     test "$lang" = "ALL" && continue
11929     # need to check for the exact string, so add space before and after the list of all languages
11930     for vl in $ALL_LANGS; do
11931         if test "$vl" = "$lang"; then
11932            break
11933         fi
11934     done
11935     if test "$vl" != "$lang"; then
11936         # if you're reading this - you prolly quoted your languages remove the quotes ...
11937         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11938     fi
11939 done
11940 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11941     echo $WITH_LANG | grep -q en-US
11942     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11944 # list with substituted ALL
11945 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11946 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11947 test "$WITH_LANG" = "en-US" && WITH_LANG=
11948 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11949     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11950     ALL_LANGS=`echo $ALL_LANGS qtz`
11952 AC_SUBST(ALL_LANGS)
11953 AC_SUBST(WITH_LANG)
11954 AC_SUBST(WITH_LANG_LIST)
11955 AC_SUBST(GIT_NEEDED_SUBMODULES)
11957 WITH_POOR_HELP_LOCALIZATIONS=
11958 if test -d "$SRC_ROOT/translations/source"; then
11959     for l in `ls -1 $SRC_ROOT/translations/source`; do
11960         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11961             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11962         fi
11963     done
11965 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11967 if test -n "$with_locales"; then
11968     WITH_LOCALES="$with_locales"
11970     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11971     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11972     # config_host/config_locales.h.in
11973     for locale in $WITH_LOCALES; do
11974         lang=${locale%_*}
11976         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
11978         case $lang in
11979         hi|mr*ne)
11980             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
11981             ;;
11982         bg|ru)
11983             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
11984             ;;
11985         esac
11986     done
11987 else
11988     AC_DEFINE(WITH_LOCALE_ALL)
11990 AC_SUBST(WITH_LOCALES)
11992 dnl git submodule update --reference
11993 dnl ===================================================================
11994 if test -n "${GIT_REFERENCE_SRC}"; then
11995     for repo in ${GIT_NEEDED_SUBMODULES}; do
11996         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11997             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11998         fi
11999     done
12001 AC_SUBST(GIT_REFERENCE_SRC)
12003 dnl git submodules linked dirs
12004 dnl ===================================================================
12005 if test -n "${GIT_LINK_SRC}"; then
12006     for repo in ${GIT_NEEDED_SUBMODULES}; do
12007         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12008             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12009         fi
12010     done
12012 AC_SUBST(GIT_LINK_SRC)
12014 dnl branding
12015 dnl ===================================================================
12016 AC_MSG_CHECKING([for alternative branding images directory])
12017 # initialize mapped arrays
12018 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12019 brand_files="$BRAND_INTRO_IMAGES about.svg"
12021 if test -z "$with_branding" -o "$with_branding" = "no"; then
12022     AC_MSG_RESULT([none])
12023     DEFAULT_BRAND_IMAGES="$brand_files"
12024 else
12025     if ! test -d $with_branding ; then
12026         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12027     else
12028         AC_MSG_RESULT([$with_branding])
12029         CUSTOM_BRAND_DIR="$with_branding"
12030         for lfile in $brand_files
12031         do
12032             if ! test -f $with_branding/$lfile ; then
12033                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12034                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12035             else
12036                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12037             fi
12038         done
12039         check_for_progress="yes"
12040     fi
12042 AC_SUBST([BRAND_INTRO_IMAGES])
12043 AC_SUBST([CUSTOM_BRAND_DIR])
12044 AC_SUBST([CUSTOM_BRAND_IMAGES])
12045 AC_SUBST([DEFAULT_BRAND_IMAGES])
12048 AC_MSG_CHECKING([for 'intro' progress settings])
12049 PROGRESSBARCOLOR=
12050 PROGRESSSIZE=
12051 PROGRESSPOSITION=
12052 PROGRESSFRAMECOLOR=
12053 PROGRESSTEXTCOLOR=
12054 PROGRESSTEXTBASELINE=
12056 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12057     source "$with_branding/progress.conf"
12058     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12059 else
12060     AC_MSG_RESULT([none])
12063 AC_SUBST(PROGRESSBARCOLOR)
12064 AC_SUBST(PROGRESSSIZE)
12065 AC_SUBST(PROGRESSPOSITION)
12066 AC_SUBST(PROGRESSFRAMECOLOR)
12067 AC_SUBST(PROGRESSTEXTCOLOR)
12068 AC_SUBST(PROGRESSTEXTBASELINE)
12071 AC_MSG_CHECKING([for extra build ID])
12072 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12073     EXTRA_BUILDID="$with_extra_buildid"
12075 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12076 if test -n "$EXTRA_BUILDID" ; then
12077     AC_MSG_RESULT([$EXTRA_BUILDID])
12078 else
12079     AC_MSG_RESULT([not set])
12081 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12083 OOO_VENDOR=
12084 AC_MSG_CHECKING([for vendor])
12085 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12086     OOO_VENDOR="$USERNAME"
12088     if test -z "$OOO_VENDOR"; then
12089         OOO_VENDOR="$USER"
12090     fi
12092     if test -z "$OOO_VENDOR"; then
12093         OOO_VENDOR="`id -u -n`"
12094     fi
12096     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12097 else
12098     OOO_VENDOR="$with_vendor"
12099     AC_MSG_RESULT([$OOO_VENDOR])
12101 AC_SUBST(OOO_VENDOR)
12103 if echo "$host_os" | grep -q linux-android ; then
12104     ANDROID_PACKAGE_NAME=
12105     AC_MSG_CHECKING([for Android package name])
12106     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12107         if test -n "$ENABLE_DEBUG"; then
12108             # Default to the package name that makes ndk-gdb happy.
12109             ANDROID_PACKAGE_NAME="org.libreoffice"
12110         else
12111             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12112         fi
12114         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12115     else
12116         ANDROID_PACKAGE_NAME="$with_android_package_name"
12117         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12118     fi
12119     AC_SUBST(ANDROID_PACKAGE_NAME)
12122 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12123 if test "$with_compat_oowrappers" = "yes"; then
12124     WITH_COMPAT_OOWRAPPERS=TRUE
12125     AC_MSG_RESULT(yes)
12126 else
12127     WITH_COMPAT_OOWRAPPERS=
12128     AC_MSG_RESULT(no)
12130 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12132 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12133 AC_MSG_CHECKING([for install dirname])
12134 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12135     INSTALLDIRNAME="$with_install_dirname"
12137 AC_MSG_RESULT([$INSTALLDIRNAME])
12138 AC_SUBST(INSTALLDIRNAME)
12140 AC_MSG_CHECKING([for prefix])
12141 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12142 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12143 PREFIXDIR="$prefix"
12144 AC_MSG_RESULT([$PREFIXDIR])
12145 AC_SUBST(PREFIXDIR)
12147 LIBDIR=[$(eval echo $(eval echo $libdir))]
12148 AC_SUBST(LIBDIR)
12150 DATADIR=[$(eval echo $(eval echo $datadir))]
12151 AC_SUBST(DATADIR)
12153 MANDIR=[$(eval echo $(eval echo $mandir))]
12154 AC_SUBST(MANDIR)
12156 DOCDIR=[$(eval echo $(eval echo $docdir))]
12157 AC_SUBST(DOCDIR)
12159 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12160 AC_SUBST(INSTALLDIR)
12162 TESTINSTALLDIR="${BUILDDIR}/test-install"
12163 AC_SUBST(TESTINSTALLDIR)
12166 # ===================================================================
12167 # OAuth2 id and secrets
12168 # ===================================================================
12170 AC_MSG_CHECKING([for Google Drive client id and secret])
12171 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12172 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12173 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12174     GDRIVE_CLIENT_ID="\"\""
12177 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12178     GDRIVE_CLIENT_SECRET="\"\""
12181 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12182     AC_MSG_RESULT([not set])
12183 else
12184     AC_MSG_RESULT([set])
12187 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12188 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12190 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12191 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12192 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12193 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12194     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12197 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12198     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12201 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12202     AC_MSG_RESULT([not set])
12203 else
12204     AC_MSG_RESULT([set])
12206 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12207 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12209 AC_MSG_CHECKING([for OneDrive client id and secret])
12210 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12211 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12212 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12213     ONEDRIVE_CLIENT_ID="\"\""
12216 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12217     ONEDRIVE_CLIENT_SECRET="\"\""
12220 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12221     AC_MSG_RESULT([not set])
12222 else
12223     AC_MSG_RESULT([set])
12225 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12226 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12229 dnl ===================================================================
12230 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12231 dnl --enable-dependency-tracking configure option
12232 dnl ===================================================================
12233 AC_MSG_CHECKING([whether to enable dependency tracking])
12234 if test "$enable_dependency_tracking" = "no"; then
12235     nodep=TRUE
12236     AC_MSG_RESULT([no])
12237 else
12238     AC_MSG_RESULT([yes])
12240 AC_SUBST(nodep)
12242 dnl ===================================================================
12243 dnl Number of CPUs to use during the build
12244 dnl ===================================================================
12245 AC_MSG_CHECKING([for number of processors to use])
12246 # plain --with-parallelism is just the default
12247 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12248     if test "$with_parallelism" = "no"; then
12249         PARALLELISM=0
12250     else
12251         PARALLELISM=$with_parallelism
12252     fi
12253 else
12254     if test "$enable_icecream" = "yes"; then
12255         PARALLELISM="10"
12256     else
12257         case `uname -s` in
12259         Darwin|FreeBSD|NetBSD|OpenBSD)
12260             PARALLELISM=`sysctl -n hw.ncpu`
12261             ;;
12263         Linux)
12264             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12265         ;;
12266         # what else than above does profit here *and* has /proc?
12267         *)
12268             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12269             ;;
12270         esac
12272         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12273         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12274     fi
12277 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12278     if test -z "$with_parallelism"; then
12279             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12280             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12281             PARALLELISM="1"
12282     else
12283         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."
12284     fi
12287 if test $PARALLELISM -eq 0; then
12288     AC_MSG_RESULT([explicit make -j option needed])
12289 else
12290     AC_MSG_RESULT([$PARALLELISM])
12292 AC_SUBST(PARALLELISM)
12294 IWYU_PATH="$with_iwyu"
12295 AC_SUBST(IWYU_PATH)
12296 if test ! -z "$IWYU_PATH"; then
12297     if test ! -f "$IWYU_PATH"; then
12298         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12299     fi
12303 # Set up ILIB for MSVC build
12305 ILIB1=
12306 if test "$build_os" = "cygwin"; then
12307     ILIB="."
12308     if test -n "$JAVA_HOME"; then
12309         ILIB="$ILIB;$JAVA_HOME/lib"
12310     fi
12311     ILIB1=-link
12312     if test "$BITNESS_OVERRIDE" = 64; then
12313         if test $vcnum = "150"; then
12314             ILIB="$ILIB;$COMPATH/lib/x64"
12315             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12316         else
12317             ILIB="$ILIB;$COMPATH/lib/amd64"
12318             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12319         fi
12320         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12321         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12322         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12323             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12324             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12325         fi
12326         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12327         ucrtlibpath_formatted=$formatted_path
12328         ILIB="$ILIB;$ucrtlibpath_formatted"
12329         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12330     else
12331         if test $vcnum = "150"; then
12332             ILIB="$ILIB;$COMPATH/lib/x86"
12333             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12334         else
12335             ILIB="$ILIB;$COMPATH/lib"
12336             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12337         fi
12338         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12339         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12340         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12341             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12342             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12343         fi
12344         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12345         ucrtlibpath_formatted=$formatted_path
12346         ILIB="$ILIB;$ucrtlibpath_formatted"
12347         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12348     fi
12349     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12350         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12351     else
12352         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12353     fi
12355     AC_SUBST(ILIB)
12358 AC_MSG_CHECKING(
12359     [whether C++11 use of const_iterator in standard containers is broken])
12360 save_CXXFLAGS=$CXXFLAGS
12361 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12362 AC_LANG_PUSH([C++])
12363 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12364     #include <list>
12365     ]],[[
12366         std::list<int> l;
12367         l.erase(l.cbegin());
12368     ]])],
12369     [broken=no], [broken=yes])
12370 AC_LANG_POP([C++])
12371 CXXFLAGS=$save_CXXFLAGS
12372 AC_MSG_RESULT([$broken])
12373 if test "$broken" = yes; then
12374     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12378 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12379 save_CXXFLAGS=$CXXFLAGS
12380 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12381 save_LIBS=$LIBS
12382 if test -n "$ILIB1"; then
12383     LIBS="$LIBS $ILIB1"
12385 AC_LANG_PUSH([C++])
12386 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12387     // Exit with failure if the static initializer_list is stored on the
12388     // stack (as done by Clang < 3.4):
12389     #include <initializer_list>
12390     struct S {};
12391     bool g(void const * p1, void const * p2) {
12392         int n;
12393         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12394     }
12395     bool f(void const * p1) {
12396         static std::initializer_list<S> s { S() };
12397         return g(p1, s.begin());
12398     }
12399     ]],[[
12400         int n;
12401         return f(&n) ? 0 : 1;
12402     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12403 AC_LANG_POP([C++])
12404 LIBS=$save_LIBS
12405 CXXFLAGS=$save_CXXFLAGS
12406 AC_MSG_RESULT([$broken])
12407 if test "$broken" = yes; then
12408     AC_MSG_ERROR([working support for static initializer_list needed])
12412 # ===================================================================
12413 # Creating bigger shared library to link against
12414 # ===================================================================
12415 AC_MSG_CHECKING([whether to create huge library])
12416 MERGELIBS=
12418 if test $_os = iOS -o $_os = Android; then
12419     # Never any point in mergelibs for these as we build just static
12420     # libraries anyway...
12421     enable_mergelibs=no
12424 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12425     if test $_os != Linux -a $_os != WINNT; then
12426         add_warning "--enable-mergelibs is not tested for this platform"
12427     fi
12428     MERGELIBS="TRUE"
12429     AC_MSG_RESULT([yes])
12430 else
12431     AC_MSG_RESULT([no])
12433 AC_SUBST([MERGELIBS])
12435 dnl ===================================================================
12436 dnl icerun is a wrapper that stops us spawning tens of processes
12437 dnl locally - for tools that can't be executed on the compile cluster
12438 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12439 dnl ===================================================================
12440 AC_MSG_CHECKING([whether to use icerun wrapper])
12441 ICECREAM_RUN=
12442 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12443     ICECREAM_RUN=icerun
12444     AC_MSG_RESULT([yes])
12445 else
12446     AC_MSG_RESULT([no])
12448 AC_SUBST(ICECREAM_RUN)
12450 dnl ===================================================================
12451 dnl Setup the ICECC_VERSION for the build the same way it was set for
12452 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12453 dnl ===================================================================
12454 x_ICECC_VERSION=[\#]
12455 if test -n "$ICECC_VERSION" ; then
12456     x_ICECC_VERSION=
12458 AC_SUBST(x_ICECC_VERSION)
12459 AC_SUBST(ICECC_VERSION)
12461 dnl ===================================================================
12463 AC_MSG_CHECKING([MPL subset])
12464 MPL_SUBSET=
12466 if test "$enable_mpl_subset" = "yes"; then
12467     warn_report=false
12468     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12469         warn_report=true
12470     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12471         warn_report=true
12472     fi
12473     if test "$warn_report" = "true"; then
12474         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12475     fi
12476     if test "x$enable_postgresql_sdbc" != "xno"; then
12477         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12478     fi
12479     if test "$enable_lotuswordpro" = "yes"; then
12480         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12481     fi
12482     if test "$WITH_WEBDAV" = "neon"; then
12483         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12484     fi
12485     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12486         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12487     fi
12488     if test -n "$ENABLE_PDFIMPORT"; then
12489         if test "x$SYSTEM_POPPLER" = "x"; then
12490             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12491         fi
12492     fi
12493     # cf. m4/libo_check_extension.m4
12494     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12495         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12496     fi
12497     for theme in $WITH_THEMES; do
12498         case $theme in
12499         breeze|crystal|default|hicontrast|oxygen|sifr)
12500             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12501         *) : ;;
12502         esac
12503     done
12505     ENABLE_OPENGL_TRANSITIONS=
12507     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12508         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12509     fi
12511     MPL_SUBSET="TRUE"
12512     AC_DEFINE(MPL_HAVE_SUBSET)
12513     AC_MSG_RESULT([only])
12514 else
12515     AC_MSG_RESULT([no restrictions])
12517 AC_SUBST(MPL_SUBSET)
12519 dnl ===================================================================
12521 AC_MSG_CHECKING([formula logger])
12522 ENABLE_FORMULA_LOGGER=
12524 if test "x$enable_formula_logger" = "xyes"; then
12525     AC_MSG_RESULT([yes])
12526     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12527     ENABLE_FORMULA_LOGGER=TRUE
12528 elif test -n "$ENABLE_DBGUTIL" ; then
12529     AC_MSG_RESULT([yes])
12530     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12531     ENABLE_FORMULA_LOGGER=TRUE
12532 else
12533     AC_MSG_RESULT([no])
12536 AC_SUBST(ENABLE_FORMULA_LOGGER)
12538 dnl ===================================================================
12539 dnl Setting up the environment.
12540 dnl ===================================================================
12541 AC_MSG_NOTICE([setting up the build environment variables...])
12543 AC_SUBST(COMPATH)
12545 if test "$build_os" = "cygwin"; then
12546     if test -d "$COMPATH/atlmfc/lib"; then
12547         ATL_LIB="$COMPATH/atlmfc/lib"
12548         ATL_INCLUDE="$COMPATH/atlmfc/include"
12549     else
12550         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12551         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12552     fi
12553     if test "$BITNESS_OVERRIDE" = 64; then
12554         if test $VCVER = "150"; then
12555             ATL_LIB="$ATL_LIB/x64"
12556         else
12557             ATL_LIB="$ATL_LIB/amd64"
12558         fi
12559     else
12560         if test $VCVER = "150"; then
12561             ATL_LIB="$ATL_LIB/x86"
12562         fi
12563     fi
12564     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12565     PathFormat "/usr/bin/find.exe"
12566     FIND="$formatted_path"
12567     PathFormat "/usr/bin/sort.exe"
12568     SORT="$formatted_path"
12569     PathFormat "/usr/bin/grep.exe"
12570     WIN_GREP="$formatted_path"
12571     PathFormat "/usr/bin/ls.exe"
12572     WIN_LS="$formatted_path"
12573     PathFormat "/usr/bin/touch.exe"
12574     WIN_TOUCH="$formatted_path"
12575 else
12576     FIND=find
12577     SORT=sort
12580 AC_SUBST(ATL_INCLUDE)
12581 AC_SUBST(ATL_LIB)
12582 AC_SUBST(FIND)
12583 AC_SUBST(SORT)
12584 AC_SUBST(WIN_GREP)
12585 AC_SUBST(WIN_LS)
12586 AC_SUBST(WIN_TOUCH)
12588 AC_SUBST(BUILD_TYPE)
12590 AC_SUBST(SOLARINC)
12592 PathFormat "$PERL"
12593 PERL="$formatted_path"
12594 AC_SUBST(PERL)
12596 if test -n "$TMPDIR"; then
12597     TEMP_DIRECTORY="$TMPDIR"
12598 else
12599     TEMP_DIRECTORY="/tmp"
12601 if test "$build_os" = "cygwin"; then
12602     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12604 AC_SUBST(TEMP_DIRECTORY)
12606 # setup the PATH for the environment
12607 if test -n "$LO_PATH_FOR_BUILD"; then
12608     LO_PATH="$LO_PATH_FOR_BUILD"
12609 else
12610     LO_PATH="$PATH"
12612     case "$host_os" in
12614     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12615         if test "$ENABLE_JAVA" != ""; then
12616             pathmunge "$JAVA_HOME/bin" "after"
12617         fi
12618         ;;
12620     cygwin*)
12621         # Win32 make needs native paths
12622         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12623             LO_PATH=`cygpath -p -m "$PATH"`
12624         fi
12625         if test "$BITNESS_OVERRIDE" = 64; then
12626             # needed for msi packaging
12627             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12628         fi
12629         # .NET 4.6 and higher don't have bin directory
12630         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12631             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12632         fi
12633         pathmunge "$ASM_HOME" "before"
12634         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12635         pathmunge "$CSC_PATH" "before"
12636         pathmunge "$MIDL_PATH" "before"
12637         pathmunge "$AL_PATH" "before"
12638         pathmunge "$MSPDB_PATH" "before"
12639         if test -n "$MSBUILD_PATH" ; then
12640             pathmunge "$MSBUILD_PATH" "before"
12641         fi
12642         if test "$BITNESS_OVERRIDE" = 64; then
12643             pathmunge "$COMPATH/bin/amd64" "before"
12644             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12645         else
12646             pathmunge "$COMPATH/bin" "before"
12647             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12648         fi
12649         if test "$ENABLE_JAVA" != ""; then
12650             if test -d "$JAVA_HOME/jre/bin/client"; then
12651                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12652             fi
12653             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12654                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12655             fi
12656             pathmunge "$JAVA_HOME/bin" "before"
12657         fi
12658         ;;
12660     solaris*)
12661         pathmunge "/usr/css/bin" "before"
12662         if test "$ENABLE_JAVA" != ""; then
12663             pathmunge "$JAVA_HOME/bin" "after"
12664         fi
12665         ;;
12666     esac
12669 AC_SUBST(LO_PATH)
12671 libo_FUZZ_SUMMARY
12673 # Generate a configuration sha256 we can use for deps
12674 if test -f config_host.mk; then
12675     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12677 if test -f config_host_lang.mk; then
12678     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12681 CFLAGS=$my_original_CFLAGS
12682 CXXFLAGS=$my_original_CXXFLAGS
12683 CPPFLAGS=$my_original_CPPFLAGS
12685 AC_CONFIG_FILES([config_host.mk
12686                  config_host_lang.mk
12687                  Makefile
12688                  lo.xcent
12689                  bin/bffvalidator.sh
12690                  bin/odfvalidator.sh
12691                  bin/officeotron.sh
12692                  instsetoo_native/util/openoffice.lst
12693                  sysui/desktop/macosx/Info.plist
12694                  ios/lo.xcconfig])
12695 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12696 AC_CONFIG_HEADERS([config_host/config_clang.h])
12697 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12698 AC_CONFIG_HEADERS([config_host/config_eot.h])
12699 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12700 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12701 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12702 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12703 AC_CONFIG_HEADERS([config_host/config_features.h])
12704 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12705 AC_CONFIG_HEADERS([config_host/config_folders.h])
12706 AC_CONFIG_HEADERS([config_host/config_gio.h])
12707 AC_CONFIG_HEADERS([config_host/config_global.h])
12708 AC_CONFIG_HEADERS([config_host/config_java.h])
12709 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12710 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12711 AC_CONFIG_HEADERS([config_host/config_locales.h])
12712 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12713 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12714 AC_CONFIG_HEADERS([config_host/config_oox.h])
12715 AC_CONFIG_HEADERS([config_host/config_options.h])
12716 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12717 AC_CONFIG_HEADERS([config_host/config_test.h])
12718 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12719 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12720 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12721 AC_CONFIG_HEADERS([config_host/config_version.h])
12722 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12723 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12724 AC_CONFIG_HEADERS([config_host/config_python.h])
12725 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12726 AC_OUTPUT
12728 if test "$CROSS_COMPILING" = TRUE; then
12729     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12732 # touch the config timestamp file
12733 if test ! -f config_host.mk.stamp; then
12734     echo > config_host.mk.stamp
12735 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12736     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12737 else
12738     echo > config_host.mk.stamp
12741 # touch the config lang timestamp file
12742 if test ! -f config_host_lang.mk.stamp; then
12743     echo > config_host_lang.mk.stamp
12744 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12745     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12746 else
12747     echo > config_host_lang.mk.stamp
12751 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12753 cat << _EOS
12754 ****************************************************************************
12755 WARNING:
12756 Your make version is known to be horribly slow, and hard to debug
12757 problems with. To get a reasonably functional make please do:
12759 to install a pre-compiled binary make for Win32
12761  mkdir -p /opt/lo/bin
12762  cd /opt/lo/bin
12763  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12764  cp make-85047eb-msvc.exe make
12765  chmod +x make
12767 to install from source:
12768 place yourself in a working directory of you choice.
12770  git clone git://git.savannah.gnu.org/make.git
12772  [go to Start menu, click "All Programs", click "Visual Studio 2015", click "Visual Studio Tools", double-click "VS2015 x86 Native Tools Command Prompt" or "VS2015 x64 Native Tools Command Prompt"]
12773  set PATH=%PATH%;C:\Cygwin\bin
12774  [or Cygwin64, if that is what you have]
12775  cd path-to-make-repo-you-cloned-above
12776  build_w32.bat --without-guile
12778 should result in a WinRel/gnumake.exe.
12779 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12781 Then re-run autogen.sh
12783 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12784 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12786 _EOS
12789 cat << _EOF
12790 ****************************************************************************
12792 To build, run:
12793 $GNUMAKE
12795 To view some help, run:
12796 $GNUMAKE help
12798 _EOF
12800 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12801     cat << _EOF
12802 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12803 _EOF
12805     if test $_os = Darwin; then
12806         echo open instdir/$PRODUCTNAME.app
12807     else
12808         echo instdir/program/soffice
12809     fi
12810     cat << _EOF
12812 If you want to run the smoketest, run:
12813 $GNUMAKE check
12815 _EOF
12818 if test -f warn; then
12819     cat warn
12820     rm warn
12823 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: