update credits - with aliases fixed
[LibreOffice.git] / configure.ac
blobaae4bac6ad9789b2976c8486a04ad349b3cb5435
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.0.2.0+],[],[],[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; 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     *)
2775         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--12])
2776         ;;
2777     esac
2779     if test "$with_macosx_version_min_required" = "" ; then
2780         with_macosx_version_min_required="10.9";
2781     fi
2783     if test "$with_macosx_version_max_allowed" = "" ; then
2784         with_macosx_version_max_allowed="$with_macosx_sdk"
2785     fi
2787     # export this so that "xcrun" invocations later return matching values
2788     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2789     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2790     export DEVELOPER_DIR
2791     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2792     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2794     case "$with_macosx_version_min_required" in
2795     10.9)
2796         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2797         ;;
2798     10.10)
2799         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2800         ;;
2801     10.11)
2802         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2803         ;;
2804     10.12)
2805         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2806         ;;
2807     *)
2808         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--12])
2809         ;;
2810     esac
2812     LIBTOOL=/usr/bin/libtool
2813     INSTALL_NAME_TOOL=install_name_tool
2814     if test -z "$save_CC"; then
2815         AC_MSG_CHECKING([what compiler to use])
2816         stdlib=-stdlib=libc++
2817         if test "$ENABLE_LTO" = TRUE; then
2818             lto=-flto
2819         fi
2820         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2821         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2822         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2823         AR=`xcrun -find ar`
2824         NM=`xcrun -find nm`
2825         STRIP=`xcrun -find strip`
2826         LIBTOOL=`xcrun -find libtool`
2827         RANLIB=`xcrun -find ranlib`
2828         AC_MSG_RESULT([$CC and $CXX])
2829     fi
2831     case "$with_macosx_version_max_allowed" in
2832     10.9)
2833         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2834         ;;
2835     10.10)
2836         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2837         ;;
2838     10.11)
2839         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2840         ;;
2841     10.12)
2842         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2843         ;;
2844     *)
2845         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--12])
2846         ;;
2847     esac
2849     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2850     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2851         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2852     else
2853         AC_MSG_RESULT([ok])
2854     fi
2856     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2857     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2858         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2859     else
2860         AC_MSG_RESULT([ok])
2861     fi
2862     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2863     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2865     AC_MSG_CHECKING([whether to do code signing])
2867     if test "$enable_macosx_code_signing" = yes; then
2868         # By default use the first suitable certificate (?).
2870         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2871         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2872         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2873         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2874         # "Developer ID Application" one.
2876         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2877         if test -n "$identity"; then
2878             MACOSX_CODESIGNING_IDENTITY=$identity
2879             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2880             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2881         else
2882             AC_MSG_ERROR([cannot determine identity to use])
2883         fi
2884     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2885         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2886         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2887         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2888     else
2889         AC_MSG_RESULT([no])
2890     fi
2892     AC_MSG_CHECKING([whether to create a Mac App Store package])
2894     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2895         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2896     elif test "$enable_macosx_package_signing" = yes; then
2897         # By default use the first suitable certificate.
2898         # It should be a "3rd Party Mac Developer Installer" one
2900         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2901         if test -n "$identity"; then
2902             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2903             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2904             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2905         else
2906             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2907         fi
2908     elif test -n "$enable_macosx_package_signing"; then
2909         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2910         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2911         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2912     else
2913         AC_MSG_RESULT([no])
2914     fi
2916     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2917         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2918     fi
2920     AC_MSG_CHECKING([whether to sandbox the application])
2922     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2923         AC_MSG_ERROR([OS X sandboxing requires code signing])
2924     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2925         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2926     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2927         ENABLE_MACOSX_SANDBOX=TRUE
2928         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2929         AC_MSG_RESULT([yes])
2930     else
2931         AC_MSG_RESULT([no])
2932     fi
2934     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2935     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2936     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2938 AC_SUBST(MACOSX_SDK_PATH)
2939 AC_SUBST(MACOSX_SDK_VERSION)
2940 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2941 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2942 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2943 AC_SUBST(INSTALL_NAME_TOOL)
2944 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2945 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2946 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2947 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2948 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2950 dnl ===================================================================
2951 dnl Check iOS SDK and compiler
2952 dnl ===================================================================
2954 if test $_os = iOS; then
2956     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2957         :
2958     else
2959         BITNESS_OVERRIDE=64
2960     fi
2962     AC_MSG_CHECKING([what iOS SDK to use])
2964     if test "$enable_ios_simulator" = yes; then
2965         platform=iPhoneSimulator
2966     else
2967         platform=iPhoneOS
2968     fi
2970     xcode_developer=`xcode-select -print-path`
2972     current_sdk_ver=10.2
2973     for sdkver in 10.3 10.2 10.1 10.0 9.3; do
2974         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2975         if test -d $t; then
2976             ios_sdk=$sdkver
2977             sysroot=$t
2978             break
2979         fi
2980     done
2982     if test -z "$sysroot"; then
2983         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2984     fi
2986     AC_MSG_RESULT($sysroot)
2988     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2990     if test "$enable_ios_simulator" = yes; then
2991         if test "$BITNESS_OVERRIDE" = 64; then
2992             XCODE_ARCHS=x86_64
2993             versionmin=-mios-simulator-version-min=9.3
2994         else
2995             XCODE_ARCHS=i386
2996             versionmin=-mios-simulator-version-min=9.3
2997         fi
2998     else
2999         platform=iPhoneOS
3000         if test "$BITNESS_OVERRIDE" = 64; then
3001             XCODE_ARCHS=arm64
3002         else
3003             XCODE_ARCHS=armv7
3004         fi
3005         versionmin=-miphoneos-version-min=9.3
3006     fi
3008     # LTO is not really recommended for iOS builds,
3009     # the link time will be astronomical
3010     if test "$ENABLE_LTO" = TRUE; then
3011         lto=-flto
3012     fi
3013     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3014     # get compiled with it, to avoid ld warnings when linking all that together into one
3015     # executable.
3017     XCODE_CLANG_CXX_LIBRARY=libc++
3018     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3020     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3021     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3023     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3024     AR=`xcrun -find ar`
3025     NM=`xcrun -find nm`
3026     STRIP=`xcrun -find strip`
3027     LIBTOOL=`xcrun -find libtool`
3028     RANLIB=`xcrun -find ranlib`
3031 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3032 AC_SUBST(XCODE_ARCHS)
3033 AC_SUBST(XCODEBUILD_SDK)
3035 AC_MSG_CHECKING([whether to treat the installation as read-only])
3037 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3038         "$enable_extensions" != yes; then
3039     enable_readonly_installset=yes
3041 if test "$enable_readonly_installset" = yes; then
3042     AC_MSG_RESULT([yes])
3043     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3044 else
3045     AC_MSG_RESULT([no])
3048 dnl ===================================================================
3049 dnl Structure of install set
3050 dnl ===================================================================
3052 if test $_os = Darwin; then
3053     LIBO_BIN_FOLDER=MacOS
3054     LIBO_ETC_FOLDER=Resources
3055     LIBO_LIBEXEC_FOLDER=MacOS
3056     LIBO_LIB_FOLDER=Frameworks
3057     LIBO_LIB_PYUNO_FOLDER=Resources
3058     LIBO_SHARE_FOLDER=Resources
3059     LIBO_SHARE_HELP_FOLDER=Resources/help
3060     LIBO_SHARE_JAVA_FOLDER=Resources/java
3061     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3062     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3063     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3064     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3065     LIBO_URE_BIN_FOLDER=MacOS
3066     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3067     LIBO_URE_LIB_FOLDER=Frameworks
3068     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3069     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3070 elif test $_os = WINNT; then
3071     LIBO_BIN_FOLDER=program
3072     LIBO_ETC_FOLDER=program
3073     LIBO_LIBEXEC_FOLDER=program
3074     LIBO_LIB_FOLDER=program
3075     LIBO_LIB_PYUNO_FOLDER=program
3076     LIBO_SHARE_FOLDER=share
3077     LIBO_SHARE_HELP_FOLDER=help
3078     LIBO_SHARE_JAVA_FOLDER=program/classes
3079     LIBO_SHARE_PRESETS_FOLDER=presets
3080     LIBO_SHARE_READMES_FOLDER=readmes
3081     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3082     LIBO_SHARE_SHELL_FOLDER=program/shell
3083     LIBO_URE_BIN_FOLDER=program
3084     LIBO_URE_ETC_FOLDER=program
3085     LIBO_URE_LIB_FOLDER=program
3086     LIBO_URE_MISC_FOLDER=program
3087     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3088 else
3089     LIBO_BIN_FOLDER=program
3090     LIBO_ETC_FOLDER=program
3091     LIBO_LIBEXEC_FOLDER=program
3092     LIBO_LIB_FOLDER=program
3093     LIBO_LIB_PYUNO_FOLDER=program
3094     LIBO_SHARE_FOLDER=share
3095     LIBO_SHARE_HELP_FOLDER=help
3096     LIBO_SHARE_JAVA_FOLDER=program/classes
3097     LIBO_SHARE_PRESETS_FOLDER=presets
3098     LIBO_SHARE_READMES_FOLDER=readmes
3099     if test "$enable_fuzzers" != yes; then
3100         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3101     else
3102         LIBO_SHARE_RESOURCE_FOLDER=resource
3103     fi
3104     LIBO_SHARE_SHELL_FOLDER=program/shell
3105     LIBO_URE_BIN_FOLDER=program
3106     LIBO_URE_ETC_FOLDER=program
3107     LIBO_URE_LIB_FOLDER=program
3108     LIBO_URE_MISC_FOLDER=program
3109     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3111 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3112 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3113 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3114 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3115 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3116 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3117 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3118 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3119 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3120 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3121 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3122 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3123 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3124 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3125 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3126 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3128 # Not all of them needed in config_host.mk, add more if need arises
3129 AC_SUBST(LIBO_BIN_FOLDER)
3130 AC_SUBST(LIBO_ETC_FOLDER)
3131 AC_SUBST(LIBO_LIB_FOLDER)
3132 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3133 AC_SUBST(LIBO_SHARE_FOLDER)
3134 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3135 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3136 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3137 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3138 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3139 AC_SUBST(LIBO_URE_BIN_FOLDER)
3140 AC_SUBST(LIBO_URE_ETC_FOLDER)
3141 AC_SUBST(LIBO_URE_LIB_FOLDER)
3142 AC_SUBST(LIBO_URE_MISC_FOLDER)
3143 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3145 dnl ===================================================================
3146 dnl Windows specific tests and stuff
3147 dnl ===================================================================
3149 reg_get_value()
3151     # Return value: $regvalue
3152     unset regvalue
3154     local _regentry="/proc/registry${1}/${2}"
3155     if test -f "$_regentry"; then
3156         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3157         # Registry keys read via /proc/registry* are always \0 terminated!
3158         local _regvalue=$(tr -d '\0' < "$_regentry")
3159         if test $? -eq 0; then
3160             regvalue=$_regvalue
3161         fi
3162     fi
3165 # Get a value from the 32-bit side of the Registry
3166 reg_get_value_32()
3168     reg_get_value "32" "$1"
3171 # Get a value from the 64-bit side of the Registry
3172 reg_get_value_64()
3174     reg_get_value "64" "$1"
3177 if test "$_os" = "WINNT"; then
3178     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3179     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3180         AC_MSG_RESULT([no])
3181         WINDOWS_SDK_ARCH="x86"
3182     else
3183         AC_MSG_RESULT([yes])
3184         WINDOWS_SDK_ARCH="x64"
3185         BITNESS_OVERRIDE=64
3186     fi
3189 if test "$cross_compiling" = "yes"; then
3190     export CROSS_COMPILING=TRUE
3191 else
3192     CROSS_COMPILING=
3193     BUILD_TYPE="$BUILD_TYPE NATIVE"
3195 AC_SUBST(CROSS_COMPILING)
3197 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3198 if test "$GCC" = "yes"; then
3199     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3200     bsymbolic_functions_ldflags_save=$LDFLAGS
3201     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3202     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3203 #include <stdio.h>
3204         ],[
3205 printf ("hello world\n");
3206         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3207     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3208         AC_MSG_RESULT( found )
3209     else
3210         AC_MSG_RESULT( not found )
3211     fi
3212     LDFLAGS=$bsymbolic_functions_ldflags_save
3214 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3216 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3217 # NOTE: must _not_ be used for bundled external libraries!
3218 ISYSTEM=
3219 if test "$GCC" = "yes"; then
3220     AC_MSG_CHECKING( for -isystem )
3221     save_CFLAGS=$CFLAGS
3222     CFLAGS="$CFLAGS -Werror"
3223     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3224     CFLAGS=$save_CFLAGS
3225     if test -n "$ISYSTEM"; then
3226         AC_MSG_RESULT(yes)
3227     else
3228         AC_MSG_RESULT(no)
3229     fi
3231 if test -z "$ISYSTEM"; then
3232     # fall back to using -I
3233     ISYSTEM=-I
3235 AC_SUBST(ISYSTEM)
3237 dnl ===================================================================
3238 dnl  Check which Visual Studio compiler is used
3239 dnl ===================================================================
3241 map_vs_year_to_version()
3243     # Return value: $vsversion
3245     unset vsversion
3247     case $1 in
3248     2015)
3249         vsversion=14.0;;
3250     2017)
3251         vsversion=15.0;;
3252     *)
3253         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3254     esac
3257 vs_versions_to_check()
3259     # Args: $1 (optional) : versions to check, in the order of preference
3260     # Return value: $vsversions
3262     unset vsversions
3264     if test -n "$1"; then
3265         map_vs_year_to_version "$1"
3266         vsversions=$vsversion
3267     else
3268         # By default we prefer 2015/2017, in this order
3269         vsversions="14.0 15.0"
3270     fi
3273 win_get_env_from_vsvars32bat()
3275     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3276     if test $vcnum = "150"; then
3277       # Also seems to be located in another directory under the same name: vsvars32.bat
3278       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3279       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3280     else
3281       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3282     fi
3283     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3284     chmod +x $WRAPPERBATCHFILEPATH
3285     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3286     rm -f $WRAPPERBATCHFILEPATH
3287     printf '%s' "$_win_get_env_from_vsvars32bat"
3290 find_ucrt()
3292     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3293     if test -n "$regvalue"; then
3294         PathFormat "$regvalue"
3295         UCRTSDKDIR=$formatted_path
3296         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3297         UCRTVERSION=$regvalue
3298         # Rest if not exist
3299         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3300           UCRTSDKDIR=
3301         fi
3302     fi
3303     if test -z "$UCRTSDKDIR"; then
3304         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3305         if test "$vcnum" = "150"; then
3306           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3307         else
3308           ide_env_file="${ide_env_dir}/vsvars32.bat"
3309         fi
3310         if test -f "$ide_env_file"; then
3311             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3312             UCRTSDKDIR=$formatted_path
3313             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3314             dnl Hack needed at least by tml:
3315             if test "$UCRTVERSION" = 10.0.15063.0 \
3316                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3317                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3318             then
3319                 UCRTVERSION=10.0.14393.0
3320             fi
3321         else
3322           AC_MSG_ERROR([No UCRT found])
3323         fi
3324     fi
3327 find_msvc()
3329     # Find Visual C++ 2015/2017
3330     # Args: $1 (optional) : The VS version year
3331     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3333     unset vctest vcnum vcnumwithdot vcbuildnumber
3335     vs_versions_to_check "$1"
3337     for ver in $vsversions; do
3338         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3339         if test -n "$regvalue"; then
3340             vctest=$regvalue
3341             break
3342         fi
3343         # As always MSVC 15.0 is special here
3344         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3345         if test -n "$regvalue"; then
3346             AC_MSG_RESULT([found: $regvalue])
3347             PathFormat "$regvalue"
3348             vctest=$formatted_path
3349             break
3350         fi
3351     done
3352     if test -n "$vctest"; then
3353         vcnumwithdot=$ver
3354         case "$vcnumwithdot" in
3355         14.0)
3356             vcyear=2015
3357             vcnum=140
3358             ;;
3359         15.0)
3360             vcyear=2017
3361             vcnum=150
3362             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3363             ;;
3364         esac
3365     fi
3368 SOLARINC=
3369 SHOWINCLUDES_PREFIX=
3370 MSBUILD_PATH=
3371 DEVENV=
3372 if test "$_os" = "WINNT"; then
3373     AC_MSG_CHECKING([Visual C++])
3375     find_msvc "$with_visual_studio"
3376     if test -z "$vctest"; then
3377         if test -n "$with_visual_studio"; then
3378             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3379         else
3380             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3381         fi
3382     fi
3384     if test "$BITNESS_OVERRIDE" = ""; then
3385         if test -f "$vctest/bin/cl.exe"; then
3386             VC_PRODUCT_DIR=$vctest
3387         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3388             VC_PRODUCT_DIR=$vctest/VC
3389         else
3390             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3391         fi
3392     else
3393         if test -f "$vctest/bin/amd64/cl.exe"; then
3394             VC_PRODUCT_DIR=$vctest
3395         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3396             VC_PRODUCT_DIR=$vctest/VC
3397         else
3398             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])
3399         fi
3400     fi
3402     AC_MSG_CHECKING([for short pathname of VC product directory])
3403     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3404     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3406     UCRTSDKDIR=
3407     UCRTVERSION=
3409     AC_MSG_CHECKING([for UCRT location])
3410     find_ucrt
3411     # find_ucrt errors out if it doesn't find it
3412     AC_MSG_RESULT([found])
3413     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3414     ucrtincpath_formatted=$formatted_path
3415     # SOLARINC is used for external modules and must be set too.
3416     # And no, it's not sufficient to set SOLARINC only, as configure
3417     # itself doesn't honour it.
3418     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3419     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3420     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3421     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3423     AC_SUBST(UCRTSDKDIR)
3424     AC_SUBST(UCRTVERSION)
3426     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3427     # Find the proper version of MSBuild.exe to use based on the VS version
3428     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3429     if test -n "$regvalue" ; then
3430         AC_MSG_RESULT([found: $regvalue])
3431         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3432     else
3433         if test $vcnum = "150"; then
3434             if test "$BITNESS_OVERRIDE" = ""; then
3435                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3436             else
3437                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3438             fi
3439             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3440         else
3441             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3442         fi
3443         AC_MSG_RESULT([$regvalue])
3444     fi
3446     # Find the version of devenv.exe
3447     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3448     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3449     if test ! -e "$DEVENV"; then
3450         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3451     fi
3453     dnl ===========================================================
3454     dnl  Check for the corresponding mspdb*.dll
3455     dnl ===========================================================
3457     MSPDB_PATH=
3458     CL_DIR=
3459     CL_LIB=
3461     if test "$BITNESS_OVERRIDE" = ""; then
3462         if test "$vcnum" = "150"; then
3463             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3464             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3465         else
3466             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3467             CL_DIR=bin
3468         fi
3469     else
3470         if test "$vcnum" = "150"; then
3471             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3472             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3473         else
3474             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3475             CL_DIR=bin/amd64
3476         fi
3477     fi
3479     # MSVC 15.0 has libraries from 14.0?
3480     if test  "$vcnum" = "150"; then
3481         mspdbnum="140"
3482     else
3483         mspdbnum=$vcnum
3484     fi
3486     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3487         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3488     fi
3490     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3491     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3493     dnl The path needs to be added before cl is called
3494     PATH="$MSPDB_PATH:$PATH"
3496     AC_MSG_CHECKING([cl.exe])
3498     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3499     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3500     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3501     # is not enough?
3503     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3504     dnl needed when building CLR code:
3505     if test -z "$MSVC_CXX"; then
3506         if test "$BITNESS_OVERRIDE" = ""; then
3507             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3508                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3509             fi
3510         else
3511             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3512                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3513             fi
3514         fi
3516         # This gives us a posix path with 8.3 filename restrictions
3517         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3518     fi
3520     if test -z "$CC"; then
3521         CC=$MSVC_CXX
3522     fi
3523     if test "$BITNESS_OVERRIDE" = ""; then
3524         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3525         MSVC_CXX="$MSVC_CXX -arch:SSE"
3526     fi
3528     if test -n "$CC"; then
3529         # Remove /cl.exe from CC case insensitive
3530         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3531         if test "$BITNESS_OVERRIDE" = ""; then
3532            if test "$vcnum" = "150"; then
3533                COMPATH="$VC_PRODUCT_DIR"
3534            else
3535                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3536            fi
3537         else
3538             if test -n "$VC_PRODUCT_DIR"; then
3539                 COMPATH=$VC_PRODUCT_DIR
3540             fi
3541         fi
3542         if test "$BITNESS_OVERRIDE" = ""; then
3543             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3544             CC="$CC -arch:SSE"
3545         fi
3547         if test "$vcnum" = "150"; then
3548             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3549         fi
3551         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3553         PathFormat "$COMPATH"
3554         COMPATH="$formatted_path"
3556         VCVER=$vcnum
3557         MSVSVER=$vcyear
3559         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3560         # are always "better", we list them in reverse chronological order.
3562         case $vcnum in
3563         140)
3564             COMEX=19
3565             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3566             ;;
3567         150)
3568             COMEX=19
3569             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3570             ;;
3571         esac
3573         # The expectation is that --with-windows-sdk should not need to be used
3574         if test -n "$with_windows_sdk"; then
3575             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3576             *" "$with_windows_sdk" "*)
3577                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3578                 ;;
3579             *)
3580                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3581                 ;;
3582             esac
3583         fi
3585         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3586         ac_objext=obj
3587         ac_exeext=exe
3589     else
3590         AC_MSG_ERROR([Visual C++ not found after all, huh])
3591     fi
3593     dnl We need to guess the prefix of the -showIncludes output, it can be
3594     dnl localized
3595     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3596     echo "#include <stdlib.h>" > conftest.c
3597     dnl Filter out -FIIntrin.h when CC points at clang-cl.exe and needs to
3598     dnl explicitly state that argument:
3599     my_CC=
3600     for i in $CC; do
3601         case $i in
3602         -FIIntrin.h)
3603             ;;
3604         *)
3605             my_CC="$my_CC $i"
3606             ;;
3607         esac
3608     done
3609     SHOWINCLUDES_PREFIX=`$my_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3610         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3611     rm -f conftest.c conftest.obj
3612     if test -z "$SHOWINCLUDES_PREFIX"; then
3613         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3614     else
3615         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3616     fi
3618     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3619     # version of the Explorer extension (and maybe other small
3620     # bits, too) needed when installing a 32-bit LibreOffice on a
3621     # 64-bit OS. The 64-bit Explorer extension is a feature that
3622     # has been present since long in OOo. Don't confuse it with
3623     # building LibreOffice itself as 64-bit code.
3625     BUILD_X64=
3626     CXX_X64_BINARY=
3627     LINK_X64_BINARY=
3629     if test "$BITNESS_OVERRIDE" = ""; then
3630         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3631         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3632             # Prefer native x64 compiler to cross-compiler, in case we are running
3633             # the build on a 64-bit OS.
3634             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3635                 BUILD_X64=TRUE
3636                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3637                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3638             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3639                 BUILD_X64=TRUE
3640                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3641                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3642             fi
3643         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3644             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3645             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3646                 BUILD_X64=TRUE
3647                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3648                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3649             fi
3650         fi
3651         if test "$BUILD_X64" = TRUE; then
3652             AC_MSG_RESULT([found])
3653         else
3654             AC_MSG_RESULT([not found])
3655             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3656         fi
3657     fi
3658     AC_SUBST(BUILD_X64)
3660     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3661     AC_SUBST(CXX_X64_BINARY)
3662     AC_SUBST(LINK_X64_BINARY)
3664 AC_SUBST(VCVER)
3665 AC_SUBST(DEVENV)
3666 PathFormat "$MSPDB_PATH"
3667 MSPDB_PATH="$formatted_path"
3668 AC_SUBST(MSVC_CXX)
3669 AC_SUBST(SHOWINCLUDES_PREFIX)
3671 if test "$_os" = "WINNT"; then
3672     AC_MSG_CHECKING([whether to use DirectX])
3673     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3674         ENABLE_DIRECTX="TRUE"
3675         AC_MSG_RESULT([yes])
3676     else
3677         ENABLE_DIRECTX=""
3678         AC_MSG_RESULT([no])
3679     fi
3680 else
3681     ENABLE_DIRECTX=""
3684 AC_SUBST(ENABLE_DIRECTX)
3687 # unowinreg.dll
3689 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3690 AC_SUBST(UNOWINREG_DLL)
3692 COM_IS_CLANG=
3693 AC_MSG_CHECKING([whether the compiler is actually Clang])
3694 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3695     #ifndef __clang__
3696     you lose
3697     #endif
3698     int foo=42;
3699     ]])],
3700     [AC_MSG_RESULT([yes])
3701      COM_IS_CLANG=TRUE],
3702     [AC_MSG_RESULT([no])])
3704 if test "$COM_IS_CLANG" = TRUE; then
3705     AC_MSG_CHECKING([the Clang version])
3706     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | ${CC%-cl.exe*} -E -P -`
3707     CLANG_FULL_VERSION=`echo __clang_version__ | ${CC%-cl.exe*} -E -P -`
3708     CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3709     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3710     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3711     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3713 AC_SUBST(COM_IS_CLANG)
3716 # prefix C with ccache if needed
3718 if test "$CCACHE" != ""; then
3719     AC_MSG_CHECKING([whether $CC is already ccached])
3721     AC_LANG_PUSH([C])
3722     save_CFLAGS=$CFLAGS
3723     CFLAGS="$CFLAGS --ccache-skip -O2"
3724     dnl an empty program will do, we're checking the compiler flags
3725     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3726                       [use_ccache=yes], [use_ccache=no])
3727     if test $use_ccache = yes; then
3728         AC_MSG_RESULT([yes])
3729     else
3730         CC="$CCACHE $CC"
3731         AC_MSG_RESULT([no])
3732     fi
3733     CFLAGS=$save_CFLAGS
3734     AC_LANG_POP([C])
3737 # ===================================================================
3738 # check various GCC options that Clang does not support now but maybe
3739 # will somewhen in the future, check them even for GCC, so that the
3740 # flags are set
3741 # ===================================================================
3743 HAVE_GCC_GGDB2=
3744 HAVE_GCC_FINLINE_LIMIT=
3745 HAVE_GCC_FNO_INLINE=
3746 if test "$GCC" = "yes"; then
3747     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3748     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3749         # Option just ignored and silly warning that isn't a real
3750         # warning printed
3751         :
3752     else
3753         save_CFLAGS=$CFLAGS
3754         CFLAGS="$CFLAGS -Werror -ggdb2"
3755         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3756         CFLAGS=$save_CFLAGS
3757     fi
3758     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3759         AC_MSG_RESULT([yes])
3760     else
3761         AC_MSG_RESULT([no])
3762     fi
3764     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3765     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3766         # As above
3767         :
3768     else
3769         save_CFLAGS=$CFLAGS
3770         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3771         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3772         CFLAGS=$save_CFLAGS
3773     fi
3774     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3775         AC_MSG_RESULT([yes])
3776     else
3777         AC_MSG_RESULT([no])
3778     fi
3780     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3781     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3782         # Ditto
3783         :
3784     else
3785         save_CFLAGS=$CFLAGS
3786         CFLAGS="$CFLAGS -Werror -fno-inline"
3787         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3788         CFLAGS=$save_CFLAGS
3789     fi
3790     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3791         AC_MSG_RESULT([yes])
3792     else
3793         AC_MSG_RESULT([no])
3794     fi
3796     if test "$host_cpu" = "m68k"; then
3797         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3798         save_CFLAGS=$CFLAGS
3799         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3800         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3801         CFLAGS=$save_CFLAGS
3802         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3803             AC_MSG_RESULT([yes])
3804         else
3805             AC_MSG_ERROR([no])
3806         fi
3807     fi
3809 AC_SUBST(HAVE_GCC_GGDB2)
3810 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3811 AC_SUBST(HAVE_GCC_FNO_INLINE)
3813 dnl ===================================================================
3814 dnl  Test the gcc version
3815 dnl ===================================================================
3816 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3817     AC_MSG_CHECKING([the GCC version])
3818     _gcc_version=`$CC -dumpversion`
3819     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3821     AC_MSG_RESULT([gcc $_gcc_version])
3823     if test "$GCC_VERSION" -lt 0407; then
3824         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.7.0])
3825     fi
3826 else
3827     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3828     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3829     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3830     # (which reports itself as GCC 4.2.1).
3831     GCC_VERSION=
3833 AC_SUBST(GCC_VERSION)
3835 dnl Set the ENABLE_DBGUTIL variable
3836 dnl ===================================================================
3837 AC_MSG_CHECKING([whether to build with additional debug utilities])
3838 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3839     ENABLE_DBGUTIL="TRUE"
3840     # this is an extra var so it can have different default on different MSVC
3841     # versions (in case there are version specific problems with it)
3842     MSVC_USE_DEBUG_RUNTIME="TRUE"
3844     AC_MSG_RESULT([yes])
3845     # cppunit and graphite expose STL in public headers
3846     if test "$with_system_cppunit" = "yes"; then
3847         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3848     else
3849         with_system_cppunit=no
3850     fi
3851     if test "$with_system_graphite" = "yes"; then
3852         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3853     else
3854         with_system_graphite=no
3855     fi
3856     if test "$with_system_mysql_cppconn" = "yes"; then
3857         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3858     else
3859         with_system_mysql_cppconn=no
3860     fi
3861     if test "$with_system_orcus" = "yes"; then
3862         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3863     else
3864         with_system_orcus=no
3865     fi
3866     if test "$with_system_libcmis" = "yes"; then
3867         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3868     else
3869         with_system_libcmis=no
3870     fi
3871     if test "$with_system_libgltf" = "yes"; then
3872         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3873     else
3874         with_system_libgltf=no
3875     fi
3876     if test "$with_system_hunspell" = "yes"; then
3877         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3878     else
3879         with_system_hunspell=no
3880     fi
3881 else
3882     ENABLE_DBGUTIL=""
3883     MSVC_USE_DEBUG_RUNTIME=""
3884     AC_MSG_RESULT([no])
3886 AC_SUBST(ENABLE_DBGUTIL)
3887 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3889 dnl Set the ENABLE_DEBUG variable.
3890 dnl ===================================================================
3891 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3892     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3894 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3895     if test -z "$libo_fuzzed_enable_debug"; then
3896         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3897     else
3898         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3899         enable_debug=yes
3900     fi
3903 AC_MSG_CHECKING([whether to do a debug build])
3904 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3905     ENABLE_DEBUG="TRUE"
3906     if test -n "$ENABLE_DBGUTIL" ; then
3907         AC_MSG_RESULT([yes (dbgutil)])
3908     else
3909         AC_MSG_RESULT([yes])
3910     fi
3911 else
3912     ENABLE_DEBUG=""
3913     AC_MSG_RESULT([no])
3915 AC_SUBST(ENABLE_DEBUG)
3917 if test "$enable_sal_log" = yes; then
3918     ENABLE_SAL_LOG=TRUE
3920 AC_SUBST(ENABLE_SAL_LOG)
3922 dnl Selective debuginfo
3923 ENABLE_DEBUGINFO_FOR=
3924 if test -n "$ENABLE_DEBUG"; then
3925     AC_MSG_CHECKING([whether to use selective debuginfo])
3926     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3927         if test "$enable_selective_debuginfo" = "yes"; then
3928             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3929         fi
3930         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3931         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3932     else
3933         ENABLE_DEBUGINFO_FOR=all
3934         AC_MSG_RESULT([no, for all])
3935     fi
3936 else
3937     if test -n "$enable_selective_debuginfo"; then
3938         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3939     fi
3941 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3943 dnl Check for enable symbols option
3944 dnl ===================================================================
3945 AC_MSG_CHECKING([whether to generate debug information])
3946 if test -z "$enable_symbols"; then
3947     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3948         enable_symbols=yes
3949     else
3950         enable_symbols=no
3951     fi
3953 if test "$enable_symbols" != no; then
3954     ENABLE_SYMBOLS=TRUE
3955     AC_MSG_RESULT([yes])
3956 else
3957     ENABLE_SYMBOLS=
3958     AC_MSG_RESULT([no])
3960 AC_SUBST(ENABLE_SYMBOLS)
3962 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3963     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3964     AC_MSG_CHECKING([whether enough memory is available for linking])
3965     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3966     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3967     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3968         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3969     else
3970         AC_MSG_RESULT([yes])
3971     fi
3974 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3975 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3976 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3977 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3978 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3979     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
3981 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
3984 # determine CPUNAME, OS, ...
3985 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3987 case "$host_os" in
3989 aix*)
3990     COM=GCC
3991     CPUNAME=POWERPC
3992     USING_X11=TRUE
3993     OS=AIX
3994     RTL_OS=AIX
3995     RTL_ARCH=PowerPC
3996     PLATFORMID=aix_powerpc
3997     P_SEP=:
3998     ;;
4000 cygwin*)
4001     COM=MSC
4002     USING_X11=
4003     OS=WNT
4004     RTL_OS=Windows
4005     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4006         P_SEP=";"
4007     else
4008         P_SEP=:
4009     fi
4010     case "$host_cpu" in
4011     i*86|x86_64)
4012         if test "$BITNESS_OVERRIDE" = 64; then
4013             CPUNAME=X86_64
4014             RTL_ARCH=X86_64
4015             PLATFORMID=windows_x86_64
4016             WINDOWS_X64=1
4017             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4018         else
4019             CPUNAME=INTEL
4020             RTL_ARCH=x86
4021             PLATFORMID=windows_x86
4022         fi
4023         ;;
4024     *)
4025         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4026         ;;
4027     esac
4028     SCPDEFS="$SCPDEFS -D_MSC_VER"
4029     ;;
4031 darwin*)
4032     COM=GCC
4033     USING_X11=
4034     OS=MACOSX
4035     RTL_OS=MacOSX
4036     P_SEP=:
4038     case "$host_cpu" in
4039     arm*)
4040         CPUNAME=ARM
4041         RTL_ARCH=ARM_EABI
4042         PLATFORMID=ios_arm
4043         OS=IOS
4044         ;;
4045     i*86)
4046         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4047         ;;
4048     x86_64)
4049         CPUNAME=X86_64
4050         RTL_ARCH=X86_64
4051         PLATFORMID=macosx_x86_64
4052         ;;
4053     *)
4054         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4055         ;;
4056     esac
4057     ;;
4059 dragonfly*)
4060     COM=GCC
4061     USING_X11=TRUE
4062     OS=DRAGONFLY
4063     RTL_OS=DragonFly
4064     P_SEP=:
4066     case "$host_cpu" in
4067     i*86)
4068         CPUNAME=INTEL
4069         RTL_ARCH=x86
4070         PLATFORMID=dragonfly_x86
4071         ;;
4072     x86_64)
4073         CPUNAME=X86_64
4074         RTL_ARCH=X86_64
4075         PLATFORMID=dragonfly_x86_64
4076         ;;
4077     *)
4078         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4079         ;;
4080     esac
4081     ;;
4083 freebsd*)
4084     COM=GCC
4085     USING_X11=TRUE
4086     RTL_OS=FreeBSD
4087     OS=FREEBSD
4088     P_SEP=:
4090     case "$host_cpu" in
4091     i*86)
4092         CPUNAME=INTEL
4093         RTL_ARCH=x86
4094         PLATFORMID=freebsd_x86
4095         ;;
4096     x86_64|amd64)
4097         CPUNAME=X86_64
4098         RTL_ARCH=X86_64
4099         PLATFORMID=freebsd_x86_64
4100         ;;
4101     *)
4102         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4103         ;;
4104     esac
4105     ;;
4107 kfreebsd*)
4108     COM=GCC
4109     USING_X11=TRUE
4110     OS=LINUX
4111     RTL_OS=kFreeBSD
4112     P_SEP=:
4114     case "$host_cpu" in
4116     i*86)
4117         CPUNAME=INTEL
4118         RTL_ARCH=x86
4119         PLATFORMID=kfreebsd_x86
4120         ;;
4121     x86_64)
4122         CPUNAME=X86_64
4123         RTL_ARCH=X86_64
4124         PLATFORMID=kfreebsd_x86_64
4125         ;;
4126     *)
4127         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4128         ;;
4129     esac
4130     ;;
4132 linux-gnu*)
4133     COM=GCC
4134     USING_X11=TRUE
4135     OS=LINUX
4136     RTL_OS=Linux
4137     P_SEP=:
4139     case "$host_cpu" in
4141     aarch64)
4142         CPUNAME=AARCH64
4143         PLATFORMID=linux_aarch64
4144         RTL_ARCH=AARCH64
4145         ;;
4146     alpha)
4147         CPUNAME=AXP
4148         RTL_ARCH=ALPHA
4149         PLATFORMID=linux_alpha
4150         ;;
4151     arm*)
4152         CPUNAME=ARM
4153         EPM_FLAGS="-a arm"
4154         RTL_ARCH=ARM_EABI
4155         PLATFORMID=linux_arm_eabi
4156         case "$host_cpu" in
4157         arm*-linux)
4158             RTL_ARCH=ARM_OABI
4159             PLATFORMID=linux_arm_oabi
4160             ;;
4161         esac
4162         ;;
4163     hppa)
4164         CPUNAME=HPPA
4165         RTL_ARCH=HPPA
4166         EPM_FLAGS="-a hppa"
4167         PLATFORMID=linux_hppa
4168         ;;
4169     i*86)
4170         CPUNAME=INTEL
4171         RTL_ARCH=x86
4172         PLATFORMID=linux_x86
4173         ;;
4174     ia64)
4175         CPUNAME=IA64
4176         RTL_ARCH=IA64
4177         PLATFORMID=linux_ia64
4178         ;;
4179     mips)
4180         CPUNAME=GODSON
4181         RTL_ARCH=MIPS_EB
4182         EPM_FLAGS="-a mips"
4183         PLATFORMID=linux_mips_eb
4184         ;;
4185     mips64)
4186         CPUNAME=GODSON64
4187         RTL_ARCH=MIPS64_EB
4188         EPM_FLAGS="-a mips64"
4189         PLATFORMID=linux_mips64_eb
4190         ;;
4191     mips64el)
4192         CPUNAME=GODSON64
4193         RTL_ARCH=MIPS64_EL
4194         EPM_FLAGS="-a mips64el"
4195         PLATFORMID=linux_mips64_el
4196         ;;
4197     mipsel)
4198         CPUNAME=GODSON
4199         RTL_ARCH=MIPS_EL
4200         EPM_FLAGS="-a mipsel"
4201         PLATFORMID=linux_mips_el
4202         ;;
4203     m68k)
4204         CPUNAME=M68K
4205         RTL_ARCH=M68K
4206         PLATFORMID=linux_m68k
4207         ;;
4208     powerpc)
4209         CPUNAME=POWERPC
4210         RTL_ARCH=PowerPC
4211         PLATFORMID=linux_powerpc
4212         ;;
4213     powerpc64)
4214         CPUNAME=POWERPC64
4215         RTL_ARCH=PowerPC_64
4216         PLATFORMID=linux_powerpc64
4217         ;;
4218     powerpc64le)
4219         CPUNAME=POWERPC64
4220         RTL_ARCH=PowerPC_64_LE
4221         PLATFORMID=linux_powerpc64_le
4222         ;;
4223     sparc)
4224         CPUNAME=SPARC
4225         RTL_ARCH=SPARC
4226         PLATFORMID=linux_sparc
4227         ;;
4228     sparc64)
4229         CPUNAME=SPARC64
4230         RTL_ARCH=SPARC64
4231         PLATFORMID=linux_sparc64
4232         ;;
4233     s390)
4234         CPUNAME=S390
4235         RTL_ARCH=S390
4236         PLATFORMID=linux_s390
4237         ;;
4238     s390x)
4239         CPUNAME=S390X
4240         RTL_ARCH=S390x
4241         PLATFORMID=linux_s390x
4242         ;;
4243     x86_64)
4244         CPUNAME=X86_64
4245         RTL_ARCH=X86_64
4246         PLATFORMID=linux_x86_64
4247         ;;
4248     *)
4249         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4250         ;;
4251     esac
4252     ;;
4254 linux-android*)
4255     COM=GCC
4256     USING_X11=
4257     OS=ANDROID
4258     RTL_OS=Android
4259     P_SEP=:
4261     case "$host_cpu" in
4263     arm|armel)
4264         CPUNAME=ARM
4265         RTL_ARCH=ARM_EABI
4266         PLATFORMID=android_arm_eabi
4267         ;;
4268     aarch64)
4269         CPUNAME=AARCH64
4270         RTL_ARCH=AARCH64
4271         PLATFORMID=android_aarch64
4272         ;;
4273     mips|mipsel)
4274         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4275         RTL_ARCH=MIPS_EL
4276         PLATFORMID=android_mips_el
4277         ;;
4278     i*86)
4279         CPUNAME=INTEL
4280         RTL_ARCH=x86
4281         PLATFORMID=android_x86
4282         ;;
4283     *)
4284         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4285         ;;
4286     esac
4287     ;;
4289 *netbsd*)
4290     COM=GCC
4291     USING_X11=TRUE
4292     OS=NETBSD
4293     RTL_OS=NetBSD
4294     P_SEP=:
4296     case "$host_cpu" in
4297     i*86)
4298         CPUNAME=INTEL
4299         RTL_ARCH=x86
4300         PLATFORMID=netbsd_x86
4301         ;;
4302     powerpc)
4303         CPUNAME=POWERPC
4304         RTL_ARCH=PowerPC
4305         PLATFORMID=netbsd_powerpc
4306         ;;
4307     sparc)
4308         CPUNAME=SPARC
4309         RTL_ARCH=SPARC
4310         PLATFORMID=netbsd_sparc
4311         ;;
4312     x86_64)
4313         CPUNAME=X86_64
4314         RTL_ARCH=X86_64
4315         PLATFORMID=netbsd_x86_64
4316         ;;
4317     *)
4318         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4319         ;;
4320     esac
4321     ;;
4323 openbsd*)
4324     COM=GCC
4325     USING_X11=TRUE
4326     OS=OPENBSD
4327     RTL_OS=OpenBSD
4328     P_SEP=:
4330     case "$host_cpu" in
4331     i*86)
4332         CPUNAME=INTEL
4333         RTL_ARCH=x86
4334         PLATFORMID=openbsd_x86
4335         ;;
4336     x86_64)
4337         CPUNAME=X86_64
4338         RTL_ARCH=X86_64
4339         PLATFORMID=openbsd_x86_64
4340         ;;
4341     *)
4342         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4343         ;;
4344     esac
4345     SOLARINC="$SOLARINC -I/usr/local/include"
4346     ;;
4348 solaris*)
4349     COM=GCC
4350     USING_X11=TRUE
4351     OS=SOLARIS
4352     RTL_OS=Solaris
4353     P_SEP=:
4355     case "$host_cpu" in
4356     i*86)
4357         CPUNAME=INTEL
4358         RTL_ARCH=x86
4359         PLATFORMID=solaris_x86
4360         ;;
4361     sparc)
4362         CPUNAME=SPARC
4363         RTL_ARCH=SPARC
4364         PLATFORMID=solaris_sparc
4365         ;;
4366     sparc64)
4367         CPUNAME=SPARC64
4368         RTL_ARCH=SPARC64
4369         PLATFORMID=solaris_sparc64
4370         ;;
4371     *)
4372         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4373         ;;
4374     esac
4375     SOLARINC="$SOLARINC -I/usr/local/include"
4376     ;;
4379     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4380     ;;
4381 esac
4383 if test "$with_x" = "no"; then
4384     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4387 ENABLE_HEADLESS=""
4388 if test "$enable_gui" = "no"; then
4389     if test "$USING_X11" != TRUE; then
4390         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4391     fi
4392     USING_X11=
4393     ENABLE_HEADLESS=TRUE
4394     AC_DEFINE(HAVE_FEATURE_UI,0)
4395     test_cairo=yes
4397 AC_SUBST(ENABLE_HEADLESS)
4399 WORKDIR="${BUILDDIR}/workdir"
4400 INSTDIR="${BUILDDIR}/instdir"
4401 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4402 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4403 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4404 AC_SUBST(COM)
4405 AC_SUBST(CPUNAME)
4406 AC_SUBST(RTL_OS)
4407 AC_SUBST(RTL_ARCH)
4408 AC_SUBST(EPM_FLAGS)
4409 AC_SUBST(USING_X11)
4410 AC_SUBST([INSTDIR])
4411 AC_SUBST([INSTROOT])
4412 AC_SUBST([INSTROOTBASE])
4413 AC_SUBST(OS)
4414 AC_SUBST(P_SEP)
4415 AC_SUBST(WORKDIR)
4416 AC_SUBST(PLATFORMID)
4417 AC_SUBST(WINDOWS_X64)
4418 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4420 dnl ===================================================================
4421 dnl Test which package format to use
4422 dnl ===================================================================
4423 AC_MSG_CHECKING([which package format to use])
4424 if test -n "$with_package_format" -a "$with_package_format" != no; then
4425     for i in $with_package_format; do
4426         case "$i" in
4427         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4428             ;;
4429         *)
4430             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4431 aix - AIX software distribution
4432 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4433 deb - Debian software distribution
4434 pkg - Solaris software distribution
4435 rpm - RedHat software distribution
4437 LibreOffice additionally supports:
4438 archive - .tar.gz or .zip
4439 dmg - Mac OS X .dmg
4440 installed - installation tree
4441 msi - Windows .msi
4442         ])
4443             ;;
4444         esac
4445     done
4446     PKGFORMAT="$with_package_format"
4447     AC_MSG_RESULT([$PKGFORMAT])
4448 else
4449     PKGFORMAT=
4450     AC_MSG_RESULT([none])
4452 AC_SUBST(PKGFORMAT)
4454 dnl ===================================================================
4455 dnl Set up a different compiler to produce tools to run on the build
4456 dnl machine when doing cross-compilation
4457 dnl ===================================================================
4459 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4460 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4461 if test "$cross_compiling" = "yes"; then
4462     AC_MSG_CHECKING([for BUILD platform configuration])
4463     echo
4464     rm -rf CONF-FOR-BUILD config_build.mk
4465     mkdir CONF-FOR-BUILD
4466     # Here must be listed all files needed when running the configure script. In particular, also
4467     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4468     # keep them in the same order as there.
4469     (cd $SRC_ROOT && tar cf - \
4470         config.guess \
4471         bin/get_config_variables \
4472         solenv/bin/getcompver.awk \
4473         solenv/inc/langlist.mk \
4474         config_host.mk.in \
4475         config_host_lang.mk.in \
4476         Makefile.in \
4477         lo.xcent.in \
4478         bin/bffvalidator.sh.in \
4479         bin/odfvalidator.sh.in \
4480         bin/officeotron.sh.in \
4481         instsetoo_native/util/openoffice.lst.in \
4482         config_host/*.in \
4483         sysui/desktop/macosx/Info.plist.in \
4484         ios/lo.xcconfig.in) \
4485     | (cd CONF-FOR-BUILD && tar xf -)
4486     cp configure CONF-FOR-BUILD
4487     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4488     (
4489     unset COM USING_X11 OS CPUNAME
4490     unset CC CXX SYSBASE CFLAGS
4491     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4492     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4493     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4494     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4495     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4496     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4497     cd CONF-FOR-BUILD
4498     sub_conf_opts=""
4499     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4500     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4501     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4502     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4503     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4504     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4505     # Don't bother having configure look for stuff not needed for the build platform anyway
4506     ./configure \
4507         --disable-cups \
4508         --disable-gtk3 \
4509         --disable-pdfimport \
4510         --disable-postgresql-sdbc \
4511         --with-parallelism="$with_parallelism" \
4512         --without-doxygen \
4513         --without-java \
4514         $sub_conf_opts \
4515         --srcdir=$srcdir \
4516         2>&1 | sed -e 's/^/    /'
4517     test -f ./config_host.mk 2>/dev/null || exit
4518     cp config_host.mk ../config_build.mk
4519     cp config_host_lang.mk ../config_build_lang.mk
4520     mv config.log ../config.Build.log
4521     mkdir -p ../config_build
4522     mv config_host/*.h ../config_build
4523     . ./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
4525     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
4526         VV='$'$V
4527         VV=`eval "echo $VV"`
4528         if test -n "$VV"; then
4529             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4530             echo "$line" >>build-config
4531         fi
4532     done
4534     for V in INSTDIR INSTROOT WORKDIR; do
4535         VV='$'$V
4536         VV=`eval "echo $VV"`
4537         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4538         if test -n "$VV"; then
4539             line="${V}_FOR_BUILD='$VV'"
4540             echo "$line" >>build-config
4541         fi
4542     done
4544     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4545     echo "$line" >>build-config
4547     )
4548     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4549     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])
4550     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4551              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4553     eval `cat CONF-FOR-BUILD/build-config`
4555     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4557     rm -rf CONF-FOR-BUILD
4558 else
4559     OS_FOR_BUILD="$OS"
4560     CC_FOR_BUILD="$CC"
4561     CXX_FOR_BUILD="$CXX"
4562     INSTDIR_FOR_BUILD="$INSTDIR"
4563     INSTROOT_FOR_BUILD="$INSTROOT"
4564     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4565     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4566     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4567     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4568     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4569     WORKDIR_FOR_BUILD="$WORKDIR"
4571 AC_SUBST(OS_FOR_BUILD)
4572 AC_SUBST(INSTDIR_FOR_BUILD)
4573 AC_SUBST(INSTROOT_FOR_BUILD)
4574 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4575 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4576 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4577 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4578 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4579 AC_SUBST(WORKDIR_FOR_BUILD)
4581 dnl ===================================================================
4582 dnl Check for syslog header
4583 dnl ===================================================================
4584 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4586 # placeholder for future crash reporter feature
4587 ENABLE_CRASHDUMP=""
4588 AC_SUBST(ENABLE_CRASHDUMP)
4590 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4591 dnl ===================================================================
4592 AC_MSG_CHECKING([whether to turn warnings to errors])
4593 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4594     ENABLE_WERROR="TRUE"
4595     AC_MSG_RESULT([yes])
4596 else
4597     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4598         ENABLE_WERROR="TRUE"
4599         AC_MSG_RESULT([yes])
4600     else
4601         AC_MSG_RESULT([no])
4602     fi
4604 AC_SUBST(ENABLE_WERROR)
4606 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4607 dnl ===================================================================
4608 AC_MSG_CHECKING([whether to have assert to abort in release code])
4609 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4610     ASSERT_ALWAYS_ABORT="TRUE"
4611     AC_MSG_RESULT([yes])
4612 else
4613     ASSERT_ALWAYS_ABORT="FALSE"
4614     AC_MSG_RESULT([no])
4616 AC_SUBST(ASSERT_ALWAYS_ABORT)
4618 # Determine whether to use ooenv for the instdir installation
4619 # ===================================================================
4620 if test $_os != "WINNT" -a $_os != "Darwin"; then
4621     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4622     if test "$enable_ooenv" = "no"; then
4623         AC_MSG_RESULT([no])
4624     else
4625         ENABLE_OOENV="TRUE"
4626         AC_MSG_RESULT([yes])
4627     fi
4629 AC_SUBST(ENABLE_OOENV)
4631 if test "$USING_X11" != TRUE; then
4632     # be sure to do not mess with unneeded stuff
4633     test_randr=no
4634     test_xrender=no
4635     test_cups=no
4636     test_dbus=no
4637     test_gtk=no
4638     build_gstreamer_1_0=no
4639     build_gstreamer_0_10=no
4640     test_tde=no
4641     test_kde4=no
4642     enable_cairo_canvas=no
4645 dnl ===================================================================
4646 dnl check for cups support
4647 dnl ===================================================================
4648 ENABLE_CUPS=""
4650 if test "$enable_cups" = "no"; then
4651     test_cups=no
4654 AC_MSG_CHECKING([whether to enable CUPS support])
4655 if test "$test_cups" = "yes"; then
4656     ENABLE_CUPS="TRUE"
4657     AC_MSG_RESULT([yes])
4659     AC_MSG_CHECKING([whether cups support is present])
4660     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4661     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4662     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4663         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4664     fi
4666 else
4667     AC_MSG_RESULT([no])
4670 AC_SUBST(ENABLE_CUPS)
4672 # fontconfig checks
4673 if test "$test_fontconfig" = "yes"; then
4674     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4675     SYSTEM_FONTCONFIG=TRUE
4676     FilterLibs "${FONTCONFIG_LIBS}"
4677     FONTCONFIG_LIBS="${filteredlibs}"
4679 AC_SUBST(FONTCONFIG_CFLAGS)
4680 AC_SUBST(FONTCONFIG_LIBS)
4681 AC_SUBST([SYSTEM_FONTCONFIG])
4683 dnl whether to find & fetch external tarballs?
4684 dnl ===================================================================
4685 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4686    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4687        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4688    else
4689        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4690    fi
4692 if test -z "$TARFILE_LOCATION"; then
4693     if test -d "$SRC_ROOT/src" ; then
4694         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4695         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4696     fi
4697     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4698 else
4699     AbsolutePath "$TARFILE_LOCATION"
4700     PathFormat "${absolute_path}"
4701     TARFILE_LOCATION="${formatted_path}"
4703 AC_SUBST(TARFILE_LOCATION)
4705 AC_MSG_CHECKING([whether we want to fetch tarballs])
4706 if test "$enable_fetch_external" != "no"; then
4707     if test "$with_all_tarballs" = "yes"; then
4708         AC_MSG_RESULT([yes, all of them])
4709         DO_FETCH_TARBALLS="ALL"
4710     else
4711         AC_MSG_RESULT([yes, if we use them])
4712         DO_FETCH_TARBALLS="TRUE"
4713     fi
4714 else
4715     AC_MSG_RESULT([no])
4716     DO_FETCH_TARBALLS=
4718 AC_SUBST(DO_FETCH_TARBALLS)
4720 AC_MSG_CHECKING([whether to build help])
4721 HELP_COMMON_ONLY=FALSE
4722 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4723     BUILD_TYPE="$BUILD_TYPE HELP"
4724     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4725     if test "$with_help" = "common" ; then
4726         HELP_COMMON_ONLY=TRUE
4727         AC_MSG_RESULT([common only])
4728     else
4729         SCPDEFS="$SCPDEFS -DWITH_HELP"
4730         AC_MSG_RESULT([yes])
4731     fi
4732 else
4733     AC_MSG_RESULT([no])
4735 AC_SUBST(HELP_COMMON_ONLY)
4737 dnl Test whether to include MySpell dictionaries
4738 dnl ===================================================================
4739 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4740 if test "$with_myspell_dicts" = "yes"; then
4741     AC_MSG_RESULT([yes])
4742     WITH_MYSPELL_DICTS=TRUE
4743     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4744     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4745 else
4746     AC_MSG_RESULT([no])
4747     WITH_MYSPELL_DICTS=
4749 AC_SUBST(WITH_MYSPELL_DICTS)
4751 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4752 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4753     if test "$with_system_dicts" = yes; then
4754         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4755     fi
4756     with_system_dicts=no
4759 AC_MSG_CHECKING([whether to use dicts from external paths])
4760 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4761     AC_MSG_RESULT([yes])
4762     SYSTEM_DICTS=TRUE
4763     AC_MSG_CHECKING([for spelling dictionary directory])
4764     if test -n "$with_external_dict_dir"; then
4765         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4766     else
4767         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4768         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4769             DICT_SYSTEM_DIR=file:///usr/share/myspell
4770         fi
4771     fi
4772     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4773     AC_MSG_CHECKING([for hyphenation patterns directory])
4774     if test -n "$with_external_hyph_dir"; then
4775         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4776     else
4777         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4778     fi
4779     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4780     AC_MSG_CHECKING([for thesaurus directory])
4781     if test -n "$with_external_thes_dir"; then
4782         THES_SYSTEM_DIR=file://$with_external_thes_dir
4783     else
4784         THES_SYSTEM_DIR=file:///usr/share/mythes
4785     fi
4786     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4787 else
4788     AC_MSG_RESULT([no])
4789     SYSTEM_DICTS=
4791 AC_SUBST(SYSTEM_DICTS)
4792 AC_SUBST(DICT_SYSTEM_DIR)
4793 AC_SUBST(HYPH_SYSTEM_DIR)
4794 AC_SUBST(THES_SYSTEM_DIR)
4796 dnl ===================================================================
4797 dnl enable pch by default on windows
4798 dnl enable it explicitly otherwise
4799 ENABLE_PCH=""
4800 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4801     if test -z "$libo_fuzzed_enable_pch"; then
4802         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4803     else
4804         AC_MSG_NOTICE([Resetting --enable-pch=no])
4805         enable_pch=no
4806     fi
4809 AC_MSG_CHECKING([whether to enable pch feature])
4810 if test "$enable_pch" != "no"; then
4811     if test "$_os" = "WINNT"; then
4812         ENABLE_PCH="TRUE"
4813         AC_MSG_RESULT([yes])
4814     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4815         ENABLE_PCH="TRUE"
4816         AC_MSG_RESULT([yes])
4817     elif test -n "$enable_pch"; then
4818         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4819     else
4820         AC_MSG_RESULT([no])
4821     fi
4822 else
4823     AC_MSG_RESULT([no])
4825 AC_SUBST(ENABLE_PCH)
4827 TAB=`printf '\t'`
4829 AC_MSG_CHECKING([the GNU Make version])
4830 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4831 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4832 if test "$_make_longver" -ge "038200"; then
4833     AC_MSG_RESULT([$GNUMAKE $_make_version])
4835 elif test "$_make_longver" -ge "038100"; then
4836     if test "$build_os" = "cygwin"; then
4837         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4838     fi
4839     AC_MSG_RESULT([$GNUMAKE $_make_version])
4841     dnl ===================================================================
4842     dnl Search all the common names for sha1sum
4843     dnl ===================================================================
4844     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4845     if test -z "$SHA1SUM"; then
4846         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4847     elif test "$SHA1SUM" = "openssl"; then
4848         SHA1SUM="openssl sha1"
4849     fi
4850     AC_MSG_CHECKING([for GNU Make bug 20033])
4851     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4852     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4853 A := \$(wildcard *.a)
4855 .PHONY: all
4856 all: \$(A:.a=.b)
4857 <TAB>@echo survived bug20033.
4859 .PHONY: setup
4860 setup:
4861 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4863 define d1
4864 @echo lala \$(1)
4865 @sleep 1
4866 endef
4868 define d2
4869 @echo tyty \$(1)
4870 @sleep 1
4871 endef
4873 %.b : %.a
4874 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4875 <TAB>\$(call d1,\$(CHECKSUM)),\
4876 <TAB>\$(call d2,\$(CHECKSUM)))
4878     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4879         no_parallelism_make="YES"
4880         AC_MSG_RESULT([yes, disable parallelism])
4881     else
4882         AC_MSG_RESULT([no, keep parallelism enabled])
4883     fi
4884     rm -rf $TESTGMAKEBUG20033
4885 else
4886     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4889 # find if gnumake support file function
4890 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4891 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4892 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4893     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4895 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4896 \$(file >test.txt,Success )
4898 .PHONY: all
4899 all:
4900 <TAB>@cat test.txt
4903 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4904 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4905     HAVE_GNUMAKE_FILE_FUNC=TRUE
4906     AC_MSG_RESULT([yes])
4907 else
4908     AC_MSG_RESULT([no])
4910 rm -rf $TESTGMAKEFILEFUNC
4911 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4912 AC_SUBST(GNUMAKE_WIN_NATIVE)
4914 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4915 STALE_MAKE=
4916 if test "$_make_ver_check" = ""; then
4917    STALE_MAKE=TRUE
4920 HAVE_LD_HASH_STYLE=FALSE
4921 WITH_LINKER_HASH_STYLE=
4922 AC_MSG_CHECKING([for --hash-style gcc linker support])
4923 if test "$GCC" = "yes"; then
4924     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4925         hash_styles="gnu sysv"
4926     elif test "$with_linker_hash_style" = "no"; then
4927         hash_styles=
4928     else
4929         hash_styles="$with_linker_hash_style"
4930     fi
4932     for hash_style in $hash_styles; do
4933         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4934         hash_style_ldflags_save=$LDFLAGS
4935         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4937         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4938             [
4939 #include <stdio.h>
4940             ],[
4941 printf ("");
4942             ])],
4943             [
4944                   HAVE_LD_HASH_STYLE=TRUE
4945                   WITH_LINKER_HASH_STYLE=$hash_style
4946             ],
4947             [HAVE_LD_HASH_STYLE=FALSE],
4948             [HAVE_LD_HASH_STYLE=FALSE])
4949         LDFLAGS=$hash_style_ldflags_save
4950     done
4952     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4953         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4954     else
4955         AC_MSG_RESULT( no )
4956     fi
4957     LDFLAGS=$hash_style_ldflags_save
4958 else
4959     AC_MSG_RESULT( no )
4961 AC_SUBST(HAVE_LD_HASH_STYLE)
4962 AC_SUBST(WITH_LINKER_HASH_STYLE)
4964 dnl ===================================================================
4965 dnl Check whether there's a Perl version available.
4966 dnl ===================================================================
4967 if test -z "$with_perl_home"; then
4968     AC_PATH_PROG(PERL, perl)
4969 else
4970     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4971     _perl_path="$with_perl_home/bin/perl"
4972     if test -x "$_perl_path"; then
4973         PERL=$_perl_path
4974     else
4975         AC_MSG_ERROR([$_perl_path not found])
4976     fi
4979 dnl ===================================================================
4980 dnl Testing for Perl version 5 or greater.
4981 dnl $] is the Perl version variable, it is returned as an integer
4982 dnl ===================================================================
4983 if test "$PERL"; then
4984     AC_MSG_CHECKING([the Perl version])
4985     ${PERL} -e "exit($]);"
4986     _perl_version=$?
4987     if test "$_perl_version" -lt 5; then
4988         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
4989     fi
4990     AC_MSG_RESULT([Perl $_perl_version])
4991 else
4992     AC_MSG_ERROR([Perl not found, install Perl 5])
4995 dnl ===================================================================
4996 dnl Testing for required Perl modules
4997 dnl ===================================================================
4999 AC_MSG_CHECKING([for required Perl modules])
5000 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5001     AC_MSG_RESULT([all modules found])
5002 else
5003     AC_MSG_RESULT([failed to find some modules])
5004     # Find out which modules are missing.
5005     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5006         missing_perl_modules="$missing_perl_modules Cwd"
5007     fi
5008     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5009         missing_perl_modules="$missing_perl_modules Digest::MD5"
5010     fi
5011        AC_MSG_ERROR([
5012     The missing Perl modules are: $missing_perl_modules
5013     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5016 dnl ===================================================================
5017 dnl Check for pkg-config
5018 dnl ===================================================================
5019 if test "$_os" != "WINNT"; then
5020     PKG_PROG_PKG_CONFIG
5023 if test "$_os" != "WINNT"; then
5025     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5026     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5027     # explicitly. Or put /path/to/compiler in PATH yourself.
5029     # Use wrappers for LTO
5030     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5031         AC_CHECK_TOOL(AR,gcc-ar)
5032         AC_CHECK_TOOL(NM,gcc-nm)
5033         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5034     else
5035         AC_CHECK_TOOL(AR,ar)
5036         AC_CHECK_TOOL(NM,nm)
5037         AC_CHECK_TOOL(RANLIB,ranlib)
5038     fi
5039     AC_CHECK_TOOL(OBJDUMP,objdump)
5040     AC_CHECK_TOOL(READELF,readelf)
5041     AC_CHECK_TOOL(STRIP,strip)
5042     if test "$_os" = "WINNT"; then
5043         AC_CHECK_TOOL(DLLTOOL,dlltool)
5044         AC_CHECK_TOOL(WINDRES,windres)
5045     fi
5047 AC_SUBST(AR)
5048 AC_SUBST(DLLTOOL)
5049 AC_SUBST(NM)
5050 AC_SUBST(OBJDUMP)
5051 AC_SUBST(PKG_CONFIG)
5052 AC_SUBST(RANLIB)
5053 AC_SUBST(READELF)
5054 AC_SUBST(STRIP)
5055 AC_SUBST(WINDRES)
5057 dnl ===================================================================
5058 dnl pkg-config checks on Mac OS X
5059 dnl ===================================================================
5061 if test $_os = Darwin; then
5062     AC_MSG_CHECKING([for bogus pkg-config])
5063     if test -n "$PKG_CONFIG"; then
5064         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5065             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5066         else
5067             if test "$enable_bogus_pkg_config" = "yes"; then
5068                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5069             else
5070                 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.])
5071             fi
5072         fi
5073     else
5074         AC_MSG_RESULT([no, good])
5075     fi
5078 find_csc()
5080     # Return value: $csctest
5082     unset csctest
5084     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5085     if test -n "$regvalue"; then
5086         csctest=$regvalue
5087         return
5088     fi
5091 find_al()
5093     # Return value: $altest
5095     unset altest
5097     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5098         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5099         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5100             altest=$regvalue
5101             return
5102         fi
5103     done
5105     # We need this additional check to detect 4.6.2 or above.
5106     for ver in 4.7 4.6.2; do
5107         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/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
5115 find_dotnetsdk()
5117     # Return value: $frametest (that's a silly name...)
5119     unset frametest
5121     for ver in 1.1 2.0; do
5122         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5123         if test -n "$regvalue"; then
5124             frametest=$regvalue
5125             return
5126         fi
5127     done
5130 find_dotnetsdk46()
5132     unset frametest
5134     for ver in 4.7 4.6.2 4.6.1 4.6; do
5135         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5136         if test -n "$regvalue"; then
5137             frametest=$regvalue
5138             return
5139         fi
5140         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5141         if test -n "$regvalue"; then
5142             frametest=$regvalue
5143             return
5144         fi
5145     done
5148 find_winsdk_version()
5150     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5151     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5153     unset winsdktest winsdkbinsubdir winsdklibsubdir
5155     case "$1" in
5156     7.*)
5157         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5158         if test -n "$regvalue"; then
5159             winsdktest=$regvalue
5160             winsdklibsubdir=.
5161             return
5162         fi
5163         ;;
5164     8.0|8.0A)
5165         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5166         if test -n "$regvalue"; then
5167             winsdktest=$regvalue
5168             winsdklibsubdir=win8
5169             return
5170         fi
5171         ;;
5172     8.1|8.1A)
5173         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5174         if test -n "$regvalue"; then
5175             winsdktest=$regvalue
5176             winsdklibsubdir=winv6.3
5177             return
5178         fi
5179         ;;
5180     10.0)
5181         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5182         if test -n "$regvalue"; then
5183             winsdktest=$regvalue
5184             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5185             if test -n "$regvalue"; then
5186                 winsdkbinsubdir="$regvalue".0
5187             fi
5188             winsdklibsubdir=$regvalue
5189             if test "$regvalue" = "10.0.14393"; then
5190                 winsdklibsubdir="10.0.14393.0"
5191             elif test "$regvalue" = "10.0.15063"; then
5192                 winsdklibsubdir="10.0.15063.0"
5193                 dnl Hack needed at least by tml:
5194                 if test ! -f "${winsdktest}/Include/10.0.15063.0/um/sqlext.h" \
5195                     -a -f "${winsdktest}/Include/10.0.14393.0/um/sqlext.h"
5196                 then
5197                     winsdklibsubdir="10.0.14393.0"
5198                 fi
5199             fi
5200             return
5201         fi
5202         ;;
5203     esac
5206 find_winsdk()
5208     # Return value: From find_winsdk_version
5210     unset winsdktest
5212     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5213         find_winsdk_version $ver
5214         if test -n "$winsdktest"; then
5215             return
5216         fi
5217     done
5220 find_msms()
5222     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5223     AC_MSG_CHECKING([for $my_msm_file])
5224     msmdir=
5225     for ver in 14.0 15.0; do
5226         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5227         if test -n "$regvalue"; then
5228             if test -e "$regvalue/$my_msm_file"; then
5229                 msmdir=$regvalue
5230                 break
5231             fi
5232         fi
5233     done
5234     dnl Is the following fallback really necessary, or was it added in response
5235     dnl to never having started Visual Studio on a given machine, so the
5236     dnl registry keys checked above had presumably not yet been created?
5237     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5238     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5239     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5240     dnl expanding to "C:\Program Files\Common Files"), which would need
5241     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5242     dnl obtain its value from cygwin:
5243     if test -z "$msmdir"; then
5244         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5245         if test -e "$my_msm_dir/$my_msm_file"; then
5246             msmdir=$my_msm_dir
5247         fi
5248     fi
5250     dnl Starting from MSVC 15.0, merge modules are located in different directory
5251     if test $VCVER = 150; then
5252         my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$vcbuildnumber/MergeModules/"
5253         if test -e "$my_msm_dir/$my_msm_file"; then
5254             msmdir=$my_msm_dir
5255         else
5256             # got everything in 14.10.15017 except the MSMS in 25008... huh?
5257             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/14.10.25008/MergeModules/"
5258             if test -e "$my_msm_dir/$my_msm_file"; then
5259                 msmdir=$my_msm_dir
5260             fi
5261         fi
5262     fi
5264     if test -n "$msmdir"; then
5265         msmdir=`cygpath -m "$msmdir"`
5266         AC_MSG_RESULT([$msmdir])
5267     else
5268         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5269             AC_MSG_ERROR([not found])
5270         else
5271             AC_MSG_WARN([not found])
5272             add_warning "MSM $my_msm_file not found"
5273         fi
5274     fi
5277 find_msvc_x64_dlls()
5279     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5280     if test "$VCVER" = 150; then
5281         if test $vcbuildnumber = 14.10.25017; then
5282             msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$vcbuildnumber/onecore/x64/Microsoft.VC${VCVER}.CRT"
5283         else
5284             msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$vcbuildnumber/x64/Microsoft.VC${VCVER}.CRT"
5285         fi
5286     fi
5287     # http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
5288     # Refactored C Runtime (CRT): This CTP contains the first preview of the substantially refactored CRT.
5289     # msvcr140.dll no longer exists. It is replaced by a trio of DLLs: vcruntime140.dll, appcrt140.dll,
5290     # and desktopcrt140.dll.
5292     if test "$VCVER" = 150; then
5293        msvcdlls="msvcp140.dll vcruntime140.dll"
5294     elif test "$VCVER" = 140; then
5295        msvcdlls="msvcp${VCVER}.dll vcruntime${VCVER}.dll"
5296     else
5297        msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5298     fi
5299     for dll in $msvcdlls; do
5300         if ! test -f "$msvcdllpath/$dll"; then
5301             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5302         fi
5303     done
5306 dnl =========================================
5307 dnl Check for the Windows  SDK.
5308 dnl =========================================
5309 if test "$_os" = "WINNT"; then
5310     AC_MSG_CHECKING([for Windows SDK])
5311     if test "$build_os" = "cygwin"; then
5312         find_winsdk
5313         WINDOWS_SDK_HOME=$winsdktest
5315         # normalize if found
5316         if test -n "$WINDOWS_SDK_HOME"; then
5317             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5318             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5319         fi
5321         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5322     fi
5324     if test -n "$WINDOWS_SDK_HOME"; then
5325         # Remove a possible trailing backslash
5326         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5328         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5329              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5330              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5331             have_windows_sdk_headers=yes
5332         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5333              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5334              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5335             have_windows_sdk_headers=yes
5336         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5337              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5338              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5339             have_windows_sdk_headers=yes
5340         else
5341             have_windows_sdk_headers=no
5342         fi
5344         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5345             have_windows_sdk_libs=yes
5346         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5347             have_windows_sdk_libs=yes
5348         else
5349             have_windows_sdk_libs=no
5350         fi
5352         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5353             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5354 the  Windows SDK are installed.])
5355         fi
5356     fi
5358     if test -z "$WINDOWS_SDK_HOME"; then
5359         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5360     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5361         WINDOWS_SDK_VERSION=70
5362         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5363     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5364         WINDOWS_SDK_VERSION=80
5365         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5366         dnl compatibility warning if not explicitly choosing the 80 SDK:
5367         if test -z "$with_windows_sdk"; then
5368             AC_MSG_WARN([If a build should run on Windows XP,])
5369             AC_MSG_WARN([use --with-windows-sdk=7.1A])
5370             add_warning "If a build should run on Windows XP,"
5371             add_warning "use --with-windows-sdk=7.1A"
5372         fi
5373     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5374         WINDOWS_SDK_VERSION=81
5375         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5376     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5377         WINDOWS_SDK_VERSION=10
5378         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5379     else
5380         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5381     fi
5382     PathFormat "$WINDOWS_SDK_HOME"
5383     WINDOWS_SDK_HOME="$formatted_path"
5384     if test "$build_os" = "cygwin"; then
5385         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5386         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5387             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5388         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5389             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5390         fi
5391     fi
5393     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5394     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5395     dnl but not in v8.0), so allow this to be overridden with a
5396     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5397     dnl and configuration error if no WiLangId.vbs is found would arguably be
5398     dnl better, but I do not know under which conditions exactly it is needed by
5399     dnl msiglobal.pm:
5400     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5401         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5402         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5403             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5404         fi
5405         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5406             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5407         fi
5408         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5409             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
5410             add_warning "WiLangId.vbs not found - building translated packages will fail"
5411         fi
5412     fi
5414 AC_SUBST(WINDOWS_SDK_HOME)
5415 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5416 AC_SUBST(WINDOWS_SDK_VERSION)
5417 AC_SUBST(WINDOWS_SDK_WILANGID)
5419 if test "$build_os" = "cygwin"; then
5420     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5421     dnl dir, it also determines that dir's path w/o an arch segment if any,
5422     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5423     AC_MSG_CHECKING([for midl.exe])
5425     find_winsdk
5426     if test -n "$winsdkbinsubdir" \
5427         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5428     then
5429         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5430         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5431     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5432         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5433         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5434     elif test -f "$winsdktest/Bin/midl.exe"; then
5435         MIDL_PATH=$winsdktest/Bin
5436         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5437     fi
5438     if test ! -f "$MIDL_PATH/midl.exe"; then
5439         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5440     else
5441         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5442     fi
5444     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5445     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5447     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5448          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5449          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5450          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5451     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5452          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5453          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5454          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5455     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5456          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5457          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5458          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5459     else
5460         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5461     fi
5463     dnl Check csc.exe
5464     AC_MSG_CHECKING([for csc.exe])
5465     find_csc
5466     if test -f "$csctest/csc.exe"; then
5467         CSC_PATH="$csctest"
5468     fi
5469     if test ! -f "$CSC_PATH/csc.exe"; then
5470         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5471     else
5472         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5473     fi
5475     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5477     dnl Check al.exe
5478     AC_MSG_CHECKING([for al.exe])
5479     find_winsdk
5480     if test -n "$winsdkbinsubdir" \
5481         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5482     then
5483         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5484     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5485         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5486     elif test -f "$winsdktest/Bin/al.exe"; then
5487         AL_PATH="$winsdktest/Bin"
5488     fi
5490     if test -z "$AL_PATH"; then
5491         find_al
5492         if test -f "$altest/bin/al.exe"; then
5493             AL_PATH="$altest/bin"
5494         elif test -f "$altest/al.exe"; then
5495             AL_PATH="$altest"
5496         fi
5497     fi
5498     if test ! -f "$AL_PATH/al.exe"; then
5499         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5500     else
5501         AC_MSG_RESULT([$AL_PATH/al.exe])
5502     fi
5504     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5506     dnl Check mscoree.lib / .NET Framework dir
5507     AC_MSG_CHECKING(.NET Framework)
5508     find_dotnetsdk
5509     if test -f "$frametest/lib/mscoree.lib"; then
5510         DOTNET_FRAMEWORK_HOME="$frametest"
5511     else
5512         find_winsdk
5513         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5514             DOTNET_FRAMEWORK_HOME="$winsdktest"
5515         else
5516             find_dotnetsdk46
5517             PathFormat "$frametest"
5518             frametest="$formatted_path"
5519             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5520                  DOTNET_FRAMEWORK_HOME="$frametest"
5521             fi
5522         fi
5523     fi
5525     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
5526         AC_MSG_ERROR([mscoree.lib not found])
5527     fi
5528     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5530     PathFormat "$MIDL_PATH"
5531     MIDL_PATH="$formatted_path"
5533     PathFormat "$AL_PATH"
5534     AL_PATH="$formatted_path"
5536     PathFormat "$DOTNET_FRAMEWORK_HOME"
5537     DOTNET_FRAMEWORK_HOME="$formatted_path"
5539     PathFormat "$CSC_PATH"
5540     CSC_PATH="$formatted_path"
5543 dnl ===================================================================
5544 dnl Check if stdc headers are available excluding MSVC.
5545 dnl ===================================================================
5546 if test "$_os" != "WINNT"; then
5547     AC_HEADER_STDC
5550 dnl ===================================================================
5551 dnl Testing for C++ compiler and version...
5552 dnl ===================================================================
5554 if test "$_os" != "WINNT"; then
5555     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5556     save_CXXFLAGS=$CXXFLAGS
5557     AC_PROG_CXX
5558     CXXFLAGS=$save_CXXFLAGS
5559 else
5560     if test -n "$CC" -a -z "$CXX"; then
5561         CXX="$CC"
5562     fi
5565 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5566 dnl ("implementation limitation" when defining OUStringLiteral variables in
5567 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5568 dnl probably a good idea to require that anyway.  A reliable way to check for
5569 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5570 dnl namespace definitions (which requires /std:c++latest to be enabled):
5571 if test "$COM" = MSC -a "$VCVER" = 140; then
5572     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5573     save_CXX=$CXX
5574     save_CXXFLAGS=$CXXFLAGS
5575     CXX=$MSVC_CXX
5576     CXXFLAGS="$CXXFLAGS /std:c++latest"
5577     AC_LANG_PUSH([C++])
5578     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5579         namespace A::B {}
5580     ]])], [good=yes], [good=no])
5581     AC_LANG_POP([C++])
5582     CXX=$save_CXX
5583     CXXFLAGS=$save_CXXFLAGS
5584     AC_MSG_RESULT([$good])
5585     if test "$good" = no; then
5586         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5587     fi
5590 dnl check for GNU C++ compiler version
5591 if test "$GXX" = "yes"; then
5592     AC_MSG_CHECKING([the GNU C++ compiler version])
5594     _gpp_version=`$CXX -dumpversion`
5595     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5597     if test "$_gpp_majmin" -lt "401"; then
5598         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5599     else
5600         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5601     fi
5603     dnl see https://code.google.com/p/android/issues/detail?id=41770
5604     if test "$_gpp_majmin" -ge "401"; then
5605         glibcxx_threads=no
5606         AC_LANG_PUSH([C++])
5607         AC_REQUIRE_CPP
5608         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5609         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5610             #include <bits/c++config.h>]],[[
5611             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5612             && !defined(_GLIBCXX__PTHREADS) \
5613             && !defined(_GLIBCXX_HAS_GTHREADS)
5614             choke me
5615             #endif
5616         ]])],[AC_MSG_RESULT([yes])
5617         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5618         AC_LANG_POP([C++])
5619         if test $glibcxx_threads = yes; then
5620             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5621         fi
5622      fi
5624 AC_SUBST(BOOST_CXXFLAGS)
5627 # prefx CXX with ccache if needed
5629 if test "$CCACHE" != ""; then
5630     AC_MSG_CHECKING([whether $CXX is already ccached])
5631     AC_LANG_PUSH([C++])
5632     save_CXXFLAGS=$CXXFLAGS
5633     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5634     dnl an empty program will do, we're checking the compiler flags
5635     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5636                       [use_ccache=yes], [use_ccache=no])
5637     if test $use_ccache = yes; then
5638         AC_MSG_RESULT([yes])
5639     else
5640         CXX="$CCACHE $CXX"
5641         AC_MSG_RESULT([no])
5642     fi
5643     CXXFLAGS=$save_CXXFLAGS
5644     AC_LANG_POP([C++])
5647 dnl ===================================================================
5648 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5649 dnl ===================================================================
5651 if test "$_os" != "WINNT"; then
5652     AC_PROG_CXXCPP
5654     dnl Check whether there's a C pre-processor.
5655     AC_PROG_CPP
5659 dnl ===================================================================
5660 dnl Find integral type sizes and alignments
5661 dnl ===================================================================
5663 if test "$_os" != "WINNT"; then
5665     AC_CHECK_SIZEOF(long)
5666     AC_CHECK_SIZEOF(short)
5667     AC_CHECK_SIZEOF(int)
5668     AC_CHECK_SIZEOF(long long)
5669     AC_CHECK_SIZEOF(double)
5670     AC_CHECK_SIZEOF(void*)
5672     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5673     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5674     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5675     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5676     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5678     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5679     m4_pattern_allow([AC_CHECK_ALIGNOF])
5680     m4_ifdef([AC_CHECK_ALIGNOF],
5681         [
5682             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5683             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5684             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5685             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5686         ],
5687         [
5688             case "$_os-$host_cpu" in
5689             Linux-i686)
5690                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5691                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5692                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5693                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5694                 ;;
5695             Linux-x86_64)
5696                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5697                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5698                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5699                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5700                 ;;
5701             *)
5702                 if test -z "$ac_cv_alignof_short" -o \
5703                         -z "$ac_cv_alignof_int" -o \
5704                         -z "$ac_cv_alignof_long" -o \
5705                         -z "$ac_cv_alignof_double"; then
5706                    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.])
5707                 fi
5708                 ;;
5709             esac
5710         ])
5712     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5713     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5714     if test $ac_cv_sizeof_long -eq 8; then
5715         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5716     elif test $ac_cv_sizeof_double -eq 8; then
5717         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5718     else
5719         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5720     fi
5722     dnl Check for large file support
5723     AC_SYS_LARGEFILE
5724     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5725         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5726     fi
5727     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5728         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5729     fi
5730 else
5731     # Hardcode for MSVC
5732     SAL_TYPES_SIZEOFSHORT=2
5733     SAL_TYPES_SIZEOFINT=4
5734     SAL_TYPES_SIZEOFLONG=4
5735     SAL_TYPES_SIZEOFLONGLONG=8
5736     if test "$BITNESS_OVERRIDE" = ""; then
5737         SAL_TYPES_SIZEOFPOINTER=4
5738     else
5739         SAL_TYPES_SIZEOFPOINTER=8
5740     fi
5741     SAL_TYPES_ALIGNMENT2=2
5742     SAL_TYPES_ALIGNMENT4=4
5743     SAL_TYPES_ALIGNMENT8=8
5744     LFS_CFLAGS=''
5746 AC_SUBST(LFS_CFLAGS)
5748 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5749 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5750 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5751 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5752 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5753 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5754 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5755 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5757 dnl ===================================================================
5758 dnl Check whether to enable runtime optimizations
5759 dnl ===================================================================
5760 ENABLE_RUNTIME_OPTIMIZATIONS=
5761 AC_MSG_CHECKING([whether to enable runtime optimizations])
5762 if test -z "$enable_runtime_optimizations"; then
5763     for i in $CC; do
5764         case $i in
5765         -fsanitize=*)
5766             enable_runtime_optimizations=no
5767             break
5768             ;;
5769         esac
5770     done
5772 if test "$enable_runtime_optimizations" != no; then
5773     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5774     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5775     AC_MSG_RESULT([yes])
5776 else
5777     AC_MSG_RESULT([no])
5779 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5781 dnl ===================================================================
5782 dnl Check if valgrind headers are available
5783 dnl ===================================================================
5784 ENABLE_VALGRIND=
5785 if test "$cross_compiling" != yes; then
5786     prev_cppflags=$CPPFLAGS
5787     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5788     # or where does it come from?
5789     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5790     AC_CHECK_HEADER([valgrind/valgrind.h],
5791         [ENABLE_VALGRIND=TRUE])
5792     CPPFLAGS=$prev_cppflags
5794 AC_SUBST([ENABLE_VALGRIND])
5795 if test -z "$ENABLE_VALGRIND"; then
5796     VALGRIND_CFLAGS=
5798 AC_SUBST([VALGRIND_CFLAGS])
5801 dnl ===================================================================
5802 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5803 dnl ===================================================================
5805 # We need at least the sys/sdt.h include header.
5806 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5807 if test "$SDT_H_FOUND" = "TRUE"; then
5808     # Found sys/sdt.h header, now make sure the c++ compiler works.
5809     # Old g++ versions had problems with probes in constructors/destructors.
5810     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5811     AC_LANG_PUSH([C++])
5812     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5813     #include <sys/sdt.h>
5814     class ProbeClass
5815     {
5816     private:
5817       int& ref;
5818       const char *name;
5820     public:
5821       ProbeClass(int& v, const char *n) : ref(v), name(n)
5822       {
5823         DTRACE_PROBE2(_test_, cons, name, ref);
5824       }
5826       void method(int min)
5827       {
5828         DTRACE_PROBE3(_test_, meth, name, ref, min);
5829         ref -= min;
5830       }
5832       ~ProbeClass()
5833       {
5834         DTRACE_PROBE2(_test_, dest, name, ref);
5835       }
5836     };
5837     ]],[[
5838     int i = 64;
5839     DTRACE_PROBE1(_test_, call, i);
5840     ProbeClass inst = ProbeClass(i, "call");
5841     inst.method(24);
5842     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5843           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5844     AC_LANG_POP([C++])
5846 AC_CONFIG_HEADERS([config_host/config_probes.h])
5848 dnl ===================================================================
5849 dnl thread-safe statics
5850 dnl ===================================================================
5851 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5852 unset HAVE_THREADSAFE_STATICS
5853 if test "$GCC" = "yes"; then
5854     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5855     dnl us.  However, some C++ runtimes use a single lock for all static
5856     dnl variables, which can cause deadlock in multi-threaded applications.
5857     dnl This is not easily tested here; for POSIX-based systems, if executing
5858     dnl the following C++ program does not terminate then the tool chain
5859     dnl apparently has this problem:
5860     dnl
5861     dnl   #include <pthread.h>
5862     dnl   int h() { return 0; }
5863     dnl   void * g(void * unused) {
5864     dnl     static int n = h();
5865     dnl     return &n;
5866     dnl   }
5867     dnl   int f() {
5868     dnl     pthread_t t;
5869     dnl     pthread_create(&t, 0, g, 0);
5870     dnl     pthread_join(t, 0);
5871     dnl     return 0;
5872     dnl   }
5873     dnl   int main() {
5874     dnl     static int n = f();
5875     dnl     return n;
5876     dnl   }
5877     dnl
5878     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5879     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5880     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5881     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5882     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5883     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5884     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5885     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5886     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5887     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5888     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5889     dnl "too old"):
5890     if test "$_os" = Darwin; then
5891         HAVE_THREADSAFE_STATICS=TRUE
5892     elif test "$_os" != Android; then
5893         if test "$COM_IS_CLANG" = TRUE; then
5894             AC_LANG_PUSH([C++])
5895             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5896 #include <list>
5897 #if defined __GLIBCXX__
5898 #if __GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306
5899 #error
5900 #endif
5901 #endif
5902                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5903             AC_LANG_POP([C++])
5904         else # known to work in GCC since version 4.3
5905             HAVE_THREADSAFE_STATICS=TRUE
5906         fi
5907     fi
5908     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5909         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5910         AC_MSG_RESULT([yes])
5911     else
5912         AC_MSG_RESULT([broken (i.e., no)])
5913     fi
5914 else
5915     # MSVC has sprouted C++11 thread-safe statics in 2015
5916     # http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
5917     if test "$COM" = "MSC" -a "$VCVER" -ge "140"; then
5918         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5919         AC_MSG_RESULT([yes])
5920     else
5921         AC_MSG_RESULT([no])
5922     fi
5924 AC_SUBST(HAVE_THREADSAFE_STATICS)
5926 dnl ===================================================================
5927 dnl GCC features
5928 dnl ===================================================================
5929 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5930     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5931     save_CFLAGS=$CFLAGS
5932     CFLAGS="$CFLAGS -Werror -mno-avx"
5933     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5934     CFLAGS=$save_CFLAGS
5935     if test "$HAVE_GCC_AVX" = "TRUE"; then
5936         AC_MSG_RESULT([yes])
5937     else
5938         AC_MSG_RESULT([no])
5939     fi
5941     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5942     save_CFLAGS=$CFLAGS
5943     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5944     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5945     CFLAGS=$save_CFLAGS
5946     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5947         AC_MSG_RESULT([yes])
5948     else
5949         AC_MSG_RESULT([no])
5950     fi
5952     AC_MSG_CHECKING([whether $CC supports atomic functions])
5953     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5954     int v = 0;
5955     if (__sync_add_and_fetch(&v, 1) != 1 ||
5956         __sync_sub_and_fetch(&v, 1) != 0)
5957         return 1;
5958     __sync_synchronize();
5959     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5960         v != 1)
5961         return 1;
5962     return 0;
5963 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5964     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5965         AC_MSG_RESULT([yes])
5966         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5967     else
5968         AC_MSG_RESULT([no])
5969     fi
5971     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5972     save_CFLAGS=$CFLAGS
5973     CFLAGS="$CFLAGS -Werror"
5974     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5975             __attribute__((deprecated("test"))) void f();
5976         ])], [
5977             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5978             AC_MSG_RESULT([yes])
5979         ], [AC_MSG_RESULT([no])])
5980     CFLAGS=$save_CFLAGS
5982     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5983     AC_LANG_PUSH([C++])
5984     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5985             #include <cstddef>
5986             #include <cxxabi.h>
5987             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5988         ])], [
5989             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5990             AC_MSG_RESULT([yes])
5991         ], [AC_MSG_RESULT([no])])
5992     AC_LANG_POP([C++])
5994     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5995     AC_LANG_PUSH([C++])
5996     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5997             #include <cstddef>
5998             #include <cxxabi.h>
5999             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6000         ])], [
6001             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6002             AC_MSG_RESULT([yes])
6003         ], [AC_MSG_RESULT([no])])
6004     AC_LANG_POP([C++])
6006     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6007     AC_LANG_PUSH([C++])
6008     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6009             #include <cxxabi.h>
6010             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6011         ])], [
6012             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6013             AC_MSG_RESULT([yes])
6014         ], [AC_MSG_RESULT([no])])
6015     AC_LANG_POP([C++])
6017     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6018     AC_LANG_PUSH([C++])
6019     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6020             #include <cstddef>
6021             #include <cxxabi.h>
6022             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6023         ])], [
6024             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6025             AC_MSG_RESULT([yes])
6026         ], [AC_MSG_RESULT([no])])
6027     AC_LANG_POP([C++])
6029     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6030     AC_LANG_PUSH([C++])
6031     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6032             #include <cstddef>
6033             #include <cxxabi.h>
6034             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6035         ])], [
6036             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6037             AC_MSG_RESULT([yes])
6038         ], [AC_MSG_RESULT([no])])
6039     AC_LANG_POP([C++])
6041     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6042     AC_LANG_PUSH([C++])
6043     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6044             #include <cxxabi.h>
6045             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6046         ])], [
6047             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6048             AC_MSG_RESULT([yes])
6049         ], [AC_MSG_RESULT([no])])
6050     AC_LANG_POP([C++])
6052     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6053     AC_LANG_PUSH([C++])
6054     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6055             #include <cxxabi.h>
6056             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6057         ])], [
6058             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6059             AC_MSG_RESULT([yes])
6060         ], [AC_MSG_RESULT([no])])
6061     AC_LANG_POP([C++])
6063     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6064     AC_LANG_PUSH([C++])
6065     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6066             #include <cstddef>
6067             #include <cxxabi.h>
6068             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6069         ])], [
6070             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6071             AC_MSG_RESULT([yes])
6072         ], [AC_MSG_RESULT([no])])
6073     AC_LANG_POP([C++])
6075     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6076     AC_LANG_PUSH([C++])
6077     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6078             #include <cstddef>
6079             #include <cxxabi.h>
6080             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6081         ])], [
6082             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6083             AC_MSG_RESULT([yes])
6084         ], [AC_MSG_RESULT([no])])
6085     AC_LANG_POP([C++])
6087     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6088     AC_LANG_PUSH([C++])
6089     save_CXXFLAGS=$CXXFLAGS
6090     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
6091     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6092             #include <string>
6093             void f() { std::string s; }
6094         ])], [
6095             AC_MSG_RESULT([no])
6096         ], [
6097             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6098             AC_MSG_RESULT([yes])])
6099     CXXFLAGS=$save_CXXFLAGS
6100     AC_LANG_POP([C++])
6102     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6103     AC_LANG_PUSH([C++])
6104     save_CXXFLAGS=$CXXFLAGS
6105     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
6106     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6107             struct __attribute__((warn_unused)) dummy {};
6108         ])], [
6109             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6110             AC_MSG_RESULT([yes])
6111         ], [AC_MSG_RESULT([no])])
6112     CXXFLAGS=$save_CXXFLAGS
6113 AC_LANG_POP([C++])
6116 AC_SUBST(HAVE_GCC_AVX)
6117 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6118 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6120 dnl ===================================================================
6121 dnl Identify the C++ library
6122 dnl ===================================================================
6124 AC_MSG_CHECKING([What the C++ library is])
6125 AC_LANG_PUSH([C++])
6126 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6127 #include <utility>
6128 #ifndef __GLIBCXX__
6129 foo bar
6130 #endif
6131 ]])],
6132     [CPP_LIBRARY=GLIBCXX
6133      cpp_library_name="GNU libstdc++"
6134     ],
6135     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6136 #include <utility>
6137 #ifndef _LIBCPP_VERSION
6138 foo bar
6139 #endif
6140 ]])],
6141     [CPP_LIBRARY=LIBCPP
6142      cpp_library_name="LLVM libc++"
6143     ],
6144     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6145 #include <utility>
6146 #ifndef _MSC_VER
6147 foo bar
6148 #endif
6149 ]])],
6150     [CPP_LIBRARY=MSVCRT
6151      cpp_library_name="Microsoft"
6152     ],
6153     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6154 AC_MSG_RESULT([$cpp_library_name])
6155 AC_LANG_POP([C++])
6157 dnl ===================================================================
6158 dnl C++11
6159 dnl ===================================================================
6161 CXXFLAGS_CXX11=
6162 if test "$COM" = MSC; then
6163     AC_MSG_CHECKING([whether $CXX supports C++11])
6164     AC_MSG_RESULT(yes)
6165     # MSVC supports (a subset of) CXX11 without any switch
6166 elif test "$GCC" = "yes"; then
6167     HAVE_CXX11=
6168     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
6169     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
6170         save_CXXFLAGS=$CXXFLAGS
6171         CXXFLAGS="$CXXFLAGS $flag -Werror"
6172         AC_LANG_PUSH([C++])
6173         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6174             #include <algorithm>
6175             #include <functional>
6176             #include <vector>
6177             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6178                 std::sort(v.begin(), v.end(), fn);
6179             }
6180             ]])],[CXXFLAGS_CXX11=$flag])
6181         AC_LANG_POP([C++])
6182         CXXFLAGS=$save_CXXFLAGS
6183         if test -n "$CXXFLAGS_CXX11"; then
6184             HAVE_CXX11=TRUE
6185             break
6186         fi
6187     done
6188     if test "$HAVE_CXX11" = TRUE; then
6189         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6190     else
6191         AC_MSG_ERROR(no)
6192     fi
6195 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6196 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6197 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6198 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6199 dnl again towards 4.7.2:
6200 if test $CPP_LIBRARY = GLIBCXX; then
6201     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6202     AC_LANG_PUSH([C++])
6203     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6204 #include <list>
6205 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6206     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6207     //   GCC 4.7.0: 20120322
6208     //   GCC 4.7.1: 20120614
6209     // and using a range check is not possible as the mapping between
6210     // __GLIBCXX__ values and GCC versions is not monotonic
6211 /* ok */
6212 #else
6213 abi broken
6214 #endif
6215         ]])], [AC_MSG_RESULT(no, ok)],
6216         [AC_MSG_ERROR(yes)])
6217     AC_LANG_POP([C++])
6220 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6221 save_CXXFLAGS=$CXXFLAGS
6222 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6223 AC_LANG_PUSH([C++])
6225 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6226 #include <stddef.h>
6228 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6230 namespace
6232         struct b
6233         {
6234                 int i;
6235                 int j;
6236         };
6238 ]], [[
6239 struct a
6241         int i;
6242         int j;
6244 a thinga[]={{0,0}, {1,1}};
6245 b thingb[]={{0,0}, {1,1}};
6246 size_t i = sizeof(sal_n_array_size(thinga));
6247 size_t j = sizeof(sal_n_array_size(thingb));
6248 return !(i != 0 && j != 0);
6250     ], [ AC_MSG_RESULT(yes) ],
6251     [ AC_MSG_ERROR(no)])
6252 AC_LANG_POP([C++])
6253 CXXFLAGS=$save_CXXFLAGS
6255 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6256 save_CXXFLAGS=$CXXFLAGS
6257 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6258 AC_LANG_PUSH([C++])
6260 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6261 #include <vector>
6262     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6263     // (__float128)
6265     ],[ AC_MSG_RESULT(yes) ],
6266     [
6267         AC_MSG_RESULT(no)
6268         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6269         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6270         # __float128 is available during its build, but it's usually built using GCC,
6271         # and so c++config.h hardcodes __float128 being supported). As the only place
6272         # where __float128 is actually used is in a template specialization,
6273         # -D__float128=void will avoid the problem there while still causing a problem
6274         # if somebody actually uses the type.
6275         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6276         CXXFLAGS="$CXXFLAGS -D__float128=void"
6277         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6278 #include <vector>
6279     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6280     // (__float128)
6282     ],
6283     [
6284      AC_MSG_RESULT(yes)
6285      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6286     ],
6287     [
6288      AC_MSG_ERROR(no)
6289     ])
6292 AC_LANG_POP([C++])
6293 CXXFLAGS=$save_CXXFLAGS
6295 AC_SUBST(CXXFLAGS_CXX11)
6297 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6298 save_CXXFLAGS=$CXXFLAGS
6299 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6300 AC_LANG_PUSH([C++])
6301 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6302     struct S {
6303         int n_;
6304         constexpr S(int n): n_(n) {}
6305     };
6306     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6307 AC_LANG_POP([C++])
6308 CXXFLAGS=$save_CXXFLAGS
6309 AC_MSG_RESULT([$cxx11_constexpr])
6310 if test "$cxx11_constexpr" = no; then
6311     AC_MSG_ERROR([Your $CXX does not support 'constexpr'. This is no longer supported.])
6314 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6315 save_CXXFLAGS=$CXXFLAGS
6316 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6317 AC_LANG_PUSH([C++])
6318 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6319     // A somewhat over-complicated way of checking for
6320     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6321     // in constexpr function":
6322     #include <cassert>
6323     template<typename T> inline constexpr T f(T x) { return x; }
6324     template<typename T> inline constexpr T g(T x) {
6325         assert(f(static_cast<int>(x)));
6326         return x;
6327     }
6328     enum E { e };
6329     auto v = g(E::e);
6331     struct S {
6332         int n_;
6333         constexpr bool f() {
6334             int n = n_;
6335             int i = 0;
6336             while (n > 0) { --n; ++i; }
6337             assert(i >= 0);
6338             return i == 0;
6339         }
6340     };
6341     constexpr auto v2 = S{10}.f();
6342     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6343 AC_LANG_POP([C++])
6344 CXXFLAGS=$save_CXXFLAGS
6345 AC_MSG_RESULT([$cxx14_constexpr])
6346 if test "$cxx14_constexpr" = yes; then
6347     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6350 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6351 save_CXXFLAGS=$CXXFLAGS
6352 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6353 AC_LANG_PUSH([C++])
6354 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6355     struct S {
6356         void f() &;
6357         void f() &&;
6358     };
6359     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6360 AC_LANG_POP([C++])
6361 CXXFLAGS=$save_CXXFLAGS
6362 AC_MSG_RESULT([$cxx11_ref_qualifier])
6363 if test "$cxx11_ref_qualifier" = yes; then
6364     AC_DEFINE([HAVE_CXX11_REF_QUALIFIER])
6367 AC_MSG_CHECKING([whether $CXX supports C++11 char16_t string literals])
6368 save_CXXFLAGS=$CXXFLAGS
6369 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6370 AC_LANG_PUSH([C++])
6371 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6372     auto s = u"";
6373     ]])], [cxx11_utf16_string_literal=yes], [cxx11_utf16_string_literal=no])
6374 AC_LANG_POP([C++])
6375 CXXFLAGS=$save_CXXFLAGS
6376 AC_MSG_RESULT([$cxx11_utf16_string_literal])
6377 if test "$cxx11_utf16_string_literal" = no; then
6378     AC_MSG_ERROR([Your $CXX does not support UTF-16 string literals. This is no longer supported.])
6381 dnl _Pragma support (may require C++11)
6382 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6383     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6384     AC_LANG_PUSH([C++])
6385     save_CXXFLAGS=$CXXFLAGS
6386     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6387     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6388             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6389         ])], [
6390             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6391             AC_MSG_RESULT([yes])
6392         ], [AC_MSG_RESULT([no])])
6393     AC_LANG_POP([C++])
6394     CXXFLAGS=$save_CXXFLAGS
6397 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6398 if test "$GCC" = yes; then
6399     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6400     AC_LANG_PUSH([C++])
6401     save_CXXFLAGS=$CXXFLAGS
6402     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6403     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6404     CXXFLAGS=$save_CXXFLAGS
6405     AC_LANG_POP([C++])
6406     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6407         AC_MSG_RESULT([yes])
6408     else
6409         AC_MSG_RESULT([no])
6410     fi
6412 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6414 dnl ===================================================================
6415 dnl system stl sanity tests
6416 dnl ===================================================================
6417 if test "$_os" != "WINNT"; then
6419     AC_LANG_PUSH([C++])
6421     save_CPPFLAGS="$CPPFLAGS"
6422     if test -n "$MACOSX_SDK_PATH"; then
6423         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6424     fi
6426     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6427     # only.
6428     if test "$CPP_LIBRARY" = GLIBCXX; then
6429         dnl gcc#19664, gcc#22482, rhbz#162935
6430         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6431         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6432         AC_MSG_RESULT([$stlvisok])
6433         if test "$stlvisok" = "no"; then
6434             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6435         fi
6436     fi
6438     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6439     # when we don't make any dynamic libraries?
6440     if test "$DISABLE_DYNLOADING" = ""; then
6441         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6442         cat > conftestlib1.cc <<_ACEOF
6443 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6444 struct S2: S1<int> { virtual ~S2(); };
6445 S2::~S2() {}
6446 _ACEOF
6447         cat > conftestlib2.cc <<_ACEOF
6448 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6449 struct S2: S1<int> { virtual ~S2(); };
6450 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6451 _ACEOF
6452         gccvisinlineshiddenok=yes
6453         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6454             gccvisinlineshiddenok=no
6455         else
6456             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6457             dnl known to not work with -z defs (unsetting which makes the test
6458             dnl moot, though):
6459             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6460             if test "$COM_IS_CLANG" = TRUE; then
6461                 for i in $CXX $CXXFLAGS; do
6462                     case $i in
6463                     -fsanitize=*)
6464                         my_linkflagsnoundefs=
6465                         break
6466                         ;;
6467                     esac
6468                 done
6469             fi
6470             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6471                 gccvisinlineshiddenok=no
6472             fi
6473         fi
6475         rm -fr libconftest*
6476         AC_MSG_RESULT([$gccvisinlineshiddenok])
6477         if test "$gccvisinlineshiddenok" = "no"; then
6478             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6479         fi
6480     fi
6482     AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6483     cat >visibility.cxx <<_ACEOF
6484 #pragma GCC visibility push(hidden)
6485 struct __attribute__ ((visibility ("default"))) TestStruct {
6486   static void Init();
6488 __attribute__ ((visibility ("default"))) void TestFunc() {
6489   TestStruct::Init();
6491 _ACEOF
6492     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6493         gccvisbroken=yes
6494     else
6495         case "$host_cpu" in
6496         i?86|x86_64)
6497             if test "$_os" = "Darwin"; then
6498                 gccvisbroken=no
6499             else
6500                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6501                     gccvisbroken=no
6502                 else
6503                     gccvisbroken=yes
6504                 fi
6505             fi
6506             ;;
6507         *)
6508             gccvisbroken=no
6509             ;;
6510         esac
6511     fi
6512     rm -f visibility.s visibility.cxx
6514     AC_MSG_RESULT([$gccvisbroken])
6515     if test "$gccvisbroken" = "yes"; then
6516         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6517     fi
6519     CPPFLAGS="$save_CPPFLAGS"
6521     AC_LANG_POP([C++])
6524 dnl ===================================================================
6525 dnl  Clang++ tests
6526 dnl ===================================================================
6528 HAVE_GCC_FNO_DEFAULT_INLINE=
6529 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6530 if test "$GCC" = "yes"; then
6531     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6532     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6533         # Option just ignored and silly warning that isn't a real
6534         # warning printed
6535         :
6536     else
6537         AC_LANG_PUSH([C++])
6538         save_CXXFLAGS=$CXXFLAGS
6539         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6540         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6541         CXXFLAGS=$save_CXXFLAGS
6542         AC_LANG_POP([C++])
6543     fi
6544     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6545         AC_MSG_RESULT([yes])
6546     else
6547         AC_MSG_RESULT([no])
6548     fi
6550     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6551     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6552         # As above
6553         :
6554     else
6555         AC_LANG_PUSH([C++])
6556         save_CXXFLAGS=$CXXFLAGS
6557         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6558         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6559         CXXFLAGS=$save_CXXFLAGS
6560         AC_LANG_POP([C++])
6561     fi
6562     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6563         AC_MSG_RESULT([yes])
6564     else
6565         AC_MSG_RESULT([no])
6566     fi
6568 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6569 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6571 dnl ===================================================================
6572 dnl Compiler plugins
6573 dnl ===================================================================
6575 COMPILER_PLUGINS=
6576 # currently only Clang
6578 if test "$COM_IS_CLANG" != "TRUE"; then
6579     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6580         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6581         enable_compiler_plugins=no
6582     fi
6585 if test "$COM_IS_CLANG" = "TRUE"; then
6586     if test -n "$enable_compiler_plugins"; then
6587         compiler_plugins="$enable_compiler_plugins"
6588     elif test -n "$ENABLE_DBGUTIL"; then
6589         compiler_plugins=test
6590     else
6591         compiler_plugins=no
6592     fi
6593     if test "$compiler_plugins" != "no"; then
6594         dnl The prefix where Clang resides, override to where Clang resides if
6595         dnl using a source build:
6596         if test -z "$CLANGDIR"; then
6597             CLANGDIR=/usr
6598         fi
6599         AC_LANG_PUSH([C++])
6600         save_CPPFLAGS=$CPPFLAGS
6601         save_CXX=$CXX
6602         # compiler plugins must be built with "native" bitness of clang
6603         # because they link against clang libraries
6604         CXX=${COMPILER_PLUGINS_CXX-$(echo $CXX | sed -e s/-m64// -e s/-m32//)}
6605         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6606         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6607             [COMPILER_PLUGINS=TRUE],
6608             [
6609             if test "$compiler_plugins" = "yes"; then
6610                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6611             else
6612                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6613                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6614             fi
6615             ])
6616         CXX=$save_CXX
6617         CPPFLAGS=$save_CPPFLAGS
6618         AC_LANG_POP([C++])
6619     fi
6620 else
6621     if test "$enable_compiler_plugins" = "yes"; then
6622         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6623     fi
6625 AC_SUBST(COMPILER_PLUGINS)
6626 AC_SUBST(COMPILER_PLUGINS_CXX)
6627 AC_SUBST(CLANGDIR)
6629 # Plugin to help linker.
6630 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6631 # This makes --enable-lto build with clang work.
6632 AC_SUBST(LD_PLUGIN)
6634 dnl ===================================================================
6635 dnl allocator
6636 dnl ===================================================================
6637 AC_MSG_CHECKING([which memory allocator to use])
6638 if test "$with_alloc" = "system"; then
6639     AC_MSG_RESULT([system])
6640     ALLOC="SYS_ALLOC"
6642 if test "$with_alloc" = "tcmalloc"; then
6643     AC_MSG_RESULT(tcmalloc)
6644     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6645         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6646     fi
6647     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6648         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6649     ALLOC="TCMALLOC"
6651 if test "$with_alloc" = "jemalloc"; then
6652     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6653         AC_MSG_RESULT(jemalloc)
6654         save_CFLAGS=$CFLAGS
6655         CFLAGS="$CFLAGS -pthread"
6656         AC_CHECK_LIB([jemalloc], [malloc], [:],
6657             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6658         ALLOC="JEMALLOC"
6659         CFLAGS=$save_CFLAGS
6660     else
6661         AC_MSG_RESULT([system])
6662         ALLOC="SYS_ALLOC"
6663     fi
6665 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6666     AC_MSG_RESULT([internal])
6668 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6669 AC_SUBST(HAVE_POSIX_FALLOCATE)
6670 AC_SUBST(ALLOC)
6672 dnl ===================================================================
6673 dnl Custom build version
6674 dnl ===================================================================
6676 AC_MSG_CHECKING([whether to add custom build version])
6677 if test "$with_build_version" != ""; then
6678     BUILD_VER_STRING=$with_build_version
6679     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6680 else
6681     BUILD_VER_STRING=
6682     AC_MSG_RESULT([no])
6684 AC_SUBST(BUILD_VER_STRING)
6686 JITC_PROCESSOR_TYPE=""
6687 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6688     # IBMs JDK needs this...
6689     JITC_PROCESSOR_TYPE=6
6690     export JITC_PROCESSOR_TYPE
6692 AC_SUBST([JITC_PROCESSOR_TYPE])
6694 # Misc Windows Stuff
6695 if test $_os = "WINNT"; then
6696     find_msvc_x64_dlls
6697     find_msms
6698     MSVC_DLL_PATH="$msvcdllpath"
6699     MSVC_DLLS="$msvcdlls"
6700     MSM_PATH="$msmdir"
6701     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6704 AC_SUBST(MSVC_DLL_PATH)
6705 AC_SUBST(MSVC_DLLS)
6706 AC_SUBST(MSM_PATH)
6708 dnl ===================================================================
6709 dnl Checks for Java
6710 dnl ===================================================================
6711 if test "$ENABLE_JAVA" != ""; then
6713     # Windows-specific tests
6714     if test "$build_os" = "cygwin"; then
6715         if test "$BITNESS_OVERRIDE" = 64; then
6716             bitness=64
6717         else
6718             bitness=32
6719         fi
6721         if test -z "$with_jdk_home"; then
6722             for ver in 1.8 1.7 1.6; do
6723                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6724                 if test -n "$regvalue"; then
6725                     _jdk_home=$regvalue
6726                     break
6727                 fi
6728             done
6729             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6730                 with_jdk_home="$_jdk_home"
6731                 howfound="found automatically"
6732             else
6733                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6734             fi
6735         else
6736             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6737             howfound="you passed"
6738         fi
6739     fi
6741     # 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.
6742     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6743     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6744         with_jdk_home=`/usr/libexec/java_home`
6745     fi
6747     JAVA_HOME=; export JAVA_HOME
6748     if test -z "$with_jdk_home"; then
6749         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6750     else
6751         _java_path="$with_jdk_home/bin/$with_java"
6752         dnl Check if there is a Java interpreter at all.
6753         if test -x "$_java_path"; then
6754             JAVAINTERPRETER=$_java_path
6755         else
6756             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6757         fi
6758     fi
6760     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6761     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6762     dnl loaded by java to run JunitTests:
6763     if test "$build_os" = "cygwin"; then
6764         shortjdkhome=`cygpath -d "$with_jdk_home"`
6765         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
6766             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6767             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6768         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
6769             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6770             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6771         fi
6773         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6774             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6775         fi
6776         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6777     elif test "$cross_compiling" != "yes"; then
6778         case $CPUNAME in
6779             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6780                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6781                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6782                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6783                 fi
6784                 ;;
6785             *) # assumption: everything else 32-bit
6786                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6787                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6788                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6789                 fi
6790                 ;;
6791         esac
6792     fi
6795 HAVE_JAVA9=
6796 dnl ===================================================================
6797 dnl Checks for JDK.
6798 dnl ===================================================================
6800 # Note that JAVA_HOME as for now always means the *build* platform's
6801 # JAVA_HOME. Whether all the complexity here actually is needed any
6802 # more or not, no idea.
6804 if test "$ENABLE_JAVA" != ""; then
6805     _gij_longver=0
6806     AC_MSG_CHECKING([the installed JDK])
6807     if test -n "$JAVAINTERPRETER"; then
6808         dnl java -version sends output to stderr!
6809         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6810             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6811         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6812             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6813         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6814             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6815         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6816             JDK=ibm
6818             dnl IBM JDK specific tests
6819             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6820             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6822             if test "$_jdk_ver" -lt 10600; then
6823                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6824             fi
6826             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6828             if test "$with_jdk_home" = ""; then
6829                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6830 you must use the "--with-jdk-home" configure option explicitly])
6831             fi
6833             JAVA_HOME=$with_jdk_home
6834         else
6835             JDK=sun
6837             dnl Sun JDK specific tests
6838             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6839             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6841             if test "$_jdk_ver" -lt 10600; then
6842                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6843             fi
6844             if test "$_jdk_ver" -gt 10600; then
6845                 JAVA_CLASSPATH_NOT_SET=TRUE
6846             fi
6847             if test "$_jdk_ver" -ge 10900; then
6848                 HAVE_JAVA9=TRUE
6849             fi
6851             AC_MSG_RESULT([checked (JDK $_jdk)])
6852             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6853             if test "$_os" = "WINNT"; then
6854                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6855             fi
6857             # set to limit VM usage for JunitTests
6858             JAVAIFLAGS=-Xmx64M
6859             # set to limit VM usage for javac
6860             JAVAFLAGS=-J-Xmx128M
6861         fi
6862     else
6863         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6864     fi
6865 else
6866     dnl Java disabled
6867     JAVA_HOME=
6868     export JAVA_HOME
6871 dnl ===================================================================
6872 dnl Set target Java bytecode version
6873 dnl ===================================================================
6874 if test "$ENABLE_JAVA" != ""; then
6875     if test "$HAVE_JAVA9" = "TRUE"; then
6876         _java_target_ver="1.6"
6877     else
6878         _java_target_ver="1.5"
6879     fi
6880     JAVA_SOURCE_VER="$_java_target_ver"
6881     JAVA_TARGET_VER="$_java_target_ver"
6884 dnl ===================================================================
6885 dnl Checks for javac
6886 dnl ===================================================================
6887 if test "$ENABLE_JAVA" != ""; then
6888     javacompiler="javac"
6889     if test -z "$with_jdk_home"; then
6890         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6891     else
6892         _javac_path="$with_jdk_home/bin/$javacompiler"
6893         dnl Check if there is a Java compiler at all.
6894         if test -x "$_javac_path"; then
6895             JAVACOMPILER=$_javac_path
6896         fi
6897     fi
6898     if test -z "$JAVACOMPILER"; then
6899         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6900     fi
6901     if test "$build_os" = "cygwin"; then
6902         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6903             JAVACOMPILER="${JAVACOMPILER}.exe"
6904         fi
6905         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6906     fi
6909 dnl ===================================================================
6910 dnl Checks for javadoc
6911 dnl ===================================================================
6912 if test "$ENABLE_JAVA" != ""; then
6913     if test -z "$with_jdk_home"; then
6914         AC_PATH_PROG(JAVADOC, javadoc)
6915     else
6916         _javadoc_path="$with_jdk_home/bin/javadoc"
6917         dnl Check if there is a javadoc at all.
6918         if test -x "$_javadoc_path"; then
6919             JAVADOC=$_javadoc_path
6920         else
6921             AC_PATH_PROG(JAVADOC, javadoc)
6922         fi
6923     fi
6924     if test -z "$JAVADOC"; then
6925         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6926     fi
6927     if test "$build_os" = "cygwin"; then
6928         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6929             JAVADOC="${JAVADOC}.exe"
6930         fi
6931         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6932     fi
6934     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6935     JAVADOCISGJDOC="yes"
6936     fi
6938 AC_SUBST(JAVADOCISGJDOC)
6940 if test "$ENABLE_JAVA" != ""; then
6941     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6942     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6943         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6944            # try to recover first by looking whether we have a alternatives
6945            # system as in Debian or newer SuSEs where following /usr/bin/javac
6946            # over /etc/alternatives/javac leads to the right bindir where we
6947            # just need to strip a bit away to get a valid JAVA_HOME
6948            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6949         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6950             # maybe only one level of symlink (e.g. on Mac)
6951             JAVA_HOME=$(readlink $JAVACOMPILER)
6952             if test "$(dirname $JAVA_HOME)" = "."; then
6953                 # we've got no path to trim back
6954                 JAVA_HOME=""
6955             fi
6956         else
6957             # else warn
6958             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6959             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6960             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6961             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6962         fi
6963         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6964         if test "$JAVA_HOME" != "/usr"; then
6965             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6966                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6967                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6968                 dnl Tiger already returns a JDK path..
6969                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6970             else
6971                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6972                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6973                 dnl that checks which version to run
6974                 if test -f "$JAVA_HOME"; then
6975                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6976                 fi
6977             fi
6978         fi
6979     fi
6980     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6982     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6983     if test -z "$JAVA_HOME"; then
6984         if test "x$with_jdk_home" = "x"; then
6985             cat > findhome.java <<_ACEOF
6986 [import java.io.File;
6988 class findhome
6990     public static void main(String args[])
6991     {
6992         String jrelocation = System.getProperty("java.home");
6993         File jre = new File(jrelocation);
6994         System.out.println(jre.getParent());
6995     }
6997 _ACEOF
6998             AC_MSG_CHECKING([if javac works])
6999             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7000             AC_TRY_EVAL(javac_cmd)
7001             if test $? = 0 -a -f ./findhome.class; then
7002                 AC_MSG_RESULT([javac works])
7003             else
7004                 echo "configure: javac test failed" >&5
7005                 cat findhome.java >&5
7006                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7007             fi
7008             AC_MSG_CHECKING([if gij knows its java.home])
7009             JAVA_HOME=`$JAVAINTERPRETER findhome`
7010             if test $? = 0 -a "$JAVA_HOME" != ""; then
7011                 AC_MSG_RESULT([$JAVA_HOME])
7012             else
7013                 echo "configure: java test failed" >&5
7014                 cat findhome.java >&5
7015                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7016             fi
7017             # clean-up after ourselves
7018             rm -f ./findhome.java ./findhome.class
7019         else
7020             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7021         fi
7022     fi
7024     # now check if $JAVA_HOME is really valid
7025     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7026         case "${JAVA_HOME}" in
7027             /Library/Java/JavaVirtualMachines/*)
7028                 ;;
7029             *)
7030                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7031                 ;;
7032         esac
7033         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7034             JAVA_HOME_OK="NO"
7035         fi
7036     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7037         JAVA_HOME_OK="NO"
7038     fi
7039     if test "$JAVA_HOME_OK" = "NO"; then
7040         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7041         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7042         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7043         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7044         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7045         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7046     fi
7047     PathFormat "$JAVA_HOME"
7048     JAVA_HOME="$formatted_path"
7051 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7052     "$_os" != Darwin
7053 then
7054     AC_MSG_CHECKING([for JAWT lib])
7055     if test "$_os" = WINNT; then
7056         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7057         JAWTLIB=jawt.lib
7058     else
7059         case "$host_cpu" in
7060         arm*)
7061             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7062             JAVA_ARCH=$my_java_arch
7063             ;;
7064         i*86)
7065             my_java_arch=i386
7066             ;;
7067         m68k)
7068             my_java_arch=m68k
7069             ;;
7070         powerpc)
7071             my_java_arch=ppc
7072             ;;
7073         powerpc64)
7074             my_java_arch=ppc64
7075             ;;
7076         powerpc64le)
7077             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7078             JAVA_ARCH=$my_java_arch
7079             ;;
7080         sparc64)
7081             my_java_arch=sparcv9
7082             ;;
7083         x86_64)
7084             my_java_arch=amd64
7085             ;;
7086         *)
7087             my_java_arch=$host_cpu
7088             ;;
7089         esac
7090         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7091         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7092     fi
7093     AC_MSG_RESULT([$JAWTLIB])
7095 AC_SUBST(JAWTLIB)
7097 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7098     case "$host_os" in
7100     aix*)
7101         JAVAINC="-I$JAVA_HOME/include"
7102         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7103         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7104         ;;
7106     cygwin*)
7107         JAVAINC="-I$JAVA_HOME/include/win32"
7108         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7109         ;;
7111     darwin*)
7112         if test -d "$JAVA_HOME/include/darwin"; then
7113             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7114         else
7115             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7116         fi
7117         ;;
7119     dragonfly*)
7120         JAVAINC="-I$JAVA_HOME/include"
7121         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7122         ;;
7124     freebsd*)
7125         JAVAINC="-I$JAVA_HOME/include"
7126         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7127         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7128         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7129         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7130         ;;
7132     k*bsd*-gnu*)
7133         JAVAINC="-I$JAVA_HOME/include"
7134         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7135         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7136         ;;
7138     linux-gnu*)
7139         JAVAINC="-I$JAVA_HOME/include"
7140         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7141         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7142         ;;
7144     *netbsd*)
7145         JAVAINC="-I$JAVA_HOME/include"
7146         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7147         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7148        ;;
7150     openbsd*)
7151         JAVAINC="-I$JAVA_HOME/include"
7152         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7153         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7154         ;;
7156     solaris*)
7157         JAVAINC="-I$JAVA_HOME/include"
7158         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7159         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7160         ;;
7161     esac
7163 SOLARINC="$SOLARINC $JAVAINC"
7165 AC_SUBST(JAVACOMPILER)
7166 AC_SUBST(JAVADOC)
7167 AC_SUBST(JAVAINTERPRETER)
7168 AC_SUBST(JAVAIFLAGS)
7169 AC_SUBST(JAVAFLAGS)
7170 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7171 AC_SUBST(JAVA_HOME)
7172 AC_SUBST(JAVA_SOURCE_VER)
7173 AC_SUBST(JAVA_TARGET_VER)
7174 AC_SUBST(JDK)
7177 dnl ===================================================================
7178 dnl Export file validation
7179 dnl ===================================================================
7180 AC_MSG_CHECKING([whether to enable export file validation])
7181 if test "$with_export_validation" = yes; then
7182     if test -z "$ENABLE_JAVA"; then
7183         AC_MSG_RESULT([no, as Java is disabled])
7184     else
7185         AC_MSG_RESULT([yes])
7186         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7188         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7189         if test -z "$ODFVALIDATOR"; then
7190             # remember to download the ODF toolkit with validator later
7191             AC_MSG_NOTICE([no odfvalidator found, will download it])
7192             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7193             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7195             # and fetch name of odfvalidator jar name from download.lst
7196             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7197             AC_SUBST(ODFVALIDATOR_JAR)
7199             if test -z "$ODFVALIDATOR_JAR"; then
7200                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7201             fi
7202         fi
7203         if test "$build_os" = "cygwin"; then
7204             # In case of Cygwin it will be executed from Windows,
7205             # so we need to run bash and absolute path to validator
7206             # so instead of "odfvalidator" it will be
7207             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7208             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7209         else
7210             ODFVALIDATOR="sh $ODFVALIDATOR"
7211         fi
7212         AC_SUBST(ODFVALIDATOR)
7215         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7216         if test -z "$OFFICEOTRON"; then
7217             # remember to download the officeotron with validator later
7218             AC_MSG_NOTICE([no officeotron found, will download it])
7219             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7220             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7222             # and fetch name of officeotron jar name from download.lst
7223             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7224             AC_SUBST(OFFICEOTRON_JAR)
7226             if test -z "$OFFICEOTRON_JAR"; then
7227                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7228             fi
7229         else
7230             # check version of existing officeotron
7231             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7232             if test 0"$OFFICEOTRON_VER" -lt 704; then
7233                 AC_MSG_ERROR([officeotron too old])
7234             fi
7235         fi
7236         if test "$build_os" = "cygwin"; then
7237             # In case of Cygwin it will be executed from Windows,
7238             # so we need to run bash and absolute path to validator
7239             # so instead of "odfvalidator" it will be
7240             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7241             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7242         else
7243             OFFICEOTRON="sh $OFFICEOTRON"
7244         fi
7245     fi
7246     AC_SUBST(OFFICEOTRON)
7247 else
7248     AC_MSG_RESULT([no])
7251 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7252 if test "$with_bffvalidator" != "no"; then
7253     AC_DEFINE(HAVE_BFFVALIDATOR)
7255     if test "$with_export_validation" != "yes"; then
7256         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7257     fi
7259     if test "$with_bffvalidator" = "yes"; then
7260         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7261     else
7262         BFFVALIDATOR="$with_bffvalidator"
7263     fi
7265     if test "$build_os" = "cygwin"; then
7266         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7267             AC_MSG_RESULT($BFFVALIDATOR)
7268         else
7269             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7270         fi
7271     elif test -n "$BFFVALIDATOR"; then
7272         # We are not in Cygwin but need to run Windows binary with wine
7273         AC_PATH_PROGS(WINE, wine)
7275         # so swap in a shell wrapper that converts paths transparently
7276         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7277         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7278         AC_SUBST(BFFVALIDATOR_EXE)
7279         AC_MSG_RESULT($BFFVALIDATOR)
7280     else
7281         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7282     fi
7283     AC_SUBST(BFFVALIDATOR)
7284 else
7285     AC_MSG_RESULT([no])
7288 dnl ===================================================================
7289 dnl Check for C preprocessor to use
7290 dnl ===================================================================
7291 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7292 if test -n "$with_idlc_cpp"; then
7293     AC_MSG_RESULT([$with_idlc_cpp])
7294     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7295 else
7296     AC_MSG_RESULT([ucpp])
7297     AC_MSG_CHECKING([which ucpp tp use])
7298     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7299         AC_MSG_RESULT([external])
7300         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7301     else
7302         AC_MSG_RESULT([internal])
7303         BUILD_TYPE="$BUILD_TYPE UCPP"
7304     fi
7306 AC_SUBST(SYSTEM_UCPP)
7308 dnl ===================================================================
7309 dnl Check for epm (not needed for Windows)
7310 dnl ===================================================================
7311 AC_MSG_CHECKING([whether to enable EPM for packing])
7312 if test "$enable_epm" = "yes"; then
7313     AC_MSG_RESULT([yes])
7314     if test "$_os" != "WINNT"; then
7315         if test $_os = Darwin; then
7316             EPM=internal
7317         elif test -n "$with_epm"; then
7318             EPM=$with_epm
7319         else
7320             AC_PATH_PROG(EPM, epm, no)
7321         fi
7322         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7323             AC_MSG_NOTICE([EPM will be built.])
7324             BUILD_TYPE="$BUILD_TYPE EPM"
7325             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7326         else
7327             # Gentoo has some epm which is something different...
7328             AC_MSG_CHECKING([whether the found epm is the right epm])
7329             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7330                 AC_MSG_RESULT([yes])
7331             else
7332                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7333             fi
7334             AC_MSG_CHECKING([epm version])
7335             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7336             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7337                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7338                 AC_MSG_RESULT([OK, >= 3.7])
7339             else
7340                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7341                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7342             fi
7343         fi
7344     fi
7346     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7347         AC_MSG_CHECKING([for rpm])
7348         for a in "$RPM" rpmbuild rpm; do
7349             $a --usage >/dev/null 2> /dev/null
7350             if test $? -eq 0; then
7351                 RPM=$a
7352                 break
7353             else
7354                 $a --version >/dev/null 2> /dev/null
7355                 if test $? -eq 0; then
7356                     RPM=$a
7357                     break
7358                 fi
7359             fi
7360         done
7361         if test -z "$RPM"; then
7362             AC_MSG_ERROR([not found])
7363         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7364             RPM_PATH=`which $RPM`
7365             AC_MSG_RESULT([$RPM_PATH])
7366             SCPDEFS="$SCPDEFS -DWITH_RPM"
7367         else
7368             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7369         fi
7370     fi
7371     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7372         AC_PATH_PROG(DPKG, dpkg, no)
7373         if test "$DPKG" = "no"; then
7374             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7375         fi
7376     fi
7377     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7378        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7379         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7380             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7381                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7382                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7383                     AC_MSG_RESULT([yes])
7384                 else
7385                     AC_MSG_RESULT([no])
7386                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7387                         _pt="rpm"
7388                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7389                         add_warning "the rpms will need to be installed with --nodeps"
7390                     else
7391                         _pt="pkg"
7392                     fi
7393                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7394                     add_warning "the ${_pt}s will not be relocateable"
7395                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7396                                  relocation will work, you need to patch your epm with the
7397                                  patch in epm/epm-3.7.patch or build with
7398                                  --with-epm=internal which will build a suitable epm])
7399                 fi
7400             fi
7401         fi
7402     fi
7403     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7404         AC_PATH_PROG(PKGMK, pkgmk, no)
7405         if test "$PKGMK" = "no"; then
7406             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7407         fi
7408     fi
7409     AC_SUBST(RPM)
7410     AC_SUBST(DPKG)
7411     AC_SUBST(PKGMK)
7412 else
7413     for i in $PKGFORMAT; do
7414         case "$i" in
7415         aix | bsd | deb | pkg | rpm | native | portable)
7416             AC_MSG_ERROR(
7417                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7418             ;;
7419         esac
7420     done
7421     AC_MSG_RESULT([no])
7422     EPM=NO
7424 AC_SUBST(EPM)
7426 if test $_os = iOS; then
7427     enable_mpl_subset=yes
7428     enable_lotuswordpro=no
7429     enable_coinmp=yes
7430     enable_lpsolve=no
7431     enable_postgresql_sdbc=no
7432     enable_extension_integration=no
7433     enable_report_builder=no
7434     with_theme="tango"
7435     with_ppds=no
7438 ENABLE_LWP=
7439 if test "$enable_lotuswordpro" = "yes"; then
7440     ENABLE_LWP="TRUE"
7442 AC_SUBST(ENABLE_LWP)
7444 dnl ===================================================================
7445 dnl Check for gperf
7446 dnl ===================================================================
7447 AC_PATH_PROG(GPERF, gperf)
7448 if test -z "$GPERF"; then
7449     AC_MSG_ERROR([gperf not found but needed. Install it.])
7451 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7452     GPERF=`cygpath -m $GPERF`
7454 AC_MSG_CHECKING([gperf version])
7455 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7456     AC_MSG_RESULT([OK])
7457 else
7458     AC_MSG_ERROR([too old, you need at least 3.0.0])
7460 AC_SUBST(GPERF)
7462 dnl ===================================================================
7463 dnl Check for building ODK
7464 dnl ===================================================================
7465 if test "$enable_odk" = no; then
7466     unset DOXYGEN
7467 else
7468     if test "$with_doxygen" = no; then
7469         AC_MSG_CHECKING([for doxygen])
7470         unset DOXYGEN
7471         AC_MSG_RESULT([no])
7472     else
7473         if test "$with_doxygen" = yes; then
7474             AC_PATH_PROG([DOXYGEN], [doxygen])
7475             if test -z "$DOXYGEN"; then
7476                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7477             fi
7478         else
7479             AC_MSG_CHECKING([for doxygen])
7480             DOXYGEN=$with_doxygen
7481             AC_MSG_RESULT([$DOXYGEN])
7482         fi
7483         if test -n "$DOXYGEN"; then
7484             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7485             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7486             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7487                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7488             fi
7489         fi
7490     fi
7492 AC_SUBST([DOXYGEN])
7494 AC_MSG_CHECKING([whether to build the ODK])
7495 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7496     AC_MSG_RESULT([yes])
7498     if test "$with_java" != "no"; then
7499         AC_MSG_CHECKING([whether to build unowinreg.dll])
7500         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7501             # build on Win by default
7502             enable_build_unowinreg=yes
7503         fi
7504         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7505             AC_MSG_RESULT([no])
7506             BUILD_UNOWINREG=
7507         else
7508             AC_MSG_RESULT([yes])
7509             BUILD_UNOWINREG=TRUE
7510         fi
7511         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7512             if test -z "$with_mingw_cross_compiler"; then
7513                 dnl Guess...
7514                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7515             elif test -x "$with_mingw_cross_compiler"; then
7516                  MINGWCXX="$with_mingw_cross_compiler"
7517             else
7518                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7519             fi
7521             if test "$MINGWCXX" = "false"; then
7522                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7523             fi
7525             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7526             if test -x "$mingwstrip_test"; then
7527                 MINGWSTRIP="$mingwstrip_test"
7528             else
7529                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7530             fi
7532             if test "$MINGWSTRIP" = "false"; then
7533                 AC_MSG_ERROR(MinGW32 binutils not found.)
7534             fi
7535         fi
7536     fi
7537     BUILD_TYPE="$BUILD_TYPE ODK"
7538 else
7539     AC_MSG_RESULT([no])
7540     BUILD_UNOWINREG=
7542 AC_SUBST(BUILD_UNOWINREG)
7543 AC_SUBST(MINGWCXX)
7544 AC_SUBST(MINGWSTRIP)
7546 dnl ===================================================================
7547 dnl Check for system zlib
7548 dnl ===================================================================
7549 if test "$with_system_zlib" = "auto"; then
7550     case "$_os" in
7551     WINNT)
7552         with_system_zlib="$with_system_libs"
7553         ;;
7554     *)
7555         if test "$enable_fuzzers" != "yes"; then
7556             with_system_zlib=yes
7557         else
7558             with_system_zlib=no
7559         fi
7560         ;;
7561     esac
7564 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7565 dnl and has no pkg-config for it at least on some tinderboxes,
7566 dnl so leaving that out for now
7567 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7568 AC_MSG_CHECKING([which zlib to use])
7569 if test "$with_system_zlib" = "yes"; then
7570     AC_MSG_RESULT([external])
7571     SYSTEM_ZLIB=TRUE
7572     AC_CHECK_HEADER(zlib.h, [],
7573         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7574     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7575         [AC_MSG_ERROR(zlib not found or functional)], [])
7576 else
7577     AC_MSG_RESULT([internal])
7578     SYSTEM_ZLIB=
7579     BUILD_TYPE="$BUILD_TYPE ZLIB"
7580     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7581     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7583 AC_SUBST(ZLIB_CFLAGS)
7584 AC_SUBST(ZLIB_LIBS)
7585 AC_SUBST(SYSTEM_ZLIB)
7587 dnl ===================================================================
7588 dnl Check for system jpeg
7589 dnl ===================================================================
7590 AC_MSG_CHECKING([which libjpeg to use])
7591 if test "$with_system_jpeg" = "yes"; then
7592     AC_MSG_RESULT([external])
7593     SYSTEM_JPEG=TRUE
7594     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7595         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7596     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7597         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7598 else
7599     SYSTEM_JPEG=
7600     AC_MSG_RESULT([internal, jpeg-turbo])
7601     BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7602     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg-turbo"
7603     if test "$COM" = "MSC"; then
7604         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs/libjpeg.lib"
7605     else
7606         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs -ljpeg"
7607     fi
7609     case "$host_cpu" in
7610     x86_64 | amd64 | i*86 | x86 | ia32)
7611         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7612         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7613             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7614                 NASM="$LODE_HOME/opt/bin/nasm"
7615             elif test -x "/opt/lo/bin/nasm"; then
7616                 NASM="/opt/lo/bin/nasm"
7617             fi
7618         fi
7620         if test -n "$NASM"; then
7621             AC_MSG_CHECKING([for object file format of host system])
7622             case "$host_os" in
7623               cygwin* | mingw* | pw32* | interix*)
7624                 case "$host_cpu" in
7625                   x86_64)
7626                     objfmt='Win64-COFF'
7627                     ;;
7628                   *)
7629                     objfmt='Win32-COFF'
7630                     ;;
7631                 esac
7632               ;;
7633               msdosdjgpp* | go32*)
7634                 objfmt='COFF'
7635               ;;
7636               os2-emx*)                 # not tested
7637                 objfmt='MSOMF'          # obj
7638               ;;
7639               linux*coff* | linux*oldld*)
7640                 objfmt='COFF'           # ???
7641               ;;
7642               linux*aout*)
7643                 objfmt='a.out'
7644               ;;
7645               linux*)
7646                 case "$host_cpu" in
7647                   x86_64)
7648                     objfmt='ELF64'
7649                     ;;
7650                   *)
7651                     objfmt='ELF'
7652                     ;;
7653                 esac
7654               ;;
7655               kfreebsd* | freebsd* | netbsd* | openbsd*)
7656                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7657                   objfmt='BSD-a.out'
7658                 else
7659                   case "$host_cpu" in
7660                     x86_64 | amd64)
7661                       objfmt='ELF64'
7662                       ;;
7663                     *)
7664                       objfmt='ELF'
7665                       ;;
7666                   esac
7667                 fi
7668               ;;
7669               solaris* | sunos* | sysv* | sco*)
7670                 case "$host_cpu" in
7671                   x86_64)
7672                     objfmt='ELF64'
7673                     ;;
7674                   *)
7675                     objfmt='ELF'
7676                     ;;
7677                 esac
7678               ;;
7679               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7680                 case "$host_cpu" in
7681                   x86_64)
7682                     objfmt='Mach-O64'
7683                     ;;
7684                   *)
7685                     objfmt='Mach-O'
7686                     ;;
7687                 esac
7688               ;;
7689               *)
7690                 objfmt='ELF ?'
7691               ;;
7692             esac
7694             AC_MSG_RESULT([$objfmt])
7695             if test "$objfmt" = 'ELF ?'; then
7696               objfmt='ELF'
7697               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7698             fi
7700             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7701             case "$objfmt" in
7702               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7703               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7704               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7705               COFF)       NAFLAGS='-fcoff -DCOFF';;
7706               a.out)      NAFLAGS='-faout -DAOUT';;
7707               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7708               ELF)        NAFLAGS='-felf -DELF';;
7709               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7710               RDF)        NAFLAGS='-frdf -DRDF';;
7711               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7712               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7713             esac
7714             AC_MSG_RESULT([$NAFLAGS])
7716             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7717             cat > conftest.asm << EOF
7718             [%line __oline__ "configure"
7719                     section .text
7720                     global  _main,main
7721             _main:
7722             main:   xor     eax,eax
7723                     ret
7724             ]
7726             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7727             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7728               AC_MSG_RESULT(yes)
7729             else
7730               echo "configure: failed program was:" >&AC_FD_CC
7731               cat conftest.asm >&AC_FD_CC
7732               rm -rf conftest*
7733               AC_MSG_RESULT(no)
7734               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7735               NASM=""
7736             fi
7738         fi
7740         if test -z "$NASM"; then
7741 cat << _EOS
7742 ****************************************************************************
7743 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7744 To get one please:
7746 _EOS
7747             if test "$build_os" = "cygwin"; then
7748 cat << _EOS
7749 install a pre-compiled binary for Win32
7751 mkdir -p /opt/lo/bin
7752 cd /opt/lo/bin
7753 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7754 chmod +x nasm
7756 or get and install one from http://www.nasm.us/
7758 Then re-run autogen.sh
7760 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7761 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7763 _EOS
7764             else
7765 cat << _EOS
7766 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7768 _EOS
7769             fi
7770             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7771             add_warning "no suitable nasm (Netwide Assembler) found for internal jpeg-turbo"
7772         fi
7773       ;;
7774     esac
7777 AC_SUBST(NASM)
7778 AC_SUBST(LIBJPEG_CFLAGS)
7779 AC_SUBST(LIBJPEG_LIBS)
7780 AC_SUBST(SYSTEM_JPEG)
7782 dnl ===================================================================
7783 dnl Check for system clucene
7784 dnl ===================================================================
7785 dnl we should rather be using
7786 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7787 dnl but the contribs-lib check seems tricky
7788 AC_MSG_CHECKING([which clucene to use])
7789 if test "$with_system_clucene" = "yes"; then
7790     AC_MSG_RESULT([external])
7791     SYSTEM_CLUCENE=TRUE
7792     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7793     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7794     FilterLibs "${CLUCENE_LIBS}"
7795     CLUCENE_LIBS="${filteredlibs}"
7796     AC_LANG_PUSH([C++])
7797     save_CXXFLAGS=$CXXFLAGS
7798     save_CPPFLAGS=$CPPFLAGS
7799     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7800     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7801     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7802     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7803     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7804                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7805     CXXFLAGS=$save_CXXFLAGS
7806     CPPFLAGS=$save_CPPFLAGS
7807     AC_LANG_POP([C++])
7809     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7810 else
7811     AC_MSG_RESULT([internal])
7812     SYSTEM_CLUCENE=
7813     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7815 AC_SUBST(SYSTEM_CLUCENE)
7816 AC_SUBST(CLUCENE_CFLAGS)
7817 AC_SUBST(CLUCENE_LIBS)
7819 dnl ===================================================================
7820 dnl Check for system expat
7821 dnl ===================================================================
7822 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7824 dnl ===================================================================
7825 dnl Check for system xmlsec
7826 dnl ===================================================================
7827 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7829 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7830 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7831     ENABLE_EOT="TRUE"
7832     AC_DEFINE([ENABLE_EOT])
7833     AC_MSG_RESULT([yes])
7835     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7836 else
7837     ENABLE_EOT=
7838     AC_MSG_RESULT([no])
7840 AC_SUBST([ENABLE_EOT])
7842 dnl ===================================================================
7843 dnl Check for DLP libs
7844 dnl ===================================================================
7845 AS_IF([test "$COM" = "MSC"],
7846       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7847       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7849 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7851 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7853 AS_IF([test "$COM" = "MSC"],
7854       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7855       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7857 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7859 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7861 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7862 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.6])
7864 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7866 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7868 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7870 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7871 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.11])
7873 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7874 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
7876 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7878 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7879 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7881 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7883 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7885 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7887 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7888 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.3])
7890 dnl ===================================================================
7891 dnl Check for system libcmis
7892 dnl ===================================================================
7893 # libcmis requires curl and we can't build curl for iOS
7894 if test $_os != iOS; then
7895     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7896     ENABLE_CMIS=TRUE
7897 else
7898     ENABLE_CMIS=
7900 AC_SUBST(ENABLE_CMIS)
7902 dnl ===================================================================
7903 dnl Check for system lcms2
7904 dnl ===================================================================
7905 if test "$with_system_lcms2" != "yes"; then
7906     SYSTEM_LCMS2=
7908 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7909 if test "$GCC" = "yes"; then
7910     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7912 if test "$COM" = "MSC"; then # override the above
7913     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7916 dnl ===================================================================
7917 dnl Check for system cppunit
7918 dnl ===================================================================
7919 if test "$cross_compiling" != "yes"; then
7920     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7923 dnl ===================================================================
7924 dnl Check whether freetype is available
7925 dnl ===================================================================
7926 if test  "$test_freetype" = "yes"; then
7927     AC_MSG_CHECKING([whether freetype is available])
7928     # FreeType has 3 different kinds of versions
7929     # * release, like 2.4.10
7930     # * libtool, like 13.0.7 (this what pkg-config returns)
7931     # * soname
7932     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7933     #
7934     # 9.9.3 is 2.2.0
7935     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7936     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7937     FilterLibs "${FREETYPE_LIBS}"
7938     FREETYPE_LIBS="${filteredlibs}"
7939     SYSTEM_FREETYPE=TRUE
7940 else
7941     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7942     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7944 AC_SUBST(FREETYPE_CFLAGS)
7945 AC_SUBST(FREETYPE_LIBS)
7946 AC_SUBST([SYSTEM_FREETYPE])
7948 # ===================================================================
7949 # Check for system libxslt
7950 # to prevent incompatibilities between internal libxml2 and external libxslt,
7951 # or vice versa, use with_system_libxml here
7952 # ===================================================================
7953 if test "$with_system_libxml" = "auto"; then
7954     case "$_os" in
7955     WINNT|iOS|Android)
7956         with_system_libxml="$with_system_libs"
7957         ;;
7958     *)
7959         if test "$enable_fuzzers" != "yes"; then
7960             with_system_libxml=yes
7961         else
7962             with_system_libxml=no
7963         fi
7964         ;;
7965     esac
7968 AC_MSG_CHECKING([which libxslt to use])
7969 if test "$with_system_libxml" = "yes"; then
7970     AC_MSG_RESULT([external])
7971     SYSTEM_LIBXSLT=TRUE
7972     if test "$_os" = "Darwin"; then
7973         dnl make sure to use SDK path
7974         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7975         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7976         dnl omit -L/usr/lib
7977         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7978         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7979     else
7980         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7981         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7982         FilterLibs "${LIBXSLT_LIBS}"
7983         LIBXSLT_LIBS="${filteredlibs}"
7984         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7985         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7986         FilterLibs "${LIBEXSLT_LIBS}"
7987         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7988     fi
7990     dnl Check for xsltproc
7991     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7992     if test "$XSLTPROC" = "no"; then
7993         AC_MSG_ERROR([xsltproc is required])
7994     fi
7995 else
7996     AC_MSG_RESULT([internal])
7997     SYSTEM_LIBXSLT=
7998     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8000     if test "$cross_compiling" = "yes"; then
8001         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8002         if test "$XSLTPROC" = "no"; then
8003             AC_MSG_ERROR([xsltproc is required])
8004         fi
8005     fi
8007 AC_SUBST(SYSTEM_LIBXSLT)
8008 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8009     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8011 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8013 AC_SUBST(LIBEXSLT_CFLAGS)
8014 AC_SUBST(LIBEXSLT_LIBS)
8015 AC_SUBST(LIBXSLT_CFLAGS)
8016 AC_SUBST(LIBXSLT_LIBS)
8017 AC_SUBST(XSLTPROC)
8019 # ===================================================================
8020 # Check for system libxml
8021 # ===================================================================
8022 AC_MSG_CHECKING([which libxml to use])
8023 if test "$with_system_libxml" = "yes"; then
8024     AC_MSG_RESULT([external])
8025     SYSTEM_LIBXML=TRUE
8026     if test "$_os" = "Darwin"; then
8027         dnl make sure to use SDK path
8028         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8029         dnl omit -L/usr/lib
8030         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8031     elif test $_os = iOS; then
8032         dnl make sure to use SDK path
8033         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8034         LIBXML_CFLAGS="-I$usr/include/libxml2"
8035         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8036     else
8037         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8038         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8039         FilterLibs "${LIBXML_LIBS}"
8040         LIBXML_LIBS="${filteredlibs}"
8041     fi
8043     dnl Check for xmllint
8044     AC_PATH_PROG(XMLLINT, xmllint, no)
8045     if test "$XMLLINT" = "no"; then
8046         AC_MSG_ERROR([xmllint is required])
8047     fi
8048 else
8049     AC_MSG_RESULT([internal])
8050     SYSTEM_LIBXML=
8051     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
8052     if test "$COM" = "MSC"; then
8053         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8054     fi
8055     if test "$COM" = "MSC"; then
8056         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
8057     else
8058         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
8059     fi
8060     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8062 AC_SUBST(SYSTEM_LIBXML)
8063 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8064     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8066 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8067 AC_SUBST(LIBXML_CFLAGS)
8068 AC_SUBST(LIBXML_LIBS)
8069 AC_SUBST(XMLLINT)
8071 # =====================================================================
8072 # Checking for a Python interpreter with version >= 2.6.
8073 # Build and runtime requires Python 3 compatible version (>= 2.6).
8074 # Optionally user can pass an option to configure, i. e.
8075 # ./configure PYTHON=/usr/bin/python
8076 # =====================================================================
8077 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8078     # This allows a lack of system python with no error, we use internal one in that case.
8079     AM_PATH_PYTHON([2.6],, [:])
8080     # Clean PYTHON_VERSION checked below if cross-compiling
8081     PYTHON_VERSION=""
8082     if test "$PYTHON" != ":"; then
8083         PYTHON_FOR_BUILD=$PYTHON
8084     fi
8086 AC_SUBST(PYTHON_FOR_BUILD)
8088 # Checks for Python to use for Pyuno
8089 AC_MSG_CHECKING([which Python to use for Pyuno])
8090 case "$enable_python" in
8091 no|disable)
8092     if test -z $PYTHON_FOR_BUILD; then
8093         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8094         # requirement from the choice whether to include Python stuff in the installer, but why
8095         # bother?
8096         AC_MSG_ERROR([Python is required at build time.])
8097     fi
8098     enable_python=no
8099     AC_MSG_RESULT([none])
8100     ;;
8101 ""|yes|auto)
8102     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8103         AC_MSG_RESULT([no, overridden by --disable-scripting])
8104         enable_python=no
8105     elif test $build_os = cygwin; then
8106         dnl When building on Windows we don't attempt to use any installed
8107         dnl "system"  Python.
8108         AC_MSG_RESULT([fully internal])
8109         enable_python=internal
8110     elif test "$cross_compiling" = yes; then
8111         AC_MSG_RESULT([system])
8112         enable_python=system
8113     else
8114         # Unset variables set by the above AM_PATH_PYTHON so that
8115         # we actually do check anew.
8116         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
8117         AM_PATH_PYTHON([3.3],, [:])
8118         if test "$PYTHON" = ":"; then
8119             if test -z "$PYTHON_FOR_BUILD"; then
8120                 AC_MSG_RESULT([fully internal])
8121             else
8122                 AC_MSG_RESULT([internal])
8123             fi
8124             enable_python=internal
8125         else
8126             AC_MSG_RESULT([system])
8127             enable_python=system
8128         fi
8129     fi
8130     ;;
8131 internal)
8132     AC_MSG_RESULT([internal])
8133     ;;
8134 fully-internal)
8135     AC_MSG_RESULT([fully internal])
8136     enable_python=internal
8137     ;;
8138 system)
8139     AC_MSG_RESULT([system])
8140     ;;
8142     AC_MSG_ERROR([Incorrect --enable-python option])
8143     ;;
8144 esac
8146 if test $enable_python != no; then
8147     BUILD_TYPE="$BUILD_TYPE PYUNO"
8150 if test $enable_python = system; then
8151     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8152         python_version=2.7
8153         PYTHON=python$python_version
8154         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8155             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8156             PYTHON_LIBS="-framework Python"
8157         else
8158             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8159             PYTHON_LIBS="`$PYTHON-config --libs`"
8160         fi
8161     fi
8162     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8163         # Fallback: Accept these in the environment, or as set above
8164         # for MacOSX.
8165         :
8166     elif test "$cross_compiling" != yes; then
8167         # Unset variables set by the above AM_PATH_PYTHON so that
8168         # we actually do check anew.
8169         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
8170         # This causes an error if no python command is found
8171         AM_PATH_PYTHON([3.3])
8172         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8173         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8174         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8175         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8176         if test -z "$PKG_CONFIG"; then
8177             PYTHON_CFLAGS="-I$python_include"
8178             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8179         elif $PKG_CONFIG --exists python-$python_version; then
8180             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8181             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8182         else
8183             PYTHON_CFLAGS="-I$python_include"
8184             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8185         fi
8186         FilterLibs "${PYTHON_LIBS}"
8187         PYTHON_LIBS="${filteredlibs}"
8188     else
8189         dnl How to find out the cross-compilation Python installation path?
8190         AC_MSG_CHECKING([for python version])
8191         AS_IF([test -n "$PYTHON_VERSION"],
8192               [AC_MSG_RESULT([$PYTHON_VERSION])],
8193               [AC_MSG_RESULT([not found])
8194                AC_MSG_ERROR([no usable python found])])
8195         test -n "$PYTHON_CFLAGS" && break
8196     fi
8197     # let the PYTHON_FOR_BUILD match the same python installation that
8198     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8199     # better for PythonTests.
8200     PYTHON_FOR_BUILD=$PYTHON
8203 dnl By now enable_python should be "system", "internal" or "no"
8204 case $enable_python in
8205 system)
8206     SYSTEM_PYTHON=TRUE
8208     dnl Check if the headers really work
8209     save_CPPFLAGS="$CPPFLAGS"
8210     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8211     AC_CHECK_HEADER(Python.h, [],
8212        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8213        [])
8214     CPPFLAGS="$save_CPPFLAGS"
8216     AC_LANG_PUSH(C)
8217     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8218     AC_MSG_CHECKING([for correct python library version])
8219        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8220 #include <Python.h>
8222 int main(int argc, char **argv) {
8223    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8224        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8225    else return 1;
8227        ]])],[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])])
8228     CFLAGS=$save_CFLAGS
8229     AC_LANG_POP(C)
8231     dnl FIXME Check if the Python library can be linked with, too?
8232     ;;
8234 internal)
8235     SYSTEM_PYTHON=
8236     PYTHON_VERSION_MAJOR=3
8237     PYTHON_VERSION_MINOR=5
8238     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
8239     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8240     BUILD_TYPE="$BUILD_TYPE PYTHON"
8241     # Embedded Python dies without Home set
8242     if test "$HOME" = ""; then
8243         export HOME=""
8244     fi
8245     # bz2 tarball and bzip2 is not standard
8246     if test -z "$BZIP2"; then
8247         AC_PATH_PROG( BZIP2, bzip2)
8248         if test -z "$BZIP2"; then
8249             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8250         fi
8251     fi
8252     ;;
8254     DISABLE_PYTHON=TRUE
8255     SYSTEM_PYTHON=
8256     ;;
8258     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8259     ;;
8260 esac
8262 AC_SUBST(DISABLE_PYTHON)
8263 AC_SUBST(SYSTEM_PYTHON)
8264 AC_SUBST(PYTHON_CFLAGS)
8265 AC_SUBST(PYTHON_LIBS)
8266 AC_SUBST(PYTHON_VERSION)
8267 AC_SUBST(PYTHON_VERSION_MAJOR)
8268 AC_SUBST(PYTHON_VERSION_MINOR)
8270 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8271 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8272     AC_MSG_RESULT([yes])
8273     ENABLE_MARIADBC=TRUE
8274     MARIADBC_MAJOR=1
8275     MARIADBC_MINOR=0
8276     MARIADBC_MICRO=2
8277     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8278 else
8279     AC_MSG_RESULT([no])
8280     ENABLE_MARIADBC=
8282 AC_SUBST(ENABLE_MARIADBC)
8283 AC_SUBST(MARIADBC_MAJOR)
8284 AC_SUBST(MARIADBC_MINOR)
8285 AC_SUBST(MARIADBC_MICRO)
8287 if test "$ENABLE_MARIADBC" = "TRUE"; then
8289     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8291     dnl ===================================================================
8292     dnl Check for system MariaDB
8293     dnl ===================================================================
8294     AC_MSG_CHECKING([which MariaDB to use])
8295     if test "$with_system_mariadb" = "yes"; then
8296         AC_MSG_RESULT([external])
8297         SYSTEM_MARIADB=TRUE
8298         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8299         if test -z "$MARIADBCONFIG"; then
8300             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8301             if test -z "$MARIADBCONFIG"; then
8302                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8303                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8304             fi
8305         fi
8306         AC_MSG_CHECKING([MariaDB version])
8307         MARIADB_VERSION=`$MARIADBCONFIG --version`
8308         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8309         if test "$MARIADB_MAJOR" -ge "5"; then
8310             AC_MSG_RESULT([OK])
8311         else
8312             AC_MSG_ERROR([too old, use 5.0.x or later])
8313         fi
8314         AC_MSG_CHECKING([for MariaDB Client library])
8315         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8316         if test "$COM_IS_CLANG" = TRUE; then
8317             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8318         fi
8319         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8320         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8321         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8322         dnl linux32:
8323         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8324             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8325             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8326                 | sed -e 's|/lib64/|/lib/|')
8327         fi
8328         FilterLibs "${MARIADB_LIBS}"
8329         MARIADB_LIBS="${filteredlibs}"
8330         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8331         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8332         if test "$enable_bundle_mariadb" = "yes"; then
8333             AC_MSG_RESULT([yes])
8334             BUNDLE_MARIADB=TRUE
8335             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8337 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8339 /g' | grep -E '(mysqlclient|mariadb)')
8340             if test "$_os" = "Darwin"; then
8341                 LIBMARIADB=${LIBMARIADB}.dylib
8342             elif test "$_os" = "WINNT"; then
8343                 LIBMARIADB=${LIBMARIADB}.dll
8344             else
8345                 LIBMARIADB=${LIBMARIADB}.so
8346             fi
8347             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8348             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8349             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8350                 AC_MSG_RESULT([found.])
8351                 PathFormat "$LIBMARIADB_PATH"
8352                 LIBMARIADB_PATH="$formatted_path"
8353             else
8354                 AC_MSG_ERROR([not found.])
8355             fi
8356         else
8357             AC_MSG_RESULT([no])
8358             BUNDLE_MARIADB=
8359         fi
8360     else
8361         AC_MSG_RESULT([internal])
8362         SYSTEM_MARIADB=
8363         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8364         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8365         BUILD_TYPE="$BUILD_TYPE MARIADB"
8366     fi
8368     AC_SUBST(SYSTEM_MARIADB)
8369     AC_SUBST(MARIADB_CFLAGS)
8370     AC_SUBST(MARIADB_LIBS)
8371     AC_SUBST(LIBMARIADB)
8372     AC_SUBST(LIBMARIADB_PATH)
8373     AC_SUBST(BUNDLE_MARIADB)
8375     AC_LANG_PUSH([C++])
8376     dnl ===================================================================
8377     dnl Check for system MySQL C++ Connector
8378     dnl ===================================================================
8379     # FIXME!
8380     # who thought this too-generic cppconn dir was a good idea?
8381     AC_MSG_CHECKING([MySQL Connector/C++])
8382     if test "$with_system_mysql_cppconn" = "yes"; then
8383         AC_MSG_RESULT([external])
8384         SYSTEM_MYSQL_CPPCONN=TRUE
8385         AC_LANG_PUSH([C++])
8386         AC_CHECK_HEADER(mysql_driver.h, [],
8387                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8388         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8389                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8390         save_LIBS=$LIBS
8391         LIBS="$LIBS -lmysqlcppconn"
8392         AC_MSG_CHECKING([version])
8393         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8394 #include <mysql_driver.h>
8396 int main(int argc, char **argv) {
8397     sql::Driver *driver;
8398     driver = get_driver_instance();
8399     if (driver->getMajorVersion() > 1 || \
8400        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8401        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8402         return 0;
8403       else
8404         return 1;
8406       ]])],[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])])
8408         AC_LANG_POP([C++])
8409         LIBS=$save_LIBS
8410     else
8411         AC_MSG_RESULT([internal])
8412         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8413         SYSTEM_MYSQL_CPPCONN=
8414     fi
8415     AC_LANG_POP([C++])
8417 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8419 dnl ===================================================================
8420 dnl Check for system hsqldb
8421 dnl ===================================================================
8422 if test "$with_java" != "no"; then
8423     HSQLDB_USE_JDBC_4_1=
8424     AC_MSG_CHECKING([which hsqldb to use])
8425     if test "$with_system_hsqldb" = "yes"; then
8426         AC_MSG_RESULT([external])
8427         SYSTEM_HSQLDB=TRUE
8428         if test -z $HSQLDB_JAR; then
8429             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8430         fi
8431         if ! test -f $HSQLDB_JAR; then
8432                AC_MSG_ERROR(hsqldb.jar not found.)
8433         fi
8434         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8435         export HSQLDB_JAR
8436         if $PERL -e \
8437            'use Archive::Zip;
8438             my $file = "$ENV{'HSQLDB_JAR'}";
8439             my $zip = Archive::Zip->new( $file );
8440             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8441             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8442             {
8443                 push @l, split(/\n/, $mf);
8444                 foreach my $line (@l)
8445                 {
8446                     if ($line =~ m/Specification-Version:/)
8447                     {
8448                         ($t, $version) = split (/:/,$line);
8449                         $version =~ s/^\s//;
8450                         ($a, $b, $c, $d) = split (/\./,$version);
8451                         if ($c == "0" && $d > "8")
8452                         {
8453                             exit 0;
8454                         }
8455                         else
8456                         {
8457                             exit 1;
8458                         }
8459                     }
8460                 }
8461             }
8462             else
8463             {
8464                 exit 1;
8465             }'; then
8466             AC_MSG_RESULT([yes])
8467         else
8468             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8469         fi
8470     else
8471         AC_MSG_RESULT([internal])
8472         SYSTEM_HSQLDB=
8473         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8474         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8475         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8476         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8477             AC_MSG_RESULT([yes])
8478             HSQLDB_USE_JDBC_4_1=TRUE
8479         else
8480             AC_MSG_RESULT([no])
8481         fi
8482     fi
8483     AC_SUBST(SYSTEM_HSQLDB)
8484     AC_SUBST(HSQLDB_JAR)
8485     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8488 dnl ===================================================================
8489 dnl Check for PostgreSQL stuff
8490 dnl ===================================================================
8491 if test "x$enable_postgresql_sdbc" != "xno"; then
8492     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8494     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8495         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8496     fi
8497     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8498         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8499     fi
8501     postgres_interface=""
8502     if test "$with_system_postgresql" = "yes"; then
8503         postgres_interface="external PostgreSQL"
8504         SYSTEM_POSTGRESQL=TRUE
8505         if test "$_os" = Darwin; then
8506             supp_path=''
8507             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8508                 pg_supp_path="$P_SEP$d$pg_supp_path"
8509             done
8510         fi
8511         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8512         if test -z "$PGCONFIG"; then
8513             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8514         fi
8515         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8516         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8517         FilterLibs "${POSTGRESQL_LIB}"
8518         POSTGRESQL_LIB="${filteredlibs}"
8519     else
8520         # if/when anything else than PostgreSQL uses Kerberos,
8521         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8522         WITH_KRB5=
8523         WITH_GSSAPI=
8524         case "$_os" in
8525         Darwin)
8526             # MacOS X has system MIT Kerberos 5 since 10.4
8527             if test "$with_krb5" != "no"; then
8528                 WITH_KRB5=TRUE
8529                 save_LIBS=$LIBS
8530                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8531                 # that the libraries where these functions are located on macOS will change, is it?
8532                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8533                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8534                 KRB5_LIBS=$LIBS
8535                 LIBS=$save_LIBS
8536                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8537                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8538                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8539                 LIBS=$save_LIBS
8540             fi
8541             if test "$with_gssapi" != "no"; then
8542                 WITH_GSSAPI=TRUE
8543                 save_LIBS=$LIBS
8544                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8545                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8546                 GSSAPI_LIBS=$LIBS
8547                 LIBS=$save_LIBS
8548             fi
8549             ;;
8550         WINNT)
8551             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8552                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8553             fi
8554             ;;
8555         Linux|GNU|*BSD|DragonFly)
8556             if test "$with_krb5" != "no"; then
8557                 WITH_KRB5=TRUE
8558                 save_LIBS=$LIBS
8559                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8560                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8561                 KRB5_LIBS=$LIBS
8562                 LIBS=$save_LIBS
8563                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8564                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8565                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8566                 LIBS=$save_LIBS
8567             fi
8568             if test "$with_gssapi" != "no"; then
8569                 WITH_GSSAPI=TRUE
8570                 save_LIBS=$LIBS
8571                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8572                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8573                 GSSAPI_LIBS=$LIBS
8574                 LIBS=$save_LIBS
8575             fi
8576             ;;
8577         *)
8578             if test "$with_krb5" = "yes"; then
8579                 WITH_KRB5=TRUE
8580                 save_LIBS=$LIBS
8581                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8582                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8583                 KRB5_LIBS=$LIBS
8584                 LIBS=$save_LIBS
8585                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8586                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8587                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8588                 LIBS=$save_LIBS
8589             fi
8590             if test "$with_gssapi" = "yes"; then
8591                 WITH_GSSAPI=TRUE
8592                 save_LIBS=$LIBS
8593                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8594                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8595                 LIBS=$save_LIBS
8596                 GSSAPI_LIBS=$LIBS
8597             fi
8598         esac
8600         if test -n "$with_libpq_path"; then
8601             SYSTEM_POSTGRESQL=TRUE
8602             postgres_interface="external libpq"
8603             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8604             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8605         else
8606             SYSTEM_POSTGRESQL=
8607             postgres_interface="internal"
8608             POSTGRESQL_LIB=""
8609             POSTGRESQL_INC="%OVERRIDE_ME%"
8610             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8611         fi
8612     fi
8614     AC_MSG_CHECKING([PostgreSQL C interface])
8615     AC_MSG_RESULT([$postgres_interface])
8617     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8618         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8619         save_CFLAGS=$CFLAGS
8620         save_CPPFLAGS=$CPPFLAGS
8621         save_LIBS=$LIBS
8622         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8623         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8624         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8625         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8626             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8627         CFLAGS=$save_CFLAGS
8628         CPPFLAGS=$save_CPPFLAGS
8629         LIBS=$save_LIBS
8630     fi
8631     BUILD_POSTGRESQL_SDBC=TRUE
8633 AC_SUBST(WITH_KRB5)
8634 AC_SUBST(WITH_GSSAPI)
8635 AC_SUBST(GSSAPI_LIBS)
8636 AC_SUBST(KRB5_LIBS)
8637 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8638 AC_SUBST(SYSTEM_POSTGRESQL)
8639 AC_SUBST(POSTGRESQL_INC)
8640 AC_SUBST(POSTGRESQL_LIB)
8642 dnl ===================================================================
8643 dnl Check for Firebird stuff
8644 dnl ===================================================================
8645 ENABLE_FIREBIRD_SDBC=""
8646 if test "$enable_firebird_sdbc" = "yes" ; then
8647     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8649     dnl ===================================================================
8650     dnl Check for system Firebird
8651     dnl ===================================================================
8652     AC_MSG_CHECKING([which Firebird to use])
8653     if test "$with_system_firebird" = "yes"; then
8654         AC_MSG_RESULT([external])
8655         SYSTEM_FIREBIRD=TRUE
8656         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8657         if test -z "$FIREBIRDCONFIG"; then
8658             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8659             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8660                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8661             ])
8662             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8663         else
8664             AC_MSG_NOTICE([fb_config found])
8665             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8666             AC_MSG_CHECKING([for Firebird Client library])
8667             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8668             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8669             FilterLibs "${FIREBIRD_LIBS}"
8670             FIREBIRD_LIBS="${filteredlibs}"
8671         fi
8672         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8673         AC_MSG_CHECKING([Firebird version])
8674         if test -n "${FIREBIRD_VERSION}"; then
8675             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8676             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8677             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8678                 AC_MSG_RESULT([OK])
8679             else
8680                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8681             fi
8682         else
8683             __save_CFLAGS="${CFLAGS}"
8684             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8685             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8686 #if defined(FB_API_VER) && FB_API_VER == 30
8687 int fb_api_is_30(void) { return 0; }
8688 #else
8689 #error "Wrong Firebird API version"
8690 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8691             CFLAGS="${__save_CFLAGS}"
8692         fi
8693         ENABLE_FIREBIRD_SDBC="TRUE"
8694     elif test "$enable_database_connectivity" != yes; then
8695         AC_MSG_RESULT([none])
8696     elif test "$cross_compiling" = "yes"; then
8697         AC_MSG_RESULT([none])
8698     else
8699         dnl Embedded Firebird has version 3.0
8700         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8701         dnl We need libatomic-ops for any non X86/X64 system
8702         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8703             dnl ===================================================================
8704             dnl Check for system libatomic-ops
8705             dnl ===================================================================
8706             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8707             if test "$with_system_libatomic_ops" = "yes"; then
8708                 SYSTEM_LIBATOMIC_OPS=TRUE
8709                 AC_CHECK_HEADERS(atomic_ops.h, [],
8710                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8711             else
8712                 SYSTEM_LIBATOMIC_OPS=
8713                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8714                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8715                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8716             fi
8717         fi
8719         AC_MSG_RESULT([internal])
8720         SYSTEM_FIREBIRD=
8721         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8722         FIREBIRD_LIBS="-lfbclient"
8724         if test "$with_system_libtommath" = "yes"; then
8725             SYSTEM_LIBTOMMATH=TRUE
8726             dnl check for tommath presence
8727             save_LIBS=$LIBS
8728             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8729             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8730             LIBS=$save_LIBS
8731         else
8732             SYSTEM_LIBTOMMATH=
8733             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8734             LIBTOMMATH_LIBS="-ltommath"
8735             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8736         fi
8738         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8739         ENABLE_FIREBIRD_SDBC="TRUE"
8740     fi
8742 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8743 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8744 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8745 AC_SUBST(LIBATOMIC_OPS_LIBS)
8746 AC_SUBST(SYSTEM_FIREBIRD)
8747 AC_SUBST(FIREBIRD_CFLAGS)
8748 AC_SUBST(FIREBIRD_LIBS)
8749 AC_SUBST([TOMMATH_CFLAGS])
8750 AC_SUBST([TOMMATH_LIBS])
8752 dnl ===================================================================
8753 dnl Check for system curl
8754 dnl ===================================================================
8755 AC_MSG_CHECKING([which libcurl to use])
8756 if test "$with_system_curl" = "auto"; then
8757     with_system_curl="$with_system_libs"
8760 if test "$with_system_curl" = "yes"; then
8761     AC_MSG_RESULT([external])
8762     SYSTEM_CURL=TRUE
8764     # First try PKGCONFIG and then fall back
8765     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8767     if test -n "$CURL_PKG_ERRORS"; then
8768         AC_PATH_PROG(CURLCONFIG, curl-config)
8769         if test -z "$CURLCONFIG"; then
8770             AC_MSG_ERROR([curl development files not found])
8771         fi
8772         CURL_LIBS=`$CURLCONFIG --libs`
8773         FilterLibs "${CURL_LIBS}"
8774         CURL_LIBS="${filteredlibs}"
8775         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8776         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8778         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8779         case $curl_version in
8780         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8781         dnl so they need to be doubled to end up in the configure script
8782         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8783             AC_MSG_RESULT([yes])
8784             ;;
8785         *)
8786             AC_MSG_ERROR([no, you have $curl_version])
8787             ;;
8788         esac
8789     fi
8791     ENABLE_CURL=TRUE
8792 elif test $_os = iOS; then
8793     # Let's see if we need curl, I think not?
8794     AC_MSG_RESULT([none])
8795     ENABLE_CURL=
8796 else
8797     AC_MSG_RESULT([internal])
8798     SYSTEM_CURL=
8799     BUILD_TYPE="$BUILD_TYPE CURL"
8800     ENABLE_CURL=TRUE
8802 AC_SUBST(SYSTEM_CURL)
8803 AC_SUBST(CURL_CFLAGS)
8804 AC_SUBST(CURL_LIBS)
8805 AC_SUBST(ENABLE_CURL)
8807 dnl ===================================================================
8808 dnl Check for system boost
8809 dnl ===================================================================
8810 AC_MSG_CHECKING([which boost to use])
8811 if test "$with_system_boost" = "yes"; then
8812     AC_MSG_RESULT([external])
8813     SYSTEM_BOOST=TRUE
8814     AX_BOOST_BASE(1.47)
8815     AX_BOOST_DATE_TIME
8816     AX_BOOST_FILESYSTEM
8817     AX_BOOST_IOSTREAMS
8818     AX_BOOST_LOCALE
8819     AC_LANG_PUSH([C++])
8820     save_CXXFLAGS=$CXXFLAGS
8821     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8822     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8823        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8824     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8825        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8826     CXXFLAGS=$save_CXXFLAGS
8827     AC_LANG_POP([C++])
8828     # this is in m4/ax_boost_base.m4
8829     FilterLibs "${BOOST_LDFLAGS}"
8830     BOOST_LDFLAGS="${filteredlibs}"
8831 else
8832     AC_MSG_RESULT([internal])
8833     BUILD_TYPE="$BUILD_TYPE BOOST"
8834     SYSTEM_BOOST=
8835     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8836         # use warning-suppressing wrapper headers
8837         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8838     else
8839         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8840     fi
8842 AC_SUBST(SYSTEM_BOOST)
8844 dnl ===================================================================
8845 dnl Check for system mdds
8846 dnl ===================================================================
8847 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8849 dnl ===================================================================
8850 dnl Check for system glm
8851 dnl ===================================================================
8852 AC_MSG_CHECKING([which glm to use])
8853 if test "$with_system_glm" = "yes"; then
8854     AC_MSG_RESULT([external])
8855     SYSTEM_GLM=TRUE
8856     AC_LANG_PUSH([C++])
8857     AC_CHECK_HEADER([glm/glm.hpp], [],
8858        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8859     AC_LANG_POP([C++])
8860 else
8861     AC_MSG_RESULT([internal])
8862     BUILD_TYPE="$BUILD_TYPE GLM"
8863     SYSTEM_GLM=
8864     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8866 AC_SUBST([GLM_CFLAGS])
8867 AC_SUBST([SYSTEM_GLM])
8869 dnl ===================================================================
8870 dnl Check for system odbc
8871 dnl ===================================================================
8872 AC_MSG_CHECKING([which odbc headers to use])
8873 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
8874     AC_MSG_RESULT([external])
8875     SYSTEM_ODBC_HEADERS=TRUE
8877     if test "$build_os" = "cygwin"; then
8878         save_CPPFLAGS=$CPPFLAGS
8879         find_winsdk
8880         PathFormat "$winsdktest"
8881         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"
8882         AC_CHECK_HEADER(sqlext.h, [],
8883             [AC_MSG_ERROR(odbc not found. install odbc)],
8884             [#include <windows.h>])
8885         CPPFLAGS=$save_CPPFLAGS
8886     else
8887         AC_CHECK_HEADER(sqlext.h, [],
8888             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8889     fi
8890 elif test "$enable_database_connectivity" != yes; then
8891     AC_MSG_RESULT([none])
8892 else
8893     AC_MSG_RESULT([internal])
8894     SYSTEM_ODBC_HEADERS=
8896 AC_SUBST(SYSTEM_ODBC_HEADERS)
8899 dnl ===================================================================
8900 dnl Check for system openldap
8901 dnl ===================================================================
8903 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8904 AC_MSG_CHECKING([which openldap library to use])
8905 if test "$with_system_openldap" = "yes"; then
8906     AC_MSG_RESULT([external])
8907     SYSTEM_OPENLDAP=TRUE
8908     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8909     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8910     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8911 else
8912     AC_MSG_RESULT([internal])
8913     SYSTEM_OPENLDAP=
8914     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8917 AC_SUBST(SYSTEM_OPENLDAP)
8919 dnl ===================================================================
8920 dnl Check for system NSS
8921 dnl ===================================================================
8922 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
8923     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8924     AC_DEFINE(HAVE_FEATURE_NSS)
8925     ENABLE_NSS="TRUE"
8926     AC_DEFINE(ENABLE_NSS)
8927 else
8928     with_tls=openssl
8930 AC_SUBST(ENABLE_NSS)
8932 dnl ===================================================================
8933 dnl Check for TLS/SSL and cryptographic implementation to use
8934 dnl ===================================================================
8935 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8936 if test -n "$with_tls"; then
8937     case $with_tls in
8938     openssl)
8939         AC_DEFINE(USE_TLS_OPENSSL)
8940         TLS=OPENSSL
8942         if test "$enable_openssl" != "yes"; then
8943             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8944         fi
8946         # warn that OpenSSL has been selected but not all TLS code has this option
8947         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8948         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8949         ;;
8950     nss)
8951         AC_DEFINE(USE_TLS_NSS)
8952         TLS=NSS
8953         ;;
8954     *)
8955         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8956 openssl - OpenSSL
8957 nss - Mozilla's Network Security Services (NSS)
8958     ])
8959         ;;
8960     esac
8961 else
8962     # default to using NSS, it results in smaller oox lib
8963     AC_DEFINE(USE_TLS_NSS)
8964     TLS=NSS
8966 AC_MSG_RESULT([$TLS])
8967 AC_SUBST(TLS)
8969 dnl ===================================================================
8970 dnl Check for system sane
8971 dnl ===================================================================
8972 AC_MSG_CHECKING([which sane header to use])
8973 if test "$with_system_sane" = "yes"; then
8974     AC_MSG_RESULT([external])
8975     AC_CHECK_HEADER(sane/sane.h, [],
8976       [AC_MSG_ERROR(sane not found. install sane)], [])
8977 else
8978     AC_MSG_RESULT([internal])
8979     BUILD_TYPE="$BUILD_TYPE SANE"
8982 dnl ===================================================================
8983 dnl Check for system icu
8984 dnl ===================================================================
8985 SYSTEM_GENBRK=
8986 SYSTEM_GENCCODE=
8987 SYSTEM_GENCMN=
8989 ICU_MAJOR=58
8990 ICU_MINOR=1
8991 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8992 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8993 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8994 AC_MSG_CHECKING([which icu to use])
8995 if test "$with_system_icu" = "yes"; then
8996     AC_MSG_RESULT([external])
8997     SYSTEM_ICU=TRUE
8998     AC_LANG_PUSH([C++])
8999     AC_MSG_CHECKING([for unicode/rbbi.h])
9000     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9001     AC_LANG_POP([C++])
9003     if test "$cross_compiling" != "yes"; then
9004         AC_PATH_PROG(ICUCONFIG,icu-config)
9006         AC_MSG_CHECKING([ICU version])
9007         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9008         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9009         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9011         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "6" \); then
9012             AC_MSG_RESULT([OK, $ICU_VERSION])
9013         else
9014             AC_MSG_ERROR([not suitable, only >= 4.6 supported currently])
9015         fi
9016     fi
9018     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9019         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9020         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9021         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9022         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9023         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9024         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9025             AC_MSG_RESULT([yes])
9026         else
9027             AC_MSG_RESULT([no])
9028             if test "$with_system_icu_for_build" != "force"; then
9029                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9030 You can use --with-system-icu-for-build=force to use it anyway.])
9031             fi
9032         fi
9033     fi
9035     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9036         # using the system icu tools can lead to version confusion, use the
9037         # ones from the build environment when cross-compiling
9038         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9039         if test -z "$SYSTEM_GENBRK"; then
9040             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9041         fi
9042         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9043         if test -z "$SYSTEM_GENCCODE"; then
9044             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9045         fi
9046         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9047         if test -z "$SYSTEM_GENCMN"; then
9048             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9049         fi
9050         if test "$ICU_MAJOR" -ge "49"; then
9051             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9052             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9053             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9054         else
9055             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9056             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9057             ICU_RECLASSIFIED_HEBREW_LETTER=
9058         fi
9059     fi
9061     if test "$cross_compiling" = "yes"; then
9062         if test "$ICU_MAJOR" -ge "50"; then
9063             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9064             ICU_MINOR=""
9065         fi
9066     fi
9067 else
9068     AC_MSG_RESULT([internal])
9069     SYSTEM_ICU=
9070     BUILD_TYPE="$BUILD_TYPE ICU"
9071     # surprisingly set these only for "internal" (to be used by various other
9072     # external libs): the system icu-config is quite unhelpful and spits out
9073     # dozens of weird flags and also default path -I/usr/include
9074     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9075     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9077 if test "$ICU_MAJOR" -ge "59"; then
9078     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9079     # with -std=c++11 but not all external libraries can be built with that,
9080     # for those use a bit-compatible typedef uint16_t UChar; see
9081     # icu/source/common/unicode/umachine.h
9082     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9083 else
9084     ICU_UCHAR_TYPE=""
9086 AC_SUBST(SYSTEM_ICU)
9087 AC_SUBST(SYSTEM_GENBRK)
9088 AC_SUBST(SYSTEM_GENCCODE)
9089 AC_SUBST(SYSTEM_GENCMN)
9090 AC_SUBST(ICU_MAJOR)
9091 AC_SUBST(ICU_MINOR)
9092 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9093 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9094 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9095 AC_SUBST(ICU_CFLAGS)
9096 AC_SUBST(ICU_LIBS)
9097 AC_SUBST(ICU_UCHAR_TYPE)
9099 dnl ==================================================================
9100 dnl Breakpad
9101 dnl ==================================================================
9102 AC_MSG_CHECKING([whether to enable breakpad])
9103 if test "$enable_breakpad" != yes; then
9104     AC_MSG_RESULT([no])
9105 else
9106     AC_MSG_RESULT([yes])
9107     ENABLE_BREAKPAD="TRUE"
9108     AC_DEFINE(ENABLE_BREAKPAD)
9109     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9110     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9112     AC_MSG_CHECKING([for crashreport config])
9113     if test "$with_symbol_config" = "no"; then
9114         BREAKPAD_SYMBOL_CONFIG="invalid"
9115         AC_MSG_RESULT([no])
9116     else
9117         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9118         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9119         AC_MSG_RESULT([yes])
9120     fi
9121     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9123 AC_SUBST(ENABLE_BREAKPAD)
9125 dnl ==================================================================
9126 dnl libfuzzer
9127 dnl ==================================================================
9128 AC_MSG_CHECKING([whether to enable fuzzers])
9129 if test "$enable_fuzzers" != yes; then
9130     AC_MSG_RESULT([no])
9131 else
9132     AC_MSG_RESULT([yes])
9133     ENABLE_FUZZERS="TRUE"
9134     AC_DEFINE(ENABLE_FUZZERS)
9135     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9137 AC_SUBST(ENABLE_FUZZERS)
9139 dnl ===================================================================
9140 dnl Orcus
9141 dnl ===================================================================
9142 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.12 >= 0.12.0])
9143 if test "$with_system_orcus" != "yes"; then
9144     if test "$SYSTEM_BOOST" = "TRUE"; then
9145         # ===========================================================
9146         # Determine if we are going to need to link with Boost.System
9147         # ===========================================================
9148         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9149         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9150         dnl in documentation has no effect.
9151         AC_MSG_CHECKING([if we need to link with Boost.System])
9152         AC_LANG_PUSH([C++])
9153         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9154                 @%:@include <boost/version.hpp>
9155             ]],[[
9156                 #if BOOST_VERSION >= 105000
9157                 #   error yes, we need to link with Boost.System
9158                 #endif
9159             ]])],[
9160                 AC_MSG_RESULT([no])
9161             ],[
9162                 AC_MSG_RESULT([yes])
9163                 AX_BOOST_SYSTEM
9164         ])
9165         AC_LANG_POP([C++])
9166     fi
9168 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9169 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9170 AC_SUBST([BOOST_SYSTEM_LIB])
9171 AC_SUBST(SYSTEM_LIBORCUS)
9173 dnl ===================================================================
9174 dnl HarfBuzz
9175 dnl ===================================================================
9176 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9177                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9178                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9180 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9181                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9182                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9184 if test "$COM" = "MSC"; then # override the above
9185     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9186     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9189 if test "$with_system_harfbuzz" = "yes"; then
9190     if test "$with_system_graphite" = "no"; then
9191         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9192     fi
9193     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9194     _save_libs="$LIBS"
9195     _save_cflags="$CFLAGS"
9196     LIBS="$LIBS $HARFBUZZ_LIBS"
9197     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9198     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9199     LIBS="$_save_libs"
9200     CFLAGS="$_save_cflags"
9201 else
9202     if test "$with_system_graphite" = "yes"; then
9203         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9204     fi
9207 AC_MSG_CHECKING([whether to use X11])
9208 dnl ***************************************
9209 dnl testing for X libraries and includes...
9210 dnl ***************************************
9211 if test "$USING_X11" = TRUE; then
9212     AC_DEFINE(HAVE_FEATURE_X11)
9214 AC_MSG_RESULT([$USING_X11])
9216 if test "$USING_X11" = TRUE; then
9217     AC_PATH_X
9218     AC_PATH_XTRA
9219     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9221     if test -z "$x_includes"; then
9222         x_includes="default_x_includes"
9223     fi
9224     if test -z "$x_libraries"; then
9225         x_libraries="default_x_libraries"
9226     fi
9227     CFLAGS="$CFLAGS $X_CFLAGS"
9228     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9229     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9230 else
9231     x_includes="no_x_includes"
9232     x_libraries="no_x_libraries"
9235 if test "$USING_X11" = TRUE; then
9236     dnl ===================================================================
9237     dnl Check for Composite.h for Mozilla plugin
9238     dnl ===================================================================
9239     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9240      [#include <X11/Intrinsic.h>])
9242     dnl ===================================================================
9243     dnl Check for extension headers
9244     dnl ===================================================================
9245     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9246      [#include <X11/extensions/shape.h>])
9248     # vcl needs ICE and SM
9249     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9250     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9251         [AC_MSG_ERROR(ICE library not found)])
9252     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9253     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9254         [AC_MSG_ERROR(SM library not found)])
9257 dnl ===================================================================
9258 dnl Check for system Xrender
9259 dnl ===================================================================
9260 AC_MSG_CHECKING([whether to use Xrender])
9261 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9262     AC_MSG_RESULT([yes])
9263     PKG_CHECK_MODULES(XRENDER, xrender)
9264     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9265     FilterLibs "${XRENDER_LIBS}"
9266     XRENDER_LIBS="${filteredlibs}"
9267     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9268       [AC_MSG_ERROR(libXrender not found or functional)], [])
9269     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9270       [AC_MSG_ERROR(Xrender not found. install X)], [])
9271 else
9272     AC_MSG_RESULT([no])
9274 AC_SUBST(XRENDER_CFLAGS)
9275 AC_SUBST(XRENDER_LIBS)
9277 dnl ===================================================================
9278 dnl Check for XRandr
9279 dnl ===================================================================
9280 AC_MSG_CHECKING([whether to enable RandR support])
9281 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9282     AC_MSG_RESULT([yes])
9283     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9284     if test "$ENABLE_RANDR" != "TRUE"; then
9285         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9286                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9287         XRANDR_CFLAGS=" "
9288         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9289           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9290         XRANDR_LIBS="-lXrandr "
9291         ENABLE_RANDR="TRUE"
9292     fi
9293     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9294     FilterLibs "${XRANDR_LIBS}"
9295     XRANDR_LIBS="${filteredlibs}"
9296 else
9297     ENABLE_RANDR=""
9298     AC_MSG_RESULT([no])
9300 AC_SUBST(XRANDR_CFLAGS)
9301 AC_SUBST(XRANDR_LIBS)
9302 AC_SUBST(ENABLE_RANDR)
9304 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9305     WITH_WEBDAV="serf"
9307 if test $_os = iOS -o $_os = Android; then
9308     WITH_WEBDAV="no"
9310 AC_MSG_CHECKING([for webdav library])
9311 case "$WITH_WEBDAV" in
9312 serf)
9313     AC_MSG_RESULT([serf])
9314     # Check for system apr-util
9315     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9316                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9317                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9318     if test "$COM" = "MSC"; then
9319         APR_LIB_DIR="LibR"
9320         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9321         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9322     fi
9324     # Check for system serf
9325     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9326                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9327     if test "$COM" = "MSC"; then
9328         SERF_LIB_DIR="Release"
9329         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9330         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9331     fi
9332     ;;
9333 neon)
9334     AC_MSG_RESULT([neon])
9335     # Check for system neon
9336     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9337     if test "$with_system_neon" = "yes"; then
9338         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9339     else
9340         NEON_VERSION=0295
9341     fi
9342     AC_SUBST(NEON_VERSION)
9343     ;;
9345     AC_MSG_RESULT([none, disabled])
9346     WITH_WEBDAV=""
9347     ;;
9348 esac
9349 AC_SUBST(WITH_WEBDAV)
9351 dnl ===================================================================
9352 dnl Check for disabling cve_tests
9353 dnl ===================================================================
9354 AC_MSG_CHECKING([whether to execute CVE tests])
9355 # If not explicitly enabled or disabled, default
9356 if test -z "$enable_cve_tests"; then
9357     case "$OS" in
9358     WNT)
9359         # Default cves off for windows with its wild and wonderful
9360         # varienty of AV software kicking in and panicing
9361         enable_cve_tests=no
9362         ;;
9363     *)
9364         # otherwise yes
9365         enable_cve_tests=yes
9366         ;;
9367     esac
9369 if test "$enable_cve_tests" = "no"; then
9370     AC_MSG_RESULT([no])
9371     DISABLE_CVE_TESTS=TRUE
9372     AC_SUBST(DISABLE_CVE_TESTS)
9373 else
9374     AC_MSG_RESULT([yes])
9377 dnl ===================================================================
9378 dnl Check for enabling chart XShape tests
9379 dnl ===================================================================
9380 AC_MSG_CHECKING([whether to execute chart XShape tests])
9381 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9382     AC_MSG_RESULT([yes])
9383     ENABLE_CHART_TESTS=TRUE
9384     AC_SUBST(ENABLE_CHART_TESTS)
9385 else
9386     AC_MSG_RESULT([no])
9389 dnl ===================================================================
9390 dnl Check for system openssl
9391 dnl ===================================================================
9392 DISABLE_OPENSSL=
9393 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9394 if test "$enable_openssl" = "yes"; then
9395     AC_MSG_RESULT([no])
9396     if test "$_os" = Darwin ; then
9397         # OpenSSL is deprecated when building for 10.7 or later.
9398         #
9399         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9400         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9402         with_system_openssl=no
9403         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9404     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9405             && test "$with_system_openssl" != "no"; then
9406         with_system_openssl=yes
9407         SYSTEM_OPENSSL=TRUE
9408         OPENSSL_CFLAGS=
9409         OPENSSL_LIBS="-lssl -lcrypto"
9410     else
9411         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9412     fi
9413     if test "$with_system_openssl" = "yes"; then
9414         AC_MSG_CHECKING([whether openssl supports SHA512])
9415         AC_LANG_PUSH([C])
9416         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9417             SHA512_CTX context;
9418 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9419         AC_LANG_POP(C)
9420     fi
9421 else
9422     AC_MSG_RESULT([yes])
9423     DISABLE_OPENSSL=TRUE
9425     # warn that although OpenSSL is disabled, system libraries may depend on it
9426     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9427     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9430 AC_SUBST([DISABLE_OPENSSL])
9432 dnl ===================================================================
9433 dnl Check for building gnutls
9434 dnl ===================================================================
9435 AC_MSG_CHECKING([whether to use gnutls])
9436 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9437     AC_MSG_RESULT([yes])
9438     AM_PATH_LIBGCRYPT()
9439     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9440         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9441                       available in the system to use as replacement.]]))
9442     FilterLibs "${LIBGCRYPT_LIBS}"
9443     LIBGCRYPT_LIBS="${filteredlibs}"
9444 else
9445     AC_MSG_RESULT([no])
9448 AC_SUBST([LIBGCRYPT_CFLAGS])
9449 AC_SUBST([LIBGCRYPT_LIBS])
9451 dnl ===================================================================
9452 dnl Check for system redland
9453 dnl ===================================================================
9454 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9455 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9456 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9457 if test "$with_system_redland" = "yes"; then
9458     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9459             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9460 else
9461     RAPTOR_MAJOR="0"
9462     RASQAL_MAJOR="3"
9463     REDLAND_MAJOR="0"
9465 AC_SUBST(RAPTOR_MAJOR)
9466 AC_SUBST(RASQAL_MAJOR)
9467 AC_SUBST(REDLAND_MAJOR)
9469 dnl ===================================================================
9470 dnl Check for system hunspell
9471 dnl ===================================================================
9472 AC_MSG_CHECKING([which libhunspell to use])
9473 if test "$with_system_hunspell" = "yes"; then
9474     AC_MSG_RESULT([external])
9475     SYSTEM_HUNSPELL=TRUE
9476     AC_LANG_PUSH([C++])
9477     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9478     if test "$HUNSPELL_PC" != "TRUE"; then
9479         AC_CHECK_HEADER(hunspell.hxx, [],
9480             [
9481             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9482             [AC_MSG_ERROR(hunspell headers not found.)], [])
9483             ], [])
9484         AC_CHECK_LIB([hunspell], [main], [:],
9485            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9486         HUNSPELL_LIBS=-lhunspell
9487     fi
9488     AC_LANG_POP([C++])
9489     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9490     FilterLibs "${HUNSPELL_LIBS}"
9491     HUNSPELL_LIBS="${filteredlibs}"
9492 else
9493     AC_MSG_RESULT([internal])
9494     SYSTEM_HUNSPELL=
9495     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9496     if test "$COM" = "MSC"; then
9497         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9498     else
9499         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9500     fi
9501     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9503 AC_SUBST(SYSTEM_HUNSPELL)
9504 AC_SUBST(HUNSPELL_CFLAGS)
9505 AC_SUBST(HUNSPELL_LIBS)
9507 dnl ===================================================================
9508 dnl Checking for altlinuxhyph
9509 dnl ===================================================================
9510 AC_MSG_CHECKING([which altlinuxhyph to use])
9511 if test "$with_system_altlinuxhyph" = "yes"; then
9512     AC_MSG_RESULT([external])
9513     SYSTEM_HYPH=TRUE
9514     AC_CHECK_HEADER(hyphen.h, [],
9515        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9516     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9517        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9518        [#include <hyphen.h>])
9519     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9520         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9521     if test -z "$HYPHEN_LIB"; then
9522         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9523            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9524     fi
9525     if test -z "$HYPHEN_LIB"; then
9526         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9527            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9528     fi
9529 else
9530     AC_MSG_RESULT([internal])
9531     SYSTEM_HYPH=
9532     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9533     if test "$COM" = "MSC"; then
9534         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9535     else
9536         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9537     fi
9539 AC_SUBST(SYSTEM_HYPH)
9540 AC_SUBST(HYPHEN_LIB)
9542 dnl ===================================================================
9543 dnl Checking for mythes
9544 dnl ===================================================================
9545 AC_MSG_CHECKING([which mythes to use])
9546 if test "$with_system_mythes" = "yes"; then
9547     AC_MSG_RESULT([external])
9548     SYSTEM_MYTHES=TRUE
9549     AC_LANG_PUSH([C++])
9550     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9551     if test "$MYTHES_PKGCONFIG" = "no"; then
9552         AC_CHECK_HEADER(mythes.hxx, [],
9553             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9554         AC_CHECK_LIB([mythes-1.2], [main], [:],
9555             [ MYTHES_FOUND=no], [])
9556     if test "$MYTHES_FOUND" = "no"; then
9557         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9558                 [ MYTHES_FOUND=no], [])
9559     fi
9560     if test "$MYTHES_FOUND" = "no"; then
9561         AC_MSG_ERROR([mythes library not found!.])
9562     fi
9563     fi
9564     AC_LANG_POP([C++])
9565     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9566     FilterLibs "${MYTHES_LIBS}"
9567     MYTHES_LIBS="${filteredlibs}"
9568 else
9569     AC_MSG_RESULT([internal])
9570     SYSTEM_MYTHES=
9571     BUILD_TYPE="$BUILD_TYPE MYTHES"
9572     if test "$COM" = "MSC"; then
9573         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9574     else
9575         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9576     fi
9578 AC_SUBST(SYSTEM_MYTHES)
9579 AC_SUBST(MYTHES_CFLAGS)
9580 AC_SUBST(MYTHES_LIBS)
9582 dnl ===================================================================
9583 dnl How should we build the linear programming solver ?
9584 dnl ===================================================================
9586 ENABLE_COINMP=
9587 AC_MSG_CHECKING([whether to build with CoinMP])
9588 if test "$enable_coinmp" != "no"; then
9589     ENABLE_COINMP=TRUE
9590     AC_MSG_RESULT([yes])
9591     if test "$with_system_coinmp" = "yes"; then
9592         SYSTEM_COINMP=TRUE
9593         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9594         FilterLibs "${COINMP_LIBS}"
9595         COINMP_LIBS="${filteredlibs}"
9596     else
9597         BUILD_TYPE="$BUILD_TYPE COINMP"
9598     fi
9599 else
9600     AC_MSG_RESULT([no])
9602 AC_SUBST(ENABLE_COINMP)
9603 AC_SUBST(SYSTEM_COINMP)
9604 AC_SUBST(COINMP_CFLAGS)
9605 AC_SUBST(COINMP_LIBS)
9607 ENABLE_LPSOLVE=
9608 AC_MSG_CHECKING([whether to build with lpsolve])
9609 if test "$enable_lpsolve" != "no"; then
9610     ENABLE_LPSOLVE=TRUE
9611     AC_MSG_RESULT([yes])
9612 else
9613     AC_MSG_RESULT([no])
9615 AC_SUBST(ENABLE_LPSOLVE)
9617 if test "$ENABLE_LPSOLVE" = TRUE; then
9618     AC_MSG_CHECKING([which lpsolve to use])
9619     if test "$with_system_lpsolve" = "yes"; then
9620         AC_MSG_RESULT([external])
9621         SYSTEM_LPSOLVE=TRUE
9622         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9623            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9624         save_LIBS=$LIBS
9625         # some systems need this. Like Ubuntu....
9626         AC_CHECK_LIB(m, floor)
9627         AC_CHECK_LIB(dl, dlopen)
9628         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9629             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9630         LIBS=$save_LIBS
9631     else
9632         AC_MSG_RESULT([internal])
9633         SYSTEM_LPSOLVE=
9634         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9635     fi
9637 AC_SUBST(SYSTEM_LPSOLVE)
9639 dnl ===================================================================
9640 dnl Checking for libexttextcat
9641 dnl ===================================================================
9642 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9643 if test "$with_system_libexttextcat" = "yes"; then
9644     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9646 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9648 dnl ***************************************
9649 dnl testing libc version for Linux...
9650 dnl ***************************************
9651 if test "$_os" = "Linux"; then
9652     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9653     exec 6>/dev/null # no output
9654     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9655     exec 6>&1 # output on again
9656     if test "$HAVE_LIBC"; then
9657         AC_MSG_RESULT([yes])
9658     else
9659         AC_MSG_ERROR([no, upgrade libc])
9660     fi
9663 dnl =========================================
9664 dnl Check for uuidgen
9665 dnl =========================================
9666 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9667     # presence is already tested above in the WINDOWS_SDK_HOME check
9668     UUIDGEN=uuidgen.exe
9669     AC_SUBST(UUIDGEN)
9670 else
9671     AC_PATH_PROG([UUIDGEN], [uuidgen])
9672     if test -z "$UUIDGEN"; then
9673         AC_MSG_WARN([uuid is needed for building installation sets])
9674     fi
9677 dnl ***************************************
9678 dnl Checking for bison and flex
9679 dnl ***************************************
9680 AC_PATH_PROG(BISON, bison)
9681 if test -z "$BISON"; then
9682     AC_MSG_ERROR([no bison found in \$PATH, install it])
9683 else
9684     AC_MSG_CHECKING([the bison version])
9685     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9686     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9687     # Accept newer than 2.0
9688     if test "$_bison_longver" -lt 2000; then
9689         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9690     fi
9693 AC_PATH_PROG(FLEX, flex)
9694 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9695     FLEX=`cygpath -m $FLEX`
9697 if test -z "$FLEX"; then
9698     AC_MSG_ERROR([no flex found in \$PATH, install it])
9699 else
9700     AC_MSG_CHECKING([the flex version])
9701     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9702     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9703         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9704     fi
9706 AC_SUBST([FLEX])
9707 dnl ***************************************
9708 dnl Checking for patch
9709 dnl ***************************************
9710 AC_PATH_PROG(PATCH, patch)
9711 if test -z "$PATCH"; then
9712     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9715 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9716 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9717     if test -z "$with_gnu_patch"; then
9718         GNUPATCH=$PATCH
9719     else
9720         if test -x "$with_gnu_patch"; then
9721             GNUPATCH=$with_gnu_patch
9722         else
9723             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9724         fi
9725     fi
9727     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9728     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9729         AC_MSG_RESULT([yes])
9730     else
9731         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9732     fi
9733 else
9734     GNUPATCH=$PATCH
9737 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9738     GNUPATCH=`cygpath -m $GNUPATCH`
9741 dnl We also need to check for --with-gnu-cp
9743 if test -z "$with_gnu_cp"; then
9744     # check the place where the good stuff is hidden on Solaris...
9745     if test -x /usr/gnu/bin/cp; then
9746         GNUCP=/usr/gnu/bin/cp
9747     else
9748         AC_PATH_PROGS(GNUCP, gnucp cp)
9749     fi
9750     if test -z $GNUCP; then
9751         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9752     fi
9753 else
9754     if test -x "$with_gnu_cp"; then
9755         GNUCP=$with_gnu_cp
9756     else
9757         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9758     fi
9761 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9762     GNUCP=`cygpath -m $GNUCP`
9765 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9766 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9767     AC_MSG_RESULT([yes])
9768 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9769     AC_MSG_RESULT([yes])
9770 else
9771     case "$build_os" in
9772     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9773         x_GNUCP=[\#]
9774         GNUCP=''
9775         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9776         ;;
9777     *)
9778         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9779         ;;
9780     esac
9783 AC_SUBST(GNUPATCH)
9784 AC_SUBST(GNUCP)
9785 AC_SUBST(x_GNUCP)
9787 dnl ***************************************
9788 dnl testing assembler path
9789 dnl ***************************************
9790 ML_EXE=""
9791 if test "$_os" = "WINNT"; then
9792     if test "$BITNESS_OVERRIDE" = ""; then
9793         assembler=ml.exe
9794         assembler_bin=$CL_DIR
9795     else
9796         assembler=ml64.exe
9797         assembler_bin=$CL_DIR
9798     fi
9800     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9801     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9802         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9803         AC_MSG_RESULT([found])
9804         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9805     else
9806         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9807     fi
9809     PathFormat "$ASM_HOME"
9810     ASM_HOME="$formatted_path"
9811 else
9812     ASM_HOME=""
9815 AC_SUBST(ML_EXE)
9817 dnl ===================================================================
9818 dnl We need zip and unzip
9819 dnl ===================================================================
9820 AC_PATH_PROG(ZIP, zip)
9821 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9822 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9823     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],,)
9826 AC_PATH_PROG(UNZIP, unzip)
9827 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9829 dnl ===================================================================
9830 dnl Zip must be a specific type for different build types.
9831 dnl ===================================================================
9832 if test $build_os = cygwin; then
9833     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9834         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9835     fi
9838 dnl ===================================================================
9839 dnl We need touch with -h option support.
9840 dnl ===================================================================
9841 AC_PATH_PROG(TOUCH, touch)
9842 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9843 touch warn
9844 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9845     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],,)
9848 dnl ===================================================================
9849 dnl Check for system epoxy
9850 dnl ===================================================================
9851 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9853 dnl ===================================================================
9854 dnl Set vcl option: coordinate device in double or sal_Int32
9855 dnl ===================================================================
9857 dnl disabled for now, we don't want subtle differences between OSs
9858 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9859 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9860 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9861 dnl     AC_MSG_RESULT([double])
9862 dnl else
9863 dnl     AC_MSG_RESULT([sal_Int32])
9864 dnl fi
9866 dnl ===================================================================
9867 dnl Test which vclplugs have to be built.
9868 dnl ===================================================================
9869 R=""
9870 if test "$USING_X11" != TRUE; then
9871     enable_gtk=no
9872     enable_gtk3=no
9874 GTK3_CFLAGS=""
9875 GTK3_LIBS=""
9876 ENABLE_GTK3=""
9877 if test "x$enable_gtk3" = "xyes"; then
9878     if test "$with_system_cairo" = no; then
9879         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9880     fi
9881     : ${with_system_cairo:=yes}
9882     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="")
9883     if test "x$ENABLE_GTK3" = "xTRUE"; then
9884         R="gtk3"
9885         dnl Avoid installed by unpackaged files for now.
9886         if test -z "$PKGFORMAT"; then
9887             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9888         fi
9889     else
9890         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9891     fi
9892     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9893     FilterLibs "${GTK3_LIBS}"
9894     GTK3_LIBS="${filteredlibs}"
9896     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9897     if test "$with_system_epoxy" != "yes"; then
9898         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9899     fi
9901 AC_SUBST(GTK3_LIBS)
9902 AC_SUBST(GTK3_CFLAGS)
9903 AC_SUBST(ENABLE_GTK3)
9905 ENABLE_GTK=""
9906 if test "x$enable_gtk" = "xyes"; then
9907     if test "$with_system_cairo" = no; then
9908         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9909     fi
9910     : ${with_system_cairo:=yes}
9911     ENABLE_GTK="TRUE"
9912     AC_DEFINE(ENABLE_GTK)
9913     R="gtk $R"
9915 AC_SUBST(ENABLE_GTK)
9917 ENABLE_TDE=""
9918 if test "x$enable_tde" = "xyes"; then
9919     ENABLE_TDE="TRUE"
9920     AC_DEFINE(ENABLE_TDE)
9921     R="$R tde"
9923 AC_SUBST(ENABLE_TDE)
9925 ENABLE_KDE4=""
9926 if test "x$enable_kde4" = "xyes"; then
9927     ENABLE_KDE4="TRUE"
9928     AC_DEFINE(ENABLE_KDE4)
9929     R="$R kde4"
9931 AC_SUBST(ENABLE_KDE4)
9934 build_vcl_plugins="$R"
9935 if test -z "$build_vcl_plugins"; then
9936     build_vcl_plugins="none"
9938 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
9940 dnl ===================================================================
9941 dnl check for dbus support
9942 dnl ===================================================================
9943 ENABLE_DBUS=""
9944 DBUS_CFLAGS=""
9945 DBUS_LIBS=""
9947 if test "$enable_dbus" = "no"; then
9948     test_dbus=no
9951 AC_MSG_CHECKING([whether to enable DBUS support])
9952 if test "$test_dbus" = "yes"; then
9953     ENABLE_DBUS="TRUE"
9954     AC_MSG_RESULT([yes])
9955     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9956     AC_DEFINE(ENABLE_DBUS)
9957     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9958     FilterLibs "${DBUS_LIBS}"
9959     DBUS_LIBS="${filteredlibs}"
9960 else
9961     AC_MSG_RESULT([no])
9964 AC_SUBST(ENABLE_DBUS)
9965 AC_SUBST(DBUS_CFLAGS)
9966 AC_SUBST(DBUS_LIBS)
9968 AC_MSG_CHECKING([whether to enable Impress remote control])
9969 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9970     AC_MSG_RESULT([yes])
9971     ENABLE_SDREMOTE=TRUE
9972     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9974     # If not explicitly enabled or disabled, default
9975     if test -z "$enable_sdremote_bluetooth"; then
9976         case "$OS" in
9977         LINUX|MACOSX|WNT)
9978             # Default to yes for these
9979             enable_sdremote_bluetooth=yes
9980             ;;
9981         *)
9982             # otherwise no
9983             enable_sdremote_bluetooth=no
9984             ;;
9985         esac
9986     fi
9987     # $enable_sdremote_bluetooth is guaranteed non-empty now
9989     if test "$enable_sdremote_bluetooth" != "no"; then
9990         if test "$OS" = "LINUX"; then
9991             if test "$ENABLE_DBUS" = "TRUE"; then
9992                 AC_MSG_RESULT([yes])
9993                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
9994                 dnl ===================================================================
9995                 dnl Check for system bluez
9996                 dnl ===================================================================
9997                 AC_MSG_CHECKING([which Bluetooth header to use])
9998                 if test "$with_system_bluez" = "yes"; then
9999                     AC_MSG_RESULT([external])
10000                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10001                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10002                     SYSTEM_BLUEZ=TRUE
10003                 else
10004                     AC_MSG_RESULT([internal])
10005                     SYSTEM_BLUEZ=
10006                 fi
10007             else
10008                 AC_MSG_RESULT([no, dbus disabled])
10009                 ENABLE_SDREMOTE_BLUETOOTH=
10010                 SYSTEM_BLUEZ=
10011             fi
10012         else
10013             AC_MSG_RESULT([yes])
10014             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10015             SYSTEM_BLUEZ=
10016         fi
10017     else
10018         AC_MSG_RESULT([no])
10019         ENABLE_SDREMOTE_BLUETOOTH=
10020         SYSTEM_BLUEZ=
10021     fi
10022 else
10023     ENABLE_SDREMOTE=
10024     SYSTEM_BLUEZ=
10025     AC_MSG_RESULT([no])
10027 AC_SUBST(ENABLE_SDREMOTE)
10028 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10029 AC_SUBST(SYSTEM_BLUEZ)
10031 dnl ===================================================================
10032 dnl Check whether the gtk 2.0 libraries are available.
10033 dnl ===================================================================
10035 GTK_CFLAGS=""
10036 GTK_LIBS=""
10037 ENABLE_SYSTRAY_GTK=""
10038 if test  "$test_gtk" = "yes"; then
10040     if test "$ENABLE_GTK" = "TRUE"; then
10041         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]))
10042         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10043         FilterLibs "${GTK_LIBS}"
10044         GTK_LIBS="${filteredlibs}"
10045         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]))
10046         BUILD_TYPE="$BUILD_TYPE GTK"
10047         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10048         FilterLibs "${GTHREAD_LIBS}"
10049         GTHREAD_LIBS="${filteredlibs}"
10051         if test "x$enable_systray" = "xyes"; then
10052             ENABLE_SYSTRAY_GTK="TRUE"
10053         fi
10055         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10056         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10057                           [ENABLE_GTK_PRINT="TRUE"],
10058                           [ENABLE_GTK_PRINT=""])
10059         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10060         FilterLibs "${GTK_PRINT_LIBS}"
10061         GTK_PRINT_LIBS="${filteredlibs}"
10063         AC_MSG_CHECKING([whether to enable GIO support])
10064         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10065             dnl Need at least 2.26 for the dbus support.
10066             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10067                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10068             if test "$ENABLE_GIO" = "TRUE"; then
10069                 AC_DEFINE(ENABLE_GIO)
10070                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10071                 FilterLibs "${GIO_LIBS}"
10072                 GIO_LIBS="${filteredlibs}"
10073             fi
10074         else
10075             AC_MSG_RESULT([no])
10076         fi
10077     fi
10079 AC_SUBST(ENABLE_GIO)
10080 AC_SUBST(GIO_CFLAGS)
10081 AC_SUBST(GIO_LIBS)
10082 AC_SUBST(ENABLE_SYSTRAY_GTK)
10083 AC_SUBST(GTK_CFLAGS)
10084 AC_SUBST(GTK_LIBS)
10085 AC_SUBST(GTHREAD_CFLAGS)
10086 AC_SUBST(GTHREAD_LIBS)
10087 AC_SUBST([ENABLE_GTK_PRINT])
10088 AC_SUBST([GTK_PRINT_CFLAGS])
10089 AC_SUBST([GTK_PRINT_LIBS])
10092 dnl ===================================================================
10094 SPLIT_APP_MODULES=""
10095 if test "$enable_split_app_modules" = "yes"; then
10096     SPLIT_APP_MODULES="TRUE"
10098 AC_SUBST(SPLIT_APP_MODULES)
10100 SPLIT_OPT_FEATURES=""
10101 if test "$enable_split_opt_features" = "yes"; then
10102     SPLIT_OPT_FEATURES="TRUE"
10104 AC_SUBST(SPLIT_OPT_FEATURES)
10106 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10107     if test "$enable_cairo_canvas" = yes; then
10108         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10109     fi
10110     enable_cairo_canvas=no
10111 elif test -z "$enable_cairo_canvas"; then
10112     enable_cairo_canvas=yes
10115 ENABLE_CAIRO_CANVAS=""
10116 if test "$enable_cairo_canvas" = "yes"; then
10117     test_cairo=yes
10118     ENABLE_CAIRO_CANVAS="TRUE"
10119     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10121 AC_SUBST(ENABLE_CAIRO_CANVAS)
10123 dnl ===================================================================
10124 dnl Check whether the GStreamer libraries are available.
10125 dnl It's possible to build avmedia with both GStreamer backends!
10126 dnl ===================================================================
10128 ENABLE_GSTREAMER_1_0=""
10130 if test "$build_gstreamer_1_0" = "yes"; then
10132     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10133     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10134         ENABLE_GSTREAMER_1_0="TRUE"
10135         AC_MSG_RESULT([yes])
10136         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10137         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10138         FilterLibs "${GSTREAMER_1_0_LIBS}"
10139         GSTREAMER_1_0_LIBS="${filteredlibs}"
10140     else
10141         AC_MSG_RESULT([no])
10142     fi
10144 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10145 AC_SUBST(GSTREAMER_1_0_LIBS)
10146 AC_SUBST(ENABLE_GSTREAMER_1_0)
10149 ENABLE_GSTREAMER_0_10=""
10150 if test "$build_gstreamer_0_10" = "yes"; then
10152     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10153     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10154         ENABLE_GSTREAMER_0_10="TRUE"
10155         AC_MSG_RESULT([yes])
10156         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10157             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10158         ])
10159         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10160         FilterLibs "${GSTREAMER_0_10_LIBS}"
10161         GSTREAMER_0_10_LIBS="${filteredlibs}"
10162     else
10163         AC_MSG_RESULT([no])
10164     fi
10167 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10168 AC_SUBST(GSTREAMER_0_10_LIBS)
10169 AC_SUBST(ENABLE_GSTREAMER_0_10)
10171 dnl ===================================================================
10172 dnl Check whether to build the VLC avmedia backend
10173 dnl ===================================================================
10175 ENABLE_VLC=""
10177 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10178 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10179     ENABLE_VLC="TRUE"
10180     AC_MSG_RESULT([yes])
10181 else
10182     AC_MSG_RESULT([no])
10184 AC_SUBST(ENABLE_VLC)
10186 ENABLE_OPENGL_TRANSITIONS=
10187 ENABLE_OPENGL_CANVAS=
10188 if test $_os = iOS -o $_os = Android; then
10189    : # disable
10190 elif test "$_os" = "Darwin"; then
10191     # We use frameworks on Mac OS X, no need for detail checks
10192     ENABLE_OPENGL_TRANSITIONS=TRUE
10193     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10194     ENABLE_OPENGL_CANVAS=TRUE
10195 elif test $_os = WINNT; then
10196     ENABLE_OPENGL_TRANSITIONS=TRUE
10197     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10198     ENABLE_OPENGL_CANVAS=TRUE
10199 else
10200     if test "$USING_X11" = TRUE; then
10201         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10202         ENABLE_OPENGL_TRANSITIONS=TRUE
10203         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10204         ENABLE_OPENGL_CANVAS=TRUE
10205     fi
10208 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10209 AC_SUBST(ENABLE_OPENGL_CANVAS)
10211 dnl =================================================
10212 dnl Check whether to build with OpenCL support.
10213 dnl =================================================
10215 if test $_os != iOS -a $_os != Android; then
10216     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10217     # platform (optional at run-time, used through clew).
10218     BUILD_TYPE="$BUILD_TYPE OPENCL"
10219     AC_DEFINE(HAVE_FEATURE_OPENCL)
10222 dnl ===================================================================
10223 dnl Check whether to enable glTF support
10224 dnl ===================================================================
10225 AC_MSG_CHECKING([whether to enable glTF support])
10226 ENABLE_GLTF=
10227 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android -a "$ENABLE_HEADLESS" = ""; then
10228     ENABLE_GLTF=TRUE
10229     AC_MSG_RESULT([yes])
10230     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10231     if test "$with_system_libgltf" = "yes"; then
10232         SYSTEM_LIBGLTF=TRUE
10233         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.1 >= 0.1.0] )
10234         FilterLibs "${LIBGLTF_LIBS}"
10235         LIBGLTF_LIBS="${filteredlibs}"
10236     else
10237         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10238     fi
10239 else
10240     AC_MSG_RESULT([no])
10242 AC_SUBST(ENABLE_GLTF)
10243 AC_SUBST(SYSTEM_LIBGLTF)
10244 AC_SUBST(LIBGLTF_CFLAGS)
10245 AC_SUBST(LIBGLTF_LIBS)
10247 dnl ===================================================================
10248 dnl Check whether to enable COLLADA support
10249 dnl ===================================================================
10250 AC_MSG_CHECKING([whether to enable COLLADA support])
10251 ENABLE_COLLADA=
10252 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10253     AC_MSG_RESULT([yes])
10254     ENABLE_COLLADA=TRUE
10255     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10257     AC_MSG_CHECKING([which OPENCOLLADA to use])
10258     if test "$with_system_opencollada" = "yes"; then
10259         AC_MSG_RESULT([external])
10260         SYSTEM_OPENCOLLADA=TRUE
10261         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10262         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10263         AC_LANG_PUSH([C++])
10264         save_CXXFLAGS=$CXXFLAGS
10265         save_CPPFLAGS=$CPPFLAGS
10266         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10267         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10268         AC_CHECK_HEADERS(
10269                 COLLADABU.h \
10270                 COLLADAFW.h \
10271                 COLLADASaxFWLLoader.h \
10272                 GeneratedSaxParser.h,
10273             [],
10274             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10275             [])
10276         CXXFLAGS=$save_CXXFLAGS
10277         CPPFLAGS=$save_CPPFLAGS
10278         AC_LANG_POP([C++])
10279         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10280         FilterLibs "${OPENCOLLADA_LIBS}"
10281         OPENCOLLADA_LIBS="${filteredlibs}"
10282     else
10283         AC_MSG_RESULT([internal])
10284         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10285     fi
10287     AC_MSG_CHECKING([which collada2gltf to use])
10288     if test "$with_system_collada2gltf" = "yes"; then
10289         if test "$with_system_opencollada" = "no"; then
10290             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10291         fi
10292         AC_MSG_RESULT([external])
10293         SYSTEM_COLLADA2GLTF=TRUE
10294         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10295         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10296         AC_LANG_PUSH([C++])
10297         save_CXXFLAGS=$CXXFLAGS
10298         save_CPPFLAGS=$CPPFLAGS
10299         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10300         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10301         AC_CHECK_HEADERS(
10302                 GLTF.h \
10303                 encodingHelpers.h,
10304             [],
10305             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10306             [])
10307         CXXFLAGS=$save_CXXFLAGS
10308         CPPFLAGS=$save_CPPFLAGS
10309         AC_LANG_POP([C++])
10310         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10311         FilterLibs "${COLLADA2GLTF_LIBS}"
10312         COLLADA2GLTF_LIBS="${filteredlibs}"
10313     else
10314         AC_MSG_RESULT([internal])
10315         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10316     fi
10317 else
10318     AC_MSG_RESULT([no])
10320 AC_SUBST(ENABLE_COLLADA)
10321 AC_SUBST([OPENCOLLADA_CFLAGS])
10322 AC_SUBST([OPENCOLLADA_LIBS])
10323 AC_SUBST([SYSTEM_OPENCOLLADA])
10325 AC_SUBST([COLLADA2GLTF_CFLAGS])
10326 AC_SUBST([COLLADA2GLTF_LIBS])
10327 AC_SUBST([SYSTEM_COLLADA2GLTF])
10329 if test "$enable_dconf" != no; then
10330     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10331         if test "$enable_dconf" = yes; then
10332             AC_MSG_ERROR([dconf not found])
10333         else
10334             enable_dconf=no
10335         fi])
10337 AC_MSG_CHECKING([whether to enable dconf])
10338 if test "$enable_dconf" = no; then
10339     DCONF_CFLAGS=
10340     DCONF_LIBS=
10341     ENABLE_DCONF=
10342     AC_MSG_RESULT([no])
10343 else
10344     ENABLE_DCONF=TRUE
10345     AC_DEFINE(ENABLE_DCONF)
10346     AC_MSG_RESULT([yes])
10348 AC_SUBST([DCONF_CFLAGS])
10349 AC_SUBST([DCONF_LIBS])
10350 AC_SUBST([ENABLE_DCONF])
10352 # pdf import?
10353 AC_MSG_CHECKING([whether to build the PDF import feature])
10354 ENABLE_PDFIMPORT=
10355 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10356     AC_MSG_RESULT([yes])
10357     ENABLE_PDFIMPORT=TRUE
10358     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10360     dnl ===================================================================
10361     dnl Check for system poppler
10362     dnl ===================================================================
10363     AC_MSG_CHECKING([which PDF import backend to use])
10364     if test "$with_system_poppler" = "yes"; then
10365         AC_MSG_RESULT([external])
10366         SYSTEM_POPPLER=TRUE
10367         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10368         AC_LANG_PUSH([C++])
10369         save_CXXFLAGS=$CXXFLAGS
10370         save_CPPFLAGS=$CPPFLAGS
10371         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10372         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10373         AC_CHECK_HEADER([cpp/poppler-version.h],
10374             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10375             [])
10376         CXXFLAGS=$save_CXXFLAGS
10377         CPPFLAGS=$save_CPPFLAGS
10378         AC_LANG_POP([C++])
10379         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10381         FilterLibs "${POPPLER_LIBS}"
10382         POPPLER_LIBS="${filteredlibs}"
10383     else
10384         AC_MSG_RESULT([internal])
10385         SYSTEM_POPPLER=
10386         BUILD_TYPE="$BUILD_TYPE POPPLER"
10387         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10388     fi
10389     AC_DEFINE([ENABLE_PDFIMPORT],1)
10390 else
10391     AC_MSG_RESULT([no])
10393 AC_SUBST(ENABLE_PDFIMPORT)
10394 AC_SUBST(SYSTEM_POPPLER)
10395 AC_SUBST(POPPLER_CFLAGS)
10396 AC_SUBST(POPPLER_LIBS)
10398 # pdf import?
10399 AC_MSG_CHECKING([whether to build PDFium])
10400 ENABLE_PDFIUM=
10401 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10402     AC_MSG_RESULT([yes])
10403     ENABLE_PDFIUM=TRUE
10404     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10405     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10406 else
10407     AC_MSG_RESULT([no])
10409 AC_SUBST(ENABLE_PDFIUM)
10411 SYSTEM_GPGMEPP=
10412 if test "$_os" = "Linux"; then
10413     dnl ===================================================================
10414     dnl Check for system gpgme
10415     dnl ===================================================================
10416     AC_MSG_CHECKING([which gpgmepp to use])
10417     if test "$with_system_gpgmepp" = "yes"; then
10418         AC_MSG_RESULT([external])
10419         SYSTEM_GPGMEPP=TRUE
10421         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10422         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10423             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10424         # progress_callback is the only func with plain C linkage
10425         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10426         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10427             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10428         AC_CHECK_HEADER(gpgme.h, [],
10429             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10430     else
10431         AC_MSG_RESULT([internal])
10432         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10434         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10435         GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10436         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10437         LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10438     fi
10440 AC_SUBST(SYSTEM_GPGMEPP)
10441 AC_SUBST(GPG_ERROR_CFLAGS)
10442 AC_SUBST(GPG_ERROR_LIBS)
10443 AC_SUBST(LIBASSUAN_CFLAGS)
10444 AC_SUBST(LIBASSUAN_LIBS)
10445 AC_SUBST(GPGMEPP_CFLAGS)
10446 AC_SUBST(GPGMEPP_LIBS)
10448 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10449 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10450     AC_MSG_RESULT([yes])
10451     ENABLE_MEDIAWIKI=TRUE
10452     BUILD_TYPE="$BUILD_TYPE XSLTML"
10453     if test  "x$with_java" = "xno"; then
10454         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10455     fi
10456 else
10457     AC_MSG_RESULT([no])
10458     ENABLE_MEDIAWIKI=
10459     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10461 AC_SUBST(ENABLE_MEDIAWIKI)
10463 AC_MSG_CHECKING([whether to build the Report Builder])
10464 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10465     AC_MSG_RESULT([yes])
10466     ENABLE_REPORTBUILDER=TRUE
10467     AC_MSG_CHECKING([which jfreereport libs to use])
10468     if test "$with_system_jfreereport" = "yes"; then
10469         SYSTEM_JFREEREPORT=TRUE
10470         AC_MSG_RESULT([external])
10471         if test -z $SAC_JAR; then
10472             SAC_JAR=/usr/share/java/sac.jar
10473         fi
10474         if ! test -f $SAC_JAR; then
10475              AC_MSG_ERROR(sac.jar not found.)
10476         fi
10478         if test -z $LIBXML_JAR; then
10479             if test -f /usr/share/java/libxml-1.0.0.jar; then
10480                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10481             elif test -f /usr/share/java/libxml.jar; then
10482                 LIBXML_JAR=/usr/share/java/libxml.jar
10483             else
10484                 AC_MSG_ERROR(libxml.jar replacement not found.)
10485             fi
10486         elif ! test -f $LIBXML_JAR; then
10487             AC_MSG_ERROR(libxml.jar not found.)
10488         fi
10490         if test -z $FLUTE_JAR; then
10491             if test -f/usr/share/java/flute-1.3.0.jar; then
10492                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10493             elif test -f /usr/share/java/flute.jar; then
10494                 FLUTE_JAR=/usr/share/java/flute.jar
10495             else
10496                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10497             fi
10498         elif ! test -f $FLUTE_JAR; then
10499             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10500         fi
10502         if test -z $JFREEREPORT_JAR; then
10503             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10504                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10505             elif test -f /usr/share/java/flow-engine.jar; then
10506                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10507             else
10508                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10509             fi
10510         elif ! test -f  $JFREEREPORT_JAR; then
10511                 AC_MSG_ERROR(jfreereport.jar not found.)
10512         fi
10514         if test -z $LIBLAYOUT_JAR; then
10515             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10516                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10517             elif test -f /usr/share/java/liblayout.jar; then
10518                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10519             else
10520                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10521             fi
10522         elif ! test -f $LIBLAYOUT_JAR; then
10523                 AC_MSG_ERROR(liblayout.jar not found.)
10524         fi
10526         if test -z $LIBLOADER_JAR; then
10527             if test -f /usr/share/java/libloader-1.0.0.jar; then
10528                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10529             elif test -f /usr/share/java/libloader.jar; then
10530                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10531             else
10532                 AC_MSG_ERROR(libloader.jar replacement not found.)
10533             fi
10534         elif ! test -f  $LIBLOADER_JAR; then
10535             AC_MSG_ERROR(libloader.jar not found.)
10536         fi
10538         if test -z $LIBFORMULA_JAR; then
10539             if test -f /usr/share/java/libformula-0.2.0.jar; then
10540                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10541             elif test -f /usr/share/java/libformula.jar; then
10542                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10543             else
10544                 AC_MSG_ERROR(libformula.jar replacement not found.)
10545             fi
10546         elif ! test -f $LIBFORMULA_JAR; then
10547                 AC_MSG_ERROR(libformula.jar not found.)
10548         fi
10550         if test -z $LIBREPOSITORY_JAR; then
10551             if test -f /usr/share/java/librepository-1.0.0.jar; then
10552                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10553             elif test -f /usr/share/java/librepository.jar; then
10554                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10555             else
10556                 AC_MSG_ERROR(librepository.jar replacement not found.)
10557             fi
10558         elif ! test -f $LIBREPOSITORY_JAR; then
10559             AC_MSG_ERROR(librepository.jar not found.)
10560         fi
10562         if test -z $LIBFONTS_JAR; then
10563             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10564                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10565             elif test -f /usr/share/java/libfonts.jar; then
10566                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10567             else
10568                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10569             fi
10570         elif ! test -f $LIBFONTS_JAR; then
10571                 AC_MSG_ERROR(libfonts.jar not found.)
10572         fi
10574         if test -z $LIBSERIALIZER_JAR; then
10575             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10576                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10577             elif test -f /usr/share/java/libserializer.jar; then
10578                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10579             else
10580                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10581             fi
10582         elif ! test -f $LIBSERIALIZER_JAR; then
10583                 AC_MSG_ERROR(libserializer.jar not found.)
10584         fi
10586         if test -z $LIBBASE_JAR; then
10587             if test -f /usr/share/java/libbase-1.0.0.jar; then
10588                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10589             elif test -f /usr/share/java/libbase.jar; then
10590                 LIBBASE_JAR=/usr/share/java/libbase.jar
10591             else
10592                 AC_MSG_ERROR(libbase.jar replacement not found.)
10593             fi
10594         elif ! test -f $LIBBASE_JAR; then
10595             AC_MSG_ERROR(libbase.jar not found.)
10596         fi
10598     else
10599         AC_MSG_RESULT([internal])
10600         SYSTEM_JFREEREPORT=
10601         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10602     fi
10603 else
10604     AC_MSG_RESULT([no])
10605     ENABLE_REPORTBUILDER=
10606     SYSTEM_JFREEREPORT=
10608 AC_SUBST(ENABLE_REPORTBUILDER)
10609 AC_SUBST(SYSTEM_JFREEREPORT)
10610 AC_SUBST(SAC_JAR)
10611 AC_SUBST(LIBXML_JAR)
10612 AC_SUBST(FLUTE_JAR)
10613 AC_SUBST(JFREEREPORT_JAR)
10614 AC_SUBST(LIBBASE_JAR)
10615 AC_SUBST(LIBLAYOUT_JAR)
10616 AC_SUBST(LIBLOADER_JAR)
10617 AC_SUBST(LIBFORMULA_JAR)
10618 AC_SUBST(LIBREPOSITORY_JAR)
10619 AC_SUBST(LIBFONTS_JAR)
10620 AC_SUBST(LIBSERIALIZER_JAR)
10622 # this has to be here because both the Wiki Publisher and the SRB use
10623 # commons-logging
10624 COMMONS_LOGGING_VERSION=1.2
10625 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10626     AC_MSG_CHECKING([which Apache commons-* libs to use])
10627     if test "$with_system_apache_commons" = "yes"; then
10628         SYSTEM_APACHE_COMMONS=TRUE
10629         AC_MSG_RESULT([external])
10630         if test -z $COMMONS_LOGGING_JAR; then
10631             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10632                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10633            elif test -f /usr/share/java/commons-logging.jar; then
10634                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10635             else
10636                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10637             fi
10638         elif ! test -f $COMMONS_LOGGING_JAR; then
10639             AC_MSG_ERROR(commons-logging.jar not found.)
10640         fi
10641     else
10642         AC_MSG_RESULT([internal])
10643         SYSTEM_APACHE_COMMONS=
10644         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10645     fi
10647 AC_SUBST(SYSTEM_APACHE_COMMONS)
10648 AC_SUBST(COMMONS_LOGGING_JAR)
10649 AC_SUBST(COMMONS_LOGGING_VERSION)
10651 # scripting provider for BeanShell?
10652 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10653 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10654     AC_MSG_RESULT([yes])
10655     ENABLE_SCRIPTING_BEANSHELL=TRUE
10657     dnl ===================================================================
10658     dnl Check for system beanshell
10659     dnl ===================================================================
10660     AC_MSG_CHECKING([which beanshell to use])
10661     if test "$with_system_beanshell" = "yes"; then
10662         AC_MSG_RESULT([external])
10663         SYSTEM_BSH=TRUE
10664         if test -z $BSH_JAR; then
10665             BSH_JAR=/usr/share/java/bsh.jar
10666         fi
10667         if ! test -f $BSH_JAR; then
10668             AC_MSG_ERROR(bsh.jar not found.)
10669         fi
10670     else
10671         AC_MSG_RESULT([internal])
10672         SYSTEM_BSH=
10673         BUILD_TYPE="$BUILD_TYPE BSH"
10674     fi
10675 else
10676     AC_MSG_RESULT([no])
10677     ENABLE_SCRIPTING_BEANSHELL=
10678     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10680 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10681 AC_SUBST(SYSTEM_BSH)
10682 AC_SUBST(BSH_JAR)
10684 # scripting provider for JavaScript?
10685 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10686 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10687     AC_MSG_RESULT([yes])
10688     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10690     dnl ===================================================================
10691     dnl Check for system rhino
10692     dnl ===================================================================
10693     AC_MSG_CHECKING([which rhino to use])
10694     if test "$with_system_rhino" = "yes"; then
10695         AC_MSG_RESULT([external])
10696         SYSTEM_RHINO=TRUE
10697         if test -z $RHINO_JAR; then
10698             RHINO_JAR=/usr/share/java/js.jar
10699         fi
10700         if ! test -f $RHINO_JAR; then
10701             AC_MSG_ERROR(js.jar not found.)
10702         fi
10703     else
10704         AC_MSG_RESULT([internal])
10705         SYSTEM_RHINO=
10706         BUILD_TYPE="$BUILD_TYPE RHINO"
10707     fi
10708 else
10709     AC_MSG_RESULT([no])
10710     ENABLE_SCRIPTING_JAVASCRIPT=
10711     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10713 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10714 AC_SUBST(SYSTEM_RHINO)
10715 AC_SUBST(RHINO_JAR)
10717 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10718 # paths should be added to library search path. So lets put all 64-bit
10719 # platforms there.
10720 supports_multilib=
10721 case "$host_cpu" in
10722 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10723     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10724         supports_multilib="yes"
10725     fi
10726     ;;
10728     ;;
10729 esac
10731 dnl ===================================================================
10732 dnl Check whether the TQt and TDE libraries are available.
10733 dnl ===================================================================
10735 TDE_CFLAGS=""
10736 TDE_LIBS=""
10737 if test "$_os" != "OpenBSD"; then
10738     TDE_MOC="moc"
10740 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10741     dnl Search paths for TQt and TDE
10742     if test -z "$supports_multilib"; then
10743         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"
10744         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"
10745     else
10746         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"
10747         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"
10748     fi
10749     if test -n "$TQTDIR"; then
10750         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10751         if test -z "$supports_multilib"; then
10752             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10753         else
10754             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10755         fi
10756     fi
10757     if test -z "$supports_multilib"; then
10758         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"
10759         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"
10760     else
10761         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"
10762         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"
10763     fi
10764     if test -n "$TDEDIR"; then
10765         tde_incdirs="$TDEDIR/include $tde_incdirs"
10766         if test -z "$supports_multilib"; then
10767             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10768         else
10769             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10770         fi
10771     fi
10773     dnl What to test
10774     tqt_test_include="ntqstyle.h"
10775     tde_test_include="kapp.h"
10777     if test "$_os" != "OpenBSD"; then
10778         tqt_test_library="libtqt-mt.so"
10779         tde_test_library="libDCOP.so"
10780     else
10781         tqt_test_library="libtqt-mt.so*"
10782         tde_test_library="libDCOP.so*"
10783     fi
10785     dnl Check for TQt headers
10786     AC_MSG_CHECKING([for TQt headers])
10787     tqt_incdir="no"
10788     for tde_check in $tqt_incdirs; do
10789         if test -r "$tde_check/$tqt_test_include"; then
10790             tqt_incdir="$tde_check"
10791             break
10792         fi
10793     done
10794     AC_MSG_RESULT([$tqt_incdir])
10795     if test "x$tqt_incdir" = "xno"; then
10796         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10797 your TQt installation by exporting TQTDIR before running "configure".])
10798     fi
10800     dnl Check for TQt libraries
10801     AC_MSG_CHECKING([for TQt libraries])
10802     tqt_libdir="no"
10803     for tqt_check in $tqt_libdirs; do
10804         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10805             tqt_libdir="$tqt_check"
10806             break
10807         fi
10808     done
10809     AC_MSG_RESULT([$tqt_libdir])
10810     if test "x$tqt_libdir" = "xno"; then
10811         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10812 your TQt installation by exporting TQTDIR before running "configure".])
10813     fi
10815     dnl Check for Meta Object Compiler
10816     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10817     if test "$MOC" = "no"; then
10818         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10819 the root of your TQt installation by exporting TQTDIR before running "configure".])
10820     fi
10822     dnl Check for TDE headers
10823     AC_MSG_CHECKING([for TDE headers])
10824     tde_incdir="no"
10825     for tde_check in $tde_incdirs; do
10826         if test -r "$tde_check/$tde_test_include"; then
10827             tde_incdir="$tde_check"
10828             break
10829         fi
10830     done
10831     AC_MSG_RESULT([$tde_incdir])
10832     if test "x$tde_incdir" = "xno"; then
10833         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10834 your TDE installation by exporting TDEDIR before running "configure".])
10835     fi
10837     dnl Check for TDE libraries
10838     AC_MSG_CHECKING([for TDE libraries])
10839     tde_libdir="no"
10840     for tde_check in $tde_libdirs; do
10841         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10842             tde_libdir="$tde_check"
10843             break
10844         fi
10845     done
10846     AC_MSG_RESULT([$tde_libdir])
10847     if test "x$tde_libdir" = "xno"; then
10848         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10849 your TDE installation by exporting TDEDIR before running "configure".])
10850     fi
10852     dnl Set the variables
10853     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10854     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10856 AC_SUBST(TDE_CFLAGS)
10857 AC_SUBST(TDE_LIBS)
10858 AC_SUBST(TDE_MOC)
10860 dnl ===================================================================
10861 dnl KDE4 Integration
10862 dnl ===================================================================
10864 KDE4_CFLAGS=""
10865 KDE4_LIBS=""
10866 QMAKE4="qmake"
10867 MOC4="moc"
10868 KDE4_GLIB_CFLAGS=""
10869 KDE4_GLIB_LIBS=""
10870 KDE4_HAVE_GLIB=""
10871 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10872     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10873     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10875     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10876     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10878     if test -n "$supports_multilib"; then
10879         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10880         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10881     fi
10883     if test -n "$QTDIR"; then
10884         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10885         if test -z "$supports_multilib"; then
10886             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10887         else
10888             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10889         fi
10890     fi
10891     if test -n "$QT4DIR"; then
10892         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10893         if test -z "$supports_multilib"; then
10894             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10895         else
10896             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10897         fi
10898     fi
10900     if test -n "$KDEDIR"; then
10901         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10902         if test -z "$supports_multilib"; then
10903             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10904         else
10905             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10906         fi
10907     fi
10908     if test -n "$KDE4DIR"; then
10909         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10910         if test -z "$supports_multilib"; then
10911             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10912         else
10913             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10914         fi
10915     fi
10917     qt4_test_include="Qt/qobject.h"
10918     qt4_test_library="libQtNetwork.so"
10919     kde4_test_include="kwindowsystem.h"
10920     kde4_test_library="libsolid.so"
10922     AC_MSG_CHECKING([for Qt4 headers])
10923     qt4_header_dir="no"
10924     for inc_dir in $qt4_incdirs; do
10925         if test -r "$inc_dir/$qt4_test_include"; then
10926             qt4_header_dir="$inc_dir"
10927             break
10928         fi
10929     done
10931     AC_MSG_RESULT([$qt4_header_dir])
10932     if test "x$qt4_header_dir" = "xno"; then
10933         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10934     fi
10936     dnl Check for qmake
10937     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10938     QMAKE4="$QMAKEQT4"
10939     if test "$QMAKE4" = "no"; then
10940         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10941         if test "$QMAKE4" = "no"; then
10942             AC_MSG_ERROR([Qmake not found.  Please specify
10943 the root of your Qt installation by exporting QT4DIR before running "configure".])
10944         fi
10945     fi
10947     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10948     AC_MSG_CHECKING([for Qt4 libraries])
10949     qt4_lib_dir="no"
10950     for lib_dir in $qt4_libdirs; do
10951         if test -r "$lib_dir/$qt4_test_library"; then
10952             qt4_lib_dir="$lib_dir"
10953             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10954             break
10955         fi
10956     done
10958     AC_MSG_RESULT([$qt4_lib_dir])
10960     if test "x$qt4_lib_dir" = "xno"; then
10961         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10962     fi
10964     dnl Check for Meta Object Compiler
10966     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10967     MOC4="$MOCQT4"
10968     if test "$MOC4" = "no"; then
10969         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10970         if test "$MOC4" = "no"; then
10971             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10972 the root of your Qt installation by exporting QT4DIR before running "configure".])
10973         fi
10974     fi
10976     dnl Check for KDE4 headers
10977     AC_MSG_CHECKING([for KDE4 headers])
10978     kde4_incdir="no"
10979     for kde4_check in $kde4_incdirs; do
10980         if test -r "$kde4_check/$kde4_test_include"; then
10981             kde4_incdir="$kde4_check"
10982             break
10983         fi
10984     done
10985     AC_MSG_RESULT([$kde4_incdir])
10986     if test "x$kde4_incdir" = "xno"; then
10987         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10988     fi
10989     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10991     dnl Check for KDE4 libraries
10992     AC_MSG_CHECKING([for KDE4 libraries])
10993     kde4_libdir="no"
10994     for kde4_check in $kde4_libdirs; do
10995         if test -r "$kde4_check/$kde4_test_library"; then
10996             kde4_libdir="$kde4_check"
10997             break
10998         fi
10999     done
11001     AC_MSG_RESULT([$kde4_libdir])
11002     if test "x$kde4_libdir" = "xno"; then
11003         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11004     fi
11006     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11007     if ! test -z "$kde4_incdir"; then
11008         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11009     else
11010         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11011     fi
11013     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11014     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11015     FilterLibs "$KDE4_LIBS"
11016     KDE4_LIBS="$filteredlibs"
11018     AC_LANG_PUSH([C++])
11019     save_CXXFLAGS=$CXXFLAGS
11020     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11021     AC_MSG_CHECKING([whether KDE is >= 4.2])
11022        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11023 #include <kdeversion.h>
11025 int main(int argc, char **argv) {
11026        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11027        else return 1;
11029 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11030     CXXFLAGS=$save_CXXFLAGS
11031     AC_LANG_POP([C++])
11033     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11034     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11035     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11036         [
11037             KDE4_HAVE_GLIB=TRUE
11038             AC_DEFINE(KDE4_HAVE_GLIB,1)
11039             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11040             FilterLibs "${KDE4_GLIB_LIBS}"
11041             KDE4_GLIB_LIBS="${filteredlibs}"
11043             qt4_fix_warning=
11045             AC_LANG_PUSH([C++])
11046             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11047             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11048             #  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
11049             #               ^~~~~~~~~~~~~~~~~~~~~~~
11050             #               vptr for 'QObjectPrivate'
11051             save_CXX=$CXX
11052             CXX=$(printf %s "$CXX" \
11053                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11054             save_CXXFLAGS=$CXXFLAGS
11055             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11056             save_LIBS=$LIBS
11057             LIBS="$LIBS $KDE4_LIBS"
11058             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11060             # Prepare meta object data
11061             TSTBASE="tst_exclude_socket_notifiers"
11062             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11063             ln -fs "${TSTMOC}.hxx"
11064             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11066             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11067 #include <cstdlib>
11068 #include "tst_exclude_socket_notifiers.moc"
11070 int main(int argc, char *argv[])
11072     QCoreApplication app(argc, argv);
11073     exit(tst_processEventsExcludeSocket());
11074     return 0;
11076             ]])],[
11077                 AC_MSG_RESULT([yes])
11078             ],[
11079                 AC_MSG_RESULT([no])
11080                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11081                 if test -z "$qt4_fix_warning"; then
11082                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11083                 fi
11084                 qt4_fix_warning=1
11085                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11086                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11088             # Remove meta object data
11089             rm -f "${TSTBASE}."*
11091             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11093             # Prepare meta object data
11094             TSTBASE="tst_exclude_posted_events"
11095             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11096             ln -fs "${TSTMOC}.hxx"
11097             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11099             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11100 #include <cstdlib>
11101 #include "tst_exclude_posted_events.moc"
11103 int main(int argc, char *argv[])
11105     QCoreApplication app(argc, argv);
11106     exit(tst_excludePostedEvents());
11107     return 0;
11109             ]])],[
11110                 AC_MSG_RESULT([yes])
11111             ],[
11112                 AC_MSG_RESULT([no])
11113                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11114                 if test -z "$qt4_fix_warning"; then
11115                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11116                 fi
11117                 qt4_fix_warning=1
11118                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11119             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11121             # Remove meta object data
11122             rm -f "${TSTBASE}."*
11124             if test -n "$qt4_fix_warning"; then
11125                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11126             fi
11128             LIBS=$save_LIBS
11129             CXXFLAGS=$save_CXXFLAGS
11130             CXX=$save_CXX
11131             AC_LANG_POP([C++])
11132         ],
11133         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11135 AC_SUBST(KDE4_CFLAGS)
11136 AC_SUBST(KDE4_LIBS)
11137 AC_SUBST(MOC4)
11138 AC_SUBST(KDE4_GLIB_CFLAGS)
11139 AC_SUBST(KDE4_GLIB_LIBS)
11140 AC_SUBST(KDE4_HAVE_GLIB)
11142 dnl ===================================================================
11143 dnl Test whether to include Evolution 2 support
11144 dnl ===================================================================
11145 AC_MSG_CHECKING([whether to enable evolution 2 support])
11146 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11147     AC_MSG_RESULT([yes])
11148     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11149     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11150     FilterLibs "${GOBJECT_LIBS}"
11151     GOBJECT_LIBS="${filteredlibs}"
11152     ENABLE_EVOAB2="TRUE"
11153 else
11154     ENABLE_EVOAB2=""
11155     AC_MSG_RESULT([no])
11157 AC_SUBST(ENABLE_EVOAB2)
11158 AC_SUBST(GOBJECT_CFLAGS)
11159 AC_SUBST(GOBJECT_LIBS)
11161 dnl ===================================================================
11162 dnl Test whether to include TDE AB support
11163 dnl ===================================================================
11164 AC_MSG_CHECKING([whether to enable TDE address book support])
11165 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11166     AC_MSG_RESULT([yes])
11167     AC_LANG_PUSH([C++])
11168     save_CXXFLAGS=$CXXFLAGS
11169     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11170     AC_MSG_CHECKING([whether TDE is at least R14.0])
11171        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11172 #include <tdeversion.h>
11174 int main(int argc, char **argv) {
11175        if (TDE_VERSION_MAJOR >= 14) return 0;
11176        else return 1;
11178        ]])],[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])],
11179        [AC_MSG_ERROR([TDE support not tested with cross compilation])])
11180     CXXFLAGS=$save_CXXFLAGS
11181     AC_LANG_POP([C++])
11182     ENABLE_TDEAB=TRUE
11183 else
11184     AC_MSG_RESULT([no])
11185     ENABLE_TDEAB=
11187 AC_SUBST(ENABLE_TDEAB)
11189 dnl ===================================================================
11190 dnl Test which themes to include
11191 dnl ===================================================================
11192 AC_MSG_CHECKING([which themes to include])
11193 # if none given use default subset of available themes
11194 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11195     with_theme="breeze breeze_dark galaxy hicontrast sifr sifr_dark tango"
11196     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11199 WITH_THEMES=""
11200 if test "x$with_theme" != "xno"; then
11201     for theme in $with_theme; do
11202         case $theme in
11203         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|sifr_dark|tango|tango_testing) real_theme="$theme" ;;
11204         default) real_theme=galaxy ;;
11205         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11206         esac
11207         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11208     done
11210 AC_MSG_RESULT([$WITH_THEMES])
11211 AC_SUBST([WITH_THEMES])
11212 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11213 for theme in $with_theme; do
11214     case $theme in
11215     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11216     *) ;;
11217     esac
11218 done
11220 dnl ===================================================================
11221 dnl Test whether to integrate helppacks into the product's installer
11222 dnl ===================================================================
11223 AC_MSG_CHECKING([for helppack integration])
11224 if test "$with_helppack_integration" = "no"; then
11225     WITH_HELPPACK_INTEGRATION=
11226     AC_MSG_RESULT([no integration])
11227 else
11228     WITH_HELPPACK_INTEGRATION=TRUE
11229     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11230     AC_MSG_RESULT([integration])
11232 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11234 ###############################################################################
11235 # Extensions checking
11236 ###############################################################################
11237 AC_MSG_CHECKING([for extensions integration])
11238 if test "x$enable_extension_integration" != "xno"; then
11239     WITH_EXTENSION_INTEGRATION=TRUE
11240     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11241     AC_MSG_RESULT([yes, use integration])
11242 else
11243     WITH_EXTENSION_INTEGRATION=
11244     AC_MSG_RESULT([no, do not integrate])
11246 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11248 dnl Should any extra extensions be included?
11249 dnl There are standalone tests for each of these below.
11250 WITH_EXTRA_EXTENSIONS=
11251 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11253 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11254 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11255 if test "x$with_java" != "xno"; then
11256     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11257     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11260 TEST_FONTS_MISSING=0
11262 # $1  = font family
11263 # $2+ = accepted font mappings
11264 test_font_map()
11266     FONT="$1" ; shift
11267     AC_MSG_CHECKING([font mapping for '$FONT'])
11268     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11269     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11271     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11272     while test "$#" -ge 1 ; do
11273         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11274         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11275     done
11276     if test $TESTEXPR
11277     then
11278         AC_MSG_RESULT([ok])
11279     else
11280         AC_MSG_WARN([unknown ($FONTFILE)])
11281         add_warning "unknown ($FONTFILE)"
11282         TEST_FONTS_MISSING=1
11283     fi
11286 dnl ===================================================================
11287 dnl Test whether to include fonts
11288 dnl ===================================================================
11289 AC_MSG_CHECKING([whether to include third-party fonts])
11290 if test "$with_fonts" != "no"; then
11291     AC_MSG_RESULT([yes])
11292     WITH_FONTS=TRUE
11293     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11294     AC_DEFINE(HAVE_MORE_FONTS)
11295 else
11296     AC_MSG_RESULT([no])
11297     WITH_FONTS=
11298     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11299     if test "$test_fontconfig" = "yes"; then
11300         AC_PATH_PROG([FCMATCH], [fc-match])
11301         if test -z "$FCMATCH"; then
11302             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11303             TEST_FONTS_MISSING=1
11304         else
11305             test_font_map 'Calibri' 'Carlito'
11306             test_font_map 'DejaVuSans' 'DejaVuSans'
11307             if test ${TEST_FONTS_MISSING} -eq 1
11308             then
11309                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11310                 add_warning "Unknown font mappings - unit tests disabled."
11311             fi
11312         fi
11313     else
11314         TEST_FONTS_MISSING=0
11315     fi
11317 AC_SUBST(WITH_FONTS)
11318 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11321 dnl ===================================================================
11322 dnl Test whether to enable online update service
11323 dnl ===================================================================
11324 AC_MSG_CHECKING([whether to enable online update])
11325 ENABLE_ONLINE_UPDATE=
11326 ENABLE_ONLINE_UPDATE_MAR=
11327 if test "$enable_online_update" = ""; then
11328     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11329         AC_MSG_RESULT([yes])
11330         ENABLE_ONLINE_UPDATE="TRUE"
11331     else
11332         AC_MSG_RESULT([no])
11333     fi
11334 else
11335     if test "$enable_online_update" = "mar"; then
11336         AC_MSG_RESULT([yes - MAR-based online update])
11337         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11338     elif test "$enable_online_update" = "yes"; then
11339         AC_MSG_RESULT([yes])
11340         ENABLE_ONLINE_UPDATE="TRUE"
11341     else
11342         AC_MSG_RESULT([no])
11343     fi
11345 AC_SUBST(ENABLE_ONLINE_UPDATE)
11346 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11348 dnl ===================================================================
11349 dnl Test whether we need bzip2
11350 dnl ===================================================================
11351 SYSTEM_BZIP2=
11352 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11353     AC_MSG_CHECKING([whether to use system bzip2])
11354     if test "$with_system_bzip2" = yes; then
11355         SYSTEM_BZIP2=TRUE
11356         AC_MSG_RESULT([yes])
11357         PKG_CHECK_MODULES(BZIP2, bzip2)
11358         FilterLibs "${BZIP2_LIBS}"
11359         BZIP2_LIBS="${filteredlibs}"
11360     else
11361         AC_MSG_RESULT([no])
11362         BUILD_TYPE="$BUILD_TYPE BZIP2"
11363     fi
11365 AC_SUBST(SYSTEM_BZIP2)
11366 AC_SUBST(BZIP2_CFLAGS)
11367 AC_SUBST(BZIP2_LIBS)
11369 dnl ===================================================================
11370 dnl Test whether to enable extension update
11371 dnl ===================================================================
11372 AC_MSG_CHECKING([whether to enable extension update])
11373 ENABLE_EXTENSION_UPDATE=
11374 if test "x$enable_extension_update" = "xno"; then
11375     AC_MSG_RESULT([no])
11376 else
11377     AC_MSG_RESULT([yes])
11378     ENABLE_EXTENSION_UPDATE="TRUE"
11379     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11380     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11382 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11385 dnl ===================================================================
11386 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11387 dnl ===================================================================
11388 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11389 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11390     AC_MSG_RESULT([no])
11391     ENABLE_SILENT_MSI=
11392 else
11393     AC_MSG_RESULT([yes])
11394     ENABLE_SILENT_MSI=TRUE
11395     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11397 AC_SUBST(ENABLE_SILENT_MSI)
11399 AC_MSG_CHECKING([whether and how to use Xinerama])
11400 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11401     if test "$x_libraries" = "default_x_libraries"; then
11402         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11403         if test "x$XINERAMALIB" = x; then
11404            XINERAMALIB="/usr/lib"
11405         fi
11406     else
11407         XINERAMALIB="$x_libraries"
11408     fi
11409     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11410         # we have both versions, let the user decide but use the dynamic one
11411         # per default
11412         USE_XINERAMA=TRUE
11413         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11414             XINERAMA_LINK=dynamic
11415         else
11416             XINERAMA_LINK=static
11417         fi
11418     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11419         # we have only the dynamic version
11420         USE_XINERAMA=TRUE
11421         XINERAMA_LINK=dynamic
11422     elif test -e "$XINERAMALIB/libXinerama.a"; then
11423         # static version
11424         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11425             USE_XINERAMA=TRUE
11426             XINERAMA_LINK=static
11427         else
11428             USE_XINERAMA=
11429             XINERAMA_LINK=none
11430         fi
11431     else
11432         # no Xinerama
11433         USE_XINERAMA=
11434         XINERAMA_LINK=none
11435     fi
11436     if test "$USE_XINERAMA" = "TRUE"; then
11437         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11438         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11439             [AC_MSG_ERROR(Xinerama header not found.)], [])
11440         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11441         if test "x$XEXTLIB" = x; then
11442            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11443         fi
11444         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11445         if test "$_os" = "FreeBSD"; then
11446             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11447         fi
11448         if test "$_os" = "Linux"; then
11449             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11450         fi
11451         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11452             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11453     else
11454         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11455     fi
11456 else
11457     USE_XINERAMA=
11458     XINERAMA_LINK=none
11459     AC_MSG_RESULT([no])
11461 AC_SUBST(USE_XINERAMA)
11462 AC_SUBST(XINERAMA_LINK)
11464 dnl ===================================================================
11465 dnl Test whether to build cairo or rely on the system version
11466 dnl ===================================================================
11468 if test "$USING_X11" = TRUE; then
11469     # Used in vcl/Library_vclplug_gen.mk
11470     test_cairo=yes
11473 if test "$test_cairo" = "yes"; then
11474     AC_MSG_CHECKING([whether to use the system cairo])
11476     : ${with_system_cairo:=$with_system_libs}
11477     if test "$with_system_cairo" = "yes"; then
11478         SYSTEM_CAIRO=TRUE
11479         AC_MSG_RESULT([yes])
11481         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11482         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11483         FilterLibs "${CAIRO_LIBS}"
11484         CAIRO_LIBS="${filteredlibs}"
11486         if test "$test_xrender" = "yes"; then
11487             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11488             AC_LANG_PUSH([C])
11489             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11490 #ifdef PictStandardA8
11491 #else
11492       return fail;
11493 #endif
11494 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11496             AC_LANG_POP([C])
11497         fi
11498     else
11499         SYSTEM_CAIRO=
11500         AC_MSG_RESULT([no])
11502         BUILD_TYPE="$BUILD_TYPE CAIRO"
11503     fi
11506 AC_SUBST(SYSTEM_CAIRO)
11507 AC_SUBST(CAIRO_CFLAGS)
11508 AC_SUBST(CAIRO_LIBS)
11510 dnl ===================================================================
11511 dnl Test whether to use avahi
11512 dnl ===================================================================
11513 if test "$_os" = "WINNT"; then
11514     # Windows uses bundled mDNSResponder
11515     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11516 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11517     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11518                       [ENABLE_AVAHI="TRUE"])
11519     AC_DEFINE(HAVE_FEATURE_AVAHI)
11520     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11521     FilterLibs "${AVAHI_LIBS}"
11522     AVAHI_LIBS="${filteredlibs}"
11525 AC_SUBST(ENABLE_AVAHI)
11526 AC_SUBST(AVAHI_CFLAGS)
11527 AC_SUBST(AVAHI_LIBS)
11529 dnl ===================================================================
11530 dnl Test whether to use liblangtag
11531 dnl ===================================================================
11532 SYSTEM_LIBLANGTAG=
11533 AC_MSG_CHECKING([whether to use system liblangtag])
11534 if test "$with_system_liblangtag" = yes; then
11535     SYSTEM_LIBLANGTAG=TRUE
11536     AC_MSG_RESULT([yes])
11537     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11538     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11539     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11540     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11541     FilterLibs "${LIBLANGTAG_LIBS}"
11542     LIBLANGTAG_LIBS="${filteredlibs}"
11543 else
11544     SYSTEM_LIBLANGTAG=
11545     AC_MSG_RESULT([no])
11546     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11547     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/langtag"
11548     if test "$COM" = "MSC"; then
11549         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11550     else
11551         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11552     fi
11554 AC_SUBST(SYSTEM_LIBLANGTAG)
11555 AC_SUBST(LIBLANGTAG_CFLAGS)
11556 AC_SUBST(LIBLANGTAG_LIBS)
11558 dnl ===================================================================
11559 dnl Test whether to build libpng or rely on the system version
11560 dnl ===================================================================
11562 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11564 dnl ===================================================================
11565 dnl Check for runtime JVM search path
11566 dnl ===================================================================
11567 if test "$ENABLE_JAVA" != ""; then
11568     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11569     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11570         AC_MSG_RESULT([yes])
11571         if ! test -d "$with_jvm_path"; then
11572             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11573         fi
11574         if ! test -d "$with_jvm_path"jvm; then
11575             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11576         fi
11577         JVM_ONE_PATH_CHECK="$with_jvm_path"
11578         AC_SUBST(JVM_ONE_PATH_CHECK)
11579     else
11580         AC_MSG_RESULT([no])
11581     fi
11584 dnl ===================================================================
11585 dnl Test for the presence of Ant and that it works
11586 dnl ===================================================================
11588 if test "$ENABLE_JAVA" != ""; then
11589     ANT_HOME=; export ANT_HOME
11590     WITH_ANT_HOME=; export WITH_ANT_HOME
11591     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11592         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11593             if test "$_os" = "WINNT"; then
11594                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11595             else
11596                 with_ant_home="$LODE_HOME/opt/ant"
11597             fi
11598         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11599             with_ant_home="$LODE_HOME/opt/ant"
11600         fi
11601     fi
11602     if test -z "$with_ant_home"; then
11603         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11604     else
11605         if test "$_os" = "WINNT"; then
11606             # AC_PATH_PROGS needs unix path
11607             with_ant_home=`cygpath -u "$with_ant_home"`
11608         fi
11609         AbsolutePath "$with_ant_home"
11610         with_ant_home=$absolute_path
11611         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11612         WITH_ANT_HOME=$with_ant_home
11613         ANT_HOME=$with_ant_home
11614     fi
11616     if test -z "$ANT"; then
11617         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11618     else
11619         # resolve relative or absolute symlink
11620         while test -h "$ANT"; do
11621             a_cwd=`pwd`
11622             a_basename=`basename "$ANT"`
11623             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11624             cd "`dirname "$ANT"`"
11625             cd "`dirname "$a_script"`"
11626             ANT="`pwd`"/"`basename "$a_script"`"
11627             cd "$a_cwd"
11628         done
11630         AC_MSG_CHECKING([if $ANT works])
11631         cat > conftest.java << EOF
11632         public class conftest {
11633             int testmethod(int a, int b) {
11634                     return a + b;
11635             }
11636         }
11639         cat > conftest.xml << EOF
11640         <project name="conftest" default="conftest">
11641         <target name="conftest">
11642             <javac srcdir="." includes="conftest.java">
11643             </javac>
11644         </target>
11645         </project>
11648         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11649         if test $? = 0 -a -f ./conftest.class; then
11650             AC_MSG_RESULT([Ant works])
11651             if test -z "$WITH_ANT_HOME"; then
11652                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11653                 if test -z "$ANT_HOME"; then
11654                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11655                 fi
11656             else
11657                 ANT_HOME="$WITH_ANT_HOME"
11658             fi
11659         else
11660             echo "configure: Ant test failed" >&5
11661             cat conftest.java >&5
11662             cat conftest.xml >&5
11663             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11664         fi
11665         rm -f conftest* core core.* *.core
11666     fi
11667     if test -z "$ANT_HOME"; then
11668         ANT_HOME="NO_ANT_HOME"
11669     else
11670         PathFormat "$ANT_HOME"
11671         ANT_HOME="$formatted_path"
11672         PathFormat "$ANT"
11673         ANT="$formatted_path"
11674     fi
11675     AC_SUBST(ANT_HOME)
11676     AC_SUBST(ANT)
11678     dnl Checking for ant.jar
11679     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11680         AC_MSG_CHECKING([Ant lib directory])
11681         if test -f $ANT_HOME/lib/ant.jar; then
11682             ANT_LIB="$ANT_HOME/lib"
11683         else
11684             if test -f $ANT_HOME/ant.jar; then
11685                 ANT_LIB="$ANT_HOME"
11686             else
11687                 if test -f /usr/share/java/ant.jar; then
11688                     ANT_LIB=/usr/share/java
11689                 else
11690                     if test -f /usr/share/ant-core/lib/ant.jar; then
11691                         ANT_LIB=/usr/share/ant-core/lib
11692                     else
11693                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11694                             ANT_LIB="$ANT_HOME/lib/ant"
11695                         else
11696                             if test -f /usr/share/lib/ant/ant.jar; then
11697                                 ANT_LIB=/usr/share/lib/ant
11698                             else
11699                                 AC_MSG_ERROR([Ant libraries not found!])
11700                             fi
11701                         fi
11702                     fi
11703                 fi
11704             fi
11705         fi
11706         PathFormat "$ANT_LIB"
11707         ANT_LIB="$formatted_path"
11708         AC_MSG_RESULT([Ant lib directory found.])
11709     fi
11710     AC_SUBST(ANT_LIB)
11712     ant_minver=1.6.0
11713     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11715     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11716     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11717     ant_version_major=`echo $ant_version | cut -d. -f1`
11718     ant_version_minor=`echo $ant_version | cut -d. -f2`
11719     echo "configure: ant_version $ant_version " >&5
11720     echo "configure: ant_version_major $ant_version_major " >&5
11721     echo "configure: ant_version_minor $ant_version_minor " >&5
11722     if test "$ant_version_major" -ge "2"; then
11723         AC_MSG_RESULT([yes, $ant_version])
11724     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11725         AC_MSG_RESULT([yes, $ant_version])
11726     else
11727         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11728     fi
11730     rm -f conftest* core core.* *.core
11733 OOO_JUNIT_JAR=
11734 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11735     AC_MSG_CHECKING([for JUnit 4])
11736     if test "$with_junit" = "yes"; then
11737         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11738             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11739         elif test -e /usr/share/java/junit4.jar; then
11740             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11741         else
11742            if test -e /usr/share/lib/java/junit.jar; then
11743               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11744            else
11745               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11746            fi
11747         fi
11748     else
11749         OOO_JUNIT_JAR=$with_junit
11750     fi
11751     if test "$_os" = "WINNT"; then
11752         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11753     fi
11754     printf 'import org.junit.Before;' > conftest.java
11755     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11756         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11757     else
11758         AC_MSG_ERROR(
11759 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11760  specify its pathname via --with-junit=..., or disable it via --without-junit])
11761     fi
11762     rm -f conftest.class conftest.java
11763     if test $OOO_JUNIT_JAR != ""; then
11764     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11765     fi
11767 AC_SUBST(OOO_JUNIT_JAR)
11769 HAMCREST_JAR=
11770 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11771     AC_MSG_CHECKING([for included Hamcrest])
11772     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11773     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11774         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11775     else
11776         AC_MSG_RESULT([Not included])
11777         AC_MSG_CHECKING([for standalone hamcrest jar.])
11778         if test "$with_hamcrest" = "yes"; then
11779             if test -e /usr/share/lib/java/hamcrest.jar; then
11780                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11781             elif test -e /usr/share/java/hamcrest/core.jar; then
11782                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11783             else
11784                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11785             fi
11786         else
11787             HAMCREST_JAR=$with_hamcrest
11788         fi
11789         if test "$_os" = "WINNT"; then
11790             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11791         fi
11792         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11793             AC_MSG_RESULT([$HAMCREST_JAR])
11794         else
11795             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),
11796                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11797         fi
11798     fi
11799     rm -f conftest.class conftest.java
11801 AC_SUBST(HAMCREST_JAR)
11804 AC_SUBST(SCPDEFS)
11807 # check for wget and curl
11809 WGET=
11810 CURL=
11812 if test "$enable_fetch_external" != "no"; then
11814 CURL=`which curl 2>/dev/null`
11816 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11817     # wget new enough?
11818     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11819     if test $? -eq 0; then
11820         WGET=$i
11821         break
11822     fi
11823 done
11825 if test -z "$WGET" -a -z "$CURL"; then
11826     AC_MSG_ERROR([neither wget nor curl found!])
11831 AC_SUBST(WGET)
11832 AC_SUBST(CURL)
11835 # check for sha256sum
11837 SHA256SUM=
11839 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11840     eval "$i -a 256 --version" > /dev/null 2>&1
11841     ret=$?
11842     if test $ret -eq 0; then
11843         SHA256SUM="$i -a 256"
11844         break
11845     fi
11846 done
11848 if test -z "$SHA256SUM"; then
11849     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11850         eval "$i --version" > /dev/null 2>&1
11851         ret=$?
11852         if test $ret -eq 0; then
11853             SHA256SUM=$i
11854             break
11855         fi
11856     done
11859 if test -z "$SHA256SUM"; then
11860     AC_MSG_ERROR([no sha256sum found!])
11863 AC_SUBST(SHA256SUM)
11865 dnl ===================================================================
11866 dnl Dealing with l10n options
11867 dnl ===================================================================
11868 AC_MSG_CHECKING([which languages to be built])
11869 # get list of all languages
11870 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11871 # the sed command does the following:
11872 #   + if a line ends with a backslash, append the next line to it
11873 #   + adds " on the beginning of the value (after =)
11874 #   + adds " at the end of the value
11875 #   + removes en-US; we want to put it on the beginning
11876 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11877 [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)]
11878 ALL_LANGS="en-US $completelangiso"
11879 # check the configured localizations
11880 WITH_LANG="$with_lang"
11881 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11882     AC_MSG_RESULT([en-US])
11883 else
11884     AC_MSG_RESULT([$WITH_LANG])
11885     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11887 # check that the list is valid
11888 for lang in $WITH_LANG; do
11889     test "$lang" = "ALL" && continue
11890     # need to check for the exact string, so add space before and after the list of all languages
11891     for vl in $ALL_LANGS; do
11892         if test "$vl" = "$lang"; then
11893            break
11894         fi
11895     done
11896     if test "$vl" != "$lang"; then
11897         # if you're reading this - you prolly quoted your languages remove the quotes ...
11898         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11899     fi
11900 done
11901 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11902     echo $WITH_LANG | grep -q en-US
11903     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11905 # list with substituted ALL
11906 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11907 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11908 test "$WITH_LANG" = "en-US" && WITH_LANG=
11909 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11910     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11911     ALL_LANGS=`echo $ALL_LANGS qtz`
11913 AC_SUBST(ALL_LANGS)
11914 AC_SUBST(WITH_LANG)
11915 AC_SUBST(WITH_LANG_LIST)
11916 AC_SUBST(GIT_NEEDED_SUBMODULES)
11918 WITH_POOR_HELP_LOCALIZATIONS=
11919 if test -d "$SRC_ROOT/translations/source"; then
11920     for l in `ls -1 $SRC_ROOT/translations/source`; do
11921         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11922             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11923         fi
11924     done
11926 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11928 if test -n "$with_locales"; then
11929     WITH_LOCALES="$with_locales"
11931     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11932     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11933     # config_host/config_locales.h.in
11934     for locale in $WITH_LOCALES; do
11935         lang=${locale%_*}
11937         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
11939         case $lang in
11940         hi|mr*ne)
11941             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
11942             ;;
11943         bg|ru)
11944             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
11945             ;;
11946         esac
11947     done
11948 else
11949     AC_DEFINE(WITH_LOCALE_ALL)
11951 AC_SUBST(WITH_LOCALES)
11953 dnl git submodule update --reference
11954 dnl ===================================================================
11955 if test -n "${GIT_REFERENCE_SRC}"; then
11956     for repo in ${GIT_NEEDED_SUBMODULES}; do
11957         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11958             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11959         fi
11960     done
11962 AC_SUBST(GIT_REFERENCE_SRC)
11964 dnl git submodules linked dirs
11965 dnl ===================================================================
11966 if test -n "${GIT_LINK_SRC}"; then
11967     for repo in ${GIT_NEEDED_SUBMODULES}; do
11968         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
11969             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
11970         fi
11971     done
11973 AC_SUBST(GIT_LINK_SRC)
11975 dnl branding
11976 dnl ===================================================================
11977 AC_MSG_CHECKING([for alternative branding images directory])
11978 # initialize mapped arrays
11979 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
11980 brand_files="$BRAND_INTRO_IMAGES about.svg"
11982 if test -z "$with_branding" -o "$with_branding" = "no"; then
11983     AC_MSG_RESULT([none])
11984     DEFAULT_BRAND_IMAGES="$brand_files"
11985 else
11986     if ! test -d $with_branding ; then
11987         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11988     else
11989         AC_MSG_RESULT([$with_branding])
11990         CUSTOM_BRAND_DIR="$with_branding"
11991         for lfile in $brand_files
11992         do
11993             if ! test -f $with_branding/$lfile ; then
11994                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11995                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11996             else
11997                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11998             fi
11999         done
12000         check_for_progress="yes"
12001     fi
12003 AC_SUBST([BRAND_INTRO_IMAGES])
12004 AC_SUBST([CUSTOM_BRAND_DIR])
12005 AC_SUBST([CUSTOM_BRAND_IMAGES])
12006 AC_SUBST([DEFAULT_BRAND_IMAGES])
12009 AC_MSG_CHECKING([for 'intro' progress settings])
12010 PROGRESSBARCOLOR=
12011 PROGRESSSIZE=
12012 PROGRESSPOSITION=
12013 PROGRESSFRAMECOLOR=
12014 PROGRESSTEXTCOLOR=
12015 PROGRESSTEXTBASELINE=
12017 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12018     source "$with_branding/progress.conf"
12019     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12020 else
12021     AC_MSG_RESULT([none])
12024 AC_SUBST(PROGRESSBARCOLOR)
12025 AC_SUBST(PROGRESSSIZE)
12026 AC_SUBST(PROGRESSPOSITION)
12027 AC_SUBST(PROGRESSFRAMECOLOR)
12028 AC_SUBST(PROGRESSTEXTCOLOR)
12029 AC_SUBST(PROGRESSTEXTBASELINE)
12032 AC_MSG_CHECKING([for extra build ID])
12033 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12034     EXTRA_BUILDID="$with_extra_buildid"
12036 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12037 if test -n "$EXTRA_BUILDID" ; then
12038     AC_MSG_RESULT([$EXTRA_BUILDID])
12039 else
12040     AC_MSG_RESULT([not set])
12042 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12044 OOO_VENDOR=
12045 AC_MSG_CHECKING([for vendor])
12046 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12047     OOO_VENDOR="$USERNAME"
12049     if test -z "$OOO_VENDOR"; then
12050         OOO_VENDOR="$USER"
12051     fi
12053     if test -z "$OOO_VENDOR"; then
12054         OOO_VENDOR="`id -u -n`"
12055     fi
12057     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12058 else
12059     OOO_VENDOR="$with_vendor"
12060     AC_MSG_RESULT([$OOO_VENDOR])
12062 AC_SUBST(OOO_VENDOR)
12064 if echo "$host_os" | grep -q linux-android ; then
12065     ANDROID_PACKAGE_NAME=
12066     AC_MSG_CHECKING([for Android package name])
12067     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12068         if test -n "$ENABLE_DEBUG"; then
12069             # Default to the package name that makes ndk-gdb happy.
12070             ANDROID_PACKAGE_NAME="org.libreoffice"
12071         else
12072             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12073         fi
12075         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12076     else
12077         ANDROID_PACKAGE_NAME="$with_android_package_name"
12078         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12079     fi
12080     AC_SUBST(ANDROID_PACKAGE_NAME)
12083 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12084 if test "$with_compat_oowrappers" = "yes"; then
12085     WITH_COMPAT_OOWRAPPERS=TRUE
12086     AC_MSG_RESULT(yes)
12087 else
12088     WITH_COMPAT_OOWRAPPERS=
12089     AC_MSG_RESULT(no)
12091 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12093 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12094 AC_MSG_CHECKING([for install dirname])
12095 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12096     INSTALLDIRNAME="$with_install_dirname"
12098 AC_MSG_RESULT([$INSTALLDIRNAME])
12099 AC_SUBST(INSTALLDIRNAME)
12101 AC_MSG_CHECKING([for prefix])
12102 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12103 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12104 PREFIXDIR="$prefix"
12105 AC_MSG_RESULT([$PREFIXDIR])
12106 AC_SUBST(PREFIXDIR)
12108 LIBDIR=[$(eval echo $(eval echo $libdir))]
12109 AC_SUBST(LIBDIR)
12111 DATADIR=[$(eval echo $(eval echo $datadir))]
12112 AC_SUBST(DATADIR)
12114 MANDIR=[$(eval echo $(eval echo $mandir))]
12115 AC_SUBST(MANDIR)
12117 DOCDIR=[$(eval echo $(eval echo $docdir))]
12118 AC_SUBST(DOCDIR)
12120 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12121 AC_SUBST(INSTALLDIR)
12123 TESTINSTALLDIR="${BUILDDIR}/test-install"
12124 AC_SUBST(TESTINSTALLDIR)
12127 # ===================================================================
12128 # OAuth2 id and secrets
12129 # ===================================================================
12131 AC_MSG_CHECKING([for Google Drive client id and secret])
12132 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12133 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12134 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12135     GDRIVE_CLIENT_ID="\"\""
12138 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12139     GDRIVE_CLIENT_SECRET="\"\""
12142 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12143     AC_MSG_RESULT([not set])
12144 else
12145     AC_MSG_RESULT([set])
12148 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12149 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12151 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12152 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12153 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12154 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12155     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12158 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12159     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12162 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12163     AC_MSG_RESULT([not set])
12164 else
12165     AC_MSG_RESULT([set])
12167 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12168 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12170 AC_MSG_CHECKING([for OneDrive client id and secret])
12171 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12172 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12173 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12174     ONEDRIVE_CLIENT_ID="\"\""
12177 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12178     ONEDRIVE_CLIENT_SECRET="\"\""
12181 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12182     AC_MSG_RESULT([not set])
12183 else
12184     AC_MSG_RESULT([set])
12186 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12187 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12190 dnl ===================================================================
12191 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12192 dnl --enable-dependency-tracking configure option
12193 dnl ===================================================================
12194 AC_MSG_CHECKING([whether to enable dependency tracking])
12195 if test "$enable_dependency_tracking" = "no"; then
12196     nodep=TRUE
12197     AC_MSG_RESULT([no])
12198 else
12199     AC_MSG_RESULT([yes])
12201 AC_SUBST(nodep)
12203 dnl ===================================================================
12204 dnl Number of CPUs to use during the build
12205 dnl ===================================================================
12206 AC_MSG_CHECKING([for number of processors to use])
12207 # plain --with-parallelism is just the default
12208 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12209     if test "$with_parallelism" = "no"; then
12210         PARALLELISM=0
12211     else
12212         PARALLELISM=$with_parallelism
12213     fi
12214 else
12215     if test "$enable_icecream" = "yes"; then
12216         PARALLELISM="10"
12217     else
12218         case `uname -s` in
12220         Darwin|FreeBSD|NetBSD|OpenBSD)
12221             PARALLELISM=`sysctl -n hw.ncpu`
12222             ;;
12224         Linux)
12225             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12226         ;;
12227         # what else than above does profit here *and* has /proc?
12228         *)
12229             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12230             ;;
12231         esac
12233         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12234         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12235     fi
12238 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12239     if test -z "$with_parallelism"; then
12240             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12241             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12242             PARALLELISM="1"
12243     else
12244         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."
12245     fi
12248 if test $PARALLELISM -eq 0; then
12249     AC_MSG_RESULT([explicit make -j option needed])
12250 else
12251     AC_MSG_RESULT([$PARALLELISM])
12253 AC_SUBST(PARALLELISM)
12255 IWYU_PATH="$with_iwyu"
12256 AC_SUBST(IWYU_PATH)
12257 if test ! -z "$IWYU_PATH"; then
12258     if test ! -f "$IWYU_PATH"; then
12259         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12260     fi
12264 # Set up ILIB for MSVC build
12266 ILIB1=
12267 if test "$build_os" = "cygwin"; then
12268     ILIB="."
12269     if test -n "$JAVA_HOME"; then
12270         ILIB="$ILIB;$JAVA_HOME/lib"
12271     fi
12272     ILIB1=-link
12273     if test "$BITNESS_OVERRIDE" = 64; then
12274         if test $vcnum = "150"; then
12275             ILIB="$ILIB;$COMPATH/lib/x64"
12276             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12277         else
12278             ILIB="$ILIB;$COMPATH/lib/amd64"
12279             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12280         fi
12281         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12282         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12283         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12284             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12285             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12286         fi
12287         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12288         ucrtlibpath_formatted=$formatted_path
12289         ILIB="$ILIB;$ucrtlibpath_formatted"
12290         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12291     else
12292         if test $vcnum = "150"; then
12293             ILIB="$ILIB;$COMPATH/lib/x86"
12294             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12295         else
12296             ILIB="$ILIB;$COMPATH/lib"
12297             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12298         fi
12299         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12300         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12301         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12302             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12303             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12304         fi
12305         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12306         ucrtlibpath_formatted=$formatted_path
12307         ILIB="$ILIB;$ucrtlibpath_formatted"
12308         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12309     fi
12310     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12311         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12312     else
12313         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12314     fi
12316     AC_SUBST(ILIB)
12319 AC_MSG_CHECKING(
12320     [whether C++11 use of const_iterator in standard containers is broken])
12321 save_CXXFLAGS=$CXXFLAGS
12322 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12323 AC_LANG_PUSH([C++])
12324 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12325     #include <list>
12326     ]],[[
12327         std::list<int> l;
12328         l.erase(l.cbegin());
12329     ]])],
12330     [broken=no], [broken=yes])
12331 AC_LANG_POP([C++])
12332 CXXFLAGS=$save_CXXFLAGS
12333 AC_MSG_RESULT([$broken])
12334 if test "$broken" = yes; then
12335     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12339 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12340 save_CXXFLAGS=$CXXFLAGS
12341 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12342 save_LIBS=$LIBS
12343 if test -n "$ILIB1"; then
12344     LIBS="$LIBS $ILIB1"
12346 AC_LANG_PUSH([C++])
12347 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12348     // Exit with failure if the static initializer_list is stored on the
12349     // stack (as done by Clang < 3.4):
12350     #include <initializer_list>
12351     struct S {};
12352     bool g(void const * p1, void const * p2) {
12353         int n;
12354         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12355     }
12356     bool f(void const * p1) {
12357         static std::initializer_list<S> s { S() };
12358         return g(p1, s.begin());
12359     }
12360     ]],[[
12361         int n;
12362         return f(&n) ? 0 : 1;
12363     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12364 AC_LANG_POP([C++])
12365 LIBS=$save_LIBS
12366 CXXFLAGS=$save_CXXFLAGS
12367 AC_MSG_RESULT([$broken])
12368 if test "$broken" = yes; then
12369     AC_MSG_ERROR([working support for static initializer_list needed])
12373 # ===================================================================
12374 # Creating bigger shared library to link against
12375 # ===================================================================
12376 AC_MSG_CHECKING([whether to create huge library])
12377 MERGELIBS=
12379 if test $_os = iOS -o $_os = Android; then
12380     # Never any point in mergelibs for these as we build just static
12381     # libraries anyway...
12382     enable_mergelibs=no
12385 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12386     if test $_os != Linux -a $_os != WINNT; then
12387         add_warning "--enable-mergelibs is not tested for this platform"
12388     fi
12389     MERGELIBS="TRUE"
12390     AC_MSG_RESULT([yes])
12391 else
12392     AC_MSG_RESULT([no])
12394 AC_SUBST([MERGELIBS])
12396 dnl ===================================================================
12397 dnl icerun is a wrapper that stops us spawning tens of processes
12398 dnl locally - for tools that can't be executed on the compile cluster
12399 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12400 dnl ===================================================================
12401 AC_MSG_CHECKING([whether to use icerun wrapper])
12402 ICECREAM_RUN=
12403 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12404     ICECREAM_RUN=icerun
12405     AC_MSG_RESULT([yes])
12406 else
12407     AC_MSG_RESULT([no])
12409 AC_SUBST(ICECREAM_RUN)
12411 dnl ===================================================================
12412 dnl Setup the ICECC_VERSION for the build the same way it was set for
12413 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12414 dnl ===================================================================
12415 x_ICECC_VERSION=[\#]
12416 if test -n "$ICECC_VERSION" ; then
12417     x_ICECC_VERSION=
12419 AC_SUBST(x_ICECC_VERSION)
12420 AC_SUBST(ICECC_VERSION)
12422 dnl ===================================================================
12424 AC_MSG_CHECKING([MPL subset])
12425 MPL_SUBSET=
12427 if test "$enable_mpl_subset" = "yes"; then
12428     warn_report=false
12429     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12430         warn_report=true
12431     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12432         warn_report=true
12433     fi
12434     if test "$warn_report" = "true"; then
12435         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12436     fi
12437     if test "x$enable_postgresql_sdbc" != "xno"; then
12438         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12439     fi
12440     if test "$enable_lotuswordpro" = "yes"; then
12441         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12442     fi
12443     if test "$WITH_WEBDAV" = "neon"; then
12444         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12445     fi
12446     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12447         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12448     fi
12449     if test -n "$ENABLE_PDFIMPORT"; then
12450         if test "x$SYSTEM_POPPLER" = "x"; then
12451             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12452         fi
12453     fi
12454     # cf. m4/libo_check_extension.m4
12455     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12456         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12457     fi
12458     for theme in $WITH_THEMES; do
12459         case $theme in
12460         breeze|crystal|default|hicontrast|oxygen|sifr)
12461             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12462         *) : ;;
12463         esac
12464     done
12466     ENABLE_OPENGL_TRANSITIONS=
12468     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12469         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12470     fi
12472     MPL_SUBSET="TRUE"
12473     AC_DEFINE(MPL_HAVE_SUBSET)
12474     AC_MSG_RESULT([only])
12475 else
12476     AC_MSG_RESULT([no restrictions])
12478 AC_SUBST(MPL_SUBSET)
12480 dnl ===================================================================
12482 AC_MSG_CHECKING([formula logger])
12483 ENABLE_FORMULA_LOGGER=
12485 if test "x$enable_formula_logger" = "xyes"; then
12486     AC_MSG_RESULT([yes])
12487     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12488     ENABLE_FORMULA_LOGGER=TRUE
12489 elif test -n "$ENABLE_DBGUTIL" ; then
12490     AC_MSG_RESULT([yes])
12491     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12492     ENABLE_FORMULA_LOGGER=TRUE
12493 else
12494     AC_MSG_RESULT([no])
12497 AC_SUBST(ENABLE_FORMULA_LOGGER)
12499 dnl ===================================================================
12500 dnl Setting up the environment.
12501 dnl ===================================================================
12502 AC_MSG_NOTICE([setting up the build environment variables...])
12504 AC_SUBST(COMPATH)
12506 if test "$build_os" = "cygwin"; then
12507     if test -d "$COMPATH/atlmfc/lib"; then
12508         ATL_LIB="$COMPATH/atlmfc/lib"
12509         ATL_INCLUDE="$COMPATH/atlmfc/include"
12510     else
12511         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12512         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12513     fi
12514     if test "$BITNESS_OVERRIDE" = 64; then
12515         if test $VCVER = "150"; then
12516             ATL_LIB="$ATL_LIB/x64"
12517         else
12518             ATL_LIB="$ATL_LIB/amd64"
12519         fi
12520     else
12521         if test $VCVER = "150"; then
12522             ATL_LIB="$ATL_LIB/x86"
12523         fi
12524     fi
12525     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12526     PathFormat "/usr/bin/find.exe"
12527     FIND="$formatted_path"
12528     PathFormat "/usr/bin/sort.exe"
12529     SORT="$formatted_path"
12530     PathFormat "/usr/bin/grep.exe"
12531     WIN_GREP="$formatted_path"
12532     PathFormat "/usr/bin/ls.exe"
12533     WIN_LS="$formatted_path"
12534     PathFormat "/usr/bin/touch.exe"
12535     WIN_TOUCH="$formatted_path"
12536 else
12537     FIND=find
12538     SORT=sort
12541 AC_SUBST(ATL_INCLUDE)
12542 AC_SUBST(ATL_LIB)
12543 AC_SUBST(FIND)
12544 AC_SUBST(SORT)
12545 AC_SUBST(WIN_GREP)
12546 AC_SUBST(WIN_LS)
12547 AC_SUBST(WIN_TOUCH)
12549 AC_SUBST(BUILD_TYPE)
12551 AC_SUBST(SOLARINC)
12553 PathFormat "$PERL"
12554 PERL="$formatted_path"
12555 AC_SUBST(PERL)
12557 if test -n "$TMPDIR"; then
12558     TEMP_DIRECTORY="$TMPDIR"
12559 else
12560     TEMP_DIRECTORY="/tmp"
12562 if test "$build_os" = "cygwin"; then
12563     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12565 AC_SUBST(TEMP_DIRECTORY)
12567 # setup the PATH for the environment
12568 if test -n "$LO_PATH_FOR_BUILD"; then
12569     LO_PATH="$LO_PATH_FOR_BUILD"
12570 else
12571     LO_PATH="$PATH"
12573     case "$host_os" in
12575     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12576         if test "$ENABLE_JAVA" != ""; then
12577             pathmunge "$JAVA_HOME/bin" "after"
12578         fi
12579         ;;
12581     cygwin*)
12582         # Win32 make needs native paths
12583         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12584             LO_PATH=`cygpath -p -m "$PATH"`
12585         fi
12586         if test "$BITNESS_OVERRIDE" = 64; then
12587             # needed for msi packaging
12588             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12589         fi
12590         # .NET 4.6 and higher don't have bin directory
12591         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12592             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12593         fi
12594         pathmunge "$ASM_HOME" "before"
12595         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12596         pathmunge "$CSC_PATH" "before"
12597         pathmunge "$MIDL_PATH" "before"
12598         pathmunge "$AL_PATH" "before"
12599         pathmunge "$MSPDB_PATH" "before"
12600         if test -n "$MSBUILD_PATH" ; then
12601             pathmunge "$MSBUILD_PATH" "before"
12602         fi
12603         if test "$BITNESS_OVERRIDE" = 64; then
12604             pathmunge "$COMPATH/bin/amd64" "before"
12605             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12606         else
12607             pathmunge "$COMPATH/bin" "before"
12608             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12609         fi
12610         if test "$ENABLE_JAVA" != ""; then
12611             if test -d "$JAVA_HOME/jre/bin/client"; then
12612                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12613             fi
12614             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12615                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12616             fi
12617             pathmunge "$JAVA_HOME/bin" "before"
12618         fi
12619         ;;
12621     solaris*)
12622         pathmunge "/usr/css/bin" "before"
12623         if test "$ENABLE_JAVA" != ""; then
12624             pathmunge "$JAVA_HOME/bin" "after"
12625         fi
12626         ;;
12627     esac
12630 AC_SUBST(LO_PATH)
12632 libo_FUZZ_SUMMARY
12634 # Generate a configuration sha256 we can use for deps
12635 if test -f config_host.mk; then
12636     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12638 if test -f config_host_lang.mk; then
12639     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12642 CFLAGS=$my_original_CFLAGS
12643 CXXFLAGS=$my_original_CXXFLAGS
12644 CPPFLAGS=$my_original_CPPFLAGS
12646 AC_CONFIG_FILES([config_host.mk
12647                  config_host_lang.mk
12648                  Makefile
12649                  lo.xcent
12650                  bin/bffvalidator.sh
12651                  bin/odfvalidator.sh
12652                  bin/officeotron.sh
12653                  instsetoo_native/util/openoffice.lst
12654                  sysui/desktop/macosx/Info.plist
12655                  ios/lo.xcconfig])
12656 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12657 AC_CONFIG_HEADERS([config_host/config_clang.h])
12658 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12659 AC_CONFIG_HEADERS([config_host/config_eot.h])
12660 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12661 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12662 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12663 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12664 AC_CONFIG_HEADERS([config_host/config_features.h])
12665 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12666 AC_CONFIG_HEADERS([config_host/config_folders.h])
12667 AC_CONFIG_HEADERS([config_host/config_gio.h])
12668 AC_CONFIG_HEADERS([config_host/config_global.h])
12669 AC_CONFIG_HEADERS([config_host/config_java.h])
12670 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12671 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12672 AC_CONFIG_HEADERS([config_host/config_locales.h])
12673 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12674 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12675 AC_CONFIG_HEADERS([config_host/config_oox.h])
12676 AC_CONFIG_HEADERS([config_host/config_options.h])
12677 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12678 AC_CONFIG_HEADERS([config_host/config_test.h])
12679 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12680 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12681 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12682 AC_CONFIG_HEADERS([config_host/config_version.h])
12683 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12684 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12685 AC_CONFIG_HEADERS([config_host/config_python.h])
12686 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12687 AC_OUTPUT
12689 if test "$CROSS_COMPILING" = TRUE; then
12690     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12693 # touch the config timestamp file
12694 if test ! -f config_host.mk.stamp; then
12695     echo > config_host.mk.stamp
12696 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12697     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12698 else
12699     echo > config_host.mk.stamp
12702 # touch the config lang timestamp file
12703 if test ! -f config_host_lang.mk.stamp; then
12704     echo > config_host_lang.mk.stamp
12705 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12706     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12707 else
12708     echo > config_host_lang.mk.stamp
12712 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12714 cat << _EOS
12715 ****************************************************************************
12716 WARNING:
12717 Your make version is known to be horribly slow, and hard to debug
12718 problems with. To get a reasonably functional make please do:
12720 to install a pre-compiled binary make for Win32
12722  mkdir -p /opt/lo/bin
12723  cd /opt/lo/bin
12724  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12725  cp make-85047eb-msvc.exe make
12726  chmod +x make
12728 to install from source:
12729 place yourself in a working directory of you choice.
12731  git clone git://git.savannah.gnu.org/make.git
12733  [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"]
12734  set PATH=%PATH%;C:\Cygwin\bin
12735  [or Cygwin64, if that is what you have]
12736  cd path-to-make-repo-you-cloned-above
12737  build_w32.bat --without-guile
12739 should result in a WinRel/gnumake.exe.
12740 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12742 Then re-run autogen.sh
12744 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12745 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12747 _EOS
12750 cat << _EOF
12751 ****************************************************************************
12753 To build, run:
12754 $GNUMAKE
12756 To view some help, run:
12757 $GNUMAKE help
12759 _EOF
12761 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12762     cat << _EOF
12763 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12764 _EOF
12766     if test $_os = Darwin; then
12767         echo open instdir/$PRODUCTNAME.app
12768     else
12769         echo instdir/program/soffice
12770     fi
12771     cat << _EOF
12773 If you want to run the smoketest, run:
12774 $GNUMAKE check
12776 _EOF
12779 if test -f warn; then
12780     cat warn
12781     rm warn
12784 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: