tdf#108821 - fixed bad alloc on opening large file
[LibreOffice.git] / configure.ac
blob0eb7ed7150a1d914f358757c0dfba5212a14f17c
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],[6.0.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84     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.*|14.1.*|15.0*)
386         ;;
387     *)
388         AC_MSG_WARN([Untested android NDK version $ANDROID_NDK_VERSION, only versions r9* til 15.0.* have been used successfully. Proceed at your own risk.])
389         add_warning "Untested android NDK version $ANDROID_NDK_VERSION, only versions r9* til 15.0.* 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         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
421         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
422         ANDROID_USING_CLANG=true
423         ;;
424     *)
425         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
426     esac
428     if test ! -d $ANDROID_BINUTILS_DIR; then
429         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
430     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
431         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
432     fi
434     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
435     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
436     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
437     # manage to link the (app-specific) single huge .so that is built for the app in
438     # android/source/ if there is debug information in a significant part of the object files.
439     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
440     # all objects have been built with debug information.)
441     toolchain_system='*'
442     case $build_os in
443     linux-gnu*)
444         ndk_build_os=linux
445         ;;
446     darwin*)
447         ndk_build_os=darwin
448         ;;
449     *)
450         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
451         ;;
452     esac
454     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
455     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
456     if test $build_cpu = x86_64; then
457         if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
458             ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
459         fi
460         if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
461             ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
462         fi
463     fi
464     ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
466     # This stays empty if there is just one version of the toolchain in the NDK
467     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
468     if test ! -d "$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/libs" ; then
469         # nope, won't work if empty...
470         # as is the case when using the ndk-bundle as installed with android studio
471         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
472         if test -n "$ANDROID_USING_CLANG"; then
473             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
474         fi
475     fi
477     ANDROID_API_LEVEL=15
478     if test $host_cpu = arm; then
479         android_gnu_prefix=arm-linux-androideabi
480     elif test $host_cpu = aarch64; then
481         android_gnu_prefix=aarch64-linux-android
482         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
483         ANDROID_API_LEVEL=L
484     elif test $host_cpu = mips; then
485         android_gnu_prefix=mipsel-linux-android
486     elif test $ANDROID_NDK_VERSION = r8; then
487         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
488         android_gnu_prefix=i686-android-linux
489     else
490         android_gnu_prefix=i686-linux-android
491     fi
493     ANDROID_ARCH=$android_cpu
494     if test $host_cpu = arm; then
495         ANDROID_APP_ABI=armeabi-v7a
496         if test -n "$ANDROID_USING_CLANG"; then
497             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
498             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
499             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
500         else
501             :
502         fi
503         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
504         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
505         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
506     elif test $host_cpu = aarch64; then
507         ANDROID_APP_ABI=arm64-v8a
508         ANDROID_ARCH=arm64
509     elif test $host_cpu = mips; then
510         ANDROID_APP_ABI=mips
511         ANDROIDCFLAGS=""
512     else # x86
513         ANDROID_APP_ABI=x86
514         ANDROIDCFLAGS="-march=atom"
515     fi
516     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
517     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
518     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
519     export PKG_CONFIG_LIBDIR="$ANDROID_BINUTILS_PREBUILT_ROOT/lib/pkgconfig"
521     if test -n "$ANDROID_USING_CLANG"; then
522         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
523     else
524         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
525     fi
527     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
528     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
529     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
530     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
531     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
532     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
534     # When using the 4.6 or newer toolchain, use the gold linker
535     case "$with_android_ndk_toolchain_version" in
536     4.[[6789]]*|[[56789]].*|clang*)
537         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
538             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
539         fi
540         ;;
541     esac
543     if test "$ENABLE_LTO" = TRUE; then
544         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
545         # $CC and $CXX when building external libraries
546         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
547     fi
549     # gdbserver can be in different locations
550     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
551         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
552     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
553         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
554     elif test $android_cpu = aarch64; then
555         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
556     else
557         AC_MSG_ERROR([Can't find gdbserver for your Android target])
558     fi
560     if test $host_cpu = arm; then
561         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 -I $ANDROID_NDK_HOME/sources/cxx-stl/gabi++/include"
562     elif test $host_cpu = mips; then
563         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"
564     else # x86
565         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"
566     fi
568     if test -z "$CC"; then
569         case "$with_android_ndk_toolchain_version" in
570         4.*)
571             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
572             ;;
573         clang*)
574             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
575         esac
576     fi
577     if test -z "$CXX"; then
578         case "$with_android_ndk_toolchain_version" in
579         4.*)
580             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
581             ;;
582         clang*)
583             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
584             ;;
585         esac
586     fi
588     # remember to download the ownCloud Android library later
589     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
591 AC_SUBST(ANDROID_NDK_GDBSERVER)
592 AC_SUBST(ANDROID_APP_ABI)
594 dnl ===================================================================
595 dnl --with-android-sdk
596 dnl ===================================================================
597 ANDROID_SDK_HOME=
598 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
599     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
601 if test -n "$with_android_sdk"; then
602     ANDROID_SDK_HOME=$with_android_sdk
603     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
605 AC_SUBST(ANDROID_SDK_HOME)
607 dnl ===================================================================
608 dnl The following is a list of supported systems.
609 dnl Sequential to keep the logic very simple
610 dnl These values may be checked and reset later.
611 dnl ===================================================================
612 #defaults unless the os test overrides this:
613 test_randr=yes
614 test_xrender=yes
615 test_cups=yes
616 test_dbus=yes
617 test_fontconfig=yes
618 test_cairo=no
620 # Default values, as such probably valid just for Linux, set
621 # differently below just for Mac OSX,but at least better than
622 # hardcoding these as we used to do. Much of this is duplicated also
623 # in solenv for old build system and for gbuild, ideally we should
624 # perhaps define stuff like this only here in configure.ac?
626 LINKFLAGSSHL="-shared"
627 PICSWITCH="-fpic"
628 DLLPOST=".so"
630 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
632 INSTROOTBASESUFFIX=
633 INSTROOTCONTENTSUFFIX=
634 SDKDIRNAME=sdk
636 case "$host_os" in
638 solaris*)
639     test_gtk=yes
640     build_gstreamer_1_0=yes
641     build_gstreamer_0_10=yes
642     test_freetype=yes
643     _os=SunOS
645     dnl ===========================================================
646     dnl Check whether we're using Solaris 10 - SPARC or Intel.
647     dnl ===========================================================
648     AC_MSG_CHECKING([the Solaris operating system release])
649     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
650     if test "$_os_release" -lt "10"; then
651         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
652     else
653         AC_MSG_RESULT([ok ($_os_release)])
654     fi
656     dnl Check whether we're using a SPARC or i386 processor
657     AC_MSG_CHECKING([the processor type])
658     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
659         AC_MSG_RESULT([ok ($host_cpu)])
660     else
661         AC_MSG_ERROR([only SPARC and i386 processors are supported])
662     fi
663     ;;
665 linux-gnu*|k*bsd*-gnu*)
666     test_gtk=yes
667     build_gstreamer_1_0=yes
668     build_gstreamer_0_10=yes
669     test_kde4=yes
670     if test "$enable_fuzzers" != yes; then
671         test_freetype=yes
672         test_fontconfig=yes
673     else
674         test_freetype=no
675         test_fontconfig=no
676         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
677     fi
678     _os=Linux
679     ;;
681 gnu)
682     test_randr=no
683     test_xrender=no
684     _os=GNU
685      ;;
687 cygwin*|interix*)
689     # When building on Windows normally with MSVC under Cygwin,
690     # configure thinks that the host platform (the platform the
691     # built code will run on) is Cygwin, even if it obviously is
692     # Windows, which in Autoconf terminology is called
693     # "mingw32". (Which is misleading as MinGW is the name of the
694     # tool-chain, not an operating system.)
696     # Somewhat confusing, yes. But this configure script doesn't
697     # look at $host etc that much, it mostly uses its own $_os
698     # variable, set here in this case statement.
700     test_cups=no
701     test_dbus=no
702     test_randr=no
703     test_xrender=no
704     test_freetype=no
705     test_fontconfig=no
706     _os=WINNT
708     DLLPOST=".dll"
709     LINKFLAGSNOUNDEFS=
710     ;;
712 darwin*) # Mac OS X or iOS
713     test_gtk=yes
714     test_randr=no
715     test_xrender=no
716     test_freetype=no
717     test_fontconfig=no
718     test_dbus=no
719     if test "$host_cpu" = "armv7" -o "$host_cpu" = "arm64"; then
720         _os=iOS
721         test_gtk=no
722         test_cups=no
723     else
724         _os=Darwin
725         if test -n "$LODE_HOME" ; then
726             mac_sanitize_path
727             AC_MSG_NOTICE([sanitized the PATH to $PATH])
728         fi
729         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
730         INSTROOTCONTENTSUFFIX=/Contents
731         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
732     fi
733     enable_systray=no
734     # See comment above the case "$host_os"
735     LINKFLAGSSHL="-dynamiclib -single_module"
737     # -fPIC is default
738     PICSWITCH=""
740     DLLPOST=".dylib"
742     # -undefined error is the default
743     LINKFLAGSNOUNDEFS=""
746 freebsd*)
747     test_gtk=yes
748     build_gstreamer_1_0=yes
749     build_gstreamer_0_10=yes
750     test_kde4=yes
751     test_freetype=yes
752     AC_MSG_CHECKING([the FreeBSD operating system release])
753     if test -n "$with_os_version"; then
754         OSVERSION="$with_os_version"
755     else
756         OSVERSION=`/sbin/sysctl -n kern.osreldate`
757     fi
758     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
759     AC_MSG_CHECKING([which thread library to use])
760     if test "$OSVERSION" -lt "500016"; then
761         PTHREAD_CFLAGS="-D_THREAD_SAFE"
762         PTHREAD_LIBS="-pthread"
763     elif test "$OSVERSION" -lt "502102"; then
764         PTHREAD_CFLAGS="-D_THREAD_SAFE"
765         PTHREAD_LIBS="-lc_r"
766     else
767         PTHREAD_CFLAGS=""
768         PTHREAD_LIBS="-pthread"
769     fi
770     AC_MSG_RESULT([$PTHREAD_LIBS])
771     _os=FreeBSD
772     ;;
774 *netbsd*)
775     test_gtk=yes
776     build_gstreamer_1_0=yes
777     build_gstreamer_0_10=yes
778     test_kde4=yes
779     test_freetype=yes
780     PTHREAD_LIBS="-pthread -lpthread"
781     _os=NetBSD
782     ;;
784 aix*)
785     test_randr=no
786     test_freetype=yes
787     PTHREAD_LIBS=-pthread
788     _os=AIX
789     ;;
791 openbsd*)
792     test_gtk=yes
793     test_freetype=yes
794     PTHREAD_CFLAGS="-D_THREAD_SAFE"
795     PTHREAD_LIBS="-pthread"
796     _os=OpenBSD
797     ;;
799 dragonfly*)
800     test_gtk=yes
801     build_gstreamer_1_0=yes
802     build_gstreamer_0_10=yes
803     test_kde4=yes
804     test_freetype=yes
805     PTHREAD_LIBS="-pthread"
806     _os=DragonFly
807     ;;
809 linux-android*)
810     build_gstreamer_1_0=no
811     build_gstreamer_0_10=no
812     enable_lotuswordpro=no
813     enable_mpl_subset=yes
814     enable_coinmp=yes
815     enable_lpsolve=no
816     enable_report_builder=no
817     enable_odk=no
818     enable_postgresql_sdbc=no
819     enable_python=no
820     with_theme="tango"
821     test_cups=no
822     test_dbus=no
823     test_fontconfig=no
824     test_freetype=no
825     test_gtk=no
826     test_kde4=no
827     test_randr=no
828     test_xrender=no
829     _os=Android
831     if test -z "$with_android_ndk"; then
832         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
833     fi
835     if test -z "$with_android_ndk_toolchain_version"; then
836         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
837     fi
839     # Verify that the NDK and SDK options are proper
840     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
841         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
842     fi
844     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
845     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
846     ;;
849     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
850     ;;
851 esac
853 if echo "$host_os" | grep -q linux-android ; then
854     if test -z "$with_android_sdk"; then
855         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
856     fi
858     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
859         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
860     fi
862     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
863     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
864         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
865                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
866                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
867         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
868         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
869         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
870     fi
871     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
872         AC_MSG_WARN([android support repository not found - install with
873                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
874                      to allow the build to download the specified version of the android support libraries])
875         add_warning "android support repository not found - install with"
876         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
877         add_warning "to allow the build to download the specified version of the android support libraries"
878     fi
881 if test "$_os" = "AIX"; then
882     AC_PATH_PROG(GAWK, gawk)
883     if test -z "$GAWK"; then
884         AC_MSG_ERROR([gawk not found in \$PATH])
885     fi
888 AC_SUBST(SDKDIRNAME)
890 AC_SUBST(PTHREAD_CFLAGS)
891 AC_SUBST(PTHREAD_LIBS)
893 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
894 # By default use the ones specified by our build system,
895 # but explicit override is possible.
896 AC_MSG_CHECKING(for explicit AFLAGS)
897 if test -n "$AFLAGS"; then
898     AC_MSG_RESULT([$AFLAGS])
899     x_AFLAGS=
900 else
901     AC_MSG_RESULT(no)
902     x_AFLAGS=[\#]
904 AC_MSG_CHECKING(for explicit CFLAGS)
905 if test -n "$CFLAGS"; then
906     AC_MSG_RESULT([$CFLAGS])
907     x_CFLAGS=
908 else
909     AC_MSG_RESULT(no)
910     x_CFLAGS=[\#]
912 AC_MSG_CHECKING(for explicit CXXFLAGS)
913 if test -n "$CXXFLAGS"; then
914     AC_MSG_RESULT([$CXXFLAGS])
915     x_CXXFLAGS=
916 else
917     AC_MSG_RESULT(no)
918     x_CXXFLAGS=[\#]
920 AC_MSG_CHECKING(for explicit OBJCFLAGS)
921 if test -n "$OBJCFLAGS"; then
922     AC_MSG_RESULT([$OBJCFLAGS])
923     x_OBJCFLAGS=
924 else
925     AC_MSG_RESULT(no)
926     x_OBJCFLAGS=[\#]
928 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
929 if test -n "$OBJCXXFLAGS"; then
930     AC_MSG_RESULT([$OBJCXXFLAGS])
931     x_OBJCXXFLAGS=
932 else
933     AC_MSG_RESULT(no)
934     x_OBJCXXFLAGS=[\#]
936 AC_MSG_CHECKING(for explicit LDFLAGS)
937 if test -n "$LDFLAGS"; then
938     AC_MSG_RESULT([$LDFLAGS])
939     x_LDFLAGS=
940 else
941     AC_MSG_RESULT(no)
942     x_LDFLAGS=[\#]
944 AC_SUBST(AFLAGS)
945 AC_SUBST(CFLAGS)
946 AC_SUBST(CXXFLAGS)
947 AC_SUBST(OBJCFLAGS)
948 AC_SUBST(OBJCXXFLAGS)
949 AC_SUBST(LDFLAGS)
950 AC_SUBST(x_AFLAGS)
951 AC_SUBST(x_CFLAGS)
952 AC_SUBST(x_CXXFLAGS)
953 AC_SUBST(x_OBJCFLAGS)
954 AC_SUBST(x_OBJCXXFLAGS)
955 AC_SUBST(x_LDFLAGS)
957 dnl These are potentially set for MSVC, in the code checking for UCRT below:
958 my_original_CFLAGS=$CFLAGS
959 my_original_CXXFLAGS=$CXXFLAGS
960 my_original_CPPFLAGS=$CPPFLAGS
962 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
963 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
964 dnl AC_PROG_CC internally.
965 if test "$_os" != "WINNT"; then
966     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
967     save_CFLAGS=$CFLAGS
968     AC_PROG_CC
969     CFLAGS=$save_CFLAGS
972 if test $_os != "WINNT"; then
973     save_LIBS="$LIBS"
974     AC_SEARCH_LIBS([dlsym], [dl],
975         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
976         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
977     LIBS="$save_LIBS"
979 AC_SUBST(DLOPEN_LIBS)
981 ###############################################################################
982 # Extensions switches --enable/--disable
983 ###############################################################################
984 # By default these should be enabled unless having extra dependencies.
985 # If there is extra dependency over configure options then the enable should
986 # be automagic based on whether the requiring feature is enabled or not.
987 # All this options change anything only with --enable-extension-integration.
989 # The name of this option and its help string makes it sound as if
990 # extensions are built anyway, just not integrated in the installer,
991 # if you use --disable-extension-integration. Is that really the
992 # case?
994 libo_FUZZ_ARG_ENABLE(extension-integration,
995     AS_HELP_STRING([--disable-extension-integration],
996         [Disable integration of the built extensions in the installer of the
997          product. Use this switch to disable the integration.])
1000 AC_ARG_ENABLE(avmedia,
1001     AS_HELP_STRING([--disable-avmedia],
1002         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1005 AC_ARG_ENABLE(database-connectivity,
1006     AS_HELP_STRING([--disable-database-connectivity],
1007         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1010 # This doesn't mean not building (or "integrating") extensions
1011 # (although it probably should; i.e. it should imply
1012 # --disable-extension-integration I guess), it means not supporting
1013 # any extension mechanism at all
1014 libo_FUZZ_ARG_ENABLE(extensions,
1015     AS_HELP_STRING([--disable-extensions],
1016         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1019 AC_ARG_ENABLE(scripting,
1020     AS_HELP_STRING([--disable-scripting],
1021         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1024 # This is mainly for Android and iOS, but could potentially be used in some
1025 # special case otherwise, too, so factored out as a separate setting
1027 AC_ARG_ENABLE(dynamic-loading,
1028     AS_HELP_STRING([--disable-dynamic-loading],
1029         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1032 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
1033     AS_HELP_STRING([--enable-ext-mariadb-connector],
1034         [Enable the build of the MariaDB/MySQL Connector extension.])
1037 libo_FUZZ_ARG_ENABLE(report-builder,
1038     AS_HELP_STRING([--disable-report-builder],
1039         [Disable the Report Builder.])
1042 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1043     AS_HELP_STRING([--enable-ext-wiki-publisher],
1044         [Enable the Wiki Publisher extension.])
1047 libo_FUZZ_ARG_ENABLE(lpsolve,
1048     AS_HELP_STRING([--disable-lpsolve],
1049         [Disable compilation of the lp solve solver ])
1051 libo_FUZZ_ARG_ENABLE(coinmp,
1052     AS_HELP_STRING([--disable-coinmp],
1053         [Disable compilation of the CoinMP solver ])
1056 libo_FUZZ_ARG_ENABLE(pdfimport,
1057     AS_HELP_STRING([--disable-pdfimport],
1058         [Disable building the PDF import feature.])
1061 libo_FUZZ_ARG_ENABLE(pdfium,
1062     AS_HELP_STRING([--disable-pdfium],
1063         [Disable building PDFium.])
1066 ###############################################################################
1068 dnl ---------- *** ----------
1070 libo_FUZZ_ARG_ENABLE(mergelibs,
1071     AS_HELP_STRING([--enable-mergelibs],
1072         [Merge several of the smaller libraries into one big, "merged", one.])
1075 libo_FUZZ_ARG_ENABLE(breakpad,
1076     AS_HELP_STRING([--enable-breakpad],
1077         [Enables breakpad for crash reporting.])
1080 AC_ARG_ENABLE(fetch-external,
1081     AS_HELP_STRING([--disable-fetch-external],
1082         [Disables fetching external tarballs from web sources.])
1085 AC_ARG_ENABLE(fuzzers,
1086     AS_HELP_STRING([--enable-fuzzers],
1087         [Enables building libfuzzer targets for fuzz testing.])
1090 libo_FUZZ_ARG_ENABLE(pch,
1091     AS_HELP_STRING([--enable-pch],
1092         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1095 libo_FUZZ_ARG_ENABLE(epm,
1096     AS_HELP_STRING([--enable-epm],
1097         [LibreOffice includes self-packaging code, that requires epm, however epm is
1098          useless for large scale package building.])
1101 libo_FUZZ_ARG_ENABLE(odk,
1102     AS_HELP_STRING([--disable-odk],
1103         [LibreOffice includes an ODK, office development kit which some packagers may
1104          wish to build without.])
1107 AC_ARG_ENABLE(mpl-subset,
1108     AS_HELP_STRING([--enable-mpl-subset],
1109         [Don't compile any pieces which are not MPL or more liberally licensed])
1112 libo_FUZZ_ARG_ENABLE(evolution2,
1113     AS_HELP_STRING([--enable-evolution2],
1114         [Allows the built-in evolution 2 addressbook connectivity build to be
1115          enabled.])
1118 AC_ARG_ENABLE(avahi,
1119     AS_HELP_STRING([--enable-avahi],
1120         [Determines whether to use Avahi to advertise Impress to remote controls.])
1123 libo_FUZZ_ARG_ENABLE(werror,
1124     AS_HELP_STRING([--enable-werror],
1125         [Turn warnings to errors. (Has no effect in modules where the treating
1126          of warnings as errors is disabled explicitly.)]),
1129 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1130     AS_HELP_STRING([--enable-assert-always-abort],
1131         [make assert() abort even in release code.]),
1134 libo_FUZZ_ARG_ENABLE(dbgutil,
1135     AS_HELP_STRING([--enable-dbgutil],
1136         [Provide debugging support from --enable-debug and include additional debugging
1137          utilities such as object counting or more expensive checks.
1138          This is the recommended option for developers.
1139          Note that this makes the build ABI incompatible, it is not possible to mix object
1140          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1142 libo_FUZZ_ARG_ENABLE(debug,
1143     AS_HELP_STRING([--enable-debug],
1144         [Include debugging information, disable compiler optimization and inlining plus
1145          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1147 libo_FUZZ_ARG_ENABLE(sal-log,
1148     AS_HELP_STRING([--enable-sal-log],
1149         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1151 AC_ARG_ENABLE(selective-debuginfo,
1152     AS_HELP_STRING([--enable-selective-debuginfo],
1153         [If --enable-debug or --enable-dbgutil is used, build debugging information
1154          (-g compiler flag) only for the specified gbuild build targets
1155          (where all means everything, - prepended means not to enable, / appended means
1156          everything in the directory; there is no ordering, more specific overrides
1157          more general, and disabling takes precedence).
1158          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1160 libo_FUZZ_ARG_ENABLE(symbols,
1161     AS_HELP_STRING([--enable-symbols],
1162         [Generate debug information.
1163          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1164          otherwise.]))
1166 libo_FUZZ_ARG_ENABLE(optimized,
1167     AS_HELP_STRING([--disable-optimized],
1168         [Whether to compile with optimization flags.
1169          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1170          otherwise.]))
1172 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1173     AS_HELP_STRING([--disable-runtime-optimizations],
1174         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1175          JVM JIT) that are known to interact badly with certain dynamic analysis
1176          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1177          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1178          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1180 AC_ARG_WITH(valgrind,
1181     AS_HELP_STRING([--with-valgrind],
1182         [Make availability of Valgrind headers a hard requirement.]))
1184 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1185     AS_HELP_STRING([--enable-compiler-plugins],
1186         [Enable compiler plugins that will perform additional checks during
1187          building. Enabled automatically by --enable-dbgutil.]))
1189 libo_FUZZ_ARG_ENABLE(ooenv,
1190     AS_HELP_STRING([--disable-ooenv],
1191         [Disable ooenv for the instdir installation.]))
1193 AC_ARG_ENABLE(lto,
1194     AS_HELP_STRING([--enable-lto],
1195         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1196          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1197          linker. For MSVC, this option is broken at the moment. This is experimental work
1198          in progress that shouldn't be used unless you are working on it.)]))
1200 AC_ARG_ENABLE(python,
1201     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1202         [Enables or disables Python support at run-time and build-time.
1203          Also specifies what Python to use. 'auto' is the default.
1204          'fully-internal' even forces the internal version for uses of Python
1205          during the build.]))
1207 libo_FUZZ_ARG_ENABLE(gtk,
1208     AS_HELP_STRING([--disable-gtk],
1209         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1210 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1212 libo_FUZZ_ARG_ENABLE(gtk3,
1213     AS_HELP_STRING([--disable-gtk3],
1214         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1215          This is experimental and may not work.]),
1216 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1218 libo_FUZZ_ARG_ENABLE(systray,
1219     AS_HELP_STRING([--disable-systray],
1220         [Determines whether to build the systray quickstarter.]),
1221 ,test "${enable_systray+set}" = set || enable_systray=yes)
1223 AC_ARG_ENABLE(split-app-modules,
1224     AS_HELP_STRING([--enable-split-app-modules],
1225         [Split file lists for app modules, e.g. base, calc.
1226          Has effect only with make distro-pack-install]),
1229 AC_ARG_ENABLE(split-opt-features,
1230     AS_HELP_STRING([--enable-split-opt-features],
1231         [Split file lists for some optional features, e.g. pyuno, testtool.
1232          Has effect only with make distro-pack-install]),
1235 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1236     AS_HELP_STRING([--disable-cairo-canvas],
1237         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1240 libo_FUZZ_ARG_ENABLE(dbus,
1241     AS_HELP_STRING([--disable-dbus],
1242         [Determines whether to enable features that depend on dbus.
1243          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1244 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1246 libo_FUZZ_ARG_ENABLE(sdremote,
1247     AS_HELP_STRING([--disable-sdremote],
1248         [Determines whether to enable Impress remote control (i.e. the server component).]),
1249 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1251 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1252     AS_HELP_STRING([--disable-sdremote-bluetooth],
1253         [Determines whether to build sdremote with bluetooth support.
1254          Requires dbus on Linux.]))
1256 libo_FUZZ_ARG_ENABLE(gio,
1257     AS_HELP_STRING([--disable-gio],
1258         [Determines whether to use the GIO support.]),
1259 ,test "${enable_gio+set}" = set || enable_gio=yes)
1261 AC_ARG_ENABLE(kde4,
1262     AS_HELP_STRING([--enable-kde4],
1263         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1264          KDE4 are available.]),
1267 libo_FUZZ_ARG_ENABLE(gui,
1268     AS_HELP_STRING([--disable-gui],
1269         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1270          command-line option. Not related to LibreOffice Online functionality. Don't use
1271          unless you are certain you need to. Nobody will help you if you insist on trying
1272          this and run into problems.]),
1273 ,test "${enable_gui+set}" = set || enable_gui=yes)
1275 libo_FUZZ_ARG_ENABLE(randr,
1276     AS_HELP_STRING([--disable-randr],
1277         [Disable RandR support in the vcl project.]),
1278 ,test "${enable_randr+set}" = set || enable_randr=yes)
1280 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1281     AS_HELP_STRING([--disable-gstreamer-1-0],
1282         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1283 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1285 AC_ARG_ENABLE(gstreamer-0-10,
1286     AS_HELP_STRING([--enable-gstreamer-0-10],
1287         [Enable building with the gstreamer 0.10 avmedia backend.]),
1288 ,enable_gstreamer_0_10=no)
1290 libo_FUZZ_ARG_ENABLE(vlc,
1291     AS_HELP_STRING([--enable-vlc],
1292         [Enable building with the (experimental) VLC avmedia backend.]),
1293 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1295 libo_FUZZ_ARG_ENABLE(neon,
1296     AS_HELP_STRING([--disable-neon],
1297         [Disable neon and the compilation of webdav binding.]),
1300 libo_FUZZ_ARG_ENABLE([eot],
1301     [AS_HELP_STRING([--enable-eot],
1302         [Enable support for Embedded OpenType fonts.])],
1303 ,test "${enable_eot+set}" = set || enable_eot=no)
1305 libo_FUZZ_ARG_ENABLE(cve-tests,
1306     AS_HELP_STRING([--disable-cve-tests],
1307         [Prevent CVE tests to be executed]),
1310 libo_FUZZ_ARG_ENABLE(chart-tests,
1311     AS_HELP_STRING([--enable-chart-tests],
1312         [Executes chart XShape tests. In a perfect world these tests would be
1313          stable and everyone could run them, in reality it is best to run them
1314          only on a few machines that are known to work and maintained by people
1315          who can judge if a test failure is a regression or not.]),
1318 AC_ARG_ENABLE(build-unowinreg,
1319     AS_HELP_STRING([--enable-build-unowinreg],
1320         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1321          compiler is needed on Linux.]),
1324 AC_ARG_ENABLE(dependency-tracking,
1325     AS_HELP_STRING([--enable-dependency-tracking],
1326         [Do not reject slow dependency extractors.])[
1327   --disable-dependency-tracking
1328                           Disables generation of dependency information.
1329                           Speed up one-time builds.],
1332 AC_ARG_ENABLE(icecream,
1333     AS_HELP_STRING([--enable-icecream],
1334         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1335          It defaults to /opt/icecream for the location of the icecream gcc/g++
1336          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1339 libo_FUZZ_ARG_ENABLE(cups,
1340     AS_HELP_STRING([--disable-cups],
1341         [Do not build cups support.])
1344 AC_ARG_ENABLE(ccache,
1345     AS_HELP_STRING([--disable-ccache],
1346         [Do not try to use ccache automatically.
1347          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1348          CC/CXX are not yet set, and --enable-icecream is not given, we
1349          attempt to use ccache. --disable-ccache disables ccache completely.
1353 AC_ARG_ENABLE(64-bit,
1354     AS_HELP_STRING([--enable-64-bit],
1355         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1356          At the moment meaningful only for Windows.]), ,)
1358 libo_FUZZ_ARG_ENABLE(online-update,
1359     AS_HELP_STRING([--enable-online-update],
1360         [Enable the online update service that will check for new versions of
1361          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1362          If the value is "mar", the experimental Mozilla-like update will be
1363          enabled instead of the traditional update mechanism.]),
1366 AC_ARG_WITH(update-config,
1367     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1368                    [Path to the update config ini file]))
1370 libo_FUZZ_ARG_ENABLE(extension-update,
1371     AS_HELP_STRING([--disable-extension-update],
1372         [Disable possibility to update installed extensions.]),
1375 libo_FUZZ_ARG_ENABLE(release-build,
1376     AS_HELP_STRING([--enable-release-build],
1377         [Enable release build.
1378          See http://wiki.documentfoundation.org/Development/DevBuild]),
1381 AC_ARG_ENABLE(windows-build-signing,
1382     AS_HELP_STRING([--enable-windows-build-signing],
1383         [Enable signing of windows binaries (*.exe, *.dll)]),
1386 AC_ARG_ENABLE(silent-msi,
1387     AS_HELP_STRING([--enable-silent-msi],
1388         [Enable MSI with LIMITUI=1 (silent install).]),
1391 AC_ARG_ENABLE(macosx-code-signing,
1392     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1393         [Sign executables, dylibs, frameworks and the app bundle. If you
1394          don't provide an identity the first suitable certificate
1395          in your keychain is used.]),
1398 AC_ARG_ENABLE(macosx-package-signing,
1399     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1400         [Create a .pkg suitable for uploading to the Mac App Store and sign
1401          it. If you don't provide an identity the first suitable certificate
1402          in your keychain is used.]),
1405 AC_ARG_ENABLE(macosx-sandbox,
1406     AS_HELP_STRING([--enable-macosx-sandbox],
1407         [Make the app bundle run in a sandbox. Requires code signing.
1408          Is required by apps distributed in the Mac App Store, and implies
1409          adherence to App Store rules.]),
1412 AC_ARG_WITH(macosx-bundle-identifier,
1413     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1414         [Define the OS X bundle identifier. Default is the somewhat weird
1415          org.libreoffice.script ("script", huh?).]),
1416 ,with_macosx_bundle_identifier=org.libreoffice.script)
1418 AC_ARG_WITH(product-name,
1419     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1420         [Define the product name. Default is AC_PACKAGE_NAME.]),
1421 ,with_product_name=$PRODUCTNAME)
1423 AC_ARG_WITH(package-version,
1424     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1425         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1428 libo_FUZZ_ARG_ENABLE(readonly-installset,
1429     AS_HELP_STRING([--enable-readonly-installset],
1430         [Prevents any attempts by LibreOffice to write into its installation. That means
1431          at least that no "system-wide" extensions can be added. Experimental work in
1432          progress.]),
1435 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1436     AS_HELP_STRING([--disable-postgresql-sdbc],
1437         [Disable the build of the PostgreSQL-SDBC driver.])
1440 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1441     AS_HELP_STRING([--disable-lotuswordpro],
1442         [Disable the build of the Lotus Word Pro filter.]),
1443 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1445 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1446     AS_HELP_STRING([--disable-firebird-sdbc],
1447         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1448 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1450 AC_ARG_ENABLE(bogus-pkg-config,
1451     AS_HELP_STRING([--enable-bogus-pkg-config],
1452         [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.]),
1455 AC_ARG_ENABLE(openssl,
1456     AS_HELP_STRING([--disable-openssl],
1457         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1458          components will either use GNUTLS or NSS. Work in progress,
1459          use only if you are hacking on it.]),
1460 ,enable_openssl=yes)
1462 AC_ARG_ENABLE(library-bin-tar,
1463     AS_HELP_STRING([--enable-library-bin-tar],
1464         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1465         Some libraries can save their build result in a tarball
1466         stored in TARFILE_LOCATION. That binary tarball is
1467         uniquely identified by the source tarball,
1468         the content of the config_host.mk file and the content
1469         of the top-level directory in core for that library
1470         If this option is enabled, then if such a tarfile exist, it will be untarred
1471         instead of the source tarfile, and the build step will be skipped for that
1472         library.
1473         If a proper tarfile does not exist, then the normal source-based
1474         build is done for that library and a proper binary tarfile is created
1475         for the next time.]),
1478 libo_FUZZ_ARG_ENABLE(gltf,
1479     AS_HELP_STRING([--disable-gltf],
1480         [Determines whether to build libraries related to glTF 3D model rendering.]))
1482 libo_FUZZ_ARG_ENABLE(collada,
1483     AS_HELP_STRING([--disable-collada],
1484         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1486 AC_ARG_ENABLE(dconf,
1487     AS_HELP_STRING([--disable-dconf],
1488         [Disable the dconf configuration backend (enabled by default where
1489          available).]))
1491 libo_FUZZ_ARG_ENABLE(formula-logger,
1492     AS_HELP_STRING(
1493         [--enable-formula-logger],
1494         [Enable formula logger for logging formula calculation flow in Calc.]
1495     )
1498 dnl ===================================================================
1499 dnl Optional Packages (--with/without-)
1500 dnl ===================================================================
1502 AC_ARG_WITH(gcc-home,
1503     AS_HELP_STRING([--with-gcc-home],
1504         [Specify the location of gcc/g++ manually. This can be used in conjunction
1505          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1506          non-default path.]),
1509 AC_ARG_WITH(gnu-patch,
1510     AS_HELP_STRING([--with-gnu-patch],
1511         [Specify location of GNU patch on Solaris or FreeBSD.]),
1514 AC_ARG_WITH(build-platform-configure-options,
1515     AS_HELP_STRING([--with-build-platform-configure-options],
1516         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1519 AC_ARG_WITH(gnu-cp,
1520     AS_HELP_STRING([--with-gnu-cp],
1521         [Specify location of GNU cp on Solaris or FreeBSD.]),
1524 AC_ARG_WITH(external-tar,
1525     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1526         [Specify an absolute path of where to find (and store) tarfiles.]),
1527     TARFILE_LOCATION=$withval ,
1530 AC_ARG_WITH(referenced-git,
1531     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1532         [Specify another checkout directory to reference. This makes use of
1533                  git submodule update --reference, and saves a lot of diskspace
1534                  when having multiple trees side-by-side.]),
1535     GIT_REFERENCE_SRC=$withval ,
1538 AC_ARG_WITH(linked-git,
1539     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1540         [Specify a directory where the repositories of submodules are located.
1541          This uses a method similar to git-new-workdir to get submodules.]),
1542     GIT_LINK_SRC=$withval ,
1545 AC_ARG_WITH(galleries,
1546     AS_HELP_STRING([--with-galleries],
1547         [Specify how galleries should be built. It is possible either to
1548          build these internally from source ("build"),
1549          or to disable them ("no")]),
1552 AC_ARG_WITH(theme,
1553     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1554         [Choose which themes to include. By default those themes with an '*' are included.
1555          Possible choices: *breeze, *breeze_dark, crystal, *galaxy, *hicontrast, oxygen, *sifr, *sifr_dark, *tango, *tango_testing.]),
1558 libo_FUZZ_ARG_WITH(helppack-integration,
1559     AS_HELP_STRING([--without-helppack-integration],
1560         [It will not integrate the helppacks to the installer
1561          of the product. Please use this switch to use the online help
1562          or separate help packages.]),
1565 libo_FUZZ_ARG_WITH(fonts,
1566     AS_HELP_STRING([--without-fonts],
1567         [LibreOffice includes some third-party fonts to provide a reliable basis for
1568          help content, templates, samples, etc. When these fonts are already
1569          known to be available on the system then you should use this option.]),
1572 AC_ARG_WITH(epm,
1573     AS_HELP_STRING([--with-epm],
1574         [Decides which epm to use. Default is to use the one from the system if
1575          one is built. When either this is not there or you say =internal epm
1576          will be built.]),
1579 AC_ARG_WITH(package-format,
1580     AS_HELP_STRING([--with-package-format],
1581         [Specify package format(s) for LibreOffice installation sets. The
1582          implicit --without-package-format leads to no installation sets being
1583          generated. Possible values: aix, archive, bsd, deb, dmg,
1584          installed, msi, pkg, and rpm.
1585          Example: --with-package-format='deb rpm']),
1588 AC_ARG_WITH(tls,
1589     AS_HELP_STRING([--with-tls],
1590         [Decides which TLS/SSL and cryptographic implementations to use for
1591          LibreOffice's code. Notice that this doesn't apply for depending
1592          libraries like "neon", for example. Default is to use OpenSSL
1593          although NSS is also possible. Notice that selecting NSS restricts
1594          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1595          restrict by now the usage of NSS in LO's code. Possible values:
1596          openssl, nss. Example: --with-tls="nss"]),
1599 AC_ARG_WITH(system-libs,
1600     AS_HELP_STRING([--with-system-libs],
1601         [Use libraries already on system -- enables all --with-system-* flags.]),
1604 AC_ARG_WITH(system-bzip2,
1605     AS_HELP_STRING([--with-system-bzip2],
1606         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1607     [with_system_bzip2="$with_system_libs"])
1609 AC_ARG_WITH(system-headers,
1610     AS_HELP_STRING([--with-system-headers],
1611         [Use headers already on system -- enables all --with-system-* flags for
1612          external packages whose headers are the only entities used i.e.
1613          boost/odbc/sane-header(s).]),,
1614     [with_system_headers="$with_system_libs"])
1616 AC_ARG_WITH(system-jars,
1617     AS_HELP_STRING([--without-system-jars],
1618         [When building with --with-system-libs, also the needed jars are expected
1619          on the system. Use this to disable that]),,
1620     [with_system_jars="$with_system_libs"])
1622 AC_ARG_WITH(system-cairo,
1623     AS_HELP_STRING([--with-system-cairo],
1624         [Use cairo libraries already on system.  Happens automatically for
1625          (implicit) --enable-gtk and for --enable-gtk3.]))
1627 AC_ARG_WITH(system-epoxy,
1628     AS_HELP_STRING([--with-system-epoxy],
1629         [Use epoxy libraries already on system.  Happens automatically for
1630          --enable-gtk3.]),,
1631        [with_system_epoxy="$with_system_libs"])
1633 AC_ARG_WITH(myspell-dicts,
1634     AS_HELP_STRING([--with-myspell-dicts],
1635         [Adds myspell dictionaries to the LibreOffice installation set]),
1638 AC_ARG_WITH(system-dicts,
1639     AS_HELP_STRING([--without-system-dicts],
1640         [Do not use dictionaries from system paths.]),
1643 AC_ARG_WITH(external-dict-dir,
1644     AS_HELP_STRING([--with-external-dict-dir],
1645         [Specify external dictionary dir.]),
1648 AC_ARG_WITH(external-hyph-dir,
1649     AS_HELP_STRING([--with-external-hyph-dir],
1650         [Specify external hyphenation pattern dir.]),
1653 AC_ARG_WITH(external-thes-dir,
1654     AS_HELP_STRING([--with-external-thes-dir],
1655         [Specify external thesaurus dir.]),
1658 AC_ARG_WITH(system-zlib,
1659     AS_HELP_STRING([--with-system-zlib],
1660         [Use zlib already on system.]),,
1661     [with_system_zlib=auto])
1663 AC_ARG_WITH(system-jpeg,
1664     AS_HELP_STRING([--with-system-jpeg],
1665         [Use jpeg already on system.]),,
1666     [with_system_jpeg="$with_system_libs"])
1668 AC_ARG_WITH(system-libgltf,
1669     AS_HELP_STRING([--with-system-libgltf],
1670         [Use libgltf already on system.]),,
1671     [with_system_libgltf="$with_system_libs"])
1673 AC_ARG_WITH(system-clucene,
1674     AS_HELP_STRING([--with-system-clucene],
1675         [Use clucene already on system.]),,
1676     [with_system_clucene="$with_system_libs"])
1678 AC_ARG_WITH(system-expat,
1679     AS_HELP_STRING([--with-system-expat],
1680         [Use expat already on system.]),,
1681     [with_system_expat="$with_system_libs"])
1683 AC_ARG_WITH(system-libxml,
1684     AS_HELP_STRING([--with-system-libxml],
1685         [Use libxml/libxslt already on system.]),,
1686     [with_system_libxml=auto])
1688 AC_ARG_WITH(system-icu,
1689     AS_HELP_STRING([--with-system-icu],
1690         [Use icu already on system.]),,
1691     [with_system_icu="$with_system_libs"])
1693 AC_ARG_WITH(system-ucpp,
1694     AS_HELP_STRING([--with-system-ucpp],
1695         [Use ucpp already on system.]),,
1696     [])
1698 AC_ARG_WITH(system-opencollada,
1699     AS_HELP_STRING([--with-system-opencollada],
1700         [Use openCOLLADA already on system.]),,
1701     [with_system_opencollada=no])
1703 AC_ARG_WITH(system-collada2gltf,
1704     AS_HELP_STRING([--with-system-collada2gltf],
1705         [Use collada2gltf already on system.]),,
1706     [with_system_collada2gltf=no])
1708 AC_ARG_WITH(system-openldap,
1709     AS_HELP_STRING([--with-system-openldap],
1710         [Use the OpenLDAP LDAP SDK already on system.]),,
1711     [with_system_openldap="$with_system_libs"])
1713 AC_ARG_WITH(system-poppler,
1714     AS_HELP_STRING([--with-system-poppler],
1715         [Use system poppler (only needed for PDF import).]),,
1716     [with_system_poppler="$with_system_libs"])
1718 AC_ARG_WITH(system-gpgmepp,
1719     AS_HELP_STRING([--with-system-gpgmepp],
1720         [Use gpgmepp already on system]),,
1721     [with_system_gpgmepp="$with_system_libs"])
1723 AC_ARG_WITH(system-apache-commons,
1724     AS_HELP_STRING([--with-system-apache-commons],
1725         [Use Apache commons libraries already on system.]),,
1726     [with_system_apache_commons="$with_system_jars"])
1728 AC_ARG_WITH(system-mariadb,
1729     AS_HELP_STRING([--with-system-mariadb],
1730         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1731          extension.]),,
1732     [with_system_mariadb="$with_system_libs"])
1734 AC_ARG_ENABLE(bundle-mariadb,
1735     AS_HELP_STRING([--enable-bundle-mariadb],
1736         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1739 AC_ARG_WITH(system-mysql-cppconn,
1740     AS_HELP_STRING([--with-system-mysql-cppconn],
1741         [Use MySQL C++ Connector libraries already on system.]),,
1742     [with_system_mysql_cppconn="$with_system_libs"])
1744 AC_ARG_WITH(system-postgresql,
1745     AS_HELP_STRING([--with-system-postgresql],
1746         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1747          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1748     [with_system_postgresql="$with_system_libs"])
1750 AC_ARG_WITH(libpq-path,
1751     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1752         [Use this PostgreSQL C interface (libpq) installation for building
1753          the PostgreSQL-SDBC extension.]),
1756 AC_ARG_WITH(system-firebird,
1757     AS_HELP_STRING([--with-system-firebird],
1758         [Use Firebird libraries already on system, for building the Firebird-SDBC
1759          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1760     [with_system_firebird="$with_system_libs"])
1762 AC_ARG_WITH(system-libtommath,
1763             AS_HELP_STRING([--with-system-libtommath],
1764                            [Use libtommath already on system]),,
1765             [with_system_libtommath="$with_system_libs"])
1767 AC_ARG_WITH(system-hsqldb,
1768     AS_HELP_STRING([--with-system-hsqldb],
1769         [Use hsqldb already on system.]))
1771 AC_ARG_WITH(hsqldb-jar,
1772     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1773         [Specify path to jarfile manually.]),
1774     HSQLDB_JAR=$withval)
1776 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1777     AS_HELP_STRING([--disable-scripting-beanshell],
1778         [Disable support for scripts in BeanShell.]),
1782 AC_ARG_WITH(system-beanshell,
1783     AS_HELP_STRING([--with-system-beanshell],
1784         [Use beanshell already on system.]),,
1785     [with_system_beanshell="$with_system_jars"])
1787 AC_ARG_WITH(beanshell-jar,
1788     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1789         [Specify path to jarfile manually.]),
1790     BSH_JAR=$withval)
1792 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1793     AS_HELP_STRING([--disable-scripting-javascript],
1794         [Disable support for scripts in JavaScript.]),
1798 AC_ARG_WITH(system-rhino,
1799     AS_HELP_STRING([--with-system-rhino],
1800         [Use rhino already on system.]),,)
1801 #    [with_system_rhino="$with_system_jars"])
1802 # Above is not used as we have different debug interface
1803 # patched into internal rhino. This code needs to be fixed
1804 # before we can enable it by default.
1806 AC_ARG_WITH(rhino-jar,
1807     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1808         [Specify path to jarfile manually.]),
1809     RHINO_JAR=$withval)
1811 AC_ARG_WITH(commons-codec-jar,
1812     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1813         [Specify path to jarfile manually.]),
1814     COMMONS_CODEC_JAR=$withval)
1816 AC_ARG_WITH(commons-lang-jar,
1817     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1818         [Specify path to jarfile manually.]),
1819     COMMONS_LANG_JAR=$withval)
1821 AC_ARG_WITH(commons-httpclient-jar,
1822     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1823         [Specify path to jarfile manually.]),
1824     COMMONS_HTTPCLIENT_JAR=$withval)
1826 AC_ARG_WITH(commons-logging-jar,
1827     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1828         [Specify path to jarfile manually.]),
1829     COMMONS_LOGGING_JAR=$withval)
1831 AC_ARG_WITH(system-jfreereport,
1832     AS_HELP_STRING([--with-system-jfreereport],
1833         [Use JFreeReport already on system.]),,
1834     [with_system_jfreereport="$with_system_jars"])
1836 AC_ARG_WITH(sac-jar,
1837     AS_HELP_STRING([--with-sac-jar=JARFILE],
1838         [Specify path to jarfile manually.]),
1839     SAC_JAR=$withval)
1841 AC_ARG_WITH(libxml-jar,
1842     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1843         [Specify path to jarfile manually.]),
1844     LIBXML_JAR=$withval)
1846 AC_ARG_WITH(flute-jar,
1847     AS_HELP_STRING([--with-flute-jar=JARFILE],
1848         [Specify path to jarfile manually.]),
1849     FLUTE_JAR=$withval)
1851 AC_ARG_WITH(jfreereport-jar,
1852     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1853         [Specify path to jarfile manually.]),
1854     JFREEREPORT_JAR=$withval)
1856 AC_ARG_WITH(liblayout-jar,
1857     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1858         [Specify path to jarfile manually.]),
1859     LIBLAYOUT_JAR=$withval)
1861 AC_ARG_WITH(libloader-jar,
1862     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1863         [Specify path to jarfile manually.]),
1864     LIBLOADER_JAR=$withval)
1866 AC_ARG_WITH(libformula-jar,
1867     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1868         [Specify path to jarfile manually.]),
1869     LIBFORMULA_JAR=$withval)
1871 AC_ARG_WITH(librepository-jar,
1872     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1873         [Specify path to jarfile manually.]),
1874     LIBREPOSITORY_JAR=$withval)
1876 AC_ARG_WITH(libfonts-jar,
1877     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1878         [Specify path to jarfile manually.]),
1879     LIBFONTS_JAR=$withval)
1881 AC_ARG_WITH(libserializer-jar,
1882     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1883         [Specify path to jarfile manually.]),
1884     LIBSERIALIZER_JAR=$withval)
1886 AC_ARG_WITH(libbase-jar,
1887     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1888         [Specify path to jarfile manually.]),
1889     LIBBASE_JAR=$withval)
1891 AC_ARG_WITH(system-odbc,
1892     AS_HELP_STRING([--with-system-odbc],
1893         [Use the odbc headers already on system.]),,
1894     [with_system_odbc="auto"])
1896 AC_ARG_WITH(system-sane,
1897     AS_HELP_STRING([--with-system-sane],
1898         [Use sane.h already on system.]),,
1899     [with_system_sane="$with_system_headers"])
1901 AC_ARG_WITH(system-bluez,
1902     AS_HELP_STRING([--with-system-bluez],
1903         [Use bluetooth.h already on system.]),,
1904     [with_system_bluez="$with_system_headers"])
1906 AC_ARG_WITH(system-curl,
1907     AS_HELP_STRING([--with-system-curl],
1908         [Use curl already on system.]),,
1909     [with_system_curl=auto])
1911 AC_ARG_WITH(system-boost,
1912     AS_HELP_STRING([--with-system-boost],
1913         [Use boost already on system.]),,
1914     [with_system_boost="$with_system_headers"])
1916 AC_ARG_WITH(system-glm,
1917     AS_HELP_STRING([--with-system-glm],
1918         [Use glm already on system.]),,
1919     [with_system_glm="$with_system_headers"])
1921 AC_ARG_WITH(system-hunspell,
1922     AS_HELP_STRING([--with-system-hunspell],
1923         [Use libhunspell already on system.]),,
1924     [with_system_hunspell="$with_system_libs"])
1926 AC_ARG_WITH(system-mythes,
1927     AS_HELP_STRING([--with-system-mythes],
1928         [Use mythes already on system.]),,
1929     [with_system_mythes="$with_system_libs"])
1931 AC_ARG_WITH(system-altlinuxhyph,
1932     AS_HELP_STRING([--with-system-altlinuxhyph],
1933         [Use ALTLinuxhyph already on system.]),,
1934     [with_system_altlinuxhyph="$with_system_libs"])
1936 AC_ARG_WITH(system-lpsolve,
1937     AS_HELP_STRING([--with-system-lpsolve],
1938         [Use lpsolve already on system.]),,
1939     [with_system_lpsolve="$with_system_libs"])
1941 AC_ARG_WITH(system-coinmp,
1942     AS_HELP_STRING([--with-system-coinmp],
1943         [Use CoinMP already on system.]),,
1944     [with_system_coinmp="$with_system_libs"])
1946 AC_ARG_WITH(system-liblangtag,
1947     AS_HELP_STRING([--with-system-liblangtag],
1948         [Use liblangtag library already on system.]),,
1949     [with_system_liblangtag="$with_system_libs"])
1951 AC_ARG_WITH(webdav,
1952     AS_HELP_STRING([--with-webdav],
1953         [Specify which library to use for webdav implementation.
1954          Possible values: "neon", "serf", "no". The default value is "neon".
1955          Example: --with-webdav="serf"]),
1956     WITH_WEBDAV=$withval,
1957     WITH_WEBDAV="neon")
1959 AC_ARG_WITH(linker-hash-style,
1960     AS_HELP_STRING([--with-linker-hash-style],
1961         [Use linker with --hash-style=<style> when linking shared objects.
1962          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1963          if supported on the build system, and "sysv" otherwise.]))
1965 AC_ARG_WITH(jdk-home,
1966     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1967         [If you have installed JDK 1.3 or later on your system please supply the
1968          path here. Note that this is not the location of the java command but the
1969          location of the entire distribution.]),
1972 AC_ARG_WITH(help,
1973     AS_HELP_STRING([--with-help],
1974         [Enable the build of help. There is a special parameter "common" that
1975          can be used to bundle only the common part, .e.g help-specific icons.
1976          This is useful when you build the helpcontent separately.])
1977     [
1978                           Usage:     --with-help    build the entire local help
1979                                  --without-help     no local help (default)
1980                                  --with-help=common bundle common files for the local
1981                                                     help but do not build the whole help
1982     ],
1985 libo_FUZZ_ARG_WITH(java,
1986     AS_HELP_STRING([--with-java=<java command>],
1987         [Specify the name of the Java interpreter command. Typically "java"
1988          which is the default.
1990          To build without support for Java components, applets, accessibility
1991          or the XML filters written in Java, use --without-java or --with-java=no.]),
1992     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1993     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1996 AC_ARG_WITH(jvm-path,
1997     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1998         [Use a specific JVM search path at runtime.
1999          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2002 AC_ARG_WITH(ant-home,
2003     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2004         [If you have installed Jakarta Ant on your system, please supply the path here.
2005          Note that this is not the location of the Ant binary but the location
2006          of the entire distribution.]),
2009 AC_ARG_WITH(symbol-config,
2010     AS_HELP_STRING([--with-symbol-config],
2011         [Configuration for the crashreport symbol upload]),
2012         [],
2013         [with_symbol_config=no])
2015 AC_ARG_WITH(export-validation,
2016     AS_HELP_STRING([--without-export-validation],
2017         [Disable validating OOXML and ODF files as exported from in-tree tests.
2018          Use this option e.g. if your system only provides Java 5.]),
2019 ,with_export_validation=yes)
2021 AC_ARG_WITH(bffvalidator,
2022     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2023         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2024          Requires installed Microsoft Office Binary File Format Validator.
2025          Note: export-validation (--with-export-validation) is required to be turned on.
2026          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2027 ,with_bffvalidator=no)
2029 libo_FUZZ_ARG_WITH(junit,
2030     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2031         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2032          --without-junit disables those tests. Not relevant in the --without-java case.]),
2033 ,with_junit=yes)
2035 AC_ARG_WITH(hamcrest,
2036     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2037         [Specifies the hamcrest jar file to use for JUnit-based tests.
2038          --without-junit disables those tests. Not relevant in the --without-java case.]),
2039 ,with_hamcrest=yes)
2041 AC_ARG_WITH(perl-home,
2042     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2043         [If you have installed Perl 5 Distribution, on your system, please
2044          supply the path here. Note that this is not the location of the Perl
2045          binary but the location of the entire distribution.]),
2048 libo_FUZZ_ARG_WITH(doxygen,
2049     AS_HELP_STRING(
2050         [--with-doxygen=<absolute path to doxygen executable>],
2051         [Specifies the doxygen executable to use when generating ODK C/C++
2052          documentation. --without-doxygen disables generation of ODK C/C++
2053          documentation. Not relevant in the --disable-odk case.]),
2054 ,with_doxygen=yes)
2056 AC_ARG_WITH(visual-studio,
2057     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
2058         [Specify which Visual Studio version to use in case several are
2059          installed. If not specified, defaults to 2015.]),
2062 AC_ARG_WITH(windows-sdk,
2063     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2064         [Specify which Windows SDK, or "Windows Kit", version to use
2065          in case the one that came with the selected Visual Studio
2066          is not what you want for some reason. Note that not all compiler/SDK
2067          combinations are supported. The intent is that this option should not
2068          be needed.]),
2071 AC_ARG_WITH(lang,
2072     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2073         [Use this option to build LibreOffice with additional UI language support.
2074          English (US) is always included by default.
2075          Separate multiple languages with space.
2076          For all languages, use --with-lang=ALL.]),
2079 AC_ARG_WITH(locales,
2080     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2081         [Use this option to limit the locale information built in.
2082          Separate multiple locales with space.
2083          Very experimental and might well break stuff.
2084          Just a desperate measure to shrink code and data size.
2085          By default all the locales available is included.
2086          This option is completely unrelated to --with-lang.])
2087     [
2088                           Affects also our character encoding conversion
2089                           tables for encodings mainly targeted for a
2090                           particular locale, like EUC-CN and EUC-TW for
2091                           zh, ISO-2022-JP for ja.
2093                           Affects also our add-on break iterator data for
2094                           some languages.
2096                           For the default, all locales, don't use this switch at all.
2097                           Specifying just the language part of a locale means all matching
2098                           locales will be included.
2099     ],
2102 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2103 libo_FUZZ_ARG_WITH(krb5,
2104     AS_HELP_STRING([--with-krb5],
2105         [Enable MIT Kerberos 5 support in modules that support it.
2106          By default automatically enabled on platforms
2107          where a good system Kerberos 5 is available.]),
2110 libo_FUZZ_ARG_WITH(gssapi,
2111     AS_HELP_STRING([--with-gssapi],
2112         [Enable GSSAPI support in modules that support it.
2113          By default automatically enabled on platforms
2114          where a good system GSSAPI is available.]),
2117 AC_ARG_WITH(iwyu,
2118     AS_HELP_STRING([--with-iwyu],
2119         [Use given IWYU binary path to check unneeded includes instead of building.
2120          Use only if you are hacking on it.]),
2123 dnl ===================================================================
2124 dnl Branding
2125 dnl ===================================================================
2127 AC_ARG_WITH(branding,
2128     AS_HELP_STRING([--with-branding=/path/to/images],
2129         [Use given path to retrieve branding images set.])
2130     [
2131                           Search for intro.png about.svg and flat_logo.svg.
2132                           If any is missing, default ones will be used instead.
2134                           Search also progress.conf for progress
2135                           settings on intro screen :
2137                           PROGRESSBARCOLOR="255,255,255" Set color of
2138                           progress bar. Comma separated RGB decimal values.
2139                           PROGRESSSIZE="407,6" Set size of progress bar.
2140                           Comma separated decimal values (width, height).
2141                           PROGRESSPOSITION="61,317" Set position of progress
2142                           bar from left,top. Comma separated decimal values.
2143                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2144                           bar frame. Comma separated RGB decimal values.
2145                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2146                           bar text. Comma separated RGB decimal values.
2147                           PROGRESSTEXTBASELINE="287" Set vertical position of
2148                           progress bar text from top. Decimal value.
2150                           Default values will be used if not found.
2151     ],
2155 AC_ARG_WITH(extra-buildid,
2156     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2157         [Show addition build identification in about dialog.]),
2161 AC_ARG_WITH(vendor,
2162     AS_HELP_STRING([--with-vendor="John the Builder"],
2163         [Set vendor of the build.]),
2166 AC_ARG_WITH(android-package-name,
2167     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2168         [Set Android package name of the build.]),
2171 AC_ARG_WITH(compat-oowrappers,
2172     AS_HELP_STRING([--with-compat-oowrappers],
2173         [Install oo* wrappers in parallel with
2174          lo* ones to keep backward compatibility.
2175          Has effect only with make distro-pack-install]),
2178 AC_ARG_WITH(os-version,
2179     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2180         [For FreeBSD users, use this option option to override the detected OSVERSION.]),
2183 AC_ARG_WITH(mingw-cross-compiler,
2184     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2185         [Specify the MinGW cross-compiler to use.
2186          When building on the ODK on Unix and building unowinreg.dll,
2187          specify the MinGW C++ cross-compiler.]),
2190 AC_ARG_WITH(idlc-cpp,
2191     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2192         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2195 AC_ARG_WITH(build-version,
2196     AS_HELP_STRING([--with-build-version="Built by Jim"],
2197         [Allows the builder to add a custom version tag that will appear in the
2198          Help/About box for QA purposes.]),
2199 with_build_version=$withval,
2202 AC_ARG_WITH(alloc,
2203     AS_HELP_STRING([--with-alloc],
2204         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2205          Note that on FreeBSD/NetBSD system==jemalloc]),
2208 AC_ARG_WITH(parallelism,
2209     AS_HELP_STRING([--with-parallelism],
2210         [Number of jobs to run simultaneously during build. Parallel builds can
2211         save a lot of time on multi-cpu machines. Defaults to the number of
2212         CPUs on the machine, unless you configure --enable-icecream - then to
2213         10.]),
2216 AC_ARG_WITH(all-tarballs,
2217     AS_HELP_STRING([--with-all-tarballs],
2218         [Download all external tarballs unconditionally]))
2220 AC_ARG_WITH(gdrive-client-id,
2221     AS_HELP_STRING([--with-gdrive-client-id],
2222         [Provides the client id of the application for OAuth2 authentication
2223         on Google Drive. If either this or --with-gdrive-client-secret is
2224         empty, the feature will be disabled]),
2227 AC_ARG_WITH(gdrive-client-secret,
2228     AS_HELP_STRING([--with-gdrive-client-secret],
2229         [Provides the client secret of the application for OAuth2
2230         authentication on Google Drive. If either this or
2231         --with-gdrive-client-id is empty, the feature will be disabled]),
2234 AC_ARG_WITH(alfresco-cloud-client-id,
2235     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2236         [Provides the client id of the application for OAuth2 authentication
2237         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2238         empty, the feature will be disabled]),
2241 AC_ARG_WITH(alfresco-cloud-client-secret,
2242     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2243         [Provides the client secret of the application for OAuth2
2244         authentication on Alfresco Cloud. If either this or
2245         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2248 AC_ARG_WITH(onedrive-client-id,
2249     AS_HELP_STRING([--with-onedrive-client-id],
2250         [Provides the client id of the application for OAuth2 authentication
2251         on OneDrive. If either this or --with-onedrive-client-secret is
2252         empty, the feature will be disabled]),
2255 AC_ARG_WITH(onedrive-client-secret,
2256     AS_HELP_STRING([--with-onedrive-client-secret],
2257         [Provides the client secret of the application for OAuth2
2258         authentication on OneDrive. If either this or
2259         --with-onedrive-client-id is empty, the feature will be disabled]),
2261 dnl ===================================================================
2262 dnl Do we want to use pre-build binary tarball for recompile
2263 dnl ===================================================================
2265 if test "$enable_library_bin_tar" = "yes" ; then
2266     USE_LIBRARY_BIN_TAR=TRUE
2267 else
2268     USE_LIBRARY_BIN_TAR=
2270 AC_SUBST(USE_LIBRARY_BIN_TAR)
2272 dnl ===================================================================
2273 dnl Test whether build target is Release Build
2274 dnl ===================================================================
2275 AC_MSG_CHECKING([whether build target is Release Build])
2276 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2277     AC_MSG_RESULT([no])
2278     ENABLE_RELEASE_BUILD=
2279 else
2280     AC_MSG_RESULT([yes])
2281     ENABLE_RELEASE_BUILD=TRUE
2283 AC_SUBST(ENABLE_RELEASE_BUILD)
2285 dnl ===================================================================
2286 dnl Test whether to sign Windows Build
2287 dnl ===================================================================
2288 AC_MSG_CHECKING([whether to sign windows build])
2289 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2290     AC_MSG_RESULT([yes])
2291     WINDOWS_BUILD_SIGNING="TRUE"
2292 else
2293     AC_MSG_RESULT([no])
2294     WINDOWS_BUILD_SIGNING="FALSE"
2296 AC_SUBST(WINDOWS_BUILD_SIGNING)
2298 dnl ===================================================================
2299 dnl MacOSX build and runtime environment options
2300 dnl ===================================================================
2302 AC_ARG_WITH(macosx-sdk,
2303     AS_HELP_STRING([--with-macosx-sdk=<version>],
2304         [Prefer a specific SDK for building.])
2305     [
2306                           If the requested SDK is not available, a search for the oldest one will be done.
2307                           With current Xcode versions, only the latest SDK is included, so this option is
2308                           not terribly useful. It works fine to build with a new SDK and run the result
2309                           on an older OS.
2311                           e. g.: --with-macosx-sdk=10.9
2313                           there are 3 options to control the MacOSX build:
2314                           --with-macosx-sdk (referred as 'sdk' below)
2315                           --with-macosx-version-min-required (referred as 'min' below)
2316                           --with-macosx-version-max-allowed (referred as 'max' below)
2318                           the connection between these value and the default they take is as follow:
2319                           ( ? means not specified on the command line, s means the SDK version found,
2320                           constraint: 8 <= x <= y <= z)
2322                           ==========================================
2323                            command line      || config result
2324                           ==========================================
2325                           min  | max  | sdk  || min  | max  | sdk  |
2326                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2327                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2328                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2329                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2330                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2331                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2332                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2333                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2336                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2337                           for a detailed technical explanation of these variables
2339                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2340     ],
2343 AC_ARG_WITH(macosx-version-min-required,
2344     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2345         [set the minimum OS version needed to run the built LibreOffice])
2346     [
2347                           e. g.: --with-macos-version-min-required=10.9
2348                           see --with-macosx-sdk for more info
2349     ],
2352 AC_ARG_WITH(macosx-version-max-allowed,
2353     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2354         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2355     [
2356                           e. g.: --with-macos-version-max-allowed=10.9
2357                           see --with-macosx-sdk for more info
2358     ],
2362 dnl ===================================================================
2363 dnl options for stuff used during cross-compilation build
2364 dnl Not quite superseded by --with-build-platform-configure-options.
2365 dnl TODO: check, if the "force" option is still needed anywhere.
2366 dnl ===================================================================
2368 AC_ARG_WITH(system-icu-for-build,
2369     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2370         [Use icu already on system for build tools (cross-compilation only).]))
2373 dnl ===================================================================
2374 dnl Check for incompatible options set by fuzzing, and reset those
2375 dnl automatically to working combinations
2376 dnl ===================================================================
2378 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2379         "$enable_dbus" != "$enable_avahi"; then
2380     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2381     enable_avahi=$enable_dbus
2384 dnl ===================================================================
2385 dnl check for required programs (grep, awk, sed, bash)
2386 dnl ===================================================================
2388 pathmunge ()
2390     if test -n "$1"; then
2391         if test "$build_os" = "cygwin"; then
2392             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2393                 PathFormat "$1"
2394                 new_path=`cygpath -sm "$formatted_path"`
2395             else
2396                 PathFormat "$1"
2397                 new_path=`cygpath -u "$formatted_path"`
2398             fi
2399         else
2400             new_path="$1"
2401         fi
2402         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2403             if test "$2" = "after"; then
2404                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2405             else
2406                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2407             fi
2408         fi
2409         unset new_path
2410     fi
2413 AC_PROG_AWK
2414 AC_PATH_PROG( AWK, $AWK)
2415 if test -z "$AWK"; then
2416     AC_MSG_ERROR([install awk to run this script])
2419 AC_PATH_PROG(BASH, bash)
2420 if test -z "$BASH"; then
2421     AC_MSG_ERROR([bash not found in \$PATH])
2423 AC_SUBST(BASH)
2425 AC_MSG_CHECKING([for GNU or BSD tar])
2426 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2427     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2428     if test $? -eq 0;  then
2429         GNUTAR=$a
2430         break
2431     fi
2432 done
2433 AC_MSG_RESULT($GNUTAR)
2434 if test -z "$GNUTAR"; then
2435     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2437 AC_SUBST(GNUTAR)
2439 AC_MSG_CHECKING([for tar's option to strip components])
2440 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2441 if test $? -eq 0; then
2442     STRIP_COMPONENTS="--strip-components"
2443 else
2444     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2445     if test $? -eq 0; then
2446         STRIP_COMPONENTS="--strip-path"
2447     else
2448         STRIP_COMPONENTS="unsupported"
2449     fi
2451 AC_MSG_RESULT($STRIP_COMPONENTS)
2452 if test x$STRIP_COMPONENTS = xunsupported; then
2453     AC_MSG_ERROR([you need a tar that is able to strip components.])
2455 AC_SUBST(STRIP_COMPONENTS)
2457 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2458 dnl desktop OSes from "mobile" ones.
2460 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2461 dnl In other words, that when building for an OS that is not a
2462 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2464 dnl Note the direction of the implication; there is no assumption that
2465 dnl cross-compiling would imply a non-desktop OS.
2467 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2468     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2469     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2470     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2473 # Whether to build "avmedia" functionality or not.
2475 if test -z "$enable_avmedia"; then
2476     enable_avmedia=yes
2479 if test "$enable_avmedia" = yes; then
2480     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2481     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2484 # Decide whether to build database connectivity stuff (including
2485 # Base) or not. We probably don't want to on non-desktop OSes.
2487 if test -z "$enable_database_connectivity"; then
2488     # --disable-database-connectivity is unfinished work in progress
2489     # and the iOS test app doesn't link if we actually try to use it.
2490     # if test $_os != iOS -a $_os != Android; then
2491         enable_database_connectivity=yes
2492     # fi
2495 if test "$enable_database_connectivity" = yes; then
2496     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2497     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2500 if test -z "$enable_extensions"; then
2501     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2502     if test $_os != iOS -a $_os != Android; then
2503         enable_extensions=yes
2504     fi
2507 if test "$enable_extensions" = yes; then
2508     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2509     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2512 if test -z "$enable_scripting"; then
2513     # Disable scripting for iOS unless specifically overridden
2514     # with --enable-scripting.
2515     if test $_os != iOS; then
2516         enable_scripting=yes
2517     fi
2520 DISABLE_SCRIPTING=''
2521 if test "$enable_scripting" = yes; then
2522     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2523     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2524 else
2525     DISABLE_SCRIPTING='TRUE'
2526     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2529 if test $_os = iOS -o $_os = Android; then
2530     # Disable dynamic_loading always for iOS and Android
2531     enable_dynamic_loading=no
2532 elif test -z "$enable_dynamic_loading"; then
2533     # Otherwise enable it unless speficically disabled
2534     enable_dynamic_loading=yes
2537 DISABLE_DYNLOADING=''
2538 if test "$enable_dynamic_loading" = yes; then
2539     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2540 else
2541     DISABLE_DYNLOADING='TRUE'
2543 AC_SUBST(DISABLE_DYNLOADING)
2545 # remenber SYSBASE value
2546 AC_SUBST(SYSBASE)
2548 dnl ===================================================================
2549 dnl  Sort out various gallery compilation options
2550 dnl ===================================================================
2551 AC_MSG_CHECKING([how to build and package galleries])
2552 if test -n "${with_galleries}"; then
2553     if test "$with_galleries" = "build"; then
2554         WITH_GALLERY_BUILD=TRUE
2555         AC_MSG_RESULT([build from source images internally])
2556     elif test "$with_galleries" = "no"; then
2557         WITH_GALLERY_BUILD=
2558         AC_MSG_RESULT([disable non-internal gallery build])
2559     else
2560         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2561     fi
2562 else
2563     if test $_os != iOS -a $_os != Android; then
2564         WITH_GALLERY_BUILD=TRUE
2565         AC_MSG_RESULT([internal src images for desktop])
2566     else
2567         WITH_GALLERY_BUILD=
2568         AC_MSG_RESULT([disable src image build])
2569     fi
2571 AC_SUBST(WITH_GALLERY_BUILD)
2573 dnl ===================================================================
2574 dnl  Checks if ccache is available
2575 dnl ===================================================================
2576 if test "$_os" = "WINNT"; then
2577     # on windows/VC build do not use ccache
2578     CCACHE=""
2579 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2580     case "%$CC%$CXX%" in
2581     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2582     # assume that's good then
2583     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2584         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2585         ;;
2586     *)
2587         AC_PATH_PROG([CCACHE],[ccache],[not found])
2588         if test "$CCACHE" = "not found"; then
2589             CCACHE=""
2590         else
2591             # Need to check for ccache version: otherwise prevents
2592             # caching of the results (like "-x objective-c++" for Mac)
2593             if test $_os = Darwin -o $_os = iOS; then
2594                 # Check ccache version
2595                 AC_MSG_CHECKING([whether version of ccache is suitable])
2596                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2597                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2598                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2599                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2600                 else
2601                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2602                     CCACHE=""
2603                 fi
2604             fi
2605         fi
2606         ;;
2607     esac
2608 else
2609     CCACHE=""
2612 if test "$CCACHE" != ""; then
2613     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2614     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2615     if test "$ccache_size" = ""; then
2616         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2617         if test "$ccache_size" = ""; then
2618             ccache_size=0
2619         fi
2620         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2621         if test $ccache_size -lt 1024; then
2622             CCACHE=""
2623             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2624             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2625         else
2626             # warn that ccache may be too small for debug build
2627             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2628             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2629         fi
2630     else
2631         if test $ccache_size -lt 5; then
2632             #warn that ccache may be too small for debug build
2633             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2634             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2635         fi
2636     fi
2639 dnl ===================================================================
2640 dnl  Checks for C compiler,
2641 dnl  The check for the C++ compiler is later on.
2642 dnl ===================================================================
2643 if test "$_os" != "WINNT"; then
2644     GCC_HOME_SET="true"
2645     AC_MSG_CHECKING([gcc home])
2646     if test -z "$with_gcc_home"; then
2647         if test "$enable_icecream" = "yes"; then
2648             if test -d "/usr/lib/icecc/bin"; then
2649                 GCC_HOME="/usr/lib/icecc/"
2650             else
2651                 GCC_HOME="/opt/icecream/"
2652             fi
2653         else
2654             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2655             GCC_HOME_SET="false"
2656         fi
2657     else
2658         GCC_HOME="$with_gcc_home"
2659     fi
2660     AC_MSG_RESULT($GCC_HOME)
2661     AC_SUBST(GCC_HOME)
2663     if test "$GCC_HOME_SET" = "true"; then
2664         if test -z "$CC"; then
2665             CC="$GCC_HOME/bin/gcc"
2666         fi
2667         if test -z "$CXX"; then
2668             CXX="$GCC_HOME/bin/g++"
2669         fi
2670     fi
2673 COMPATH=`dirname "$CC"`
2674 if test "$COMPATH" = "."; then
2675     AC_PATH_PROGS(COMPATH, $CC)
2676     dnl double square bracket to get single because of M4 quote...
2677     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2679 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2681 dnl ===================================================================
2682 dnl Java support
2683 dnl ===================================================================
2684 AC_MSG_CHECKING([whether to build with Java support])
2685 if test "$with_java" != "no"; then
2686     if test "$DISABLE_SCRIPTING" = TRUE; then
2687         AC_MSG_RESULT([no, overridden by --disable-scripting])
2688         ENABLE_JAVA=""
2689         with_java=no
2690     else
2691         AC_MSG_RESULT([yes])
2692         ENABLE_JAVA="TRUE"
2693         AC_DEFINE(HAVE_FEATURE_JAVA)
2694     fi
2695 else
2696     AC_MSG_RESULT([no])
2697     ENABLE_JAVA=""
2700 AC_SUBST(ENABLE_JAVA)
2702 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2704 dnl ENABLE_JAVA="" indicate no Java support at all
2706 dnl ===================================================================
2707 dnl Check OS X SDK and compiler
2708 dnl ===================================================================
2710 if test $_os = Darwin; then
2712     # If no --with-macosx-sdk option is given, look for one
2714     # The intent is that for "most" Mac-based developers, a suitable
2715     # SDK will be found automatically without any configure options.
2717     # For developers with a current Xcode, the lowest-numbered SDK
2718     # higher than or equal to the minimum required should be found.
2720     AC_MSG_CHECKING([what Mac OS X SDK to use])
2722     for _macosx_sdk in $with_macosx_sdk 10.9 10.10 10.11 10.12; do
2723         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2724         if test -d "$MACOSX_SDK_PATH"; then
2725             with_macosx_sdk="${_macosx_sdk}"
2726             break
2727         else
2728             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2729             if test -d "$MACOSX_SDK_PATH"; then
2730                 with_macosx_sdk="${_macosx_sdk}"
2731                 break
2732             fi
2733         fi
2734     done
2735     if test ! -d "$MACOSX_SDK_PATH"; then
2736         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2737     fi
2738     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2740     case $with_macosx_sdk in
2741     10.9)
2742         MACOSX_SDK_VERSION=1090
2743         ;;
2744     10.10)
2745         MACOSX_SDK_VERSION=101000
2746         ;;
2747     10.11)
2748         MACOSX_SDK_VERSION=101100
2749         ;;
2750     10.12)
2751         MACOSX_SDK_VERSION=101200
2752         ;;
2753     *)
2754         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--12])
2755         ;;
2756     esac
2758     if test "$with_macosx_version_min_required" = "" ; then
2759         with_macosx_version_min_required="10.9";
2760     fi
2762     if test "$with_macosx_version_max_allowed" = "" ; then
2763         with_macosx_version_max_allowed="$with_macosx_sdk"
2764     fi
2766     # export this so that "xcrun" invocations later return matching values
2767     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2768     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2769     export DEVELOPER_DIR
2770     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2771     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2773     case "$with_macosx_version_min_required" in
2774     10.9)
2775         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2776         ;;
2777     10.10)
2778         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2779         ;;
2780     10.11)
2781         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2782         ;;
2783     10.12)
2784         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2785         ;;
2786     *)
2787         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--12])
2788         ;;
2789     esac
2791     LIBTOOL=/usr/bin/libtool
2792     INSTALL_NAME_TOOL=install_name_tool
2793     if test -z "$save_CC"; then
2794         AC_MSG_CHECKING([what compiler to use])
2795         stdlib=-stdlib=libc++
2796         if test "$ENABLE_LTO" = TRUE; then
2797             lto=-flto
2798         fi
2799         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2800         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2801         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2802         AR=`xcrun -find ar`
2803         NM=`xcrun -find nm`
2804         STRIP=`xcrun -find strip`
2805         LIBTOOL=`xcrun -find libtool`
2806         RANLIB=`xcrun -find ranlib`
2807         AC_MSG_RESULT([$CC and $CXX])
2808     fi
2810     case "$with_macosx_version_max_allowed" in
2811     10.9)
2812         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2813         ;;
2814     10.10)
2815         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2816         ;;
2817     10.11)
2818         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2819         ;;
2820     10.12)
2821         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2822         ;;
2823     *)
2824         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--12])
2825         ;;
2826     esac
2828     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2829     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2830         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2831     else
2832         AC_MSG_RESULT([ok])
2833     fi
2835     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2836     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2837         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2838     else
2839         AC_MSG_RESULT([ok])
2840     fi
2841     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2842     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2844     AC_MSG_CHECKING([whether to do code signing])
2846     if test "$enable_macosx_code_signing" = yes; then
2847         # By default use the first suitable certificate (?).
2849         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2850         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2851         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2852         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2853         # "Developer ID Application" one.
2855         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2856         if test -n "$identity"; then
2857             MACOSX_CODESIGNING_IDENTITY=$identity
2858             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2859             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2860         else
2861             AC_MSG_ERROR([cannot determine identity to use])
2862         fi
2863     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2864         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2865         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2866         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2867     else
2868         AC_MSG_RESULT([no])
2869     fi
2871     AC_MSG_CHECKING([whether to create a Mac App Store package])
2873     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2874         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2875     elif test "$enable_macosx_package_signing" = yes; then
2876         # By default use the first suitable certificate.
2877         # It should be a "3rd Party Mac Developer Installer" one
2879         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2880         if test -n "$identity"; then
2881             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2882             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2883             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2884         else
2885             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2886         fi
2887     elif test -n "$enable_macosx_package_signing"; then
2888         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2889         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2890         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2891     else
2892         AC_MSG_RESULT([no])
2893     fi
2895     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2896         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2897     fi
2899     AC_MSG_CHECKING([whether to sandbox the application])
2901     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2902         AC_MSG_ERROR([OS X sandboxing requires code signing])
2903     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2904         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2905     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2906         ENABLE_MACOSX_SANDBOX=TRUE
2907         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2908         AC_MSG_RESULT([yes])
2909     else
2910         AC_MSG_RESULT([no])
2911     fi
2913     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2914     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2915     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2917 AC_SUBST(MACOSX_SDK_PATH)
2918 AC_SUBST(MACOSX_SDK_VERSION)
2919 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2920 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2921 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2922 AC_SUBST(INSTALL_NAME_TOOL)
2923 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2924 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2925 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2926 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2927 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2929 dnl ===================================================================
2930 dnl Check iOS SDK and compiler
2931 dnl ===================================================================
2933 if test $_os = iOS; then
2934     if test "$host_cpu" = "arm64"; then
2935         BITNESS_OVERRIDE=64
2936     fi
2938     AC_MSG_CHECKING([what iOS SDK to use])
2940     if test "$build_cpu" = "i386"; then
2941         platform=iPhoneSimulator
2942         XCODE_ARCHS=i386
2943         versionmin=-mios-simulator-version-min=9.3
2944     elif test "$build_cpu" = "x86_64"; then
2945         platform=iPhoneSimulator
2946         XCODE_ARCHS=x86_64
2947         versionmin=-mios-simulator-version-min=9.3
2948     else
2949         platform=iPhoneOS
2950         XCODE_ARCHS=$host_cpu
2951         versionmin=-miphoneos-version-min=9.3
2952     fi
2954     xcode_developer=`xcode-select -print-path`
2956     current_sdk_ver=10.2
2957     for sdkver in 10.3 10.2 10.1 10.0 9.3; do
2958         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2959         if test -d $t; then
2960             ios_sdk=$sdkver
2961             sysroot=$t
2962             break
2963         fi
2964     done
2966     if test -z "$sysroot"; then
2967         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2968     fi
2970     AC_MSG_RESULT($sysroot)
2972     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2974     # LTO is not really recommended for iOS builds,
2975     # the link time will be astronomical
2976     if test "$ENABLE_LTO" = TRUE; then
2977         lto=-flto
2978     fi
2979     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
2980     # get compiled with it, to avoid ld warnings when linking all that together into one
2981     # executable.
2983     XCODE_CLANG_CXX_LIBRARY=libc++
2984     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
2986     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
2987     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
2989     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2990     AR=`xcrun -find ar`
2991     NM=`xcrun -find nm`
2992     STRIP=`xcrun -find strip`
2993     LIBTOOL=`xcrun -find libtool`
2994     RANLIB=`xcrun -find ranlib`
2997 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
2998 AC_SUBST(XCODE_ARCHS)
2999 AC_SUBST(XCODEBUILD_SDK)
3001 AC_MSG_CHECKING([whether to treat the installation as read-only])
3003 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3004         "$enable_extensions" != yes; then
3005     enable_readonly_installset=yes
3007 if test "$enable_readonly_installset" = yes; then
3008     AC_MSG_RESULT([yes])
3009     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3010 else
3011     AC_MSG_RESULT([no])
3014 dnl ===================================================================
3015 dnl Structure of install set
3016 dnl ===================================================================
3018 if test $_os = Darwin; then
3019     LIBO_BIN_FOLDER=MacOS
3020     LIBO_ETC_FOLDER=Resources
3021     LIBO_LIBEXEC_FOLDER=MacOS
3022     LIBO_LIB_FOLDER=Frameworks
3023     LIBO_LIB_PYUNO_FOLDER=Resources
3024     LIBO_SHARE_FOLDER=Resources
3025     LIBO_SHARE_HELP_FOLDER=Resources/help
3026     LIBO_SHARE_JAVA_FOLDER=Resources/java
3027     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3028     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3029     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3030     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3031     LIBO_URE_BIN_FOLDER=MacOS
3032     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3033     LIBO_URE_LIB_FOLDER=Frameworks
3034     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3035     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3036 elif test $_os = WINNT; then
3037     LIBO_BIN_FOLDER=program
3038     LIBO_ETC_FOLDER=program
3039     LIBO_LIBEXEC_FOLDER=program
3040     LIBO_LIB_FOLDER=program
3041     LIBO_LIB_PYUNO_FOLDER=program
3042     LIBO_SHARE_FOLDER=share
3043     LIBO_SHARE_HELP_FOLDER=help
3044     LIBO_SHARE_JAVA_FOLDER=program/classes
3045     LIBO_SHARE_PRESETS_FOLDER=presets
3046     LIBO_SHARE_READMES_FOLDER=readmes
3047     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3048     LIBO_SHARE_SHELL_FOLDER=program/shell
3049     LIBO_URE_BIN_FOLDER=program
3050     LIBO_URE_ETC_FOLDER=program
3051     LIBO_URE_LIB_FOLDER=program
3052     LIBO_URE_MISC_FOLDER=program
3053     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3054 else
3055     LIBO_BIN_FOLDER=program
3056     LIBO_ETC_FOLDER=program
3057     LIBO_LIBEXEC_FOLDER=program
3058     LIBO_LIB_FOLDER=program
3059     LIBO_LIB_PYUNO_FOLDER=program
3060     LIBO_SHARE_FOLDER=share
3061     LIBO_SHARE_HELP_FOLDER=help
3062     LIBO_SHARE_JAVA_FOLDER=program/classes
3063     LIBO_SHARE_PRESETS_FOLDER=presets
3064     LIBO_SHARE_READMES_FOLDER=readmes
3065     if test "$enable_fuzzers" != yes; then
3066         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3067     else
3068         LIBO_SHARE_RESOURCE_FOLDER=resource
3069     fi
3070     LIBO_SHARE_SHELL_FOLDER=program/shell
3071     LIBO_URE_BIN_FOLDER=program
3072     LIBO_URE_ETC_FOLDER=program
3073     LIBO_URE_LIB_FOLDER=program
3074     LIBO_URE_MISC_FOLDER=program
3075     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3077 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3078 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3079 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3080 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3081 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3091 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3092 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3094 # Not all of them needed in config_host.mk, add more if need arises
3095 AC_SUBST(LIBO_BIN_FOLDER)
3096 AC_SUBST(LIBO_ETC_FOLDER)
3097 AC_SUBST(LIBO_LIB_FOLDER)
3098 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3099 AC_SUBST(LIBO_SHARE_FOLDER)
3100 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3101 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3102 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3103 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3104 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3105 AC_SUBST(LIBO_URE_BIN_FOLDER)
3106 AC_SUBST(LIBO_URE_ETC_FOLDER)
3107 AC_SUBST(LIBO_URE_LIB_FOLDER)
3108 AC_SUBST(LIBO_URE_MISC_FOLDER)
3109 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3111 dnl ===================================================================
3112 dnl Windows specific tests and stuff
3113 dnl ===================================================================
3115 reg_get_value()
3117     # Return value: $regvalue
3118     unset regvalue
3120     local _regentry="/proc/registry${1}/${2}"
3121     if test -f "$_regentry"; then
3122         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3123         # Registry keys read via /proc/registry* are always \0 terminated!
3124         local _regvalue=$(tr -d '\0' < "$_regentry")
3125         if test $? -eq 0; then
3126             regvalue=$_regvalue
3127         fi
3128     fi
3131 # Get a value from the 32-bit side of the Registry
3132 reg_get_value_32()
3134     reg_get_value "32" "$1"
3137 # Get a value from the 64-bit side of the Registry
3138 reg_get_value_64()
3140     reg_get_value "64" "$1"
3143 if test "$_os" = "WINNT"; then
3144     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3145     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3146         AC_MSG_RESULT([no])
3147         WINDOWS_SDK_ARCH="x86"
3148     else
3149         AC_MSG_RESULT([yes])
3150         WINDOWS_SDK_ARCH="x64"
3151         BITNESS_OVERRIDE=64
3152     fi
3155 if test "$cross_compiling" = "yes"; then
3156     export CROSS_COMPILING=TRUE
3157 else
3158     CROSS_COMPILING=
3159     BUILD_TYPE="$BUILD_TYPE NATIVE"
3161 AC_SUBST(CROSS_COMPILING)
3163 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3164 if test "$GCC" = "yes"; then
3165     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3166     bsymbolic_functions_ldflags_save=$LDFLAGS
3167     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3168     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3169 #include <stdio.h>
3170         ],[
3171 printf ("hello world\n");
3172         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3173     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3174         AC_MSG_RESULT( found )
3175     else
3176         AC_MSG_RESULT( not found )
3177     fi
3178     LDFLAGS=$bsymbolic_functions_ldflags_save
3180 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3182 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3183 # NOTE: must _not_ be used for bundled external libraries!
3184 ISYSTEM=
3185 if test "$GCC" = "yes"; then
3186     AC_MSG_CHECKING( for -isystem )
3187     save_CFLAGS=$CFLAGS
3188     CFLAGS="$CFLAGS -Werror"
3189     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3190     CFLAGS=$save_CFLAGS
3191     if test -n "$ISYSTEM"; then
3192         AC_MSG_RESULT(yes)
3193     else
3194         AC_MSG_RESULT(no)
3195     fi
3197 if test -z "$ISYSTEM"; then
3198     # fall back to using -I
3199     ISYSTEM=-I
3201 AC_SUBST(ISYSTEM)
3203 dnl ===================================================================
3204 dnl  Check which Visual Studio compiler is used
3205 dnl ===================================================================
3207 map_vs_year_to_version()
3209     # Return value: $vsversion
3211     unset vsversion
3213     case $1 in
3214     2015)
3215         vsversion=14.0;;
3216     2017)
3217         vsversion=15.0;;
3218     *)
3219         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3220     esac
3223 vs_versions_to_check()
3225     # Args: $1 (optional) : versions to check, in the order of preference
3226     # Return value: $vsversions
3228     unset vsversions
3230     if test -n "$1"; then
3231         map_vs_year_to_version "$1"
3232         vsversions=$vsversion
3233     else
3234         # By default we prefer 2015/2017, in this order
3235         vsversions="14.0 15.0"
3236     fi
3239 win_get_env_from_vsvars32bat()
3241     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3242     if test $vcnum = "150"; then
3243       # Also seems to be located in another directory under the same name: vsvars32.bat
3244       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3245       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3246     else
3247       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3248     fi
3249     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3250     chmod +x $WRAPPERBATCHFILEPATH
3251     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3252     rm -f $WRAPPERBATCHFILEPATH
3253     printf '%s' "$_win_get_env_from_vsvars32bat"
3256 find_ucrt()
3258     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3259     if test -n "$regvalue"; then
3260         PathFormat "$regvalue"
3261         UCRTSDKDIR=$formatted_path
3262         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3263         UCRTVERSION=$regvalue
3264         # Rest if not exist
3265         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3266           UCRTSDKDIR=
3267         fi
3268     fi
3269     if test -z "$UCRTSDKDIR"; then
3270         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3271         if test "$vcnum" = "150"; then
3272           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3273         else
3274           ide_env_file="${ide_env_dir}/vsvars32.bat"
3275         fi
3276         if test -f "$ide_env_file"; then
3277             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3278             UCRTSDKDIR=$formatted_path
3279             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3280             dnl Hack needed at least by tml:
3281             if test "$UCRTVERSION" = 10.0.15063.0 \
3282                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3283                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3284             then
3285                 UCRTVERSION=10.0.14393.0
3286             fi
3287         else
3288           AC_MSG_ERROR([No UCRT found])
3289         fi
3290     fi
3293 find_msvc()
3295     # Find Visual C++ 2015/2017
3296     # Args: $1 (optional) : The VS version year
3297     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3299     unset vctest vcnum vcnumwithdot vcbuildnumber
3301     vs_versions_to_check "$1"
3303     for ver in $vsversions; do
3304         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3305         if test -n "$regvalue"; then
3306             vctest=$regvalue
3307             break
3308         fi
3309         # As always MSVC 15.0 is special here
3310         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3311         if test -n "$regvalue"; then
3312             AC_MSG_RESULT([found: $regvalue])
3313             PathFormat "$regvalue"
3314             vctest=$formatted_path
3315             break
3316         fi
3317     done
3318     if test -n "$vctest"; then
3319         vcnumwithdot=$ver
3320         case "$vcnumwithdot" in
3321         14.0)
3322             vcyear=2015
3323             vcnum=140
3324             ;;
3325         15.0)
3326             vcyear=2017
3327             vcnum=150
3328             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3329             ;;
3330         esac
3331     fi
3334 SOLARINC=
3335 SHOWINCLUDES_PREFIX=
3336 MSBUILD_PATH=
3337 DEVENV=
3338 if test "$_os" = "WINNT"; then
3339     AC_MSG_CHECKING([Visual C++])
3341     find_msvc "$with_visual_studio"
3342     if test -z "$vctest"; then
3343         if test -n "$with_visual_studio"; then
3344             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3345         else
3346             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3347         fi
3348     fi
3350     if test "$BITNESS_OVERRIDE" = ""; then
3351         if test -f "$vctest/bin/cl.exe"; then
3352             VC_PRODUCT_DIR=$vctest
3353         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3354             VC_PRODUCT_DIR=$vctest/VC
3355         else
3356             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3357         fi
3358     else
3359         if test -f "$vctest/bin/amd64/cl.exe"; then
3360             VC_PRODUCT_DIR=$vctest
3361         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3362             VC_PRODUCT_DIR=$vctest/VC
3363         else
3364             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])
3365         fi
3366     fi
3368     AC_MSG_CHECKING([for short pathname of VC product directory])
3369     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3370     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3372     UCRTSDKDIR=
3373     UCRTVERSION=
3375     AC_MSG_CHECKING([for UCRT location])
3376     find_ucrt
3377     # find_ucrt errors out if it doesn't find it
3378     AC_MSG_RESULT([found])
3379     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3380     ucrtincpath_formatted=$formatted_path
3381     # SOLARINC is used for external modules and must be set too.
3382     # And no, it's not sufficient to set SOLARINC only, as configure
3383     # itself doesn't honour it.
3384     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3385     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3386     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3387     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3389     AC_SUBST(UCRTSDKDIR)
3390     AC_SUBST(UCRTVERSION)
3392     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3393     # Find the proper version of MSBuild.exe to use based on the VS version
3394     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3395     if test -n "$regvalue" ; then
3396         AC_MSG_RESULT([found: $regvalue])
3397         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3398     else
3399         if test $vcnum = "150"; then
3400             if test "$BITNESS_OVERRIDE" = ""; then
3401                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3402             else
3403                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3404             fi
3405             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3406         else
3407             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3408         fi
3409         AC_MSG_RESULT([$regvalue])
3410     fi
3412     # Find the version of devenv.exe
3413     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3414     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3415     if test ! -e "$DEVENV"; then
3416         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3417     fi
3419     dnl ===========================================================
3420     dnl  Check for the corresponding mspdb*.dll
3421     dnl ===========================================================
3423     MSPDB_PATH=
3424     CL_DIR=
3425     CL_LIB=
3427     if test "$BITNESS_OVERRIDE" = ""; then
3428         if test "$vcnum" = "150"; then
3429             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3430             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3431         else
3432             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3433             CL_DIR=bin
3434         fi
3435     else
3436         if test "$vcnum" = "150"; then
3437             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3438             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3439         else
3440             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3441             CL_DIR=bin/amd64
3442         fi
3443     fi
3445     # MSVC 15.0 has libraries from 14.0?
3446     if test  "$vcnum" = "150"; then
3447         mspdbnum="140"
3448     else
3449         mspdbnum=$vcnum
3450     fi
3452     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3453         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3454     fi
3456     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3457     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3459     dnl The path needs to be added before cl is called
3460     PATH="$MSPDB_PATH:$PATH"
3462     AC_MSG_CHECKING([cl.exe])
3464     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3465     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3466     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3467     # is not enough?
3469     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3470     dnl needed when building CLR code:
3471     if test -z "$MSVC_CXX"; then
3472         if test "$BITNESS_OVERRIDE" = ""; then
3473             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3474                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3475             fi
3476         else
3477             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3478                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3479             fi
3480         fi
3482         # This gives us a posix path with 8.3 filename restrictions
3483         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3484     fi
3486     if test -z "$CC"; then
3487         CC=$MSVC_CXX
3488     fi
3489     if test "$BITNESS_OVERRIDE" = ""; then
3490         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3491         MSVC_CXX="$MSVC_CXX -arch:SSE"
3492     fi
3494     if test -n "$CC"; then
3495         # Remove /cl.exe from CC case insensitive
3496         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3497         if test "$BITNESS_OVERRIDE" = ""; then
3498            if test "$vcnum" = "150"; then
3499                COMPATH="$VC_PRODUCT_DIR"
3500            else
3501                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3502            fi
3503         else
3504             if test -n "$VC_PRODUCT_DIR"; then
3505                 COMPATH=$VC_PRODUCT_DIR
3506             fi
3507         fi
3508         if test "$BITNESS_OVERRIDE" = ""; then
3509             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3510             CC="$CC -arch:SSE"
3511         fi
3513         if test "$vcnum" = "150"; then
3514             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3515         fi
3517         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3519         PathFormat "$COMPATH"
3520         COMPATH="$formatted_path"
3522         VCVER=$vcnum
3523         MSVSVER=$vcyear
3525         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3526         # are always "better", we list them in reverse chronological order.
3528         case $vcnum in
3529         140)
3530             COMEX=19
3531             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3532             ;;
3533         150)
3534             COMEX=19
3535             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3536             ;;
3537         esac
3539         # The expectation is that --with-windows-sdk should not need to be used
3540         if test -n "$with_windows_sdk"; then
3541             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3542             *" "$with_windows_sdk" "*)
3543                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3544                 ;;
3545             *)
3546                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3547                 ;;
3548             esac
3549         fi
3551         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3552         ac_objext=obj
3553         ac_exeext=exe
3555     else
3556         AC_MSG_ERROR([Visual C++ not found after all, huh])
3557     fi
3559     dnl We need to guess the prefix of the -showIncludes output, it can be
3560     dnl localized
3561     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3562     echo "#include <stdlib.h>" > conftest.c
3563     dnl Filter out -FIIntrin.h when CC points at clang-cl.exe and needs to
3564     dnl explicitly state that argument:
3565     my_CC=
3566     for i in $CC; do
3567         case $i in
3568         -FIIntrin.h)
3569             ;;
3570         *)
3571             my_CC="$my_CC $i"
3572             ;;
3573         esac
3574     done
3575     SHOWINCLUDES_PREFIX=`$my_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3576         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3577     rm -f conftest.c conftest.obj
3578     if test -z "$SHOWINCLUDES_PREFIX"; then
3579         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3580     else
3581         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3582     fi
3584     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3585     # version of the Explorer extension (and maybe other small
3586     # bits, too) needed when installing a 32-bit LibreOffice on a
3587     # 64-bit OS. The 64-bit Explorer extension is a feature that
3588     # has been present since long in OOo. Don't confuse it with
3589     # building LibreOffice itself as 64-bit code.
3591     BUILD_X64=
3592     CXX_X64_BINARY=
3593     LINK_X64_BINARY=
3595     if test "$BITNESS_OVERRIDE" = ""; then
3596         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3597         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3598             # Prefer native x64 compiler to cross-compiler, in case we are running
3599             # the build on a 64-bit OS.
3600             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3601                 BUILD_X64=TRUE
3602                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3603                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3604             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3605                 BUILD_X64=TRUE
3606                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3607                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3608             fi
3609         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3610             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3611             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3612                 BUILD_X64=TRUE
3613                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3614                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3615             fi
3616         fi
3617         if test "$BUILD_X64" = TRUE; then
3618             AC_MSG_RESULT([found])
3619         else
3620             AC_MSG_RESULT([not found])
3621             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3622         fi
3623     fi
3624     AC_SUBST(BUILD_X64)
3626     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3627     AC_SUBST(CXX_X64_BINARY)
3628     AC_SUBST(LINK_X64_BINARY)
3630 AC_SUBST(VCVER)
3631 AC_SUBST(DEVENV)
3632 PathFormat "$MSPDB_PATH"
3633 MSPDB_PATH="$formatted_path"
3634 AC_SUBST(MSVC_CXX)
3635 AC_SUBST(SHOWINCLUDES_PREFIX)
3638 # unowinreg.dll
3640 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3641 AC_SUBST(UNOWINREG_DLL)
3643 COM_IS_CLANG=
3644 AC_MSG_CHECKING([whether the compiler is actually Clang])
3645 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3646     #ifndef __clang__
3647     you lose
3648     #endif
3649     int foo=42;
3650     ]])],
3651     [AC_MSG_RESULT([yes])
3652      COM_IS_CLANG=TRUE],
3653     [AC_MSG_RESULT([no])])
3655 if test "$COM_IS_CLANG" = TRUE; then
3656     AC_MSG_CHECKING([the Clang version])
3657     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | ${CC%-cl.exe*} -E -P -`
3658     CLANG_FULL_VERSION=`echo __clang_version__ | ${CC%-cl.exe*} -E -P -`
3659     CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3660     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3661     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3662     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3664 AC_SUBST(COM_IS_CLANG)
3667 # prefix C with ccache if needed
3669 if test "$CCACHE" != ""; then
3670     AC_MSG_CHECKING([whether $CC is already ccached])
3672     AC_LANG_PUSH([C])
3673     save_CFLAGS=$CFLAGS
3674     CFLAGS="$CFLAGS --ccache-skip -O2"
3675     dnl an empty program will do, we're checking the compiler flags
3676     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3677                       [use_ccache=yes], [use_ccache=no])
3678     if test $use_ccache = yes; then
3679         AC_MSG_RESULT([yes])
3680     else
3681         CC="$CCACHE $CC"
3682         AC_MSG_RESULT([no])
3683     fi
3684     CFLAGS=$save_CFLAGS
3685     AC_LANG_POP([C])
3688 # ===================================================================
3689 # check various GCC options that Clang does not support now but maybe
3690 # will somewhen in the future, check them even for GCC, so that the
3691 # flags are set
3692 # ===================================================================
3694 HAVE_GCC_GGDB2=
3695 HAVE_GCC_FINLINE_LIMIT=
3696 HAVE_GCC_FNO_INLINE=
3697 if test "$GCC" = "yes"; then
3698     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3699     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3700         # Option just ignored and silly warning that isn't a real
3701         # warning printed
3702         :
3703     else
3704         save_CFLAGS=$CFLAGS
3705         CFLAGS="$CFLAGS -Werror -ggdb2"
3706         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3707         CFLAGS=$save_CFLAGS
3708     fi
3709     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3710         AC_MSG_RESULT([yes])
3711     else
3712         AC_MSG_RESULT([no])
3713     fi
3715     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3716     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3717         # As above
3718         :
3719     else
3720         save_CFLAGS=$CFLAGS
3721         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3722         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3723         CFLAGS=$save_CFLAGS
3724     fi
3725     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3726         AC_MSG_RESULT([yes])
3727     else
3728         AC_MSG_RESULT([no])
3729     fi
3731     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3732     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3733         # Ditto
3734         :
3735     else
3736         save_CFLAGS=$CFLAGS
3737         CFLAGS="$CFLAGS -Werror -fno-inline"
3738         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3739         CFLAGS=$save_CFLAGS
3740     fi
3741     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3742         AC_MSG_RESULT([yes])
3743     else
3744         AC_MSG_RESULT([no])
3745     fi
3747     if test "$host_cpu" = "m68k"; then
3748         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3749         save_CFLAGS=$CFLAGS
3750         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3751         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3752         CFLAGS=$save_CFLAGS
3753         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3754             AC_MSG_RESULT([yes])
3755         else
3756             AC_MSG_ERROR([no])
3757         fi
3758     fi
3760 AC_SUBST(HAVE_GCC_GGDB2)
3761 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3762 AC_SUBST(HAVE_GCC_FNO_INLINE)
3764 dnl ===================================================================
3765 dnl  Test the gcc version
3766 dnl ===================================================================
3767 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3768     AC_MSG_CHECKING([the GCC version])
3769     _gcc_version=`$CC -dumpversion`
3770     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3771         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3772     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3774     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3776     if test "$gcc_full_version" -lt 40801; then
3777         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3778     fi
3779 else
3780     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3781     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3782     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3783     # (which reports itself as GCC 4.2.1).
3784     GCC_VERSION=
3786 AC_SUBST(GCC_VERSION)
3788 dnl Set the ENABLE_DBGUTIL variable
3789 dnl ===================================================================
3790 AC_MSG_CHECKING([whether to build with additional debug utilities])
3791 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3792     ENABLE_DBGUTIL="TRUE"
3793     # this is an extra var so it can have different default on different MSVC
3794     # versions (in case there are version specific problems with it)
3795     MSVC_USE_DEBUG_RUNTIME="TRUE"
3797     AC_MSG_RESULT([yes])
3798     # cppunit and graphite expose STL in public headers
3799     if test "$with_system_cppunit" = "yes"; then
3800         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3801     else
3802         with_system_cppunit=no
3803     fi
3804     if test "$with_system_graphite" = "yes"; then
3805         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3806     else
3807         with_system_graphite=no
3808     fi
3809     if test "$with_system_mysql_cppconn" = "yes"; then
3810         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3811     else
3812         with_system_mysql_cppconn=no
3813     fi
3814     if test "$with_system_orcus" = "yes"; then
3815         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3816     else
3817         with_system_orcus=no
3818     fi
3819     if test "$with_system_libcmis" = "yes"; then
3820         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3821     else
3822         with_system_libcmis=no
3823     fi
3824     if test "$with_system_libgltf" = "yes"; then
3825         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3826     else
3827         with_system_libgltf=no
3828     fi
3829     if test "$with_system_hunspell" = "yes"; then
3830         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3831     else
3832         with_system_hunspell=no
3833     fi
3834 else
3835     ENABLE_DBGUTIL=""
3836     MSVC_USE_DEBUG_RUNTIME=""
3837     AC_MSG_RESULT([no])
3839 AC_SUBST(ENABLE_DBGUTIL)
3840 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3842 dnl Set the ENABLE_DEBUG variable.
3843 dnl ===================================================================
3844 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3845     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3847 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3848     if test -z "$libo_fuzzed_enable_debug"; then
3849         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3850     else
3851         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3852         enable_debug=yes
3853     fi
3856 AC_MSG_CHECKING([whether to do a debug build])
3857 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3858     ENABLE_DEBUG="TRUE"
3859     if test -n "$ENABLE_DBGUTIL" ; then
3860         AC_MSG_RESULT([yes (dbgutil)])
3861     else
3862         AC_MSG_RESULT([yes])
3863     fi
3864 else
3865     ENABLE_DEBUG=""
3866     AC_MSG_RESULT([no])
3868 AC_SUBST(ENABLE_DEBUG)
3870 if test "$enable_sal_log" = yes; then
3871     ENABLE_SAL_LOG=TRUE
3873 AC_SUBST(ENABLE_SAL_LOG)
3875 dnl Selective debuginfo
3876 ENABLE_DEBUGINFO_FOR=
3877 if test -n "$ENABLE_DEBUG"; then
3878     AC_MSG_CHECKING([whether to use selective debuginfo])
3879     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3880         if test "$enable_selective_debuginfo" = "yes"; then
3881             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3882         fi
3883         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3884         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3885     else
3886         ENABLE_DEBUGINFO_FOR=all
3887         AC_MSG_RESULT([no, for all])
3888     fi
3889 else
3890     if test -n "$enable_selective_debuginfo"; then
3891         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3892     fi
3894 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3896 dnl Check for enable symbols option
3897 dnl ===================================================================
3898 AC_MSG_CHECKING([whether to generate debug information])
3899 if test -z "$enable_symbols"; then
3900     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3901         enable_symbols=yes
3902     else
3903         enable_symbols=no
3904     fi
3906 if test "$enable_symbols" != no; then
3907     ENABLE_SYMBOLS=TRUE
3908     AC_MSG_RESULT([yes])
3909 else
3910     ENABLE_SYMBOLS=
3911     AC_MSG_RESULT([no])
3913 AC_SUBST(ENABLE_SYMBOLS)
3915 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3916     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3917     AC_MSG_CHECKING([whether enough memory is available for linking])
3918     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3919     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3920     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3921         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3922     else
3923         AC_MSG_RESULT([yes])
3924     fi
3927 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3928 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3929 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3930 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3931 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3932     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
3934 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
3936 AC_MSG_CHECKING([whether to compile with optimization flags])
3937 if test -z "$enable_optimized"; then
3938     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3939         enable_optimized=no
3940     else
3941         enable_optimized=yes
3942     fi
3944 if test "$enable_optimized" != no; then
3945     ENABLE_OPTIMIZED=TRUE
3946     AC_MSG_RESULT([yes])
3947 else
3948     ENABLE_OPTIMIZED=
3949     AC_MSG_RESULT([no])
3951 AC_SUBST(ENABLE_OPTIMIZED)
3954 # determine CPUNAME, OS, ...
3955 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3957 case "$host_os" in
3959 aix*)
3960     COM=GCC
3961     CPUNAME=POWERPC
3962     USING_X11=TRUE
3963     OS=AIX
3964     RTL_OS=AIX
3965     RTL_ARCH=PowerPC
3966     PLATFORMID=aix_powerpc
3967     P_SEP=:
3968     ;;
3970 cygwin*)
3971     COM=MSC
3972     USING_X11=
3973     OS=WNT
3974     RTL_OS=Windows
3975     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3976         P_SEP=";"
3977     else
3978         P_SEP=:
3979     fi
3980     case "$host_cpu" in
3981     i*86|x86_64)
3982         if test "$BITNESS_OVERRIDE" = 64; then
3983             CPUNAME=X86_64
3984             RTL_ARCH=X86_64
3985             PLATFORMID=windows_x86_64
3986             WINDOWS_X64=1
3987             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3988         else
3989             CPUNAME=INTEL
3990             RTL_ARCH=x86
3991             PLATFORMID=windows_x86
3992         fi
3993         ;;
3994     *)
3995         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3996         ;;
3997     esac
3998     SCPDEFS="$SCPDEFS -D_MSC_VER"
3999     ;;
4001 darwin*)
4002     COM=GCC
4003     USING_X11=
4004     OS=MACOSX
4005     RTL_OS=MacOSX
4006     P_SEP=:
4008     case "$host_cpu" in
4009     arm*)
4010         CPUNAME=ARM
4011         RTL_ARCH=ARM_EABI
4012         PLATFORMID=ios_arm
4013         OS=IOS
4014         ;;
4015     i*86)
4016         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4017         ;;
4018     x86_64)
4019         CPUNAME=X86_64
4020         RTL_ARCH=X86_64
4021         PLATFORMID=macosx_x86_64
4022         ;;
4023     *)
4024         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4025         ;;
4026     esac
4027     ;;
4029 dragonfly*)
4030     COM=GCC
4031     USING_X11=TRUE
4032     OS=DRAGONFLY
4033     RTL_OS=DragonFly
4034     P_SEP=:
4036     case "$host_cpu" in
4037     i*86)
4038         CPUNAME=INTEL
4039         RTL_ARCH=x86
4040         PLATFORMID=dragonfly_x86
4041         ;;
4042     x86_64)
4043         CPUNAME=X86_64
4044         RTL_ARCH=X86_64
4045         PLATFORMID=dragonfly_x86_64
4046         ;;
4047     *)
4048         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4049         ;;
4050     esac
4051     ;;
4053 freebsd*)
4054     COM=GCC
4055     USING_X11=TRUE
4056     RTL_OS=FreeBSD
4057     OS=FREEBSD
4058     P_SEP=:
4060     case "$host_cpu" in
4061     i*86)
4062         CPUNAME=INTEL
4063         RTL_ARCH=x86
4064         PLATFORMID=freebsd_x86
4065         ;;
4066     x86_64|amd64)
4067         CPUNAME=X86_64
4068         RTL_ARCH=X86_64
4069         PLATFORMID=freebsd_x86_64
4070         ;;
4071     *)
4072         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4073         ;;
4074     esac
4075     ;;
4077 kfreebsd*)
4078     COM=GCC
4079     USING_X11=TRUE
4080     OS=LINUX
4081     RTL_OS=kFreeBSD
4082     P_SEP=:
4084     case "$host_cpu" in
4086     i*86)
4087         CPUNAME=INTEL
4088         RTL_ARCH=x86
4089         PLATFORMID=kfreebsd_x86
4090         ;;
4091     x86_64)
4092         CPUNAME=X86_64
4093         RTL_ARCH=X86_64
4094         PLATFORMID=kfreebsd_x86_64
4095         ;;
4096     *)
4097         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4098         ;;
4099     esac
4100     ;;
4102 linux-gnu*)
4103     COM=GCC
4104     USING_X11=TRUE
4105     OS=LINUX
4106     RTL_OS=Linux
4107     P_SEP=:
4109     case "$host_cpu" in
4111     aarch64)
4112         CPUNAME=AARCH64
4113         PLATFORMID=linux_aarch64
4114         RTL_ARCH=AARCH64
4115         ;;
4116     alpha)
4117         CPUNAME=AXP
4118         RTL_ARCH=ALPHA
4119         PLATFORMID=linux_alpha
4120         ;;
4121     arm*)
4122         CPUNAME=ARM
4123         EPM_FLAGS="-a arm"
4124         RTL_ARCH=ARM_EABI
4125         PLATFORMID=linux_arm_eabi
4126         case "$host_cpu" in
4127         arm*-linux)
4128             RTL_ARCH=ARM_OABI
4129             PLATFORMID=linux_arm_oabi
4130             ;;
4131         esac
4132         ;;
4133     hppa)
4134         CPUNAME=HPPA
4135         RTL_ARCH=HPPA
4136         EPM_FLAGS="-a hppa"
4137         PLATFORMID=linux_hppa
4138         ;;
4139     i*86)
4140         CPUNAME=INTEL
4141         RTL_ARCH=x86
4142         PLATFORMID=linux_x86
4143         ;;
4144     ia64)
4145         CPUNAME=IA64
4146         RTL_ARCH=IA64
4147         PLATFORMID=linux_ia64
4148         ;;
4149     mips)
4150         CPUNAME=GODSON
4151         RTL_ARCH=MIPS_EB
4152         EPM_FLAGS="-a mips"
4153         PLATFORMID=linux_mips_eb
4154         ;;
4155     mips64)
4156         CPUNAME=GODSON64
4157         RTL_ARCH=MIPS64_EB
4158         EPM_FLAGS="-a mips64"
4159         PLATFORMID=linux_mips64_eb
4160         ;;
4161     mips64el)
4162         CPUNAME=GODSON64
4163         RTL_ARCH=MIPS64_EL
4164         EPM_FLAGS="-a mips64el"
4165         PLATFORMID=linux_mips64_el
4166         ;;
4167     mipsel)
4168         CPUNAME=GODSON
4169         RTL_ARCH=MIPS_EL
4170         EPM_FLAGS="-a mipsel"
4171         PLATFORMID=linux_mips_el
4172         ;;
4173     m68k)
4174         CPUNAME=M68K
4175         RTL_ARCH=M68K
4176         PLATFORMID=linux_m68k
4177         ;;
4178     powerpc)
4179         CPUNAME=POWERPC
4180         RTL_ARCH=PowerPC
4181         PLATFORMID=linux_powerpc
4182         ;;
4183     powerpc64)
4184         CPUNAME=POWERPC64
4185         RTL_ARCH=PowerPC_64
4186         PLATFORMID=linux_powerpc64
4187         ;;
4188     powerpc64le)
4189         CPUNAME=POWERPC64
4190         RTL_ARCH=PowerPC_64_LE
4191         PLATFORMID=linux_powerpc64_le
4192         ;;
4193     sparc)
4194         CPUNAME=SPARC
4195         RTL_ARCH=SPARC
4196         PLATFORMID=linux_sparc
4197         ;;
4198     sparc64)
4199         CPUNAME=SPARC64
4200         RTL_ARCH=SPARC64
4201         PLATFORMID=linux_sparc64
4202         ;;
4203     s390)
4204         CPUNAME=S390
4205         RTL_ARCH=S390
4206         PLATFORMID=linux_s390
4207         ;;
4208     s390x)
4209         CPUNAME=S390X
4210         RTL_ARCH=S390x
4211         PLATFORMID=linux_s390x
4212         ;;
4213     x86_64)
4214         CPUNAME=X86_64
4215         RTL_ARCH=X86_64
4216         PLATFORMID=linux_x86_64
4217         ;;
4218     *)
4219         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4220         ;;
4221     esac
4222     ;;
4224 linux-android*)
4225     COM=GCC
4226     USING_X11=
4227     OS=ANDROID
4228     RTL_OS=Android
4229     P_SEP=:
4231     case "$host_cpu" in
4233     arm|armel)
4234         CPUNAME=ARM
4235         RTL_ARCH=ARM_EABI
4236         PLATFORMID=android_arm_eabi
4237         ;;
4238     aarch64)
4239         CPUNAME=AARCH64
4240         RTL_ARCH=AARCH64
4241         PLATFORMID=android_aarch64
4242         ;;
4243     mips|mipsel)
4244         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4245         RTL_ARCH=MIPS_EL
4246         PLATFORMID=android_mips_el
4247         ;;
4248     i*86)
4249         CPUNAME=INTEL
4250         RTL_ARCH=x86
4251         PLATFORMID=android_x86
4252         ;;
4253     *)
4254         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4255         ;;
4256     esac
4257     ;;
4259 *netbsd*)
4260     COM=GCC
4261     USING_X11=TRUE
4262     OS=NETBSD
4263     RTL_OS=NetBSD
4264     P_SEP=:
4266     case "$host_cpu" in
4267     i*86)
4268         CPUNAME=INTEL
4269         RTL_ARCH=x86
4270         PLATFORMID=netbsd_x86
4271         ;;
4272     powerpc)
4273         CPUNAME=POWERPC
4274         RTL_ARCH=PowerPC
4275         PLATFORMID=netbsd_powerpc
4276         ;;
4277     sparc)
4278         CPUNAME=SPARC
4279         RTL_ARCH=SPARC
4280         PLATFORMID=netbsd_sparc
4281         ;;
4282     x86_64)
4283         CPUNAME=X86_64
4284         RTL_ARCH=X86_64
4285         PLATFORMID=netbsd_x86_64
4286         ;;
4287     *)
4288         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4289         ;;
4290     esac
4291     ;;
4293 openbsd*)
4294     COM=GCC
4295     USING_X11=TRUE
4296     OS=OPENBSD
4297     RTL_OS=OpenBSD
4298     P_SEP=:
4300     case "$host_cpu" in
4301     i*86)
4302         CPUNAME=INTEL
4303         RTL_ARCH=x86
4304         PLATFORMID=openbsd_x86
4305         ;;
4306     x86_64)
4307         CPUNAME=X86_64
4308         RTL_ARCH=X86_64
4309         PLATFORMID=openbsd_x86_64
4310         ;;
4311     *)
4312         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4313         ;;
4314     esac
4315     SOLARINC="$SOLARINC -I/usr/local/include"
4316     ;;
4318 solaris*)
4319     COM=GCC
4320     USING_X11=TRUE
4321     OS=SOLARIS
4322     RTL_OS=Solaris
4323     P_SEP=:
4325     case "$host_cpu" in
4326     i*86)
4327         CPUNAME=INTEL
4328         RTL_ARCH=x86
4329         PLATFORMID=solaris_x86
4330         ;;
4331     sparc)
4332         CPUNAME=SPARC
4333         RTL_ARCH=SPARC
4334         PLATFORMID=solaris_sparc
4335         ;;
4336     sparc64)
4337         CPUNAME=SPARC64
4338         RTL_ARCH=SPARC64
4339         PLATFORMID=solaris_sparc64
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     ;;
4349     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4350     ;;
4351 esac
4353 if test "$with_x" = "no"; then
4354     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4357 ENABLE_HEADLESS=""
4358 if test "$enable_gui" = "no"; then
4359     if test "$USING_X11" != TRUE; then
4360         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4361     fi
4362     USING_X11=
4363     ENABLE_HEADLESS=TRUE
4364     AC_DEFINE(HAVE_FEATURE_UI,0)
4365     test_cairo=yes
4367 AC_SUBST(ENABLE_HEADLESS)
4369 WORKDIR="${BUILDDIR}/workdir"
4370 INSTDIR="${BUILDDIR}/instdir"
4371 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4372 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4373 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4374 AC_SUBST(COM)
4375 AC_SUBST(CPUNAME)
4376 AC_SUBST(RTL_OS)
4377 AC_SUBST(RTL_ARCH)
4378 AC_SUBST(EPM_FLAGS)
4379 AC_SUBST(USING_X11)
4380 AC_SUBST([INSTDIR])
4381 AC_SUBST([INSTROOT])
4382 AC_SUBST([INSTROOTBASE])
4383 AC_SUBST(OS)
4384 AC_SUBST(P_SEP)
4385 AC_SUBST(WORKDIR)
4386 AC_SUBST(PLATFORMID)
4387 AC_SUBST(WINDOWS_X64)
4388 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4390 dnl ===================================================================
4391 dnl Test which package format to use
4392 dnl ===================================================================
4393 AC_MSG_CHECKING([which package format to use])
4394 if test -n "$with_package_format" -a "$with_package_format" != no; then
4395     for i in $with_package_format; do
4396         case "$i" in
4397         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4398             ;;
4399         *)
4400             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4401 aix - AIX software distribution
4402 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4403 deb - Debian software distribution
4404 pkg - Solaris software distribution
4405 rpm - RedHat software distribution
4407 LibreOffice additionally supports:
4408 archive - .tar.gz or .zip
4409 dmg - Mac OS X .dmg
4410 installed - installation tree
4411 msi - Windows .msi
4412         ])
4413             ;;
4414         esac
4415     done
4416     PKGFORMAT="$with_package_format"
4417     AC_MSG_RESULT([$PKGFORMAT])
4418 else
4419     PKGFORMAT=
4420     AC_MSG_RESULT([none])
4422 AC_SUBST(PKGFORMAT)
4424 dnl ===================================================================
4425 dnl Set up a different compiler to produce tools to run on the build
4426 dnl machine when doing cross-compilation
4427 dnl ===================================================================
4429 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4430 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4431 if test "$cross_compiling" = "yes"; then
4432     AC_MSG_CHECKING([for BUILD platform configuration])
4433     echo
4434     rm -rf CONF-FOR-BUILD config_build.mk
4435     mkdir CONF-FOR-BUILD
4436     # Here must be listed all files needed when running the configure script. In particular, also
4437     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4438     # keep them in the same order as there.
4439     (cd $SRC_ROOT && tar cf - \
4440         config.guess \
4441         bin/get_config_variables \
4442         solenv/bin/getcompver.awk \
4443         solenv/inc/langlist.mk \
4444         config_host.mk.in \
4445         config_host_lang.mk.in \
4446         Makefile.in \
4447         lo.xcent.in \
4448         bin/bffvalidator.sh.in \
4449         bin/odfvalidator.sh.in \
4450         bin/officeotron.sh.in \
4451         instsetoo_native/util/openoffice.lst.in \
4452         config_host/*.in \
4453         sysui/desktop/macosx/Info.plist.in \
4454         ios/lo.xcconfig.in) \
4455     | (cd CONF-FOR-BUILD && tar xf -)
4456     cp configure CONF-FOR-BUILD
4457     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4458     (
4459     unset COM USING_X11 OS CPUNAME
4460     unset CC CXX SYSBASE CFLAGS
4461     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4462     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4463     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4464     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4465     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4466     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4467     cd CONF-FOR-BUILD
4468     sub_conf_opts=""
4469     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4470     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4471     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4472     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4473     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4474     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4475     # Don't bother having configure look for stuff not needed for the build platform anyway
4476     ./configure \
4477         --disable-cups \
4478         --disable-gtk3 \
4479         --disable-pdfimport \
4480         --disable-postgresql-sdbc \
4481         --with-parallelism="$with_parallelism" \
4482         --without-doxygen \
4483         --without-java \
4484         $sub_conf_opts \
4485         --srcdir=$srcdir \
4486         2>&1 | sed -e 's/^/    /'
4487     test -f ./config_host.mk 2>/dev/null || exit
4488     cp config_host.mk ../config_build.mk
4489     cp config_host_lang.mk ../config_build_lang.mk
4490     mv config.log ../config.Build.log
4491     mkdir -p ../config_build
4492     mv config_host/*.h ../config_build
4493     . ./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
4495     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
4496         VV='$'$V
4497         VV=`eval "echo $VV"`
4498         if test -n "$VV"; then
4499             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4500             echo "$line" >>build-config
4501         fi
4502     done
4504     for V in INSTDIR INSTROOT WORKDIR; do
4505         VV='$'$V
4506         VV=`eval "echo $VV"`
4507         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4508         if test -n "$VV"; then
4509             line="${V}_FOR_BUILD='$VV'"
4510             echo "$line" >>build-config
4511         fi
4512     done
4514     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4515     echo "$line" >>build-config
4517     )
4518     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4519     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])
4520     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4521              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4523     eval `cat CONF-FOR-BUILD/build-config`
4525     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4527     rm -rf CONF-FOR-BUILD
4528 else
4529     OS_FOR_BUILD="$OS"
4530     CC_FOR_BUILD="$CC"
4531     CXX_FOR_BUILD="$CXX"
4532     INSTDIR_FOR_BUILD="$INSTDIR"
4533     INSTROOT_FOR_BUILD="$INSTROOT"
4534     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4535     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4536     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4537     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4538     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4539     WORKDIR_FOR_BUILD="$WORKDIR"
4541 AC_SUBST(OS_FOR_BUILD)
4542 AC_SUBST(INSTDIR_FOR_BUILD)
4543 AC_SUBST(INSTROOT_FOR_BUILD)
4544 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4545 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4546 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4547 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4548 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4549 AC_SUBST(WORKDIR_FOR_BUILD)
4551 dnl ===================================================================
4552 dnl Check for syslog header
4553 dnl ===================================================================
4554 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4556 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4557 dnl ===================================================================
4558 AC_MSG_CHECKING([whether to turn warnings to errors])
4559 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4560     ENABLE_WERROR="TRUE"
4561     AC_MSG_RESULT([yes])
4562 else
4563     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4564         ENABLE_WERROR="TRUE"
4565         AC_MSG_RESULT([yes])
4566     else
4567         AC_MSG_RESULT([no])
4568     fi
4570 AC_SUBST(ENABLE_WERROR)
4572 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4573 dnl ===================================================================
4574 AC_MSG_CHECKING([whether to have assert to abort in release code])
4575 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4576     ASSERT_ALWAYS_ABORT="TRUE"
4577     AC_MSG_RESULT([yes])
4578 else
4579     ASSERT_ALWAYS_ABORT="FALSE"
4580     AC_MSG_RESULT([no])
4582 AC_SUBST(ASSERT_ALWAYS_ABORT)
4584 # Determine whether to use ooenv for the instdir installation
4585 # ===================================================================
4586 if test $_os != "WINNT" -a $_os != "Darwin"; then
4587     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4588     if test "$enable_ooenv" = "no"; then
4589         AC_MSG_RESULT([no])
4590     else
4591         ENABLE_OOENV="TRUE"
4592         AC_MSG_RESULT([yes])
4593     fi
4595 AC_SUBST(ENABLE_OOENV)
4597 if test "$USING_X11" != TRUE; then
4598     # be sure to do not mess with unneeded stuff
4599     test_randr=no
4600     test_xrender=no
4601     test_cups=no
4602     test_dbus=no
4603     test_gtk=no
4604     build_gstreamer_1_0=no
4605     build_gstreamer_0_10=no
4606     test_kde4=no
4607     enable_cairo_canvas=no
4610 dnl ===================================================================
4611 dnl check for cups support
4612 dnl ===================================================================
4613 ENABLE_CUPS=""
4615 if test "$enable_cups" = "no"; then
4616     test_cups=no
4619 AC_MSG_CHECKING([whether to enable CUPS support])
4620 if test "$test_cups" = "yes"; then
4621     ENABLE_CUPS="TRUE"
4622     AC_MSG_RESULT([yes])
4624     AC_MSG_CHECKING([whether cups support is present])
4625     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4626     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4627     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4628         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4629     fi
4631 else
4632     AC_MSG_RESULT([no])
4635 AC_SUBST(ENABLE_CUPS)
4637 # fontconfig checks
4638 if test "$test_fontconfig" = "yes"; then
4639     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4640     SYSTEM_FONTCONFIG=TRUE
4641     FilterLibs "${FONTCONFIG_LIBS}"
4642     FONTCONFIG_LIBS="${filteredlibs}"
4644 AC_SUBST(FONTCONFIG_CFLAGS)
4645 AC_SUBST(FONTCONFIG_LIBS)
4646 AC_SUBST([SYSTEM_FONTCONFIG])
4648 dnl whether to find & fetch external tarballs?
4649 dnl ===================================================================
4650 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4651    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4652        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4653    else
4654        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4655    fi
4657 if test -z "$TARFILE_LOCATION"; then
4658     if test -d "$SRC_ROOT/src" ; then
4659         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4660         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4661     fi
4662     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4663 else
4664     AbsolutePath "$TARFILE_LOCATION"
4665     PathFormat "${absolute_path}"
4666     TARFILE_LOCATION="${formatted_path}"
4668 AC_SUBST(TARFILE_LOCATION)
4670 AC_MSG_CHECKING([whether we want to fetch tarballs])
4671 if test "$enable_fetch_external" != "no"; then
4672     if test "$with_all_tarballs" = "yes"; then
4673         AC_MSG_RESULT([yes, all of them])
4674         DO_FETCH_TARBALLS="ALL"
4675     else
4676         AC_MSG_RESULT([yes, if we use them])
4677         DO_FETCH_TARBALLS="TRUE"
4678     fi
4679 else
4680     AC_MSG_RESULT([no])
4681     DO_FETCH_TARBALLS=
4683 AC_SUBST(DO_FETCH_TARBALLS)
4685 AC_MSG_CHECKING([whether to build help])
4686 HELP_COMMON_ONLY=FALSE
4687 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4688     BUILD_TYPE="$BUILD_TYPE HELP"
4689     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4690     if test "$with_help" = "common" ; then
4691         HELP_COMMON_ONLY=TRUE
4692         AC_MSG_RESULT([common only])
4693     else
4694         SCPDEFS="$SCPDEFS -DWITH_HELP"
4695         AC_MSG_RESULT([yes])
4696     fi
4697 else
4698     AC_MSG_RESULT([no])
4700 AC_SUBST(HELP_COMMON_ONLY)
4702 dnl Test whether to include MySpell dictionaries
4703 dnl ===================================================================
4704 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4705 if test "$with_myspell_dicts" = "yes"; then
4706     AC_MSG_RESULT([yes])
4707     WITH_MYSPELL_DICTS=TRUE
4708     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4709     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4710 else
4711     AC_MSG_RESULT([no])
4712     WITH_MYSPELL_DICTS=
4714 AC_SUBST(WITH_MYSPELL_DICTS)
4716 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4717 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4718     if test "$with_system_dicts" = yes; then
4719         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4720     fi
4721     with_system_dicts=no
4724 AC_MSG_CHECKING([whether to use dicts from external paths])
4725 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4726     AC_MSG_RESULT([yes])
4727     SYSTEM_DICTS=TRUE
4728     AC_MSG_CHECKING([for spelling dictionary directory])
4729     if test -n "$with_external_dict_dir"; then
4730         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4731     else
4732         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4733         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4734             DICT_SYSTEM_DIR=file:///usr/share/myspell
4735         fi
4736     fi
4737     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4738     AC_MSG_CHECKING([for hyphenation patterns directory])
4739     if test -n "$with_external_hyph_dir"; then
4740         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4741     else
4742         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4743     fi
4744     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4745     AC_MSG_CHECKING([for thesaurus directory])
4746     if test -n "$with_external_thes_dir"; then
4747         THES_SYSTEM_DIR=file://$with_external_thes_dir
4748     else
4749         THES_SYSTEM_DIR=file:///usr/share/mythes
4750     fi
4751     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4752 else
4753     AC_MSG_RESULT([no])
4754     SYSTEM_DICTS=
4756 AC_SUBST(SYSTEM_DICTS)
4757 AC_SUBST(DICT_SYSTEM_DIR)
4758 AC_SUBST(HYPH_SYSTEM_DIR)
4759 AC_SUBST(THES_SYSTEM_DIR)
4761 dnl ===================================================================
4762 dnl enable pch by default on windows
4763 dnl enable it explicitly otherwise
4764 ENABLE_PCH=""
4765 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4766     if test -z "$libo_fuzzed_enable_pch"; then
4767         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4768     else
4769         AC_MSG_NOTICE([Resetting --enable-pch=no])
4770         enable_pch=no
4771     fi
4774 AC_MSG_CHECKING([whether to enable pch feature])
4775 if test "$enable_pch" != "no"; then
4776     if test "$_os" = "WINNT"; then
4777         ENABLE_PCH="TRUE"
4778         AC_MSG_RESULT([yes])
4779     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4780         ENABLE_PCH="TRUE"
4781         AC_MSG_RESULT([yes])
4782     elif test -n "$enable_pch"; then
4783         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4784     else
4785         AC_MSG_RESULT([no])
4786     fi
4787 else
4788     AC_MSG_RESULT([no])
4790 AC_SUBST(ENABLE_PCH)
4792 TAB=`printf '\t'`
4794 AC_MSG_CHECKING([the GNU Make version])
4795 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4796 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4797 if test "$_make_longver" -ge "038200"; then
4798     AC_MSG_RESULT([$GNUMAKE $_make_version])
4800 elif test "$_make_longver" -ge "038100"; then
4801     if test "$build_os" = "cygwin"; then
4802         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4803     fi
4804     AC_MSG_RESULT([$GNUMAKE $_make_version])
4806     dnl ===================================================================
4807     dnl Search all the common names for sha1sum
4808     dnl ===================================================================
4809     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4810     if test -z "$SHA1SUM"; then
4811         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4812     elif test "$SHA1SUM" = "openssl"; then
4813         SHA1SUM="openssl sha1"
4814     fi
4815     AC_MSG_CHECKING([for GNU Make bug 20033])
4816     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4817     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4818 A := \$(wildcard *.a)
4820 .PHONY: all
4821 all: \$(A:.a=.b)
4822 <TAB>@echo survived bug20033.
4824 .PHONY: setup
4825 setup:
4826 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4828 define d1
4829 @echo lala \$(1)
4830 @sleep 1
4831 endef
4833 define d2
4834 @echo tyty \$(1)
4835 @sleep 1
4836 endef
4838 %.b : %.a
4839 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4840 <TAB>\$(call d1,\$(CHECKSUM)),\
4841 <TAB>\$(call d2,\$(CHECKSUM)))
4843     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4844         no_parallelism_make="YES"
4845         AC_MSG_RESULT([yes, disable parallelism])
4846     else
4847         AC_MSG_RESULT([no, keep parallelism enabled])
4848     fi
4849     rm -rf $TESTGMAKEBUG20033
4850 else
4851     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4854 # find if gnumake support file function
4855 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4856 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4857 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4858     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4860 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4861 \$(file >test.txt,Success )
4863 .PHONY: all
4864 all:
4865 <TAB>@cat test.txt
4868 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4869 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4870     HAVE_GNUMAKE_FILE_FUNC=TRUE
4871     AC_MSG_RESULT([yes])
4872 else
4873     AC_MSG_RESULT([no])
4875 rm -rf $TESTGMAKEFILEFUNC
4876 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4877 AC_SUBST(GNUMAKE_WIN_NATIVE)
4879 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4880 STALE_MAKE=
4881 if test "$_make_ver_check" = ""; then
4882    STALE_MAKE=TRUE
4885 HAVE_LD_HASH_STYLE=FALSE
4886 WITH_LINKER_HASH_STYLE=
4887 AC_MSG_CHECKING([for --hash-style gcc linker support])
4888 if test "$GCC" = "yes"; then
4889     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4890         hash_styles="gnu sysv"
4891     elif test "$with_linker_hash_style" = "no"; then
4892         hash_styles=
4893     else
4894         hash_styles="$with_linker_hash_style"
4895     fi
4897     for hash_style in $hash_styles; do
4898         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4899         hash_style_ldflags_save=$LDFLAGS
4900         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4902         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4903             [
4904 #include <stdio.h>
4905             ],[
4906 printf ("");
4907             ])],
4908             [
4909                   HAVE_LD_HASH_STYLE=TRUE
4910                   WITH_LINKER_HASH_STYLE=$hash_style
4911             ],
4912             [HAVE_LD_HASH_STYLE=FALSE],
4913             [HAVE_LD_HASH_STYLE=FALSE])
4914         LDFLAGS=$hash_style_ldflags_save
4915     done
4917     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4918         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4919     else
4920         AC_MSG_RESULT( no )
4921     fi
4922     LDFLAGS=$hash_style_ldflags_save
4923 else
4924     AC_MSG_RESULT( no )
4926 AC_SUBST(HAVE_LD_HASH_STYLE)
4927 AC_SUBST(WITH_LINKER_HASH_STYLE)
4929 dnl ===================================================================
4930 dnl Check whether there's a Perl version available.
4931 dnl ===================================================================
4932 if test -z "$with_perl_home"; then
4933     AC_PATH_PROG(PERL, perl)
4934 else
4935     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4936     _perl_path="$with_perl_home/bin/perl"
4937     if test -x "$_perl_path"; then
4938         PERL=$_perl_path
4939     else
4940         AC_MSG_ERROR([$_perl_path not found])
4941     fi
4944 dnl ===================================================================
4945 dnl Testing for Perl version 5 or greater.
4946 dnl $] is the Perl version variable, it is returned as an integer
4947 dnl ===================================================================
4948 if test "$PERL"; then
4949     AC_MSG_CHECKING([the Perl version])
4950     ${PERL} -e "exit($]);"
4951     _perl_version=$?
4952     if test "$_perl_version" -lt 5; then
4953         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
4954     fi
4955     AC_MSG_RESULT([Perl $_perl_version])
4956 else
4957     AC_MSG_ERROR([Perl not found, install Perl 5])
4960 dnl ===================================================================
4961 dnl Testing for required Perl modules
4962 dnl ===================================================================
4964 AC_MSG_CHECKING([for required Perl modules])
4965 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
4966     AC_MSG_RESULT([all modules found])
4967 else
4968     AC_MSG_RESULT([failed to find some modules])
4969     # Find out which modules are missing.
4970     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
4971         missing_perl_modules="$missing_perl_modules Cwd"
4972     fi
4973     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
4974         missing_perl_modules="$missing_perl_modules Digest::MD5"
4975     fi
4976        AC_MSG_ERROR([
4977     The missing Perl modules are: $missing_perl_modules
4978     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
4981 dnl ===================================================================
4982 dnl Check for pkg-config
4983 dnl ===================================================================
4984 if test "$_os" != "WINNT"; then
4985     PKG_PROG_PKG_CONFIG
4988 if test "$_os" != "WINNT"; then
4990     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4991     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4992     # explicitly. Or put /path/to/compiler in PATH yourself.
4994     # Use wrappers for LTO
4995     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
4996         AC_CHECK_TOOL(AR,gcc-ar)
4997         AC_CHECK_TOOL(NM,gcc-nm)
4998         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
4999     else
5000         AC_CHECK_TOOL(AR,ar)
5001         AC_CHECK_TOOL(NM,nm)
5002         AC_CHECK_TOOL(RANLIB,ranlib)
5003     fi
5004     AC_CHECK_TOOL(OBJDUMP,objdump)
5005     AC_CHECK_TOOL(READELF,readelf)
5006     AC_CHECK_TOOL(STRIP,strip)
5007     if test "$_os" = "WINNT"; then
5008         AC_CHECK_TOOL(DLLTOOL,dlltool)
5009         AC_CHECK_TOOL(WINDRES,windres)
5010     fi
5012 AC_SUBST(AR)
5013 AC_SUBST(DLLTOOL)
5014 AC_SUBST(NM)
5015 AC_SUBST(OBJDUMP)
5016 AC_SUBST(PKG_CONFIG)
5017 AC_SUBST(RANLIB)
5018 AC_SUBST(READELF)
5019 AC_SUBST(STRIP)
5020 AC_SUBST(WINDRES)
5022 dnl ===================================================================
5023 dnl pkg-config checks on Mac OS X
5024 dnl ===================================================================
5026 if test $_os = Darwin; then
5027     AC_MSG_CHECKING([for bogus pkg-config])
5028     if test -n "$PKG_CONFIG"; then
5029         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5030             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5031         else
5032             if test "$enable_bogus_pkg_config" = "yes"; then
5033                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5034             else
5035                 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.])
5036             fi
5037         fi
5038     else
5039         AC_MSG_RESULT([no, good])
5040     fi
5043 find_csc()
5045     # Return value: $csctest
5047     unset csctest
5049     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5050     if test -n "$regvalue"; then
5051         csctest=$regvalue
5052         return
5053     fi
5056 find_al()
5058     # Return value: $altest
5060     unset altest
5062     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5063         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5064         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5065             altest=$regvalue
5066             return
5067         fi
5068     done
5070     # We need this additional check to detect 4.6.2 or above.
5071     for ver in 4.7 4.6.2; do
5072         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5073         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5074             altest=$regvalue
5075             return
5076         fi
5077     done
5080 find_dotnetsdk()
5082     # Return value: $frametest (that's a silly name...)
5084     unset frametest
5086     for ver in 1.1 2.0; do
5087         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5088         if test -n "$regvalue"; then
5089             frametest=$regvalue
5090             return
5091         fi
5092     done
5095 find_dotnetsdk46()
5097     unset frametest
5099     for ver in 4.7 4.6.2 4.6.1 4.6; do
5100         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5101         if test -n "$regvalue"; then
5102             frametest=$regvalue
5103             return
5104         fi
5105         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5106         if test -n "$regvalue"; then
5107             frametest=$regvalue
5108             return
5109         fi
5110     done
5113 find_winsdk_version()
5115     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5116     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5118     unset winsdktest winsdkbinsubdir winsdklibsubdir
5120     case "$1" in
5121     7.*)
5122         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5123         if test -n "$regvalue"; then
5124             winsdktest=$regvalue
5125             winsdklibsubdir=.
5126             return
5127         fi
5128         ;;
5129     8.0|8.0A)
5130         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5131         if test -n "$regvalue"; then
5132             winsdktest=$regvalue
5133             winsdklibsubdir=win8
5134             return
5135         fi
5136         ;;
5137     8.1|8.1A)
5138         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5139         if test -n "$regvalue"; then
5140             winsdktest=$regvalue
5141             winsdklibsubdir=winv6.3
5142             return
5143         fi
5144         ;;
5145     10.0)
5146         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5147         if test -n "$regvalue"; then
5148             winsdktest=$regvalue
5149             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5150             if test -n "$regvalue"; then
5151                 winsdkbinsubdir="$regvalue".0
5152             fi
5153             winsdklibsubdir=$regvalue
5154             if test "$regvalue" = "10.0.14393"; then
5155                 winsdklibsubdir="10.0.14393.0"
5156             elif test "$regvalue" = "10.0.15063"; then
5157                 winsdklibsubdir="10.0.15063.0"
5158                 dnl Hack needed at least by tml:
5159                 if test ! -f "${winsdktest}/Include/10.0.15063.0/um/sqlext.h" \
5160                     -a -f "${winsdktest}/Include/10.0.14393.0/um/sqlext.h"
5161                 then
5162                     winsdklibsubdir="10.0.14393.0"
5163                 fi
5164             fi
5165             return
5166         fi
5167         ;;
5168     esac
5171 find_winsdk()
5173     # Return value: From find_winsdk_version
5175     unset winsdktest
5177     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5178         find_winsdk_version $ver
5179         if test -n "$winsdktest"; then
5180             return
5181         fi
5182     done
5185 find_msms()
5187     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5188     AC_MSG_CHECKING([for $my_msm_file])
5189     msmdir=
5190     for ver in 14.0 15.0; do
5191         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5192         if test -n "$regvalue"; then
5193             if test -e "$regvalue/$my_msm_file"; then
5194                 msmdir=$regvalue
5195                 break
5196             fi
5197         fi
5198     done
5199     dnl Is the following fallback really necessary, or was it added in response
5200     dnl to never having started Visual Studio on a given machine, so the
5201     dnl registry keys checked above had presumably not yet been created?
5202     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5203     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5204     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5205     dnl expanding to "C:\Program Files\Common Files"), which would need
5206     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5207     dnl obtain its value from cygwin:
5208     if test -z "$msmdir"; then
5209         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5210         if test -e "$my_msm_dir/$my_msm_file"; then
5211             msmdir=$my_msm_dir
5212         fi
5213     fi
5215     dnl Starting from MSVC 15.0, merge modules are located in different directory
5216     if test $VCVER = 150; then
5217         my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$vcbuildnumber/MergeModules/"
5218         if test -e "$my_msm_dir/$my_msm_file"; then
5219             msmdir=$my_msm_dir
5220         else
5221             # got everything in 14.10.15017 except the MSMS in 25008... huh?
5222             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/14.10.25008/MergeModules/"
5223             if test -e "$my_msm_dir/$my_msm_file"; then
5224                 msmdir=$my_msm_dir
5225             fi
5226         fi
5227     fi
5229     if test -n "$msmdir"; then
5230         msmdir=`cygpath -m "$msmdir"`
5231         AC_MSG_RESULT([$msmdir])
5232     else
5233         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5234             AC_MSG_ERROR([not found])
5235         else
5236             AC_MSG_WARN([not found])
5237             add_warning "MSM $my_msm_file not found"
5238         fi
5239     fi
5242 find_msvc_x64_dlls()
5244     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5245     if test "$VCVER" = 150; then
5246         if test $vcbuildnumber = 14.10.25017; then
5247             msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$vcbuildnumber/onecore/x64/Microsoft.VC${VCVER}.CRT"
5248         else
5249             msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$vcbuildnumber/x64/Microsoft.VC${VCVER}.CRT"
5250         fi
5251     fi
5252     msvcdlls="msvcp140.dll vcruntime140.dll"
5253     for dll in $msvcdlls; do
5254         if ! test -f "$msvcdllpath/$dll"; then
5255             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5256         fi
5257     done
5260 dnl =========================================
5261 dnl Check for the Windows  SDK.
5262 dnl =========================================
5263 if test "$_os" = "WINNT"; then
5264     AC_MSG_CHECKING([for Windows SDK])
5265     if test "$build_os" = "cygwin"; then
5266         find_winsdk
5267         WINDOWS_SDK_HOME=$winsdktest
5269         # normalize if found
5270         if test -n "$WINDOWS_SDK_HOME"; then
5271             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5272             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5273         fi
5275         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5276     fi
5278     if test -n "$WINDOWS_SDK_HOME"; then
5279         # Remove a possible trailing backslash
5280         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5282         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5283              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5284              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5285             have_windows_sdk_headers=yes
5286         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5287              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5288              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5289             have_windows_sdk_headers=yes
5290         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5291              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5292              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5293             have_windows_sdk_headers=yes
5294         else
5295             have_windows_sdk_headers=no
5296         fi
5298         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5299             have_windows_sdk_libs=yes
5300         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5301             have_windows_sdk_libs=yes
5302         else
5303             have_windows_sdk_libs=no
5304         fi
5306         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5307             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5308 the  Windows SDK are installed.])
5309         fi
5310     fi
5312     if test -z "$WINDOWS_SDK_HOME"; then
5313         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5314     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5315         WINDOWS_SDK_VERSION=70
5316         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5317     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5318         WINDOWS_SDK_VERSION=80
5319         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5320     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5321         WINDOWS_SDK_VERSION=81
5322         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5323     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5324         WINDOWS_SDK_VERSION=10
5325         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5326     else
5327         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5328     fi
5329     PathFormat "$WINDOWS_SDK_HOME"
5330     WINDOWS_SDK_HOME="$formatted_path"
5331     if test "$build_os" = "cygwin"; then
5332         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5333         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5334             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5335         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5336             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5337         fi
5338     fi
5340     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5341     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5342     dnl but not in v8.0), so allow this to be overridden with a
5343     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5344     dnl and configuration error if no WiLangId.vbs is found would arguably be
5345     dnl better, but I do not know under which conditions exactly it is needed by
5346     dnl msiglobal.pm:
5347     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5348         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5349         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5350             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5351         fi
5352         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5353             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5354         fi
5355         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5356             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
5357             add_warning "WiLangId.vbs not found - building translated packages will fail"
5358         fi
5359     fi
5361 AC_SUBST(WINDOWS_SDK_HOME)
5362 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5363 AC_SUBST(WINDOWS_SDK_VERSION)
5364 AC_SUBST(WINDOWS_SDK_WILANGID)
5366 if test "$build_os" = "cygwin"; then
5367     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5368     dnl dir, it also determines that dir's path w/o an arch segment if any,
5369     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5370     AC_MSG_CHECKING([for midl.exe])
5372     find_winsdk
5373     if test -n "$winsdkbinsubdir" \
5374         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5375     then
5376         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5377         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5378     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5379         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5380         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5381     elif test -f "$winsdktest/Bin/midl.exe"; then
5382         MIDL_PATH=$winsdktest/Bin
5383         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5384     fi
5385     if test ! -f "$MIDL_PATH/midl.exe"; then
5386         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5387     else
5388         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5389     fi
5391     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5392     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5394     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5395          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5396          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5397          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5398     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5399          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5400          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5401          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5402     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5403          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5404          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5405          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5406     else
5407         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5408     fi
5410     dnl Check csc.exe
5411     AC_MSG_CHECKING([for csc.exe])
5412     find_csc
5413     if test -f "$csctest/csc.exe"; then
5414         CSC_PATH="$csctest"
5415     fi
5416     if test ! -f "$CSC_PATH/csc.exe"; then
5417         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5418     else
5419         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5420     fi
5422     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5424     dnl Check al.exe
5425     AC_MSG_CHECKING([for al.exe])
5426     find_winsdk
5427     if test -n "$winsdkbinsubdir" \
5428         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5429     then
5430         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5431     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5432         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5433     elif test -f "$winsdktest/Bin/al.exe"; then
5434         AL_PATH="$winsdktest/Bin"
5435     fi
5437     if test -z "$AL_PATH"; then
5438         find_al
5439         if test -f "$altest/bin/al.exe"; then
5440             AL_PATH="$altest/bin"
5441         elif test -f "$altest/al.exe"; then
5442             AL_PATH="$altest"
5443         fi
5444     fi
5445     if test ! -f "$AL_PATH/al.exe"; then
5446         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5447     else
5448         AC_MSG_RESULT([$AL_PATH/al.exe])
5449     fi
5451     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5453     dnl Check mscoree.lib / .NET Framework dir
5454     AC_MSG_CHECKING(.NET Framework)
5455     find_dotnetsdk
5456     if test -f "$frametest/lib/mscoree.lib"; then
5457         DOTNET_FRAMEWORK_HOME="$frametest"
5458     else
5459         find_winsdk
5460         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5461             DOTNET_FRAMEWORK_HOME="$winsdktest"
5462         else
5463             find_dotnetsdk46
5464             PathFormat "$frametest"
5465             frametest="$formatted_path"
5466             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5467                  DOTNET_FRAMEWORK_HOME="$frametest"
5468             fi
5469         fi
5470     fi
5472     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
5473         AC_MSG_ERROR([mscoree.lib not found])
5474     fi
5475     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5477     PathFormat "$MIDL_PATH"
5478     MIDL_PATH="$formatted_path"
5480     PathFormat "$AL_PATH"
5481     AL_PATH="$formatted_path"
5483     PathFormat "$DOTNET_FRAMEWORK_HOME"
5484     DOTNET_FRAMEWORK_HOME="$formatted_path"
5486     PathFormat "$CSC_PATH"
5487     CSC_PATH="$formatted_path"
5490 dnl ===================================================================
5491 dnl Check if stdc headers are available excluding MSVC.
5492 dnl ===================================================================
5493 if test "$_os" != "WINNT"; then
5494     AC_HEADER_STDC
5497 dnl ===================================================================
5498 dnl Testing for C++ compiler and version...
5499 dnl ===================================================================
5501 if test "$_os" != "WINNT"; then
5502     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5503     save_CXXFLAGS=$CXXFLAGS
5504     AC_PROG_CXX
5505     CXXFLAGS=$save_CXXFLAGS
5506 else
5507     if test -n "$CC" -a -z "$CXX"; then
5508         CXX="$CC"
5509     fi
5512 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5513 dnl ("implementation limitation" when defining OUStringLiteral variables in
5514 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5515 dnl probably a good idea to require that anyway.  A reliable way to check for
5516 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5517 dnl namespace definitions (which requires /std:c++latest to be enabled):
5518 if test "$COM" = MSC -a "$VCVER" = 140; then
5519     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5520     save_CXX=$CXX
5521     save_CXXFLAGS=$CXXFLAGS
5522     CXX=$MSVC_CXX
5523     CXXFLAGS="$CXXFLAGS /std:c++latest"
5524     AC_LANG_PUSH([C++])
5525     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5526         namespace A::B {}
5527     ]])], [good=yes], [good=no])
5528     AC_LANG_POP([C++])
5529     CXX=$save_CXX
5530     CXXFLAGS=$save_CXXFLAGS
5531     AC_MSG_RESULT([$good])
5532     if test "$good" = no; then
5533         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5534     fi
5537 dnl check for GNU C++ compiler version
5538 if test "$GXX" = "yes"; then
5539     AC_MSG_CHECKING([the GNU C++ compiler version])
5541     _gpp_version=`$CXX -dumpversion`
5542     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5544     if test "$_gpp_majmin" -lt "401"; then
5545         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5546     else
5547         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5548     fi
5550     dnl see https://code.google.com/p/android/issues/detail?id=41770
5551     if test "$_gpp_majmin" -ge "401"; then
5552         glibcxx_threads=no
5553         AC_LANG_PUSH([C++])
5554         AC_REQUIRE_CPP
5555         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5556         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5557             #include <bits/c++config.h>]],[[
5558             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5559             && !defined(_GLIBCXX__PTHREADS) \
5560             && !defined(_GLIBCXX_HAS_GTHREADS)
5561             choke me
5562             #endif
5563         ]])],[AC_MSG_RESULT([yes])
5564         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5565         AC_LANG_POP([C++])
5566         if test $glibcxx_threads = yes; then
5567             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5568         fi
5569      fi
5571 AC_SUBST(BOOST_CXXFLAGS)
5574 # prefx CXX with ccache if needed
5576 if test "$CCACHE" != ""; then
5577     AC_MSG_CHECKING([whether $CXX is already ccached])
5578     AC_LANG_PUSH([C++])
5579     save_CXXFLAGS=$CXXFLAGS
5580     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5581     dnl an empty program will do, we're checking the compiler flags
5582     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5583                       [use_ccache=yes], [use_ccache=no])
5584     if test $use_ccache = yes; then
5585         AC_MSG_RESULT([yes])
5586     else
5587         CXX="$CCACHE $CXX"
5588         AC_MSG_RESULT([no])
5589     fi
5590     CXXFLAGS=$save_CXXFLAGS
5591     AC_LANG_POP([C++])
5594 dnl ===================================================================
5595 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5596 dnl ===================================================================
5598 if test "$_os" != "WINNT"; then
5599     AC_PROG_CXXCPP
5601     dnl Check whether there's a C pre-processor.
5602     AC_PROG_CPP
5606 dnl ===================================================================
5607 dnl Find integral type sizes and alignments
5608 dnl ===================================================================
5610 if test "$_os" != "WINNT"; then
5612 if test "$_os" == "iOS"; then
5613 if test "$host_cpu" == "armv7"; then
5614   ac_cv_sizeof_long=4
5615   ac_cv_sizeof_short=2
5616   ac_cv_sizeof_int=4
5617   ac_cv_sizeof_long_long=8
5618   ac_cv_sizeof_double=8
5619   ac_cv_sizeof_voidp=4
5620 else
5621   ac_cv_sizeof_long=8
5622   ac_cv_sizeof_short=2
5623   ac_cv_sizeof_int=4
5624   ac_cv_sizeof_long_long=8
5625   ac_cv_sizeof_double=8
5626   ac_cv_sizeof_voidp=8
5628 AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5630 else
5631     AC_CHECK_SIZEOF(long)
5632     AC_CHECK_SIZEOF(short)
5633     AC_CHECK_SIZEOF(int)
5634     AC_CHECK_SIZEOF(long long)
5635     AC_CHECK_SIZEOF(double)
5636     AC_CHECK_SIZEOF(void*)
5639     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5640     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5641     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5642     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5643     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5645     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5646     m4_pattern_allow([AC_CHECK_ALIGNOF])
5647     m4_ifdef([AC_CHECK_ALIGNOF],
5648         [
5649             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5650             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5651             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5652             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5653         ],
5654         [
5655             case "$_os-$host_cpu" in
5656             Linux-i686)
5657                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5658                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5659                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5660                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5661                 ;;
5662             Linux-x86_64)
5663                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5664                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5665                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5666                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5667                 ;;
5668             *)
5669                 if test -z "$ac_cv_alignof_short" -o \
5670                         -z "$ac_cv_alignof_int" -o \
5671                         -z "$ac_cv_alignof_long" -o \
5672                         -z "$ac_cv_alignof_double"; then
5673                    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.])
5674                 fi
5675                 ;;
5676             esac
5677         ])
5679     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5680     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5681     if test $ac_cv_sizeof_long -eq 8; then
5682         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5683     elif test $ac_cv_sizeof_double -eq 8; then
5684         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5685     else
5686         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5687     fi
5689     dnl Check for large file support
5690     AC_SYS_LARGEFILE
5691     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5692         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5693     fi
5694     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5695         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5696     fi
5697 else
5698     # Hardcode for MSVC
5699     SAL_TYPES_SIZEOFSHORT=2
5700     SAL_TYPES_SIZEOFINT=4
5701     SAL_TYPES_SIZEOFLONG=4
5702     SAL_TYPES_SIZEOFLONGLONG=8
5703     if test "$BITNESS_OVERRIDE" = ""; then
5704         SAL_TYPES_SIZEOFPOINTER=4
5705     else
5706         SAL_TYPES_SIZEOFPOINTER=8
5707     fi
5708     SAL_TYPES_ALIGNMENT2=2
5709     SAL_TYPES_ALIGNMENT4=4
5710     SAL_TYPES_ALIGNMENT8=8
5711     LFS_CFLAGS=''
5713 AC_SUBST(LFS_CFLAGS)
5715 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5716 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5717 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5718 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5719 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5720 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5721 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5722 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5724 dnl ===================================================================
5725 dnl Check whether to enable runtime optimizations
5726 dnl ===================================================================
5727 ENABLE_RUNTIME_OPTIMIZATIONS=
5728 AC_MSG_CHECKING([whether to enable runtime optimizations])
5729 if test -z "$enable_runtime_optimizations"; then
5730     for i in $CC; do
5731         case $i in
5732         -fsanitize=*)
5733             enable_runtime_optimizations=no
5734             break
5735             ;;
5736         esac
5737     done
5739 if test "$enable_runtime_optimizations" != no; then
5740     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5741     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5742     AC_MSG_RESULT([yes])
5743 else
5744     AC_MSG_RESULT([no])
5746 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5748 dnl ===================================================================
5749 dnl Check if valgrind headers are available
5750 dnl ===================================================================
5751 ENABLE_VALGRIND=
5752 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5753     prev_cppflags=$CPPFLAGS
5754     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5755     # or where does it come from?
5756     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5757     AC_CHECK_HEADER([valgrind/valgrind.h],
5758         [ENABLE_VALGRIND=TRUE])
5759     CPPFLAGS=$prev_cppflags
5761 AC_SUBST([ENABLE_VALGRIND])
5762 if test -z "$ENABLE_VALGRIND"; then
5763     if test "$with_valgrind" = yes; then
5764         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5765     fi
5766     VALGRIND_CFLAGS=
5768 AC_SUBST([VALGRIND_CFLAGS])
5771 dnl ===================================================================
5772 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5773 dnl ===================================================================
5775 # We need at least the sys/sdt.h include header.
5776 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5777 if test "$SDT_H_FOUND" = "TRUE"; then
5778     # Found sys/sdt.h header, now make sure the c++ compiler works.
5779     # Old g++ versions had problems with probes in constructors/destructors.
5780     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5781     AC_LANG_PUSH([C++])
5782     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5783     #include <sys/sdt.h>
5784     class ProbeClass
5785     {
5786     private:
5787       int& ref;
5788       const char *name;
5790     public:
5791       ProbeClass(int& v, const char *n) : ref(v), name(n)
5792       {
5793         DTRACE_PROBE2(_test_, cons, name, ref);
5794       }
5796       void method(int min)
5797       {
5798         DTRACE_PROBE3(_test_, meth, name, ref, min);
5799         ref -= min;
5800       }
5802       ~ProbeClass()
5803       {
5804         DTRACE_PROBE2(_test_, dest, name, ref);
5805       }
5806     };
5807     ]],[[
5808     int i = 64;
5809     DTRACE_PROBE1(_test_, call, i);
5810     ProbeClass inst = ProbeClass(i, "call");
5811     inst.method(24);
5812     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5813           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5814     AC_LANG_POP([C++])
5816 AC_CONFIG_HEADERS([config_host/config_probes.h])
5818 dnl ===================================================================
5819 dnl GCC features
5820 dnl ===================================================================
5821 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5822     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5823     save_CFLAGS=$CFLAGS
5824     CFLAGS="$CFLAGS -Werror -mno-avx"
5825     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5826     CFLAGS=$save_CFLAGS
5827     if test "$HAVE_GCC_AVX" = "TRUE"; then
5828         AC_MSG_RESULT([yes])
5829     else
5830         AC_MSG_RESULT([no])
5831     fi
5833     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5834     save_CFLAGS=$CFLAGS
5835     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5836     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5837     CFLAGS=$save_CFLAGS
5838     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5839         AC_MSG_RESULT([yes])
5840     else
5841         AC_MSG_RESULT([no])
5842     fi
5844     AC_MSG_CHECKING([whether $CC supports atomic functions])
5845     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5846     int v = 0;
5847     if (__sync_add_and_fetch(&v, 1) != 1 ||
5848         __sync_sub_and_fetch(&v, 1) != 0)
5849         return 1;
5850     __sync_synchronize();
5851     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5852         v != 1)
5853         return 1;
5854     return 0;
5855 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5856     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5857         AC_MSG_RESULT([yes])
5858         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5859     else
5860         AC_MSG_RESULT([no])
5861     fi
5863     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5864     save_CFLAGS=$CFLAGS
5865     CFLAGS="$CFLAGS -Werror"
5866     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5867             __attribute__((deprecated("test"))) void f();
5868         ])], [
5869             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5870             AC_MSG_RESULT([yes])
5871         ], [AC_MSG_RESULT([no])])
5872     CFLAGS=$save_CFLAGS
5874     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5875     AC_LANG_PUSH([C++])
5876     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5877             #include <cstddef>
5878             #include <cxxabi.h>
5879             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5880         ])], [
5881             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5882             AC_MSG_RESULT([yes])
5883         ], [AC_MSG_RESULT([no])])
5884     AC_LANG_POP([C++])
5886     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5887     AC_LANG_PUSH([C++])
5888     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5889             #include <cstddef>
5890             #include <cxxabi.h>
5891             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5892         ])], [
5893             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5894             AC_MSG_RESULT([yes])
5895         ], [AC_MSG_RESULT([no])])
5896     AC_LANG_POP([C++])
5898     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5899     AC_LANG_PUSH([C++])
5900     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5901             #include <cxxabi.h>
5902             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5903         ])], [
5904             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5905             AC_MSG_RESULT([yes])
5906         ], [AC_MSG_RESULT([no])])
5907     AC_LANG_POP([C++])
5909     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5910     AC_LANG_PUSH([C++])
5911     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5912             #include <cstddef>
5913             #include <cxxabi.h>
5914             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
5915         ])], [
5916             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
5917             AC_MSG_RESULT([yes])
5918         ], [AC_MSG_RESULT([no])])
5919     AC_LANG_POP([C++])
5921     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
5922     AC_LANG_PUSH([C++])
5923     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5924             #include <cstddef>
5925             #include <cxxabi.h>
5926             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
5927         ])], [
5928             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
5929             AC_MSG_RESULT([yes])
5930         ], [AC_MSG_RESULT([no])])
5931     AC_LANG_POP([C++])
5933     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5934     AC_LANG_PUSH([C++])
5935     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5936             #include <cxxabi.h>
5937             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5938         ])], [
5939             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
5940             AC_MSG_RESULT([yes])
5941         ], [AC_MSG_RESULT([no])])
5942     AC_LANG_POP([C++])
5944     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5945     AC_LANG_PUSH([C++])
5946     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5947             #include <cxxabi.h>
5948             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5949         ])], [
5950             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
5951             AC_MSG_RESULT([yes])
5952         ], [AC_MSG_RESULT([no])])
5953     AC_LANG_POP([C++])
5955     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
5956     AC_LANG_PUSH([C++])
5957     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5958             #include <cstddef>
5959             #include <cxxabi.h>
5960             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
5961         ])], [
5962             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
5963             AC_MSG_RESULT([yes])
5964         ], [AC_MSG_RESULT([no])])
5965     AC_LANG_POP([C++])
5967     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
5968     AC_LANG_PUSH([C++])
5969     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5970             #include <cstddef>
5971             #include <cxxabi.h>
5972             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
5973         ])], [
5974             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
5975             AC_MSG_RESULT([yes])
5976         ], [AC_MSG_RESULT([no])])
5977     AC_LANG_POP([C++])
5979     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
5980     AC_LANG_PUSH([C++])
5981     save_CXXFLAGS=$CXXFLAGS
5982     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
5983     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5984             #include <string>
5985             void f() { std::string s; }
5986         ])], [
5987             AC_MSG_RESULT([no])
5988         ], [
5989             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
5990             AC_MSG_RESULT([yes])])
5991     CXXFLAGS=$save_CXXFLAGS
5992     AC_LANG_POP([C++])
5994     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5995     AC_LANG_PUSH([C++])
5996     save_CXXFLAGS=$CXXFLAGS
5997     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
5998     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5999             struct __attribute__((warn_unused)) dummy {};
6000         ])], [
6001             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6002             AC_MSG_RESULT([yes])
6003         ], [AC_MSG_RESULT([no])])
6004     CXXFLAGS=$save_CXXFLAGS
6005 AC_LANG_POP([C++])
6008 AC_SUBST(HAVE_GCC_AVX)
6009 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6010 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6012 dnl ===================================================================
6013 dnl Identify the C++ library
6014 dnl ===================================================================
6016 AC_MSG_CHECKING([What the C++ library is])
6017 AC_LANG_PUSH([C++])
6018 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6019 #include <utility>
6020 #ifndef __GLIBCXX__
6021 foo bar
6022 #endif
6023 ]])],
6024     [CPP_LIBRARY=GLIBCXX
6025      cpp_library_name="GNU libstdc++"
6026     ],
6027     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6028 #include <utility>
6029 #ifndef _LIBCPP_VERSION
6030 foo bar
6031 #endif
6032 ]])],
6033     [CPP_LIBRARY=LIBCPP
6034      cpp_library_name="LLVM libc++"
6035     ],
6036     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6037 #include <utility>
6038 #ifndef _MSC_VER
6039 foo bar
6040 #endif
6041 ]])],
6042     [CPP_LIBRARY=MSVCRT
6043      cpp_library_name="Microsoft"
6044     ],
6045     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6046 AC_MSG_RESULT([$cpp_library_name])
6047 AC_LANG_POP([C++])
6049 dnl ===================================================================
6050 dnl C++11
6051 dnl ===================================================================
6053 CXXFLAGS_CXX11=
6054 if test "$COM" = MSC; then
6055     AC_MSG_CHECKING([whether $CXX supports C++11])
6056     AC_MSG_RESULT(yes)
6057     # MSVC supports (a subset of) CXX11 without any switch
6058 elif test "$GCC" = "yes"; then
6059     HAVE_CXX11=
6060     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
6061     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
6062         save_CXXFLAGS=$CXXFLAGS
6063         CXXFLAGS="$CXXFLAGS $flag -Werror"
6064         AC_LANG_PUSH([C++])
6065         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6066             #include <algorithm>
6067             #include <functional>
6068             #include <vector>
6069             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6070                 std::sort(v.begin(), v.end(), fn);
6071             }
6072             ]])],[CXXFLAGS_CXX11=$flag])
6073         AC_LANG_POP([C++])
6074         CXXFLAGS=$save_CXXFLAGS
6075         if test -n "$CXXFLAGS_CXX11"; then
6076             HAVE_CXX11=TRUE
6077             break
6078         fi
6079     done
6080     if test "$HAVE_CXX11" = TRUE; then
6081         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6082     else
6083         AC_MSG_ERROR(no)
6084     fi
6087 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6088 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6089 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6090 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6091 dnl again towards 4.7.2:
6092 if test $CPP_LIBRARY = GLIBCXX; then
6093     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6094     AC_LANG_PUSH([C++])
6095     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6096 #include <list>
6097 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6098     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6099     //   GCC 4.7.0: 20120322
6100     //   GCC 4.7.1: 20120614
6101     // and using a range check is not possible as the mapping between
6102     // __GLIBCXX__ values and GCC versions is not monotonic
6103 /* ok */
6104 #else
6105 abi broken
6106 #endif
6107         ]])], [AC_MSG_RESULT(no, ok)],
6108         [AC_MSG_ERROR(yes)])
6109     AC_LANG_POP([C++])
6112 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6113 save_CXXFLAGS=$CXXFLAGS
6114 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6115 AC_LANG_PUSH([C++])
6117 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6118 #include <stddef.h>
6120 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6122 namespace
6124         struct b
6125         {
6126                 int i;
6127                 int j;
6128         };
6130 ]], [[
6131 struct a
6133         int i;
6134         int j;
6136 a thinga[]={{0,0}, {1,1}};
6137 b thingb[]={{0,0}, {1,1}};
6138 size_t i = sizeof(sal_n_array_size(thinga));
6139 size_t j = sizeof(sal_n_array_size(thingb));
6140 return !(i != 0 && j != 0);
6142     ], [ AC_MSG_RESULT(yes) ],
6143     [ AC_MSG_ERROR(no)])
6144 AC_LANG_POP([C++])
6145 CXXFLAGS=$save_CXXFLAGS
6147 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6148 save_CXXFLAGS=$CXXFLAGS
6149 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6150 AC_LANG_PUSH([C++])
6152 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6153 #include <vector>
6154     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6155     // (__float128)
6157     ],[ AC_MSG_RESULT(yes) ],
6158     [
6159         AC_MSG_RESULT(no)
6160         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6161         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6162         # __float128 is available during its build, but it's usually built using GCC,
6163         # and so c++config.h hardcodes __float128 being supported). As the only place
6164         # where __float128 is actually used is in a template specialization,
6165         # -D__float128=void will avoid the problem there while still causing a problem
6166         # if somebody actually uses the type.
6167         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6168         CXXFLAGS="$CXXFLAGS -D__float128=void"
6169         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6170 #include <vector>
6171     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6172     // (__float128)
6174     ],
6175     [
6176      AC_MSG_RESULT(yes)
6177      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6178     ],
6179     [
6180      AC_MSG_ERROR(no)
6181     ])
6184 AC_LANG_POP([C++])
6185 CXXFLAGS=$save_CXXFLAGS
6187 AC_SUBST(CXXFLAGS_CXX11)
6189 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6190 save_CXXFLAGS=$CXXFLAGS
6191 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6192 AC_LANG_PUSH([C++])
6193 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6194     // A somewhat over-complicated way of checking for
6195     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6196     // in constexpr function":
6197     #include <cassert>
6198     template<typename T> inline constexpr T f(T x) { return x; }
6199     template<typename T> inline constexpr T g(T x) {
6200         assert(f(static_cast<int>(x)));
6201         return x;
6202     }
6203     enum E { e };
6204     auto v = g(E::e);
6206     struct S {
6207         int n_;
6208         constexpr bool f() {
6209             int n = n_;
6210             int i = 0;
6211             while (n > 0) { --n; ++i; }
6212             assert(i >= 0);
6213             return i == 0;
6214         }
6215     };
6216     constexpr auto v2 = S{10}.f();
6217     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6218 AC_LANG_POP([C++])
6219 CXXFLAGS=$save_CXXFLAGS
6220 AC_MSG_RESULT([$cxx14_constexpr])
6221 if test "$cxx14_constexpr" = yes; then
6222     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6225 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6226 save_CXXFLAGS=$CXXFLAGS
6227 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6228 AC_LANG_PUSH([C++])
6229 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6230     struct S {
6231         void f() &;
6232         void f() &&;
6233     };
6234     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6235 AC_LANG_POP([C++])
6236 CXXFLAGS=$save_CXXFLAGS
6237 AC_MSG_RESULT([$cxx11_ref_qualifier])
6238 if test "$cxx11_ref_qualifier" = no; then
6239     AC_MSG_ERROR([Your $CXX does not support C++11 ref-qualifiers. This is no longer supported.])
6242 dnl _Pragma support (may require C++11)
6243 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6244     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6245     AC_LANG_PUSH([C++])
6246     save_CXXFLAGS=$CXXFLAGS
6247     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6248     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6249             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6250         ])], [
6251             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6252             AC_MSG_RESULT([yes])
6253         ], [AC_MSG_RESULT([no])])
6254     AC_LANG_POP([C++])
6255     CXXFLAGS=$save_CXXFLAGS
6258 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6259 if test "$GCC" = yes; then
6260     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6261     AC_LANG_PUSH([C++])
6262     save_CXXFLAGS=$CXXFLAGS
6263     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6264     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6265     CXXFLAGS=$save_CXXFLAGS
6266     AC_LANG_POP([C++])
6267     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6268         AC_MSG_RESULT([yes])
6269     else
6270         AC_MSG_RESULT([no])
6271     fi
6273 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6275 dnl ===================================================================
6276 dnl system stl sanity tests
6277 dnl ===================================================================
6278 if test "$_os" != "WINNT"; then
6280     AC_LANG_PUSH([C++])
6282     save_CPPFLAGS="$CPPFLAGS"
6283     if test -n "$MACOSX_SDK_PATH"; then
6284         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6285     fi
6287     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6288     # only.
6289     if test "$CPP_LIBRARY" = GLIBCXX; then
6290         dnl gcc#19664, gcc#22482, rhbz#162935
6291         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6292         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6293         AC_MSG_RESULT([$stlvisok])
6294         if test "$stlvisok" = "no"; then
6295             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6296         fi
6297     fi
6299     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6300     # when we don't make any dynamic libraries?
6301     if test "$DISABLE_DYNLOADING" = ""; then
6302         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6303         cat > conftestlib1.cc <<_ACEOF
6304 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6305 struct S2: S1<int> { virtual ~S2(); };
6306 S2::~S2() {}
6307 _ACEOF
6308         cat > conftestlib2.cc <<_ACEOF
6309 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6310 struct S2: S1<int> { virtual ~S2(); };
6311 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6312 _ACEOF
6313         gccvisinlineshiddenok=yes
6314         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6315             gccvisinlineshiddenok=no
6316         else
6317             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6318             dnl known to not work with -z defs (unsetting which makes the test
6319             dnl moot, though):
6320             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6321             if test "$COM_IS_CLANG" = TRUE; then
6322                 for i in $CXX $CXXFLAGS; do
6323                     case $i in
6324                     -fsanitize=*)
6325                         my_linkflagsnoundefs=
6326                         break
6327                         ;;
6328                     esac
6329                 done
6330             fi
6331             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6332                 gccvisinlineshiddenok=no
6333             fi
6334         fi
6336         rm -fr libconftest*
6337         AC_MSG_RESULT([$gccvisinlineshiddenok])
6338         if test "$gccvisinlineshiddenok" = "no"; then
6339             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6340         fi
6341     fi
6343     AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6344     cat >visibility.cxx <<_ACEOF
6345 #pragma GCC visibility push(hidden)
6346 struct __attribute__ ((visibility ("default"))) TestStruct {
6347   static void Init();
6349 __attribute__ ((visibility ("default"))) void TestFunc() {
6350   TestStruct::Init();
6352 _ACEOF
6353     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6354         gccvisbroken=yes
6355     else
6356         case "$host_cpu" in
6357         i?86|x86_64)
6358             if test "$_os" = "Darwin"; then
6359                 gccvisbroken=no
6360             else
6361                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6362                     gccvisbroken=no
6363                 else
6364                     gccvisbroken=yes
6365                 fi
6366             fi
6367             ;;
6368         *)
6369             gccvisbroken=no
6370             ;;
6371         esac
6372     fi
6373     rm -f visibility.s visibility.cxx
6375     AC_MSG_RESULT([$gccvisbroken])
6376     if test "$gccvisbroken" = "yes"; then
6377         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6378     fi
6380     CPPFLAGS="$save_CPPFLAGS"
6382     AC_LANG_POP([C++])
6385 dnl ===================================================================
6386 dnl  Clang++ tests
6387 dnl ===================================================================
6389 HAVE_GCC_FNO_DEFAULT_INLINE=
6390 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6391 if test "$GCC" = "yes"; then
6392     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6393     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6394         # Option just ignored and silly warning that isn't a real
6395         # warning printed
6396         :
6397     else
6398         AC_LANG_PUSH([C++])
6399         save_CXXFLAGS=$CXXFLAGS
6400         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6401         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6402         CXXFLAGS=$save_CXXFLAGS
6403         AC_LANG_POP([C++])
6404     fi
6405     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6406         AC_MSG_RESULT([yes])
6407     else
6408         AC_MSG_RESULT([no])
6409     fi
6411     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6412     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6413         # As above
6414         :
6415     else
6416         AC_LANG_PUSH([C++])
6417         save_CXXFLAGS=$CXXFLAGS
6418         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6419         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6420         CXXFLAGS=$save_CXXFLAGS
6421         AC_LANG_POP([C++])
6422     fi
6423     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6424         AC_MSG_RESULT([yes])
6425     else
6426         AC_MSG_RESULT([no])
6427     fi
6429 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6430 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6432 dnl ===================================================================
6433 dnl Compiler plugins
6434 dnl ===================================================================
6436 COMPILER_PLUGINS=
6437 # currently only Clang
6439 if test "$COM_IS_CLANG" != "TRUE"; then
6440     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6441         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6442         enable_compiler_plugins=no
6443     fi
6446 if test "$COM_IS_CLANG" = "TRUE"; then
6447     if test -n "$enable_compiler_plugins"; then
6448         compiler_plugins="$enable_compiler_plugins"
6449     elif test -n "$ENABLE_DBGUTIL"; then
6450         compiler_plugins=test
6451     else
6452         compiler_plugins=no
6453     fi
6454     if test "$compiler_plugins" != "no"; then
6455         dnl The prefix where Clang resides, override to where Clang resides if
6456         dnl using a source build:
6457         if test -z "$CLANGDIR"; then
6458             CLANGDIR=/usr
6459         fi
6460         AC_LANG_PUSH([C++])
6461         save_CPPFLAGS=$CPPFLAGS
6462         save_CXX=$CXX
6463         # compiler plugins must be built with "native" bitness of clang
6464         # because they link against clang libraries
6465         CXX=${COMPILER_PLUGINS_CXX-$(echo $CXX | sed -e s/-m64// -e s/-m32//)}
6466         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6467         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6468             [COMPILER_PLUGINS=TRUE],
6469             [
6470             if test "$compiler_plugins" = "yes"; then
6471                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6472             else
6473                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6474                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6475             fi
6476             ])
6477         CXX=$save_CXX
6478         CPPFLAGS=$save_CPPFLAGS
6479         AC_LANG_POP([C++])
6480     fi
6481 else
6482     if test "$enable_compiler_plugins" = "yes"; then
6483         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6484     fi
6486 AC_SUBST(COMPILER_PLUGINS)
6487 AC_SUBST(COMPILER_PLUGINS_CXX)
6488 AC_SUBST(CLANGDIR)
6490 # Plugin to help linker.
6491 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6492 # This makes --enable-lto build with clang work.
6493 AC_SUBST(LD_PLUGIN)
6495 dnl ===================================================================
6496 dnl allocator
6497 dnl ===================================================================
6498 AC_MSG_CHECKING([which memory allocator to use])
6499 if test "$with_alloc" = "system"; then
6500     AC_MSG_RESULT([system])
6501     ALLOC="SYS_ALLOC"
6503 if test "$with_alloc" = "tcmalloc"; then
6504     AC_MSG_RESULT(tcmalloc)
6505     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6506         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6507     fi
6508     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6509         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6510     ALLOC="TCMALLOC"
6512 if test "$with_alloc" = "jemalloc"; then
6513     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6514         AC_MSG_RESULT(jemalloc)
6515         save_CFLAGS=$CFLAGS
6516         CFLAGS="$CFLAGS -pthread"
6517         AC_CHECK_LIB([jemalloc], [malloc], [:],
6518             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6519         ALLOC="JEMALLOC"
6520         CFLAGS=$save_CFLAGS
6521     else
6522         AC_MSG_RESULT([system])
6523         ALLOC="SYS_ALLOC"
6524     fi
6526 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6527     AC_MSG_RESULT([internal])
6529 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6530 AC_SUBST(HAVE_POSIX_FALLOCATE)
6531 AC_SUBST(ALLOC)
6533 dnl ===================================================================
6534 dnl Custom build version
6535 dnl ===================================================================
6537 AC_MSG_CHECKING([whether to add custom build version])
6538 if test "$with_build_version" != ""; then
6539     BUILD_VER_STRING=$with_build_version
6540     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6541 else
6542     BUILD_VER_STRING=
6543     AC_MSG_RESULT([no])
6545 AC_SUBST(BUILD_VER_STRING)
6547 JITC_PROCESSOR_TYPE=""
6548 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6549     # IBMs JDK needs this...
6550     JITC_PROCESSOR_TYPE=6
6551     export JITC_PROCESSOR_TYPE
6553 AC_SUBST([JITC_PROCESSOR_TYPE])
6555 # Misc Windows Stuff
6556 if test $_os = "WINNT"; then
6557     find_msvc_x64_dlls
6558     find_msms
6559     MSVC_DLL_PATH="$msvcdllpath"
6560     MSVC_DLLS="$msvcdlls"
6561     MSM_PATH="$msmdir"
6562     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6565 AC_SUBST(MSVC_DLL_PATH)
6566 AC_SUBST(MSVC_DLLS)
6567 AC_SUBST(MSM_PATH)
6569 dnl ===================================================================
6570 dnl Checks for Java
6571 dnl ===================================================================
6572 if test "$ENABLE_JAVA" != ""; then
6574     # Windows-specific tests
6575     if test "$build_os" = "cygwin"; then
6576         if test "$BITNESS_OVERRIDE" = 64; then
6577             bitness=64
6578         else
6579             bitness=32
6580         fi
6582         if test -z "$with_jdk_home"; then
6583             for ver in 1.8 1.7 1.6; do
6584                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6585                 if test -n "$regvalue"; then
6586                     _jdk_home=$regvalue
6587                     break
6588                 fi
6589             done
6590             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6591                 with_jdk_home="$_jdk_home"
6592                 howfound="found automatically"
6593             else
6594                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6595             fi
6596         else
6597             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6598             howfound="you passed"
6599         fi
6600     fi
6602     # 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.
6603     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6604     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6605         with_jdk_home=`/usr/libexec/java_home`
6606     fi
6608     JAVA_HOME=; export JAVA_HOME
6609     if test -z "$with_jdk_home"; then
6610         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6611     else
6612         _java_path="$with_jdk_home/bin/$with_java"
6613         dnl Check if there is a Java interpreter at all.
6614         if test -x "$_java_path"; then
6615             JAVAINTERPRETER=$_java_path
6616         else
6617             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6618         fi
6619     fi
6621     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6622     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6623     dnl loaded by java to run JunitTests:
6624     if test "$build_os" = "cygwin"; then
6625         shortjdkhome=`cygpath -d "$with_jdk_home"`
6626         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
6627             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6628             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6629         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
6630             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6631             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6632         fi
6634         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6635             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6636         fi
6637         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6638     elif test "$cross_compiling" != "yes"; then
6639         case $CPUNAME in
6640             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6641                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6642                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6643                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6644                 fi
6645                 ;;
6646             *) # assumption: everything else 32-bit
6647                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6648                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6649                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6650                 fi
6651                 ;;
6652         esac
6653     fi
6656 HAVE_JAVA9=
6657 dnl ===================================================================
6658 dnl Checks for JDK.
6659 dnl ===================================================================
6661 # Note that JAVA_HOME as for now always means the *build* platform's
6662 # JAVA_HOME. Whether all the complexity here actually is needed any
6663 # more or not, no idea.
6665 if test "$ENABLE_JAVA" != ""; then
6666     _gij_longver=0
6667     AC_MSG_CHECKING([the installed JDK])
6668     if test -n "$JAVAINTERPRETER"; then
6669         dnl java -version sends output to stderr!
6670         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6671             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6672         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6673             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6674         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6675             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6676         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6677             JDK=ibm
6679             dnl IBM JDK specific tests
6680             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6681             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6683             if test "$_jdk_ver" -lt 10600; then
6684                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6685             fi
6687             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6689             if test "$with_jdk_home" = ""; then
6690                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6691 you must use the "--with-jdk-home" configure option explicitly])
6692             fi
6694             JAVA_HOME=$with_jdk_home
6695         else
6696             JDK=sun
6698             dnl Sun JDK specific tests
6699             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6700             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6702             if test "$_jdk_ver" -lt 10600; then
6703                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6704             fi
6705             if test "$_jdk_ver" -gt 10600; then
6706                 JAVA_CLASSPATH_NOT_SET=TRUE
6707             fi
6708             if test "$_jdk_ver" -ge 10900; then
6709                 HAVE_JAVA9=TRUE
6710             fi
6712             AC_MSG_RESULT([checked (JDK $_jdk)])
6713             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6714             if test "$_os" = "WINNT"; then
6715                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6716             fi
6718             # set to limit VM usage for JunitTests
6719             JAVAIFLAGS=-Xmx64M
6720             # set to limit VM usage for javac
6721             JAVAFLAGS=-J-Xmx128M
6722         fi
6723     else
6724         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6725     fi
6726 else
6727     dnl Java disabled
6728     JAVA_HOME=
6729     export JAVA_HOME
6732 dnl ===================================================================
6733 dnl Set target Java bytecode version
6734 dnl ===================================================================
6735 if test "$ENABLE_JAVA" != ""; then
6736     if test "$HAVE_JAVA9" = "TRUE"; then
6737         _java_target_ver="1.6"
6738     else
6739         _java_target_ver="1.5"
6740     fi
6741     JAVA_SOURCE_VER="$_java_target_ver"
6742     JAVA_TARGET_VER="$_java_target_ver"
6745 dnl ===================================================================
6746 dnl Checks for javac
6747 dnl ===================================================================
6748 if test "$ENABLE_JAVA" != ""; then
6749     javacompiler="javac"
6750     if test -z "$with_jdk_home"; then
6751         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6752     else
6753         _javac_path="$with_jdk_home/bin/$javacompiler"
6754         dnl Check if there is a Java compiler at all.
6755         if test -x "$_javac_path"; then
6756             JAVACOMPILER=$_javac_path
6757         fi
6758     fi
6759     if test -z "$JAVACOMPILER"; then
6760         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6761     fi
6762     if test "$build_os" = "cygwin"; then
6763         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6764             JAVACOMPILER="${JAVACOMPILER}.exe"
6765         fi
6766         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6767     fi
6770 dnl ===================================================================
6771 dnl Checks for javadoc
6772 dnl ===================================================================
6773 if test "$ENABLE_JAVA" != ""; then
6774     if test -z "$with_jdk_home"; then
6775         AC_PATH_PROG(JAVADOC, javadoc)
6776     else
6777         _javadoc_path="$with_jdk_home/bin/javadoc"
6778         dnl Check if there is a javadoc at all.
6779         if test -x "$_javadoc_path"; then
6780             JAVADOC=$_javadoc_path
6781         else
6782             AC_PATH_PROG(JAVADOC, javadoc)
6783         fi
6784     fi
6785     if test -z "$JAVADOC"; then
6786         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6787     fi
6788     if test "$build_os" = "cygwin"; then
6789         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6790             JAVADOC="${JAVADOC}.exe"
6791         fi
6792         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6793     fi
6795     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6796     JAVADOCISGJDOC="yes"
6797     fi
6799 AC_SUBST(JAVADOCISGJDOC)
6801 if test "$ENABLE_JAVA" != ""; then
6802     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6803     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6804         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6805            # try to recover first by looking whether we have a alternatives
6806            # system as in Debian or newer SuSEs where following /usr/bin/javac
6807            # over /etc/alternatives/javac leads to the right bindir where we
6808            # just need to strip a bit away to get a valid JAVA_HOME
6809            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6810         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6811             # maybe only one level of symlink (e.g. on Mac)
6812             JAVA_HOME=$(readlink $JAVACOMPILER)
6813             if test "$(dirname $JAVA_HOME)" = "."; then
6814                 # we've got no path to trim back
6815                 JAVA_HOME=""
6816             fi
6817         else
6818             # else warn
6819             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6820             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6821             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6822             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6823         fi
6824         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6825         if test "$JAVA_HOME" != "/usr"; then
6826             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6827                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6828                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6829                 dnl Tiger already returns a JDK path..
6830                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6831             else
6832                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6833                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6834                 dnl that checks which version to run
6835                 if test -f "$JAVA_HOME"; then
6836                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6837                 fi
6838             fi
6839         fi
6840     fi
6841     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6843     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6844     if test -z "$JAVA_HOME"; then
6845         if test "x$with_jdk_home" = "x"; then
6846             cat > findhome.java <<_ACEOF
6847 [import java.io.File;
6849 class findhome
6851     public static void main(String args[])
6852     {
6853         String jrelocation = System.getProperty("java.home");
6854         File jre = new File(jrelocation);
6855         System.out.println(jre.getParent());
6856     }
6858 _ACEOF
6859             AC_MSG_CHECKING([if javac works])
6860             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6861             AC_TRY_EVAL(javac_cmd)
6862             if test $? = 0 -a -f ./findhome.class; then
6863                 AC_MSG_RESULT([javac works])
6864             else
6865                 echo "configure: javac test failed" >&5
6866                 cat findhome.java >&5
6867                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6868             fi
6869             AC_MSG_CHECKING([if gij knows its java.home])
6870             JAVA_HOME=`$JAVAINTERPRETER findhome`
6871             if test $? = 0 -a "$JAVA_HOME" != ""; then
6872                 AC_MSG_RESULT([$JAVA_HOME])
6873             else
6874                 echo "configure: java test failed" >&5
6875                 cat findhome.java >&5
6876                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6877             fi
6878             # clean-up after ourselves
6879             rm -f ./findhome.java ./findhome.class
6880         else
6881             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6882         fi
6883     fi
6885     # now check if $JAVA_HOME is really valid
6886     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6887         case "${JAVA_HOME}" in
6888             /Library/Java/JavaVirtualMachines/*)
6889                 ;;
6890             *)
6891                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
6892                 ;;
6893         esac
6894         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6895             JAVA_HOME_OK="NO"
6896         fi
6897     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6898         JAVA_HOME_OK="NO"
6899     fi
6900     if test "$JAVA_HOME_OK" = "NO"; then
6901         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6902         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6903         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6904         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6905         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6906         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6907     fi
6908     PathFormat "$JAVA_HOME"
6909     JAVA_HOME="$formatted_path"
6912 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
6913     "$_os" != Darwin
6914 then
6915     AC_MSG_CHECKING([for JAWT lib])
6916     if test "$_os" = WINNT; then
6917         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
6918         JAWTLIB=jawt.lib
6919     else
6920         case "$host_cpu" in
6921         arm*)
6922             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
6923             JAVA_ARCH=$my_java_arch
6924             ;;
6925         i*86)
6926             my_java_arch=i386
6927             ;;
6928         m68k)
6929             my_java_arch=m68k
6930             ;;
6931         powerpc)
6932             my_java_arch=ppc
6933             ;;
6934         powerpc64)
6935             my_java_arch=ppc64
6936             ;;
6937         powerpc64le)
6938             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
6939             JAVA_ARCH=$my_java_arch
6940             ;;
6941         sparc64)
6942             my_java_arch=sparcv9
6943             ;;
6944         x86_64)
6945             my_java_arch=amd64
6946             ;;
6947         *)
6948             my_java_arch=$host_cpu
6949             ;;
6950         esac
6951         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
6952         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
6953     fi
6954     AC_MSG_RESULT([$JAWTLIB])
6956 AC_SUBST(JAWTLIB)
6958 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
6959     case "$host_os" in
6961     aix*)
6962         JAVAINC="-I$JAVA_HOME/include"
6963         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6964         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6965         ;;
6967     cygwin*)
6968         JAVAINC="-I$JAVA_HOME/include/win32"
6969         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6970         ;;
6972     darwin*)
6973         if test -d "$JAVA_HOME/include/darwin"; then
6974             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
6975         else
6976             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
6977         fi
6978         ;;
6980     dragonfly*)
6981         JAVAINC="-I$JAVA_HOME/include"
6982         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6983         ;;
6985     freebsd*)
6986         JAVAINC="-I$JAVA_HOME/include"
6987         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6988         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6989         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6990         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6991         ;;
6993     k*bsd*-gnu*)
6994         JAVAINC="-I$JAVA_HOME/include"
6995         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6996         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6997         ;;
6999     linux-gnu*)
7000         JAVAINC="-I$JAVA_HOME/include"
7001         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7002         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7003         ;;
7005     *netbsd*)
7006         JAVAINC="-I$JAVA_HOME/include"
7007         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7008         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7009        ;;
7011     openbsd*)
7012         JAVAINC="-I$JAVA_HOME/include"
7013         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7014         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7015         ;;
7017     solaris*)
7018         JAVAINC="-I$JAVA_HOME/include"
7019         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7020         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7021         ;;
7022     esac
7024 SOLARINC="$SOLARINC $JAVAINC"
7026 AC_SUBST(JAVACOMPILER)
7027 AC_SUBST(JAVADOC)
7028 AC_SUBST(JAVAINTERPRETER)
7029 AC_SUBST(JAVAIFLAGS)
7030 AC_SUBST(JAVAFLAGS)
7031 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7032 AC_SUBST(JAVA_HOME)
7033 AC_SUBST(JAVA_SOURCE_VER)
7034 AC_SUBST(JAVA_TARGET_VER)
7035 AC_SUBST(JDK)
7038 dnl ===================================================================
7039 dnl Export file validation
7040 dnl ===================================================================
7041 AC_MSG_CHECKING([whether to enable export file validation])
7042 if test "$with_export_validation" = yes; then
7043     if test -z "$ENABLE_JAVA"; then
7044         AC_MSG_RESULT([no, as Java is disabled])
7045     else
7046         AC_MSG_RESULT([yes])
7047         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7049         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7050         if test -z "$ODFVALIDATOR"; then
7051             # remember to download the ODF toolkit with validator later
7052             AC_MSG_NOTICE([no odfvalidator found, will download it])
7053             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7054             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7056             # and fetch name of odfvalidator jar name from download.lst
7057             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7058             AC_SUBST(ODFVALIDATOR_JAR)
7060             if test -z "$ODFVALIDATOR_JAR"; then
7061                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7062             fi
7063         fi
7064         if test "$build_os" = "cygwin"; then
7065             # In case of Cygwin it will be executed from Windows,
7066             # so we need to run bash and absolute path to validator
7067             # so instead of "odfvalidator" it will be
7068             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7069             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7070         else
7071             ODFVALIDATOR="sh $ODFVALIDATOR"
7072         fi
7073         AC_SUBST(ODFVALIDATOR)
7076         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7077         if test -z "$OFFICEOTRON"; then
7078             # remember to download the officeotron with validator later
7079             AC_MSG_NOTICE([no officeotron found, will download it])
7080             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7081             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7083             # and fetch name of officeotron jar name from download.lst
7084             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7085             AC_SUBST(OFFICEOTRON_JAR)
7087             if test -z "$OFFICEOTRON_JAR"; then
7088                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7089             fi
7090         else
7091             # check version of existing officeotron
7092             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7093             if test 0"$OFFICEOTRON_VER" -lt 704; then
7094                 AC_MSG_ERROR([officeotron too old])
7095             fi
7096         fi
7097         if test "$build_os" = "cygwin"; then
7098             # In case of Cygwin it will be executed from Windows,
7099             # so we need to run bash and absolute path to validator
7100             # so instead of "odfvalidator" it will be
7101             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7102             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7103         else
7104             OFFICEOTRON="sh $OFFICEOTRON"
7105         fi
7106     fi
7107     AC_SUBST(OFFICEOTRON)
7108 else
7109     AC_MSG_RESULT([no])
7112 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7113 if test "$with_bffvalidator" != "no"; then
7114     AC_DEFINE(HAVE_BFFVALIDATOR)
7116     if test "$with_export_validation" != "yes"; then
7117         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7118     fi
7120     if test "$with_bffvalidator" = "yes"; then
7121         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7122     else
7123         BFFVALIDATOR="$with_bffvalidator"
7124     fi
7126     if test "$build_os" = "cygwin"; then
7127         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7128             AC_MSG_RESULT($BFFVALIDATOR)
7129         else
7130             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7131         fi
7132     elif test -n "$BFFVALIDATOR"; then
7133         # We are not in Cygwin but need to run Windows binary with wine
7134         AC_PATH_PROGS(WINE, wine)
7136         # so swap in a shell wrapper that converts paths transparently
7137         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7138         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7139         AC_SUBST(BFFVALIDATOR_EXE)
7140         AC_MSG_RESULT($BFFVALIDATOR)
7141     else
7142         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7143     fi
7144     AC_SUBST(BFFVALIDATOR)
7145 else
7146     AC_MSG_RESULT([no])
7149 dnl ===================================================================
7150 dnl Check for C preprocessor to use
7151 dnl ===================================================================
7152 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7153 if test -n "$with_idlc_cpp"; then
7154     AC_MSG_RESULT([$with_idlc_cpp])
7155     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7156 else
7157     AC_MSG_RESULT([ucpp])
7158     AC_MSG_CHECKING([which ucpp tp use])
7159     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7160         AC_MSG_RESULT([external])
7161         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7162     else
7163         AC_MSG_RESULT([internal])
7164         BUILD_TYPE="$BUILD_TYPE UCPP"
7165     fi
7167 AC_SUBST(SYSTEM_UCPP)
7169 dnl ===================================================================
7170 dnl Check for epm (not needed for Windows)
7171 dnl ===================================================================
7172 AC_MSG_CHECKING([whether to enable EPM for packing])
7173 if test "$enable_epm" = "yes"; then
7174     AC_MSG_RESULT([yes])
7175     if test "$_os" != "WINNT"; then
7176         if test $_os = Darwin; then
7177             EPM=internal
7178         elif test -n "$with_epm"; then
7179             EPM=$with_epm
7180         else
7181             AC_PATH_PROG(EPM, epm, no)
7182         fi
7183         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7184             AC_MSG_NOTICE([EPM will be built.])
7185             BUILD_TYPE="$BUILD_TYPE EPM"
7186             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7187         else
7188             # Gentoo has some epm which is something different...
7189             AC_MSG_CHECKING([whether the found epm is the right epm])
7190             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7191                 AC_MSG_RESULT([yes])
7192             else
7193                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7194             fi
7195             AC_MSG_CHECKING([epm version])
7196             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7197             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7198                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7199                 AC_MSG_RESULT([OK, >= 3.7])
7200             else
7201                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7202                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7203             fi
7204         fi
7205     fi
7207     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7208         AC_MSG_CHECKING([for rpm])
7209         for a in "$RPM" rpmbuild rpm; do
7210             $a --usage >/dev/null 2> /dev/null
7211             if test $? -eq 0; then
7212                 RPM=$a
7213                 break
7214             else
7215                 $a --version >/dev/null 2> /dev/null
7216                 if test $? -eq 0; then
7217                     RPM=$a
7218                     break
7219                 fi
7220             fi
7221         done
7222         if test -z "$RPM"; then
7223             AC_MSG_ERROR([not found])
7224         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7225             RPM_PATH=`which $RPM`
7226             AC_MSG_RESULT([$RPM_PATH])
7227             SCPDEFS="$SCPDEFS -DWITH_RPM"
7228         else
7229             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7230         fi
7231     fi
7232     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7233         AC_PATH_PROG(DPKG, dpkg, no)
7234         if test "$DPKG" = "no"; then
7235             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7236         fi
7237     fi
7238     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7239        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7240         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7241             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7242                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7243                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7244                     AC_MSG_RESULT([yes])
7245                 else
7246                     AC_MSG_RESULT([no])
7247                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7248                         _pt="rpm"
7249                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7250                         add_warning "the rpms will need to be installed with --nodeps"
7251                     else
7252                         _pt="pkg"
7253                     fi
7254                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7255                     add_warning "the ${_pt}s will not be relocateable"
7256                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7257                                  relocation will work, you need to patch your epm with the
7258                                  patch in epm/epm-3.7.patch or build with
7259                                  --with-epm=internal which will build a suitable epm])
7260                 fi
7261             fi
7262         fi
7263     fi
7264     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7265         AC_PATH_PROG(PKGMK, pkgmk, no)
7266         if test "$PKGMK" = "no"; then
7267             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7268         fi
7269     fi
7270     AC_SUBST(RPM)
7271     AC_SUBST(DPKG)
7272     AC_SUBST(PKGMK)
7273 else
7274     for i in $PKGFORMAT; do
7275         case "$i" in
7276         aix | bsd | deb | pkg | rpm | native | portable)
7277             AC_MSG_ERROR(
7278                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7279             ;;
7280         esac
7281     done
7282     AC_MSG_RESULT([no])
7283     EPM=NO
7285 AC_SUBST(EPM)
7287 if test $_os = iOS; then
7288     enable_mpl_subset=yes
7289     enable_lotuswordpro=no
7290     enable_coinmp=yes
7291     enable_lpsolve=no
7292     enable_postgresql_sdbc=no
7293     enable_extension_integration=no
7294     enable_report_builder=no
7295     with_theme="tango"
7296     with_ppds=no
7299 ENABLE_LWP=
7300 if test "$enable_lotuswordpro" = "yes"; then
7301     ENABLE_LWP="TRUE"
7303 AC_SUBST(ENABLE_LWP)
7305 dnl ===================================================================
7306 dnl Check for gperf
7307 dnl ===================================================================
7308 AC_PATH_PROG(GPERF, gperf)
7309 if test -z "$GPERF"; then
7310     AC_MSG_ERROR([gperf not found but needed. Install it.])
7312 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7313     GPERF=`cygpath -m $GPERF`
7315 AC_MSG_CHECKING([gperf version])
7316 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7317     AC_MSG_RESULT([OK])
7318 else
7319     AC_MSG_ERROR([too old, you need at least 3.0.0])
7321 AC_SUBST(GPERF)
7323 dnl ===================================================================
7324 dnl Check for building ODK
7325 dnl ===================================================================
7326 if test "$enable_odk" = no; then
7327     unset DOXYGEN
7328 else
7329     if test "$with_doxygen" = no; then
7330         AC_MSG_CHECKING([for doxygen])
7331         unset DOXYGEN
7332         AC_MSG_RESULT([no])
7333     else
7334         if test "$with_doxygen" = yes; then
7335             AC_PATH_PROG([DOXYGEN], [doxygen])
7336             if test -z "$DOXYGEN"; then
7337                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7338             fi
7339         else
7340             AC_MSG_CHECKING([for doxygen])
7341             DOXYGEN=$with_doxygen
7342             AC_MSG_RESULT([$DOXYGEN])
7343         fi
7344         if test -n "$DOXYGEN"; then
7345             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7346             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7347             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7348                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7349             fi
7350         fi
7351     fi
7353 AC_SUBST([DOXYGEN])
7355 AC_MSG_CHECKING([whether to build the ODK])
7356 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7357     AC_MSG_RESULT([yes])
7359     if test "$with_java" != "no"; then
7360         AC_MSG_CHECKING([whether to build unowinreg.dll])
7361         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7362             # build on Win by default
7363             enable_build_unowinreg=yes
7364         fi
7365         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7366             AC_MSG_RESULT([no])
7367             BUILD_UNOWINREG=
7368         else
7369             AC_MSG_RESULT([yes])
7370             BUILD_UNOWINREG=TRUE
7371         fi
7372         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7373             if test -z "$with_mingw_cross_compiler"; then
7374                 dnl Guess...
7375                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7376             elif test -x "$with_mingw_cross_compiler"; then
7377                  MINGWCXX="$with_mingw_cross_compiler"
7378             else
7379                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7380             fi
7382             if test "$MINGWCXX" = "false"; then
7383                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7384             fi
7386             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7387             if test -x "$mingwstrip_test"; then
7388                 MINGWSTRIP="$mingwstrip_test"
7389             else
7390                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7391             fi
7393             if test "$MINGWSTRIP" = "false"; then
7394                 AC_MSG_ERROR(MinGW32 binutils not found.)
7395             fi
7396         fi
7397     fi
7398     BUILD_TYPE="$BUILD_TYPE ODK"
7399 else
7400     AC_MSG_RESULT([no])
7401     BUILD_UNOWINREG=
7403 AC_SUBST(BUILD_UNOWINREG)
7404 AC_SUBST(MINGWCXX)
7405 AC_SUBST(MINGWSTRIP)
7407 dnl ===================================================================
7408 dnl Check for system zlib
7409 dnl ===================================================================
7410 if test "$with_system_zlib" = "auto"; then
7411     case "$_os" in
7412     WINNT)
7413         with_system_zlib="$with_system_libs"
7414         ;;
7415     *)
7416         if test "$enable_fuzzers" != "yes"; then
7417             with_system_zlib=yes
7418         else
7419             with_system_zlib=no
7420         fi
7421         ;;
7422     esac
7425 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7426 dnl and has no pkg-config for it at least on some tinderboxes,
7427 dnl so leaving that out for now
7428 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7429 AC_MSG_CHECKING([which zlib to use])
7430 if test "$with_system_zlib" = "yes"; then
7431     AC_MSG_RESULT([external])
7432     SYSTEM_ZLIB=TRUE
7433     AC_CHECK_HEADER(zlib.h, [],
7434         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7435     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7436         [AC_MSG_ERROR(zlib not found or functional)], [])
7437 else
7438     AC_MSG_RESULT([internal])
7439     SYSTEM_ZLIB=
7440     BUILD_TYPE="$BUILD_TYPE ZLIB"
7441     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7442     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7444 AC_SUBST(ZLIB_CFLAGS)
7445 AC_SUBST(ZLIB_LIBS)
7446 AC_SUBST(SYSTEM_ZLIB)
7448 dnl ===================================================================
7449 dnl Check for system jpeg
7450 dnl ===================================================================
7451 AC_MSG_CHECKING([which libjpeg to use])
7452 if test "$with_system_jpeg" = "yes"; then
7453     AC_MSG_RESULT([external])
7454     SYSTEM_JPEG=TRUE
7455     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7456         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7457     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7458         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7459 else
7460     SYSTEM_JPEG=
7461     AC_MSG_RESULT([internal, jpeg-turbo])
7462     BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7463     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg-turbo"
7464     if test "$COM" = "MSC"; then
7465         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs/libjpeg.lib"
7466     else
7467         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs -ljpeg"
7468     fi
7470     case "$host_cpu" in
7471     x86_64 | amd64 | i*86 | x86 | ia32)
7472         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7473         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7474             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7475                 NASM="$LODE_HOME/opt/bin/nasm"
7476             elif test -x "/opt/lo/bin/nasm"; then
7477                 NASM="/opt/lo/bin/nasm"
7478             fi
7479         fi
7481         if test -n "$NASM"; then
7482             AC_MSG_CHECKING([for object file format of host system])
7483             case "$host_os" in
7484               cygwin* | mingw* | pw32* | interix*)
7485                 case "$host_cpu" in
7486                   x86_64)
7487                     objfmt='Win64-COFF'
7488                     ;;
7489                   *)
7490                     objfmt='Win32-COFF'
7491                     ;;
7492                 esac
7493               ;;
7494               msdosdjgpp* | go32*)
7495                 objfmt='COFF'
7496               ;;
7497               os2-emx*)                 # not tested
7498                 objfmt='MSOMF'          # obj
7499               ;;
7500               linux*coff* | linux*oldld*)
7501                 objfmt='COFF'           # ???
7502               ;;
7503               linux*aout*)
7504                 objfmt='a.out'
7505               ;;
7506               linux*)
7507                 case "$host_cpu" in
7508                   x86_64)
7509                     objfmt='ELF64'
7510                     ;;
7511                   *)
7512                     objfmt='ELF'
7513                     ;;
7514                 esac
7515               ;;
7516               kfreebsd* | freebsd* | netbsd* | openbsd*)
7517                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7518                   objfmt='BSD-a.out'
7519                 else
7520                   case "$host_cpu" in
7521                     x86_64 | amd64)
7522                       objfmt='ELF64'
7523                       ;;
7524                     *)
7525                       objfmt='ELF'
7526                       ;;
7527                   esac
7528                 fi
7529               ;;
7530               solaris* | sunos* | sysv* | sco*)
7531                 case "$host_cpu" in
7532                   x86_64)
7533                     objfmt='ELF64'
7534                     ;;
7535                   *)
7536                     objfmt='ELF'
7537                     ;;
7538                 esac
7539               ;;
7540               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7541                 case "$host_cpu" in
7542                   x86_64)
7543                     objfmt='Mach-O64'
7544                     ;;
7545                   *)
7546                     objfmt='Mach-O'
7547                     ;;
7548                 esac
7549               ;;
7550               *)
7551                 objfmt='ELF ?'
7552               ;;
7553             esac
7555             AC_MSG_RESULT([$objfmt])
7556             if test "$objfmt" = 'ELF ?'; then
7557               objfmt='ELF'
7558               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7559             fi
7561             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7562             case "$objfmt" in
7563               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7564               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7565               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7566               COFF)       NAFLAGS='-fcoff -DCOFF';;
7567               a.out)      NAFLAGS='-faout -DAOUT';;
7568               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7569               ELF)        NAFLAGS='-felf -DELF';;
7570               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7571               RDF)        NAFLAGS='-frdf -DRDF';;
7572               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7573               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7574             esac
7575             AC_MSG_RESULT([$NAFLAGS])
7577             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7578             cat > conftest.asm << EOF
7579             [%line __oline__ "configure"
7580                     section .text
7581                     global  _main,main
7582             _main:
7583             main:   xor     eax,eax
7584                     ret
7585             ]
7587             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7588             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7589               AC_MSG_RESULT(yes)
7590             else
7591               echo "configure: failed program was:" >&AC_FD_CC
7592               cat conftest.asm >&AC_FD_CC
7593               rm -rf conftest*
7594               AC_MSG_RESULT(no)
7595               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7596               NASM=""
7597             fi
7599         fi
7601         if test -z "$NASM"; then
7602 cat << _EOS
7603 ****************************************************************************
7604 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7605 To get one please:
7607 _EOS
7608             if test "$build_os" = "cygwin"; then
7609 cat << _EOS
7610 install a pre-compiled binary for Win32
7612 mkdir -p /opt/lo/bin
7613 cd /opt/lo/bin
7614 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7615 chmod +x nasm
7617 or get and install one from http://www.nasm.us/
7619 Then re-run autogen.sh
7621 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7622 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7624 _EOS
7625             else
7626 cat << _EOS
7627 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7629 _EOS
7630             fi
7631             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7632             add_warning "no suitable nasm (Netwide Assembler) found for internal jpeg-turbo"
7633         fi
7634       ;;
7635     esac
7638 AC_SUBST(NASM)
7639 AC_SUBST(LIBJPEG_CFLAGS)
7640 AC_SUBST(LIBJPEG_LIBS)
7641 AC_SUBST(SYSTEM_JPEG)
7643 dnl ===================================================================
7644 dnl Check for system clucene
7645 dnl ===================================================================
7646 dnl we should rather be using
7647 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7648 dnl but the contribs-lib check seems tricky
7649 AC_MSG_CHECKING([which clucene to use])
7650 if test "$with_system_clucene" = "yes"; then
7651     AC_MSG_RESULT([external])
7652     SYSTEM_CLUCENE=TRUE
7653     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7654     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7655     FilterLibs "${CLUCENE_LIBS}"
7656     CLUCENE_LIBS="${filteredlibs}"
7657     AC_LANG_PUSH([C++])
7658     save_CXXFLAGS=$CXXFLAGS
7659     save_CPPFLAGS=$CPPFLAGS
7660     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7661     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7662     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7663     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7664     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7665                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7666     CXXFLAGS=$save_CXXFLAGS
7667     CPPFLAGS=$save_CPPFLAGS
7668     AC_LANG_POP([C++])
7670     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7671 else
7672     AC_MSG_RESULT([internal])
7673     SYSTEM_CLUCENE=
7674     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7676 AC_SUBST(SYSTEM_CLUCENE)
7677 AC_SUBST(CLUCENE_CFLAGS)
7678 AC_SUBST(CLUCENE_LIBS)
7680 dnl ===================================================================
7681 dnl Check for system expat
7682 dnl ===================================================================
7683 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7685 dnl ===================================================================
7686 dnl Check for system xmlsec
7687 dnl ===================================================================
7688 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7690 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7691 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7692     ENABLE_EOT="TRUE"
7693     AC_DEFINE([ENABLE_EOT])
7694     AC_MSG_RESULT([yes])
7696     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7697 else
7698     ENABLE_EOT=
7699     AC_MSG_RESULT([no])
7701 AC_SUBST([ENABLE_EOT])
7703 dnl ===================================================================
7704 dnl Check for DLP libs
7705 dnl ===================================================================
7706 AS_IF([test "$COM" = "MSC"],
7707       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7708       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7710 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7712 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7714 AS_IF([test "$COM" = "MSC"],
7715       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7716       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7718 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7720 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7722 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7723 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.6])
7725 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7727 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7729 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7731 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7732 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.11])
7734 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7735 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
7737 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7739 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7740 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7742 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7744 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7746 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7748 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7749 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.3])
7751 dnl ===================================================================
7752 dnl Check for system libcmis
7753 dnl ===================================================================
7754 # libcmis requires curl and we can't build curl for iOS
7755 if test $_os != iOS; then
7756     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7757     ENABLE_CMIS=TRUE
7758 else
7759     ENABLE_CMIS=
7761 AC_SUBST(ENABLE_CMIS)
7763 dnl ===================================================================
7764 dnl Check for system lcms2
7765 dnl ===================================================================
7766 if test "$with_system_lcms2" != "yes"; then
7767     SYSTEM_LCMS2=
7769 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7770 if test "$GCC" = "yes"; then
7771     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7773 if test "$COM" = "MSC"; then # override the above
7774     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7777 dnl ===================================================================
7778 dnl Check for system cppunit
7779 dnl ===================================================================
7780 if test "$cross_compiling" != "yes"; then
7781     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7784 dnl ===================================================================
7785 dnl Check whether freetype is available
7786 dnl ===================================================================
7787 if test  "$test_freetype" = "yes"; then
7788     AC_MSG_CHECKING([whether freetype is available])
7789     # FreeType has 3 different kinds of versions
7790     # * release, like 2.4.10
7791     # * libtool, like 13.0.7 (this what pkg-config returns)
7792     # * soname
7793     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7794     #
7795     # 9.9.3 is 2.2.0
7796     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7797     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7798     FilterLibs "${FREETYPE_LIBS}"
7799     FREETYPE_LIBS="${filteredlibs}"
7800     SYSTEM_FREETYPE=TRUE
7801 else
7802     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7803     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7805 AC_SUBST(FREETYPE_CFLAGS)
7806 AC_SUBST(FREETYPE_LIBS)
7807 AC_SUBST([SYSTEM_FREETYPE])
7809 # ===================================================================
7810 # Check for system libxslt
7811 # to prevent incompatibilities between internal libxml2 and external libxslt,
7812 # or vice versa, use with_system_libxml here
7813 # ===================================================================
7814 if test "$with_system_libxml" = "auto"; then
7815     case "$_os" in
7816     WINNT|iOS|Android)
7817         with_system_libxml="$with_system_libs"
7818         ;;
7819     *)
7820         if test "$enable_fuzzers" != "yes"; then
7821             with_system_libxml=yes
7822         else
7823             with_system_libxml=no
7824         fi
7825         ;;
7826     esac
7829 AC_MSG_CHECKING([which libxslt to use])
7830 if test "$with_system_libxml" = "yes"; then
7831     AC_MSG_RESULT([external])
7832     SYSTEM_LIBXSLT=TRUE
7833     if test "$_os" = "Darwin"; then
7834         dnl make sure to use SDK path
7835         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7836         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7837         dnl omit -L/usr/lib
7838         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7839         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7840     else
7841         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7842         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7843         FilterLibs "${LIBXSLT_LIBS}"
7844         LIBXSLT_LIBS="${filteredlibs}"
7845         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7846         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7847         FilterLibs "${LIBEXSLT_LIBS}"
7848         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7849     fi
7851     dnl Check for xsltproc
7852     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7853     if test "$XSLTPROC" = "no"; then
7854         AC_MSG_ERROR([xsltproc is required])
7855     fi
7856 else
7857     AC_MSG_RESULT([internal])
7858     SYSTEM_LIBXSLT=
7859     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7861     if test "$cross_compiling" = "yes"; then
7862         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7863         if test "$XSLTPROC" = "no"; then
7864             AC_MSG_ERROR([xsltproc is required])
7865         fi
7866     fi
7868 AC_SUBST(SYSTEM_LIBXSLT)
7869 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7870     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7872 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7874 AC_SUBST(LIBEXSLT_CFLAGS)
7875 AC_SUBST(LIBEXSLT_LIBS)
7876 AC_SUBST(LIBXSLT_CFLAGS)
7877 AC_SUBST(LIBXSLT_LIBS)
7878 AC_SUBST(XSLTPROC)
7880 # ===================================================================
7881 # Check for system libxml
7882 # ===================================================================
7883 AC_MSG_CHECKING([which libxml to use])
7884 if test "$with_system_libxml" = "yes"; then
7885     AC_MSG_RESULT([external])
7886     SYSTEM_LIBXML=TRUE
7887     if test "$_os" = "Darwin"; then
7888         dnl make sure to use SDK path
7889         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7890         dnl omit -L/usr/lib
7891         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7892     elif test $_os = iOS; then
7893         dnl make sure to use SDK path
7894         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7895         LIBXML_CFLAGS="-I$usr/include/libxml2"
7896         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7897     else
7898         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7899         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7900         FilterLibs "${LIBXML_LIBS}"
7901         LIBXML_LIBS="${filteredlibs}"
7902     fi
7904     dnl Check for xmllint
7905     AC_PATH_PROG(XMLLINT, xmllint, no)
7906     if test "$XMLLINT" = "no"; then
7907         AC_MSG_ERROR([xmllint is required])
7908     fi
7909 else
7910     AC_MSG_RESULT([internal])
7911     SYSTEM_LIBXML=
7912     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
7913     if test "$COM" = "MSC"; then
7914         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7915     fi
7916     if test "$COM" = "MSC"; then
7917         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
7918     else
7919         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
7920     fi
7921     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7923 AC_SUBST(SYSTEM_LIBXML)
7924 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7925     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7927 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7928 AC_SUBST(LIBXML_CFLAGS)
7929 AC_SUBST(LIBXML_LIBS)
7930 AC_SUBST(XMLLINT)
7932 # =====================================================================
7933 # Checking for a Python interpreter with version >= 2.6.
7934 # Build and runtime requires Python 3 compatible version (>= 2.6).
7935 # Optionally user can pass an option to configure, i. e.
7936 # ./configure PYTHON=/usr/bin/python
7937 # =====================================================================
7938 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7939     # This allows a lack of system python with no error, we use internal one in that case.
7940     AM_PATH_PYTHON([2.6],, [:])
7941     # Clean PYTHON_VERSION checked below if cross-compiling
7942     PYTHON_VERSION=""
7943     if test "$PYTHON" != ":"; then
7944         PYTHON_FOR_BUILD=$PYTHON
7945     fi
7947 AC_SUBST(PYTHON_FOR_BUILD)
7949 # Checks for Python to use for Pyuno
7950 AC_MSG_CHECKING([which Python to use for Pyuno])
7951 case "$enable_python" in
7952 no|disable)
7953     if test -z $PYTHON_FOR_BUILD; then
7954         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7955         # requirement from the choice whether to include Python stuff in the installer, but why
7956         # bother?
7957         AC_MSG_ERROR([Python is required at build time.])
7958     fi
7959     enable_python=no
7960     AC_MSG_RESULT([none])
7961     ;;
7962 ""|yes|auto)
7963     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7964         AC_MSG_RESULT([no, overridden by --disable-scripting])
7965         enable_python=no
7966     elif test $build_os = cygwin; then
7967         dnl When building on Windows we don't attempt to use any installed
7968         dnl "system"  Python.
7969         AC_MSG_RESULT([fully internal])
7970         enable_python=internal
7971     elif test "$cross_compiling" = yes; then
7972         AC_MSG_RESULT([system])
7973         enable_python=system
7974     else
7975         # Unset variables set by the above AM_PATH_PYTHON so that
7976         # we actually do check anew.
7977         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
7978         AM_PATH_PYTHON([3.3],, [:])
7979         if test "$PYTHON" = ":"; then
7980             if test -z "$PYTHON_FOR_BUILD"; then
7981                 AC_MSG_RESULT([fully internal])
7982             else
7983                 AC_MSG_RESULT([internal])
7984             fi
7985             enable_python=internal
7986         else
7987             AC_MSG_RESULT([system])
7988             enable_python=system
7989         fi
7990     fi
7991     ;;
7992 internal)
7993     AC_MSG_RESULT([internal])
7994     ;;
7995 fully-internal)
7996     AC_MSG_RESULT([fully internal])
7997     enable_python=internal
7998     ;;
7999 system)
8000     AC_MSG_RESULT([system])
8001     ;;
8003     AC_MSG_ERROR([Incorrect --enable-python option])
8004     ;;
8005 esac
8007 if test $enable_python != no; then
8008     BUILD_TYPE="$BUILD_TYPE PYUNO"
8011 if test $enable_python = system; then
8012     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8013         python_version=2.7
8014         PYTHON=python$python_version
8015         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8016             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8017             PYTHON_LIBS="-framework Python"
8018         else
8019             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8020             PYTHON_LIBS="`$PYTHON-config --libs`"
8021         fi
8022     fi
8023     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8024         # Fallback: Accept these in the environment, or as set above
8025         # for MacOSX.
8026         :
8027     elif test "$cross_compiling" != yes; then
8028         # Unset variables set by the above AM_PATH_PYTHON so that
8029         # we actually do check anew.
8030         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
8031         # This causes an error if no python command is found
8032         AM_PATH_PYTHON([3.3])
8033         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8034         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8035         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8036         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8037         if test -z "$PKG_CONFIG"; then
8038             PYTHON_CFLAGS="-I$python_include"
8039             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8040         elif $PKG_CONFIG --exists python-$python_version; then
8041             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8042             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8043         else
8044             PYTHON_CFLAGS="-I$python_include"
8045             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8046         fi
8047         FilterLibs "${PYTHON_LIBS}"
8048         PYTHON_LIBS="${filteredlibs}"
8049     else
8050         dnl How to find out the cross-compilation Python installation path?
8051         AC_MSG_CHECKING([for python version])
8052         AS_IF([test -n "$PYTHON_VERSION"],
8053               [AC_MSG_RESULT([$PYTHON_VERSION])],
8054               [AC_MSG_RESULT([not found])
8055                AC_MSG_ERROR([no usable python found])])
8056         test -n "$PYTHON_CFLAGS" && break
8057     fi
8058     # let the PYTHON_FOR_BUILD match the same python installation that
8059     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8060     # better for PythonTests.
8061     PYTHON_FOR_BUILD=$PYTHON
8064 dnl By now enable_python should be "system", "internal" or "no"
8065 case $enable_python in
8066 system)
8067     SYSTEM_PYTHON=TRUE
8069     dnl Check if the headers really work
8070     save_CPPFLAGS="$CPPFLAGS"
8071     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8072     AC_CHECK_HEADER(Python.h, [],
8073        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8074        [])
8075     CPPFLAGS="$save_CPPFLAGS"
8077     AC_LANG_PUSH(C)
8078     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8079     AC_MSG_CHECKING([for correct python library version])
8080        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8081 #include <Python.h>
8083 int main(int argc, char **argv) {
8084    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8085        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8086    else return 1;
8088        ]])],[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])])
8089     CFLAGS=$save_CFLAGS
8090     AC_LANG_POP(C)
8092     dnl FIXME Check if the Python library can be linked with, too?
8093     ;;
8095 internal)
8096     SYSTEM_PYTHON=
8097     PYTHON_VERSION_MAJOR=3
8098     PYTHON_VERSION_MINOR=5
8099     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
8100     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8101     BUILD_TYPE="$BUILD_TYPE PYTHON"
8102     # Embedded Python dies without Home set
8103     if test "$HOME" = ""; then
8104         export HOME=""
8105     fi
8106     # bz2 tarball and bzip2 is not standard
8107     if test -z "$BZIP2"; then
8108         AC_PATH_PROG( BZIP2, bzip2)
8109         if test -z "$BZIP2"; then
8110             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8111         fi
8112     fi
8113     ;;
8115     DISABLE_PYTHON=TRUE
8116     SYSTEM_PYTHON=
8117     ;;
8119     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8120     ;;
8121 esac
8123 AC_SUBST(DISABLE_PYTHON)
8124 AC_SUBST(SYSTEM_PYTHON)
8125 AC_SUBST(PYTHON_CFLAGS)
8126 AC_SUBST(PYTHON_LIBS)
8127 AC_SUBST(PYTHON_VERSION)
8128 AC_SUBST(PYTHON_VERSION_MAJOR)
8129 AC_SUBST(PYTHON_VERSION_MINOR)
8131 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8132 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8133     AC_MSG_RESULT([yes])
8134     ENABLE_MARIADBC=TRUE
8135     MARIADBC_MAJOR=1
8136     MARIADBC_MINOR=0
8137     MARIADBC_MICRO=2
8138     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8139 else
8140     AC_MSG_RESULT([no])
8141     ENABLE_MARIADBC=
8143 AC_SUBST(ENABLE_MARIADBC)
8144 AC_SUBST(MARIADBC_MAJOR)
8145 AC_SUBST(MARIADBC_MINOR)
8146 AC_SUBST(MARIADBC_MICRO)
8148 if test "$ENABLE_MARIADBC" = "TRUE"; then
8150     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8152     dnl ===================================================================
8153     dnl Check for system MariaDB
8154     dnl ===================================================================
8155     AC_MSG_CHECKING([which MariaDB to use])
8156     if test "$with_system_mariadb" = "yes"; then
8157         AC_MSG_RESULT([external])
8158         SYSTEM_MARIADB=TRUE
8159         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8160         if test -z "$MARIADBCONFIG"; then
8161             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8162             if test -z "$MARIADBCONFIG"; then
8163                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8164                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8165             fi
8166         fi
8167         AC_MSG_CHECKING([MariaDB version])
8168         MARIADB_VERSION=`$MARIADBCONFIG --version`
8169         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8170         if test "$MARIADB_MAJOR" -ge "5"; then
8171             AC_MSG_RESULT([OK])
8172         else
8173             AC_MSG_ERROR([too old, use 5.0.x or later])
8174         fi
8175         AC_MSG_CHECKING([for MariaDB Client library])
8176         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8177         if test "$COM_IS_CLANG" = TRUE; then
8178             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8179         fi
8180         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8181         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8182         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8183         dnl linux32:
8184         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8185             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8186             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8187                 | sed -e 's|/lib64/|/lib/|')
8188         fi
8189         FilterLibs "${MARIADB_LIBS}"
8190         MARIADB_LIBS="${filteredlibs}"
8191         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8192         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8193         if test "$enable_bundle_mariadb" = "yes"; then
8194             AC_MSG_RESULT([yes])
8195             BUNDLE_MARIADB=TRUE
8196             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8198 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8200 /g' | grep -E '(mysqlclient|mariadb)')
8201             if test "$_os" = "Darwin"; then
8202                 LIBMARIADB=${LIBMARIADB}.dylib
8203             elif test "$_os" = "WINNT"; then
8204                 LIBMARIADB=${LIBMARIADB}.dll
8205             else
8206                 LIBMARIADB=${LIBMARIADB}.so
8207             fi
8208             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8209             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8210             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8211                 AC_MSG_RESULT([found.])
8212                 PathFormat "$LIBMARIADB_PATH"
8213                 LIBMARIADB_PATH="$formatted_path"
8214             else
8215                 AC_MSG_ERROR([not found.])
8216             fi
8217         else
8218             AC_MSG_RESULT([no])
8219             BUNDLE_MARIADB=
8220         fi
8221     else
8222         AC_MSG_RESULT([internal])
8223         SYSTEM_MARIADB=
8224         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8225         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8226         BUILD_TYPE="$BUILD_TYPE MARIADB"
8227     fi
8229     AC_SUBST(SYSTEM_MARIADB)
8230     AC_SUBST(MARIADB_CFLAGS)
8231     AC_SUBST(MARIADB_LIBS)
8232     AC_SUBST(LIBMARIADB)
8233     AC_SUBST(LIBMARIADB_PATH)
8234     AC_SUBST(BUNDLE_MARIADB)
8236     AC_LANG_PUSH([C++])
8237     dnl ===================================================================
8238     dnl Check for system MySQL C++ Connector
8239     dnl ===================================================================
8240     # FIXME!
8241     # who thought this too-generic cppconn dir was a good idea?
8242     AC_MSG_CHECKING([MySQL Connector/C++])
8243     if test "$with_system_mysql_cppconn" = "yes"; then
8244         AC_MSG_RESULT([external])
8245         SYSTEM_MYSQL_CPPCONN=TRUE
8246         AC_LANG_PUSH([C++])
8247         AC_CHECK_HEADER(mysql_driver.h, [],
8248                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8249         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8250                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8251         save_LIBS=$LIBS
8252         LIBS="$LIBS -lmysqlcppconn"
8253         AC_MSG_CHECKING([version])
8254         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8255 #include <mysql_driver.h>
8257 int main(int argc, char **argv) {
8258     sql::Driver *driver;
8259     driver = get_driver_instance();
8260     if (driver->getMajorVersion() > 1 || \
8261        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8262        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8263         return 0;
8264       else
8265         return 1;
8267       ]])],[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])])
8269         AC_LANG_POP([C++])
8270         LIBS=$save_LIBS
8271     else
8272         AC_MSG_RESULT([internal])
8273         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8274         SYSTEM_MYSQL_CPPCONN=
8275     fi
8276     AC_LANG_POP([C++])
8278 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8280 dnl ===================================================================
8281 dnl Check for system hsqldb
8282 dnl ===================================================================
8283 if test "$with_java" != "no"; then
8284     HSQLDB_USE_JDBC_4_1=
8285     AC_MSG_CHECKING([which hsqldb to use])
8286     if test "$with_system_hsqldb" = "yes"; then
8287         AC_MSG_RESULT([external])
8288         SYSTEM_HSQLDB=TRUE
8289         if test -z $HSQLDB_JAR; then
8290             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8291         fi
8292         if ! test -f $HSQLDB_JAR; then
8293                AC_MSG_ERROR(hsqldb.jar not found.)
8294         fi
8295         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8296         export HSQLDB_JAR
8297         if $PERL -e \
8298            'use Archive::Zip;
8299             my $file = "$ENV{'HSQLDB_JAR'}";
8300             my $zip = Archive::Zip->new( $file );
8301             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8302             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8303             {
8304                 push @l, split(/\n/, $mf);
8305                 foreach my $line (@l)
8306                 {
8307                     if ($line =~ m/Specification-Version:/)
8308                     {
8309                         ($t, $version) = split (/:/,$line);
8310                         $version =~ s/^\s//;
8311                         ($a, $b, $c, $d) = split (/\./,$version);
8312                         if ($c == "0" && $d > "8")
8313                         {
8314                             exit 0;
8315                         }
8316                         else
8317                         {
8318                             exit 1;
8319                         }
8320                     }
8321                 }
8322             }
8323             else
8324             {
8325                 exit 1;
8326             }'; then
8327             AC_MSG_RESULT([yes])
8328         else
8329             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8330         fi
8331     else
8332         AC_MSG_RESULT([internal])
8333         SYSTEM_HSQLDB=
8334         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8335         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8336         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8337         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8338             AC_MSG_RESULT([yes])
8339             HSQLDB_USE_JDBC_4_1=TRUE
8340         else
8341             AC_MSG_RESULT([no])
8342         fi
8343     fi
8344     AC_SUBST(SYSTEM_HSQLDB)
8345     AC_SUBST(HSQLDB_JAR)
8346     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8349 dnl ===================================================================
8350 dnl Check for PostgreSQL stuff
8351 dnl ===================================================================
8352 if test "x$enable_postgresql_sdbc" != "xno"; then
8353     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8355     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8356         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8357     fi
8358     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8359         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8360     fi
8362     postgres_interface=""
8363     if test "$with_system_postgresql" = "yes"; then
8364         postgres_interface="external PostgreSQL"
8365         SYSTEM_POSTGRESQL=TRUE
8366         if test "$_os" = Darwin; then
8367             supp_path=''
8368             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8369                 pg_supp_path="$P_SEP$d$pg_supp_path"
8370             done
8371         fi
8372         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8373         if test -z "$PGCONFIG"; then
8374             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8375         fi
8376         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8377         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8378         FilterLibs "${POSTGRESQL_LIB}"
8379         POSTGRESQL_LIB="${filteredlibs}"
8380     else
8381         # if/when anything else than PostgreSQL uses Kerberos,
8382         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8383         WITH_KRB5=
8384         WITH_GSSAPI=
8385         case "$_os" in
8386         Darwin)
8387             # MacOS X has system MIT Kerberos 5 since 10.4
8388             if test "$with_krb5" != "no"; then
8389                 WITH_KRB5=TRUE
8390                 save_LIBS=$LIBS
8391                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8392                 # that the libraries where these functions are located on macOS will change, is it?
8393                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8394                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8395                 KRB5_LIBS=$LIBS
8396                 LIBS=$save_LIBS
8397                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8398                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8399                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8400                 LIBS=$save_LIBS
8401             fi
8402             if test "$with_gssapi" != "no"; then
8403                 WITH_GSSAPI=TRUE
8404                 save_LIBS=$LIBS
8405                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8406                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8407                 GSSAPI_LIBS=$LIBS
8408                 LIBS=$save_LIBS
8409             fi
8410             ;;
8411         WINNT)
8412             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8413                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8414             fi
8415             ;;
8416         Linux|GNU|*BSD|DragonFly)
8417             if test "$with_krb5" != "no"; then
8418                 WITH_KRB5=TRUE
8419                 save_LIBS=$LIBS
8420                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8421                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8422                 KRB5_LIBS=$LIBS
8423                 LIBS=$save_LIBS
8424                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8425                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8426                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8427                 LIBS=$save_LIBS
8428             fi
8429             if test "$with_gssapi" != "no"; then
8430                 WITH_GSSAPI=TRUE
8431                 save_LIBS=$LIBS
8432                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8433                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8434                 GSSAPI_LIBS=$LIBS
8435                 LIBS=$save_LIBS
8436             fi
8437             ;;
8438         *)
8439             if test "$with_krb5" = "yes"; then
8440                 WITH_KRB5=TRUE
8441                 save_LIBS=$LIBS
8442                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8443                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8444                 KRB5_LIBS=$LIBS
8445                 LIBS=$save_LIBS
8446                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8447                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8448                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8449                 LIBS=$save_LIBS
8450             fi
8451             if test "$with_gssapi" = "yes"; then
8452                 WITH_GSSAPI=TRUE
8453                 save_LIBS=$LIBS
8454                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8455                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8456                 LIBS=$save_LIBS
8457                 GSSAPI_LIBS=$LIBS
8458             fi
8459         esac
8461         if test -n "$with_libpq_path"; then
8462             SYSTEM_POSTGRESQL=TRUE
8463             postgres_interface="external libpq"
8464             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8465             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8466         else
8467             SYSTEM_POSTGRESQL=
8468             postgres_interface="internal"
8469             POSTGRESQL_LIB=""
8470             POSTGRESQL_INC="%OVERRIDE_ME%"
8471             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8472         fi
8473     fi
8475     AC_MSG_CHECKING([PostgreSQL C interface])
8476     AC_MSG_RESULT([$postgres_interface])
8478     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8479         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8480         save_CFLAGS=$CFLAGS
8481         save_CPPFLAGS=$CPPFLAGS
8482         save_LIBS=$LIBS
8483         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8484         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8485         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8486         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8487             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8488         CFLAGS=$save_CFLAGS
8489         CPPFLAGS=$save_CPPFLAGS
8490         LIBS=$save_LIBS
8491     fi
8492     BUILD_POSTGRESQL_SDBC=TRUE
8494 AC_SUBST(WITH_KRB5)
8495 AC_SUBST(WITH_GSSAPI)
8496 AC_SUBST(GSSAPI_LIBS)
8497 AC_SUBST(KRB5_LIBS)
8498 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8499 AC_SUBST(SYSTEM_POSTGRESQL)
8500 AC_SUBST(POSTGRESQL_INC)
8501 AC_SUBST(POSTGRESQL_LIB)
8503 dnl ===================================================================
8504 dnl Check for Firebird stuff
8505 dnl ===================================================================
8506 ENABLE_FIREBIRD_SDBC=""
8507 if test "$enable_firebird_sdbc" = "yes" ; then
8508     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8510     dnl ===================================================================
8511     dnl Check for system Firebird
8512     dnl ===================================================================
8513     AC_MSG_CHECKING([which Firebird to use])
8514     if test "$with_system_firebird" = "yes"; then
8515         AC_MSG_RESULT([external])
8516         SYSTEM_FIREBIRD=TRUE
8517         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8518         if test -z "$FIREBIRDCONFIG"; then
8519             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8520             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8521                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8522             ])
8523             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8524         else
8525             AC_MSG_NOTICE([fb_config found])
8526             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8527             AC_MSG_CHECKING([for Firebird Client library])
8528             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8529             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8530             FilterLibs "${FIREBIRD_LIBS}"
8531             FIREBIRD_LIBS="${filteredlibs}"
8532         fi
8533         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8534         AC_MSG_CHECKING([Firebird version])
8535         if test -n "${FIREBIRD_VERSION}"; then
8536             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8537             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8538             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8539                 AC_MSG_RESULT([OK])
8540             else
8541                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8542             fi
8543         else
8544             __save_CFLAGS="${CFLAGS}"
8545             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8546             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8547 #if defined(FB_API_VER) && FB_API_VER == 30
8548 int fb_api_is_30(void) { return 0; }
8549 #else
8550 #error "Wrong Firebird API version"
8551 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8552             CFLAGS="${__save_CFLAGS}"
8553         fi
8554         ENABLE_FIREBIRD_SDBC="TRUE"
8555     elif test "$enable_database_connectivity" != yes; then
8556         AC_MSG_RESULT([none])
8557     elif test "$cross_compiling" = "yes"; then
8558         AC_MSG_RESULT([none])
8559     else
8560         dnl Embedded Firebird has version 3.0
8561         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8562         dnl We need libatomic-ops for any non X86/X64 system
8563         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8564             dnl ===================================================================
8565             dnl Check for system libatomic-ops
8566             dnl ===================================================================
8567             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8568             if test "$with_system_libatomic_ops" = "yes"; then
8569                 SYSTEM_LIBATOMIC_OPS=TRUE
8570                 AC_CHECK_HEADERS(atomic_ops.h, [],
8571                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8572             else
8573                 SYSTEM_LIBATOMIC_OPS=
8574                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8575                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8576                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8577             fi
8578         fi
8580         AC_MSG_RESULT([internal])
8581         SYSTEM_FIREBIRD=
8582         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8583         FIREBIRD_LIBS="-lfbclient"
8585         if test "$with_system_libtommath" = "yes"; then
8586             SYSTEM_LIBTOMMATH=TRUE
8587             dnl check for tommath presence
8588             save_LIBS=$LIBS
8589             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8590             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8591             LIBS=$save_LIBS
8592         else
8593             SYSTEM_LIBTOMMATH=
8594             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8595             LIBTOMMATH_LIBS="-ltommath"
8596             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8597         fi
8599         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8600         ENABLE_FIREBIRD_SDBC="TRUE"
8601     fi
8603 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8604 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8605 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8606 AC_SUBST(LIBATOMIC_OPS_LIBS)
8607 AC_SUBST(SYSTEM_FIREBIRD)
8608 AC_SUBST(FIREBIRD_CFLAGS)
8609 AC_SUBST(FIREBIRD_LIBS)
8610 AC_SUBST([TOMMATH_CFLAGS])
8611 AC_SUBST([TOMMATH_LIBS])
8613 dnl ===================================================================
8614 dnl Check for system curl
8615 dnl ===================================================================
8616 AC_MSG_CHECKING([which libcurl to use])
8617 if test "$with_system_curl" = "auto"; then
8618     with_system_curl="$with_system_libs"
8621 if test "$with_system_curl" = "yes"; then
8622     AC_MSG_RESULT([external])
8623     SYSTEM_CURL=TRUE
8625     # First try PKGCONFIG and then fall back
8626     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8628     if test -n "$CURL_PKG_ERRORS"; then
8629         AC_PATH_PROG(CURLCONFIG, curl-config)
8630         if test -z "$CURLCONFIG"; then
8631             AC_MSG_ERROR([curl development files not found])
8632         fi
8633         CURL_LIBS=`$CURLCONFIG --libs`
8634         FilterLibs "${CURL_LIBS}"
8635         CURL_LIBS="${filteredlibs}"
8636         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8637         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8639         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8640         case $curl_version in
8641         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8642         dnl so they need to be doubled to end up in the configure script
8643         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8644             AC_MSG_RESULT([yes])
8645             ;;
8646         *)
8647             AC_MSG_ERROR([no, you have $curl_version])
8648             ;;
8649         esac
8650     fi
8652     ENABLE_CURL=TRUE
8653 elif test $_os = iOS; then
8654     # Let's see if we need curl, I think not?
8655     AC_MSG_RESULT([none])
8656     ENABLE_CURL=
8657 else
8658     AC_MSG_RESULT([internal])
8659     SYSTEM_CURL=
8660     BUILD_TYPE="$BUILD_TYPE CURL"
8661     ENABLE_CURL=TRUE
8663 AC_SUBST(SYSTEM_CURL)
8664 AC_SUBST(CURL_CFLAGS)
8665 AC_SUBST(CURL_LIBS)
8666 AC_SUBST(ENABLE_CURL)
8668 dnl ===================================================================
8669 dnl Check for system boost
8670 dnl ===================================================================
8671 AC_MSG_CHECKING([which boost to use])
8672 if test "$with_system_boost" = "yes"; then
8673     AC_MSG_RESULT([external])
8674     SYSTEM_BOOST=TRUE
8675     AX_BOOST_BASE(1.47)
8676     AX_BOOST_DATE_TIME
8677     AX_BOOST_FILESYSTEM
8678     AX_BOOST_IOSTREAMS
8679     AX_BOOST_LOCALE
8680     AC_LANG_PUSH([C++])
8681     save_CXXFLAGS=$CXXFLAGS
8682     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8683     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8684        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8685     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8686        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8687     CXXFLAGS=$save_CXXFLAGS
8688     AC_LANG_POP([C++])
8689     # this is in m4/ax_boost_base.m4
8690     FilterLibs "${BOOST_LDFLAGS}"
8691     BOOST_LDFLAGS="${filteredlibs}"
8692 else
8693     AC_MSG_RESULT([internal])
8694     BUILD_TYPE="$BUILD_TYPE BOOST"
8695     SYSTEM_BOOST=
8696     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8697         # use warning-suppressing wrapper headers
8698         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8699     else
8700         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8701     fi
8703 AC_SUBST(SYSTEM_BOOST)
8705 dnl ===================================================================
8706 dnl Check for system mdds
8707 dnl ===================================================================
8708 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8710 dnl ===================================================================
8711 dnl Check for system glm
8712 dnl ===================================================================
8713 AC_MSG_CHECKING([which glm to use])
8714 if test "$with_system_glm" = "yes"; then
8715     AC_MSG_RESULT([external])
8716     SYSTEM_GLM=TRUE
8717     AC_LANG_PUSH([C++])
8718     AC_CHECK_HEADER([glm/glm.hpp], [],
8719        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8720     AC_LANG_POP([C++])
8721 else
8722     AC_MSG_RESULT([internal])
8723     BUILD_TYPE="$BUILD_TYPE GLM"
8724     SYSTEM_GLM=
8725     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8727 AC_SUBST([GLM_CFLAGS])
8728 AC_SUBST([SYSTEM_GLM])
8730 dnl ===================================================================
8731 dnl Check for system odbc
8732 dnl ===================================================================
8733 AC_MSG_CHECKING([which odbc headers to use])
8734 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
8735     AC_MSG_RESULT([external])
8736     SYSTEM_ODBC_HEADERS=TRUE
8738     if test "$build_os" = "cygwin"; then
8739         save_CPPFLAGS=$CPPFLAGS
8740         find_winsdk
8741         PathFormat "$winsdktest"
8742         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"
8743         AC_CHECK_HEADER(sqlext.h, [],
8744             [AC_MSG_ERROR(odbc not found. install odbc)],
8745             [#include <windows.h>])
8746         CPPFLAGS=$save_CPPFLAGS
8747     else
8748         AC_CHECK_HEADER(sqlext.h, [],
8749             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8750     fi
8751 elif test "$enable_database_connectivity" != yes; then
8752     AC_MSG_RESULT([none])
8753 else
8754     AC_MSG_RESULT([internal])
8755     SYSTEM_ODBC_HEADERS=
8757 AC_SUBST(SYSTEM_ODBC_HEADERS)
8760 dnl ===================================================================
8761 dnl Check for system openldap
8762 dnl ===================================================================
8764 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8765 AC_MSG_CHECKING([which openldap library to use])
8766 if test "$with_system_openldap" = "yes"; then
8767     AC_MSG_RESULT([external])
8768     SYSTEM_OPENLDAP=TRUE
8769     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8770     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8771     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8772 else
8773     AC_MSG_RESULT([internal])
8774     SYSTEM_OPENLDAP=
8775     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8778 AC_SUBST(SYSTEM_OPENLDAP)
8780 dnl ===================================================================
8781 dnl Check for system NSS
8782 dnl ===================================================================
8783 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
8784     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8785     AC_DEFINE(HAVE_FEATURE_NSS)
8786     ENABLE_NSS="TRUE"
8787     AC_DEFINE(ENABLE_NSS)
8788 elif test $_os != iOS ; then
8789     with_tls=openssl
8791 AC_SUBST(ENABLE_NSS)
8793 dnl ===================================================================
8794 dnl Check for TLS/SSL and cryptographic implementation to use
8795 dnl ===================================================================
8796 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8797 if test -n "$with_tls"; then
8798     case $with_tls in
8799     openssl)
8800         AC_DEFINE(USE_TLS_OPENSSL)
8801         TLS=OPENSSL
8803         if test "$enable_openssl" != "yes"; then
8804             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8805         fi
8807         # warn that OpenSSL has been selected but not all TLS code has this option
8808         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8809         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8810         ;;
8811     nss)
8812         AC_DEFINE(USE_TLS_NSS)
8813         TLS=NSS
8814         ;;
8815     no)
8816         AC_MSG_WARN([Skipping TLS/SSL])
8817         ;;
8818     *)
8819         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8820 openssl - OpenSSL
8821 nss - Mozilla's Network Security Services (NSS)
8822     ])
8823         ;;
8824     esac
8825 else
8826     # default to using NSS, it results in smaller oox lib
8827     AC_DEFINE(USE_TLS_NSS)
8828     TLS=NSS
8830 AC_MSG_RESULT([$TLS])
8831 AC_SUBST(TLS)
8833 dnl ===================================================================
8834 dnl Check for system sane
8835 dnl ===================================================================
8836 AC_MSG_CHECKING([which sane header to use])
8837 if test "$with_system_sane" = "yes"; then
8838     AC_MSG_RESULT([external])
8839     AC_CHECK_HEADER(sane/sane.h, [],
8840       [AC_MSG_ERROR(sane not found. install sane)], [])
8841 else
8842     AC_MSG_RESULT([internal])
8843     BUILD_TYPE="$BUILD_TYPE SANE"
8846 dnl ===================================================================
8847 dnl Check for system icu
8848 dnl ===================================================================
8849 SYSTEM_GENBRK=
8850 SYSTEM_GENCCODE=
8851 SYSTEM_GENCMN=
8853 ICU_MAJOR=59
8854 ICU_MINOR=1
8855 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8856 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8857 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8858 AC_MSG_CHECKING([which icu to use])
8859 if test "$with_system_icu" = "yes"; then
8860     AC_MSG_RESULT([external])
8861     SYSTEM_ICU=TRUE
8862     AC_LANG_PUSH([C++])
8863     AC_MSG_CHECKING([for unicode/rbbi.h])
8864     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8865     AC_LANG_POP([C++])
8867     if test "$cross_compiling" != "yes"; then
8868         AC_PATH_PROG(ICUCONFIG,icu-config)
8870         AC_MSG_CHECKING([ICU version])
8871         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8872         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8873         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8875         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "6" \); then
8876             AC_MSG_RESULT([OK, $ICU_VERSION])
8877         else
8878             AC_MSG_ERROR([not suitable, only >= 4.6 supported currently])
8879         fi
8880     fi
8882     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8883         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8884         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8885         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8886         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8887         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8888         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8889             AC_MSG_RESULT([yes])
8890         else
8891             AC_MSG_RESULT([no])
8892             if test "$with_system_icu_for_build" != "force"; then
8893                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8894 You can use --with-system-icu-for-build=force to use it anyway.])
8895             fi
8896         fi
8897     fi
8899     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8900         # using the system icu tools can lead to version confusion, use the
8901         # ones from the build environment when cross-compiling
8902         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8903         if test -z "$SYSTEM_GENBRK"; then
8904             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8905         fi
8906         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8907         if test -z "$SYSTEM_GENCCODE"; then
8908             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8909         fi
8910         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8911         if test -z "$SYSTEM_GENCMN"; then
8912             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8913         fi
8914         if test "$ICU_MAJOR" -ge "49"; then
8915             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8916             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8917             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8918         else
8919             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
8920             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
8921             ICU_RECLASSIFIED_HEBREW_LETTER=
8922         fi
8923     fi
8925     if test "$cross_compiling" = "yes"; then
8926         if test "$ICU_MAJOR" -ge "50"; then
8927             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8928             ICU_MINOR=""
8929         fi
8930     fi
8931 else
8932     AC_MSG_RESULT([internal])
8933     SYSTEM_ICU=
8934     BUILD_TYPE="$BUILD_TYPE ICU"
8935     # surprisingly set these only for "internal" (to be used by various other
8936     # external libs): the system icu-config is quite unhelpful and spits out
8937     # dozens of weird flags and also default path -I/usr/include
8938     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8939     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
8941 if test "$ICU_MAJOR" -ge "59"; then
8942     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
8943     # with -std=c++11 but not all external libraries can be built with that,
8944     # for those use a bit-compatible typedef uint16_t UChar; see
8945     # icu/source/common/unicode/umachine.h
8946     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
8947 else
8948     ICU_UCHAR_TYPE=""
8950 AC_SUBST(SYSTEM_ICU)
8951 AC_SUBST(SYSTEM_GENBRK)
8952 AC_SUBST(SYSTEM_GENCCODE)
8953 AC_SUBST(SYSTEM_GENCMN)
8954 AC_SUBST(ICU_MAJOR)
8955 AC_SUBST(ICU_MINOR)
8956 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8957 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8958 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8959 AC_SUBST(ICU_CFLAGS)
8960 AC_SUBST(ICU_LIBS)
8961 AC_SUBST(ICU_UCHAR_TYPE)
8963 dnl ==================================================================
8964 dnl Breakpad
8965 dnl ==================================================================
8966 AC_MSG_CHECKING([whether to enable breakpad])
8967 if test "$enable_breakpad" != yes; then
8968     AC_MSG_RESULT([no])
8969 else
8970     AC_MSG_RESULT([yes])
8971     ENABLE_BREAKPAD="TRUE"
8972     AC_DEFINE(ENABLE_BREAKPAD)
8973     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
8974     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
8976     AC_MSG_CHECKING([for crashreport config])
8977     if test "$with_symbol_config" = "no"; then
8978         BREAKPAD_SYMBOL_CONFIG="invalid"
8979         AC_MSG_RESULT([no])
8980     else
8981         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
8982         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
8983         AC_MSG_RESULT([yes])
8984     fi
8985     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
8987 AC_SUBST(ENABLE_BREAKPAD)
8989 dnl ==================================================================
8990 dnl libfuzzer
8991 dnl ==================================================================
8992 AC_MSG_CHECKING([whether to enable fuzzers])
8993 if test "$enable_fuzzers" != yes; then
8994     AC_MSG_RESULT([no])
8995 else
8996     AC_MSG_RESULT([yes])
8997     ENABLE_FUZZERS="TRUE"
8998     AC_DEFINE(ENABLE_FUZZERS)
8999     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9001 AC_SUBST(ENABLE_FUZZERS)
9003 dnl ===================================================================
9004 dnl Orcus
9005 dnl ===================================================================
9006 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.12 >= 0.12.0])
9007 if test "$with_system_orcus" != "yes"; then
9008     if test "$SYSTEM_BOOST" = "TRUE"; then
9009         # ===========================================================
9010         # Determine if we are going to need to link with Boost.System
9011         # ===========================================================
9012         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9013         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9014         dnl in documentation has no effect.
9015         AC_MSG_CHECKING([if we need to link with Boost.System])
9016         AC_LANG_PUSH([C++])
9017         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9018                 @%:@include <boost/version.hpp>
9019             ]],[[
9020                 #if BOOST_VERSION >= 105000
9021                 #   error yes, we need to link with Boost.System
9022                 #endif
9023             ]])],[
9024                 AC_MSG_RESULT([no])
9025             ],[
9026                 AC_MSG_RESULT([yes])
9027                 AX_BOOST_SYSTEM
9028         ])
9029         AC_LANG_POP([C++])
9030     fi
9032 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9033 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9034 AC_SUBST([BOOST_SYSTEM_LIB])
9035 AC_SUBST(SYSTEM_LIBORCUS)
9037 dnl ===================================================================
9038 dnl HarfBuzz
9039 dnl ===================================================================
9040 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9041                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9042                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9044 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9045                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9046                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9048 if test "$COM" = "MSC"; then # override the above
9049     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9050     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9053 if test "$with_system_harfbuzz" = "yes"; then
9054     if test "$with_system_graphite" = "no"; then
9055         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9056     fi
9057     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9058     _save_libs="$LIBS"
9059     _save_cflags="$CFLAGS"
9060     LIBS="$LIBS $HARFBUZZ_LIBS"
9061     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9062     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9063     LIBS="$_save_libs"
9064     CFLAGS="$_save_cflags"
9065 else
9066     if test "$with_system_graphite" = "yes"; then
9067         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9068     fi
9071 AC_MSG_CHECKING([whether to use X11])
9072 dnl ***************************************
9073 dnl testing for X libraries and includes...
9074 dnl ***************************************
9075 if test "$USING_X11" = TRUE; then
9076     AC_DEFINE(HAVE_FEATURE_X11)
9078 AC_MSG_RESULT([$USING_X11])
9080 if test "$USING_X11" = TRUE; then
9081     AC_PATH_X
9082     AC_PATH_XTRA
9083     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9085     if test -z "$x_includes"; then
9086         x_includes="default_x_includes"
9087     fi
9088     if test -z "$x_libraries"; then
9089         x_libraries="default_x_libraries"
9090     fi
9091     CFLAGS="$CFLAGS $X_CFLAGS"
9092     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9093     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9094 else
9095     x_includes="no_x_includes"
9096     x_libraries="no_x_libraries"
9099 if test "$USING_X11" = TRUE; then
9100     dnl ===================================================================
9101     dnl Check for Composite.h for Mozilla plugin
9102     dnl ===================================================================
9103     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9104      [#include <X11/Intrinsic.h>])
9106     dnl ===================================================================
9107     dnl Check for extension headers
9108     dnl ===================================================================
9109     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9110      [#include <X11/extensions/shape.h>])
9112     # vcl needs ICE and SM
9113     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9114     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9115         [AC_MSG_ERROR(ICE library not found)])
9116     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9117     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9118         [AC_MSG_ERROR(SM library not found)])
9121 dnl ===================================================================
9122 dnl Check for system Xrender
9123 dnl ===================================================================
9124 AC_MSG_CHECKING([whether to use Xrender])
9125 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9126     AC_MSG_RESULT([yes])
9127     PKG_CHECK_MODULES(XRENDER, xrender)
9128     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9129     FilterLibs "${XRENDER_LIBS}"
9130     XRENDER_LIBS="${filteredlibs}"
9131     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9132       [AC_MSG_ERROR(libXrender not found or functional)], [])
9133     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9134       [AC_MSG_ERROR(Xrender not found. install X)], [])
9135 else
9136     AC_MSG_RESULT([no])
9138 AC_SUBST(XRENDER_CFLAGS)
9139 AC_SUBST(XRENDER_LIBS)
9141 dnl ===================================================================
9142 dnl Check for XRandr
9143 dnl ===================================================================
9144 AC_MSG_CHECKING([whether to enable RandR support])
9145 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9146     AC_MSG_RESULT([yes])
9147     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9148     if test "$ENABLE_RANDR" != "TRUE"; then
9149         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9150                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9151         XRANDR_CFLAGS=" "
9152         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9153           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9154         XRANDR_LIBS="-lXrandr "
9155         ENABLE_RANDR="TRUE"
9156     fi
9157     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9158     FilterLibs "${XRANDR_LIBS}"
9159     XRANDR_LIBS="${filteredlibs}"
9160 else
9161     ENABLE_RANDR=""
9162     AC_MSG_RESULT([no])
9164 AC_SUBST(XRANDR_CFLAGS)
9165 AC_SUBST(XRANDR_LIBS)
9166 AC_SUBST(ENABLE_RANDR)
9168 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9169     WITH_WEBDAV="serf"
9171 if test $_os = iOS -o $_os = Android; then
9172     WITH_WEBDAV="no"
9174 AC_MSG_CHECKING([for webdav library])
9175 case "$WITH_WEBDAV" in
9176 serf)
9177     AC_MSG_RESULT([serf])
9178     # Check for system apr-util
9179     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9180                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9181                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9182     if test "$COM" = "MSC"; then
9183         APR_LIB_DIR="LibR"
9184         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9185         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9186     fi
9188     # Check for system serf
9189     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9190                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9191     if test "$COM" = "MSC"; then
9192         SERF_LIB_DIR="Release"
9193         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9194         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9195     fi
9196     ;;
9197 neon)
9198     AC_MSG_RESULT([neon])
9199     # Check for system neon
9200     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9201     if test "$with_system_neon" = "yes"; then
9202         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9203     else
9204         NEON_VERSION=0295
9205     fi
9206     AC_SUBST(NEON_VERSION)
9207     ;;
9209     AC_MSG_RESULT([none, disabled])
9210     WITH_WEBDAV=""
9211     ;;
9212 esac
9213 AC_SUBST(WITH_WEBDAV)
9215 dnl ===================================================================
9216 dnl Check for disabling cve_tests
9217 dnl ===================================================================
9218 AC_MSG_CHECKING([whether to execute CVE tests])
9219 # If not explicitly enabled or disabled, default
9220 if test -z "$enable_cve_tests"; then
9221     case "$OS" in
9222     WNT)
9223         # Default cves off for windows with its wild and wonderful
9224         # varienty of AV software kicking in and panicing
9225         enable_cve_tests=no
9226         ;;
9227     *)
9228         # otherwise yes
9229         enable_cve_tests=yes
9230         ;;
9231     esac
9233 if test "$enable_cve_tests" = "no"; then
9234     AC_MSG_RESULT([no])
9235     DISABLE_CVE_TESTS=TRUE
9236     AC_SUBST(DISABLE_CVE_TESTS)
9237 else
9238     AC_MSG_RESULT([yes])
9241 dnl ===================================================================
9242 dnl Check for enabling chart XShape tests
9243 dnl ===================================================================
9244 AC_MSG_CHECKING([whether to execute chart XShape tests])
9245 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9246     AC_MSG_RESULT([yes])
9247     ENABLE_CHART_TESTS=TRUE
9248     AC_SUBST(ENABLE_CHART_TESTS)
9249 else
9250     AC_MSG_RESULT([no])
9253 dnl ===================================================================
9254 dnl Check for system openssl
9255 dnl ===================================================================
9256 DISABLE_OPENSSL=
9257 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9258 if test "$enable_openssl" = "yes"; then
9259     AC_MSG_RESULT([no])
9260     if test "$_os" = Darwin ; then
9261         # OpenSSL is deprecated when building for 10.7 or later.
9262         #
9263         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9264         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9266         with_system_openssl=no
9267         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9268     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9269             && test "$with_system_openssl" != "no"; then
9270         with_system_openssl=yes
9271         SYSTEM_OPENSSL=TRUE
9272         OPENSSL_CFLAGS=
9273         OPENSSL_LIBS="-lssl -lcrypto"
9274     else
9275         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9276     fi
9277     if test "$with_system_openssl" = "yes"; then
9278         AC_MSG_CHECKING([whether openssl supports SHA512])
9279         AC_LANG_PUSH([C])
9280         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9281             SHA512_CTX context;
9282 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9283         AC_LANG_POP(C)
9284     fi
9285 else
9286     AC_MSG_RESULT([yes])
9287     DISABLE_OPENSSL=TRUE
9289     # warn that although OpenSSL is disabled, system libraries may depend on it
9290     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9291     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9294 AC_SUBST([DISABLE_OPENSSL])
9296 dnl ===================================================================
9297 dnl Check for building gnutls
9298 dnl ===================================================================
9299 AC_MSG_CHECKING([whether to use gnutls])
9300 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9301     AC_MSG_RESULT([yes])
9302     AM_PATH_LIBGCRYPT()
9303     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9304         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9305                       available in the system to use as replacement.]]))
9306     FilterLibs "${LIBGCRYPT_LIBS}"
9307     LIBGCRYPT_LIBS="${filteredlibs}"
9308 else
9309     AC_MSG_RESULT([no])
9312 AC_SUBST([LIBGCRYPT_CFLAGS])
9313 AC_SUBST([LIBGCRYPT_LIBS])
9315 dnl ===================================================================
9316 dnl Check for system redland
9317 dnl ===================================================================
9318 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9319 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9320 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9321 if test "$with_system_redland" = "yes"; then
9322     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9323             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9324 else
9325     RAPTOR_MAJOR="0"
9326     RASQAL_MAJOR="3"
9327     REDLAND_MAJOR="0"
9329 AC_SUBST(RAPTOR_MAJOR)
9330 AC_SUBST(RASQAL_MAJOR)
9331 AC_SUBST(REDLAND_MAJOR)
9333 dnl ===================================================================
9334 dnl Check for system hunspell
9335 dnl ===================================================================
9336 AC_MSG_CHECKING([which libhunspell to use])
9337 if test "$with_system_hunspell" = "yes"; then
9338     AC_MSG_RESULT([external])
9339     SYSTEM_HUNSPELL=TRUE
9340     AC_LANG_PUSH([C++])
9341     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9342     if test "$HUNSPELL_PC" != "TRUE"; then
9343         AC_CHECK_HEADER(hunspell.hxx, [],
9344             [
9345             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9346             [AC_MSG_ERROR(hunspell headers not found.)], [])
9347             ], [])
9348         AC_CHECK_LIB([hunspell], [main], [:],
9349            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9350         HUNSPELL_LIBS=-lhunspell
9351     fi
9352     AC_LANG_POP([C++])
9353     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9354     FilterLibs "${HUNSPELL_LIBS}"
9355     HUNSPELL_LIBS="${filteredlibs}"
9356 else
9357     AC_MSG_RESULT([internal])
9358     SYSTEM_HUNSPELL=
9359     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9360     if test "$COM" = "MSC"; then
9361         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9362     else
9363         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9364     fi
9365     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9367 AC_SUBST(SYSTEM_HUNSPELL)
9368 AC_SUBST(HUNSPELL_CFLAGS)
9369 AC_SUBST(HUNSPELL_LIBS)
9371 dnl ===================================================================
9372 dnl Checking for altlinuxhyph
9373 dnl ===================================================================
9374 AC_MSG_CHECKING([which altlinuxhyph to use])
9375 if test "$with_system_altlinuxhyph" = "yes"; then
9376     AC_MSG_RESULT([external])
9377     SYSTEM_HYPH=TRUE
9378     AC_CHECK_HEADER(hyphen.h, [],
9379        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9380     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9381        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9382        [#include <hyphen.h>])
9383     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9384         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9385     if test -z "$HYPHEN_LIB"; then
9386         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9387            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9388     fi
9389     if test -z "$HYPHEN_LIB"; then
9390         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9391            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9392     fi
9393 else
9394     AC_MSG_RESULT([internal])
9395     SYSTEM_HYPH=
9396     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9397     if test "$COM" = "MSC"; then
9398         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9399     else
9400         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9401     fi
9403 AC_SUBST(SYSTEM_HYPH)
9404 AC_SUBST(HYPHEN_LIB)
9406 dnl ===================================================================
9407 dnl Checking for mythes
9408 dnl ===================================================================
9409 AC_MSG_CHECKING([which mythes to use])
9410 if test "$with_system_mythes" = "yes"; then
9411     AC_MSG_RESULT([external])
9412     SYSTEM_MYTHES=TRUE
9413     AC_LANG_PUSH([C++])
9414     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9415     if test "$MYTHES_PKGCONFIG" = "no"; then
9416         AC_CHECK_HEADER(mythes.hxx, [],
9417             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9418         AC_CHECK_LIB([mythes-1.2], [main], [:],
9419             [ MYTHES_FOUND=no], [])
9420     if test "$MYTHES_FOUND" = "no"; then
9421         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9422                 [ MYTHES_FOUND=no], [])
9423     fi
9424     if test "$MYTHES_FOUND" = "no"; then
9425         AC_MSG_ERROR([mythes library not found!.])
9426     fi
9427     fi
9428     AC_LANG_POP([C++])
9429     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9430     FilterLibs "${MYTHES_LIBS}"
9431     MYTHES_LIBS="${filteredlibs}"
9432 else
9433     AC_MSG_RESULT([internal])
9434     SYSTEM_MYTHES=
9435     BUILD_TYPE="$BUILD_TYPE MYTHES"
9436     if test "$COM" = "MSC"; then
9437         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9438     else
9439         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9440     fi
9442 AC_SUBST(SYSTEM_MYTHES)
9443 AC_SUBST(MYTHES_CFLAGS)
9444 AC_SUBST(MYTHES_LIBS)
9446 dnl ===================================================================
9447 dnl How should we build the linear programming solver ?
9448 dnl ===================================================================
9450 ENABLE_COINMP=
9451 AC_MSG_CHECKING([whether to build with CoinMP])
9452 if test "$enable_coinmp" != "no"; then
9453     ENABLE_COINMP=TRUE
9454     AC_MSG_RESULT([yes])
9455     if test "$with_system_coinmp" = "yes"; then
9456         SYSTEM_COINMP=TRUE
9457         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9458         FilterLibs "${COINMP_LIBS}"
9459         COINMP_LIBS="${filteredlibs}"
9460     else
9461         BUILD_TYPE="$BUILD_TYPE COINMP"
9462     fi
9463 else
9464     AC_MSG_RESULT([no])
9466 AC_SUBST(ENABLE_COINMP)
9467 AC_SUBST(SYSTEM_COINMP)
9468 AC_SUBST(COINMP_CFLAGS)
9469 AC_SUBST(COINMP_LIBS)
9471 ENABLE_LPSOLVE=
9472 AC_MSG_CHECKING([whether to build with lpsolve])
9473 if test "$enable_lpsolve" != "no"; then
9474     ENABLE_LPSOLVE=TRUE
9475     AC_MSG_RESULT([yes])
9476 else
9477     AC_MSG_RESULT([no])
9479 AC_SUBST(ENABLE_LPSOLVE)
9481 if test "$ENABLE_LPSOLVE" = TRUE; then
9482     AC_MSG_CHECKING([which lpsolve to use])
9483     if test "$with_system_lpsolve" = "yes"; then
9484         AC_MSG_RESULT([external])
9485         SYSTEM_LPSOLVE=TRUE
9486         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9487            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9488         save_LIBS=$LIBS
9489         # some systems need this. Like Ubuntu....
9490         AC_CHECK_LIB(m, floor)
9491         AC_CHECK_LIB(dl, dlopen)
9492         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9493             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9494         LIBS=$save_LIBS
9495     else
9496         AC_MSG_RESULT([internal])
9497         SYSTEM_LPSOLVE=
9498         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9499     fi
9501 AC_SUBST(SYSTEM_LPSOLVE)
9503 dnl ===================================================================
9504 dnl Checking for libexttextcat
9505 dnl ===================================================================
9506 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9507 if test "$with_system_libexttextcat" = "yes"; then
9508     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9510 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9512 dnl ***************************************
9513 dnl testing libc version for Linux...
9514 dnl ***************************************
9515 if test "$_os" = "Linux"; then
9516     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9517     exec 6>/dev/null # no output
9518     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9519     exec 6>&1 # output on again
9520     if test "$HAVE_LIBC"; then
9521         AC_MSG_RESULT([yes])
9522     else
9523         AC_MSG_ERROR([no, upgrade libc])
9524     fi
9527 dnl =========================================
9528 dnl Check for uuidgen
9529 dnl =========================================
9530 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9531     # presence is already tested above in the WINDOWS_SDK_HOME check
9532     UUIDGEN=uuidgen.exe
9533     AC_SUBST(UUIDGEN)
9534 else
9535     AC_PATH_PROG([UUIDGEN], [uuidgen])
9536     if test -z "$UUIDGEN"; then
9537         AC_MSG_WARN([uuid is needed for building installation sets])
9538     fi
9541 dnl ***************************************
9542 dnl Checking for bison and flex
9543 dnl ***************************************
9544 AC_PATH_PROG(BISON, bison)
9545 if test -z "$BISON"; then
9546     AC_MSG_ERROR([no bison found in \$PATH, install it])
9547 else
9548     AC_MSG_CHECKING([the bison version])
9549     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9550     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9551     # Accept newer than 2.0
9552     if test "$_bison_longver" -lt 2000; then
9553         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9554     fi
9557 AC_PATH_PROG(FLEX, flex)
9558 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9559     FLEX=`cygpath -m $FLEX`
9561 if test -z "$FLEX"; then
9562     AC_MSG_ERROR([no flex found in \$PATH, install it])
9563 else
9564     AC_MSG_CHECKING([the flex version])
9565     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9566     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9567         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9568     fi
9570 AC_SUBST([FLEX])
9571 dnl ***************************************
9572 dnl Checking for patch
9573 dnl ***************************************
9574 AC_PATH_PROG(PATCH, patch)
9575 if test -z "$PATCH"; then
9576     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9579 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9580 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9581     if test -z "$with_gnu_patch"; then
9582         GNUPATCH=$PATCH
9583     else
9584         if test -x "$with_gnu_patch"; then
9585             GNUPATCH=$with_gnu_patch
9586         else
9587             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9588         fi
9589     fi
9591     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9592     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9593         AC_MSG_RESULT([yes])
9594     else
9595         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9596     fi
9597 else
9598     GNUPATCH=$PATCH
9601 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9602     GNUPATCH=`cygpath -m $GNUPATCH`
9605 dnl We also need to check for --with-gnu-cp
9607 if test -z "$with_gnu_cp"; then
9608     # check the place where the good stuff is hidden on Solaris...
9609     if test -x /usr/gnu/bin/cp; then
9610         GNUCP=/usr/gnu/bin/cp
9611     else
9612         AC_PATH_PROGS(GNUCP, gnucp cp)
9613     fi
9614     if test -z $GNUCP; then
9615         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9616     fi
9617 else
9618     if test -x "$with_gnu_cp"; then
9619         GNUCP=$with_gnu_cp
9620     else
9621         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9622     fi
9625 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9626     GNUCP=`cygpath -m $GNUCP`
9629 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9630 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9631     AC_MSG_RESULT([yes])
9632 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9633     AC_MSG_RESULT([yes])
9634 else
9635     case "$build_os" in
9636     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9637         x_GNUCP=[\#]
9638         GNUCP=''
9639         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9640         ;;
9641     *)
9642         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9643         ;;
9644     esac
9647 AC_SUBST(GNUPATCH)
9648 AC_SUBST(GNUCP)
9649 AC_SUBST(x_GNUCP)
9651 dnl ***************************************
9652 dnl testing assembler path
9653 dnl ***************************************
9654 ML_EXE=""
9655 if test "$_os" = "WINNT"; then
9656     if test "$BITNESS_OVERRIDE" = ""; then
9657         assembler=ml.exe
9658         assembler_bin=$CL_DIR
9659     else
9660         assembler=ml64.exe
9661         assembler_bin=$CL_DIR
9662     fi
9664     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9665     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9666         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9667         AC_MSG_RESULT([found])
9668         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9669     else
9670         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9671     fi
9673     PathFormat "$ASM_HOME"
9674     ASM_HOME="$formatted_path"
9675 else
9676     ASM_HOME=""
9679 AC_SUBST(ML_EXE)
9681 dnl ===================================================================
9682 dnl We need zip and unzip
9683 dnl ===================================================================
9684 AC_PATH_PROG(ZIP, zip)
9685 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9686 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9687     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],,)
9690 AC_PATH_PROG(UNZIP, unzip)
9691 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9693 dnl ===================================================================
9694 dnl Zip must be a specific type for different build types.
9695 dnl ===================================================================
9696 if test $build_os = cygwin; then
9697     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9698         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9699     fi
9702 dnl ===================================================================
9703 dnl We need touch with -h option support.
9704 dnl ===================================================================
9705 AC_PATH_PROG(TOUCH, touch)
9706 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9707 touch warn
9708 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9709     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],,)
9712 dnl ===================================================================
9713 dnl Check for system epoxy
9714 dnl ===================================================================
9715 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9717 dnl ===================================================================
9718 dnl Set vcl option: coordinate device in double or sal_Int32
9719 dnl ===================================================================
9721 dnl disabled for now, we don't want subtle differences between OSs
9722 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9723 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9724 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9725 dnl     AC_MSG_RESULT([double])
9726 dnl else
9727 dnl     AC_MSG_RESULT([sal_Int32])
9728 dnl fi
9730 dnl ===================================================================
9731 dnl Test which vclplugs have to be built.
9732 dnl ===================================================================
9733 R=""
9734 if test "$USING_X11" != TRUE; then
9735     enable_gtk=no
9736     enable_gtk3=no
9738 GTK3_CFLAGS=""
9739 GTK3_LIBS=""
9740 ENABLE_GTK3=""
9741 if test "x$enable_gtk3" = "xyes"; then
9742     if test "$with_system_cairo" = no; then
9743         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9744     fi
9745     : ${with_system_cairo:=yes}
9746     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="")
9747     if test "x$ENABLE_GTK3" = "xTRUE"; then
9748         R="gtk3"
9749         dnl Avoid installed by unpackaged files for now.
9750         if test -z "$PKGFORMAT"; then
9751             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9752         fi
9753     else
9754         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9755     fi
9756     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9757     FilterLibs "${GTK3_LIBS}"
9758     GTK3_LIBS="${filteredlibs}"
9760     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9761     if test "$with_system_epoxy" != "yes"; then
9762         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9763     fi
9765 AC_SUBST(GTK3_LIBS)
9766 AC_SUBST(GTK3_CFLAGS)
9767 AC_SUBST(ENABLE_GTK3)
9769 ENABLE_GTK=""
9770 if test "x$enable_gtk" = "xyes"; then
9771     if test "$with_system_cairo" = no; then
9772         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9773     fi
9774     : ${with_system_cairo:=yes}
9775     ENABLE_GTK="TRUE"
9776     AC_DEFINE(ENABLE_GTK)
9777     R="gtk $R"
9779 AC_SUBST(ENABLE_GTK)
9781 ENABLE_KDE4=""
9782 if test "x$enable_kde4" = "xyes"; then
9783     ENABLE_KDE4="TRUE"
9784     AC_DEFINE(ENABLE_KDE4)
9785     R="$R kde4"
9787 AC_SUBST(ENABLE_KDE4)
9790 build_vcl_plugins="$R"
9791 if test -z "$build_vcl_plugins"; then
9792     build_vcl_plugins="none"
9794 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
9796 dnl ===================================================================
9797 dnl check for dbus support
9798 dnl ===================================================================
9799 ENABLE_DBUS=""
9800 DBUS_CFLAGS=""
9801 DBUS_LIBS=""
9803 if test "$enable_dbus" = "no"; then
9804     test_dbus=no
9807 AC_MSG_CHECKING([whether to enable DBUS support])
9808 if test "$test_dbus" = "yes"; then
9809     ENABLE_DBUS="TRUE"
9810     AC_MSG_RESULT([yes])
9811     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9812     AC_DEFINE(ENABLE_DBUS)
9813     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9814     FilterLibs "${DBUS_LIBS}"
9815     DBUS_LIBS="${filteredlibs}"
9816 else
9817     AC_MSG_RESULT([no])
9820 AC_SUBST(ENABLE_DBUS)
9821 AC_SUBST(DBUS_CFLAGS)
9822 AC_SUBST(DBUS_LIBS)
9824 AC_MSG_CHECKING([whether to enable Impress remote control])
9825 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9826     AC_MSG_RESULT([yes])
9827     ENABLE_SDREMOTE=TRUE
9828     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9830     # If not explicitly enabled or disabled, default
9831     if test -z "$enable_sdremote_bluetooth"; then
9832         case "$OS" in
9833         LINUX|MACOSX|WNT)
9834             # Default to yes for these
9835             enable_sdremote_bluetooth=yes
9836             ;;
9837         *)
9838             # otherwise no
9839             enable_sdremote_bluetooth=no
9840             ;;
9841         esac
9842     fi
9843     # $enable_sdremote_bluetooth is guaranteed non-empty now
9845     if test "$enable_sdremote_bluetooth" != "no"; then
9846         if test "$OS" = "LINUX"; then
9847             if test "$ENABLE_DBUS" = "TRUE"; then
9848                 AC_MSG_RESULT([yes])
9849                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
9850                 dnl ===================================================================
9851                 dnl Check for system bluez
9852                 dnl ===================================================================
9853                 AC_MSG_CHECKING([which Bluetooth header to use])
9854                 if test "$with_system_bluez" = "yes"; then
9855                     AC_MSG_RESULT([external])
9856                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
9857                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
9858                     SYSTEM_BLUEZ=TRUE
9859                 else
9860                     AC_MSG_RESULT([internal])
9861                     SYSTEM_BLUEZ=
9862                 fi
9863             else
9864                 AC_MSG_RESULT([no, dbus disabled])
9865                 ENABLE_SDREMOTE_BLUETOOTH=
9866                 SYSTEM_BLUEZ=
9867             fi
9868         else
9869             AC_MSG_RESULT([yes])
9870             ENABLE_SDREMOTE_BLUETOOTH=TRUE
9871             SYSTEM_BLUEZ=
9872         fi
9873     else
9874         AC_MSG_RESULT([no])
9875         ENABLE_SDREMOTE_BLUETOOTH=
9876         SYSTEM_BLUEZ=
9877     fi
9878 else
9879     ENABLE_SDREMOTE=
9880     SYSTEM_BLUEZ=
9881     AC_MSG_RESULT([no])
9883 AC_SUBST(ENABLE_SDREMOTE)
9884 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
9885 AC_SUBST(SYSTEM_BLUEZ)
9887 dnl ===================================================================
9888 dnl Check whether the gtk 2.0 libraries are available.
9889 dnl ===================================================================
9891 GTK_CFLAGS=""
9892 GTK_LIBS=""
9893 ENABLE_SYSTRAY_GTK=""
9894 if test  "$test_gtk" = "yes"; then
9896     if test "$ENABLE_GTK" = "TRUE"; then
9897         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]))
9898         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9899         FilterLibs "${GTK_LIBS}"
9900         GTK_LIBS="${filteredlibs}"
9901         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]))
9902         BUILD_TYPE="$BUILD_TYPE GTK"
9903         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9904         FilterLibs "${GTHREAD_LIBS}"
9905         GTHREAD_LIBS="${filteredlibs}"
9907         if test "x$enable_systray" = "xyes"; then
9908             ENABLE_SYSTRAY_GTK="TRUE"
9909         fi
9911         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
9912         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
9913                           [ENABLE_GTK_PRINT="TRUE"],
9914                           [ENABLE_GTK_PRINT=""])
9915         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9916         FilterLibs "${GTK_PRINT_LIBS}"
9917         GTK_PRINT_LIBS="${filteredlibs}"
9919         AC_MSG_CHECKING([whether to enable GIO support])
9920         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
9921             dnl Need at least 2.26 for the dbus support.
9922             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
9923                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
9924             if test "$ENABLE_GIO" = "TRUE"; then
9925                 AC_DEFINE(ENABLE_GIO)
9926                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9927                 FilterLibs "${GIO_LIBS}"
9928                 GIO_LIBS="${filteredlibs}"
9929             fi
9930         else
9931             AC_MSG_RESULT([no])
9932         fi
9933     fi
9935 AC_SUBST(ENABLE_GIO)
9936 AC_SUBST(GIO_CFLAGS)
9937 AC_SUBST(GIO_LIBS)
9938 AC_SUBST(ENABLE_SYSTRAY_GTK)
9939 AC_SUBST(GTK_CFLAGS)
9940 AC_SUBST(GTK_LIBS)
9941 AC_SUBST(GTHREAD_CFLAGS)
9942 AC_SUBST(GTHREAD_LIBS)
9943 AC_SUBST([ENABLE_GTK_PRINT])
9944 AC_SUBST([GTK_PRINT_CFLAGS])
9945 AC_SUBST([GTK_PRINT_LIBS])
9948 dnl ===================================================================
9950 SPLIT_APP_MODULES=""
9951 if test "$enable_split_app_modules" = "yes"; then
9952     SPLIT_APP_MODULES="TRUE"
9954 AC_SUBST(SPLIT_APP_MODULES)
9956 SPLIT_OPT_FEATURES=""
9957 if test "$enable_split_opt_features" = "yes"; then
9958     SPLIT_OPT_FEATURES="TRUE"
9960 AC_SUBST(SPLIT_OPT_FEATURES)
9962 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
9963     if test "$enable_cairo_canvas" = yes; then
9964         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
9965     fi
9966     enable_cairo_canvas=no
9967 elif test -z "$enable_cairo_canvas"; then
9968     enable_cairo_canvas=yes
9971 ENABLE_CAIRO_CANVAS=""
9972 if test "$enable_cairo_canvas" = "yes"; then
9973     test_cairo=yes
9974     ENABLE_CAIRO_CANVAS="TRUE"
9975     AC_DEFINE(ENABLE_CAIRO_CANVAS)
9977 AC_SUBST(ENABLE_CAIRO_CANVAS)
9979 dnl ===================================================================
9980 dnl Check whether the GStreamer libraries are available.
9981 dnl It's possible to build avmedia with both GStreamer backends!
9982 dnl ===================================================================
9984 ENABLE_GSTREAMER_1_0=""
9986 if test "$build_gstreamer_1_0" = "yes"; then
9988     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
9989     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
9990         ENABLE_GSTREAMER_1_0="TRUE"
9991         AC_MSG_RESULT([yes])
9992         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
9993         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9994         FilterLibs "${GSTREAMER_1_0_LIBS}"
9995         GSTREAMER_1_0_LIBS="${filteredlibs}"
9996     else
9997         AC_MSG_RESULT([no])
9998     fi
10000 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10001 AC_SUBST(GSTREAMER_1_0_LIBS)
10002 AC_SUBST(ENABLE_GSTREAMER_1_0)
10005 ENABLE_GSTREAMER_0_10=""
10006 if test "$build_gstreamer_0_10" = "yes"; then
10008     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10009     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10010         ENABLE_GSTREAMER_0_10="TRUE"
10011         AC_MSG_RESULT([yes])
10012         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10013             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10014         ])
10015         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10016         FilterLibs "${GSTREAMER_0_10_LIBS}"
10017         GSTREAMER_0_10_LIBS="${filteredlibs}"
10018     else
10019         AC_MSG_RESULT([no])
10020     fi
10023 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10024 AC_SUBST(GSTREAMER_0_10_LIBS)
10025 AC_SUBST(ENABLE_GSTREAMER_0_10)
10027 dnl ===================================================================
10028 dnl Check whether to build the VLC avmedia backend
10029 dnl ===================================================================
10031 ENABLE_VLC=""
10033 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10034 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10035     ENABLE_VLC="TRUE"
10036     AC_MSG_RESULT([yes])
10037 else
10038     AC_MSG_RESULT([no])
10040 AC_SUBST(ENABLE_VLC)
10042 ENABLE_OPENGL_TRANSITIONS=
10043 ENABLE_OPENGL_CANVAS=
10044 if test $_os = iOS -o $_os = Android; then
10045    : # disable
10046 elif test "$_os" = "Darwin"; then
10047     # We use frameworks on Mac OS X, no need for detail checks
10048     ENABLE_OPENGL_TRANSITIONS=TRUE
10049     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10050     ENABLE_OPENGL_CANVAS=TRUE
10051 elif test $_os = WINNT; then
10052     ENABLE_OPENGL_TRANSITIONS=TRUE
10053     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10054     ENABLE_OPENGL_CANVAS=TRUE
10055 else
10056     if test "$USING_X11" = TRUE; then
10057         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10058         ENABLE_OPENGL_TRANSITIONS=TRUE
10059         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10060         ENABLE_OPENGL_CANVAS=TRUE
10061     fi
10064 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10065 AC_SUBST(ENABLE_OPENGL_CANVAS)
10067 dnl =================================================
10068 dnl Check whether to build with OpenCL support.
10069 dnl =================================================
10071 if test $_os != iOS -a $_os != Android; then
10072     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10073     # platform (optional at run-time, used through clew).
10074     BUILD_TYPE="$BUILD_TYPE OPENCL"
10075     AC_DEFINE(HAVE_FEATURE_OPENCL)
10078 dnl ===================================================================
10079 dnl Check whether to enable glTF support
10080 dnl ===================================================================
10081 AC_MSG_CHECKING([whether to enable glTF support])
10082 ENABLE_GLTF=
10083 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android -a "$ENABLE_HEADLESS" = ""; then
10084     ENABLE_GLTF=TRUE
10085     AC_MSG_RESULT([yes])
10086     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10087     if test "$with_system_libgltf" = "yes"; then
10088         SYSTEM_LIBGLTF=TRUE
10089         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.1 >= 0.1.0] )
10090         FilterLibs "${LIBGLTF_LIBS}"
10091         LIBGLTF_LIBS="${filteredlibs}"
10092     else
10093         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10094     fi
10095 else
10096     AC_MSG_RESULT([no])
10098 AC_SUBST(ENABLE_GLTF)
10099 AC_SUBST(SYSTEM_LIBGLTF)
10100 AC_SUBST(LIBGLTF_CFLAGS)
10101 AC_SUBST(LIBGLTF_LIBS)
10103 dnl ===================================================================
10104 dnl Check whether to enable COLLADA support
10105 dnl ===================================================================
10106 AC_MSG_CHECKING([whether to enable COLLADA support])
10107 ENABLE_COLLADA=
10108 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10109     AC_MSG_RESULT([yes])
10110     ENABLE_COLLADA=TRUE
10111     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10113     AC_MSG_CHECKING([which OPENCOLLADA to use])
10114     if test "$with_system_opencollada" = "yes"; then
10115         AC_MSG_RESULT([external])
10116         SYSTEM_OPENCOLLADA=TRUE
10117         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10118         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10119         AC_LANG_PUSH([C++])
10120         save_CXXFLAGS=$CXXFLAGS
10121         save_CPPFLAGS=$CPPFLAGS
10122         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10123         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10124         AC_CHECK_HEADERS(
10125                 COLLADABU.h \
10126                 COLLADAFW.h \
10127                 COLLADASaxFWLLoader.h \
10128                 GeneratedSaxParser.h,
10129             [],
10130             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10131             [])
10132         CXXFLAGS=$save_CXXFLAGS
10133         CPPFLAGS=$save_CPPFLAGS
10134         AC_LANG_POP([C++])
10135         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10136         FilterLibs "${OPENCOLLADA_LIBS}"
10137         OPENCOLLADA_LIBS="${filteredlibs}"
10138     else
10139         AC_MSG_RESULT([internal])
10140         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10141     fi
10143     AC_MSG_CHECKING([which collada2gltf to use])
10144     if test "$with_system_collada2gltf" = "yes"; then
10145         if test "$with_system_opencollada" = "no"; then
10146             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10147         fi
10148         AC_MSG_RESULT([external])
10149         SYSTEM_COLLADA2GLTF=TRUE
10150         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10151         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10152         AC_LANG_PUSH([C++])
10153         save_CXXFLAGS=$CXXFLAGS
10154         save_CPPFLAGS=$CPPFLAGS
10155         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10156         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10157         AC_CHECK_HEADERS(
10158                 GLTF.h \
10159                 encodingHelpers.h,
10160             [],
10161             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10162             [])
10163         CXXFLAGS=$save_CXXFLAGS
10164         CPPFLAGS=$save_CPPFLAGS
10165         AC_LANG_POP([C++])
10166         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10167         FilterLibs "${COLLADA2GLTF_LIBS}"
10168         COLLADA2GLTF_LIBS="${filteredlibs}"
10169     else
10170         AC_MSG_RESULT([internal])
10171         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10172     fi
10173 else
10174     AC_MSG_RESULT([no])
10176 AC_SUBST(ENABLE_COLLADA)
10177 AC_SUBST([OPENCOLLADA_CFLAGS])
10178 AC_SUBST([OPENCOLLADA_LIBS])
10179 AC_SUBST([SYSTEM_OPENCOLLADA])
10181 AC_SUBST([COLLADA2GLTF_CFLAGS])
10182 AC_SUBST([COLLADA2GLTF_LIBS])
10183 AC_SUBST([SYSTEM_COLLADA2GLTF])
10185 if test "$enable_dconf" != no; then
10186     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10187         if test "$enable_dconf" = yes; then
10188             AC_MSG_ERROR([dconf not found])
10189         else
10190             enable_dconf=no
10191         fi])
10193 AC_MSG_CHECKING([whether to enable dconf])
10194 if test "$enable_dconf" = no; then
10195     DCONF_CFLAGS=
10196     DCONF_LIBS=
10197     ENABLE_DCONF=
10198     AC_MSG_RESULT([no])
10199 else
10200     ENABLE_DCONF=TRUE
10201     AC_DEFINE(ENABLE_DCONF)
10202     AC_MSG_RESULT([yes])
10204 AC_SUBST([DCONF_CFLAGS])
10205 AC_SUBST([DCONF_LIBS])
10206 AC_SUBST([ENABLE_DCONF])
10208 # pdf import?
10209 AC_MSG_CHECKING([whether to build the PDF import feature])
10210 ENABLE_PDFIMPORT=
10211 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10212     AC_MSG_RESULT([yes])
10213     ENABLE_PDFIMPORT=TRUE
10214     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10216     dnl ===================================================================
10217     dnl Check for system poppler
10218     dnl ===================================================================
10219     AC_MSG_CHECKING([which PDF import backend to use])
10220     if test "$with_system_poppler" = "yes"; then
10221         AC_MSG_RESULT([external])
10222         SYSTEM_POPPLER=TRUE
10223         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10224         AC_LANG_PUSH([C++])
10225         save_CXXFLAGS=$CXXFLAGS
10226         save_CPPFLAGS=$CPPFLAGS
10227         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10228         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10229         AC_CHECK_HEADER([cpp/poppler-version.h],
10230             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10231             [])
10232         CXXFLAGS=$save_CXXFLAGS
10233         CPPFLAGS=$save_CPPFLAGS
10234         AC_LANG_POP([C++])
10235         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10237         FilterLibs "${POPPLER_LIBS}"
10238         POPPLER_LIBS="${filteredlibs}"
10239     else
10240         AC_MSG_RESULT([internal])
10241         SYSTEM_POPPLER=
10242         BUILD_TYPE="$BUILD_TYPE POPPLER"
10243         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10244     fi
10245     AC_DEFINE([ENABLE_PDFIMPORT],1)
10246 else
10247     AC_MSG_RESULT([no])
10249 AC_SUBST(ENABLE_PDFIMPORT)
10250 AC_SUBST(SYSTEM_POPPLER)
10251 AC_SUBST(POPPLER_CFLAGS)
10252 AC_SUBST(POPPLER_LIBS)
10254 # pdf import?
10255 AC_MSG_CHECKING([whether to build PDFium])
10256 ENABLE_PDFIUM=
10257 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10258     AC_MSG_RESULT([yes])
10259     ENABLE_PDFIUM=TRUE
10260     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10261     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10262 else
10263     AC_MSG_RESULT([no])
10265 AC_SUBST(ENABLE_PDFIUM)
10267 SYSTEM_GPGMEPP=
10268 if test "$_os" = "Linux"; then
10269     dnl ===================================================================
10270     dnl Check for system gpgme
10271     dnl ===================================================================
10272     AC_MSG_CHECKING([which gpgmepp to use])
10273     if test "$with_system_gpgmepp" = "yes"; then
10274         AC_MSG_RESULT([external])
10275         SYSTEM_GPGMEPP=TRUE
10277         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10278         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10279             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10280         # progress_callback is the only func with plain C linkage
10281         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10282         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10283             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10284         AC_CHECK_HEADER(gpgme.h, [],
10285             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10286     else
10287         AC_MSG_RESULT([internal])
10288         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10290         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10291         GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10292         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10293         LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10294     fi
10296 AC_SUBST(SYSTEM_GPGMEPP)
10297 AC_SUBST(GPG_ERROR_CFLAGS)
10298 AC_SUBST(GPG_ERROR_LIBS)
10299 AC_SUBST(LIBASSUAN_CFLAGS)
10300 AC_SUBST(LIBASSUAN_LIBS)
10301 AC_SUBST(GPGMEPP_CFLAGS)
10302 AC_SUBST(GPGMEPP_LIBS)
10304 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10305 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10306     AC_MSG_RESULT([yes])
10307     ENABLE_MEDIAWIKI=TRUE
10308     BUILD_TYPE="$BUILD_TYPE XSLTML"
10309     if test  "x$with_java" = "xno"; then
10310         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10311     fi
10312 else
10313     AC_MSG_RESULT([no])
10314     ENABLE_MEDIAWIKI=
10315     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10317 AC_SUBST(ENABLE_MEDIAWIKI)
10319 AC_MSG_CHECKING([whether to build the Report Builder])
10320 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10321     AC_MSG_RESULT([yes])
10322     ENABLE_REPORTBUILDER=TRUE
10323     AC_MSG_CHECKING([which jfreereport libs to use])
10324     if test "$with_system_jfreereport" = "yes"; then
10325         SYSTEM_JFREEREPORT=TRUE
10326         AC_MSG_RESULT([external])
10327         if test -z $SAC_JAR; then
10328             SAC_JAR=/usr/share/java/sac.jar
10329         fi
10330         if ! test -f $SAC_JAR; then
10331              AC_MSG_ERROR(sac.jar not found.)
10332         fi
10334         if test -z $LIBXML_JAR; then
10335             if test -f /usr/share/java/libxml-1.0.0.jar; then
10336                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10337             elif test -f /usr/share/java/libxml.jar; then
10338                 LIBXML_JAR=/usr/share/java/libxml.jar
10339             else
10340                 AC_MSG_ERROR(libxml.jar replacement not found.)
10341             fi
10342         elif ! test -f $LIBXML_JAR; then
10343             AC_MSG_ERROR(libxml.jar not found.)
10344         fi
10346         if test -z $FLUTE_JAR; then
10347             if test -f/usr/share/java/flute-1.3.0.jar; then
10348                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10349             elif test -f /usr/share/java/flute.jar; then
10350                 FLUTE_JAR=/usr/share/java/flute.jar
10351             else
10352                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10353             fi
10354         elif ! test -f $FLUTE_JAR; then
10355             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10356         fi
10358         if test -z $JFREEREPORT_JAR; then
10359             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10360                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10361             elif test -f /usr/share/java/flow-engine.jar; then
10362                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10363             else
10364                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10365             fi
10366         elif ! test -f  $JFREEREPORT_JAR; then
10367                 AC_MSG_ERROR(jfreereport.jar not found.)
10368         fi
10370         if test -z $LIBLAYOUT_JAR; then
10371             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10372                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10373             elif test -f /usr/share/java/liblayout.jar; then
10374                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10375             else
10376                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10377             fi
10378         elif ! test -f $LIBLAYOUT_JAR; then
10379                 AC_MSG_ERROR(liblayout.jar not found.)
10380         fi
10382         if test -z $LIBLOADER_JAR; then
10383             if test -f /usr/share/java/libloader-1.0.0.jar; then
10384                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10385             elif test -f /usr/share/java/libloader.jar; then
10386                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10387             else
10388                 AC_MSG_ERROR(libloader.jar replacement not found.)
10389             fi
10390         elif ! test -f  $LIBLOADER_JAR; then
10391             AC_MSG_ERROR(libloader.jar not found.)
10392         fi
10394         if test -z $LIBFORMULA_JAR; then
10395             if test -f /usr/share/java/libformula-0.2.0.jar; then
10396                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10397             elif test -f /usr/share/java/libformula.jar; then
10398                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10399             else
10400                 AC_MSG_ERROR(libformula.jar replacement not found.)
10401             fi
10402         elif ! test -f $LIBFORMULA_JAR; then
10403                 AC_MSG_ERROR(libformula.jar not found.)
10404         fi
10406         if test -z $LIBREPOSITORY_JAR; then
10407             if test -f /usr/share/java/librepository-1.0.0.jar; then
10408                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10409             elif test -f /usr/share/java/librepository.jar; then
10410                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10411             else
10412                 AC_MSG_ERROR(librepository.jar replacement not found.)
10413             fi
10414         elif ! test -f $LIBREPOSITORY_JAR; then
10415             AC_MSG_ERROR(librepository.jar not found.)
10416         fi
10418         if test -z $LIBFONTS_JAR; then
10419             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10420                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10421             elif test -f /usr/share/java/libfonts.jar; then
10422                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10423             else
10424                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10425             fi
10426         elif ! test -f $LIBFONTS_JAR; then
10427                 AC_MSG_ERROR(libfonts.jar not found.)
10428         fi
10430         if test -z $LIBSERIALIZER_JAR; then
10431             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10432                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10433             elif test -f /usr/share/java/libserializer.jar; then
10434                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10435             else
10436                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10437             fi
10438         elif ! test -f $LIBSERIALIZER_JAR; then
10439                 AC_MSG_ERROR(libserializer.jar not found.)
10440         fi
10442         if test -z $LIBBASE_JAR; then
10443             if test -f /usr/share/java/libbase-1.0.0.jar; then
10444                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10445             elif test -f /usr/share/java/libbase.jar; then
10446                 LIBBASE_JAR=/usr/share/java/libbase.jar
10447             else
10448                 AC_MSG_ERROR(libbase.jar replacement not found.)
10449             fi
10450         elif ! test -f $LIBBASE_JAR; then
10451             AC_MSG_ERROR(libbase.jar not found.)
10452         fi
10454     else
10455         AC_MSG_RESULT([internal])
10456         SYSTEM_JFREEREPORT=
10457         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10458     fi
10459 else
10460     AC_MSG_RESULT([no])
10461     ENABLE_REPORTBUILDER=
10462     SYSTEM_JFREEREPORT=
10464 AC_SUBST(ENABLE_REPORTBUILDER)
10465 AC_SUBST(SYSTEM_JFREEREPORT)
10466 AC_SUBST(SAC_JAR)
10467 AC_SUBST(LIBXML_JAR)
10468 AC_SUBST(FLUTE_JAR)
10469 AC_SUBST(JFREEREPORT_JAR)
10470 AC_SUBST(LIBBASE_JAR)
10471 AC_SUBST(LIBLAYOUT_JAR)
10472 AC_SUBST(LIBLOADER_JAR)
10473 AC_SUBST(LIBFORMULA_JAR)
10474 AC_SUBST(LIBREPOSITORY_JAR)
10475 AC_SUBST(LIBFONTS_JAR)
10476 AC_SUBST(LIBSERIALIZER_JAR)
10478 # this has to be here because both the Wiki Publisher and the SRB use
10479 # commons-logging
10480 COMMONS_LOGGING_VERSION=1.2
10481 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10482     AC_MSG_CHECKING([which Apache commons-* libs to use])
10483     if test "$with_system_apache_commons" = "yes"; then
10484         SYSTEM_APACHE_COMMONS=TRUE
10485         AC_MSG_RESULT([external])
10486         if test -z $COMMONS_LOGGING_JAR; then
10487             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10488                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10489            elif test -f /usr/share/java/commons-logging.jar; then
10490                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10491             else
10492                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10493             fi
10494         elif ! test -f $COMMONS_LOGGING_JAR; then
10495             AC_MSG_ERROR(commons-logging.jar not found.)
10496         fi
10497     else
10498         AC_MSG_RESULT([internal])
10499         SYSTEM_APACHE_COMMONS=
10500         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10501     fi
10503 AC_SUBST(SYSTEM_APACHE_COMMONS)
10504 AC_SUBST(COMMONS_LOGGING_JAR)
10505 AC_SUBST(COMMONS_LOGGING_VERSION)
10507 # scripting provider for BeanShell?
10508 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10509 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10510     AC_MSG_RESULT([yes])
10511     ENABLE_SCRIPTING_BEANSHELL=TRUE
10513     dnl ===================================================================
10514     dnl Check for system beanshell
10515     dnl ===================================================================
10516     AC_MSG_CHECKING([which beanshell to use])
10517     if test "$with_system_beanshell" = "yes"; then
10518         AC_MSG_RESULT([external])
10519         SYSTEM_BSH=TRUE
10520         if test -z $BSH_JAR; then
10521             BSH_JAR=/usr/share/java/bsh.jar
10522         fi
10523         if ! test -f $BSH_JAR; then
10524             AC_MSG_ERROR(bsh.jar not found.)
10525         fi
10526     else
10527         AC_MSG_RESULT([internal])
10528         SYSTEM_BSH=
10529         BUILD_TYPE="$BUILD_TYPE BSH"
10530     fi
10531 else
10532     AC_MSG_RESULT([no])
10533     ENABLE_SCRIPTING_BEANSHELL=
10534     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10536 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10537 AC_SUBST(SYSTEM_BSH)
10538 AC_SUBST(BSH_JAR)
10540 # scripting provider for JavaScript?
10541 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10542 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10543     AC_MSG_RESULT([yes])
10544     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10546     dnl ===================================================================
10547     dnl Check for system rhino
10548     dnl ===================================================================
10549     AC_MSG_CHECKING([which rhino to use])
10550     if test "$with_system_rhino" = "yes"; then
10551         AC_MSG_RESULT([external])
10552         SYSTEM_RHINO=TRUE
10553         if test -z $RHINO_JAR; then
10554             RHINO_JAR=/usr/share/java/js.jar
10555         fi
10556         if ! test -f $RHINO_JAR; then
10557             AC_MSG_ERROR(js.jar not found.)
10558         fi
10559     else
10560         AC_MSG_RESULT([internal])
10561         SYSTEM_RHINO=
10562         BUILD_TYPE="$BUILD_TYPE RHINO"
10563     fi
10564 else
10565     AC_MSG_RESULT([no])
10566     ENABLE_SCRIPTING_JAVASCRIPT=
10567     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10569 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10570 AC_SUBST(SYSTEM_RHINO)
10571 AC_SUBST(RHINO_JAR)
10573 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10574 # paths should be added to library search path. So lets put all 64-bit
10575 # platforms there.
10576 supports_multilib=
10577 case "$host_cpu" in
10578 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10579     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10580         supports_multilib="yes"
10581     fi
10582     ;;
10584     ;;
10585 esac
10587 dnl ===================================================================
10588 dnl KDE4 Integration
10589 dnl ===================================================================
10591 KDE4_CFLAGS=""
10592 KDE4_LIBS=""
10593 QMAKE4="qmake"
10594 MOC4="moc"
10595 KDE4_GLIB_CFLAGS=""
10596 KDE4_GLIB_LIBS=""
10597 KDE4_HAVE_GLIB=""
10598 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10599     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10600     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10602     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10603     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10605     if test -n "$supports_multilib"; then
10606         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10607         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10608     fi
10610     if test -n "$QTDIR"; then
10611         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10612         if test -z "$supports_multilib"; then
10613             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10614         else
10615             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10616         fi
10617     fi
10618     if test -n "$QT4DIR"; then
10619         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10620         if test -z "$supports_multilib"; then
10621             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10622         else
10623             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10624         fi
10625     fi
10627     if test -n "$KDEDIR"; then
10628         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10629         if test -z "$supports_multilib"; then
10630             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10631         else
10632             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10633         fi
10634     fi
10635     if test -n "$KDE4DIR"; then
10636         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10637         if test -z "$supports_multilib"; then
10638             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10639         else
10640             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10641         fi
10642     fi
10644     qt4_test_include="Qt/qobject.h"
10645     qt4_test_library="libQtNetwork.so"
10646     kde4_test_include="kwindowsystem.h"
10647     kde4_test_library="libsolid.so"
10649     AC_MSG_CHECKING([for Qt4 headers])
10650     qt4_header_dir="no"
10651     for inc_dir in $qt4_incdirs; do
10652         if test -r "$inc_dir/$qt4_test_include"; then
10653             qt4_header_dir="$inc_dir"
10654             break
10655         fi
10656     done
10658     AC_MSG_RESULT([$qt4_header_dir])
10659     if test "x$qt4_header_dir" = "xno"; then
10660         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10661     fi
10663     dnl Check for qmake
10664     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10665     QMAKE4="$QMAKEQT4"
10666     if test "$QMAKE4" = "no"; then
10667         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10668         if test "$QMAKE4" = "no"; then
10669             AC_MSG_ERROR([Qmake not found.  Please specify
10670 the root of your Qt installation by exporting QT4DIR before running "configure".])
10671         fi
10672     fi
10674     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10675     AC_MSG_CHECKING([for Qt4 libraries])
10676     qt4_lib_dir="no"
10677     for lib_dir in $qt4_libdirs; do
10678         if test -r "$lib_dir/$qt4_test_library"; then
10679             qt4_lib_dir="$lib_dir"
10680             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10681             break
10682         fi
10683     done
10685     AC_MSG_RESULT([$qt4_lib_dir])
10687     if test "x$qt4_lib_dir" = "xno"; then
10688         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10689     fi
10691     dnl Check for Meta Object Compiler
10693     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10694     MOC4="$MOCQT4"
10695     if test "$MOC4" = "no"; then
10696         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10697         if test "$MOC4" = "no"; then
10698             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10699 the root of your Qt installation by exporting QT4DIR before running "configure".])
10700         fi
10701     fi
10703     dnl Check for KDE4 headers
10704     AC_MSG_CHECKING([for KDE4 headers])
10705     kde4_incdir="no"
10706     for kde4_check in $kde4_incdirs; do
10707         if test -r "$kde4_check/$kde4_test_include"; then
10708             kde4_incdir="$kde4_check"
10709             break
10710         fi
10711     done
10712     AC_MSG_RESULT([$kde4_incdir])
10713     if test "x$kde4_incdir" = "xno"; then
10714         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10715     fi
10716     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10718     dnl Check for KDE4 libraries
10719     AC_MSG_CHECKING([for KDE4 libraries])
10720     kde4_libdir="no"
10721     for kde4_check in $kde4_libdirs; do
10722         if test -r "$kde4_check/$kde4_test_library"; then
10723             kde4_libdir="$kde4_check"
10724             break
10725         fi
10726     done
10728     AC_MSG_RESULT([$kde4_libdir])
10729     if test "x$kde4_libdir" = "xno"; then
10730         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10731     fi
10733     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10734     if ! test -z "$kde4_incdir"; then
10735         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10736     else
10737         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10738     fi
10740     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10741     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10742     FilterLibs "$KDE4_LIBS"
10743     KDE4_LIBS="$filteredlibs"
10745     AC_LANG_PUSH([C++])
10746     save_CXXFLAGS=$CXXFLAGS
10747     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10748     AC_MSG_CHECKING([whether KDE is >= 4.2])
10749        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10750 #include <kdeversion.h>
10752 int main(int argc, char **argv) {
10753        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10754        else return 1;
10756 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10757     CXXFLAGS=$save_CXXFLAGS
10758     AC_LANG_POP([C++])
10760     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10761     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10762     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10763         [
10764             KDE4_HAVE_GLIB=TRUE
10765             AC_DEFINE(KDE4_HAVE_GLIB,1)
10766             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10767             FilterLibs "${KDE4_GLIB_LIBS}"
10768             KDE4_GLIB_LIBS="${filteredlibs}"
10770             qt4_fix_warning=
10772             AC_LANG_PUSH([C++])
10773             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10774             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10775             #  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
10776             #               ^~~~~~~~~~~~~~~~~~~~~~~
10777             #               vptr for 'QObjectPrivate'
10778             save_CXX=$CXX
10779             CXX=$(printf %s "$CXX" \
10780                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10781             save_CXXFLAGS=$CXXFLAGS
10782             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10783             save_LIBS=$LIBS
10784             LIBS="$LIBS $KDE4_LIBS"
10785             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10787             # Prepare meta object data
10788             TSTBASE="tst_exclude_socket_notifiers"
10789             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10790             ln -fs "${TSTMOC}.hxx"
10791             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10793             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10794 #include <cstdlib>
10795 #include "tst_exclude_socket_notifiers.moc"
10797 int main(int argc, char *argv[])
10799     QCoreApplication app(argc, argv);
10800     exit(tst_processEventsExcludeSocket());
10801     return 0;
10803             ]])],[
10804                 AC_MSG_RESULT([yes])
10805             ],[
10806                 AC_MSG_RESULT([no])
10807                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10808                 if test -z "$qt4_fix_warning"; then
10809                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10810                 fi
10811                 qt4_fix_warning=1
10812                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10813                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10815             # Remove meta object data
10816             rm -f "${TSTBASE}."*
10818             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10820             # Prepare meta object data
10821             TSTBASE="tst_exclude_posted_events"
10822             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10823             ln -fs "${TSTMOC}.hxx"
10824             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10826             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10827 #include <cstdlib>
10828 #include "tst_exclude_posted_events.moc"
10830 int main(int argc, char *argv[])
10832     QCoreApplication app(argc, argv);
10833     exit(tst_excludePostedEvents());
10834     return 0;
10836             ]])],[
10837                 AC_MSG_RESULT([yes])
10838             ],[
10839                 AC_MSG_RESULT([no])
10840                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10841                 if test -z "$qt4_fix_warning"; then
10842                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10843                 fi
10844                 qt4_fix_warning=1
10845                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
10846             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10848             # Remove meta object data
10849             rm -f "${TSTBASE}."*
10851             if test -n "$qt4_fix_warning"; then
10852                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
10853             fi
10855             LIBS=$save_LIBS
10856             CXXFLAGS=$save_CXXFLAGS
10857             CXX=$save_CXX
10858             AC_LANG_POP([C++])
10859         ],
10860         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
10862 AC_SUBST(KDE4_CFLAGS)
10863 AC_SUBST(KDE4_LIBS)
10864 AC_SUBST(MOC4)
10865 AC_SUBST(KDE4_GLIB_CFLAGS)
10866 AC_SUBST(KDE4_GLIB_LIBS)
10867 AC_SUBST(KDE4_HAVE_GLIB)
10869 dnl ===================================================================
10870 dnl Test whether to include Evolution 2 support
10871 dnl ===================================================================
10872 AC_MSG_CHECKING([whether to enable evolution 2 support])
10873 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
10874     AC_MSG_RESULT([yes])
10875     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
10876     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10877     FilterLibs "${GOBJECT_LIBS}"
10878     GOBJECT_LIBS="${filteredlibs}"
10879     ENABLE_EVOAB2="TRUE"
10880 else
10881     ENABLE_EVOAB2=""
10882     AC_MSG_RESULT([no])
10884 AC_SUBST(ENABLE_EVOAB2)
10885 AC_SUBST(GOBJECT_CFLAGS)
10886 AC_SUBST(GOBJECT_LIBS)
10888 dnl ===================================================================
10889 dnl Test which themes to include
10890 dnl ===================================================================
10891 AC_MSG_CHECKING([which themes to include])
10892 # if none given use default subset of available themes
10893 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
10894     with_theme="breeze breeze_dark galaxy hicontrast sifr sifr_dark tango"
10895     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
10898 WITH_THEMES=""
10899 if test "x$with_theme" != "xno"; then
10900     for theme in $with_theme; do
10901         case $theme in
10902         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|sifr_dark|tango|tango_testing) real_theme="$theme" ;;
10903         default) real_theme=galaxy ;;
10904         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
10905         esac
10906         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
10907     done
10909 AC_MSG_RESULT([$WITH_THEMES])
10910 AC_SUBST([WITH_THEMES])
10911 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
10912 for theme in $with_theme; do
10913     case $theme in
10914     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
10915     *) ;;
10916     esac
10917 done
10919 dnl ===================================================================
10920 dnl Test whether to integrate helppacks into the product's installer
10921 dnl ===================================================================
10922 AC_MSG_CHECKING([for helppack integration])
10923 if test "$with_helppack_integration" = "no"; then
10924     WITH_HELPPACK_INTEGRATION=
10925     AC_MSG_RESULT([no integration])
10926 else
10927     WITH_HELPPACK_INTEGRATION=TRUE
10928     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
10929     AC_MSG_RESULT([integration])
10931 AC_SUBST(WITH_HELPPACK_INTEGRATION)
10933 ###############################################################################
10934 # Extensions checking
10935 ###############################################################################
10936 AC_MSG_CHECKING([for extensions integration])
10937 if test "x$enable_extension_integration" != "xno"; then
10938     WITH_EXTENSION_INTEGRATION=TRUE
10939     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
10940     AC_MSG_RESULT([yes, use integration])
10941 else
10942     WITH_EXTENSION_INTEGRATION=
10943     AC_MSG_RESULT([no, do not integrate])
10945 AC_SUBST(WITH_EXTENSION_INTEGRATION)
10947 dnl Should any extra extensions be included?
10948 dnl There are standalone tests for each of these below.
10949 WITH_EXTRA_EXTENSIONS=
10950 AC_SUBST([WITH_EXTRA_EXTENSIONS])
10952 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
10953 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
10954 if test "x$with_java" != "xno"; then
10955     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
10956     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
10959 TEST_FONTS_MISSING=0
10961 # $1  = font family
10962 # $2+ = accepted font mappings
10963 test_font_map()
10965     FONT="$1" ; shift
10966     AC_MSG_CHECKING([font mapping for '$FONT'])
10967     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
10968     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
10970     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
10971     while test "$#" -ge 1 ; do
10972         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
10973         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
10974     done
10975     if test $TESTEXPR
10976     then
10977         AC_MSG_RESULT([ok])
10978     else
10979         AC_MSG_WARN([unknown ($FONTFILE)])
10980         add_warning "unknown ($FONTFILE)"
10981         TEST_FONTS_MISSING=1
10982     fi
10985 dnl ===================================================================
10986 dnl Test whether to include fonts
10987 dnl ===================================================================
10988 AC_MSG_CHECKING([whether to include third-party fonts])
10989 if test "$with_fonts" != "no"; then
10990     AC_MSG_RESULT([yes])
10991     WITH_FONTS=TRUE
10992     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
10993     AC_DEFINE(HAVE_MORE_FONTS)
10994 else
10995     AC_MSG_RESULT([no])
10996     WITH_FONTS=
10997     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
10998     if test "$test_fontconfig" = "yes"; then
10999         AC_PATH_PROG([FCMATCH], [fc-match])
11000         if test -z "$FCMATCH"; then
11001             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11002             TEST_FONTS_MISSING=1
11003         else
11004             test_font_map 'Calibri' 'Carlito'
11005             test_font_map 'DejaVuSans' 'DejaVuSans'
11006             if test ${TEST_FONTS_MISSING} -eq 1
11007             then
11008                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11009                 add_warning "Unknown font mappings - unit tests disabled."
11010             fi
11011         fi
11012     else
11013         TEST_FONTS_MISSING=0
11014     fi
11016 AC_SUBST(WITH_FONTS)
11017 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11020 dnl ===================================================================
11021 dnl Test whether to enable online update service
11022 dnl ===================================================================
11023 AC_MSG_CHECKING([whether to enable online update])
11024 ENABLE_ONLINE_UPDATE=
11025 ENABLE_ONLINE_UPDATE_MAR=
11026 UPDATE_CONFIG=
11027 if test "$enable_online_update" = ""; then
11028     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11029         AC_MSG_RESULT([yes])
11030         ENABLE_ONLINE_UPDATE="TRUE"
11031     else
11032         AC_MSG_RESULT([no])
11033     fi
11034 else
11035     if test "$enable_online_update" = "mar"; then
11036         AC_MSG_RESULT([yes - MAR-based online update])
11037         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11038         if test "$with_update_config" = ""; then
11039             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11040         fi
11041         UPDATE_CONFIG="$with_update_config"
11042         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11043     elif test "$enable_online_update" = "yes"; then
11044         AC_MSG_RESULT([yes])
11045         ENABLE_ONLINE_UPDATE="TRUE"
11046     else
11047         AC_MSG_RESULT([no])
11048     fi
11050 AC_SUBST(ENABLE_ONLINE_UPDATE)
11051 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11052 AC_SUBST(UPDATE_CONFIG)
11054 dnl ===================================================================
11055 dnl Test whether we need bzip2
11056 dnl ===================================================================
11057 SYSTEM_BZIP2=
11058 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11059     AC_MSG_CHECKING([whether to use system bzip2])
11060     if test "$with_system_bzip2" = yes; then
11061         SYSTEM_BZIP2=TRUE
11062         AC_MSG_RESULT([yes])
11063         PKG_CHECK_MODULES(BZIP2, bzip2)
11064         FilterLibs "${BZIP2_LIBS}"
11065         BZIP2_LIBS="${filteredlibs}"
11066     else
11067         AC_MSG_RESULT([no])
11068         BUILD_TYPE="$BUILD_TYPE BZIP2"
11069     fi
11071 AC_SUBST(SYSTEM_BZIP2)
11072 AC_SUBST(BZIP2_CFLAGS)
11073 AC_SUBST(BZIP2_LIBS)
11075 dnl ===================================================================
11076 dnl Test whether to enable extension update
11077 dnl ===================================================================
11078 AC_MSG_CHECKING([whether to enable extension update])
11079 ENABLE_EXTENSION_UPDATE=
11080 if test "x$enable_extension_update" = "xno"; then
11081     AC_MSG_RESULT([no])
11082 else
11083     AC_MSG_RESULT([yes])
11084     ENABLE_EXTENSION_UPDATE="TRUE"
11085     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11086     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11088 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11091 dnl ===================================================================
11092 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11093 dnl ===================================================================
11094 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11095 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11096     AC_MSG_RESULT([no])
11097     ENABLE_SILENT_MSI=
11098 else
11099     AC_MSG_RESULT([yes])
11100     ENABLE_SILENT_MSI=TRUE
11101     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11103 AC_SUBST(ENABLE_SILENT_MSI)
11105 AC_MSG_CHECKING([whether and how to use Xinerama])
11106 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11107     if test "$x_libraries" = "default_x_libraries"; then
11108         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11109         if test "x$XINERAMALIB" = x; then
11110            XINERAMALIB="/usr/lib"
11111         fi
11112     else
11113         XINERAMALIB="$x_libraries"
11114     fi
11115     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11116         # we have both versions, let the user decide but use the dynamic one
11117         # per default
11118         USE_XINERAMA=TRUE
11119         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11120             XINERAMA_LINK=dynamic
11121         else
11122             XINERAMA_LINK=static
11123         fi
11124     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11125         # we have only the dynamic version
11126         USE_XINERAMA=TRUE
11127         XINERAMA_LINK=dynamic
11128     elif test -e "$XINERAMALIB/libXinerama.a"; then
11129         # static version
11130         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11131             USE_XINERAMA=TRUE
11132             XINERAMA_LINK=static
11133         else
11134             USE_XINERAMA=
11135             XINERAMA_LINK=none
11136         fi
11137     else
11138         # no Xinerama
11139         USE_XINERAMA=
11140         XINERAMA_LINK=none
11141     fi
11142     if test "$USE_XINERAMA" = "TRUE"; then
11143         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11144         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11145             [AC_MSG_ERROR(Xinerama header not found.)], [])
11146         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11147         if test "x$XEXTLIB" = x; then
11148            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11149         fi
11150         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11151         if test "$_os" = "FreeBSD"; then
11152             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11153         fi
11154         if test "$_os" = "Linux"; then
11155             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11156         fi
11157         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11158             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11159     else
11160         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11161     fi
11162 else
11163     USE_XINERAMA=
11164     XINERAMA_LINK=none
11165     AC_MSG_RESULT([no])
11167 AC_SUBST(USE_XINERAMA)
11168 AC_SUBST(XINERAMA_LINK)
11170 dnl ===================================================================
11171 dnl Test whether to build cairo or rely on the system version
11172 dnl ===================================================================
11174 if test "$USING_X11" = TRUE; then
11175     # Used in vcl/Library_vclplug_gen.mk
11176     test_cairo=yes
11179 if test "$test_cairo" = "yes"; then
11180     AC_MSG_CHECKING([whether to use the system cairo])
11182     : ${with_system_cairo:=$with_system_libs}
11183     if test "$with_system_cairo" = "yes"; then
11184         SYSTEM_CAIRO=TRUE
11185         AC_MSG_RESULT([yes])
11187         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11188         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11189         FilterLibs "${CAIRO_LIBS}"
11190         CAIRO_LIBS="${filteredlibs}"
11192         if test "$test_xrender" = "yes"; then
11193             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11194             AC_LANG_PUSH([C])
11195             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11196 #ifdef PictStandardA8
11197 #else
11198       return fail;
11199 #endif
11200 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11202             AC_LANG_POP([C])
11203         fi
11204     else
11205         SYSTEM_CAIRO=
11206         AC_MSG_RESULT([no])
11208         BUILD_TYPE="$BUILD_TYPE CAIRO"
11209     fi
11212 AC_SUBST(SYSTEM_CAIRO)
11213 AC_SUBST(CAIRO_CFLAGS)
11214 AC_SUBST(CAIRO_LIBS)
11216 dnl ===================================================================
11217 dnl Test whether to use avahi
11218 dnl ===================================================================
11219 if test "$_os" = "WINNT"; then
11220     # Windows uses bundled mDNSResponder
11221     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11222 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11223     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11224                       [ENABLE_AVAHI="TRUE"])
11225     AC_DEFINE(HAVE_FEATURE_AVAHI)
11226     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11227     FilterLibs "${AVAHI_LIBS}"
11228     AVAHI_LIBS="${filteredlibs}"
11231 AC_SUBST(ENABLE_AVAHI)
11232 AC_SUBST(AVAHI_CFLAGS)
11233 AC_SUBST(AVAHI_LIBS)
11235 dnl ===================================================================
11236 dnl Test whether to use liblangtag
11237 dnl ===================================================================
11238 SYSTEM_LIBLANGTAG=
11239 AC_MSG_CHECKING([whether to use system liblangtag])
11240 if test "$with_system_liblangtag" = yes; then
11241     SYSTEM_LIBLANGTAG=TRUE
11242     AC_MSG_RESULT([yes])
11243     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11244     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11245     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11246     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11247     FilterLibs "${LIBLANGTAG_LIBS}"
11248     LIBLANGTAG_LIBS="${filteredlibs}"
11249 else
11250     SYSTEM_LIBLANGTAG=
11251     AC_MSG_RESULT([no])
11252     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11253     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/langtag"
11254     if test "$COM" = "MSC"; then
11255         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11256     else
11257         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11258     fi
11260 AC_SUBST(SYSTEM_LIBLANGTAG)
11261 AC_SUBST(LIBLANGTAG_CFLAGS)
11262 AC_SUBST(LIBLANGTAG_LIBS)
11264 dnl ===================================================================
11265 dnl Test whether to build libpng or rely on the system version
11266 dnl ===================================================================
11268 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11270 dnl ===================================================================
11271 dnl Check for runtime JVM search path
11272 dnl ===================================================================
11273 if test "$ENABLE_JAVA" != ""; then
11274     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11275     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11276         AC_MSG_RESULT([yes])
11277         if ! test -d "$with_jvm_path"; then
11278             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11279         fi
11280         if ! test -d "$with_jvm_path"jvm; then
11281             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11282         fi
11283         JVM_ONE_PATH_CHECK="$with_jvm_path"
11284         AC_SUBST(JVM_ONE_PATH_CHECK)
11285     else
11286         AC_MSG_RESULT([no])
11287     fi
11290 dnl ===================================================================
11291 dnl Test for the presence of Ant and that it works
11292 dnl ===================================================================
11294 if test "$ENABLE_JAVA" != ""; then
11295     ANT_HOME=; export ANT_HOME
11296     WITH_ANT_HOME=; export WITH_ANT_HOME
11297     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11298         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11299             if test "$_os" = "WINNT"; then
11300                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11301             else
11302                 with_ant_home="$LODE_HOME/opt/ant"
11303             fi
11304         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11305             with_ant_home="$LODE_HOME/opt/ant"
11306         fi
11307     fi
11308     if test -z "$with_ant_home"; then
11309         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11310     else
11311         if test "$_os" = "WINNT"; then
11312             # AC_PATH_PROGS needs unix path
11313             with_ant_home=`cygpath -u "$with_ant_home"`
11314         fi
11315         AbsolutePath "$with_ant_home"
11316         with_ant_home=$absolute_path
11317         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11318         WITH_ANT_HOME=$with_ant_home
11319         ANT_HOME=$with_ant_home
11320     fi
11322     if test -z "$ANT"; then
11323         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11324     else
11325         # resolve relative or absolute symlink
11326         while test -h "$ANT"; do
11327             a_cwd=`pwd`
11328             a_basename=`basename "$ANT"`
11329             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11330             cd "`dirname "$ANT"`"
11331             cd "`dirname "$a_script"`"
11332             ANT="`pwd`"/"`basename "$a_script"`"
11333             cd "$a_cwd"
11334         done
11336         AC_MSG_CHECKING([if $ANT works])
11337         cat > conftest.java << EOF
11338         public class conftest {
11339             int testmethod(int a, int b) {
11340                     return a + b;
11341             }
11342         }
11345         cat > conftest.xml << EOF
11346         <project name="conftest" default="conftest">
11347         <target name="conftest">
11348             <javac srcdir="." includes="conftest.java">
11349             </javac>
11350         </target>
11351         </project>
11354         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11355         if test $? = 0 -a -f ./conftest.class; then
11356             AC_MSG_RESULT([Ant works])
11357             if test -z "$WITH_ANT_HOME"; then
11358                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11359                 if test -z "$ANT_HOME"; then
11360                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11361                 fi
11362             else
11363                 ANT_HOME="$WITH_ANT_HOME"
11364             fi
11365         else
11366             echo "configure: Ant test failed" >&5
11367             cat conftest.java >&5
11368             cat conftest.xml >&5
11369             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11370         fi
11371         rm -f conftest* core core.* *.core
11372     fi
11373     if test -z "$ANT_HOME"; then
11374         ANT_HOME="NO_ANT_HOME"
11375     else
11376         PathFormat "$ANT_HOME"
11377         ANT_HOME="$formatted_path"
11378         PathFormat "$ANT"
11379         ANT="$formatted_path"
11380     fi
11381     AC_SUBST(ANT_HOME)
11382     AC_SUBST(ANT)
11384     dnl Checking for ant.jar
11385     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11386         AC_MSG_CHECKING([Ant lib directory])
11387         if test -f $ANT_HOME/lib/ant.jar; then
11388             ANT_LIB="$ANT_HOME/lib"
11389         else
11390             if test -f $ANT_HOME/ant.jar; then
11391                 ANT_LIB="$ANT_HOME"
11392             else
11393                 if test -f /usr/share/java/ant.jar; then
11394                     ANT_LIB=/usr/share/java
11395                 else
11396                     if test -f /usr/share/ant-core/lib/ant.jar; then
11397                         ANT_LIB=/usr/share/ant-core/lib
11398                     else
11399                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11400                             ANT_LIB="$ANT_HOME/lib/ant"
11401                         else
11402                             if test -f /usr/share/lib/ant/ant.jar; then
11403                                 ANT_LIB=/usr/share/lib/ant
11404                             else
11405                                 AC_MSG_ERROR([Ant libraries not found!])
11406                             fi
11407                         fi
11408                     fi
11409                 fi
11410             fi
11411         fi
11412         PathFormat "$ANT_LIB"
11413         ANT_LIB="$formatted_path"
11414         AC_MSG_RESULT([Ant lib directory found.])
11415     fi
11416     AC_SUBST(ANT_LIB)
11418     ant_minver=1.6.0
11419     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11421     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11422     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11423     ant_version_major=`echo $ant_version | cut -d. -f1`
11424     ant_version_minor=`echo $ant_version | cut -d. -f2`
11425     echo "configure: ant_version $ant_version " >&5
11426     echo "configure: ant_version_major $ant_version_major " >&5
11427     echo "configure: ant_version_minor $ant_version_minor " >&5
11428     if test "$ant_version_major" -ge "2"; then
11429         AC_MSG_RESULT([yes, $ant_version])
11430     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11431         AC_MSG_RESULT([yes, $ant_version])
11432     else
11433         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11434     fi
11436     rm -f conftest* core core.* *.core
11439 OOO_JUNIT_JAR=
11440 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11441     AC_MSG_CHECKING([for JUnit 4])
11442     if test "$with_junit" = "yes"; then
11443         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11444             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11445         elif test -e /usr/share/java/junit4.jar; then
11446             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11447         else
11448            if test -e /usr/share/lib/java/junit.jar; then
11449               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11450            else
11451               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11452            fi
11453         fi
11454     else
11455         OOO_JUNIT_JAR=$with_junit
11456     fi
11457     if test "$_os" = "WINNT"; then
11458         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11459     fi
11460     printf 'import org.junit.Before;' > conftest.java
11461     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11462         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11463     else
11464         AC_MSG_ERROR(
11465 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11466  specify its pathname via --with-junit=..., or disable it via --without-junit])
11467     fi
11468     rm -f conftest.class conftest.java
11469     if test $OOO_JUNIT_JAR != ""; then
11470     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11471     fi
11473 AC_SUBST(OOO_JUNIT_JAR)
11475 HAMCREST_JAR=
11476 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11477     AC_MSG_CHECKING([for included Hamcrest])
11478     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11479     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11480         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11481     else
11482         AC_MSG_RESULT([Not included])
11483         AC_MSG_CHECKING([for standalone hamcrest jar.])
11484         if test "$with_hamcrest" = "yes"; then
11485             if test -e /usr/share/lib/java/hamcrest.jar; then
11486                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11487             elif test -e /usr/share/java/hamcrest/core.jar; then
11488                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11489             else
11490                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11491             fi
11492         else
11493             HAMCREST_JAR=$with_hamcrest
11494         fi
11495         if test "$_os" = "WINNT"; then
11496             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11497         fi
11498         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11499             AC_MSG_RESULT([$HAMCREST_JAR])
11500         else
11501             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),
11502                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11503         fi
11504     fi
11505     rm -f conftest.class conftest.java
11507 AC_SUBST(HAMCREST_JAR)
11510 AC_SUBST(SCPDEFS)
11513 # check for wget and curl
11515 WGET=
11516 CURL=
11518 if test "$enable_fetch_external" != "no"; then
11520 CURL=`which curl 2>/dev/null`
11522 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11523     # wget new enough?
11524     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11525     if test $? -eq 0; then
11526         WGET=$i
11527         break
11528     fi
11529 done
11531 if test -z "$WGET" -a -z "$CURL"; then
11532     AC_MSG_ERROR([neither wget nor curl found!])
11537 AC_SUBST(WGET)
11538 AC_SUBST(CURL)
11541 # check for sha256sum
11543 SHA256SUM=
11545 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11546     eval "$i -a 256 --version" > /dev/null 2>&1
11547     ret=$?
11548     if test $ret -eq 0; then
11549         SHA256SUM="$i -a 256"
11550         break
11551     fi
11552 done
11554 if test -z "$SHA256SUM"; then
11555     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11556         eval "$i --version" > /dev/null 2>&1
11557         ret=$?
11558         if test $ret -eq 0; then
11559             SHA256SUM=$i
11560             break
11561         fi
11562     done
11565 if test -z "$SHA256SUM"; then
11566     AC_MSG_ERROR([no sha256sum found!])
11569 AC_SUBST(SHA256SUM)
11571 dnl ===================================================================
11572 dnl Dealing with l10n options
11573 dnl ===================================================================
11574 AC_MSG_CHECKING([which languages to be built])
11575 # get list of all languages
11576 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11577 # the sed command does the following:
11578 #   + if a line ends with a backslash, append the next line to it
11579 #   + adds " on the beginning of the value (after =)
11580 #   + adds " at the end of the value
11581 #   + removes en-US; we want to put it on the beginning
11582 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11583 [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)]
11584 ALL_LANGS="en-US $completelangiso"
11585 # check the configured localizations
11586 WITH_LANG="$with_lang"
11587 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11588     AC_MSG_RESULT([en-US])
11589 else
11590     AC_MSG_RESULT([$WITH_LANG])
11591     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11593 # check that the list is valid
11594 for lang in $WITH_LANG; do
11595     test "$lang" = "ALL" && continue
11596     # need to check for the exact string, so add space before and after the list of all languages
11597     for vl in $ALL_LANGS; do
11598         if test "$vl" = "$lang"; then
11599            break
11600         fi
11601     done
11602     if test "$vl" != "$lang"; then
11603         # if you're reading this - you prolly quoted your languages remove the quotes ...
11604         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11605     fi
11606 done
11607 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11608     echo $WITH_LANG | grep -q en-US
11609     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11611 # list with substituted ALL
11612 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11613 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11614 test "$WITH_LANG" = "en-US" && WITH_LANG=
11615 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11616     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11617     ALL_LANGS=`echo $ALL_LANGS qtz`
11619 AC_SUBST(ALL_LANGS)
11620 AC_SUBST(WITH_LANG)
11621 AC_SUBST(WITH_LANG_LIST)
11622 AC_SUBST(GIT_NEEDED_SUBMODULES)
11624 WITH_POOR_HELP_LOCALIZATIONS=
11625 if test -d "$SRC_ROOT/translations/source"; then
11626     for l in `ls -1 $SRC_ROOT/translations/source`; do
11627         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11628             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11629         fi
11630     done
11632 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11634 if test -n "$with_locales"; then
11635     WITH_LOCALES="$with_locales"
11637     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11638     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11639     # config_host/config_locales.h.in
11640     for locale in $WITH_LOCALES; do
11641         lang=${locale%_*}
11643         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
11645         case $lang in
11646         hi|mr*ne)
11647             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
11648             ;;
11649         bg|ru)
11650             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
11651             ;;
11652         esac
11653     done
11654 else
11655     AC_DEFINE(WITH_LOCALE_ALL)
11657 AC_SUBST(WITH_LOCALES)
11659 dnl git submodule update --reference
11660 dnl ===================================================================
11661 if test -n "${GIT_REFERENCE_SRC}"; then
11662     for repo in ${GIT_NEEDED_SUBMODULES}; do
11663         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11664             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11665         fi
11666     done
11668 AC_SUBST(GIT_REFERENCE_SRC)
11670 dnl git submodules linked dirs
11671 dnl ===================================================================
11672 if test -n "${GIT_LINK_SRC}"; then
11673     for repo in ${GIT_NEEDED_SUBMODULES}; do
11674         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
11675             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
11676         fi
11677     done
11679 AC_SUBST(GIT_LINK_SRC)
11681 dnl branding
11682 dnl ===================================================================
11683 AC_MSG_CHECKING([for alternative branding images directory])
11684 # initialize mapped arrays
11685 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
11686 brand_files="$BRAND_INTRO_IMAGES about.svg"
11688 if test -z "$with_branding" -o "$with_branding" = "no"; then
11689     AC_MSG_RESULT([none])
11690     DEFAULT_BRAND_IMAGES="$brand_files"
11691 else
11692     if ! test -d $with_branding ; then
11693         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
11694     else
11695         AC_MSG_RESULT([$with_branding])
11696         CUSTOM_BRAND_DIR="$with_branding"
11697         for lfile in $brand_files
11698         do
11699             if ! test -f $with_branding/$lfile ; then
11700                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
11701                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
11702             else
11703                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
11704             fi
11705         done
11706         check_for_progress="yes"
11707     fi
11709 AC_SUBST([BRAND_INTRO_IMAGES])
11710 AC_SUBST([CUSTOM_BRAND_DIR])
11711 AC_SUBST([CUSTOM_BRAND_IMAGES])
11712 AC_SUBST([DEFAULT_BRAND_IMAGES])
11715 AC_MSG_CHECKING([for 'intro' progress settings])
11716 PROGRESSBARCOLOR=
11717 PROGRESSSIZE=
11718 PROGRESSPOSITION=
11719 PROGRESSFRAMECOLOR=
11720 PROGRESSTEXTCOLOR=
11721 PROGRESSTEXTBASELINE=
11723 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
11724     source "$with_branding/progress.conf"
11725     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
11726 else
11727     AC_MSG_RESULT([none])
11730 AC_SUBST(PROGRESSBARCOLOR)
11731 AC_SUBST(PROGRESSSIZE)
11732 AC_SUBST(PROGRESSPOSITION)
11733 AC_SUBST(PROGRESSFRAMECOLOR)
11734 AC_SUBST(PROGRESSTEXTCOLOR)
11735 AC_SUBST(PROGRESSTEXTBASELINE)
11738 AC_MSG_CHECKING([for extra build ID])
11739 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
11740     EXTRA_BUILDID="$with_extra_buildid"
11742 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
11743 if test -n "$EXTRA_BUILDID" ; then
11744     AC_MSG_RESULT([$EXTRA_BUILDID])
11745 else
11746     AC_MSG_RESULT([not set])
11748 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
11750 OOO_VENDOR=
11751 AC_MSG_CHECKING([for vendor])
11752 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
11753     OOO_VENDOR="$USERNAME"
11755     if test -z "$OOO_VENDOR"; then
11756         OOO_VENDOR="$USER"
11757     fi
11759     if test -z "$OOO_VENDOR"; then
11760         OOO_VENDOR="`id -u -n`"
11761     fi
11763     AC_MSG_RESULT([not set, using $OOO_VENDOR])
11764 else
11765     OOO_VENDOR="$with_vendor"
11766     AC_MSG_RESULT([$OOO_VENDOR])
11768 AC_SUBST(OOO_VENDOR)
11770 if echo "$host_os" | grep -q linux-android ; then
11771     ANDROID_PACKAGE_NAME=
11772     AC_MSG_CHECKING([for Android package name])
11773     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
11774         if test -n "$ENABLE_DEBUG"; then
11775             # Default to the package name that makes ndk-gdb happy.
11776             ANDROID_PACKAGE_NAME="org.libreoffice"
11777         else
11778             ANDROID_PACKAGE_NAME="org.example.libreoffice"
11779         fi
11781         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
11782     else
11783         ANDROID_PACKAGE_NAME="$with_android_package_name"
11784         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
11785     fi
11786     AC_SUBST(ANDROID_PACKAGE_NAME)
11789 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
11790 if test "$with_compat_oowrappers" = "yes"; then
11791     WITH_COMPAT_OOWRAPPERS=TRUE
11792     AC_MSG_RESULT(yes)
11793 else
11794     WITH_COMPAT_OOWRAPPERS=
11795     AC_MSG_RESULT(no)
11797 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
11799 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
11800 AC_MSG_CHECKING([for install dirname])
11801 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
11802     INSTALLDIRNAME="$with_install_dirname"
11804 AC_MSG_RESULT([$INSTALLDIRNAME])
11805 AC_SUBST(INSTALLDIRNAME)
11807 AC_MSG_CHECKING([for prefix])
11808 test "x$prefix" = xNONE && prefix=$ac_default_prefix
11809 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
11810 PREFIXDIR="$prefix"
11811 AC_MSG_RESULT([$PREFIXDIR])
11812 AC_SUBST(PREFIXDIR)
11814 LIBDIR=[$(eval echo $(eval echo $libdir))]
11815 AC_SUBST(LIBDIR)
11817 DATADIR=[$(eval echo $(eval echo $datadir))]
11818 AC_SUBST(DATADIR)
11820 MANDIR=[$(eval echo $(eval echo $mandir))]
11821 AC_SUBST(MANDIR)
11823 DOCDIR=[$(eval echo $(eval echo $docdir))]
11824 AC_SUBST(DOCDIR)
11826 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
11827 AC_SUBST(INSTALLDIR)
11829 TESTINSTALLDIR="${BUILDDIR}/test-install"
11830 AC_SUBST(TESTINSTALLDIR)
11833 # ===================================================================
11834 # OAuth2 id and secrets
11835 # ===================================================================
11837 AC_MSG_CHECKING([for Google Drive client id and secret])
11838 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
11839 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
11840 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
11841     GDRIVE_CLIENT_ID="\"\""
11844 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
11845     GDRIVE_CLIENT_SECRET="\"\""
11848 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
11849     AC_MSG_RESULT([not set])
11850 else
11851     AC_MSG_RESULT([set])
11854 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
11855 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
11857 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
11858 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
11859 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
11860 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
11861     ALFRESCO_CLOUD_CLIENT_ID="\"\""
11864 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
11865     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
11868 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
11869     AC_MSG_RESULT([not set])
11870 else
11871     AC_MSG_RESULT([set])
11873 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
11874 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
11876 AC_MSG_CHECKING([for OneDrive client id and secret])
11877 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
11878 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
11879 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
11880     ONEDRIVE_CLIENT_ID="\"\""
11883 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
11884     ONEDRIVE_CLIENT_SECRET="\"\""
11887 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
11888     AC_MSG_RESULT([not set])
11889 else
11890     AC_MSG_RESULT([set])
11892 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
11893 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
11896 dnl ===================================================================
11897 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
11898 dnl --enable-dependency-tracking configure option
11899 dnl ===================================================================
11900 AC_MSG_CHECKING([whether to enable dependency tracking])
11901 if test "$enable_dependency_tracking" = "no"; then
11902     nodep=TRUE
11903     AC_MSG_RESULT([no])
11904 else
11905     AC_MSG_RESULT([yes])
11907 AC_SUBST(nodep)
11909 dnl ===================================================================
11910 dnl Number of CPUs to use during the build
11911 dnl ===================================================================
11912 AC_MSG_CHECKING([for number of processors to use])
11913 # plain --with-parallelism is just the default
11914 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
11915     if test "$with_parallelism" = "no"; then
11916         PARALLELISM=0
11917     else
11918         PARALLELISM=$with_parallelism
11919     fi
11920 else
11921     if test "$enable_icecream" = "yes"; then
11922         PARALLELISM="10"
11923     else
11924         case `uname -s` in
11926         Darwin|FreeBSD|NetBSD|OpenBSD)
11927             PARALLELISM=`sysctl -n hw.ncpu`
11928             ;;
11930         Linux)
11931             PARALLELISM=`getconf _NPROCESSORS_ONLN`
11932         ;;
11933         # what else than above does profit here *and* has /proc?
11934         *)
11935             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
11936             ;;
11937         esac
11939         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
11940         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
11941     fi
11944 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
11945     if test -z "$with_parallelism"; then
11946             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
11947             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
11948             PARALLELISM="1"
11949     else
11950         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."
11951     fi
11954 if test $PARALLELISM -eq 0; then
11955     AC_MSG_RESULT([explicit make -j option needed])
11956 else
11957     AC_MSG_RESULT([$PARALLELISM])
11959 AC_SUBST(PARALLELISM)
11961 IWYU_PATH="$with_iwyu"
11962 AC_SUBST(IWYU_PATH)
11963 if test ! -z "$IWYU_PATH"; then
11964     if test ! -f "$IWYU_PATH"; then
11965         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
11966     fi
11970 # Set up ILIB for MSVC build
11972 ILIB1=
11973 if test "$build_os" = "cygwin"; then
11974     ILIB="."
11975     if test -n "$JAVA_HOME"; then
11976         ILIB="$ILIB;$JAVA_HOME/lib"
11977     fi
11978     ILIB1=-link
11979     if test "$BITNESS_OVERRIDE" = 64; then
11980         if test $vcnum = "150"; then
11981             ILIB="$ILIB;$COMPATH/lib/x64"
11982             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
11983         else
11984             ILIB="$ILIB;$COMPATH/lib/amd64"
11985             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
11986         fi
11987         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
11988         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
11989         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
11990             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
11991             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
11992         fi
11993         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
11994         ucrtlibpath_formatted=$formatted_path
11995         ILIB="$ILIB;$ucrtlibpath_formatted"
11996         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
11997     else
11998         if test $vcnum = "150"; then
11999             ILIB="$ILIB;$COMPATH/lib/x86"
12000             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12001         else
12002             ILIB="$ILIB;$COMPATH/lib"
12003             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12004         fi
12005         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12006         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12007         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12008             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12009             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12010         fi
12011         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12012         ucrtlibpath_formatted=$formatted_path
12013         ILIB="$ILIB;$ucrtlibpath_formatted"
12014         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12015     fi
12016     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12017         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12018     else
12019         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12020     fi
12022     AC_SUBST(ILIB)
12025 AC_MSG_CHECKING(
12026     [whether C++11 use of const_iterator in standard containers is broken])
12027 save_CXXFLAGS=$CXXFLAGS
12028 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12029 AC_LANG_PUSH([C++])
12030 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12031     #include <list>
12032     ]],[[
12033         std::list<int> l;
12034         l.erase(l.cbegin());
12035     ]])],
12036     [broken=no], [broken=yes])
12037 AC_LANG_POP([C++])
12038 CXXFLAGS=$save_CXXFLAGS
12039 AC_MSG_RESULT([$broken])
12040 if test "$broken" = yes; then
12041     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12045 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12046 save_CXXFLAGS=$CXXFLAGS
12047 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12048 save_LIBS=$LIBS
12049 if test -n "$ILIB1"; then
12050     LIBS="$LIBS $ILIB1"
12052 AC_LANG_PUSH([C++])
12053 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12054     // Exit with failure if the static initializer_list is stored on the
12055     // stack (as done by Clang < 3.4):
12056     #include <initializer_list>
12057     struct S {};
12058     bool g(void const * p1, void const * p2) {
12059         int n;
12060         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12061     }
12062     bool f(void const * p1) {
12063         static std::initializer_list<S> s { S() };
12064         return g(p1, s.begin());
12065     }
12066     ]],[[
12067         int n;
12068         return f(&n) ? 0 : 1;
12069     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12070 AC_LANG_POP([C++])
12071 LIBS=$save_LIBS
12072 CXXFLAGS=$save_CXXFLAGS
12073 AC_MSG_RESULT([$broken])
12074 if test "$broken" = yes -a "$_os" != "iOS"; then
12075     AC_MSG_ERROR([working support for static initializer_list needed])
12079 # ===================================================================
12080 # Creating bigger shared library to link against
12081 # ===================================================================
12082 AC_MSG_CHECKING([whether to create huge library])
12083 MERGELIBS=
12085 if test $_os = iOS -o $_os = Android; then
12086     # Never any point in mergelibs for these as we build just static
12087     # libraries anyway...
12088     enable_mergelibs=no
12091 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12092     if test $_os != Linux -a $_os != WINNT; then
12093         add_warning "--enable-mergelibs is not tested for this platform"
12094     fi
12095     MERGELIBS="TRUE"
12096     AC_MSG_RESULT([yes])
12097 else
12098     AC_MSG_RESULT([no])
12100 AC_SUBST([MERGELIBS])
12102 dnl ===================================================================
12103 dnl icerun is a wrapper that stops us spawning tens of processes
12104 dnl locally - for tools that can't be executed on the compile cluster
12105 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12106 dnl ===================================================================
12107 AC_MSG_CHECKING([whether to use icerun wrapper])
12108 ICECREAM_RUN=
12109 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12110     ICECREAM_RUN=icerun
12111     AC_MSG_RESULT([yes])
12112 else
12113     AC_MSG_RESULT([no])
12115 AC_SUBST(ICECREAM_RUN)
12117 dnl ===================================================================
12118 dnl Setup the ICECC_VERSION for the build the same way it was set for
12119 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12120 dnl ===================================================================
12121 x_ICECC_VERSION=[\#]
12122 if test -n "$ICECC_VERSION" ; then
12123     x_ICECC_VERSION=
12125 AC_SUBST(x_ICECC_VERSION)
12126 AC_SUBST(ICECC_VERSION)
12128 dnl ===================================================================
12130 AC_MSG_CHECKING([MPL subset])
12131 MPL_SUBSET=
12133 if test "$enable_mpl_subset" = "yes"; then
12134     warn_report=false
12135     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12136         warn_report=true
12137     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12138         warn_report=true
12139     fi
12140     if test "$warn_report" = "true"; then
12141         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12142     fi
12143     if test "x$enable_postgresql_sdbc" != "xno"; then
12144         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12145     fi
12146     if test "$enable_lotuswordpro" = "yes"; then
12147         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12148     fi
12149     if test "$WITH_WEBDAV" = "neon"; then
12150         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12151     fi
12152     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12153         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12154     fi
12155     if test -n "$ENABLE_PDFIMPORT"; then
12156         if test "x$SYSTEM_POPPLER" = "x"; then
12157             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12158         fi
12159     fi
12160     # cf. m4/libo_check_extension.m4
12161     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12162         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12163     fi
12164     for theme in $WITH_THEMES; do
12165         case $theme in
12166         breeze|crystal|default|hicontrast|oxygen|sifr)
12167             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12168         *) : ;;
12169         esac
12170     done
12172     ENABLE_OPENGL_TRANSITIONS=
12174     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12175         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12176     fi
12178     MPL_SUBSET="TRUE"
12179     AC_DEFINE(MPL_HAVE_SUBSET)
12180     AC_MSG_RESULT([only])
12181 else
12182     AC_MSG_RESULT([no restrictions])
12184 AC_SUBST(MPL_SUBSET)
12186 dnl ===================================================================
12188 AC_MSG_CHECKING([formula logger])
12189 ENABLE_FORMULA_LOGGER=
12191 if test "x$enable_formula_logger" = "xyes"; then
12192     AC_MSG_RESULT([yes])
12193     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12194     ENABLE_FORMULA_LOGGER=TRUE
12195 elif test -n "$ENABLE_DBGUTIL" ; then
12196     AC_MSG_RESULT([yes])
12197     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12198     ENABLE_FORMULA_LOGGER=TRUE
12199 else
12200     AC_MSG_RESULT([no])
12203 AC_SUBST(ENABLE_FORMULA_LOGGER)
12205 dnl ===================================================================
12206 dnl Setting up the environment.
12207 dnl ===================================================================
12208 AC_MSG_NOTICE([setting up the build environment variables...])
12210 AC_SUBST(COMPATH)
12212 if test "$build_os" = "cygwin"; then
12213     if test -d "$COMPATH/atlmfc/lib"; then
12214         ATL_LIB="$COMPATH/atlmfc/lib"
12215         ATL_INCLUDE="$COMPATH/atlmfc/include"
12216     else
12217         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12218         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12219     fi
12220     if test "$BITNESS_OVERRIDE" = 64; then
12221         if test $VCVER = "150"; then
12222             ATL_LIB="$ATL_LIB/x64"
12223         else
12224             ATL_LIB="$ATL_LIB/amd64"
12225         fi
12226     else
12227         if test $VCVER = "150"; then
12228             ATL_LIB="$ATL_LIB/x86"
12229         fi
12230     fi
12231     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12232     PathFormat "/usr/bin/find.exe"
12233     FIND="$formatted_path"
12234     PathFormat "/usr/bin/sort.exe"
12235     SORT="$formatted_path"
12236     PathFormat "/usr/bin/grep.exe"
12237     WIN_GREP="$formatted_path"
12238     PathFormat "/usr/bin/ls.exe"
12239     WIN_LS="$formatted_path"
12240     PathFormat "/usr/bin/touch.exe"
12241     WIN_TOUCH="$formatted_path"
12242 else
12243     FIND=find
12244     SORT=sort
12247 AC_SUBST(ATL_INCLUDE)
12248 AC_SUBST(ATL_LIB)
12249 AC_SUBST(FIND)
12250 AC_SUBST(SORT)
12251 AC_SUBST(WIN_GREP)
12252 AC_SUBST(WIN_LS)
12253 AC_SUBST(WIN_TOUCH)
12255 AC_SUBST(BUILD_TYPE)
12257 AC_SUBST(SOLARINC)
12259 PathFormat "$PERL"
12260 PERL="$formatted_path"
12261 AC_SUBST(PERL)
12263 if test -n "$TMPDIR"; then
12264     TEMP_DIRECTORY="$TMPDIR"
12265 else
12266     TEMP_DIRECTORY="/tmp"
12268 if test "$build_os" = "cygwin"; then
12269     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12271 AC_SUBST(TEMP_DIRECTORY)
12273 # setup the PATH for the environment
12274 if test -n "$LO_PATH_FOR_BUILD"; then
12275     LO_PATH="$LO_PATH_FOR_BUILD"
12276 else
12277     LO_PATH="$PATH"
12279     case "$host_os" in
12281     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12282         if test "$ENABLE_JAVA" != ""; then
12283             pathmunge "$JAVA_HOME/bin" "after"
12284         fi
12285         ;;
12287     cygwin*)
12288         # Win32 make needs native paths
12289         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12290             LO_PATH=`cygpath -p -m "$PATH"`
12291         fi
12292         if test "$BITNESS_OVERRIDE" = 64; then
12293             # needed for msi packaging
12294             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12295         fi
12296         # .NET 4.6 and higher don't have bin directory
12297         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12298             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12299         fi
12300         pathmunge "$ASM_HOME" "before"
12301         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12302         pathmunge "$CSC_PATH" "before"
12303         pathmunge "$MIDL_PATH" "before"
12304         pathmunge "$AL_PATH" "before"
12305         pathmunge "$MSPDB_PATH" "before"
12306         if test -n "$MSBUILD_PATH" ; then
12307             pathmunge "$MSBUILD_PATH" "before"
12308         fi
12309         if test "$BITNESS_OVERRIDE" = 64; then
12310             pathmunge "$COMPATH/bin/amd64" "before"
12311             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12312         else
12313             pathmunge "$COMPATH/bin" "before"
12314             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12315         fi
12316         if test "$ENABLE_JAVA" != ""; then
12317             if test -d "$JAVA_HOME/jre/bin/client"; then
12318                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12319             fi
12320             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12321                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12322             fi
12323             pathmunge "$JAVA_HOME/bin" "before"
12324         fi
12325         ;;
12327     solaris*)
12328         pathmunge "/usr/css/bin" "before"
12329         if test "$ENABLE_JAVA" != ""; then
12330             pathmunge "$JAVA_HOME/bin" "after"
12331         fi
12332         ;;
12333     esac
12336 AC_SUBST(LO_PATH)
12338 libo_FUZZ_SUMMARY
12340 # Generate a configuration sha256 we can use for deps
12341 if test -f config_host.mk; then
12342     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12344 if test -f config_host_lang.mk; then
12345     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12348 CFLAGS=$my_original_CFLAGS
12349 CXXFLAGS=$my_original_CXXFLAGS
12350 CPPFLAGS=$my_original_CPPFLAGS
12352 AC_CONFIG_FILES([config_host.mk
12353                  config_host_lang.mk
12354                  Makefile
12355                  lo.xcent
12356                  bin/bffvalidator.sh
12357                  bin/odfvalidator.sh
12358                  bin/officeotron.sh
12359                  instsetoo_native/util/openoffice.lst
12360                  sysui/desktop/macosx/Info.plist
12361                  ios/lo.xcconfig])
12362 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12363 AC_CONFIG_HEADERS([config_host/config_clang.h])
12364 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12365 AC_CONFIG_HEADERS([config_host/config_eot.h])
12366 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12367 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12368 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12369 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12370 AC_CONFIG_HEADERS([config_host/config_features.h])
12371 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12372 AC_CONFIG_HEADERS([config_host/config_folders.h])
12373 AC_CONFIG_HEADERS([config_host/config_gio.h])
12374 AC_CONFIG_HEADERS([config_host/config_global.h])
12375 AC_CONFIG_HEADERS([config_host/config_java.h])
12376 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12377 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12378 AC_CONFIG_HEADERS([config_host/config_locales.h])
12379 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12380 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12381 AC_CONFIG_HEADERS([config_host/config_oox.h])
12382 AC_CONFIG_HEADERS([config_host/config_options.h])
12383 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12384 AC_CONFIG_HEADERS([config_host/config_test.h])
12385 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12386 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12387 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12388 AC_CONFIG_HEADERS([config_host/config_version.h])
12389 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12390 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12391 AC_CONFIG_HEADERS([config_host/config_python.h])
12392 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12393 AC_OUTPUT
12395 if test "$CROSS_COMPILING" = TRUE; then
12396     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12399 # touch the config timestamp file
12400 if test ! -f config_host.mk.stamp; then
12401     echo > config_host.mk.stamp
12402 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12403     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12404 else
12405     echo > config_host.mk.stamp
12408 # touch the config lang timestamp file
12409 if test ! -f config_host_lang.mk.stamp; then
12410     echo > config_host_lang.mk.stamp
12411 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12412     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12413 else
12414     echo > config_host_lang.mk.stamp
12418 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12420 cat << _EOS
12421 ****************************************************************************
12422 WARNING:
12423 Your make version is known to be horribly slow, and hard to debug
12424 problems with. To get a reasonably functional make please do:
12426 to install a pre-compiled binary make for Win32
12428  mkdir -p /opt/lo/bin
12429  cd /opt/lo/bin
12430  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12431  cp make-85047eb-msvc.exe make
12432  chmod +x make
12434 to install from source:
12435 place yourself in a working directory of you choice.
12437  git clone git://git.savannah.gnu.org/make.git
12439  [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"]
12440  set PATH=%PATH%;C:\Cygwin\bin
12441  [or Cygwin64, if that is what you have]
12442  cd path-to-make-repo-you-cloned-above
12443  build_w32.bat --without-guile
12445 should result in a WinRel/gnumake.exe.
12446 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12448 Then re-run autogen.sh
12450 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12451 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12453 _EOS
12456 cat << _EOF
12457 ****************************************************************************
12459 To build, run:
12460 $GNUMAKE
12462 To view some help, run:
12463 $GNUMAKE help
12465 _EOF
12467 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12468     cat << _EOF
12469 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12470 _EOF
12472     if test $_os = Darwin; then
12473         echo open instdir/$PRODUCTNAME.app
12474     else
12475         echo instdir/program/soffice
12476     fi
12477     cat << _EOF
12479 If you want to run the smoketest, run:
12480 $GNUMAKE check
12482 _EOF
12485 if test -f warn; then
12486     cat warn
12487     rm warn
12490 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: