bump product version to 5.3.6.1
[LibreOffice.git] / configure.ac
blob6c59f3215bfd6a86bebdf191050d9bd06c60640e
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argumemnt to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[5.3.6.1],[],[],[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 an rerun])
299     fi
302 AC_SUBST(SRC_ROOT)
303 AC_SUBST(BUILDDIR)
304 AC_SUBST(x_Cygwin)
305 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
306 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
308 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
309     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
312 # need sed in os checks...
313 AC_PATH_PROGS(SED, sed)
314 if test -z "$SED"; then
315     AC_MSG_ERROR([install sed to run this script])
318 # Set the ENABLE_LTO variable
319 # ===================================================================
320 AC_MSG_CHECKING([whether to use link-time optimization])
321 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
322     ENABLE_LTO="TRUE"
323     AC_MSG_RESULT([yes])
324     AC_DEFINE(STATIC_LINKING)
325 else
326     ENABLE_LTO=""
327     AC_MSG_RESULT([no])
329 AC_SUBST(ENABLE_LTO)
331 dnl ===================================================================
332 dnl When building for Android, --with-android-ndk,
333 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
334 dnl mandatory
335 dnl ===================================================================
337 AC_ARG_WITH(android-ndk,
338     AS_HELP_STRING([--with-android-ndk],
339         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
342 AC_ARG_WITH(android-ndk-toolchain-version,
343     AS_HELP_STRING([--with-android-ndk-toolchain-version],
344         [Specify which toolchain version to use, of those present in the
345         Android NDK you are using. The default is 4.9 currently.]), ,)
347 AC_ARG_WITH(android-sdk,
348     AS_HELP_STRING([--with-android-sdk],
349         [Specify location of the Android SDK. Mandatory when building for Android,
350         or when building the Impress Remote Android app.]),
353 ANDROID_NDK_HOME=
354 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
355     with_android_ndk="$SRC_ROOT/external/android-ndk"
357 if test -n "$with_android_ndk"; then
358     ANDROID_NDK_HOME=$with_android_ndk
360     # Set up a lot of pre-canned defaults
362     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
363         if test ! -f $ANDROID_NDK_HOME/source.properties; then
364             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
365         fi
366         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
367     else
368         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
369     fi
370     if test -z "$ANDROID_NDK_VERSION";  then
371         AC_MSG_ERROR([Failed to determine android NDK version. Please check your installation.])
372     fi
373     case $ANDROID_NDK_VERSION in
374     r9*|r10*)
375         ;;
376     11.1.*|12.1.*|13.1.*)
377         ;;
378     *)
379         AC_MSG_WARN([Untested android NDK version $ANDROID_NDK_VERSION, only versions r9* til 13.1.* have been used successfully. Proceed at your own risk.])
380         add_warning "Untested android NDK version $ANDROID_NDK_VERSION, only versions r9* til 13.1.* have been used successfully. Proceed at your own risk."
381         ;;
382     esac
384     if test $host_cpu = arm; then
385         android_cpu=arm
386         android_platform_prefix=$android_cpu-linux-androideabi
387     elif test $host_cpu = aarch64; then
388         android_cpu=aarch64
389         android_platform_prefix=$android_cpu-linux-android
390     elif test $host_cpu = mips; then
391         android_cpu=mips
392         android_platform_prefix=$android_cpu-linux-androideabi
393     else
394         # host_cpu is something like "i386" or "i686" I guess, NDK uses
395         # "x86" in some contexts
396         android_cpu=x86
397         android_platform_prefix=$android_cpu
398     fi
400     if test -z "$with_android_ndk_toolchain_version"; then
401         # Default to gcc 4.9
402         with_android_ndk_toolchain_version=4.9
403     fi
405     case "$with_android_ndk_toolchain_version" in
406     4.6|4.7|4.8|4.9)
407         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
408         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
409         ;;
410     clang3.3|clang3.4)
411         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
412         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
413         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
414         ANDROID_USING_CLANG=true
415         ;;
416     *)
417         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
418     esac
420     if test ! -d $ANDROID_BINUTILS_DIR; then
421         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
422     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
423         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
424     fi
426     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
427     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
428     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
429     # manage to link the (app-specific) single huge .so that is built for the app in
430     # android/source/ if there is debug information in a significant part of the object files.
431     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
432     # all objects have been built with debug information.)
433     toolchain_system='*'
434     case $build_os in
435     linux-gnu*)
436         ndk_build_os=linux
437         ;;
438     darwin*)
439         ndk_build_os=darwin
440         ;;
441     *)
442         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
443         ;;
444     esac
446     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
447     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
448     if test $build_cpu = x86_64; then
449         if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
450             ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
451         fi
452         if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
453             ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
454         fi
455     fi
456     ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
458     # This stays empty if there is just one version of the toolchain in the NDK
459     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
460     if test ! -d "$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/libs" ; then
461         # nope, won't work if empty...
462         # as is the case when using the ndk-bundle as installed with android studio
463         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
464         if test -n "$ANDROID_USING_CLANG"; then
465             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
466         fi
467     fi
469     ANDROID_API_LEVEL=15
470     if test $host_cpu = arm; then
471         android_gnu_prefix=arm-linux-androideabi
472     elif test $host_cpu = aarch64; then
473         android_gnu_prefix=aarch64-linux-android
474         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
475         ANDROID_API_LEVEL=L
476     elif test $host_cpu = mips; then
477         android_gnu_prefix=mipsel-linux-android
478     elif test $ANDROID_NDK_VERSION = r8; then
479         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
480         android_gnu_prefix=i686-android-linux
481     else
482         android_gnu_prefix=i686-linux-android
483     fi
485     ANDROID_ARCH=$android_cpu
486     if test $host_cpu = arm; then
487         ANDROID_APP_ABI=armeabi-v7a
488         if test -n "$ANDROID_USING_CLANG"; then
489             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
490             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
491             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
492         else
493             :
494         fi
495         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
496         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
497         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
498     elif test $host_cpu = aarch64; then
499         ANDROID_APP_ABI=arm64-v8a
500         ANDROID_ARCH=arm64
501     elif test $host_cpu = mips; then
502         ANDROID_APP_ABI=mips
503         ANDROIDCFLAGS=""
504     else # x86
505         ANDROID_APP_ABI=x86
506         ANDROIDCFLAGS="-march=atom"
507     fi
508     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
510     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
511     export PKG_CONFIG_LIBDIR="$ANDROID_BINUTILS_PREBUILT_ROOT/lib/pkgconfig"
513     if test -n "$ANDROID_USING_CLANG"; then
514         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
515     else
516         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
517     fi
519     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
520     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
521     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
522     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
523     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
524     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
526     # When using the 4.6 or newer toolchain, use the gold linker
527     case "$with_android_ndk_toolchain_version" in
528     4.[[6789]]*|[[56789]].*|clang*)
529         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
530             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
531         fi
532         ;;
533     esac
535     if test "$ENABLE_LTO" = TRUE; then
536         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
537         # $CC and $CXX when building external libraries
538          if test "$COM_IS_CLANG" = TRUE; then
539             ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
540         else
541             ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
542         fi
543     fi
545     # gdbserver can be in different locations
546     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
547         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
548     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
549         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
550     elif test $android_cpu = aarch64; then
551         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
552     else
553         AC_MSG_ERROR([Can't find gdbserver for your Android target])
554     fi
556     if test $host_cpu = arm; then
557         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"
558     elif test $host_cpu = mips; then
559         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"
560     else # x86
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/x86/include"
562     fi
564     if test -z "$CC"; then
565         case "$with_android_ndk_toolchain_version" in
566         4.*)
567             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
568             ;;
569         clang*)
570             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
571         esac
572     fi
573     if test -z "$CXX"; then
574         case "$with_android_ndk_toolchain_version" in
575         4.*)
576             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
577             ;;
578         clang*)
579             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
580             ;;
581         esac
582     fi
584     # remember to download the ownCloud Android library later
585     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
587 AC_SUBST(ANDROID_NDK_GDBSERVER)
588 AC_SUBST(ANDROID_APP_ABI)
590 dnl ===================================================================
591 dnl --with-android-sdk
592 dnl ===================================================================
593 ANDROID_SDK_HOME=
594 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
595     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
597 if test -n "$with_android_sdk"; then
598     ANDROID_SDK_HOME=$with_android_sdk
599     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
601 AC_SUBST(ANDROID_SDK_HOME)
603 dnl ===================================================================
604 dnl The following is a list of supported systems.
605 dnl Sequential to keep the logic very simple
606 dnl These values may be checked and reset later.
607 dnl ===================================================================
608 #defaults unless the os test overrides this:
609 test_randr=yes
610 test_xrender=yes
611 test_cups=yes
612 test_dbus=yes
613 test_fontconfig=yes
614 test_cairo=no
616 # Default values, as such probably valid just for Linux, set
617 # differently below just for Mac OSX,but at least better than
618 # hardcoding these as we used to do. Much of this is duplicated also
619 # in solenv for old build system and for gbuild, ideally we should
620 # perhaps define stuff like this only here in configure.ac?
622 LINKFLAGSSHL="-shared"
623 PICSWITCH="-fpic"
624 DLLPOST=".so"
626 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
628 INSTROOTSUFFIX=
629 SDKDIRNAME=sdk
631 case "$host_os" in
633 solaris*)
634     test_gtk=yes
635     build_gstreamer_1_0=yes
636     build_gstreamer_0_10=yes
637     test_tde=yes
638     test_freetype=yes
639     _os=SunOS
641     dnl ===========================================================
642     dnl Check whether we're using Solaris 10 - SPARC or Intel.
643     dnl ===========================================================
644     AC_MSG_CHECKING([the Solaris operating system release])
645     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
646     if test "$_os_release" -lt "10"; then
647         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
648     else
649         AC_MSG_RESULT([ok ($_os_release)])
650     fi
652     dnl Check whether we're using a SPARC or i386 processor
653     AC_MSG_CHECKING([the processor type])
654     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
655         AC_MSG_RESULT([ok ($host_cpu)])
656     else
657         AC_MSG_ERROR([only SPARC and i386 processors are supported])
658     fi
659     ;;
661 linux-gnu*|k*bsd*-gnu*)
662     test_gtk=yes
663     build_gstreamer_1_0=yes
664     build_gstreamer_0_10=yes
665     test_tde=yes
666     test_kde4=yes
667     test_freetype=yes
668     _os=Linux
669     ;;
671 gnu)
672     test_randr=no
673     test_xrender=no
674     _os=GNU
675      ;;
677 cygwin*|interix*|mingw32*)
679     # When building on Windows normally with MSVC under Cygwin,
680     # configure thinks that the host platform (the platform the
681     # built code will run on) is Cygwin, even if it obviously is
682     # Windows, which in Autoconf terminology is called
683     # "mingw32". (Which is misleading as MinGW is the name of the
684     # tool-chain, not an operating system.)
686     # Somewhat confusing, yes. But this configure script doesn't
687     # look at $host etc that much, it mostly uses its own $_os
688     # variable, set here in this case statement.
690     # When cross-compiling to Windows from Unix, the host platform
691     # is "mingw32" (because in that case it is the MinGW
692     # tool-chain that is used).
694     test_cups=no
695     test_dbus=no
696     test_randr=no
697     test_xrender=no
698     test_freetype=no
699     test_fontconfig=no
700     _os=WINNT
702     DLLPOST=".dll"
703     LINKFLAGSNOUNDEFS=
705     # If the host OS matches "mingw32*", that means we are using the
706     # MinGW cross-compiler, because we don't see the point in building
707     # LibreOffice using MinGW on Windows. If you want to build on
708     # Windows, use MSVC. If you want to use MinGW, surely you want to
709     # cross-compile (from Linux or some other Unix).
711     case "$host_os" in
712     mingw32*)
713         WITH_MINGW=yes
714         if test -z "$CC"; then
715             CC="$host_cpu-$host_vendor-$host_os-gcc"
716         fi
717         if test -z "$CXX"; then
718             CXX="$host_cpu-$host_vendor-$host_os-g++"
719         fi
720         ;;
721     esac
722     ;;
724 darwin*) # Mac OS X or iOS
725     test_gtk=yes
726     test_randr=no
727     test_xrender=no
728     test_freetype=no
729     test_fontconfig=no
730     test_dbus=no
731     if test "$host_cpu" = "arm"; then
732         _os=iOS
733         test_gtk=no
734         test_cups=no
735     else
736         _os=Darwin
737         if test -n "$LODE_HOME" ; then
738             mac_sanitize_path
739             AC_MSG_NOTICE([sanitized the PATH to $PATH])
740         fi
741         INSTROOTSUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app/Contents
742         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
743     fi
744     enable_systray=no
745     # See comment above the case "$host_os"
746     LINKFLAGSSHL="-dynamiclib -single_module"
748     # -fPIC is default
749     PICSWITCH=""
751     DLLPOST=".dylib"
753     # -undefined error is the default
754     LINKFLAGSNOUNDEFS=""
757 freebsd*)
758     test_gtk=yes
759     build_gstreamer_1_0=yes
760     build_gstreamer_0_10=yes
761     test_tde=yes
762     test_kde4=yes
763     test_freetype=yes
764     AC_MSG_CHECKING([the FreeBSD operating system release])
765     if test -n "$with_os_version"; then
766         OSVERSION="$with_os_version"
767     else
768         OSVERSION=`/sbin/sysctl -n kern.osreldate`
769     fi
770     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
771     AC_MSG_CHECKING([which thread library to use])
772     if test "$OSVERSION" -lt "500016"; then
773         PTHREAD_CFLAGS="-D_THREAD_SAFE"
774         PTHREAD_LIBS="-pthread"
775     elif test "$OSVERSION" -lt "502102"; then
776         PTHREAD_CFLAGS="-D_THREAD_SAFE"
777         PTHREAD_LIBS="-lc_r"
778     else
779         PTHREAD_CFLAGS=""
780         PTHREAD_LIBS="-pthread"
781     fi
782     AC_MSG_RESULT([$PTHREAD_LIBS])
783     _os=FreeBSD
784     ;;
786 *netbsd*)
787     test_gtk=yes
788     build_gstreamer_1_0=yes
789     build_gstreamer_0_10=yes
790     test_tde=no
791     test_kde4=yes
792     test_freetype=yes
793     PTHREAD_LIBS="-pthread -lpthread"
794     _os=NetBSD
795     ;;
797 aix*)
798     test_randr=no
799     test_freetype=yes
800     PTHREAD_LIBS=-pthread
801     _os=AIX
802     ;;
804 openbsd*)
805     test_gtk=yes
806     test_tde=yes
807     test_freetype=yes
808     PTHREAD_CFLAGS="-D_THREAD_SAFE"
809     PTHREAD_LIBS="-pthread"
810     _os=OpenBSD
811     ;;
813 dragonfly*)
814     test_gtk=yes
815     build_gstreamer_1_0=yes
816     build_gstreamer_0_10=yes
817     test_tde=yes
818     test_kde4=yes
819     test_freetype=yes
820     PTHREAD_LIBS="-pthread"
821     _os=DragonFly
822     ;;
824 linux-android*)
825     build_gstreamer_1_0=no
826     build_gstreamer_0_10=no
827     enable_lotuswordpro=no
828     enable_mpl_subset=yes
829     enable_coinmp=yes
830     enable_lpsolve=no
831     enable_report_builder=no
832     enable_odk=no
833     enable_postgresql_sdbc=no
834     enable_python=no
835     with_theme="tango"
836     test_cups=no
837     test_dbus=no
838     test_fontconfig=no
839     test_freetype=no
840     test_gtk=no
841     test_tde=no
842     test_kde4=no
843     test_randr=no
844     test_xrender=no
845     _os=Android
847     if test -z "$with_android_ndk"; then
848         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
849     fi
851     if test -z "$with_android_ndk_toolchain_version"; then
852         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
853     fi
855     # Verify that the NDK and SDK options are proper
856     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
857         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
858     fi
860     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
861     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
862     ;;
864 emscripten*)
865     build_gstreamer_1_0=no
866     build_gstreamer_0_10=no
867     enable_lotuswordpro=no
868     enable_mpl_subset=yes
869     enable_coinmp=yes
870     enable_lpsolve=no
871     enable_report_builder=no
872     with_theme="tango"
873     test_cups=no
874     test_dbus=no
875     test_fontconfig=no
876     test_freetype=no
877     test_gtk=no
878     test_tde=no
879     test_kde4=no
880     test_randr=no
881     test_xrender=no
882     _os=Emscripten
883     ;;
886     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
887     ;;
888 esac
890 if echo "$host_os" | grep -q linux-android ; then
891     if test -z "$with_android_sdk"; then
892         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
893     fi
895     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
896         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
897     fi
899     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
900     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
901         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
902                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
903                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
904         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
905         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
906         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
907     fi
908     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
909         AC_MSG_WARN([android support repository not found - install with
910                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
911                      to allow the build to download the specified version of the android support libraries])
912         add_warning "android support repository not found - install with"
913         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
914         add_warning "to allow the build to download the specified version of the android support libraries"
915     fi
918 if test "$_os" = "AIX"; then
919     AC_PATH_PROG(GAWK, gawk)
920     if test -z "$GAWK"; then
921         AC_MSG_ERROR([gawk not found in \$PATH])
922     fi
925 AC_SUBST(SDKDIRNAME)
927 AC_SUBST(WITH_MINGW)
928 AC_SUBST(PTHREAD_CFLAGS)
929 AC_SUBST(PTHREAD_LIBS)
931 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
932 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
933 dnl AC_PROG_CC internally.
934 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
935     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
936     save_CFLAGS=$CFLAGS
937     AC_PROG_CC
938     CFLAGS=$save_CFLAGS
941 if test $_os != "WINNT"; then
942     save_LIBS="$LIBS"
943     AC_SEARCH_LIBS([dlsym], [dl],
944         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
945         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
946     LIBS="$save_LIBS"
948 AC_SUBST(DLOPEN_LIBS)
950 ###############################################################################
951 # Extensions switches --enable/--disable
952 ###############################################################################
953 # By default these should be enabled unless having extra dependencies.
954 # If there is extra dependency over configure options then the enable should
955 # be automagic based on whether the requiring feature is enabled or not.
956 # All this options change anything only with --enable-extension-integration.
958 # The name of this option and its help string makes it sound as if
959 # extensions are built anyway, just not integrated in the installer,
960 # if you use --disable-extension-integration. Is that really the
961 # case?
963 AC_ARG_ENABLE(extension-integration,
964     AS_HELP_STRING([--disable-extension-integration],
965         [Disable integration of the built extensions in the installer of the
966          product. Use this switch to disable the integration.])
969 AC_ARG_ENABLE(export,
970     AS_HELP_STRING([--disable-export],
971         [Disable (some) code for document export. Useful when building viewer-only apps that lack
972          save/export functionality, to avoid having an excessive amount of code and data used
973          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
976 AC_ARG_ENABLE(avmedia,
977     AS_HELP_STRING([--disable-avmedia],
978         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
981 AC_ARG_ENABLE(database-connectivity,
982     AS_HELP_STRING([--disable-database-connectivity],
983         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
986 # This doesn't mean not building (or "integrating") extensions
987 # (although it probably should; i.e. it should imply
988 # --disable-extension-integration I guess), it means not supporting
989 # any extension mechanism at all
990 AC_ARG_ENABLE(extensions,
991     AS_HELP_STRING([--disable-extensions],
992         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
995 AC_ARG_ENABLE(scripting,
996     AS_HELP_STRING([--disable-scripting],
997         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1000 # This is mainly for Android and iOS, but could potentially be used in some
1001 # special case otherwise, too, so factored out as a separate setting
1003 AC_ARG_ENABLE(dynamic-loading,
1004     AS_HELP_STRING([--disable-dynamic-loading],
1005         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1008 AC_ARG_ENABLE(ext-mariadb-connector,
1009     AS_HELP_STRING([--enable-ext-mariadb-connector],
1010         [Enable the build of the MariaDB/MySQL Connector extension.])
1013 AC_ARG_ENABLE(report-builder,
1014     AS_HELP_STRING([--disable-report-builder],
1015         [Disable the Report Builder.])
1018 AC_ARG_ENABLE(ext-wiki-publisher,
1019     AS_HELP_STRING([--enable-ext-wiki-publisher],
1020         [Enable the Wiki Publisher extension.])
1023 AC_ARG_ENABLE(lpsolve,
1024     AS_HELP_STRING([--disable-lpsolve],
1025         [Disable compilation of the lp solve solver ])
1027 AC_ARG_ENABLE(coinmp,
1028     AS_HELP_STRING([--disable-coinmp],
1029         [Disable compilation of the CoinMP solver ])
1032 AC_ARG_ENABLE(pdfimport,
1033     AS_HELP_STRING([--disable-pdfimport],
1034         [Disable building the PDF import feature.])
1037 ###############################################################################
1039 dnl ---------- *** ----------
1041 AC_ARG_ENABLE(mergelibs,
1042     AS_HELP_STRING([--enable-mergelibs],
1043         [Enables linking of big, merged, library. Experimental feature, tested
1044         only for Linux at some stage in history, but possibly does not work even
1045         for Linux any more. This will link a core set of libraries into libmerged.])
1048 AC_ARG_ENABLE(graphite,
1049     AS_HELP_STRING([--disable-graphite],
1050         [Disables the compilation of Graphite smart font rendering.])
1053 AC_ARG_ENABLE(breakpad,
1054     AS_HELP_STRING([--enable-breakpad],
1055         [Enables breakpad for crash reporting.])
1058 AC_ARG_ENABLE(orcus,
1059     AS_HELP_STRING([--enable-orcus],
1060         [Enables orcus for extra file import filters for Calc.])
1063 AC_ARG_ENABLE(fetch-external,
1064     AS_HELP_STRING([--disable-fetch-external],
1065         [Disables fetching external tarballs from web sources.])
1068 AC_ARG_ENABLE(pch,
1069     AS_HELP_STRING([--enable-pch],
1070         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1073 AC_ARG_ENABLE(epm,
1074     AS_HELP_STRING([--enable-epm],
1075         [LibreOffice includes self-packaging code, that requires epm, however epm is
1076          useless for large scale package building.])
1079 AC_ARG_ENABLE(odk,
1080     AS_HELP_STRING([--disable-odk],
1081         [LibreOffice includes an ODK, office development kit which some packagers may
1082          wish to build without.])
1085 AC_ARG_ENABLE(mpl-subset,
1086     AS_HELP_STRING([--enable-mpl-subset],
1087         [Don't compile any pieces which are not MPL or more liberally licensed])
1090 AC_ARG_ENABLE(evolution2,
1091     AS_HELP_STRING([--enable-evolution2],
1092         [Allows the built-in evolution 2 addressbook connectivity build to be
1093          enabled.])
1096 AC_ARG_ENABLE(directx,
1097     AS_HELP_STRING([--disable-directx],
1098         [Remove DirectX implementation for the new XCanvas interface.
1099          The DirectX support requires more stuff installed on Windows to
1100          compile. (DirectX SDK, GDI+ libs)])
1103 AC_ARG_ENABLE(activex,
1104     AS_HELP_STRING([--disable-activex],
1105         [Disable the use of ActiveX for a Windows build.
1106         This switch is mandatory when using an Express edition of Visual Studio.])
1109 AC_ARG_ENABLE(atl,
1110     AS_HELP_STRING([--disable-atl],
1111         [Disable the use of ATL for a Windows build.])
1112     [
1113         This switch is mandatory when using an Express edition of Visual Studio.
1114     ],
1117 AC_ARG_ENABLE(avahi,
1118     AS_HELP_STRING([--enable-avahi],
1119         [Determines whether to use Avahi to advertise Impress to remote controls.]),
1122 AC_ARG_ENABLE(werror,
1123     AS_HELP_STRING([--enable-werror],
1124         [Turn warnings to errors. (Has no effect in modules where the treating
1125          of warnings as errors is disabled explicitly.)]),
1128 AC_ARG_ENABLE(assert-always-abort,
1129     AS_HELP_STRING([--enable-assert-always-abort],
1130         [make assert() abort even in release code.]),
1133 AC_ARG_ENABLE(dbgutil,
1134     AS_HELP_STRING([--enable-dbgutil],
1135         [Provide debugging support from --enable-debug and include additional debugging
1136          utilities such as object counting or more expensive checks.
1137          This is the recommended option for developers.
1138          Note that this makes the build ABI incompatible, it is not possible to mix object
1139          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1141 AC_ARG_ENABLE(debug,
1142     AS_HELP_STRING([--enable-debug],
1143         [Include debugging information, disable compiler optimization and inlining plus
1144          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1146 AC_ARG_ENABLE(sal-log,
1147     AS_HELP_STRING([--enable-sal-log],
1148         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1150 AC_ARG_ENABLE(selective-debuginfo,
1151     AS_HELP_STRING([--enable-selective-debuginfo],
1152         [If --enable-debug or --enable-dbgutil is used, build debugging information
1153          (-g compiler flag) only for the specified gbuild build targets
1154          (where all means everything, - prepended means not to enable, / appended means
1155          everything in the directory; there is no ordering, more specific overrides
1156          more general, and disabling takes precedence).
1157          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1159 AC_ARG_ENABLE(symbols,
1160     AS_HELP_STRING([--enable-symbols],
1161         [Generate debug information.
1162          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1163          otherwise.]))
1165 AC_ARG_ENABLE(runtime-optimizations,
1166     AS_HELP_STRING([--disable-runtime-optimizations],
1167         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1168          JVM JIT) that are known to interact badly with certain dynamic analysis
1169          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1170          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1171          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1173 AC_ARG_ENABLE(compiler-plugins,
1174     AS_HELP_STRING([--enable-compiler-plugins],
1175         [Enable compiler plugins that will perform additional checks during
1176          building. Enabled automatically by --enable-dbgutil.]))
1178 AC_ARG_ENABLE(ooenv,
1179     AS_HELP_STRING([--disable-ooenv],
1180         [Disable ooenv for the instdir installation.]))
1182 AC_ARG_ENABLE(lto,
1183     AS_HELP_STRING([--enable-lto],
1184         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1185          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1186          linker. For MSVC, this option is broken at the moment. This is experimental work
1187          in progress that shouldn't be used unless you are working on it.)]))
1189 AC_ARG_ENABLE(python,
1190     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1191         [Enables or disables Python support at run-time and build-time.
1192          Also specifies what Python to use. 'auto' is the default.
1193          'fully-internal' even forces the internal version for uses of Python
1194          during the build.]))
1196 AC_ARG_ENABLE(gtk,
1197     AS_HELP_STRING([--disable-gtk],
1198         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1199 ,enable_gtk=yes)
1201 AC_ARG_ENABLE(gtk3,
1202     AS_HELP_STRING([--disable-gtk3],
1203         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1204          This is experimental and may not work.]),
1205 ,enable_gtk3=yes)
1207 AC_ARG_ENABLE(systray,
1208     AS_HELP_STRING([--disable-systray],
1209         [Determines whether to build the systray quickstarter.]),
1210 ,enable_systray=yes)
1212 AC_ARG_ENABLE(split-app-modules,
1213     AS_HELP_STRING([--enable-split-app-modules],
1214         [Split file lists for app modules, e.g. base, calc.
1215          Has effect only with make distro-pack-install]),
1218 AC_ARG_ENABLE(split-opt-features,
1219     AS_HELP_STRING([--enable-split-opt-features],
1220         [Split file lists for some optional features, e.g. pyuno, testtool.
1221          Has effect only with make distro-pack-install]),
1224 AC_ARG_ENABLE(cairo-canvas,
1225     AS_HELP_STRING([--disable-cairo-canvas],
1226         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1229 AC_ARG_ENABLE(dbus,
1230     AS_HELP_STRING([--disable-dbus],
1231         [Determines whether to enable features that depend on dbus.
1232          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1233 ,enable_dbus=yes)
1235 AC_ARG_ENABLE(sdremote,
1236     AS_HELP_STRING([--disable-sdremote],
1237         [Determines whether to enable Impress remote control (i.e. the server component).]),
1238 ,enable_sdremote=yes)
1240 AC_ARG_ENABLE(sdremote-bluetooth,
1241     AS_HELP_STRING([--disable-sdremote-bluetooth],
1242         [Determines whether to build sdremote with bluetooth support.
1243          Requires dbus on Linux.]))
1245 AC_ARG_ENABLE(gio,
1246     AS_HELP_STRING([--disable-gio],
1247         [Determines whether to use the GIO support.]),
1248 ,enable_gio=yes)
1250 AC_ARG_ENABLE(telepathy,
1251     AS_HELP_STRING([--enable-telepathy],
1252         [Determines whether to enable Telepathy for collaboration.]),
1253 ,enable_telepathy=no)
1255 AC_ARG_ENABLE(tde,
1256     AS_HELP_STRING([--enable-tde],
1257         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1258          TDE are available.]),
1261 AC_ARG_ENABLE(tdeab,
1262     AS_HELP_STRING([--disable-tdeab],
1263         [Disable the TDE address book support.]),
1265     if test "$enable_tde" = "yes"; then
1266         enable_tdeab=yes
1267     fi
1270 AC_ARG_ENABLE(kde4,
1271     AS_HELP_STRING([--enable-kde4],
1272         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1273          KDE4 are available.]),
1276 AC_ARG_ENABLE(gui,
1277     AS_HELP_STRING([--disable-gui],
1278         [Disable X11/Wayland support to reduce dependencies. Maybe useful for
1279          headless servers, but soffice --headless works just fine without it.
1280          Work in progress, use only if you are hacking on it.]),
1281 ,enable_gui=yes)
1283 AC_ARG_ENABLE(randr,
1284     AS_HELP_STRING([--disable-randr],
1285         [Disable RandR support in the vcl project.]),
1286 ,enable_randr=yes)
1288 AC_ARG_ENABLE(gstreamer-1-0,
1289     AS_HELP_STRING([--disable-gstreamer-1-0],
1290         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1291 ,enable_gstreamer_1_0=yes)
1293 AC_ARG_ENABLE(gstreamer-0-10,
1294     AS_HELP_STRING([--enable-gstreamer-0-10],
1295         [Enable building with the gstreamer 0.10 avmedia backend.]),
1296 ,enable_gstreamer_0_10=no)
1298 AC_ARG_ENABLE(vlc,
1299     AS_HELP_STRING([--enable-vlc],
1300         [Enable building with the (experimental) VLC avmedia backend.]),
1301 ,enable_vlc=no)
1303 AC_ARG_ENABLE(neon,
1304     AS_HELP_STRING([--disable-neon],
1305         [Disable neon and the compilation of webdav binding.]),
1308 AC_ARG_ENABLE([eot],
1309     [AS_HELP_STRING([--enable-eot],
1310         [Enable support for Embedded OpenType fonts.])],
1311 , [enable_eot=no])
1313 AC_ARG_ENABLE(cve-tests,
1314     AS_HELP_STRING([--disable-cve-tests],
1315         [Prevent CVE tests to be executed]),
1318 AC_ARG_ENABLE(chart-tests,
1319     AS_HELP_STRING([--enable-chart-tests],
1320         [Executes chart XShape tests. In a perfect world these tests would be
1321          stable and everyone could run them, in reality it is best to run them
1322          only on a few machines that are known to work and maintained by people
1323          who can judge if a test failure is a regression or not.]),
1326 AC_ARG_ENABLE(build-unowinreg,
1327     AS_HELP_STRING([--enable-build-unowinreg],
1328         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1329          compiler is needed on Linux.]),
1332 AC_ARG_ENABLE(dependency-tracking,
1333     AS_HELP_STRING([--enable-dependency-tracking],
1334         [Do not reject slow dependency extractors.])[
1335   --disable-dependency-tracking
1336                           Disables generation of dependency information.
1337                           Speed up one-time builds.],
1340 AC_ARG_ENABLE(icecream,
1341     AS_HELP_STRING([--enable-icecream],
1342         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1343          It defaults to /opt/icecream for the location of the icecream gcc/g++
1344          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1347 AC_ARG_ENABLE(cups,
1348     AS_HELP_STRING([--disable-cups],
1349         [Do not build cups support.])
1352 AC_ARG_ENABLE(ccache,
1353     AS_HELP_STRING([--disable-ccache],
1354         [Do not try to use ccache automatically.
1355          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1356          CC/CXX are not yet set, and --enable-icecream is not given, we
1357          attempt to use ccache. --disable-ccache disables ccache completely.
1361 AC_ARG_ENABLE(64-bit,
1362     AS_HELP_STRING([--enable-64-bit],
1363         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1364          At the moment meaningful only for iOS and Windows.]), ,)
1366 AC_ARG_ENABLE(online-update,
1367     AS_HELP_STRING([--enable-online-update],
1368         [Enable the online update service that will check for new versions of
1369          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1370          If the value is "mar", the experimental Mozilla-like update will be
1371          enabled instead of the traditional update mechanism.]),
1374 AC_ARG_ENABLE(extension-update,
1375     AS_HELP_STRING([--disable-extension-update],
1376         [Disable possibility to update installed extensions.]),
1379 AC_ARG_ENABLE(release-build,
1380     AS_HELP_STRING([--enable-release-build],
1381         [Enable release build.
1382          See http://wiki.documentfoundation.org/Development/DevBuild]),
1385 AC_ARG_ENABLE(windows-build-signing,
1386     AS_HELP_STRING([--enable-windows-build-signing],
1387         [Enable signing of windows binaries (*.exe, *.dll)]),
1390 AC_ARG_ENABLE(silent-msi,
1391     AS_HELP_STRING([--enable-silent-msi],
1392         [Enable MSI with LIMITUI=1 (silent install).]),
1395 AC_ARG_ENABLE(macosx-code-signing,
1396     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1397         [Sign executables, dylibs, frameworks and the app bundle. If you
1398          don't provide an identity the first suitable certificate
1399          in your keychain is used.]),
1402 AC_ARG_ENABLE(macosx-package-signing,
1403     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1404         [Create a .pkg suitable for uploading to the Mac App Store and sign
1405          it. If you don't provide an identity the first suitable certificate
1406          in your keychain is used.]),
1409 AC_ARG_ENABLE(macosx-sandbox,
1410     AS_HELP_STRING([--enable-macosx-sandbox],
1411         [Make the app bundle run in a sandbox. Requires code signing.
1412          Is required by apps distributed in the Mac App Store, and implies
1413          adherence to App Store rules.]),
1416 AC_ARG_WITH(macosx-bundle-identifier,
1417     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1418         [Define the OS X bundle identifier. Default is the somewhat weird
1419          org.libreoffice.script ("script", huh?).]),
1420 ,with_macosx_bundle_identifier=org.libreoffice.script)
1422 AC_ARG_WITH(product-name,
1423     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1424         [Define the product name. Default is AC_PACKAGE_NAME.]),
1425 ,with_product_name=$PRODUCTNAME)
1427 AC_ARG_WITH(package-version,
1428     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1429         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1432 AC_ARG_ENABLE(ios-simulator,
1433     AS_HELP_STRING([--enable-ios-simulator],
1434         [Build for the iOS Simulator, not iOS device.]),
1437 AC_ARG_ENABLE(readonly-installset,
1438     AS_HELP_STRING([--enable-readonly-installset],
1439         [Prevents any attempts by LibreOffice to write into its installation. That means
1440          at least that no "system-wide" extensions can be added. Experimental work in
1441          progress.]),
1444 AC_ARG_ENABLE(postgresql-sdbc,
1445     AS_HELP_STRING([--disable-postgresql-sdbc],
1446         [Disable the build of the PostgreSQL-SDBC driver.])
1449 AC_ARG_ENABLE(lotuswordpro,
1450     AS_HELP_STRING([--disable-lotuswordpro],
1451         [Disable the build of the Lotus Word Pro filter.]),
1452 ,enable_lotuswordpro=yes)
1454 AC_ARG_ENABLE(firebird-sdbc,
1455     AS_HELP_STRING([--disable-firebird-sdbc],
1456         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1457 ,enable_firebird_sdbc=yes)
1459 AC_ARG_ENABLE(winegcc,
1460     AS_HELP_STRING([--enable-winegcc],
1461         [Enable use of winegcc during the build, in order to create msi* tools
1462          needed for MinGW cross-compilation.]),
1465 AC_ARG_ENABLE(liblangtag,
1466     AS_HELP_STRING([--disable-liblangtag],
1467         [Disable use of liblangtag, and instead use an own simple
1468          implementation.]),
1471 AC_ARG_ENABLE(bogus-pkg-config,
1472     AS_HELP_STRING([--enable-bogus-pkg-config],
1473         [MACOSX only: on MacOSX pkg-config can cause trouble. by default if one is found in the PATH, an error is issued. This flag turn that error into a warning.]),
1476 AC_ARG_ENABLE(openssl,
1477     AS_HELP_STRING([--disable-openssl],
1478         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1479          components will either use GNUTLS or NSS. Work in progress,
1480          use only if you are hacking on it.]),
1481 ,enable_openssl=yes)
1483 AC_ARG_ENABLE(library-bin-tar,
1484     AS_HELP_STRING([--enable-library-bin-tar],
1485         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1486         Some libraries can save their build result in a tarball
1487         stored in TARFILE_LOCATION. That binary tarball is
1488         uniquely identified by the source tarball,
1489         the content of the config_host.mk file and the content
1490         of the top-level directory in core for that library
1491         If this option is enabled, then if such a tarfile exist, it will be untarred
1492         instead of the source tarfile, and the build step will be skipped for that
1493         library.
1494         If a proper tarfile does not exist, then the normal source-based
1495         build is done for that library and a proper binary tarfile is created
1496         for the next time.]),
1499 AC_ARG_ENABLE(gltf,
1500     AS_HELP_STRING([--disable-gltf],
1501         [Determines whether to build libraries related to glTF 3D model rendering.]))
1503 AC_ARG_ENABLE(collada,
1504     AS_HELP_STRING([--disable-collada],
1505         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1507 AC_ARG_ENABLE(dconf,
1508     AS_HELP_STRING([--disable-dconf],
1509         [Disable the dconf configuration backend (enabled by default where
1510          available).]))
1512 AC_ARG_ENABLE(formula-logger,
1513     AS_HELP_STRING(
1514         [--enable-formula-logger],
1515         [Enable formula logger for logging formula calculation flow in Calc.]
1516     )
1519 dnl ===================================================================
1520 dnl Optional Packages (--with/without-)
1521 dnl ===================================================================
1523 AC_ARG_WITH(gcc-home,
1524     AS_HELP_STRING([--with-gcc-home],
1525         [Specify the location of gcc/g++ manually. This can be used in conjunction
1526          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1527          non-default path.]),
1530 AC_ARG_WITH(gnu-patch,
1531     AS_HELP_STRING([--with-gnu-patch],
1532         [Specify location of GNU patch on Solaris or FreeBSD.]),
1535 AC_ARG_WITH(build-platform-configure-options,
1536     AS_HELP_STRING([--with-build-platform-configure-options],
1537         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1540 AC_ARG_WITH(gnu-cp,
1541     AS_HELP_STRING([--with-gnu-cp],
1542         [Specify location of GNU cp on Solaris or FreeBSD.]),
1545 AC_ARG_WITH(external-tar,
1546     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1547         [Specify an absolute path of where to find (and store) tarfiles.]),
1548     TARFILE_LOCATION=$withval ,
1551 AC_ARG_WITH(referenced-git,
1552     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1553         [Specify another checkout directory to reference. This makes use of
1554                  git submodule update --reference, and saves a lot of diskspace
1555                  when having multiple trees side-by-side.]),
1556     GIT_REFERENCE_SRC=$withval ,
1559 AC_ARG_WITH(linked-git,
1560     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1561         [Specify a directory where the repositories of submodules are located.
1562          This uses a method similar to git-new-workdir to get submodules.]),
1563     GIT_LINK_SRC=$withval ,
1566 AC_ARG_WITH(galleries,
1567     AS_HELP_STRING([--with-galleries],
1568         [Specify how galleries should be built. It is possible either to
1569          build these internally from source ("build"),
1570          or to disable them ("no")]),
1573 AC_ARG_WITH(theme,
1574     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1575         [Choose which themes to include. By default those themes with an '*' are included.
1576          Possible choices: *breeze, *breeze_dark, crystal, *galaxy, *hicontrast, *oxygen, *sifr, *tango, *tango_testing.]),
1579 AC_ARG_WITH(helppack-integration,
1580     AS_HELP_STRING([--without-helppack-integration],
1581         [It will not integrate the helppacks to the installer
1582          of the product. Please use this switch to use the online help
1583          or separate help packages.]),
1586 AC_ARG_WITH(fonts,
1587     AS_HELP_STRING([--without-fonts],
1588         [LibreOffice includes some third-party fonts to provide a reliable basis for
1589          help content, templates, samples, etc. When these fonts are already
1590          known to be available on the system then you should use this option.]),
1593 AC_ARG_WITH(epm,
1594     AS_HELP_STRING([--with-epm],
1595         [Decides which epm to use. Default is to use the one from the system if
1596          one is built. When either this is not there or you say =internal epm
1597          will be built.]),
1600 AC_ARG_WITH(package-format,
1601     AS_HELP_STRING([--with-package-format],
1602         [Specify package format(s) for LibreOffice installation sets. The
1603          implicit --without-package-format leads to no installation sets being
1604          generated. Possible values: aix, archive, bsd, deb, dmg,
1605          installed, msi, pkg, and rpm.
1606          Example: --with-package-format='deb rpm']),
1609 AC_ARG_WITH(tls,
1610     AS_HELP_STRING([--with-tls],
1611         [Decides which TLS/SSL and cryptographic implementations to use for
1612          LibreOffice's code. Notice that this doesn't apply for depending
1613          libraries like "neon", for example. Default is to use OpenSSL
1614          although NSS is also possible. Notice that selecting NSS restricts
1615          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1616          restrict by now the usage of NSS in LO's code. Possible values:
1617          openssl, nss. Example: --with-tls="nss"]),
1620 AC_ARG_WITH(system-libs,
1621     AS_HELP_STRING([--with-system-libs],
1622         [Use libraries already on system -- enables all --with-system-* flags.]),
1625 AC_ARG_WITH(system-bzip2,
1626     AS_HELP_STRING([--with-system-bzip2],
1627         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1628     [with_system_bzip2="$with_system_libs"])
1630 AC_ARG_WITH(system-headers,
1631     AS_HELP_STRING([--with-system-headers],
1632         [Use headers already on system -- enables all --with-system-* flags for
1633          external packages whose headers are the only entities used i.e.
1634          boost/odbc/sane-header(s).]),,
1635     [with_system_headers="$with_system_libs"])
1637 AC_ARG_WITH(system-jars,
1638     AS_HELP_STRING([--without-system-jars],
1639         [When building with --with-system-libs, also the needed jars are expected
1640          on the system. Use this to disable that]),,
1641     [with_system_jars="$with_system_libs"])
1643 AC_ARG_WITH(system-cairo,
1644     AS_HELP_STRING([--with-system-cairo],
1645         [Use cairo libraries already on system.  Happens automatically for
1646          (implicit) --enable-gtk and for --enable-gtk3.]))
1648 AC_ARG_WITH(myspell-dicts,
1649     AS_HELP_STRING([--with-myspell-dicts],
1650         [Adds myspell dictionaries to the LibreOffice installation set]),
1653 AC_ARG_WITH(system-dicts,
1654     AS_HELP_STRING([--without-system-dicts],
1655         [Do not use dictionaries from system paths.]),
1658 AC_ARG_WITH(external-dict-dir,
1659     AS_HELP_STRING([--with-external-dict-dir],
1660         [Specify external dictionary dir.]),
1663 AC_ARG_WITH(external-hyph-dir,
1664     AS_HELP_STRING([--with-external-hyph-dir],
1665         [Specify external hyphenation pattern dir.]),
1668 AC_ARG_WITH(external-thes-dir,
1669     AS_HELP_STRING([--with-external-thes-dir],
1670         [Specify external thesaurus dir.]),
1673 AC_ARG_WITH(system-zlib,
1674     AS_HELP_STRING([--with-system-zlib],
1675         [Use zlib already on system.]),,
1676     [with_system_zlib=auto])
1678 AC_ARG_WITH(system-jpeg,
1679     AS_HELP_STRING([--with-system-jpeg],
1680         [Use jpeg already on system.]),,
1681     [with_system_jpeg="$with_system_libs"])
1683 AC_ARG_WITH(system-libgltf,
1684     AS_HELP_STRING([--with-system-libgltf],
1685         [Use libgltf already on system.]),,
1686     [with_system_libgltf="$with_system_libs"])
1688 AC_ARG_WITH(system-clucene,
1689     AS_HELP_STRING([--with-system-clucene],
1690         [Use clucene already on system.]),,
1691     [with_system_clucene="$with_system_libs"])
1693 AC_ARG_WITH(system-expat,
1694     AS_HELP_STRING([--with-system-expat],
1695         [Use expat already on system.]),,
1696     [with_system_expat="$with_system_libs"])
1698 AC_ARG_WITH(system-libxml,
1699     AS_HELP_STRING([--with-system-libxml],
1700         [Use libxml/libxslt already on system.]),,
1701     [with_system_libxml=auto])
1703 AC_ARG_WITH(system-icu,
1704     AS_HELP_STRING([--with-system-icu],
1705         [Use icu already on system.]),,
1706     [with_system_icu="$with_system_libs"])
1708 AC_ARG_WITH(system-ucpp,
1709     AS_HELP_STRING([--with-system-ucpp],
1710         [Use ucpp already on system.]),,
1711     [])
1713 AC_ARG_WITH(system-opencollada,
1714     AS_HELP_STRING([--with-system-opencollada],
1715         [Use openCOLLADA already on system.]),,
1716     [with_system_opencollada=no])
1718 AC_ARG_WITH(system-collada2gltf,
1719     AS_HELP_STRING([--with-system-collada2gltf],
1720         [Use collada2gltf already on system.]),,
1721     [with_system_collada2gltf=no])
1723 AC_ARG_WITH(system-openldap,
1724     AS_HELP_STRING([--with-system-openldap],
1725         [Use the OpenLDAP LDAP SDK already on system.]),,
1726     [with_system_openldap="$with_system_libs"])
1728 AC_ARG_WITH(system-poppler,
1729     AS_HELP_STRING([--with-system-poppler],
1730         [Use system poppler (only needed for PDF import).]),,
1731     [with_system_poppler="$with_system_libs"])
1733 AC_ARG_WITH(system-apache-commons,
1734     AS_HELP_STRING([--with-system-apache-commons],
1735         [Use Apache commons libraries already on system.]),,
1736     [with_system_apache_commons="$with_system_jars"])
1738 AC_ARG_WITH(system-mariadb,
1739     AS_HELP_STRING([--with-system-mariadb],
1740         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1741          extension.]),,
1742     [with_system_mariadb="$with_system_libs"])
1744 AC_ARG_ENABLE(bundle-mariadb,
1745     AS_HELP_STRING([--enable-bundle-mariadb],
1746         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1749 AC_ARG_WITH(system-mysql-cppconn,
1750     AS_HELP_STRING([--with-system-mysql-cppconn],
1751         [Use MySQL C++ Connector libraries already on system.]),,
1752     [with_system_mysql_cppconn="$with_system_libs"])
1754 AC_ARG_WITH(system-postgresql,
1755     AS_HELP_STRING([--with-system-postgresql],
1756         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1757          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1758     [with_system_postgresql="$with_system_libs"])
1760 AC_ARG_WITH(libpq-path,
1761     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1762         [Use this PostgreSQL C interface (libpq) installation for building
1763          the PostgreSQL-SDBC extension.]),
1766 AC_ARG_WITH(system-firebird,
1767     AS_HELP_STRING([--with-system-firebird],
1768         [Use Firebird libraries already on system, for building the Firebird-SDBC
1769          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1770     [with_system_firebird="$with_system_libs"])
1772 AC_ARG_WITH(system-libtommath,
1773             AS_HELP_STRING([--with-system-libtommath],
1774                            [Use libtommath already on system]),,
1775             [with_system_libtommath="$with_system_libs"])
1777 AC_ARG_WITH(system-hsqldb,
1778     AS_HELP_STRING([--with-system-hsqldb],
1779         [Use hsqldb already on system.]))
1781 AC_ARG_WITH(hsqldb-jar,
1782     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1783         [Specify path to jarfile manually.]),
1784     HSQLDB_JAR=$withval)
1786 AC_ARG_ENABLE(scripting-beanshell,
1787     AS_HELP_STRING([--disable-scripting-beanshell],
1788         [Disable support for scripts in BeanShell.]),
1792 AC_ARG_WITH(system-beanshell,
1793     AS_HELP_STRING([--with-system-beanshell],
1794         [Use beanshell already on system.]),,
1795     [with_system_beanshell="$with_system_jars"])
1797 AC_ARG_WITH(beanshell-jar,
1798     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1799         [Specify path to jarfile manually.]),
1800     BSH_JAR=$withval)
1802 AC_ARG_ENABLE(scripting-javascript,
1803     AS_HELP_STRING([--disable-scripting-javascript],
1804         [Disable support for scripts in JavaScript.]),
1808 AC_ARG_WITH(system-rhino,
1809     AS_HELP_STRING([--with-system-rhino],
1810         [Use rhino already on system.]),,)
1811 #    [with_system_rhino="$with_system_jars"])
1812 # Above is not used as we have different debug interface
1813 # patched into internal rhino. This code needs to be fixed
1814 # before we can enable it by default.
1816 AC_ARG_WITH(rhino-jar,
1817     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1818         [Specify path to jarfile manually.]),
1819     RHINO_JAR=$withval)
1821 AC_ARG_WITH(commons-codec-jar,
1822     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1823         [Specify path to jarfile manually.]),
1824     COMMONS_CODEC_JAR=$withval)
1826 AC_ARG_WITH(commons-lang-jar,
1827     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1828         [Specify path to jarfile manually.]),
1829     COMMONS_LANG_JAR=$withval)
1831 AC_ARG_WITH(commons-httpclient-jar,
1832     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1833         [Specify path to jarfile manually.]),
1834     COMMONS_HTTPCLIENT_JAR=$withval)
1836 AC_ARG_WITH(commons-logging-jar,
1837     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1838         [Specify path to jarfile manually.]),
1839     COMMONS_LOGGING_JAR=$withval)
1841 AC_ARG_WITH(system-jfreereport,
1842     AS_HELP_STRING([--with-system-jfreereport],
1843         [Use JFreeReport already on system.]),,
1844     [with_system_jfreereport="$with_system_jars"])
1846 AC_ARG_WITH(sac-jar,
1847     AS_HELP_STRING([--with-sac-jar=JARFILE],
1848         [Specify path to jarfile manually.]),
1849     SAC_JAR=$withval)
1851 AC_ARG_WITH(libxml-jar,
1852     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1853         [Specify path to jarfile manually.]),
1854     LIBXML_JAR=$withval)
1856 AC_ARG_WITH(flute-jar,
1857     AS_HELP_STRING([--with-flute-jar=JARFILE],
1858         [Specify path to jarfile manually.]),
1859     FLUTE_JAR=$withval)
1861 AC_ARG_WITH(jfreereport-jar,
1862     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1863         [Specify path to jarfile manually.]),
1864     JFREEREPORT_JAR=$withval)
1866 AC_ARG_WITH(liblayout-jar,
1867     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1868         [Specify path to jarfile manually.]),
1869     LIBLAYOUT_JAR=$withval)
1871 AC_ARG_WITH(libloader-jar,
1872     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1873         [Specify path to jarfile manually.]),
1874     LIBLOADER_JAR=$withval)
1876 AC_ARG_WITH(libformula-jar,
1877     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1878         [Specify path to jarfile manually.]),
1879     LIBFORMULA_JAR=$withval)
1881 AC_ARG_WITH(librepository-jar,
1882     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1883         [Specify path to jarfile manually.]),
1884     LIBREPOSITORY_JAR=$withval)
1886 AC_ARG_WITH(libfonts-jar,
1887     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1888         [Specify path to jarfile manually.]),
1889     LIBFONTS_JAR=$withval)
1891 AC_ARG_WITH(libserializer-jar,
1892     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1893         [Specify path to jarfile manually.]),
1894     LIBSERIALIZER_JAR=$withval)
1896 AC_ARG_WITH(libbase-jar,
1897     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1898         [Specify path to jarfile manually.]),
1899     LIBBASE_JAR=$withval)
1901 AC_ARG_WITH(system-odbc,
1902     AS_HELP_STRING([--with-system-odbc],
1903         [Use the odbc headers already on system.]),,
1904     [with_system_odbc="auto"])
1906 AC_ARG_WITH(system-sane,
1907     AS_HELP_STRING([--with-system-sane],
1908         [Use sane.h already on system.]),,
1909     [with_system_sane="$with_system_headers"])
1911 AC_ARG_WITH(system-bluez,
1912     AS_HELP_STRING([--with-system-bluez],
1913         [Use bluetooth.h already on system.]),,
1914     [with_system_bluez="$with_system_headers"])
1916 AC_ARG_WITH(system-curl,
1917     AS_HELP_STRING([--with-system-curl],
1918         [Use curl already on system.]),,
1919     [with_system_curl=auto])
1921 AC_ARG_WITH(system-boost,
1922     AS_HELP_STRING([--with-system-boost],
1923         [Use boost already on system.]),,
1924     [with_system_boost="$with_system_headers"])
1926 AC_ARG_WITH(system-glm,
1927     AS_HELP_STRING([--with-system-glm],
1928         [Use glm already on system.]),,
1929     [with_system_glm="$with_system_headers"])
1931 AC_ARG_WITH(system-hunspell,
1932     AS_HELP_STRING([--with-system-hunspell],
1933         [Use libhunspell already on system.]),,
1934     [with_system_hunspell="$with_system_libs"])
1936 AC_ARG_WITH(system-mythes,
1937     AS_HELP_STRING([--with-system-mythes],
1938         [Use mythes already on system.]),,
1939     [with_system_mythes="$with_system_libs"])
1941 AC_ARG_WITH(system-altlinuxhyph,
1942     AS_HELP_STRING([--with-system-altlinuxhyph],
1943         [Use ALTLinuxhyph already on system.]),,
1944     [with_system_altlinuxhyph="$with_system_libs"])
1946 AC_ARG_WITH(system-lpsolve,
1947     AS_HELP_STRING([--with-system-lpsolve],
1948         [Use lpsolve already on system.]),,
1949     [with_system_lpsolve="$with_system_libs"])
1951 AC_ARG_WITH(system-coinmp,
1952     AS_HELP_STRING([--with-system-coinmp],
1953         [Use CoinMP already on system.]),,
1954     [with_system_coinmp="$with_system_libs"])
1956 AC_ARG_WITH(system-liblangtag,
1957     AS_HELP_STRING([--with-system-liblangtag],
1958         [Use liblangtag library already on system.]),,
1959     [with_system_liblangtag="$with_system_libs"])
1961 AC_ARG_WITH(jpeg-turbo,
1962     AS_HELP_STRING([--with-jpeg-turbo],
1963         [Use internal libjpeg-turbo library.]),,
1964     [with_jpeg_turbo=auto])
1966 AC_ARG_WITH(webdav,
1967     AS_HELP_STRING([--with-webdav],
1968         [Specify which library to use for webdav implementation.
1969          Possible values: "neon", "serf", "no". The default value is "neon".
1970          Example: --with-webdav="serf"]),
1971     WITH_WEBDAV=$withval,
1972     WITH_WEBDAV="neon")
1974 AC_ARG_WITH(linker-hash-style,
1975     AS_HELP_STRING([--with-linker-hash-style],
1976         [Use linker with --hash-style=<style> when linking shared objects.
1977          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1978          if supported on the build system, and "sysv" otherwise.]))
1980 AC_ARG_WITH(jdk-home,
1981     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1982         [If you have installed JDK 1.3 or later on your system please supply the
1983          path here. Note that this is not the location of the java command but the
1984          location of the entire distribution.]),
1987 AC_ARG_WITH(help,
1988     AS_HELP_STRING([--with-help],
1989         [Enable the build of help. There is a special parameter "common" that
1990          can be used to bundle only the common part, .e.g help-specific icons.
1991          This is useful when you build the helpcontent separately.])
1992     [
1993                           Usage:     --with-help    build the entire local help
1994                                  --without-help     no local help (default)
1995                                  --with-help=common bundle common files for the local
1996                                                     help but do not build the whole help
1997     ],
2000 AC_ARG_WITH(java,
2001     AS_HELP_STRING([--with-java=<java command>],
2002         [Specify the name of the Java interpreter command. Typically "java"
2003          which is the default.
2005          To build without support for Java components, applets, accessibility
2006          or the XML filters written in Java, use --without-java or --with-java=no.]),
2007     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2008     [ with_java=java ]
2011 AC_ARG_WITH(jvm-path,
2012     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2013         [Use a specific JVM search path at runtime.
2014          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2017 AC_ARG_WITH(ant-home,
2018     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2019         [If you have installed Jakarta Ant on your system, please supply the path here.
2020          Note that this is not the location of the Ant binary but the location
2021          of the entire distribution.]),
2024 AC_ARG_WITH(symbol-config,
2025     AS_HELP_STRING([--with-symbol-config],
2026         [Configuration for the crashreport symbol upload]),
2027         [],
2028         [with_symbol_config=no])
2030 AC_ARG_WITH(export-validation,
2031     AS_HELP_STRING([--without-export-validation],
2032         [Disable validating OOXML and ODF files as exported from in-tree tests.
2033          Use this option e.g. if your system only provides Java 5.]),
2034 ,with_export_validation=yes)
2036 AC_ARG_WITH(bffvalidator,
2037     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2038         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2039          Requires installed Microsoft Office Binary File Format Validator.
2040          Note: export-validation (--with-export-validation) is required to be turned on.
2041          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2042 ,with_bffvalidator=no)
2044 AC_ARG_WITH(junit,
2045     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2046         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2047          --without-junit disables those tests. Not relevant in the --without-java case.]),
2048 ,with_junit=yes)
2050 AC_ARG_WITH(hamcrest,
2051     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2052         [Specifies the hamcrest jar file to use for JUnit-based tests.
2053          --without-junit disables those tests. Not relevant in the --without-java case.]),
2054 ,with_hamcrest=yes)
2056 AC_ARG_WITH(perl-home,
2057     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2058         [If you have installed Perl 5 Distribution, on your system, please
2059          supply the path here. Note that this is not the location of the Perl
2060          binary but the location of the entire distribution.]),
2063 AC_ARG_WITH(doxygen,
2064     AS_HELP_STRING(
2065         [--with-doxygen=<absolute path to doxygen executable>],
2066         [Specifies the doxygen executable to use when generating ODK C/C++
2067          documentation. --without-doxygen disables generation of ODK C/C++
2068          documentation. Not relevant in the --disable-odk case.]),
2069 ,with_doxygen=yes)
2071 AC_ARG_WITH(visual-studio,
2072     AS_HELP_STRING([--with-visual-studio=<2013/2015>],
2073         [Specify which Visual Studio version to use in case several are
2074          installed. If not specified, only 2013 is detected automatically
2075          because 2015 support is currently experimental.]),
2078 AC_ARG_WITH(windows-sdk,
2079     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2080         [Specify which Windows SDK, or "Windows Kit", version to use
2081          in case the one that came with the selected Visual Studio
2082          is not what you want for some reason. Note that not all compiler/SDK
2083          combinations are supported. The intent is that this option should not
2084          be needed.]),
2087 AC_ARG_WITH(lang,
2088     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2089         [Use this option to build LibreOffice with additional UI language support.
2090          English (US) is always included by default.
2091          Separate multiple languages with space.
2092          For all languages, use --with-lang=ALL.]),
2095 AC_ARG_WITH(locales,
2096     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2097         [Use this option to limit the locale information built in.
2098          Separate multiple locales with space.
2099          Very experimental and might well break stuff.
2100          Just a desperate measure to shrink code and data size.
2101          By default all the locales available is included.
2102          This option is completely unrelated to --with-lang.])
2103     [
2104                           Affects also our character encoding conversion
2105                           tables for encodings mainly targeted for a
2106                           particular locale, like EUC-CN and EUC-TW for
2107                           zh, ISO-2022-JP for ja.
2109                           Affects also our add-on break iterator data for
2110                           some languages.
2112                           For the default, all locales, don't use this switch at all.
2113                           Specifying just the language part of a locale means all matching
2114                           locales will be included.
2115     ],
2118 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2119 AC_ARG_WITH(krb5,
2120     AS_HELP_STRING([--with-krb5],
2121         [Enable MIT Kerberos 5 support in modules that support it.
2122          By default automatically enabled on platforms
2123          where a good system Kerberos 5 is available.]),
2126 AC_ARG_WITH(gssapi,
2127     AS_HELP_STRING([--with-gssapi],
2128         [Enable GSSAPI support in modules that support it.
2129          By default automatically enabled on platforms
2130          where a good system GSSAPI is available.]),
2133 AC_ARG_WITH(iwyu,
2134     AS_HELP_STRING([--with-iwyu],
2135         [Use given IWYU binary path to check unneeded includes instead of building.
2136          Use only if you are hacking on it.]),
2139 dnl ===================================================================
2140 dnl Branding
2141 dnl ===================================================================
2143 AC_ARG_WITH(branding,
2144     AS_HELP_STRING([--with-branding=/path/to/images],
2145         [Use given path to retrieve branding images set.])
2146     [
2147                           Search for intro.png about.svg and flat_logo.svg.
2148                           If any is missing, default ones will be used instead.
2150                           Search also progress.conf for progress
2151                           settings on intro screen :
2153                           PROGRESSBARCOLOR="255,255,255" Set color of
2154                           progress bar. Comma separated RGB decimal values.
2155                           PROGRESSSIZE="407,6" Set size of progress bar.
2156                           Comma separated decimal values (width, height).
2157                           PROGRESSPOSITION="61,317" Set position of progress
2158                           bar from left,top. Comma separated decimal values.
2159                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2160                           bar frame. Comma separated RGB decimal values.
2161                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2162                           bar text. Comma separated RGB decimal values.
2163                           PROGRESSTEXTBASELINE="287" Set vertical position of
2164                           progress bar text from top. Decimal value.
2166                           Default values will be used if not found.
2167     ],
2171 AC_ARG_WITH(extra-buildid,
2172     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2173         [Show addition build identification in about dialog.]),
2177 AC_ARG_WITH(vendor,
2178     AS_HELP_STRING([--with-vendor="John the Builder"],
2179         [Set vendor of the build.]),
2182 AC_ARG_WITH(android-package-name,
2183     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2184         [Set Android package name of the build.]),
2187 AC_ARG_WITH(compat-oowrappers,
2188     AS_HELP_STRING([--with-compat-oowrappers],
2189         [Install oo* wrappers in parallel with
2190          lo* ones to keep backward compatibility.
2191          Has effect only with make distro-pack-install]),
2194 AC_ARG_WITH(os-version,
2195     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2196         [For FreeBSD users, use this option option to override the detected OSVERSION.]),
2199 AC_ARG_WITH(mingw-cross-compiler,
2200     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2201         [Specify the MinGW cross-compiler to use.
2202          When building on the ODK on Unix and building unowinreg.dll,
2203          specify the MinGW C++ cross-compiler.]),
2206 AC_ARG_WITH(idlc-cpp,
2207     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2208         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2211 AC_ARG_WITH(build-version,
2212     AS_HELP_STRING([--with-build-version="Built by Jim"],
2213         [Allows the builder to add a custom version tag that will appear in the
2214          Help/About box for QA purposes.]),
2215 with_build_version=$withval,
2218 AC_ARG_WITH(alloc,
2219     AS_HELP_STRING([--with-alloc],
2220         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2221          Note that on FreeBSD/NetBSD system==jemalloc]),
2224 AC_ARG_WITH(parallelism,
2225     AS_HELP_STRING([--with-parallelism],
2226         [Number of jobs to run simultaneously during build. Parallel builds can
2227         save a lot of time on multi-cpu machines. Defaults to the number of
2228         CPUs on the machine, unless you configure --enable-icecream - then to
2229         10.]),
2232 AC_ARG_WITH(all-tarballs,
2233     AS_HELP_STRING([--with-all-tarballs],
2234         [Download all external tarballs unconditionally]))
2236 AC_ARG_WITH(gdrive-client-id,
2237     AS_HELP_STRING([--with-gdrive-client-id],
2238         [Provides the client id of the application for OAuth2 authentication
2239         on Google Drive. If either this or --with-gdrive-client-secret is
2240         empty, the feature will be disabled]),
2243 AC_ARG_WITH(gdrive-client-secret,
2244     AS_HELP_STRING([--with-gdrive-client-secret],
2245         [Provides the client secret of the application for OAuth2
2246         authentication on Google Drive. If either this or
2247         --with-gdrive-client-id is empty, the feature will be disabled]),
2250 AC_ARG_WITH(alfresco-cloud-client-id,
2251     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2252         [Provides the client id of the application for OAuth2 authentication
2253         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2254         empty, the feature will be disabled]),
2257 AC_ARG_WITH(alfresco-cloud-client-secret,
2258     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2259         [Provides the client secret of the application for OAuth2
2260         authentication on Alfresco Cloud. If either this or
2261         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2264 AC_ARG_WITH(onedrive-client-id,
2265     AS_HELP_STRING([--with-onedrive-client-id],
2266         [Provides the client id of the application for OAuth2 authentication
2267         on OneDrive. If either this or --with-onedrive-client-secret is
2268         empty, the feature will be disabled]),
2271 AC_ARG_WITH(onedrive-client-secret,
2272     AS_HELP_STRING([--with-onedrive-client-secret],
2273         [Provides the client secret of the application for OAuth2
2274         authentication on OneDrive. If either this or
2275         --with-onedrive-client-id is empty, the feature will be disabled]),
2277 dnl ===================================================================
2278 dnl Do we want to use pre-build binary tarball for recompile
2279 dnl ===================================================================
2281 if test "$enable_library_bin_tar" = "yes" ; then
2282     USE_LIBRARY_BIN_TAR=TRUE
2283 else
2284     USE_LIBRARY_BIN_TAR=
2286 AC_SUBST(USE_LIBRARY_BIN_TAR)
2288 dnl ===================================================================
2289 dnl Test whether build target is Release Build
2290 dnl ===================================================================
2291 AC_MSG_CHECKING([whether build target is Release Build])
2292 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2293     AC_MSG_RESULT([no])
2294     ENABLE_RELEASE_BUILD=
2295 else
2296     AC_MSG_RESULT([yes])
2297     ENABLE_RELEASE_BUILD=TRUE
2299 AC_SUBST(ENABLE_RELEASE_BUILD)
2301 dnl ===================================================================
2302 dnl Test whether to sign Windows Build
2303 dnl ===================================================================
2304 AC_MSG_CHECKING([whether to sign windows build])
2305 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2306     AC_MSG_RESULT([yes])
2307     WINDOWS_BUILD_SIGNING="TRUE"
2308 else
2309     AC_MSG_RESULT([no])
2310     WINDOWS_BUILD_SIGNING="FALSE"
2312 AC_SUBST(WINDOWS_BUILD_SIGNING)
2314 dnl ===================================================================
2315 dnl MacOSX build and runtime environment options
2316 dnl ===================================================================
2318 AC_ARG_WITH(macosx-sdk,
2319     AS_HELP_STRING([--with-macosx-sdk=<version>],
2320         [Prefer a specific SDK for building.])
2321     [
2322                           If the requested SDK is not available, a search for the oldest one will be done.
2323                           With current Xcode versions, only the latest SDK is included, so this option is
2324                           not terribly useful. It works fine to build with a new SDK and run the result
2325                           on an older OS.
2327                           e. g.: --with-macosx-sdk=10.8
2329                           there are 3 options to control the MacOSX build:
2330                           --with-macosx-sdk (referred as 'sdk' below)
2331                           --with-macosx-version-min-required (referred as 'min' below)
2332                           --with-macosx-version-max-allowed (referred as 'max' below)
2334                           the connection between these value and the default they take is as follow:
2335                           ( ? means not specified on the command line, s means the SDK version found,
2336                           constraint: 8 <= x <= y <= z)
2338                           ==========================================
2339                            command line      || config result
2340                           ==========================================
2341                           min  | max  | sdk  || min  | max  | sdk  |
2342                           ?    | ?    | ?    || 10.8 | 10.s | 10.s |
2343                           ?    | ?    | 10.x || 10.8 | 10.x | 10.x |
2344                           ?    | 10.x | ?    || 10.8 | 10.s | 10.s |
2345                           ?    | 10.x | 10.y || 10.8 | 10.x | 10.y |
2346                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2347                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2348                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2349                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2352                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2353                           for a detailed technical explanation of these variables
2355                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2356     ],
2359 AC_ARG_WITH(macosx-version-min-required,
2360     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2361         [set the minimum OS version needed to run the built LibreOffice])
2362     [
2363                           e. g.: --with-macos-version-min-required=10.8
2364                           see --with-macosx-sdk for more info
2365     ],
2368 AC_ARG_WITH(macosx-version-max-allowed,
2369     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2370         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2371     [
2372                           e. g.: --with-macos-version-max-allowed=10.8
2373                           see --with-macosx-sdk for more info
2374     ],
2378 dnl ===================================================================
2379 dnl options for stuff used during cross-compilation build
2380 dnl Not quite superseded by --with-build-platform-configure-options.
2381 dnl TODO: check, if the "force" option is still needed anywhere.
2382 dnl ===================================================================
2384 AC_ARG_WITH(system-icu-for-build,
2385     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2386         [Use icu already on system for build tools (cross-compilation only).]))
2389 dnl ===================================================================
2390 dnl check for required programs (grep, awk, sed, bash)
2391 dnl ===================================================================
2393 pathmunge ()
2395     if test -n "$1"; then
2396         if test "$build_os" = "cygwin"; then
2397             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2398                 PathFormat "$1"
2399                 new_path=`cygpath -sm "$formatted_path"`
2400             else
2401                 PathFormat "$1"
2402                 new_path=`cygpath -u "$formatted_path"`
2403             fi
2404         else
2405             new_path="$1"
2406         fi
2407         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2408             if test "$2" = "after"; then
2409                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2410             else
2411                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2412             fi
2413         fi
2414         unset new_path
2415     fi
2418 AC_PROG_AWK
2419 AC_PATH_PROG( AWK, $AWK)
2420 if test -z "$AWK"; then
2421     AC_MSG_ERROR([install awk to run this script])
2424 AC_PATH_PROG(BASH, bash)
2425 if test -z "$BASH"; then
2426     AC_MSG_ERROR([bash not found in \$PATH])
2428 AC_SUBST(BASH)
2430 AC_MSG_CHECKING([for GNU or BSD tar])
2431 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2432     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2433     if test $? -eq 0;  then
2434         GNUTAR=$a
2435         break
2436     fi
2437 done
2438 AC_MSG_RESULT($GNUTAR)
2439 if test -z "$GNUTAR"; then
2440     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2442 AC_SUBST(GNUTAR)
2444 AC_MSG_CHECKING([for tar's option to strip components])
2445 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2446 if test $? -eq 0; then
2447     STRIP_COMPONENTS="--strip-components"
2448 else
2449     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2450     if test $? -eq 0; then
2451         STRIP_COMPONENTS="--strip-path"
2452     else
2453         STRIP_COMPONENTS="unsupported"
2454     fi
2456 AC_MSG_RESULT($STRIP_COMPONENTS)
2457 if test x$STRIP_COMPONENTS = xunsupported; then
2458     AC_MSG_ERROR([you need a tar that is able to strip components.])
2460 AC_SUBST(STRIP_COMPONENTS)
2462 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2463 dnl desktop OSes from "mobile" ones.
2465 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2466 dnl In other words, that when building for an OS that is not a
2467 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2469 dnl Note the direction of the implication; there is no assumption that
2470 dnl cross-compiling would imply a non-desktop OS.
2472 if test $_os != iOS -a $_os != Android; then
2473     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2474     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2475     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2478 DISABLE_EXPORT=''
2479 if test "$enable_export" != no; then
2480     BUILD_TYPE="$BUILD_TYPE EXPORT"
2481 else
2482     DISABLE_EXPORT='TRUE'
2483     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2485 AC_SUBST(DISABLE_EXPORT)
2487 # Whether to build "avmedia" functionality or not.
2489 if test -z "$enable_avmedia"; then
2490     enable_avmedia=yes
2493 if test "$enable_avmedia" = yes; then
2494     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2495     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2496 else
2497     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2500 # Decide whether to build database connectivity stuff (including
2501 # Base) or not. We probably don't want to on non-desktop OSes.
2503 if test -z "$enable_database_connectivity"; then
2504     # --disable-database-connectivity is unfinished work in progress
2505     # and the iOS test app doesn't link if we actually try to use it.
2506     # if test $_os != iOS -a $_os != Android; then
2507         enable_database_connectivity=yes
2508     # fi
2511 if test "$enable_database_connectivity" = yes; then
2512     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2513     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2516 if test -z "$enable_extensions"; then
2517     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2518     if test $_os != iOS -a $_os != Android; then
2519         enable_extensions=yes
2520     fi
2523 if test "$enable_extensions" = yes; then
2524     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2525     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2528 if test -z "$enable_scripting"; then
2529     # Disable scripting for iOS unless specifically overridden
2530     # with --enable-scripting.
2531     if test $_os != iOS; then
2532         enable_scripting=yes
2533     fi
2536 DISABLE_SCRIPTING=''
2537 if test "$enable_scripting" = yes; then
2538     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2539     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2540 else
2541     DISABLE_SCRIPTING='TRUE'
2542     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2545 if test $_os = iOS -o $_os = Android; then
2546     # Disable dynamic_loading always for iOS and Android
2547     enable_dynamic_loading=no
2548 elif test -z "$enable_dynamic_loading"; then
2549     # Otherwise enable it unless speficically disabled
2550     enable_dynamic_loading=yes
2553 DISABLE_DYNLOADING=''
2554 if test "$enable_dynamic_loading" = yes; then
2555     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2556 else
2557     DISABLE_DYNLOADING='TRUE'
2558     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2560 AC_SUBST(DISABLE_DYNLOADING)
2562 # remenber SYSBASE value
2563 AC_SUBST(SYSBASE)
2565 dnl ===================================================================
2566 dnl  Sort out various gallery compilation options
2567 dnl ===================================================================
2568 AC_MSG_CHECKING([how to build and package galleries])
2569 if test -n "${with_galleries}"; then
2570     if test "$with_galleries" = "build"; then
2571         WITH_GALLERY_BUILD=TRUE
2572         AC_MSG_RESULT([build from source images internally])
2573     elif test "$with_galleries" = "no"; then
2574         WITH_GALLERY_BUILD=
2575         AC_MSG_RESULT([disable non-internal gallery build])
2576     else
2577         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2578     fi
2579 else
2580     if test $_os != iOS -a $_os != Android; then
2581         WITH_GALLERY_BUILD=TRUE
2582         AC_MSG_RESULT([internal src images for desktop])
2583     else
2584         WITH_GALLERY_BUILD=
2585         AC_MSG_RESULT([disable src image build])
2586     fi
2588 AC_SUBST(WITH_GALLERY_BUILD)
2590 dnl ===================================================================
2591 dnl  Checks if ccache is available
2592 dnl ===================================================================
2593 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
2594     # on windows/VC build do not use ccache
2595     CCACHE=""
2596 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2597     case "%$CC%$CXX%" in
2598     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2599     # assume that's good then
2600     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2601         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2602         ;;
2603     *)
2604         AC_PATH_PROG([CCACHE],[ccache],[not found])
2605         if test "$CCACHE" = "not found"; then
2606             CCACHE=""
2607         else
2608             # Need to check for ccache version: otherwise prevents
2609             # caching of the results (like "-x objective-c++" for Mac)
2610             if test $_os = Darwin -o $_os = iOS; then
2611                 # Check ccache version
2612                 AC_MSG_CHECKING([whether version of ccache is suitable])
2613                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2614                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2615                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2616                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2617                 else
2618                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2619                     CCACHE=""
2620                 fi
2621             fi
2622         fi
2623         ;;
2624     esac
2625 else
2626     CCACHE=""
2629 if test "$CCACHE" != ""; then
2630     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2631     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2632     if test "$ccache_size" = ""; then
2633         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2634         if test "$ccache_size" = ""; then
2635             ccache_size=0
2636         fi
2637         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2638         if test $ccache_size -lt 1024; then
2639             CCACHE=""
2640             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2641             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2642         else
2643             # warn that ccache may be too small for debug build
2644             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2645             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2646         fi
2647     else
2648         if test $ccache_size -lt 5; then
2649             #warn that ccache may be too small for debug build
2650             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2651             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2652         fi
2653     fi
2656 dnl ===================================================================
2657 dnl  Checks for C compiler,
2658 dnl  The check for the C++ compiler is later on.
2659 dnl ===================================================================
2660 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2661     GCC_HOME_SET="true"
2662     AC_MSG_CHECKING([gcc home])
2663     if test -z "$with_gcc_home"; then
2664         if test "$enable_icecream" = "yes"; then
2665             if test -d "/usr/lib/icecc/bin"; then
2666                 GCC_HOME="/usr/lib/icecc/"
2667             else
2668                 GCC_HOME="/opt/icecream/"
2669             fi
2670         else
2671             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2672             GCC_HOME_SET="false"
2673         fi
2674     else
2675         GCC_HOME="$with_gcc_home"
2676     fi
2677     AC_MSG_RESULT($GCC_HOME)
2678     AC_SUBST(GCC_HOME)
2680     if test "$GCC_HOME_SET" = "true"; then
2681         if test -z "$CC"; then
2682             CC="$GCC_HOME/bin/gcc"
2683         fi
2684         if test -z "$CXX"; then
2685             CXX="$GCC_HOME/bin/g++"
2686         fi
2687     fi
2690 COMPATH=`dirname "$CC"`
2691 if test "$COMPATH" = "."; then
2692     AC_PATH_PROGS(COMPATH, $CC)
2693     dnl double square bracket to get single because of M4 quote...
2694     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2696 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2698 dnl ===================================================================
2699 dnl Java support
2700 dnl ===================================================================
2701 AC_MSG_CHECKING([whether to build with Java support])
2702 if test "$with_java" != "no"; then
2703     if test "$DISABLE_SCRIPTING" = TRUE; then
2704         AC_MSG_RESULT([no, overridden by --disable-scripting])
2705         ENABLE_JAVA=""
2706         with_java=no
2707     else
2708         AC_MSG_RESULT([yes])
2709         ENABLE_JAVA="TRUE"
2710         AC_DEFINE(HAVE_FEATURE_JAVA)
2711     fi
2712 else
2713     AC_MSG_RESULT([no])
2714     ENABLE_JAVA=""
2717 AC_SUBST(ENABLE_JAVA)
2719 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2721 dnl ENABLE_JAVA="" indicate no Java support at all
2723 dnl ===================================================================
2724 dnl Check OS X SDK and compiler
2725 dnl ===================================================================
2727 if test $_os = Darwin; then
2729     # If no --with-macosx-sdk option is given, look for one
2731     # The intent is that for "most" Mac-based developers, a suitable
2732     # SDK will be found automatically without any configure options.
2734     # For developers with a current Xcode, the lowest-numbered SDK
2735     # higher than or equal to the minimum required should be found.
2737     AC_MSG_CHECKING([what Mac OS X SDK to use])
2739     for _macosx_sdk in $with_macosx_sdk 10.8 10.9 10.10 10.11 10.12; do
2740         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2741         if test -d "$MACOSX_SDK_PATH"; then
2742             with_macosx_sdk="${_macosx_sdk}"
2743             break
2744         else
2745             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2746             if test -d "$MACOSX_SDK_PATH"; then
2747                 with_macosx_sdk="${_macosx_sdk}"
2748                 break
2749             fi
2750         fi
2751     done
2752     if test ! -d "$MACOSX_SDK_PATH"; then
2753         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2754     fi
2755     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2757     case $with_macosx_sdk in
2758     10.8)
2759         MACOSX_SDK_VERSION=1080
2760         ;;
2761     10.9)
2762         MACOSX_SDK_VERSION=1090
2763         ;;
2764     10.10)
2765         MACOSX_SDK_VERSION=101000
2766         ;;
2767     10.11)
2768         MACOSX_SDK_VERSION=101100
2769         ;;
2770     10.12)
2771         MACOSX_SDK_VERSION=101200
2772         ;;
2773     *)
2774         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.8--12])
2775         ;;
2776     esac
2778     if test "$with_macosx_version_min_required" = "" ; then
2779         with_macosx_version_min_required="10.8";
2780     fi
2782     if test "$with_macosx_version_max_allowed" = "" ; then
2783         with_macosx_version_max_allowed="$with_macosx_sdk"
2784     fi
2786     # export this so that "xcrun" invocations later return matching values
2787     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2788     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2789     export DEVELOPER_DIR
2790     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2791     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2793     case "$with_macosx_version_min_required" in
2794     10.8)
2795         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2796         ;;
2797     10.9)
2798         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2799         ;;
2800     10.10)
2801         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2802         ;;
2803     10.11)
2804         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2805         ;;
2806     10.12)
2807         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2808         ;;
2809     *)
2810         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.8--12])
2811         ;;
2812     esac
2814     LIBTOOL=/usr/bin/libtool
2815     INSTALL_NAME_TOOL=install_name_tool
2816     if test -z "$save_CC"; then
2817         AC_MSG_CHECKING([what compiler to use])
2818         stdlib=-stdlib=libc++
2819         if test "$ENABLE_LTO" = TRUE; then
2820             lto=-flto
2821         fi
2822         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2823         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2824         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2825         AR=`xcrun -find ar`
2826         NM=`xcrun -find nm`
2827         STRIP=`xcrun -find strip`
2828         LIBTOOL=`xcrun -find libtool`
2829         RANLIB=`xcrun -find ranlib`
2830         AC_MSG_RESULT([$CC and $CXX])
2831     fi
2833     case "$with_macosx_version_max_allowed" in
2834     10.8)
2835         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2836         ;;
2837     10.9)
2838         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2839         ;;
2840     10.10)
2841         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2842         ;;
2843     10.11)
2844         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2845         ;;
2846     10.12)
2847         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2848         ;;
2849     *)
2850         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.8--12])
2851         ;;
2852     esac
2854     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2855     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2856         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2857     else
2858         AC_MSG_RESULT([ok])
2859     fi
2861     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2862     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2863         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2864     else
2865         AC_MSG_RESULT([ok])
2866     fi
2867     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2868     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2870     AC_MSG_CHECKING([whether to do code signing])
2872     if test "$enable_macosx_code_signing" = yes; then
2873         # By default use the first suitable certificate (?).
2875         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2876         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2877         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2878         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2879         # "Developer ID Application" one.
2881         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2882         if test -n "$identity"; then
2883             MACOSX_CODESIGNING_IDENTITY=$identity
2884             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2885             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2886         else
2887             AC_MSG_ERROR([cannot determine identity to use])
2888         fi
2889     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2890         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2891         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2892         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2893     else
2894         AC_MSG_RESULT([no])
2895     fi
2897     AC_MSG_CHECKING([whether to create a Mac App Store package])
2899     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2900         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2901     elif test "$enable_macosx_package_signing" = yes; then
2902         # By default use the first suitable certificate.
2903         # It should be a "3rd Party Mac Developer Installer" one
2905         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2906         if test -n "$identity"; then
2907             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2908             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2909             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2910         else
2911             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2912         fi
2913     elif test -n "$enable_macosx_package_signing"; then
2914         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2915         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2916         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2917     else
2918         AC_MSG_RESULT([no])
2919     fi
2921     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2922         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2923     fi
2925     AC_MSG_CHECKING([whether to sandbox the application])
2927     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2928         AC_MSG_ERROR([OS X sandboxing requires code signing])
2929     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2930         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2931     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2932         ENABLE_MACOSX_SANDBOX=TRUE
2933         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2934         AC_MSG_RESULT([yes])
2935     else
2936         AC_MSG_RESULT([no])
2937     fi
2939     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2940     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2941     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2943 AC_SUBST(MACOSX_SDK_PATH)
2944 AC_SUBST(MACOSX_SDK_VERSION)
2945 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2946 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2947 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2948 AC_SUBST(INSTALL_NAME_TOOL)
2949 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2950 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2951 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2952 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2953 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2955 dnl ===================================================================
2956 dnl Check iOS SDK and compiler
2957 dnl ===================================================================
2959 if test $_os = iOS; then
2961     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2962         :
2963     else
2964         BITNESS_OVERRIDE=64
2965     fi
2967     AC_MSG_CHECKING([what iOS SDK to use])
2969     if test "$enable_ios_simulator" = yes; then
2970         platform=iPhoneSimulator
2971     else
2972         platform=iPhoneOS
2973     fi
2975     xcode_developer=`xcode-select -print-path`
2977     current_sdk_ver=9.3
2978     for sdkver in 10.0 9.3 9.2; do
2979         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2980         if test -d $t; then
2981             ios_sdk=$sdkver
2982             sysroot=$t
2983             break
2984         fi
2985     done
2987     if test -z "$sysroot"; then
2988         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2989     fi
2991     AC_MSG_RESULT($sysroot)
2993     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2995     if test "$enable_ios_simulator" = yes; then
2996         if test "$BITNESS_OVERRIDE" = 64; then
2997             XCODE_ARCHS=x86_64
2998             versionmin=-mios-simulator-version-min=9.0
2999         else
3000             XCODE_ARCHS=i386
3001             versionmin=-mios-simulator-version-min=9.0
3002         fi
3003     else
3004         platform=iPhoneOS
3005         if test "$BITNESS_OVERRIDE" = 64; then
3006             XCODE_ARCHS=arm64
3007         else
3008             XCODE_ARCHS=armv7
3009         fi
3010         versionmin=-miphoneos-version-min=9.0
3011     fi
3013     # LTO is not really recommended for iOS builds,
3014     # the link time will be astronomical
3015     if test "$ENABLE_LTO" = TRUE; then
3016         lto=-flto
3017     fi
3018     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3019     # get compiled with it, to avoid ld warnings when linking all that together into one
3020     # executable.
3022     XCODE_CLANG_CXX_LIBRARY=libc++
3023     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3025     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3026     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3028     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3029     AR=`xcrun -find ar`
3030     NM=`xcrun -find nm`
3031     STRIP=`xcrun -find strip`
3032     LIBTOOL=`xcrun -find libtool`
3033     RANLIB=`xcrun -find ranlib`
3036 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3037 AC_SUBST(XCODE_ARCHS)
3038 AC_SUBST(XCODEBUILD_SDK)
3040 AC_MSG_CHECKING([whether to treat the installation as read-only])
3042 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3043         "$enable_extensions" != yes; then
3044     enable_readonly_installset=yes
3046 if test "$enable_readonly_installset" = yes; then
3047     AC_MSG_RESULT([yes])
3048     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3049 else
3050     AC_MSG_RESULT([no])
3053 dnl ===================================================================
3054 dnl Structure of install set
3055 dnl ===================================================================
3057 if test $_os = Darwin; then
3058     LIBO_BIN_FOLDER=MacOS
3059     LIBO_ETC_FOLDER=Resources
3060     LIBO_LIBEXEC_FOLDER=MacOS
3061     LIBO_LIB_FOLDER=Frameworks
3062     LIBO_LIB_PYUNO_FOLDER=Resources
3063     LIBO_SHARE_FOLDER=Resources
3064     LIBO_SHARE_HELP_FOLDER=Resources/help
3065     LIBO_SHARE_JAVA_FOLDER=Resources/java
3066     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3067     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3068     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3069     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3070     LIBO_URE_BIN_FOLDER=MacOS
3071     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3072     LIBO_URE_LIB_FOLDER=Frameworks
3073     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3074     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3075 elif test $_os = WINNT; then
3076     LIBO_BIN_FOLDER=program
3077     LIBO_ETC_FOLDER=program
3078     LIBO_LIBEXEC_FOLDER=program
3079     LIBO_LIB_FOLDER=program
3080     LIBO_LIB_PYUNO_FOLDER=program
3081     LIBO_SHARE_FOLDER=share
3082     LIBO_SHARE_HELP_FOLDER=help
3083     LIBO_SHARE_JAVA_FOLDER=program/classes
3084     LIBO_SHARE_PRESETS_FOLDER=presets
3085     LIBO_SHARE_READMES_FOLDER=readmes
3086     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3087     LIBO_SHARE_SHELL_FOLDER=program/shell
3088     LIBO_URE_BIN_FOLDER=program
3089     LIBO_URE_ETC_FOLDER=program
3090     LIBO_URE_LIB_FOLDER=program
3091     LIBO_URE_MISC_FOLDER=program
3092     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3093 else
3094     LIBO_BIN_FOLDER=program
3095     LIBO_ETC_FOLDER=program
3096     LIBO_LIBEXEC_FOLDER=program
3097     LIBO_LIB_FOLDER=program
3098     LIBO_LIB_PYUNO_FOLDER=program
3099     LIBO_SHARE_FOLDER=share
3100     LIBO_SHARE_HELP_FOLDER=help
3101     LIBO_SHARE_JAVA_FOLDER=program/classes
3102     LIBO_SHARE_PRESETS_FOLDER=presets
3103     LIBO_SHARE_READMES_FOLDER=readmes
3104     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3105     LIBO_SHARE_SHELL_FOLDER=program/shell
3106     LIBO_URE_BIN_FOLDER=program
3107     LIBO_URE_ETC_FOLDER=program
3108     LIBO_URE_LIB_FOLDER=program
3109     LIBO_URE_MISC_FOLDER=program
3110     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3112 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3113 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3114 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3115 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3116 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3117 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3118 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3119 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3120 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3121 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3122 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3123 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3124 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3125 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3126 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3127 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3129 # Not all of them needed in config_host.mk, add more if need arises
3130 AC_SUBST(LIBO_BIN_FOLDER)
3131 AC_SUBST(LIBO_ETC_FOLDER)
3132 AC_SUBST(LIBO_LIB_FOLDER)
3133 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3134 AC_SUBST(LIBO_SHARE_FOLDER)
3135 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3136 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3137 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3138 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3139 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3140 AC_SUBST(LIBO_URE_BIN_FOLDER)
3141 AC_SUBST(LIBO_URE_ETC_FOLDER)
3142 AC_SUBST(LIBO_URE_LIB_FOLDER)
3143 AC_SUBST(LIBO_URE_MISC_FOLDER)
3144 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3146 dnl ===================================================================
3147 dnl Windows specific tests and stuff
3148 dnl ===================================================================
3150 reg_get_value()
3152     # Return value: $regvalue
3153     unset regvalue
3155     local _regentry="/proc/registry${1}/${2}"
3156     if test -f "$_regentry"; then
3157         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3158         # Registry keys read via /proc/registry* are always \0 terminated!
3159         local _regvalue=$(tr -d '\0' < "$_regentry")
3160         if test $? -eq 0; then
3161             regvalue=$_regvalue
3162         fi
3163     fi
3166 # Get a value from the 32-bit side of the Registry
3167 reg_get_value_32()
3169     reg_get_value "32" "$1"
3172 # Get a value from the 64-bit side of the Registry
3173 reg_get_value_64()
3175     reg_get_value "64" "$1"
3178 if test "$_os" = "WINNT"; then
3179     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3180     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3181         AC_MSG_RESULT([no])
3182         WINDOWS_SDK_ARCH="x86"
3183     else
3184         AC_MSG_RESULT([yes])
3185         WINDOWS_SDK_ARCH="x64"
3186         BITNESS_OVERRIDE=64
3187     fi
3190 if test "$cross_compiling" = "yes"; then
3191     export CROSS_COMPILING=TRUE
3192     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3193 else
3194     CROSS_COMPILING=
3195     BUILD_TYPE="$BUILD_TYPE NATIVE"
3197 AC_SUBST(CROSS_COMPILING)
3199 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3200 if test "$GCC" = "yes"; then
3201     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3202     bsymbolic_functions_ldflags_save=$LDFLAGS
3203     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3204     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3205 #include <stdio.h>
3206         ],[
3207 printf ("hello world\n");
3208         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3209     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3210         AC_MSG_RESULT( found )
3211     else
3212         AC_MSG_RESULT( not found )
3213     fi
3214     LDFLAGS=$bsymbolic_functions_ldflags_save
3216 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3218 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3219 # NOTE: must _not_ be used for bundled external libraries!
3220 ISYSTEM=
3221 if test "$GCC" = "yes"; then
3222     AC_MSG_CHECKING( for -isystem )
3223     save_CFLAGS=$CFLAGS
3224     CFLAGS="$CFLAGS -Werror"
3225     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3226     CFLAGS=$save_CFLAGS
3227     if test -n "$ISYSTEM"; then
3228         AC_MSG_RESULT(yes)
3229     else
3230         AC_MSG_RESULT(no)
3231     fi
3233 if test -z "$ISYSTEM"; then
3234     # fall back to using -I
3235     ISYSTEM=-I
3237 AC_SUBST(ISYSTEM)
3239 dnl ===================================================================
3240 dnl  Check which Visual Studio or MinGW compiler is used
3241 dnl ===================================================================
3243 map_vs_year_to_version()
3245     # Return value: $vsversion
3247     unset vsversion
3249     case $1 in
3250     2013)
3251         vsversion=12.0;;
3252     2015)
3253         vsversion=14.0;;
3254     *)
3255         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3256     esac
3259 vs_versions_to_check()
3261     # Args: $1 (optional) : versions to check, in the order of preference
3262     # Return value: $vsversions
3264     unset vsversions
3266     if test -n "$1"; then
3267         map_vs_year_to_version "$1"
3268         vsversions=$vsversion
3269     else
3270         # By default we prefer 2013/2015, in this order
3271         vsversions="12.0 14.0"
3272     fi
3275 find_msvs()
3277     # Find Visual Studio 2013/2015
3278     # Args: $1 (optional) : versions to check, in the order of preference
3279     # Return value: $vstest
3281     unset vstest
3283     vs_versions_to_check "$1"
3285     for ver in $vsversions; do
3286         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3287         if test -n "$regvalue"; then
3288             vstest=$regvalue
3289             break
3290         fi
3291         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3292         if test -n "$regvalue"; then
3293             vstest=$regvalue
3294             break
3295         fi
3296     done
3299 win_get_env_from_vsvars32bat()
3301     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3302     echo -e "@setlocal\r\n" >> $WRAPPERBATCHFILEPATH
3303     echo -e "@call \"`cygpath -w $VC_PRODUCT_DIR`/../Common7/Tools/vsvars32.bat\"\r\n" >> $WRAPPERBATCHFILEPATH
3304     echo -e "@echo %$1%\r\n" >> $WRAPPERBATCHFILEPATH
3305     echo -e "@endlocal\r\n" >> $WRAPPERBATCHFILEPATH
3306     chmod +x $WRAPPERBATCHFILEPATH
3307     _win_get_env_from_vsvars32bat=$($WRAPPERBATCHFILEPATH | tr -d "\r")
3308     rm -f $WRAPPERBATCHFILEPATH
3309     echo $_win_get_env_from_vsvars32bat
3312 find_ucrt()
3314     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3315     if test -n "$regvalue"; then
3316         PathFormat "$regvalue"
3317         UCRTSDKDIR=$formatted_path
3318         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3319         UCRTVERSION=$regvalue
3320     fi
3321     if test -z "$UCRTSDKDIR"; then
3322         if test -f "$VC_PRODUCT_DIR/../Common7/Tools/vsvars32.bat"; then
3323             PathFormat "`win_get_env_from_vsvars32bat "UniversalCRTSdkDir"`"
3324             UCRTSDKDIR=$formatted_path
3325             UCRTVERSION=`win_get_env_from_vsvars32bat "UCRTVersion"`
3326         fi
3327     fi
3330 find_msvc()
3332     # Find Visual C++ 2013/2015
3333     # Args: $1 (optional) : The VS version year
3334     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3336     unset vctest vcnum vcnumwithdot vcexpress
3338     vs_versions_to_check "$1"
3340     for ver in $vsversions; do
3341         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3342         if test -n "$regvalue"; then
3343             vctest=$regvalue
3344             break
3345         fi
3346         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3347         if test -n "$regvalue"; then
3348             vctest=$regvalue
3349             break
3350         fi
3351     done
3352     if test -n "$vctest"; then
3353         vcnumwithdot=$ver
3354         case "$vcnumwithdot" in
3355         12.0)
3356             vcyear=2013
3357             vcnum=120
3358             ;;
3359         14.0)
3360             vcyear=2015
3361             vcnum=140
3362             ;;
3363         esac
3364         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$vcnumwithdot/Setup/VC/ProductDir
3365         if test -n "$regvalue" -a "$regvalue" = "$vctest" ; then
3366             vcexpress=Express
3367         fi
3368     fi
3371 SOLARINC=
3372 SHOWINCLUDES_PREFIX=
3373 MSBUILD_PATH=
3374 DEVENV=
3375 if test "$_os" = "WINNT"; then
3376     if test "$WITH_MINGW" != "yes"; then
3377         AC_MSG_CHECKING([Visual C++])
3379         find_msvc "$with_visual_studio"
3380         if test -z "$vctest"; then
3381             if test -n "$with_visual_studio"; then
3382                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3383             else
3384                 AC_MSG_ERROR([No Visual Studio 2013/2015 installation found])
3385             fi
3386         fi
3388         if test "$BITNESS_OVERRIDE" = ""; then
3389             if test -f "$vctest/bin/cl.exe"; then
3390                 VC_PRODUCT_DIR=$vctest
3391             else
3392                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3393             fi
3394         else
3395             if test -f "$vctest/bin/amd64/cl.exe"; then
3396                 VC_PRODUCT_DIR=$vctest
3397             else
3398                 if test -f "$vctest/bin/x86_amd64/cl.exe" -a "$vcexpress" = "Express"; then
3399                     VC_PRODUCT_DIR=$vctest
3400                 else
3401                     AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3402                 fi
3403             fi
3404         fi
3406         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3407         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3409         AC_MSG_CHECKING([Is Visual C++ Express])
3410         if test "$vcexpress" = "Express" ; then
3411             AC_MSG_RESULT([Yes])
3412         else
3413             AC_MSG_RESULT([No])
3414         fi
3416         UCRTSDKDIR=
3417         UCRTVERSION=
3419         AC_MSG_CHECKING([whether UCRT is needed for this compiler version])
3420         if test "$vcnum" = "120"; then
3421             AC_MSG_RESULT([No])
3422         else
3423             AC_MSG_RESULT([Yes])
3424             AC_MSG_CHECKING([for UCRT location])
3425             find_ucrt
3426             if test -n "$UCRTSDKDIR"; then
3427                 AC_MSG_RESULT([found])
3428                 PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3429                 ucrtincpath_formatted=$formatted_path
3430                 # SOLARINC is used for external modules and must be set too.
3431                 # And no, it's not sufficient to set SOLARINC only, as configure
3432                 # itself doesn't honour it.
3433                 SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3434                 CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3435                 CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3436                 CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3437             else
3438                 AC_MSG_ERROR([not found])
3439             fi
3440         fi
3441         AC_SUBST(UCRTSDKDIR)
3442         AC_SUBST(UCRTVERSION)
3444         # Find the proper version of MSBuild.exe to use based on the VS version
3445         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3446         if test -n "$regvalue" ; then
3447             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3448         fi
3450         # Find the version of devenv.exe
3451         DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
3452         if test ! -e "$DEVENV" -a "$vcnum" = "120"; then
3453             # for Visual Studio 2013 Express, fall back
3454             DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/WDExpress.exe"
3455         fi
3456         if test ! -e "$DEVENV"; then
3457             AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3458         fi
3460         dnl ===========================================================
3461         dnl  Check for the corresponding mspdb*.dll
3462         dnl ===========================================================
3464         MSPDB_PATH=
3466         if test "$BITNESS_OVERRIDE" = ""; then
3467             if test "$vcnum" = "120"; then
3468                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3469             else
3470                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3471             fi
3472         else
3473             if test "$vcexpress" = "Express"; then
3474                 MSPDB_PATH="$VC_PRODUCT_DIR/bin"
3475             else
3476                 MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3477             fi
3478         fi
3480         mspdbnum=$vcnum
3482         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3483             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3484         fi
3486         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3487         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3489         dnl The path needs to be added before cl is called
3490         PATH="$MSPDB_PATH:$PATH"
3492         AC_MSG_CHECKING([cl.exe])
3494         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3495         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3496         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3497         # is not enough?
3499         if test -z "$CC"; then
3500             if test "$BITNESS_OVERRIDE" = ""; then
3501                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3502                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3503                 fi
3504             else
3505                 if test "$vcexpress" = "Express"; then
3506                    if test -f "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"; then
3507                         CC="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3508                    fi
3509                 else
3510                    if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3511                         CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3512                    fi
3513                 fi
3514             fi
3516             # This gives us a posix path with 8.3 filename restrictions
3517             CC=`win_short_path_for_make "$CC"`
3518         fi
3520         if test -n "$CC"; then
3521             # Remove /cl.exe from CC case insensitive
3522             AC_MSG_RESULT([found Visual C++ $vcyear $vcexpress ($CC)])
3523             if test "$BITNESS_OVERRIDE" = ""; then
3524                 COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3525             else
3526                 if test -n "$VC_PRODUCT_DIR"; then
3527                     COMPATH=$VC_PRODUCT_DIR
3528                 fi
3529             fi
3530             if test "$BITNESS_OVERRIDE" = ""; then
3531                 dnl since MSVC 2012, default for x86 is -arch:SSE2:
3532                 CC="$CC -arch:SSE"
3533             fi
3534             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3536             PathFormat "$COMPATH"
3537             COMPATH="$formatted_path"
3539             VCVER=$vcnum
3540             MSVSVER=$vcyear
3542             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3543             # are always "better", we list them in reverse chronological order.
3545             case $vcnum in
3546             120)
3547                 COMEX=15
3548                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0 7.1A"
3549                 ;;
3550             140)
3551                 COMEX=19
3552                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0A 10.0 8.1A 8.1 8.0 7.1A"
3553                 ;;
3554             esac
3556             # The expectation is that --with-windows-sdk should not need to be used
3557             if test -n "$with_windows_sdk"; then
3558                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3559                 *" "$with_windows_sdk" "*)
3560                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3561                     ;;
3562                 *)
3563                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3564                     ;;
3565                 esac
3566             fi
3568             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3569             ac_objext=obj
3570             ac_exeext=exe
3572         else
3573             AC_MSG_ERROR([Visual C++ not found after all, huh])
3574         fi
3576         dnl We need to guess the prefix of the -showIncludes output, it can be
3577         dnl localized
3578         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3579         echo "#include <stdlib.h>" > conftest.c
3580         dnl Filter out -FIIntrin.h when CC points at clang-cl.exe and needs to
3581         dnl explicitly state that argument:
3582         my_CC=
3583         for i in $CC; do
3584             case $i in
3585             -FIIntrin.h)
3586                 ;;
3587             *)
3588                 my_CC="$my_CC $i"
3589                 ;;
3590             esac
3591         done
3592         SHOWINCLUDES_PREFIX=`$my_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3593             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3594         rm -f conftest.c conftest.obj
3595         if test -z "$SHOWINCLUDES_PREFIX"; then
3596             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3597         else
3598             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3599         fi
3601         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3602         # version of the Explorer extension (and maybe other small
3603         # bits, too) needed when installing a 32-bit LibreOffice on a
3604         # 64-bit OS. The 64-bit Explorer extension is a feature that
3605         # has been present since long in OOo. Don't confuse it with
3606         # building LibreOffice itself as 64-bit code.
3608         BUILD_X64=
3609         CXX_X64_BINARY=
3610         LINK_X64_BINARY=
3612         if test "$BITNESS_OVERRIDE" = ""; then
3613             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3614             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3615                 # Prefer native x64 compiler to cross-compiler, in case we are running
3616                 # the build on a 64-bit OS.
3617                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3618                     BUILD_X64=TRUE
3619                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3620                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3621                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3622                     BUILD_X64=TRUE
3623                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3624                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3625                 fi
3626             fi
3627             if test "$BUILD_X64" = TRUE; then
3628                 AC_MSG_RESULT([found])
3629             else
3630                 AC_MSG_RESULT([not found])
3631                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3632             fi
3633         fi
3634         AC_SUBST(BUILD_X64)
3636         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3637         AC_SUBST(CXX_X64_BINARY)
3638         AC_SUBST(LINK_X64_BINARY)
3639     else
3640         AC_MSG_CHECKING([the compiler is MinGW])
3641         MACHINE_PREFIX=`$CC -dumpmachine`
3642         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3643             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3644             AC_MSG_RESULT([yes])
3645         else
3646             AC_MSG_ERROR([Compiler is not MinGW.])
3647         fi
3648     fi
3650 AC_SUBST(VCVER)
3651 AC_SUBST(DEVENV)
3652 PathFormat "$MSPDB_PATH"
3653 MSPDB_PATH="$formatted_path"
3654 AC_SUBST(SHOWINCLUDES_PREFIX)
3656 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3657     AC_MSG_CHECKING([whether to use DirectX])
3658     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3659         ENABLE_DIRECTX="TRUE"
3660         AC_MSG_RESULT([yes])
3661     else
3662         ENABLE_DIRECTX=""
3663         AC_MSG_RESULT([no])
3664     fi
3666     AC_MSG_CHECKING([whether to use ActiveX])
3667     if test "$enable_activex" = "yes" -o "$enable_activex" = "" -a "$vcexpress" != Express; then
3668         DISABLE_ACTIVEX=""
3669         AC_MSG_RESULT([yes])
3670     else
3671         DISABLE_ACTIVEX="TRUE"
3672         AC_MSG_RESULT([no])
3673     fi
3675     AC_MSG_CHECKING([whether to use ATL])
3676     if test "$enable_atl" = "yes" -o "$enable_atl" = "" -a "$vcexpress" != Express; then
3677         DISABLE_ATL=""
3678         AC_DEFINE(HAVE_FEATURE_ATL, 1)
3679         AC_MSG_RESULT([yes])
3680     else
3681         DISABLE_ATL="TRUE"
3682         AC_MSG_RESULT([no])
3683     fi
3684 else
3685     ENABLE_DIRECTX=""
3686     DISABLE_ACTIVEX="TRUE"
3687     DISABLE_ATL="TRUE"
3690 AC_SUBST(ENABLE_DIRECTX)
3691 AC_SUBST(DISABLE_ACTIVEX)
3692 AC_SUBST(DISABLE_ATL)
3695 # dbghelp.dll
3697 if test "$_os" = "WINNT"; then
3698     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3702 # unowinreg.dll
3704 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3705 AC_SUBST(UNOWINREG_DLL)
3707 COM_IS_CLANG=
3708 AC_MSG_CHECKING([whether the compiler is actually Clang])
3709 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3710     #ifndef __clang__
3711     you lose
3712     #endif
3713     int foo=42;
3714     ]])],
3715     [AC_MSG_RESULT([yes])
3716      COM_IS_CLANG=TRUE],
3717     [AC_MSG_RESULT([no])])
3719 if test "$COM_IS_CLANG" = TRUE; then
3720     AC_MSG_CHECKING([the Clang version])
3721     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | ${CC%-cl.exe*} -E -P -`
3722     CLANG_FULL_VERSION=`echo __clang_version__ | ${CC%-cl.exe*} -E -P -`
3723     CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3724     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3725     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3726     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3728 AC_SUBST(COM_IS_CLANG)
3731 # prefix C with ccache if needed
3733 if test "$CCACHE" != ""; then
3734     AC_MSG_CHECKING([whether $CC is already ccached])
3736     AC_LANG_PUSH([C])
3737     save_CFLAGS=$CFLAGS
3738     CFLAGS="$CFLAGS --ccache-skip -O2"
3739     dnl an empty program will do, we're checking the compiler flags
3740     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3741                       [use_ccache=yes], [use_ccache=no])
3742     if test $use_ccache = yes; then
3743         AC_MSG_RESULT([yes])
3744     else
3745         CC="$CCACHE $CC"
3746         AC_MSG_RESULT([no])
3747     fi
3748     CFLAGS=$save_CFLAGS
3749     AC_LANG_POP([C])
3752 # ===================================================================
3753 # check various GCC options that Clang does not support now but maybe
3754 # will somewhen in the future, check them even for GCC, so that the
3755 # flags are set
3756 # ===================================================================
3758 HAVE_GCC_GGDB2=
3759 HAVE_GCC_FINLINE_LIMIT=
3760 HAVE_GCC_FNO_INLINE=
3761 if test "$GCC" = "yes"; then
3762     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3763     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3764         # Option just ignored and silly warning that isn't a real
3765         # warning printed
3766         :
3767     else
3768         save_CFLAGS=$CFLAGS
3769         CFLAGS="$CFLAGS -Werror -ggdb2"
3770         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3771         CFLAGS=$save_CFLAGS
3772     fi
3773     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3774         AC_MSG_RESULT([yes])
3775     else
3776         AC_MSG_RESULT([no])
3777     fi
3779     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3780     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3781         # As above
3782         :
3783     else
3784         save_CFLAGS=$CFLAGS
3785         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3786         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3787         CFLAGS=$save_CFLAGS
3788     fi
3789     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3790         AC_MSG_RESULT([yes])
3791     else
3792         AC_MSG_RESULT([no])
3793     fi
3795     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3796     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3797         # Ditto
3798         :
3799     else
3800         save_CFLAGS=$CFLAGS
3801         CFLAGS="$CFLAGS -Werror -fno-inline"
3802         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3803         CFLAGS=$save_CFLAGS
3804     fi
3805     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3806         AC_MSG_RESULT([yes])
3807     else
3808         AC_MSG_RESULT([no])
3809     fi
3811 AC_SUBST(HAVE_GCC_GGDB2)
3812 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3813 AC_SUBST(HAVE_GCC_FNO_INLINE)
3815 dnl ===================================================================
3816 dnl  Test the gcc version
3817 dnl ===================================================================
3818 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3819     AC_MSG_CHECKING([the GCC version])
3820     _gcc_version=`$CC -dumpversion`
3821     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3823     AC_MSG_RESULT([gcc $_gcc_version])
3825     if test "$GCC_VERSION" -lt 0407; then
3826         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.7.0])
3827     fi
3828 else
3829     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3830     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3831     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3832     # (which reports itself as GCC 4.2.1).
3833     GCC_VERSION=
3835 AC_SUBST(GCC_VERSION)
3837 dnl Set the ENABLE_DBGUTIL variable
3838 dnl ===================================================================
3839 AC_MSG_CHECKING([whether to build with additional debug utilities])
3840 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3841     ENABLE_DBGUTIL="TRUE"
3842     # this is an extra var so it can have different default on different MSVC
3843     # versions (in case there are version specific problems with it)
3844     MSVC_USE_DEBUG_RUNTIME="TRUE"
3846     AC_MSG_RESULT([yes])
3847     # cppunit and graphite expose STL in public headers
3848     if test "$with_system_cppunit" = "yes"; then
3849         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3850     else
3851         with_system_cppunit=no
3852     fi
3853     if test "$with_system_graphite" = "yes"; then
3854         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3855     else
3856         with_system_graphite=no
3857     fi
3858     if test "$with_system_mysql_cppconn" = "yes"; then
3859         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3860     else
3861         with_system_mysql_cppconn=no
3862     fi
3863     if test "$with_system_orcus" = "yes"; then
3864         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3865     else
3866         with_system_orcus=no
3867     fi
3868     if test "$with_system_libcmis" = "yes"; then
3869         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3870     else
3871         with_system_libcmis=no
3872     fi
3873     if test "$with_system_libgltf" = "yes"; then
3874         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3875     else
3876         with_system_libgltf=no
3877     fi
3878     if test "$with_system_hunspell" = "yes"; then
3879         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3880     else
3881         with_system_hunspell=no
3882     fi
3883 else
3884     ENABLE_DBGUTIL=""
3885     MSVC_USE_DEBUG_RUNTIME=""
3886     AC_MSG_RESULT([no])
3888 AC_SUBST(ENABLE_DBGUTIL)
3889 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3891 dnl Set the ENABLE_DEBUG variable.
3892 dnl ===================================================================
3893 AC_MSG_CHECKING([whether to do a debug build])
3894 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3895     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3897 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3898     AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3901 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3902     ENABLE_DEBUG="TRUE"
3903     if test -n "$ENABLE_DBGUTIL" ; then
3904         AC_MSG_RESULT([yes (dbgutil)])
3905     else
3906         AC_MSG_RESULT([yes])
3907     fi
3908 else
3909     ENABLE_DEBUG=""
3910     AC_MSG_RESULT([no])
3912 AC_SUBST(ENABLE_DEBUG)
3914 if test "$enable_sal_log" = yes; then
3915     ENABLE_SAL_LOG=TRUE
3917 AC_SUBST(ENABLE_SAL_LOG)
3919 dnl Selective debuginfo
3920 ENABLE_DEBUGINFO_FOR=
3921 if test -n "$ENABLE_DEBUG"; then
3922     AC_MSG_CHECKING([whether to use selective debuginfo])
3923     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3924         if test "$enable_selective_debuginfo" = "yes"; then
3925             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3926         fi
3927         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3928         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3929     else
3930         ENABLE_DEBUGINFO_FOR=all
3931         AC_MSG_RESULT([no, for all])
3932     fi
3933 else
3934     if test -n "$enable_selective_debuginfo"; then
3935         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3936     fi
3938 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3940 dnl Check for enable symbols option
3941 dnl ===================================================================
3942 AC_MSG_CHECKING([whether to generate debug information])
3943 if test -z "$enable_symbols"; then
3944     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3945         enable_symbols=yes
3946     else
3947         enable_symbols=no
3948     fi
3950 if test "$enable_symbols" != no; then
3951     ENABLE_SYMBOLS=TRUE
3952     AC_MSG_RESULT([yes])
3953 else
3954     ENABLE_SYMBOLS=
3955     AC_MSG_RESULT([no])
3957 AC_SUBST(ENABLE_SYMBOLS)
3959 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3960     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3961     AC_MSG_CHECKING([whether enough memory is available for linking])
3962     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3963     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3964     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3965         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3966     else
3967         AC_MSG_RESULT([yes])
3968     fi
3971 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3972 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3973 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3974 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3975 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3976     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
3978 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
3980 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3981 # By default use the ones specified by our build system,
3982 # but explicit override is possible.
3983 AC_MSG_CHECKING(for explicit AFLAGS)
3984 if test -n "$AFLAGS"; then
3985     AC_MSG_RESULT([$AFLAGS])
3986     x_AFLAGS=
3987 else
3988     AC_MSG_RESULT(no)
3989     x_AFLAGS=[\#]
3991 AC_MSG_CHECKING(for explicit CFLAGS)
3992 if test -n "$CFLAGS"; then
3993     AC_MSG_RESULT([$CFLAGS])
3994     x_CFLAGS=
3995 else
3996     AC_MSG_RESULT(no)
3997     x_CFLAGS=[\#]
3999 AC_MSG_CHECKING(for explicit CXXFLAGS)
4000 if test -n "$CXXFLAGS"; then
4001     AC_MSG_RESULT([$CXXFLAGS])
4002     x_CXXFLAGS=
4003 else
4004     AC_MSG_RESULT(no)
4005     x_CXXFLAGS=[\#]
4007 AC_MSG_CHECKING(for explicit OBJCFLAGS)
4008 if test -n "$OBJCFLAGS"; then
4009     AC_MSG_RESULT([$OBJCFLAGS])
4010     x_OBJCFLAGS=
4011 else
4012     AC_MSG_RESULT(no)
4013     x_OBJCFLAGS=[\#]
4015 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
4016 if test -n "$OBJCXXFLAGS"; then
4017     AC_MSG_RESULT([$OBJCXXFLAGS])
4018     x_OBJCXXFLAGS=
4019 else
4020     AC_MSG_RESULT(no)
4021     x_OBJCXXFLAGS=[\#]
4023 AC_MSG_CHECKING(for explicit LDFLAGS)
4024 if test -n "$LDFLAGS"; then
4025     AC_MSG_RESULT([$LDFLAGS])
4026     x_LDFLAGS=
4027 else
4028     AC_MSG_RESULT(no)
4029     x_LDFLAGS=[\#]
4031 AC_SUBST(AFLAGS)
4032 AC_SUBST(CFLAGS)
4033 AC_SUBST(CXXFLAGS)
4034 AC_SUBST(OBJCFLAGS)
4035 AC_SUBST(OBJCXXFLAGS)
4036 AC_SUBST(LDFLAGS)
4037 AC_SUBST(x_AFLAGS)
4038 AC_SUBST(x_CFLAGS)
4039 AC_SUBST(x_CXXFLAGS)
4040 AC_SUBST(x_OBJCFLAGS)
4041 AC_SUBST(x_OBJCXXFLAGS)
4042 AC_SUBST(x_LDFLAGS)
4045 # determine CPUNAME, OS, ...
4046 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4048 case "$host_os" in
4050 aix*)
4051     COM=GCC
4052     CPUNAME=POWERPC
4053     USING_X11=TRUE
4054     OS=AIX
4055     RTL_OS=AIX
4056     RTL_ARCH=PowerPC
4057     PLATFORMID=aix_powerpc
4058     P_SEP=:
4059     ;;
4061 cygwin*)
4062     COM=MSC
4063     USING_X11=
4064     OS=WNT
4065     RTL_OS=Windows
4066     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4067         P_SEP=";"
4068     else
4069         P_SEP=:
4070     fi
4071     case "$host_cpu" in
4072     i*86|x86_64)
4073         if test "$BITNESS_OVERRIDE" = 64; then
4074             CPUNAME=X86_64
4075             RTL_ARCH=X86_64
4076             PLATFORMID=windows_x86_64
4077             WINDOWS_X64=1
4078             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4079         else
4080             CPUNAME=INTEL
4081             RTL_ARCH=x86
4082             PLATFORMID=windows_x86
4083         fi
4084         ;;
4085     *)
4086         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4087         ;;
4088     esac
4089     SCPDEFS="$SCPDEFS -D_MSC_VER"
4090     ;;
4092 darwin*)
4093     COM=GCC
4094     USING_X11=
4095     OS=MACOSX
4096     RTL_OS=MacOSX
4097     P_SEP=:
4099     case "$host_cpu" in
4100     arm*)
4101         CPUNAME=ARM
4102         RTL_ARCH=ARM_EABI
4103         PLATFORMID=ios_arm
4104         OS=IOS
4105         ;;
4106     i*86)
4107         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4108         ;;
4109     x86_64)
4110         CPUNAME=X86_64
4111         RTL_ARCH=X86_64
4112         PLATFORMID=macosx_x86_64
4113         ;;
4114     *)
4115         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4116         ;;
4117     esac
4118     ;;
4120 dragonfly*)
4121     COM=GCC
4122     USING_X11=TRUE
4123     OS=DRAGONFLY
4124     RTL_OS=DragonFly
4125     P_SEP=:
4127     case "$host_cpu" in
4128     i*86)
4129         CPUNAME=INTEL
4130         RTL_ARCH=x86
4131         PLATFORMID=dragonfly_x86
4132         ;;
4133     x86_64)
4134         CPUNAME=X86_64
4135         RTL_ARCH=X86_64
4136         PLATFORMID=dragonfly_x86_64
4137         ;;
4138     *)
4139         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4140         ;;
4141     esac
4142     ;;
4144 freebsd*)
4145     COM=GCC
4146     USING_X11=TRUE
4147     RTL_OS=FreeBSD
4148     OS=FREEBSD
4149     P_SEP=:
4151     case "$host_cpu" in
4152     i*86)
4153         CPUNAME=INTEL
4154         RTL_ARCH=x86
4155         PLATFORMID=freebsd_x86
4156         ;;
4157     x86_64|amd64)
4158         CPUNAME=X86_64
4159         RTL_ARCH=X86_64
4160         PLATFORMID=freebsd_x86_64
4161         ;;
4162     *)
4163         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4164         ;;
4165     esac
4166     ;;
4168 kfreebsd*)
4169     COM=GCC
4170     USING_X11=TRUE
4171     OS=LINUX
4172     RTL_OS=kFreeBSD
4173     P_SEP=:
4175     case "$host_cpu" in
4177     i*86)
4178         CPUNAME=INTEL
4179         RTL_ARCH=x86
4180         PLATFORMID=kfreebsd_x86
4181         ;;
4182     x86_64)
4183         CPUNAME=X86_64
4184         RTL_ARCH=X86_64
4185         PLATFORMID=kfreebsd_x86_64
4186         ;;
4187     *)
4188         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4189         ;;
4190     esac
4191     ;;
4193 linux-gnu*)
4194     COM=GCC
4195     USING_X11=TRUE
4196     OS=LINUX
4197     RTL_OS=Linux
4198     P_SEP=:
4200     case "$host_cpu" in
4202     aarch64)
4203         CPUNAME=AARCH64
4204         PLATFORMID=linux_aarch64
4205         RTL_ARCH=AARCH64
4206         ;;
4207     alpha)
4208         CPUNAME=AXP
4209         RTL_ARCH=ALPHA
4210         PLATFORMID=linux_alpha
4211         ;;
4212     arm*)
4213         CPUNAME=ARM
4214         EPM_FLAGS="-a arm"
4215         RTL_ARCH=ARM_EABI
4216         PLATFORMID=linux_arm_eabi
4217         case "$host_cpu" in
4218         arm*-linux)
4219             RTL_ARCH=ARM_OABI
4220             PLATFORMID=linux_arm_oabi
4221             ;;
4222         esac
4223         ;;
4224     hppa)
4225         CPUNAME=HPPA
4226         RTL_ARCH=HPPA
4227         EPM_FLAGS="-a hppa"
4228         PLATFORMID=linux_hppa
4229         ;;
4230     i*86)
4231         CPUNAME=INTEL
4232         RTL_ARCH=x86
4233         PLATFORMID=linux_x86
4234         ;;
4235     ia64)
4236         CPUNAME=IA64
4237         RTL_ARCH=IA64
4238         PLATFORMID=linux_ia64
4239         ;;
4240     mips)
4241         CPUNAME=GODSON
4242         RTL_ARCH=MIPS_EB
4243         EPM_FLAGS="-a mips"
4244         PLATFORMID=linux_mips_eb
4245         ;;
4246     mips64)
4247         CPUNAME=GODSON64
4248         RTL_ARCH=MIPS64_EB
4249         EPM_FLAGS="-a mips64"
4250         PLATFORMID=linux_mips64_eb
4251         ;;
4252     mips64el)
4253         CPUNAME=GODSON64
4254         RTL_ARCH=MIPS64_EL
4255         EPM_FLAGS="-a mips64el"
4256         PLATFORMID=linux_mips64_el
4257         ;;
4258     mipsel)
4259         CPUNAME=GODSON
4260         RTL_ARCH=MIPS_EL
4261         EPM_FLAGS="-a mipsel"
4262         PLATFORMID=linux_mips_el
4263         ;;
4264     m68k)
4265         CPUNAME=M68K
4266         RTL_ARCH=M68K
4267         PLATFORMID=linux_m68k
4268         ;;
4269     powerpc)
4270         CPUNAME=POWERPC
4271         RTL_ARCH=PowerPC
4272         PLATFORMID=linux_powerpc
4273         ;;
4274     powerpc64)
4275         CPUNAME=POWERPC64
4276         RTL_ARCH=PowerPC_64
4277         PLATFORMID=linux_powerpc64
4278         ;;
4279     powerpc64le)
4280         CPUNAME=POWERPC64
4281         RTL_ARCH=PowerPC_64_LE
4282         PLATFORMID=linux_powerpc64_le
4283         ;;
4284     sparc)
4285         CPUNAME=SPARC
4286         RTL_ARCH=SPARC
4287         PLATFORMID=linux_sparc
4288         ;;
4289     sparc64)
4290         CPUNAME=SPARC64
4291         RTL_ARCH=SPARC64
4292         PLATFORMID=linux_sparc64
4293         ;;
4294     s390)
4295         CPUNAME=S390
4296         RTL_ARCH=S390
4297         PLATFORMID=linux_s390
4298         ;;
4299     s390x)
4300         CPUNAME=S390X
4301         RTL_ARCH=S390x
4302         PLATFORMID=linux_s390x
4303         ;;
4304     x86_64)
4305         CPUNAME=X86_64
4306         RTL_ARCH=X86_64
4307         PLATFORMID=linux_x86_64
4308         ;;
4309     *)
4310         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4311         ;;
4312     esac
4313     ;;
4315 linux-android*)
4316     COM=GCC
4317     USING_X11=
4318     OS=ANDROID
4319     RTL_OS=Android
4320     P_SEP=:
4322     case "$host_cpu" in
4324     arm|armel)
4325         CPUNAME=ARM
4326         RTL_ARCH=ARM_EABI
4327         PLATFORMID=android_arm_eabi
4328         ;;
4329     aarch64)
4330         CPUNAME=AARCH64
4331         RTL_ARCH=AARCH64
4332         PLATFORMID=android_aarch64
4333         ;;
4334     mips|mipsel)
4335         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4336         RTL_ARCH=MIPS_EL
4337         PLATFORMID=android_mips_el
4338         ;;
4339     i*86)
4340         CPUNAME=INTEL
4341         RTL_ARCH=x86
4342         PLATFORMID=android_x86
4343         ;;
4344     *)
4345         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4346         ;;
4347     esac
4348     ;;
4350 emscripten*)
4351     COM=emcc
4352     USING_X11=
4353     OS=EMSCRIPTEN
4354     RTL_OS=Emscripten
4355     P_SEP=:
4356     CPUNAME=INTEL
4357     RTL_ARCH=x86
4358     PLATFORMID=linux_x86
4359     ;;
4361 mingw*)
4362     COM=GCC
4363     USING_X11=
4364     OS=WNT
4365     RTL_OS=Windows
4366     P_SEP=:
4368     case "$host_cpu" in
4369     i*86|x86_64)
4370         if test "$BITNESS_OVERRIDE" = 64; then
4371             CPUNAME=X86_64
4372             RTL_ARCH=X86_84
4373             PLATFORMID=windows_x86_64
4374             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4375         else
4376             CPUNAME=INTEL
4377             RTL_ARCH=x86
4378             PLATFORMID=windows_x86
4379             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4380         fi
4381         ;;
4382     *)
4383         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4384         ;;
4385     esac
4386     ;;
4388 *netbsd*)
4389     COM=GCC
4390     USING_X11=TRUE
4391     OS=NETBSD
4392     RTL_OS=NetBSD
4393     P_SEP=:
4395     case "$host_cpu" in
4396     i*86)
4397         CPUNAME=INTEL
4398         RTL_ARCH=x86
4399         PLATFORMID=netbsd_x86
4400         ;;
4401     powerpc)
4402         CPUNAME=POWERPC
4403         RTL_ARCH=PowerPC
4404         PLATFORMID=netbsd_powerpc
4405         ;;
4406     sparc)
4407         CPUNAME=SPARC
4408         RTL_ARCH=SPARC
4409         PLATFORMID=netbsd_sparc
4410         ;;
4411     x86_64)
4412         CPUNAME=X86_64
4413         RTL_ARCH=X86_64
4414         PLATFORMID=netbsd_x86_64
4415         ;;
4416     *)
4417         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4418         ;;
4419     esac
4420     ;;
4422 openbsd*)
4423     COM=GCC
4424     USING_X11=TRUE
4425     OS=OPENBSD
4426     RTL_OS=OpenBSD
4427     P_SEP=:
4429     case "$host_cpu" in
4430     i*86)
4431         CPUNAME=INTEL
4432         RTL_ARCH=x86
4433         PLATFORMID=openbsd_x86
4434         ;;
4435     x86_64)
4436         CPUNAME=X86_64
4437         RTL_ARCH=X86_64
4438         PLATFORMID=openbsd_x86_64
4439         ;;
4440     *)
4441         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4442         ;;
4443     esac
4444     SOLARINC="$SOLARINC -I/usr/local/include"
4445     ;;
4447 solaris*)
4448     COM=GCC
4449     USING_X11=TRUE
4450     OS=SOLARIS
4451     RTL_OS=Solaris
4452     P_SEP=:
4454     case "$host_cpu" in
4455     i*86)
4456         CPUNAME=INTEL
4457         RTL_ARCH=x86
4458         PLATFORMID=solaris_x86
4459         ;;
4460     sparc)
4461         CPUNAME=SPARC
4462         RTL_ARCH=SPARC
4463         PLATFORMID=solaris_sparc
4464         ;;
4465     sparc64)
4466         CPUNAME=SPARC64
4467         RTL_ARCH=SPARC64
4468         PLATFORMID=solaris_sparc64
4469         ;;
4470     *)
4471         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4472         ;;
4473     esac
4474     SOLARINC="$SOLARINC -I/usr/local/include"
4475     ;;
4478     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4479     ;;
4480 esac
4482 if test "$with_x" = "no"; then
4483     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4486 ENABLE_HEADLESS=""
4487 if test "$enable_gui" = "no"; then
4488     if test "$USING_X11" != TRUE; then
4489         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4490     fi
4491     USING_X11=
4492     ENABLE_HEADLESS=TRUE
4493     AC_DEFINE(HAVE_FEATURE_UI,0)
4494     test_cairo=yes
4496 AC_SUBST(ENABLE_HEADLESS)
4498 WORKDIR="${BUILDDIR}/workdir"
4499 INSTDIR="${BUILDDIR}/instdir"
4500 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4501 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4502 AC_SUBST(COM)
4503 AC_SUBST(CPUNAME)
4504 AC_SUBST(RTL_OS)
4505 AC_SUBST(RTL_ARCH)
4506 AC_SUBST(EPM_FLAGS)
4507 AC_SUBST(USING_X11)
4508 AC_SUBST([INSTDIR])
4509 AC_SUBST([INSTROOT])
4510 AC_SUBST(OS)
4511 AC_SUBST(P_SEP)
4512 AC_SUBST(WORKDIR)
4513 AC_SUBST(PLATFORMID)
4514 AC_SUBST(WINDOWS_X64)
4515 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4517 dnl ===================================================================
4518 dnl Test which package format to use
4519 dnl ===================================================================
4520 AC_MSG_CHECKING([which package format to use])
4521 if test -n "$with_package_format" -a "$with_package_format" != no; then
4522     for i in $with_package_format; do
4523         case "$i" in
4524         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4525             ;;
4526         *)
4527             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4528 aix - AIX software distribution
4529 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4530 deb - Debian software distribution
4531 pkg - Solaris software distribution
4532 rpm - RedHat software distribution
4534 LibreOffice additionally supports:
4535 archive - .tar.gz or .zip
4536 dmg - Mac OS X .dmg
4537 installed - installation tree
4538 msi - Windows .msi
4539         ])
4540             ;;
4541         esac
4542     done
4543     PKGFORMAT="$with_package_format"
4544     AC_MSG_RESULT([$PKGFORMAT])
4545 else
4546     PKGFORMAT=
4547     AC_MSG_RESULT([none])
4549 AC_SUBST(PKGFORMAT)
4551 dnl ===================================================================
4552 dnl Set up a different compiler to produce tools to run on the build
4553 dnl machine when doing cross-compilation
4554 dnl ===================================================================
4556 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4557 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4558 if test "$cross_compiling" = "yes"; then
4559     AC_MSG_CHECKING([for BUILD platform configuration])
4560     echo
4561     rm -rf CONF-FOR-BUILD config_build.mk
4562     mkdir CONF-FOR-BUILD
4563     # Here must be listed all files needed when running the configure script. In particular, also
4564     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4565     # keep them in the same order as there.
4566     (cd $SRC_ROOT && tar cf - \
4567         config.guess \
4568         bin/get_config_variables \
4569         solenv/bin/getcompver.awk \
4570         solenv/inc/langlist.mk \
4571         config_host.mk.in \
4572         config_host_lang.mk.in \
4573         Makefile.in \
4574         lo.xcent.in \
4575         bin/bffvalidator.sh.in \
4576         bin/odfvalidator.sh.in \
4577         bin/officeotron.sh.in \
4578         instsetoo_native/util/openoffice.lst.in \
4579         config_host/*.in \
4580         sysui/desktop/macosx/Info.plist.in \
4581         ios/lo.xcconfig.in) \
4582     | (cd CONF-FOR-BUILD && tar xf -)
4583     cp configure CONF-FOR-BUILD
4584     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4585     (
4586     unset COM USING_X11 OS CPUNAME
4587     unset CC CXX SYSBASE CFLAGS
4588     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4589     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4590     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4591     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4592     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4593     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4594     cd CONF-FOR-BUILD
4595     sub_conf_opts=""
4596     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4597     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4598     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4599     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4600     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4601     # we need the msi build tools on mingw if we are creating the
4602     # installation set
4603     if test "$WITH_MINGW" = "yes"; then
4604         enable_winegcc_for_build=
4605         for pkgformat in $PKGFORMAT; do
4606             case "$pkgformat" in
4607             msi|native) enable_winegcc_for_build=yes ;;
4608             esac
4609         done
4610         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4611     fi
4612     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4613     # Don't bother having configure look for stuff not needed for the build platform anyway
4614     ./configure \
4615         --disable-cups \
4616         --disable-graphite \
4617         --disable-gtk3 \
4618         --disable-pdfimport \
4619         --disable-postgresql-sdbc \
4620         --with-parallelism="$with_parallelism" \
4621         --without-doxygen \
4622         --without-java \
4623         $sub_conf_opts \
4624         --srcdir=$srcdir \
4625         2>&1 | sed -e 's/^/    /'
4626     test -f ./config_host.mk 2>/dev/null || exit
4627     cp config_host.mk ../config_build.mk
4628     cp config_host_lang.mk ../config_build_lang.mk
4629     mv config.log ../config.Build.log
4630     mkdir -p ../config_build
4631     mv config_host/*.h ../config_build
4632     . ./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
4634     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
4635         VV='$'$V
4636         VV=`eval "echo $VV"`
4637         if test -n "$VV"; then
4638             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4639             echo "$line" >>build-config
4640         fi
4641     done
4643     for V in INSTDIR INSTROOT WORKDIR; do
4644         VV='$'$V
4645         VV=`eval "echo $VV"`
4646         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4647         if test -n "$VV"; then
4648             line="${V}_FOR_BUILD='$VV'"
4649             echo "$line" >>build-config
4650         fi
4651     done
4653     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4654     echo "$line" >>build-config
4656     )
4657     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4658     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])
4659     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4660              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4662     eval `cat CONF-FOR-BUILD/build-config`
4664     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4666     rm -rf CONF-FOR-BUILD
4667 else
4668     OS_FOR_BUILD="$OS"
4669     CC_FOR_BUILD="$CC"
4670     CXX_FOR_BUILD="$CXX"
4671     INSTDIR_FOR_BUILD="$INSTDIR"
4672     INSTROOT_FOR_BUILD="$INSTROOT"
4673     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4674     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4675     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4676     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4677     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4678     WORKDIR_FOR_BUILD="$WORKDIR"
4680 AC_SUBST(OS_FOR_BUILD)
4681 AC_SUBST(INSTDIR_FOR_BUILD)
4682 AC_SUBST(INSTROOT_FOR_BUILD)
4683 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4684 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4685 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4686 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4687 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4688 AC_SUBST(WORKDIR_FOR_BUILD)
4690 dnl ===================================================================
4691 dnl Check for syslog header
4692 dnl ===================================================================
4693 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4695 # placeholder for future crash reporter feature
4696 ENABLE_CRASHDUMP=""
4697 AC_SUBST(ENABLE_CRASHDUMP)
4699 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4700 dnl ===================================================================
4701 AC_MSG_CHECKING([whether to turn warnings to errors])
4702 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4703     ENABLE_WERROR="TRUE"
4704     AC_MSG_RESULT([yes])
4705 else
4706     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4707         ENABLE_WERROR="TRUE"
4708         AC_MSG_RESULT([yes])
4709     else
4710         AC_MSG_RESULT([no])
4711     fi
4713 AC_SUBST(ENABLE_WERROR)
4715 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4716 dnl ===================================================================
4717 AC_MSG_CHECKING([whether to have assert to abort in release code])
4718 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4719     ASSERT_ALWAYS_ABORT="TRUE"
4720     AC_MSG_RESULT([yes])
4721 else
4722     ASSERT_ALWAYS_ABORT="FALSE"
4723     AC_MSG_RESULT([no])
4725 AC_SUBST(ASSERT_ALWAYS_ABORT)
4727 # Determine whether to use ooenv for the instdir installation
4728 # ===================================================================
4729 if test $_os != "WINNT" -a $_os != "Darwin"; then
4730     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4731     if test "$enable_ooenv" = "no"; then
4732         AC_MSG_RESULT([no])
4733     else
4734         ENABLE_OOENV="TRUE"
4735         AC_MSG_RESULT([yes])
4736     fi
4738 AC_SUBST(ENABLE_OOENV)
4740 if test "$USING_X11" != TRUE; then
4741     # be sure to do not mess with unneeded stuff
4742     test_randr=no
4743     test_xrender=no
4744     test_cups=no
4745     test_dbus=no
4746     test_gtk=no
4747     build_gstreamer_1_0=no
4748     build_gstreamer_0_10=no
4749     test_tde=no
4750     test_kde4=no
4751     enable_cairo_canvas=no
4754 dnl ===================================================================
4755 dnl check for cups support
4756 dnl ===================================================================
4757 ENABLE_CUPS=""
4759 if test "$enable_cups" = "no"; then
4760     test_cups=no
4763 AC_MSG_CHECKING([whether to enable CUPS support])
4764 if test "$test_cups" = "yes"; then
4765     ENABLE_CUPS="TRUE"
4766     AC_MSG_RESULT([yes])
4768     AC_MSG_CHECKING([whether cups support is present])
4769     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4770     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4771     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4772         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4773     fi
4775 else
4776     AC_MSG_RESULT([no])
4779 AC_SUBST(ENABLE_CUPS)
4781 # fontconfig checks
4782 if test "$test_fontconfig" = "yes"; then
4783     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4784     SYSTEM_FONTCONFIG=TRUE
4785     FilterLibs "${FONTCONFIG_LIBS}"
4786     FONTCONFIG_LIBS="${filteredlibs}"
4788 AC_SUBST(FONTCONFIG_CFLAGS)
4789 AC_SUBST(FONTCONFIG_LIBS)
4790 AC_SUBST([SYSTEM_FONTCONFIG])
4792 dnl whether to find & fetch external tarballs?
4793 dnl ===================================================================
4794 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4795    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4796        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4797    else
4798        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4799    fi
4801 if test -z "$TARFILE_LOCATION"; then
4802     if test -d "$SRC_ROOT/src" ; then
4803         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4804         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4805     fi
4806     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4807 else
4808     AbsolutePath "$TARFILE_LOCATION"
4809     PathFormat "${absolute_path}"
4810     TARFILE_LOCATION="${formatted_path}"
4812 AC_SUBST(TARFILE_LOCATION)
4814 AC_MSG_CHECKING([whether we want to fetch tarballs])
4815 if test "$enable_fetch_external" != "no"; then
4816     if test "$with_all_tarballs" = "yes"; then
4817         AC_MSG_RESULT(["yes, all of them"])
4818         DO_FETCH_TARBALLS="ALL"
4819     else
4820         AC_MSG_RESULT(["yes, if we use them"])
4821         DO_FETCH_TARBALLS="TRUE"
4822     fi
4823 else
4824     AC_MSG_RESULT([no])
4825     DO_FETCH_TARBALLS=
4827 AC_SUBST(DO_FETCH_TARBALLS)
4829 AC_MSG_CHECKING([whether to build help])
4830 HELP_COMMON_ONLY=FALSE
4831 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4832     BUILD_TYPE="$BUILD_TYPE HELP"
4833     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4834     if test "$with_help" = "common" ; then
4835         HELP_COMMON_ONLY=TRUE
4836         AC_MSG_RESULT([common only])
4837     else
4838         SCPDEFS="$SCPDEFS -DWITH_HELP"
4839         AC_MSG_RESULT([yes])
4840     fi
4841 else
4842     AC_MSG_RESULT([no])
4844 AC_SUBST(HELP_COMMON_ONLY)
4846 dnl Test whether to include MySpell dictionaries
4847 dnl ===================================================================
4848 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4849 if test "$with_myspell_dicts" = "yes"; then
4850     AC_MSG_RESULT([yes])
4851     WITH_MYSPELL_DICTS=TRUE
4852     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4853     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4854 else
4855     AC_MSG_RESULT([no])
4856     WITH_MYSPELL_DICTS=
4858 AC_SUBST(WITH_MYSPELL_DICTS)
4860 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4861 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4862     if test "$with_system_dicts" = yes; then
4863         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4864     fi
4865     with_system_dicts=no
4868 AC_MSG_CHECKING([whether to use dicts from external paths])
4869 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4870     AC_MSG_RESULT([yes])
4871     SYSTEM_DICTS=TRUE
4872     AC_MSG_CHECKING([for spelling dictionary directory])
4873     if test -n "$with_external_dict_dir"; then
4874         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4875     else
4876         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4877         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4878             DICT_SYSTEM_DIR=file:///usr/share/myspell
4879         fi
4880     fi
4881     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4882     AC_MSG_CHECKING([for hyphenation patterns directory])
4883     if test -n "$with_external_hyph_dir"; then
4884         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4885     else
4886         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4887     fi
4888     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4889     AC_MSG_CHECKING([for thesaurus directory])
4890     if test -n "$with_external_thes_dir"; then
4891         THES_SYSTEM_DIR=file://$with_external_thes_dir
4892     else
4893         THES_SYSTEM_DIR=file:///usr/share/mythes
4894     fi
4895     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4896 else
4897     AC_MSG_RESULT([no])
4898     SYSTEM_DICTS=
4900 AC_SUBST(SYSTEM_DICTS)
4901 AC_SUBST(DICT_SYSTEM_DIR)
4902 AC_SUBST(HYPH_SYSTEM_DIR)
4903 AC_SUBST(THES_SYSTEM_DIR)
4905 dnl ===================================================================
4906 dnl enable pch by default on windows
4907 dnl enable it explicitly otherwise
4908 AC_MSG_CHECKING([whether to enable pch feature])
4909 ENABLE_PCH=""
4910 if test "$enable_pch" != "no"; then
4911     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4912         ENABLE_PCH="TRUE"
4913         AC_MSG_RESULT([yes])
4914     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4915         ENABLE_PCH="TRUE"
4916         AC_MSG_RESULT([yes])
4917     elif test -n "$enable_pch"; then
4918         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4919     else
4920         AC_MSG_RESULT([no])
4921     fi
4922 else
4923     AC_MSG_RESULT([no])
4925 AC_SUBST(ENABLE_PCH)
4927 TAB=`printf '\t'`
4929 AC_MSG_CHECKING([the GNU Make version])
4930 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4931 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4932 if test "$_make_longver" -ge "038200"; then
4933     AC_MSG_RESULT([$GNUMAKE $_make_version])
4935 elif test "$_make_longver" -ge "038100"; then
4936     if test "$build_os" = "cygwin"; then
4937         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4938     fi
4939     AC_MSG_RESULT([$GNUMAKE $_make_version])
4941     dnl ===================================================================
4942     dnl Search all the common names for sha1sum
4943     dnl ===================================================================
4944     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4945     if test -z "$SHA1SUM"; then
4946         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4947     elif test "$SHA1SUM" = "openssl"; then
4948         SHA1SUM="openssl sha1"
4949     fi
4950     AC_MSG_CHECKING([for GNU Make bug 20033])
4951     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4952     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4953 A := \$(wildcard *.a)
4955 .PHONY: all
4956 all: \$(A:.a=.b)
4957 <TAB>@echo survived bug20033.
4959 .PHONY: setup
4960 setup:
4961 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4963 define d1
4964 @echo lala \$(1)
4965 @sleep 1
4966 endef
4968 define d2
4969 @echo tyty \$(1)
4970 @sleep 1
4971 endef
4973 %.b : %.a
4974 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4975 <TAB>\$(call d1,\$(CHECKSUM)),\
4976 <TAB>\$(call d2,\$(CHECKSUM)))
4978     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4979         no_parallelism_make="YES"
4980         AC_MSG_RESULT([yes, disable parallelism])
4981     else
4982         AC_MSG_RESULT([no, keep parallelism enabled])
4983     fi
4984     rm -rf $TESTGMAKEBUG20033
4985 else
4986     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4989 # find if gnumake support file function
4990 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4991 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4992 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4993     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4995 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4996 \$(file >test.txt,Success )
4998 .PHONY: all
4999 all:
5000 <TAB>@cat test.txt
5003 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5004 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5005     HAVE_GNUMAKE_FILE_FUNC=TRUE
5006     AC_MSG_RESULT([yes])
5007 else
5008     AC_MSG_RESULT([no])
5010 rm -rf $TESTGMAKEFILEFUNC
5011 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5012 AC_SUBST(GNUMAKE_WIN_NATIVE)
5014 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5015 STALE_MAKE=
5016 if test "$_make_ver_check" = ""; then
5017    STALE_MAKE=TRUE
5020 HAVE_LD_HASH_STYLE=FALSE
5021 WITH_LINKER_HASH_STYLE=
5022 AC_MSG_CHECKING( for --hash-style gcc linker support )
5023 if test "$GCC" = "yes"; then
5024     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5025         hash_styles="gnu sysv"
5026     elif test "$with_linker_hash_style" = "no"; then
5027         hash_styles=
5028     else
5029         hash_styles="$with_linker_hash_style"
5030     fi
5032     for hash_style in $hash_styles; do
5033         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5034         hash_style_ldflags_save=$LDFLAGS
5035         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5037         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5038             [
5039 #include <stdio.h>
5040             ],[
5041 printf ("");
5042             ])],
5043             [
5044                   HAVE_LD_HASH_STYLE=TRUE
5045                   WITH_LINKER_HASH_STYLE=$hash_style
5046             ],
5047             [HAVE_LD_HASH_STYLE=FALSE],
5048             [HAVE_LD_HASH_STYLE=FALSE])
5049         LDFLAGS=$hash_style_ldflags_save
5050     done
5052     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5053         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5054     else
5055         AC_MSG_RESULT( no )
5056     fi
5057     LDFLAGS=$hash_style_ldflags_save
5058 else
5059     AC_MSG_RESULT( no )
5061 AC_SUBST(HAVE_LD_HASH_STYLE)
5062 AC_SUBST(WITH_LINKER_HASH_STYLE)
5064 dnl ===================================================================
5065 dnl Check whether there's a Perl version available.
5066 dnl ===================================================================
5067 if test -z "$with_perl_home"; then
5068     AC_PATH_PROG(PERL, perl)
5069 else
5070     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5071     _perl_path="$with_perl_home/bin/perl"
5072     if test -x "$_perl_path"; then
5073         PERL=$_perl_path
5074     else
5075         AC_MSG_ERROR([$_perl_path not found])
5076     fi
5079 dnl ===================================================================
5080 dnl Testing for Perl version 5 or greater.
5081 dnl $] is the Perl version variable, it is returned as an integer
5082 dnl ===================================================================
5083 if test "$PERL"; then
5084     AC_MSG_CHECKING([the Perl version])
5085     ${PERL} -e "exit($]);"
5086     _perl_version=$?
5087     if test "$_perl_version" -lt 5; then
5088         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5089     fi
5090     AC_MSG_RESULT([checked (perl $_perl_version)])
5091 else
5092     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5095 dnl ===================================================================
5096 dnl Testing for required Perl modules
5097 dnl ===================================================================
5099 AC_MSG_CHECKING([for required Perl modules])
5100 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5101     AC_MSG_RESULT([all modules found])
5102 else
5103     AC_MSG_RESULT([failed to find some modules])
5104     # Find out which modules are missing.
5105     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5106         missing_perl_modules="$missing_perl_modules Cwd"
5107     fi
5108     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5109         missing_perl_modules="$missing_perl_modules Digest::MD5"
5110     fi
5111        AC_MSG_ERROR([
5112     The missing Perl modules are: $missing_perl_modules
5113     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5116 dnl ===================================================================
5117 dnl Check for pkg-config
5118 dnl ===================================================================
5119 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5120     PKG_PROG_PKG_CONFIG
5123 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5125     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5126     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5127     # explicitly. Or put /path/to/compiler in PATH yourself.
5129     # Use wrappers for LTO
5130     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5131         AC_CHECK_TOOL(AR,gcc-ar)
5132         AC_CHECK_TOOL(NM,gcc-nm)
5133         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5134     else
5135         AC_CHECK_TOOL(AR,ar)
5136         AC_CHECK_TOOL(NM,nm)
5137         AC_CHECK_TOOL(RANLIB,ranlib)
5138     fi
5139     AC_CHECK_TOOL(OBJDUMP,objdump)
5140     AC_CHECK_TOOL(READELF,readelf)
5141     AC_CHECK_TOOL(STRIP,strip)
5142     if test "$_os" = "WINNT"; then
5143         AC_CHECK_TOOL(DLLTOOL,dlltool)
5144         AC_CHECK_TOOL(WINDRES,windres)
5145     fi
5147 AC_SUBST(AR)
5148 AC_SUBST(DLLTOOL)
5149 AC_SUBST(NM)
5150 AC_SUBST(OBJDUMP)
5151 AC_SUBST(PKG_CONFIG)
5152 AC_SUBST(RANLIB)
5153 AC_SUBST(READELF)
5154 AC_SUBST(STRIP)
5155 AC_SUBST(WINDRES)
5157 dnl ===================================================================
5158 dnl pkg-config checks on Mac OS X
5159 dnl ===================================================================
5161 if test $_os = Darwin; then
5162     AC_MSG_CHECKING([for bogus pkg-config])
5163     if test -n "$PKG_CONFIG"; then
5164         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5165             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5166         else
5167             if test "$enable_bogus_pkg_config" = "yes"; then
5168                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5169             else
5170                 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.])
5171             fi
5172         fi
5173     else
5174         AC_MSG_RESULT([no, good])
5175     fi
5178 find_csc()
5180     # Return value: $csctest
5182     unset csctest
5184     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5185     if test -n "$regvalue"; then
5186         csctest=$regvalue
5187         return
5188     fi
5191 find_al()
5193     # Return value: $altest
5195     unset altest
5197     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5198         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5199         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5200             altest=$regvalue
5201             return
5202         fi
5203     done
5206 find_dotnetsdk()
5208     # Return value: $frametest (that's a silly name...)
5210     unset frametest
5212     for ver in 1.1 2.0; do
5213         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5214         if test -n "$regvalue"; then
5215             frametest=$regvalue
5216             return
5217         fi
5218     done
5221 find_dotnetsdk46()
5223     unset frametest
5225     for ver in 4.6.1 4.6; do
5226         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5227         if test -n "$regvalue"; then
5228             frametest=$regvalue
5229             return
5230         fi
5231         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5232         if test -n "$regvalue"; then
5233             frametest=$regvalue
5234             return
5235         fi
5236     done
5239 find_winsdk_version()
5241     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5242     # Return values: $winsdktest, $winsdklibsubdir
5244     unset winsdktest winsdklibsubdir
5246     # Why we look for them in this particular order I don't know. But OTOH I
5247     case "$1" in
5248     7.*)
5249         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5250         if test -n "$regvalue"; then
5251             winsdktest=$regvalue
5252             winsdklibsubdir=.
5253             return
5254         fi
5255         ;;
5256     8.1|8.1A)
5257         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5258         if test -n "$regvalue"; then
5259             winsdktest=$regvalue
5260             winsdklibsubdir=winv6.3
5261             return
5262         fi
5263         ;;
5264     8.0|8.0A)
5265         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5266         if test -n "$regvalue"; then
5267             winsdktest=$regvalue
5268             winsdklibsubdir=win8
5269             return
5270         fi
5271         ;;
5272     10.0)
5273         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5274         if test -n "$regvalue"; then
5275             winsdktest=$regvalue
5276             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5277             winsdklibsubdir=$regvalue
5278             return
5279         fi
5280         ;;
5281     esac
5284 find_winsdk()
5286     # Args: $1 (optional) : list of acceptable SDK versions
5287     # Return value: $winsdktest
5289     unset winsdktest
5291     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5292         find_winsdk_version $ver
5293         if test -n "$winsdktest"; then
5294             return
5295         fi
5296     done
5299 find_msms()
5301     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5302     AC_MSG_CHECKING([for $my_msm_file])
5303     msmdir=
5304     for ver in 12.0 14.0; do
5305         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5306         if test -n "$regvalue"; then
5307             if test -e "$regvalue/$my_msm_file"; then
5308                 msmdir=$regvalue
5309                 break
5310             fi
5311         fi
5312     done
5313     dnl Is the following fallback really necessary, or was it added in response
5314     dnl to never having started Visual Studio on a given machine, so the
5315     dnl registry keys checked above had presumably not yet been created?
5316     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5317     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5318     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5319     dnl expanding to "C:\Program Files\Common Files"), which would need
5320     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5321     dnl obtain its value from cygwin:
5322     if test -z "$msmdir"; then
5323         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5324         if test -e "$my_msm_dir/$my_msm_file"; then
5325             msmdir=$my_msm_dir
5326         fi
5327     fi
5328     if test -n "$msmdir"; then
5329         msmdir=`cygpath -m "$msmdir"`
5330         AC_MSG_RESULT([$msmdir])
5331     else
5332         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5333             AC_MSG_ERROR([not found])
5334         else
5335             AC_MSG_WARN([not found])
5336         fi
5337     fi
5340 find_msvc_x64_dlls()
5342     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5343     # http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
5344     # Refactored C Runtime (CRT): This CTP contains the first preview of the substantially refactored CRT.
5345     # msvcr140.dll no longer exists. It is replaced by a trio of DLLs: vcruntime140.dll, appcrt140.dll,
5346     # and desktopcrt140.dll.
5347     if test "$VCVER" = 140; then
5348        msvcdlls="msvcp${VCVER}.dll vcruntime${VCVER}.dll"
5349     else
5350        msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5351     fi
5352     for dll in $msvcdlls; do
5353         if ! test -f "$msvcdllpath/$dll"; then
5354             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5355         fi
5356     done
5359 if test "$build_os" = "cygwin"; then
5360     dnl Check midl.exe
5361     AC_MSG_CHECKING([for midl.exe])
5363     find_winsdk
5364     if test -f "$winsdktest/Bin/midl.exe"; then
5365         MIDL_PATH="$winsdktest/Bin"
5366     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5367         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5368     fi
5369     if test ! -f "$MIDL_PATH/midl.exe"; then
5370         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5371     else
5372         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5373     fi
5375     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5376     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5378     dnl Check csc.exe
5379     AC_MSG_CHECKING([for csc.exe])
5380     find_csc
5381     if test -f "$csctest/csc.exe"; then
5382         CSC_PATH="$csctest"
5383     fi
5384     if test ! -f "$CSC_PATH/csc.exe"; then
5385         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5386     else
5387         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5388     fi
5390     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5392     dnl Check al.exe
5393     AC_MSG_CHECKING([for al.exe])
5394     find_winsdk
5395     if test -f "$winsdktest/Bin/al.exe"; then
5396         AL_PATH="$winsdktest/Bin"
5397     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5398         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5399     fi
5401     if test -z "$AL_PATH"; then
5402         find_al
5403         if test -f "$altest/bin/al.exe"; then
5404             AL_PATH="$altest/bin"
5405         elif test -f "$altest/al.exe"; then
5406             AL_PATH="$altest"
5407         fi
5408     fi
5409     if test ! -f "$AL_PATH/al.exe"; then
5410         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5411     else
5412         AC_MSG_RESULT([$AL_PATH/al.exe])
5413     fi
5415     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5417     dnl Check mscoree.lib / .NET Framework dir
5418     AC_MSG_CHECKING(.NET Framework find_dotnetsdk)
5419     find_dotnetsdk
5420     if test -f "$frametest/lib/mscoree.lib"; then
5421         DOTNET_FRAMEWORK_HOME="$frametest"
5422     else
5423         AC_MSG_CHECKING(.NET Framework find_winsdk)
5424         find_winsdk
5425         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5426             DOTNET_FRAMEWORK_HOME="$winsdktest"
5427         else
5428             AC_MSG_CHECKING(.NET Framework find_dotnetsdk46)
5429             find_dotnetsdk46
5430             PathFormat "$frametest"
5431             frametest="$formatted_path"
5432             AC_MSG_CHECKING(found: $frametest/um/$WINDOWS_SDK_ARCH/mscoree.lib)
5433             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5434                  DOTNET_FRAMEWORK_HOME="$frametest"
5435             fi
5436         fi
5437     fi
5439     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
5440         AC_MSG_ERROR([mscoree.lib not found])
5441     fi
5442     AC_MSG_RESULT(found)
5444     PathFormat "$MIDL_PATH"
5445     MIDL_PATH="$formatted_path"
5447     PathFormat "$AL_PATH"
5448     AL_PATH="$formatted_path"
5450     PathFormat "$DOTNET_FRAMEWORK_HOME"
5451     DOTNET_FRAMEWORK_HOME="$formatted_path"
5453     PathFormat "$CSC_PATH"
5454     CSC_PATH="$formatted_path"
5457 dnl ===================================================================
5458 dnl Check if stdc headers are available excluding MSVC.
5459 dnl ===================================================================
5460 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5461     AC_HEADER_STDC
5464 dnl ===================================================================
5465 dnl Testing for C++ compiler and version...
5466 dnl ===================================================================
5468 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5469     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5470     save_CXXFLAGS=$CXXFLAGS
5471     AC_PROG_CXX
5472     CXXFLAGS=$save_CXXFLAGS
5473 else
5474     if test -n "$CC" -a -z "$CXX"; then
5475         CXX="$CC"
5476     fi
5479 dnl check for GNU C++ compiler version
5480 if test "$GXX" = "yes" -a "$CXX" != "emcc"; then
5481     AC_MSG_CHECKING([the GNU C++ compiler version])
5483     _gpp_version=`$CXX -dumpversion`
5484     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5486     if test "$_gpp_majmin" -lt "401"; then
5487         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5488     else
5489         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5490     fi
5492     dnl see https://code.google.com/p/android/issues/detail?id=41770
5493     if test "$_gpp_majmin" -ge "401"; then
5494         glibcxx_threads=no
5495         AC_LANG_PUSH([C++])
5496         AC_REQUIRE_CPP
5497         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5498         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5499             #include <bits/c++config.h>]],[[
5500             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5501             && !defined(_GLIBCXX__PTHREADS) \
5502             && !defined(_GLIBCXX_HAS_GTHREADS)
5503             choke me
5504             #endif
5505         ]])],[AC_MSG_RESULT([yes])
5506         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5507         AC_LANG_POP([C++])
5508         if test $glibcxx_threads = yes; then
5509             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5510         fi
5511      fi
5513 AC_SUBST(BOOST_CXXFLAGS)
5516 # prefx CXX with ccache if needed
5518 if test "$CCACHE" != ""; then
5519     AC_MSG_CHECKING([whether $CXX is already ccached])
5520     AC_LANG_PUSH([C++])
5521     save_CXXFLAGS=$CXXFLAGS
5522     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5523     dnl an empty program will do, we're checking the compiler flags
5524     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5525                       [use_ccache=yes], [use_ccache=no])
5526     if test $use_ccache = yes; then
5527         AC_MSG_RESULT([yes])
5528     else
5529         CXX="$CCACHE $CXX"
5530         AC_MSG_RESULT([no])
5531     fi
5532     CXXFLAGS=$save_CXXFLAGS
5533     AC_LANG_POP([C++])
5536 dnl ===================================================================
5537 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5538 dnl ===================================================================
5540 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5541     AC_PROG_CXXCPP
5543     dnl Check whether there's a C pre-processor.
5544     AC_PROG_CPP
5548 dnl ===================================================================
5549 dnl Find integral type sizes and alignments
5550 dnl ===================================================================
5552 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5554     AC_CHECK_SIZEOF(long)
5555     AC_CHECK_SIZEOF(short)
5556     AC_CHECK_SIZEOF(int)
5557     AC_CHECK_SIZEOF(long long)
5558     AC_CHECK_SIZEOF(double)
5559     AC_CHECK_SIZEOF(void*)
5561     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5562     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5563     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5564     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5565     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5567     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5568     m4_pattern_allow([AC_CHECK_ALIGNOF])
5569     m4_ifdef([AC_CHECK_ALIGNOF],
5570         [
5571             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5572             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5573             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5574             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5575         ],
5576         [
5577             case "$_os-$host_cpu" in
5578             Linux-i686)
5579                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5580                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5581                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5582                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5583                 ;;
5584             Linux-x86_64)
5585                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5586                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5587                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5588                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5589                 ;;
5590             *)
5591                 if test -z "$ac_cv_alignof_short" -o \
5592                         -z "$ac_cv_alignof_int" -o \
5593                         -z "$ac_cv_alignof_long" -o \
5594                         -z "$ac_cv_alignof_double"; then
5595                    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.])
5596                 fi
5597                 ;;
5598             esac
5599         ])
5601     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5602     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5603     if test $ac_cv_sizeof_long -eq 8; then
5604         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5605     elif test $ac_cv_sizeof_double -eq 8; then
5606         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5607     else
5608         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5609     fi
5611     dnl Check for large file support
5612     AC_SYS_LARGEFILE
5613     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5614         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5615     fi
5616     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5617         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5618     fi
5619 else
5620     # Hardcode for MSVC
5621     SAL_TYPES_SIZEOFSHORT=2
5622     SAL_TYPES_SIZEOFINT=4
5623     SAL_TYPES_SIZEOFLONG=4
5624     SAL_TYPES_SIZEOFLONGLONG=8
5625     if test "$BITNESS_OVERRIDE" = ""; then
5626         SAL_TYPES_SIZEOFPOINTER=4
5627     else
5628         SAL_TYPES_SIZEOFPOINTER=8
5629     fi
5630     SAL_TYPES_ALIGNMENT2=2
5631     SAL_TYPES_ALIGNMENT4=4
5632     SAL_TYPES_ALIGNMENT8=8
5633     LFS_CFLAGS=''
5635 AC_SUBST(LFS_CFLAGS)
5637 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5638 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5639 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5640 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5641 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5642 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5643 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5644 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5646 dnl ===================================================================
5647 dnl Check whether to enable runtime optimizations
5648 dnl ===================================================================
5649 ENABLE_RUNTIME_OPTIMIZATIONS=
5650 AC_MSG_CHECKING([whether to enable runtime optimizations])
5651 if test -z "$enable_runtime_optimizations"; then
5652     for i in $CC; do
5653         case $i in
5654         -fsanitize=*)
5655             enable_runtime_optimizations=no
5656             break
5657             ;;
5658         esac
5659     done
5661 if test "$enable_runtime_optimizations" != no; then
5662     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5663     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5664     AC_MSG_RESULT([yes])
5665 else
5666     AC_MSG_RESULT([no])
5668 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5670 dnl ===================================================================
5671 dnl Check if valgrind headers are available
5672 dnl ===================================================================
5673 ENABLE_VALGRIND=
5674 if test "$cross_compiling" != yes; then
5675     prev_cppflags=$CPPFLAGS
5676     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5677     # or where does it come from?
5678     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5679     AC_CHECK_HEADER([valgrind/valgrind.h],
5680         [ENABLE_VALGRIND=TRUE])
5681     CPPFLAGS=$prev_cppflags
5683 AC_SUBST([ENABLE_VALGRIND])
5684 if test -z "$ENABLE_VALGRIND"; then
5685     VALGRIND_CFLAGS=
5687 AC_SUBST([VALGRIND_CFLAGS])
5690 dnl ===================================================================
5691 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5692 dnl ===================================================================
5694 # We need at least the sys/sdt.h include header.
5695 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5696 if test "$SDT_H_FOUND" = "TRUE"; then
5697     # Found sys/sdt.h header, now make sure the c++ compiler works.
5698     # Old g++ versions had problems with probes in constructors/destructors.
5699     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5700     AC_LANG_PUSH([C++])
5701     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5702     #include <sys/sdt.h>
5703     class ProbeClass
5704     {
5705     private:
5706       int& ref;
5707       const char *name;
5709     public:
5710       ProbeClass(int& v, const char *n) : ref(v), name(n)
5711       {
5712         DTRACE_PROBE2(_test_, cons, name, ref);
5713       }
5715       void method(int min)
5716       {
5717         DTRACE_PROBE3(_test_, meth, name, ref, min);
5718         ref -= min;
5719       }
5721       ~ProbeClass()
5722       {
5723         DTRACE_PROBE2(_test_, dest, name, ref);
5724       }
5725     };
5726     ]],[[
5727     int i = 64;
5728     DTRACE_PROBE1(_test_, call, i);
5729     ProbeClass inst = ProbeClass(i, "call");
5730     inst.method(24);
5731     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5732           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5733     AC_LANG_POP([C++])
5735 AC_CONFIG_HEADERS([config_host/config_probes.h])
5737 dnl ===================================================================
5738 dnl Set the MinGW sys-root
5739 dnl ===================================================================
5740 if test "$WITH_MINGW" = "yes"; then
5741     AC_MSG_CHECKING([for MinGW sysroot])
5742     sysroot=`$CC -print-sysroot`
5743     AS_IF([test -d "$sysroot"/mingw],
5744           [MINGW_SYSROOT="$sysroot"/mingw
5745            AC_MSG_RESULT([$MINGW_SYSROOT])],
5746           [AC_MSG_RESULT([not found])
5747            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5749 AC_SUBST([MINGW_DLLS])
5750 AC_SUBST([MINGW_SYSROOT])
5752 dnl ===================================================================
5753 dnl Set the MinGW include directories
5754 dnl ===================================================================
5755 if test "$WITH_MINGW" = "yes"; then
5756     AC_MSG_CHECKING([for MinGW include path])
5757     cat >conftest.$ac_ext <<_ACEOF
5758 #include <stddef.h>
5759 #include <bits/c++config.h>
5760 _ACEOF
5761     _mingw_lib_include_path=`$CXX -E -xc++ conftest.$ac_ext | $SED -n -e '/.*1*"\(.*\)\/stddef.h".*/s//\1/p' -e '/.*1*"\(.*\)\/bits\/c++config.h".*/s//\1/p' | sort -u | xargs echo`
5762     rm conftest.$ac_ext
5763     if test -z "$_mingw_lib_include_path"; then
5764         _mingw_lib_include_path="NO_LIB_INCLUDE"
5765         AC_MSG_RESULT([no MinGW include path])
5766     else
5767         AC_MSG_RESULT([$_mingw_lib_include_path])
5768     fi
5769     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5770     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5772     AC_LANG_PUSH([C++])
5774     AC_MSG_CHECKING([for dynamic libgcc])
5775     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5776 #include <iostream>
5777 using namespace std;
5778 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5779             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5780             if test -n "$MINGW_GCCDLL"; then
5781                 MINGW_SHARED_GCCLIB=TRUE
5782                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5783             else
5784                 MINGW_SHARED_GCCLIB=
5785                 AC_MSG_RESULT([no])
5786             fi
5787        ],[ AC_MSG_RESULT([no])
5789     ])
5791     AC_MSG_CHECKING([for dynamic libstdc++])
5792     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5793 #include <iostream>
5794 using namespace std;
5795 ]], [[ cout << "Hello there." << endl; ]])],[
5796             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5797             if test -n "$MINGW_GXXDLL"; then
5798                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5799                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5800                 if test "$CROSS_COMPILING" = "TRUE"; then
5801                     dnl m4 escaping!
5802                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5803                 fi
5804                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5805                 MINGW_SHARED_GXXLIB=TRUE
5806                 AC_MSG_RESULT([$MINGW_GXXDLL])
5807             else
5808                 MINGW_SHARED_GXXLIB=
5809                 AC_MSG_RESULT([no])
5810             fi
5811        ],[ AC_MSG_RESULT([no])
5813     ])
5815     AC_LANG_POP([C++])
5817     AC_SUBST(MINGW_SHARED_GCCLIB)
5818     AC_SUBST(MINGW_SHARED_GXXLIB)
5819     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5820     AC_SUBST(MINGW_GCCDLL)
5821     AC_SUBST(MINGW_GXXDLL)
5824 dnl *************************************************************
5825 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5826 dnl *************************************************************
5827 if test "$WITH_MINGW" = "yes"; then
5828     AC_MSG_CHECKING([exception type])
5829     AC_LANG_PUSH([C++])
5830     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5832         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5834         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5835     ])
5836     AC_MSG_RESULT($exceptions_type)
5837     AC_LANG_POP([C++])
5840 EXCEPTIONS="$exceptions_type"
5841 AC_SUBST(EXCEPTIONS)
5843 dnl ===================================================================
5844 dnl thread-safe statics
5845 dnl ===================================================================
5846 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5847 unset HAVE_THREADSAFE_STATICS
5848 if test "$GCC" = "yes"; then
5849     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5850     dnl us.  However, some C++ runtimes use a single lock for all static
5851     dnl variables, which can cause deadlock in multi-threaded applications.
5852     dnl This is not easily tested here; for POSIX-based systems, if executing
5853     dnl the following C++ program does not terminate then the tool chain
5854     dnl apparently has this problem:
5855     dnl
5856     dnl   #include <pthread.h>
5857     dnl   int h() { return 0; }
5858     dnl   void * g(void * unused) {
5859     dnl     static int n = h();
5860     dnl     return &n;
5861     dnl   }
5862     dnl   int f() {
5863     dnl     pthread_t t;
5864     dnl     pthread_create(&t, 0, g, 0);
5865     dnl     pthread_join(t, 0);
5866     dnl     return 0;
5867     dnl   }
5868     dnl   int main() {
5869     dnl     static int n = f();
5870     dnl     return n;
5871     dnl   }
5872     dnl
5873     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5874     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5875     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5876     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5877     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5878     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5879     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5880     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5881     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5882     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5883     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5884     dnl "too old"):
5885     if test "$_os" = Darwin; then
5886         dnl On Mac OS X, both /usr/lib/libstdc++.6.dylib and
5887         dnl /usr/lib/libc++1.dylib delegate to /usr/lib/libc++abi.dylib for the
5888         dnl __cxa_guard_* functionality; up to 10.8, libc++abi.dylib is
5889         dnl apparently provided by a libcppabi project that has broken semantics
5890         dnl (cf. <http://www.opensource.apple.com/source/libcppabi/libcppabi-26/
5891         dnl src/cxa_guard.cxx>), while in 10.9 (verified at least on 10.9.4) it
5892         dnl is apparently provided by LLVM's libcxxabi project, which has good
5893         dnl semantics (cf. <http://llvm.org/svn/llvm-project/libcxxabi/trunk/
5894         dnl src/cxa_guard.cpp>):
5895         if test "$MAC_OS_X_VERSION_MIN_REQUIRED" -ge 1090; then
5896             HAVE_THREADSAFE_STATICS=TRUE
5897         fi
5898     elif test "$_os" != Android; then
5899         if test "$COM_IS_CLANG" = TRUE; then
5900             AC_LANG_PUSH([C++])
5901             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5902 #include <list>
5903 #if defined __GLIBCXX__
5904 #if __GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306
5905 #error
5906 #endif
5907 #endif
5908                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5909             AC_LANG_POP([C++])
5910         else # known to work in GCC since version 4.3
5911             HAVE_THREADSAFE_STATICS=TRUE
5912         fi
5913     fi
5914     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5915         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5916         AC_MSG_RESULT([yes])
5917     else
5918         AC_MSG_RESULT([broken (i.e., no)])
5919     fi
5920 else
5921     # MSVC has sprouted C++11 thread-safe statics in 2015
5922     # http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
5923     if test "$COM" = "MSC" -a "$VCVER" -ge "140"; then
5924         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5925         AC_MSG_RESULT([yes])
5926     else
5927         AC_MSG_RESULT([no])
5928     fi
5930 AC_SUBST(HAVE_THREADSAFE_STATICS)
5932 dnl ===================================================================
5933 dnl visibility and other gcc features
5934 dnl ===================================================================
5935 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5936     if test "$COM" != MSC; then
5937         AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5938         save_CFLAGS=$CFLAGS
5939         CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5940         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5941         CFLAGS=$save_CFLAGS
5942         if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5943             AC_MSG_RESULT([yes])
5944         else
5945             AC_MSG_ERROR([no  This is no longer supported.])
5946         fi
5947     fi
5949     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5950     save_CFLAGS=$CFLAGS
5951     CFLAGS="$CFLAGS -Werror -mno-avx"
5952     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5953     CFLAGS=$save_CFLAGS
5954     if test "$HAVE_GCC_AVX" = "TRUE"; then
5955         AC_MSG_RESULT([yes])
5956     else
5957         AC_MSG_RESULT([no])
5958     fi
5960     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5961     save_CFLAGS=$CFLAGS
5962     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5963     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5964     CFLAGS=$save_CFLAGS
5965     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5966         AC_MSG_RESULT([yes])
5967     else
5968         AC_MSG_RESULT([no])
5969     fi
5971     AC_MSG_CHECKING([whether $CC supports atomic functions])
5972     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5973     int v = 0;
5974     if (__sync_add_and_fetch(&v, 1) != 1 ||
5975         __sync_sub_and_fetch(&v, 1) != 0)
5976         return 1;
5977     __sync_synchronize();
5978     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5979         v != 1)
5980         return 1;
5981     return 0;
5982 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5983     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5984         AC_MSG_RESULT([yes])
5985         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5986     else
5987         AC_MSG_RESULT([no])
5988     fi
5990     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5991     save_CFLAGS=$CFLAGS
5992     CFLAGS="$CFLAGS -Werror"
5993     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5994             __attribute__((deprecated("test"))) void f();
5995         ])], [
5996             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5997             AC_MSG_RESULT([yes])
5998         ], [AC_MSG_RESULT([no])])
5999     CFLAGS=$save_CFLAGS
6001     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
6002     AC_LANG_PUSH([C++])
6003     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6004             #include <cstddef>
6005             #include <cxxabi.h>
6006             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6007         ])], [
6008             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6009             AC_MSG_RESULT([yes])
6010         ], [AC_MSG_RESULT([no])])
6011     AC_LANG_POP([C++])
6013     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
6014     AC_LANG_PUSH([C++])
6015     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6016             #include <cstddef>
6017             #include <cxxabi.h>
6018             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6019         ])], [
6020             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6021             AC_MSG_RESULT([yes])
6022         ], [AC_MSG_RESULT([no])])
6023     AC_LANG_POP([C++])
6025     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6026     AC_LANG_PUSH([C++])
6027     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6028             #include <cxxabi.h>
6029             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6030         ])], [
6031             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6032             AC_MSG_RESULT([yes])
6033         ], [AC_MSG_RESULT([no])])
6034     AC_LANG_POP([C++])
6036     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6037     AC_LANG_PUSH([C++])
6038     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6039             #include <cstddef>
6040             #include <cxxabi.h>
6041             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6042         ])], [
6043             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6044             AC_MSG_RESULT([yes])
6045         ], [AC_MSG_RESULT([no])])
6046     AC_LANG_POP([C++])
6048     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6049     AC_LANG_PUSH([C++])
6050     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6051             #include <cstddef>
6052             #include <cxxabi.h>
6053             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6054         ])], [
6055             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6056             AC_MSG_RESULT([yes])
6057         ], [AC_MSG_RESULT([no])])
6058     AC_LANG_POP([C++])
6060     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6061     AC_LANG_PUSH([C++])
6062     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6063             #include <cxxabi.h>
6064             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6065         ])], [
6066             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6067             AC_MSG_RESULT([yes])
6068         ], [AC_MSG_RESULT([no])])
6069     AC_LANG_POP([C++])
6071     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6072     AC_LANG_PUSH([C++])
6073     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6074             #include <cxxabi.h>
6075             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6076         ])], [
6077             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6078             AC_MSG_RESULT([yes])
6079         ], [AC_MSG_RESULT([no])])
6080     AC_LANG_POP([C++])
6082     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6083     AC_LANG_PUSH([C++])
6084     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6085             #include <cstddef>
6086             #include <cxxabi.h>
6087             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6088         ])], [
6089             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6090             AC_MSG_RESULT([yes])
6091         ], [AC_MSG_RESULT([no])])
6092     AC_LANG_POP([C++])
6094     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6095     AC_LANG_PUSH([C++])
6096     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6097             #include <cstddef>
6098             #include <cxxabi.h>
6099             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6100         ])], [
6101             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6102             AC_MSG_RESULT([yes])
6103         ], [AC_MSG_RESULT([no])])
6104     AC_LANG_POP([C++])
6106     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6107     AC_LANG_PUSH([C++])
6108     save_CXXFLAGS=$CXXFLAGS
6109     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
6110     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6111             #include <string>
6112             void f() { std::string s; }
6113         ])], [
6114             AC_MSG_RESULT([no])
6115         ], [
6116             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6117             AC_MSG_RESULT([yes])])
6118     CXXFLAGS=$save_CXXFLAGS
6119     AC_LANG_POP([C++])
6122 AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6123 AC_LANG_PUSH([C++])
6124 save_CXXFLAGS=$CXXFLAGS
6125 CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
6126 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6127         struct __attribute__((warn_unused)) dummy {};
6128     ])], [
6129         AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6130         AC_MSG_RESULT([yes])
6131     ], [AC_MSG_RESULT([no])])
6132 CXXFLAGS=$save_CXXFLAGS
6133 AC_LANG_POP([C++])
6135 AC_SUBST(HAVE_GCC_AVX)
6136 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6137 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6139 dnl ===================================================================
6140 dnl Identify the C++ library
6141 dnl ===================================================================
6143 AC_MSG_CHECKING([What the C++ library is])
6144 AC_LANG_PUSH([C++])
6145 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6146 #include <utility>
6147 #ifndef __GLIBCXX__
6148 foo bar
6149 #endif
6150 ]])],
6151     [CPP_LIBRARY=GLIBCXX
6152      cpp_library_name="GNU libstdc++"
6153     ],
6154     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6155 #include <utility>
6156 #ifndef _LIBCPP_VERSION
6157 foo bar
6158 #endif
6159 ]])],
6160     [CPP_LIBRARY=LIBCPP
6161      cpp_library_name="LLVM libc++"
6162     ],
6163     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6164 #include <utility>
6165 #ifndef _MSC_VER
6166 foo bar
6167 #endif
6168 ]])],
6169     [CPP_LIBRARY=MSVCRT
6170      cpp_library_name="Microsoft"
6171     ],
6172     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6173 AC_MSG_RESULT([$cpp_library_name])
6174 AC_LANG_POP([C++])
6176 dnl ===================================================================
6177 dnl C++11
6178 dnl ===================================================================
6180 CXXFLAGS_CXX11=
6181 if test "$COM" = MSC; then
6182     AC_MSG_CHECKING([whether $CXX supports C++11])
6183     AC_MSG_RESULT(yes)
6184     # MSVC supports (a subset of) CXX11 without any switch
6185 elif test "$GCC" = "yes"; then
6186     HAVE_CXX11=
6187     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
6188     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
6189         save_CXXFLAGS=$CXXFLAGS
6190         CXXFLAGS="$CXXFLAGS $flag -Werror"
6191         AC_LANG_PUSH([C++])
6192         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6193             #include <algorithm>
6194             #include <functional>
6195             #include <vector>
6196             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6197                 std::sort(v.begin(), v.end(), fn);
6198             }
6199             ]])],[CXXFLAGS_CXX11=$flag])
6200         AC_LANG_POP([C++])
6201         CXXFLAGS=$save_CXXFLAGS
6202         if test -n "$CXXFLAGS_CXX11"; then
6203             HAVE_CXX11=TRUE
6204             break
6205         fi
6206     done
6207     if test "$HAVE_CXX11" = TRUE; then
6208         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6209     else
6210         AC_MSG_ERROR(no)
6211     fi
6214 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6215 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6216 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6217 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6218 dnl again towards 4.7.2:
6219 if test $CPP_LIBRARY = GLIBCXX; then
6220     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6221     AC_LANG_PUSH([C++])
6222     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6223 #include <list>
6224 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6225     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6226     //   GCC 4.7.0: 20120322
6227     //   GCC 4.7.1: 20120614
6228     // and using a range check is not possible as the mapping between
6229     // __GLIBCXX__ values and GCC versions is not monotonic
6230 /* ok */
6231 #else
6232 abi broken
6233 #endif
6234         ]])], [AC_MSG_RESULT(no, ok)],
6235         [AC_MSG_ERROR(yes)])
6236     AC_LANG_POP([C++])
6239 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6240 save_CXXFLAGS=$CXXFLAGS
6241 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6242 AC_LANG_PUSH([C++])
6244 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6245 #include <stddef.h>
6247 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6249 namespace
6251         struct b
6252         {
6253                 int i;
6254                 int j;
6255         };
6257 ]], [[
6258 struct a
6260         int i;
6261         int j;
6263 a thinga[]={{0,0}, {1,1}};
6264 b thingb[]={{0,0}, {1,1}};
6265 size_t i = sizeof(sal_n_array_size(thinga));
6266 size_t j = sizeof(sal_n_array_size(thingb));
6267 return !(i != 0 && j != 0);
6269     ], [ AC_MSG_RESULT(yes) ],
6270     [ AC_MSG_ERROR(no)])
6271 AC_LANG_POP([C++])
6272 CXXFLAGS=$save_CXXFLAGS
6274 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6275 save_CXXFLAGS=$CXXFLAGS
6276 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6277 AC_LANG_PUSH([C++])
6279 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6280 #include <vector>
6281     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6282     // (__float128)
6284     ],[ AC_MSG_RESULT(yes) ],
6285     [
6286         AC_MSG_RESULT(no)
6287         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6288         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6289         # __float128 is available during its build, but it's usually built using GCC,
6290         # and so c++config.h hardcodes __float128 being supported). As the only place
6291         # where __float128 is actually used is in a template specialization,
6292         # -D__float128=void will avoid the problem there while still causing a problem
6293         # if somebody actually uses the type.
6294         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6295         CXXFLAGS="$CXXFLAGS -D__float128=void"
6296         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6297 #include <vector>
6298     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6299     // (__float128)
6301     ],
6302     [
6303      AC_MSG_RESULT(yes)
6304      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6305     ],
6306     [
6307      AC_MSG_ERROR(no)
6308     ])
6311 AC_LANG_POP([C++])
6312 CXXFLAGS=$save_CXXFLAGS
6314 AC_SUBST(CXXFLAGS_CXX11)
6316 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6317 save_CXXFLAGS=$CXXFLAGS
6318 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6319 AC_LANG_PUSH([C++])
6320 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6321     struct S {
6322         int n_;
6323         constexpr S(int n): n_(n) {}
6324     };
6325     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6326 AC_LANG_POP([C++])
6327 CXXFLAGS=$save_CXXFLAGS
6328 AC_MSG_RESULT([$cxx11_constexpr])
6329 if test "$cxx11_constexpr" = yes; then
6330     AC_DEFINE([HAVE_CXX11_CONSTEXPR])
6333 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6334 save_CXXFLAGS=$CXXFLAGS
6335 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6336 AC_LANG_PUSH([C++])
6337 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6338     // A somewhat over-complicated way of checking for
6339     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6340     // in constexpr function":
6341     #include <cassert>
6342     template<typename T> inline constexpr T f(T x) { return x; }
6343     template<typename T> inline constexpr T g(T x) {
6344         assert(f(static_cast<int>(x)));
6345         return x;
6346     }
6347     enum E { e };
6348     auto v = g(E::e);
6350     struct S {
6351         int n_;
6352         constexpr bool f() {
6353             int n = n_;
6354             int i = 0;
6355             while (n > 0) { --n; ++i; }
6356             return i == 0;
6357         }
6358     };
6359     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6360 AC_LANG_POP([C++])
6361 CXXFLAGS=$save_CXXFLAGS
6362 AC_MSG_RESULT([$cxx14_constexpr])
6363 if test "$cxx14_constexpr" = yes; then
6364     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6367 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6368 save_CXXFLAGS=$CXXFLAGS
6369 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6370 AC_LANG_PUSH([C++])
6371 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6372     struct S {
6373         void f() &;
6374         void f() &&;
6375     };
6376     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6377 AC_LANG_POP([C++])
6378 CXXFLAGS=$save_CXXFLAGS
6379 AC_MSG_RESULT([$cxx11_ref_qualifier])
6380 if test "$cxx11_ref_qualifier" = yes; then
6381     AC_DEFINE([HAVE_CXX11_REF_QUALIFIER])
6384 AC_MSG_CHECKING([whether $CXX supports C++11 char16_t string literals])
6385 save_CXXFLAGS=$CXXFLAGS
6386 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6387 AC_LANG_PUSH([C++])
6388 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6389     auto s = u"";
6390     ]])], [cxx11_utf16_string_literal=yes], [cxx11_utf16_string_literal=no])
6391 AC_LANG_POP([C++])
6392 CXXFLAGS=$save_CXXFLAGS
6393 AC_MSG_RESULT([$cxx11_utf16_string_literal])
6394 if test "$cxx11_utf16_string_literal" = yes; then
6395     AC_DEFINE([HAVE_CXX11_UTF16_STRING_LITERAL])
6398 AC_MSG_CHECKING([whether $CXX supports C++14 sized deallocation])
6399 dnl At least Clang -fsanitize=address causes "multiple definition of
6400 dnl `operator delete(void*, unsigned long)'" also defined in
6401 dnl projects/compiler-rt/lib/asan/asan_new_delete.cc:
6402 save_CXX=$CXX
6403 if test "$COM_IS_CLANG" = TRUE; then
6404     my_CXX=
6405     for i in $CXX; do
6406         case $i in
6407         -fsanitize=address)
6408             ;;
6409         *)
6410             my_CXX="$my_CXX $i"
6411             ;;
6412         esac
6413     done
6414     CXX=$my_CXX
6416 save_CXXFLAGS=$CXXFLAGS
6417 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6418 AC_LANG_PUSH([C++])
6419 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
6420     #include <cstddef>
6421     #include <cstdlib>
6422     void operator delete(void *) throw () { std::exit(1); }
6423     void operator delete(void *, std::size_t) throw () { std::exit(0); }
6424     struct S { S() { throw 0; } };
6425     ]],[[
6426     try { new S; } catch (...) {}
6427     return 1;
6428     ]])], [cxx14_sized_deallocation=yes], [cxx14_sized_deallocation=no], [cxx14_sized_deallocation=no])
6429 AC_LANG_POP([C++])
6430 CXX=$save_CXX
6431 CXXFLAGS=$save_CXXFLAGS
6432 AC_MSG_RESULT([$cxx14_sized_deallocation])
6433 if test "$cxx14_sized_deallocation" = yes; then
6434     AC_DEFINE([HAVE_CXX14_SIZED_DEALLOCATION])
6437 HAVE_GCC_PRAGMA_OPERATOR=
6438 dnl _Pragma support (may require C++11)
6439 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6440     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6441     AC_LANG_PUSH([C++])
6442     save_CXXFLAGS=$CXXFLAGS
6443     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6444     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6445             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6446         ])], [
6447             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6448             HAVE_GCC_PRAGMA_OPERATOR=1
6449             AC_MSG_RESULT([yes])
6450         ], [AC_MSG_RESULT([no])])
6451     AC_LANG_POP([C++])
6452     CXXFLAGS=$save_CXXFLAGS
6454 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6456 HAVE_GCC_FNO_FNO_SIZED_DEALLOCATION=
6457 if test "$GCC" = yes; then
6458     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6459     AC_LANG_PUSH([C++])
6460     save_CXXFLAGS=$CXXFLAGS
6461     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6462     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6463     CXXFLAGS=$save_CXXFLAGS
6464     AC_LANG_POP([C++])
6465     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6466         AC_MSG_RESULT([yes])
6467     else
6468         AC_MSG_RESULT([no])
6469     fi
6471 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6473 dnl ===================================================================
6474 dnl system stl sanity tests
6475 dnl ===================================================================
6476 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6478     AC_LANG_PUSH([C++])
6480     save_CPPFLAGS="$CPPFLAGS"
6481     if test -n "$MACOSX_SDK_PATH"; then
6482         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6483     fi
6485     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6486     # only.
6487     if test "$CPP_LIBRARY" = GLIBCXX; then
6488         dnl gcc#19664, gcc#22482, rhbz#162935
6489         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6490         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6491         AC_MSG_RESULT([$stlvisok])
6492         if test "$stlvisok" = "no"; then
6493             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6494         fi
6495     fi
6497     sharedlink_ldflags_save=$LDFLAGS
6498     LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6500     AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6501     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6502 #include <sstream>
6503 using namespace std;
6504         ]], [[
6505 istringstream strm( "test" ); return 0;
6506         ]])],
6507         # Ugh, surely bad to assume an error message will contain
6508         # the word "unresolvable", a problem with
6509         # -fvisibility-inlines-hidden and STL headers might cause
6510         # some more obscure message on some platform, and anway,
6511         # the error message could be localised.
6512         [$EGREP -q unresolvable conftest.err;
6513         if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6514     ])
6515     AC_MSG_RESULT([$gccvisok])
6516     if test "$gccvisok" = "no"; then
6517         AC_MSG_ERROR([Your gcc is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6518     fi
6520     LDFLAGS=$sharedlink_ldflags_save
6522     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6523     # when we don't make any dynamic libraries?
6524     if test "$DISABLE_DYNLOADING" = ""; then
6525         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6526         cat > conftestlib1.cc <<_ACEOF
6527 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6528 struct S2: S1<int> { virtual ~S2(); };
6529 S2::~S2() {}
6530 _ACEOF
6531         cat > conftestlib2.cc <<_ACEOF
6532 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6533 struct S2: S1<int> { virtual ~S2(); };
6534 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6535 _ACEOF
6536         gccvisinlineshiddenok=yes
6537         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6538             gccvisinlineshiddenok=no
6539         else
6540             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6541             dnl known to not work with -z defs (unsetting which makes the test
6542             dnl moot, though):
6543             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6544             if test "$COM_IS_CLANG" = TRUE; then
6545                 for i in $CXX; do
6546                     case $i in
6547                     -fsanitize=*)
6548                         my_linkflagsnoundefs=
6549                         break
6550                         ;;
6551                     esac
6552                 done
6553             fi
6554             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6555                 gccvisinlineshiddenok=no
6556             fi
6557         fi
6559         rm -fr libconftest*
6560         AC_MSG_RESULT([$gccvisinlineshiddenok])
6561         if test "$gccvisinlineshiddenok" = "no"; then
6562             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6563         fi
6564     fi
6566     AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6567     cat >visibility.cxx <<_ACEOF
6568 #pragma GCC visibility push(hidden)
6569 struct __attribute__ ((visibility ("default"))) TestStruct {
6570   static void Init();
6572 __attribute__ ((visibility ("default"))) void TestFunc() {
6573   TestStruct::Init();
6575 _ACEOF
6576     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6577         gccvisbroken=yes
6578     else
6579         case "$host_cpu" in
6580         i?86|x86_64)
6581             if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6582                 gccvisbroken=no
6583             else
6584                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6585                     gccvisbroken=no
6586                 else
6587                     gccvisbroken=yes
6588                 fi
6589             fi
6590             ;;
6591         *)
6592             gccvisbroken=no
6593             ;;
6594         esac
6595     fi
6596     rm -f visibility.s visibility.cxx
6598     AC_MSG_RESULT([$gccvisbroken])
6599     if test "$gccvisbroken" = "yes"; then
6600         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6601     fi
6603     CPPFLAGS="$save_CPPFLAGS"
6605     AC_LANG_POP([C++])
6608 dnl ===================================================================
6609 dnl  Clang++ tests
6610 dnl ===================================================================
6612 HAVE_GCC_FNO_DEFAULT_INLINE=
6613 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6614 if test "$GCC" = "yes"; then
6615     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6616     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6617         # Option just ignored and silly warning that isn't a real
6618         # warning printed
6619         :
6620     else
6621         AC_LANG_PUSH([C++])
6622         save_CXXFLAGS=$CXXFLAGS
6623         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6624         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6625         CXXFLAGS=$save_CXXFLAGS
6626         AC_LANG_POP([C++])
6627     fi
6628     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6629         AC_MSG_RESULT([yes])
6630     else
6631         AC_MSG_RESULT([no])
6632     fi
6634     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6635     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6636         # As above
6637         :
6638     else
6639         AC_LANG_PUSH([C++])
6640         save_CXXFLAGS=$CXXFLAGS
6641         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6642         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6643         CXXFLAGS=$save_CXXFLAGS
6644         AC_LANG_POP([C++])
6645     fi
6646     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6647         AC_MSG_RESULT([yes])
6648     else
6649         AC_MSG_RESULT([no])
6650     fi
6652 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6653 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6655 dnl ===================================================================
6656 dnl Compiler plugins
6657 dnl ===================================================================
6659 COMPILER_PLUGINS=
6660 # currently only Clang
6661 if test "$COM_IS_CLANG" = "TRUE"; then
6662     if test -n "$enable_compiler_plugins"; then
6663         compiler_plugins="$enable_compiler_plugins"
6664     elif test -n "$ENABLE_DBGUTIL"; then
6665         compiler_plugins=test
6666     else
6667         compiler_plugins=no
6668     fi
6669     if test "$compiler_plugins" != "no"; then
6670         dnl The prefix where Clang resides, override to where Clang resides if
6671         dnl using a source build:
6672         if test -z "$CLANGDIR"; then
6673             CLANGDIR=/usr
6674         fi
6675         AC_LANG_PUSH([C++])
6676         save_CPPFLAGS=$CPPFLAGS
6677         save_CXX=$CXX
6678         # compiler plugins must be built with "native" bitness of clang
6679         # because they link against clang libraries
6680         CXX=${COMPILER_PLUGINS_CXX-$(echo $CXX | sed -e s/-m64// -e s/-m32//)}
6681         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6682         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6683             [COMPILER_PLUGINS=TRUE],
6684             [
6685             if test "$compiler_plugins" = "yes"; then
6686                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6687             else
6688                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6689                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6690             fi
6691             ])
6692         CXX=$save_CXX
6693         CPPFLAGS=$save_CPPFLAGS
6694         AC_LANG_POP([C++])
6695     fi
6696 else
6697     if test "$enable_compiler_plugins" = "yes"; then
6698         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6699     fi
6701 AC_SUBST(COMPILER_PLUGINS)
6702 AC_SUBST(COMPILER_PLUGINS_CXX)
6703 AC_SUBST(CLANGDIR)
6705 # Plugin to help linker.
6706 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6707 # This makes --enable-lto build with clang work.
6708 AC_SUBST(LD_PLUGIN)
6710 dnl ===================================================================
6711 dnl allocator
6712 dnl ===================================================================
6713 AC_MSG_CHECKING([which memory allocator to use])
6714 if test "$with_alloc" = "system"; then
6715     AC_MSG_RESULT([system])
6716     ALLOC="SYS_ALLOC"
6718 if test "$with_alloc" = "tcmalloc"; then
6719     AC_MSG_RESULT(tcmalloc)
6720     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6721         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6722     fi
6723     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6724         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6725     ALLOC="TCMALLOC"
6727 if test "$with_alloc" = "jemalloc"; then
6728     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6729         AC_MSG_RESULT(jemalloc)
6730         save_CFLAGS=$CFLAGS
6731         CFLAGS="$CFLAGS -pthread"
6732         AC_CHECK_LIB([jemalloc], [malloc], [:],
6733             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6734         ALLOC="JEMALLOC"
6735         CFLAGS=$save_CFLAGS
6736     else
6737         AC_MSG_RESULT([system])
6738         ALLOC="SYS_ALLOC"
6739     fi
6741 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6742     AC_MSG_RESULT([internal])
6744 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6745 AC_SUBST(HAVE_POSIX_FALLOCATE)
6746 AC_SUBST(ALLOC)
6748 dnl ===================================================================
6749 dnl Custom build version
6750 dnl ===================================================================
6752 AC_MSG_CHECKING([whether to add custom build version])
6753 if test "$with_build_version" != ""; then
6754     BUILD_VER_STRING=$with_build_version
6755     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6756 else
6757     BUILD_VER_STRING=
6758     AC_MSG_RESULT([no])
6760 AC_SUBST(BUILD_VER_STRING)
6762 JITC_PROCESSOR_TYPE=""
6763 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6764     # IBMs JDK needs this...
6765     JITC_PROCESSOR_TYPE=6
6766     export JITC_PROCESSOR_TYPE
6768 AC_SUBST([JITC_PROCESSOR_TYPE])
6770 # Misc Windows Stuff
6771 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6772     find_msvc_x64_dlls
6773     find_msms
6774     MSVC_DLL_PATH="$msvcdllpath"
6775     MSVC_DLLS="$msvcdlls"
6776     MSM_PATH="$msmdir"
6777     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6780 AC_SUBST(MSVC_DLL_PATH)
6781 AC_SUBST(MSVC_DLLS)
6782 AC_SUBST(MSM_PATH)
6784 dnl ===================================================================
6785 dnl Checks for Java
6786 dnl ===================================================================
6787 if test "$ENABLE_JAVA" != ""; then
6789     # Windows-specific tests
6790     if test "$build_os" = "cygwin"; then
6791         if test "$BITNESS_OVERRIDE" = 64; then
6792             bitness=64
6793         else
6794             bitness=32
6795         fi
6797         if test -z "$with_jdk_home"; then
6798             for ver in 1.8 1.7 1.6; do
6799                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6800                 if test -n "$regvalue"; then
6801                     _jdk_home=$regvalue
6802                     break
6803                 fi
6804             done
6805             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6806                 with_jdk_home="$_jdk_home"
6807                 howfound="found automatically"
6808             else
6809                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6810             fi
6811         else
6812             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6813             howfound="you passed"
6814         fi
6815     fi
6817     # 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.
6818     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6819     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6820         with_jdk_home=`/usr/libexec/java_home`
6821     fi
6823     JAVA_HOME=; export JAVA_HOME
6824     if test -z "$with_jdk_home"; then
6825         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6826     else
6827         _java_path="$with_jdk_home/bin/$with_java"
6828         dnl Check if there is a Java interpreter at all.
6829         if test -x "$_java_path"; then
6830             JAVAINTERPRETER=$_java_path
6831         else
6832             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6833         fi
6834     fi
6836     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6837     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6838     dnl loaded by java to run JunitTests:
6839     if test "$build_os" = "cygwin"; then
6840         shortjdkhome=`cygpath -d "$with_jdk_home"`
6841         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
6842             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6843             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6844         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
6845             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6846             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6847         fi
6849         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6850             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6851         fi
6852         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6853     elif test "$cross_compiling" != "yes"; then
6854         case $CPUNAME in
6855             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6856                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6857                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6858                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6859                 fi
6860                 ;;
6861             *) # assumption: everything else 32-bit
6862                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6863                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6864                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6865                 fi
6866                 ;;
6867         esac
6868     fi
6871 HAVE_JAVA9=
6872 dnl ===================================================================
6873 dnl Checks for JDK.
6874 dnl ===================================================================
6876 # Note that JAVA_HOME as for now always means the *build* platform's
6877 # JAVA_HOME. Whether all the complexity here actually is needed any
6878 # more or not, no idea.
6880 if test "$ENABLE_JAVA" != ""; then
6881     _gij_longver=0
6882     AC_MSG_CHECKING([the installed JDK])
6883     if test -n "$JAVAINTERPRETER"; then
6884         dnl java -version sends output to stderr!
6885         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6886             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6887         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6888             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6889         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6890             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6891         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6892             JDK=ibm
6894             dnl IBM JDK specific tests
6895             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6896             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6898             if test "$_jdk_ver" -lt 10600; then
6899                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6900             fi
6902             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6904             if test "$with_jdk_home" = ""; then
6905                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6906 you must use the "--with-jdk-home" configure option explicitly])
6907             fi
6909             JAVA_HOME=$with_jdk_home
6910         else
6911             JDK=sun
6913             dnl Sun JDK specific tests
6914             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6915             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6917             if test "$_jdk_ver" -lt 10600; then
6918                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6919             fi
6920             if test "$_jdk_ver" -gt 10600; then
6921                 JAVA_CLASSPATH_NOT_SET="1"
6922             fi
6923             if test "$_jdk_ver" -ge 10900; then
6924                 HAVE_JAVA9=TRUE
6925             fi
6927             AC_MSG_RESULT([checked (JDK $_jdk)])
6928             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6929             if test "$_os" = "WINNT"; then
6930                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6931             fi
6933             # set to limit VM usage for JunitTests
6934             JAVAIFLAGS=-Xmx64M
6935             # set to limit VM usage for javac
6936             JAVAFLAGS=-J-Xmx128M
6937         fi
6938     else
6939         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6940     fi
6941 else
6942     dnl Java disabled
6943     JAVA_HOME=
6944     export JAVA_HOME
6947 dnl ===================================================================
6948 dnl Set target Java bytecode version
6949 dnl ===================================================================
6950 if test "$ENABLE_JAVA" != ""; then
6951     if test "$HAVE_JAVA9" = "TRUE"; then
6952         _java_target_ver="1.6"
6953     else
6954         _java_target_ver="1.5"
6955     fi
6956     JAVA_SOURCE_VER="$_java_target_ver"
6957     JAVA_TARGET_VER="$_java_target_ver"
6960 dnl ===================================================================
6961 dnl Checks for javac
6962 dnl ===================================================================
6963 if test "$ENABLE_JAVA" != ""; then
6964     javacompiler="javac"
6965     if test -z "$with_jdk_home"; then
6966         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6967     else
6968         _javac_path="$with_jdk_home/bin/$javacompiler"
6969         dnl Check if there is a Java compiler at all.
6970         if test -x "$_javac_path"; then
6971             JAVACOMPILER=$_javac_path
6972         fi
6973     fi
6974     if test -z "$JAVACOMPILER"; then
6975         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6976     fi
6977     if test "$build_os" = "cygwin"; then
6978         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6979             JAVACOMPILER="${JAVACOMPILER}.exe"
6980         fi
6981         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6982     fi
6985 dnl ===================================================================
6986 dnl Checks for javadoc
6987 dnl ===================================================================
6988 if test "$ENABLE_JAVA" != ""; then
6989     if test -z "$with_jdk_home"; then
6990         AC_PATH_PROG(JAVADOC, javadoc)
6991     else
6992         _javadoc_path="$with_jdk_home/bin/javadoc"
6993         dnl Check if there is a javadoc at all.
6994         if test -x "$_javadoc_path"; then
6995             JAVADOC=$_javadoc_path
6996         else
6997             AC_PATH_PROG(JAVADOC, javadoc)
6998         fi
6999     fi
7000     if test -z "$JAVADOC"; then
7001         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7002     fi
7003     if test "$build_os" = "cygwin"; then
7004         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7005             JAVADOC="${JAVADOC}.exe"
7006         fi
7007         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7008     fi
7010     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7011     JAVADOCISGJDOC="yes"
7012     fi
7014 AC_SUBST(JAVADOCISGJDOC)
7016 if test "$ENABLE_JAVA" != ""; then
7017     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7018     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7019         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7020            # try to recover first by looking whether we have a alternatives
7021            # system as in Debian or newer SuSEs where following /usr/bin/javac
7022            # over /etc/alternatives/javac leads to the right bindir where we
7023            # just need to strip a bit away to get a valid JAVA_HOME
7024            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7025         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7026             # maybe only one level of symlink (e.g. on Mac)
7027             JAVA_HOME=$(readlink $JAVACOMPILER)
7028             if test "$(dirname $JAVA_HOME)" = "."; then
7029                 # we've got no path to trim back
7030                 JAVA_HOME=""
7031             fi
7032         else
7033             # else warn
7034             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7035             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7036             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7037             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7038         fi
7039         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7040         if test "$JAVA_HOME" != "/usr"; then
7041             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7042                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7043                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7044                 dnl Tiger already returns a JDK path..
7045                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7046             else
7047                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7048                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7049                 dnl that checks which version to run
7050                 if test -f "$JAVA_HOME"; then
7051                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7052                 fi
7053             fi
7054         fi
7055     fi
7056     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7058     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7059     if test -z "$JAVA_HOME"; then
7060         if test "x$with_jdk_home" = "x"; then
7061             cat > findhome.java <<_ACEOF
7062 [import java.io.File;
7064 class findhome
7066     public static void main(String args[])
7067     {
7068         String jrelocation = System.getProperty("java.home");
7069         File jre = new File(jrelocation);
7070         System.out.println(jre.getParent());
7071     }
7073 _ACEOF
7074             AC_MSG_CHECKING([if javac works])
7075             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7076             AC_TRY_EVAL(javac_cmd)
7077             if test $? = 0 -a -f ./findhome.class; then
7078                 AC_MSG_RESULT([javac works])
7079             else
7080                 echo "configure: javac test failed" >&5
7081                 cat findhome.java >&5
7082                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7083             fi
7084             AC_MSG_CHECKING([if gij knows its java.home])
7085             JAVA_HOME=`$JAVAINTERPRETER findhome`
7086             if test $? = 0 -a "$JAVA_HOME" != ""; then
7087                 AC_MSG_RESULT([$JAVA_HOME])
7088             else
7089                 echo "configure: java test failed" >&5
7090                 cat findhome.java >&5
7091                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7092             fi
7093             # clean-up after ourselves
7094             rm -f ./findhome.java ./findhome.class
7095         else
7096             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7097         fi
7098     fi
7100     # now check if $JAVA_HOME is really valid
7101     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7102         case "${JAVA_HOME}" in
7103             /Library/Java/JavaVirtualMachines/*)
7104                 ;;
7105             *)
7106                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7107                 ;;
7108         esac
7109         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7110             JAVA_HOME_OK="NO"
7111         fi
7112     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7113         JAVA_HOME_OK="NO"
7114     fi
7115     if test "$JAVA_HOME_OK" = "NO"; then
7116         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7117         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7118         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7119         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7120         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7121         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7122     fi
7123     PathFormat "$JAVA_HOME"
7124     JAVA_HOME="$formatted_path"
7127 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7128     "$_os" != Darwin
7129 then
7130     AC_MSG_CHECKING([for JAWT lib])
7131     if test "$_os" = WINNT; then
7132         if test "$WITH_MINGW" = yes; then
7133             # The path is taken care of in gb_LinkTarget__use_jawt
7134             # in RepositoryExternal.mk:
7135             JAWTLIB=-ljawt
7136         else
7137             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7138             JAWTLIB=jawt.lib
7139         fi
7140     else
7141         case "$host_cpu" in
7142         arm*)
7143             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7144             JAVA_ARCH=$my_java_arch
7145             ;;
7146         i*86)
7147             my_java_arch=i386
7148             ;;
7149         m68k)
7150             my_java_arch=m68k
7151             ;;
7152         powerpc)
7153             my_java_arch=ppc
7154             ;;
7155         powerpc64)
7156             my_java_arch=ppc64
7157             ;;
7158         powerpc64le)
7159             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7160             JAVA_ARCH=$my_java_arch
7161             ;;
7162         sparc64)
7163             my_java_arch=sparcv9
7164             ;;
7165         x86_64)
7166             my_java_arch=amd64
7167             ;;
7168         *)
7169             my_java_arch=$host_cpu
7170             ;;
7171         esac
7172         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7173         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7174     fi
7175     AC_MSG_RESULT([$JAWTLIB])
7177 AC_SUBST(JAWTLIB)
7179 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7180     case "$host_os" in
7182     aix*)
7183         JAVAINC="-I$JAVA_HOME/include"
7184         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7185         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7186         ;;
7188     cygwin*)
7189         JAVAINC="-I$JAVA_HOME/include/win32"
7190         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7191         ;;
7193     darwin*)
7194         if test -d "$JAVA_HOME/include/darwin"; then
7195             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7196         else
7197             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7198         fi
7199         ;;
7201     dragonfly*)
7202         JAVAINC="-I$JAVA_HOME/include"
7203         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7204         ;;
7206     freebsd*)
7207         JAVAINC="-I$JAVA_HOME/include"
7208         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7209         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7210         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7211         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7212         ;;
7214     k*bsd*-gnu*)
7215         JAVAINC="-I$JAVA_HOME/include"
7216         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7217         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7218         ;;
7220     linux-gnu*)
7221         JAVAINC="-I$JAVA_HOME/include"
7222         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7223         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7224         ;;
7226     mingw*)
7227         JAVAINC="-I$JAVA_HOME/include"
7228         ;;
7230     *netbsd*)
7231         JAVAINC="-I$JAVA_HOME/include"
7232         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7233         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7234        ;;
7236     openbsd*)
7237         JAVAINC="-I$JAVA_HOME/include"
7238         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7239         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7240         ;;
7242     solaris*)
7243         JAVAINC="-I$JAVA_HOME/include"
7244         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7245         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7246         ;;
7247     esac
7249 SOLARINC="$SOLARINC $JAVAINC"
7251 AC_SUBST(JAVACOMPILER)
7252 AC_SUBST(JAVADOC)
7253 AC_SUBST(JAVAINTERPRETER)
7254 AC_SUBST(JAVAIFLAGS)
7255 AC_SUBST(JAVAFLAGS)
7256 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7257 AC_SUBST(JAVA_HOME)
7258 AC_SUBST(JAVA_SOURCE_VER)
7259 AC_SUBST(JAVA_TARGET_VER)
7260 AC_SUBST(JDK)
7263 dnl ===================================================================
7264 dnl Export file validation
7265 dnl ===================================================================
7266 AC_MSG_CHECKING([whether to enable export file validation])
7267 if test "$with_export_validation" = yes; then
7268     if test -z "$ENABLE_JAVA"; then
7269         AC_MSG_RESULT([no, as Java is disabled])
7270     else
7271         AC_MSG_RESULT([yes])
7272         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7274         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7275         if test -z "$ODFVALIDATOR"; then
7276             # remember to download the ODF toolkit with validator later
7277             AC_MSG_NOTICE([no odfvalidator found, will download it])
7278             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7279             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7281             # and fetch name of odfvalidator jar name from download.lst
7282             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7283             AC_SUBST(ODFVALIDATOR_JAR)
7285             if test -z "$ODFVALIDATOR_JAR"; then
7286                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7287             fi
7288         fi
7289         if test "$build_os" = "cygwin"; then
7290             # In case of CygWin it will be executed from Windows,
7291             # so we need to run bash and absolute path to validator
7292             # so instead of "odfvalidator" it will be
7293             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7294             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7295         else
7296             ODFVALIDATOR="sh $ODFVALIDATOR"
7297         fi
7298         AC_SUBST(ODFVALIDATOR)
7301         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7302         if test -z "$OFFICEOTRON"; then
7303             # remember to download the officeotron with validator later
7304             AC_MSG_NOTICE([no officeotron found, will download it])
7305             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7306             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7308             # and fetch name of officeotron jar name from download.lst
7309             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7310             AC_SUBST(OFFICEOTRON_JAR)
7312             if test -z "$OFFICEOTRON_JAR"; then
7313                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7314             fi
7315         else
7316             # check version of existing officeotron
7317             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7318             if test 0"$OFFICEOTRON_VER" -lt 704; then
7319                 AC_MSG_ERROR([officeotron too old])
7320             fi
7321         fi
7322         if test "$build_os" = "cygwin"; then
7323             # In case of CygWin it will be executed from Windows,
7324             # so we need to run bash and absolute path to validator
7325             # so instead of "odfvalidator" it will be
7326             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7327             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7328         else
7329             OFFICEOTRON="sh $OFFICEOTRON"
7330         fi
7331     fi
7332     AC_SUBST(OFFICEOTRON)
7333 else
7334     AC_MSG_RESULT([no])
7337 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7338 if test "$with_bffvalidator" != "no"; then
7339     AC_DEFINE(HAVE_BFFVALIDATOR)
7341     if test "$with_export_validation" != "yes"; then
7342         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7343     fi
7345     if test "$with_bffvalidator" = "yes"; then
7346         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7347     else
7348         BFFVALIDATOR="$with_bffvalidator"
7349     fi
7351     if test "$build_os" = "cygwin"; then
7352         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7353             AC_MSG_RESULT($BFFVALIDATOR)
7354         else
7355             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7356         fi
7357     elif test -n "$BFFVALIDATOR"; then
7358         # We are not in CygWin but need to run Windows binary with wine
7359         AC_PATH_PROGS(WINE, wine)
7361         # so swap in a shell wrapper that converts paths transparently
7362         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7363         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7364         AC_SUBST(BFFVALIDATOR_EXE)
7365         AC_MSG_RESULT($BFFVALIDATOR)
7366     else
7367         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7368     fi
7369     AC_SUBST(BFFVALIDATOR)
7370 else
7371     AC_MSG_RESULT([no])
7374 dnl ===================================================================
7375 dnl Check for C preprocessor to use
7376 dnl ===================================================================
7377 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7378 if test -n "$with_idlc_cpp"; then
7379     AC_MSG_RESULT([$with_idlc_cpp])
7380     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7381 else
7382     AC_MSG_RESULT([ucpp])
7383     AC_MSG_CHECKING([which ucpp tp use])
7384     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7385         AC_MSG_RESULT([external])
7386         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7387     else
7388         AC_MSG_RESULT([internal])
7389         BUILD_TYPE="$BUILD_TYPE UCPP"
7390     fi
7392 AC_SUBST(SYSTEM_UCPP)
7394 dnl ===================================================================
7395 dnl Check for epm (not needed for Windows)
7396 dnl ===================================================================
7397 AC_MSG_CHECKING([whether to enable EPM for packing])
7398 if test "$enable_epm" = "yes"; then
7399     AC_MSG_RESULT([yes])
7400     if test "$_os" != "WINNT"; then
7401         if test $_os = Darwin; then
7402             EPM=internal
7403         elif test -n "$with_epm"; then
7404             EPM=$with_epm
7405         else
7406             AC_PATH_PROG(EPM, epm, no)
7407         fi
7408         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7409             AC_MSG_NOTICE([EPM will be built.])
7410             BUILD_TYPE="$BUILD_TYPE EPM"
7411             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7412         else
7413             # Gentoo has some epm which is something different...
7414             AC_MSG_CHECKING([whether the found epm is the right epm])
7415             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7416                 AC_MSG_RESULT([yes])
7417             else
7418                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7419             fi
7420             AC_MSG_CHECKING([epm version])
7421             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7422             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7423                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7424                 AC_MSG_RESULT([OK, >= 3.7])
7425             else
7426                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7427                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7428             fi
7429         fi
7430     fi
7432     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7433         AC_MSG_CHECKING([for rpm])
7434         for a in "$RPM" rpmbuild rpm; do
7435             $a --usage >/dev/null 2> /dev/null
7436             if test $? -eq 0; then
7437                 RPM=$a
7438                 break
7439             else
7440                 $a --version >/dev/null 2> /dev/null
7441                 if test $? -eq 0; then
7442                     RPM=$a
7443                     break
7444                 fi
7445             fi
7446         done
7447         if test -z "$RPM"; then
7448             AC_MSG_ERROR([not found])
7449         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7450             RPM_PATH=`which $RPM`
7451             AC_MSG_RESULT([$RPM_PATH])
7452             SCPDEFS="$SCPDEFS -DWITH_RPM"
7453         else
7454             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7455         fi
7456     fi
7457     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7458         AC_PATH_PROG(DPKG, dpkg, no)
7459         if test "$DPKG" = "no"; then
7460             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7461         fi
7462     fi
7463     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7464        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7465         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7466             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7467                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7468                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7469                     AC_MSG_RESULT([yes])
7470                 else
7471                     AC_MSG_RESULT([no])
7472                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7473                         _pt="rpm"
7474                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7475                         add_warning "the rpms will need to be installed with --nodeps"
7476                     else
7477                         _pt="pkg"
7478                     fi
7479                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7480                     add_warning "the ${_pt}s will not be relocateable"
7481                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7482                                  relocation will work, you need to patch your epm with the
7483                                  patch in epm/epm-3.7.patch or build with
7484                                  --with-epm=internal which will build a suitable epm])
7485                 fi
7486             fi
7487         fi
7488     fi
7489     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7490         AC_PATH_PROG(PKGMK, pkgmk, no)
7491         if test "$PKGMK" = "no"; then
7492             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7493         fi
7494     fi
7495     AC_SUBST(RPM)
7496     AC_SUBST(DPKG)
7497     AC_SUBST(PKGMK)
7498 else
7499     for i in $PKGFORMAT; do
7500         case "$i" in
7501         aix | bsd | deb | pkg | rpm | native | portable)
7502             AC_MSG_ERROR(
7503                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7504             ;;
7505         esac
7506     done
7507     AC_MSG_RESULT([no])
7508     EPM=NO
7510 AC_SUBST(EPM)
7512 dnl ===================================================================
7513 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7514 dnl ===================================================================
7515 WINEGCC=
7516 if test "$enable_winegcc" = "yes"; then
7517     AC_PATH_PROG(WINEGCC, winegcc)
7518     if test "$WINEGCC" = ""; then
7519         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7520     fi
7521     CC_save="$CC"
7522     ac_exeext_save="$ac_exeext"
7523     CC="$WINEGCC -m32"
7524     ac_exeext=".exe"
7525     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7526 #include <stdio.h>
7527         ],[
7528 printf ("hello world\n");
7529         ])],,
7530         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7531     )
7532     CC="$CC_save"
7533     ac_exeext="$ac_exeext_save"
7535 AC_SUBST(WINEGCC)
7537 if test $_os = iOS; then
7538     enable_mpl_subset=yes
7539     enable_lotuswordpro=no
7540     enable_coinmp=yes
7541     enable_lpsolve=no
7542     enable_postgresql_sdbc=no
7543     enable_extension_integration=no
7544     enable_report_builder=no
7545     with_theme="tango"
7546     with_ppds=no
7549 ENABLE_LWP=
7550 if test "$enable_lotuswordpro" = "yes"; then
7551     ENABLE_LWP="TRUE"
7552     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7554 AC_SUBST(ENABLE_LWP)
7556 dnl ===================================================================
7557 dnl Check for gperf
7558 dnl ===================================================================
7559 AC_PATH_PROG(GPERF, gperf)
7560 if test -z "$GPERF"; then
7561     AC_MSG_ERROR([gperf not found but needed. Install it.])
7563 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7564     GPERF=`cygpath -m $GPERF`
7566 AC_MSG_CHECKING([gperf version])
7567 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7568     AC_MSG_RESULT([OK])
7569 else
7570     AC_MSG_ERROR([too old, you need at least 3.0.0])
7572 AC_SUBST(GPERF)
7574 dnl ===================================================================
7575 dnl Check for building ODK
7576 dnl ===================================================================
7577 if test "$enable_odk" = no; then
7578     unset DOXYGEN
7579 else
7580     if test "$with_doxygen" = no; then
7581         AC_MSG_CHECKING([for doxygen])
7582         unset DOXYGEN
7583         AC_MSG_RESULT([no])
7584     else
7585         if test "$with_doxygen" = yes; then
7586             AC_PATH_PROG([DOXYGEN], [doxygen])
7587             if test -z "$DOXYGEN"; then
7588                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7589             fi
7590         else
7591             AC_MSG_CHECKING([for doxygen])
7592             DOXYGEN=$with_doxygen
7593             AC_MSG_RESULT([$DOXYGEN])
7594         fi
7595         if test -n "$DOXYGEN"; then
7596             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7597             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7598             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7599                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7600             fi
7601         fi
7602     fi
7604 AC_SUBST([DOXYGEN])
7606 AC_MSG_CHECKING([whether to build the ODK])
7607 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7608     AC_MSG_RESULT([yes])
7610     if test "$with_java" != "no"; then
7611         AC_MSG_CHECKING([whether to build unowinreg.dll])
7612         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7613             # build on Win by default
7614             enable_build_unowinreg=yes
7615         fi
7616         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7617             AC_MSG_RESULT([no])
7618             BUILD_UNOWINREG=
7619         else
7620             AC_MSG_RESULT([yes])
7621             BUILD_UNOWINREG=TRUE
7622         fi
7623         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7624             if test -z "$with_mingw_cross_compiler"; then
7625                 dnl Guess...
7626                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7627             elif test -x "$with_mingw_cross_compiler"; then
7628                  MINGWCXX="$with_mingw_cross_compiler"
7629             else
7630                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7631             fi
7633             if test "$MINGWCXX" = "false"; then
7634                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7635             fi
7637             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7638             if test -x "$mingwstrip_test"; then
7639                 MINGWSTRIP="$mingwstrip_test"
7640             else
7641                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7642             fi
7644             if test "$MINGWSTRIP" = "false"; then
7645                 AC_MSG_ERROR(MinGW32 binutils not found.)
7646             fi
7647         fi
7648     fi
7649     BUILD_TYPE="$BUILD_TYPE ODK"
7650 else
7651     AC_MSG_RESULT([no])
7652     BUILD_UNOWINREG=
7654 AC_SUBST(BUILD_UNOWINREG)
7655 AC_SUBST(MINGWCXX)
7656 AC_SUBST(MINGWSTRIP)
7658 dnl ===================================================================
7659 dnl Check for system zlib
7660 dnl ===================================================================
7661 if test "$with_system_zlib" = "auto"; then
7662     case "$_os" in
7663     WINNT)
7664         with_system_zlib="$with_system_libs"
7665         ;;
7666     *)
7667         with_system_zlib=yes
7668         ;;
7669     esac
7672 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7673 dnl and has no pkg-config for it at least on some tinderboxes,
7674 dnl so leaving that out for now
7675 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7676 AC_MSG_CHECKING([which zlib to use])
7677 if test "$with_system_zlib" = "yes"; then
7678     AC_MSG_RESULT([external])
7679     SYSTEM_ZLIB=TRUE
7680     if test "$_os" != "Emscripten"; then
7681         # Emscripten provides its own zlib, don't check for that
7682         AC_CHECK_HEADER(zlib.h, [],
7683             [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7684         AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7685             [AC_MSG_ERROR(zlib not found or functional)], [])
7686     fi
7687 else
7688     AC_MSG_RESULT([internal])
7689     SYSTEM_ZLIB=
7690     BUILD_TYPE="$BUILD_TYPE ZLIB"
7691     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7692     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7694 AC_SUBST(ZLIB_CFLAGS)
7695 AC_SUBST(ZLIB_LIBS)
7696 AC_SUBST(SYSTEM_ZLIB)
7698 dnl ===================================================================
7699 dnl Check for system jpeg
7700 dnl ===================================================================
7701 AC_MSG_CHECKING([which libjpeg to use])
7702 if test "$with_jpeg_turbo" = "auto"; then
7703     # TODO use jpeg-turbo on Darwin too
7704     case "$_os" in
7705     WINNT)
7706         with_jpeg_turbo=yes
7707         ;;
7708     *)
7709         with_jpeg_turbo=no
7710         ;;
7711     esac
7714 if test "$with_system_jpeg" = "yes"; then
7715     AC_MSG_RESULT([external])
7716     SYSTEM_JPEG=TRUE
7717     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7718         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7719     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7720         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7721     libo_MINGW_CHECK_DLL([libjpeg])
7722 else
7723     SYSTEM_JPEG=
7724     if test "$with_jpeg_turbo" = "yes"; then
7725         AC_MSG_RESULT([internal, jpeg-turbo])
7726         BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7727         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7729         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7730             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7731                 NASM="$LODE_HOME/opt/bin/nasm"
7732             elif test -x "/opt/lo/bin/nasm"; then
7733                 NASM="/opt/lo/bin/nasm"
7734             fi
7735         fi
7736         if test -z "$NASM"; then
7737 cat << _EOS
7738 ****************************************************************************
7739 You need nasm (Netwide Assembler) to build internal jpeg library.
7740 To get one please do:
7742 _EOS
7743         if test "$build_os" = "cygwin"; then
7744 cat << _EOS
7745 install a pre-compiled binary for Win32
7747  mkdir -p /opt/lo/bin
7748  cd /opt/lo/bin
7749  wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7750  chmod +x nasm
7751 _EOS
7752             else
7753 cat << _EOS
7754 consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
7755 _EOS
7756             fi
7757 cat << _EOS
7759 or get and install one from http://www.nasm.us/
7761 Then re-run autogen.sh
7763 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7764 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7766 _EOS
7767         AC_MSG_ERROR([no nasm (Netwide Assembler) found])
7768         fi
7769         LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg-turbo"
7770         if test "$COM" = "MSC"; then
7771             LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs/libjpeg.lib"
7772         else
7773             LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs -ljpeg"
7774         fi
7775     else
7776         AC_MSG_RESULT([internal, jpeg])
7777         BUILD_TYPE="$BUILD_TYPE JPEG"
7778         LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg"
7779         if test "$COM" = "MSC"; then
7780             LIBJPEG_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/libjpeg.lib"
7781         else
7782             LIBJPEG_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -ljpeg"
7783         fi
7784     fi
7786 AC_SUBST(NASM)
7787 AC_SUBST(LIBJPEG_CFLAGS)
7788 AC_SUBST(LIBJPEG_LIBS)
7789 AC_SUBST(SYSTEM_JPEG)
7791 dnl ===================================================================
7792 dnl Check for system clucene
7793 dnl ===================================================================
7794 dnl we should rather be using
7795 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7796 dnl but the contribs-lib check seems tricky
7797 AC_MSG_CHECKING([which clucene to use])
7798 if test "$with_system_clucene" = "yes"; then
7799     AC_MSG_RESULT([external])
7800     SYSTEM_CLUCENE=TRUE
7801     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7802     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7803     FilterLibs "${CLUCENE_LIBS}"
7804     CLUCENE_LIBS="${filteredlibs}"
7805     AC_LANG_PUSH([C++])
7806     save_CXXFLAGS=$CXXFLAGS
7807     save_CPPFLAGS=$CPPFLAGS
7808     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7809     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7810     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7811     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7812     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7813                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7814     CXXFLAGS=$save_CXXFLAGS
7815     CPPFLAGS=$save_CPPFLAGS
7816     AC_LANG_POP([C++])
7818     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7819 else
7820     AC_MSG_RESULT([internal])
7821     SYSTEM_CLUCENE=
7822     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7824 AC_SUBST(SYSTEM_CLUCENE)
7825 AC_SUBST(CLUCENE_CFLAGS)
7826 AC_SUBST(CLUCENE_LIBS)
7828 dnl ===================================================================
7829 dnl Check for system expat
7830 dnl ===================================================================
7831 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7832 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7833 AC_MSG_CHECKING([which expat to use])
7834 if test "$with_system_expat" = "yes"; then
7835     AC_MSG_RESULT([external])
7836     SYSTEM_EXPAT=TRUE
7837     AC_CHECK_HEADER(expat.h, [],
7838         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7839     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7840         [AC_MSG_RESULT(expat library not found or functional.)], [])
7841     libo_MINGW_CHECK_DLL([libexpat])
7842 else
7843     AC_MSG_RESULT([internal])
7844     SYSTEM_EXPAT=
7845     BUILD_TYPE="$BUILD_TYPE EXPAT"
7847 AC_SUBST(SYSTEM_EXPAT)
7849 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7850 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7851     ENABLE_EOT="TRUE"
7852     AC_DEFINE([ENABLE_EOT])
7853     AC_MSG_RESULT([yes])
7855     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7856 else
7857     ENABLE_EOT=
7858     AC_MSG_RESULT([no])
7860 AC_SUBST([ENABLE_EOT])
7862 dnl ===================================================================
7863 dnl Check for DLP libs
7864 dnl ===================================================================
7865 AS_IF([test "$COM" = "MSC"],
7866       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7867       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7869 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7871 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7873 AS_IF([test "$COM" = "MSC"],
7874       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7875       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7877 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7879 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7881 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7882 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.4])
7884 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7886 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7888 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7890 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7891 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.9])
7893 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7894 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
7896 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7898 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7899 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7901 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7903 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7905 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7907 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7908 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.2])
7910 dnl ===================================================================
7911 dnl Check for system libcmis
7912 dnl ===================================================================
7913 # libcmis requires curl and we can't build curl for iOS
7914 if test $_os != iOS; then
7915     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7916     ENABLE_CMIS=TRUE
7917 else
7918     ENABLE_CMIS=
7920 AC_SUBST(ENABLE_CMIS)
7922 dnl ===================================================================
7923 dnl Check for system lcms2
7924 dnl ===================================================================
7925 if test "$with_system_lcms2" = "yes"; then
7926     libo_MINGW_CHECK_DLL([liblcms2])
7927 else
7928     SYSTEM_LCMS2=
7930 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7931 if test "$GCC" = "yes"; then
7932     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7934 if test "$COM" = "MSC"; then # override the above
7935     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7938 dnl ===================================================================
7939 dnl Check for system cppunit
7940 dnl ===================================================================
7941 if test "$cross_compiling" != "yes"; then
7942     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7945 dnl ===================================================================
7946 dnl Check whether freetype is available
7947 dnl ===================================================================
7948 if test  "$test_freetype" = "yes"; then
7949     AC_MSG_CHECKING([whether freetype is available])
7950     # FreeType has 3 different kinds of versions
7951     # * release, like 2.4.10
7952     # * libtool, like 13.0.7 (this what pkg-config returns)
7953     # * soname
7954     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7955     #
7956     # 9.9.3 is 2.2.0
7957     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7958     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7959     FilterLibs "${FREETYPE_LIBS}"
7960     FREETYPE_LIBS="${filteredlibs}"
7961     SYSTEM_FREETYPE=TRUE
7962     _save_libs="$LIBS"
7963     _save_cflags="$CFLAGS"
7964     LIBS="$LIBS $FREETYPE_LIBS"
7965     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7966     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7967     LIBS="$_save_libs"
7968     CFLAGS="$_save_cflags"
7970 AC_SUBST(FREETYPE_CFLAGS)
7971 AC_SUBST(FREETYPE_LIBS)
7972 AC_SUBST([SYSTEM_FREETYPE])
7974 # ===================================================================
7975 # Check for system libxslt
7976 # to prevent incompatibilities between internal libxml2 and external libxslt,
7977 # or vice versa, use with_system_libxml here
7978 # ===================================================================
7979 if test "$with_system_libxml" = "auto"; then
7980     case "$_os" in
7981     WINNT|iOS|Android)
7982         with_system_libxml="$with_system_libs"
7983         ;;
7984     *)
7985         with_system_libxml=yes
7986         ;;
7987     esac
7990 AC_MSG_CHECKING([which libxslt to use])
7991 if test "$with_system_libxml" = "yes"; then
7992     AC_MSG_RESULT([external])
7993     SYSTEM_LIBXSLT=TRUE
7994     if test "$_os" = "Darwin"; then
7995         dnl make sure to use SDK path
7996         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7997         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7998         dnl omit -L/usr/lib
7999         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8000         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8001     else
8002         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8003         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8004         FilterLibs "${LIBXSLT_LIBS}"
8005         LIBXSLT_LIBS="${filteredlibs}"
8006         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8007         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8008         FilterLibs "${LIBEXSLT_LIBS}"
8009         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8010     fi
8012     dnl Check for xsltproc
8013     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8014     if test "$XSLTPROC" = "no"; then
8015         AC_MSG_ERROR([xsltproc is required])
8016     fi
8018     libo_MINGW_CHECK_DLL([libxslt])
8019     libo_MINGW_CHECK_DLL([libexslt])
8020     libo_MINGW_TRY_DLL([iconv])
8021 else
8022     AC_MSG_RESULT([internal])
8023     SYSTEM_LIBXSLT=
8024     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8026     if test "$cross_compiling" = "yes"; then
8027         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8028         if test "$XSLTPROC" = "no"; then
8029             AC_MSG_ERROR([xsltproc is required])
8030         fi
8031     fi
8033 AC_SUBST(SYSTEM_LIBXSLT)
8034 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8035     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8037 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8039 AC_SUBST(LIBEXSLT_CFLAGS)
8040 AC_SUBST(LIBEXSLT_LIBS)
8041 AC_SUBST(LIBXSLT_CFLAGS)
8042 AC_SUBST(LIBXSLT_LIBS)
8043 AC_SUBST(XSLTPROC)
8045 # ===================================================================
8046 # Check for system libxml
8047 # ===================================================================
8048 AC_MSG_CHECKING([which libxml to use])
8049 if test "$with_system_libxml" = "yes"; then
8050     AC_MSG_RESULT([external])
8051     SYSTEM_LIBXML=TRUE
8052     if test "$_os" = "Darwin"; then
8053         dnl make sure to use SDK path
8054         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8055         dnl omit -L/usr/lib
8056         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8057     elif test $_os = iOS; then
8058         dnl make sure to use SDK path
8059         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8060         LIBXML_CFLAGS="-I$usr/include/libxml2"
8061         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8062     else
8063         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8064         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8065         FilterLibs "${LIBXML_LIBS}"
8066         LIBXML_LIBS="${filteredlibs}"
8067     fi
8069     dnl Check for xmllint
8070     AC_PATH_PROG(XMLLINT, xmllint, no)
8071     if test "$XMLLINT" = "no"; then
8072         AC_MSG_ERROR([xmllint is required])
8073     fi
8075     libo_MINGW_CHECK_DLL([libxml2])
8076     libo_MINGW_TRY_DLL([zlib1])
8077 else
8078     AC_MSG_RESULT([internal])
8079     SYSTEM_LIBXML=
8080     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
8081     if test "$COM" = "MSC"; then
8082         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8083     fi
8084     if test "$COM" = "MSC"; then
8085         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
8086     else
8087         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
8088     fi
8089     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8091 AC_SUBST(SYSTEM_LIBXML)
8092 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8093     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8095 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8096 AC_SUBST(LIBXML_CFLAGS)
8097 AC_SUBST(LIBXML_LIBS)
8098 AC_SUBST(XMLLINT)
8100 # =====================================================================
8101 # Checking for a Python interpreter with version >= 2.6.
8102 # Build and runtime requires Python 3 compatible version (>= 2.6).
8103 # Optionally user can pass an option to configure, i. e.
8104 # ./configure PYTHON=/usr/bin/python
8105 # =====================================================================
8106 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8107     # This allows a lack of system python with no error, we use internal one in that case.
8108     AM_PATH_PYTHON([2.6],, [:])
8109     # Clean PYTHON_VERSION checked below if cross-compiling
8110     PYTHON_VERSION=""
8111     if test "$PYTHON" != ":"; then
8112         PYTHON_FOR_BUILD=$PYTHON
8113     fi
8115 AC_SUBST(PYTHON_FOR_BUILD)
8117 # Checks for Python to use for Pyuno
8118 AC_MSG_CHECKING([which Python to use for Pyuno])
8119 case "$enable_python" in
8120 no|disable)
8121     if test -z $PYTHON_FOR_BUILD; then
8122         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8123         # requirement from the choice whether to include Python stuff in the installer, but why
8124         # bother?
8125         AC_MSG_ERROR([Python is required at build time.])
8126     fi
8127     enable_python=no
8128     AC_MSG_RESULT([none])
8129     ;;
8130 ""|yes|auto)
8131     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8132         AC_MSG_RESULT([no, overridden by --disable-scripting])
8133         enable_python=no
8134     elif test $build_os = cygwin; then
8135         dnl When building on Windows we don't attempt to use any installed
8136         dnl "system"  Python.
8137         dnl
8138         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
8139         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
8140         dnl MinGW cross-compilation setups.)
8141         AC_MSG_RESULT([fully internal])
8142         enable_python=internal
8143     elif test "$cross_compiling" = yes; then
8144         AC_MSG_RESULT([system])
8145         enable_python=system
8146     else
8147         # Unset variables set by the above AM_PATH_PYTHON so that
8148         # we actually do check anew.
8149         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
8150         AM_PATH_PYTHON([3.3],, [:])
8151         if test "$PYTHON" = ":"; then
8152             if test -z "$PYTHON_FOR_BUILD"; then
8153                 AC_MSG_RESULT([fully internal])
8154             else
8155                 AC_MSG_RESULT([internal])
8156             fi
8157             enable_python=internal
8158         else
8159             AC_MSG_RESULT([system])
8160             enable_python=system
8161         fi
8162     fi
8163     ;;
8164 internal)
8165     AC_MSG_RESULT([internal])
8166     ;;
8167 fully-internal)
8168     AC_MSG_RESULT([fully internal])
8169     enable_python=internal
8170     ;;
8171 system)
8172     AC_MSG_RESULT([system])
8173     ;;
8175     AC_MSG_ERROR([Incorrect --enable-python option])
8176     ;;
8177 esac
8179 if test $enable_python != no; then
8180     BUILD_TYPE="$BUILD_TYPE PYUNO"
8183 if test $enable_python = system; then
8184     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8185         python_version=2.7
8186         PYTHON=python$python_version
8187         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8188             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8189             PYTHON_LIBS="-framework Python"
8190         else
8191             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8192             PYTHON_LIBS="`$PYTHON-config --libs`"
8193         fi
8194     fi
8195     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8196         # Fallback: Accept these in the environment, or as set above
8197         # for MacOSX.
8198         :
8199     elif test "$cross_compiling" != yes; then
8200         # Unset variables set by the above AM_PATH_PYTHON so that
8201         # we actually do check anew.
8202         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
8203         # This causes an error if no python command is found
8204         AM_PATH_PYTHON([3.3])
8205         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8206         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8207         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8208         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8209         if test -z "$PKG_CONFIG"; then
8210             PYTHON_CFLAGS="-I$python_include"
8211             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8212         elif $PKG_CONFIG --exists python-$python_version; then
8213             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8214             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8215         else
8216             PYTHON_CFLAGS="-I$python_include"
8217             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8218         fi
8219         FilterLibs "${PYTHON_LIBS}"
8220         PYTHON_LIBS="${filteredlibs}"
8221     else
8222         dnl How to find out the cross-compilation Python installation path?
8223         dnl Let's hardocode what we know for different distributions for now...
8224         for python_version in 2.6; do
8225             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8226                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8227                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8228                 AC_MSG_CHECKING([for python.exe])
8229                 libo_MINGW_CHECK_DLL([libpython$python_version])
8230                 libo_MINGW_CHECK_DLL([libreadline6])
8231                 libo_MINGW_CHECK_DLL([libtermcap])
8232                 # could we somehow extract the really mingw python version from
8233                 # actual distro package?
8234                 # 2.6.2 currently on OpenSUSE 12.1?
8235                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8236                 PYTHON_VERSION=$python_version.2
8237                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8238                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8239                 break
8240             fi
8241         done
8242         AC_MSG_CHECKING([for python version])
8243         AS_IF([test -n "$PYTHON_VERSION"],
8244               [AC_MSG_RESULT([$PYTHON_VERSION])],
8245               [AC_MSG_RESULT([not found])
8246                AC_MSG_ERROR([no usable python found])])
8247         test -n "$PYTHON_CFLAGS" && break
8248     fi
8249     # let the PYTHON_FOR_BUILD match the same python installation that
8250     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8251     # better for PythonTests.
8252     PYTHON_FOR_BUILD=$PYTHON
8255 dnl By now enable_python should be "system", "internal" or "no"
8256 case $enable_python in
8257 system)
8258     SYSTEM_PYTHON=TRUE
8260     dnl Check if the headers really work
8261     save_CPPFLAGS="$CPPFLAGS"
8262     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8263     AC_CHECK_HEADER(Python.h, [],
8264        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8265        [])
8266     CPPFLAGS="$save_CPPFLAGS"
8268     AC_LANG_PUSH(C)
8269     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8270     AC_MSG_CHECKING([for correct python library version])
8271        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8272 #include <Python.h>
8274 int main(int argc, char **argv) {
8275    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8276        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8277    else return 1;
8279        ]])],[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])])
8280     CFLAGS=$save_CFLAGS
8281     AC_LANG_POP(C)
8283     dnl FIXME Check if the Python library can be linked with, too?
8284     ;;
8286 internal)
8287     SYSTEM_PYTHON=
8288     PYTHON_VERSION_MAJOR=3
8289     # On windows we are supporting two different python versions: 3.3 and 3.5.
8290     # We msut do it as long as we support MSVC 2013. Python 3.3 can be removed
8291     # when MSVC 2013 support was dropped.
8292     if test "$COM" = "MSC" -a "$VCVER" = "120"; then
8293         PYTHON_VERSION_MINOR=3
8294     else
8295         PYTHON_VERSION_MINOR=5
8296     fi
8297     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
8298     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8299     BUILD_TYPE="$BUILD_TYPE PYTHON"
8300     # Embedded Python dies without Home set
8301     if test "$HOME" = ""; then
8302         export HOME=""
8303     fi
8304     # bz2 tarball and bzip2 is not standard
8305     if test -z "$BZIP2"; then
8306         AC_PATH_PROG( BZIP2, bzip2)
8307         if test -z "$BZIP2"; then
8308             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8309         fi
8310     fi
8311     ;;
8313     DISABLE_PYTHON=TRUE
8314     SYSTEM_PYTHON=
8315     ;;
8317     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8318     ;;
8319 esac
8321 AC_SUBST(DISABLE_PYTHON)
8322 AC_SUBST(SYSTEM_PYTHON)
8323 AC_SUBST(PYTHON_CFLAGS)
8324 AC_SUBST(PYTHON_LIBS)
8325 AC_SUBST(PYTHON_VERSION)
8326 AC_SUBST(PYTHON_VERSION_MAJOR)
8327 AC_SUBST(PYTHON_VERSION_MINOR)
8329 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8330 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8331     AC_MSG_RESULT([yes])
8332     ENABLE_MARIADBC=TRUE
8333     MARIADBC_MAJOR=1
8334     MARIADBC_MINOR=0
8335     MARIADBC_MICRO=2
8336     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8337 else
8338     AC_MSG_RESULT([no])
8339     ENABLE_MARIADBC=
8341 AC_SUBST(ENABLE_MARIADBC)
8342 AC_SUBST(MARIADBC_MAJOR)
8343 AC_SUBST(MARIADBC_MINOR)
8344 AC_SUBST(MARIADBC_MICRO)
8346 if test "$ENABLE_MARIADBC" = "TRUE"; then
8348     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8350     dnl ===================================================================
8351     dnl Check for system MariaDB
8352     dnl ===================================================================
8353     AC_MSG_CHECKING([which MariaDB to use])
8354     if test "$with_system_mariadb" = "yes"; then
8355         AC_MSG_RESULT([external])
8356         SYSTEM_MARIADB=TRUE
8357         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8358         if test -z "$MARIADBCONFIG"; then
8359             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8360             if test -z "$MARIADBCONFIG"; then
8361                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8362                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8363             fi
8364         fi
8365         AC_MSG_CHECKING([MariaDB version])
8366         MARIADB_VERSION=`$MARIADBCONFIG --version`
8367         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8368         if test "$MARIADB_MAJOR" -ge "5"; then
8369             AC_MSG_RESULT([OK])
8370         else
8371             AC_MSG_ERROR([too old, use 5.0.x or later])
8372         fi
8373         AC_MSG_CHECKING([for MariaDB Client library])
8374         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8375         if test "$COM_IS_CLANG" = TRUE; then
8376             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8377         fi
8378         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8379         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8380         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8381         dnl linux32:
8382         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8383             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8384             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8385                 | sed -e 's|/lib64/|/lib/|')
8386         fi
8387         FilterLibs "${MARIADB_LIBS}"
8388         MARIADB_LIBS="${filteredlibs}"
8389         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8390         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8391         if test "$enable_bundle_mariadb" = "yes"; then
8392             AC_MSG_RESULT([yes])
8393             BUNDLE_MARIADB=TRUE
8394             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8396 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8398 /g' | grep -E '(mysqlclient|mariadb)')
8399             if test "$_os" = "Darwin"; then
8400                 LIBMARIADB=${LIBMARIADB}.dylib
8401             elif test "$_os" = "WINNT"; then
8402                 LIBMARIADB=${LIBMARIADB}.dll
8403             else
8404                 LIBMARIADB=${LIBMARIADB}.so
8405             fi
8406             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8407             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8408             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8409                 AC_MSG_RESULT([found.])
8410                 PathFormat "$LIBMARIADB_PATH"
8411                 LIBMARIADB_PATH="$formatted_path"
8412             else
8413                 AC_MSG_ERROR([not found.])
8414             fi
8415         else
8416             AC_MSG_RESULT([no])
8417             BUNDLE_MARIADB=
8418         fi
8419     else
8420         AC_MSG_RESULT([internal])
8421         SYSTEM_MARIADB=
8422         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8423         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8424         BUILD_TYPE="$BUILD_TYPE MARIADB"
8425     fi
8427     AC_SUBST(SYSTEM_MARIADB)
8428     AC_SUBST(MARIADB_CFLAGS)
8429     AC_SUBST(MARIADB_LIBS)
8430     AC_SUBST(LIBMARIADB)
8431     AC_SUBST(LIBMARIADB_PATH)
8432     AC_SUBST(BUNDLE_MARIADB)
8434     AC_LANG_PUSH([C++])
8435     dnl ===================================================================
8436     dnl Check for system MySQL C++ Connector
8437     dnl ===================================================================
8438     # FIXME!
8439     # who thought this too-generic cppconn dir was a good idea?
8440     AC_MSG_CHECKING([MySQL Connector/C++])
8441     if test "$with_system_mysql_cppconn" = "yes"; then
8442         AC_MSG_RESULT([external])
8443         SYSTEM_MYSQL_CPPCONN=TRUE
8444         AC_LANG_PUSH([C++])
8445         AC_CHECK_HEADER(mysql_driver.h, [],
8446                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8447         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8448                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8449         save_LIBS=$LIBS
8450         LIBS="$LIBS -lmysqlcppconn"
8451         AC_MSG_CHECKING([version])
8452         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8453 #include <mysql_driver.h>
8455 int main(int argc, char **argv) {
8456     sql::Driver *driver;
8457     driver = get_driver_instance();
8458     if (driver->getMajorVersion() > 1 || \
8459        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8460        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8461         return 0;
8462       else
8463         return 1;
8465       ]])],[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])])
8467         AC_LANG_POP([C++])
8468         LIBS=$save_LIBS
8469     else
8470         AC_MSG_RESULT([internal])
8471         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8472         SYSTEM_MYSQL_CPPCONN=
8473     fi
8474     AC_LANG_POP([C++])
8476 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8478 dnl ===================================================================
8479 dnl Check for system hsqldb
8480 dnl ===================================================================
8481 if test "$with_java" != "no"; then
8482     HSQLDB_USE_JDBC_4_1=
8483     AC_MSG_CHECKING([which hsqldb to use])
8484     if test "$with_system_hsqldb" = "yes"; then
8485         AC_MSG_RESULT([external])
8486         SYSTEM_HSQLDB=TRUE
8487         if test -z $HSQLDB_JAR; then
8488             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8489         fi
8490         if ! test -f $HSQLDB_JAR; then
8491                AC_MSG_ERROR(hsqldb.jar not found.)
8492         fi
8493         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8494         export HSQLDB_JAR
8495         if $PERL -e \
8496            'use Archive::Zip;
8497             my $file = "$ENV{'HSQLDB_JAR'}";
8498             my $zip = Archive::Zip->new( $file );
8499             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8500             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8501             {
8502                 push @l, split(/\n/, $mf);
8503                 foreach my $line (@l)
8504                 {
8505                     if ($line =~ m/Specification-Version:/)
8506                     {
8507                         ($t, $version) = split (/:/,$line);
8508                         $version =~ s/^\s//;
8509                         ($a, $b, $c, $d) = split (/\./,$version);
8510                         if ($c == "0" && $d > "8")
8511                         {
8512                             exit 0;
8513                         }
8514                         else
8515                         {
8516                             exit 1;
8517                         }
8518                     }
8519                 }
8520             }
8521             else
8522             {
8523                 exit 1;
8524             }'; then
8525             AC_MSG_RESULT([yes])
8526         else
8527             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8528         fi
8529     else
8530         AC_MSG_RESULT([internal])
8531         SYSTEM_HSQLDB=
8532         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8533         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8534         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8535         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8536             AC_MSG_RESULT([yes])
8537             HSQLDB_USE_JDBC_4_1=TRUE
8538         else
8539             AC_MSG_RESULT([no])
8540         fi
8541     fi
8542     AC_SUBST(SYSTEM_HSQLDB)
8543     AC_SUBST(HSQLDB_JAR)
8544     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8547 dnl ===================================================================
8548 dnl Check for PostgreSQL stuff
8549 dnl ===================================================================
8550 if test "x$enable_postgresql_sdbc" != "xno"; then
8551     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8553     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8554         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8555     fi
8556     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8557         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8558     fi
8560     postgres_interface=""
8561     if test "$with_system_postgresql" = "yes"; then
8562         postgres_interface="external PostgreSQL"
8563         SYSTEM_POSTGRESQL=TRUE
8564         if test "$_os" = Darwin; then
8565             supp_path=''
8566             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8567                 pg_supp_path="$P_SEP$d$pg_supp_path"
8568             done
8569         fi
8570         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8571         if test -z "$PGCONFIG"; then
8572             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8573         fi
8574         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8575         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8576         FilterLibs "${POSTGRESQL_LIB}"
8577         POSTGRESQL_LIB="${filteredlibs}"
8578     else
8579         # if/when anything else than PostgreSQL uses Kerberos,
8580         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8581         WITH_KRB5=
8582         WITH_GSSAPI=
8583         case "$_os" in
8584         Darwin)
8585             # MacOS X has system MIT Kerberos 5 since 10.4
8586             if test "$with_krb5" != "no"; then
8587                 WITH_KRB5=TRUE
8588                 save_LIBS=$LIBS
8589                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8590                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8591                 KRB5_LIBS=$LIBS
8592                 LIBS=$save_LIBS
8593                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8594                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8595                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8596                 LIBS=$save_LIBS
8597             fi
8598             if test "$with_gssapi" != "no"; then
8599                 WITH_GSSAPI=TRUE
8600                 save_LIBS=$LIBS
8601                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8602                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8603                 GSSAPI_LIBS=$LIBS
8604                 LIBS=$save_LIBS
8605             fi
8606             ;;
8607         WINNT)
8608             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8609                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8610             fi
8611             ;;
8612         Linux|GNU|*BSD|DragonFly)
8613             if test "$with_krb5" != "no"; then
8614                 WITH_KRB5=TRUE
8615                 save_LIBS=$LIBS
8616                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8617                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8618                 KRB5_LIBS=$LIBS
8619                 LIBS=$save_LIBS
8620                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8621                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8622                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8623                 LIBS=$save_LIBS
8624             fi
8625             if test "$with_gssapi" != "no"; then
8626                 WITH_GSSAPI=TRUE
8627                 save_LIBS=$LIBS
8628                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8629                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8630                 GSSAPI_LIBS=$LIBS
8631                 LIBS=$save_LIBS
8632             fi
8633             ;;
8634         *)
8635             if test "$with_krb5" = "yes"; then
8636                 WITH_KRB5=TRUE
8637                 save_LIBS=$LIBS
8638                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8639                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8640                 KRB5_LIBS=$LIBS
8641                 LIBS=$save_LIBS
8642                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8643                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8644                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8645                 LIBS=$save_LIBS
8646             fi
8647             if test "$with_gssapi" = "yes"; then
8648                 WITH_GSSAPI=TRUE
8649                 save_LIBS=$LIBS
8650                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8651                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8652                 LIBS=$save_LIBS
8653                 GSSAPI_LIBS=$LIBS
8654             fi
8655         esac
8657         if test -n "$with_libpq_path"; then
8658             SYSTEM_POSTGRESQL=TRUE
8659             postgres_interface="external libpq"
8660             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8661             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8662         else
8663             SYSTEM_POSTGRESQL=
8664             postgres_interface="internal"
8665             POSTGRESQL_LIB=""
8666             POSTGRESQL_INC="%OVERRIDE_ME%"
8667             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8668         fi
8669     fi
8671     AC_MSG_CHECKING([PostgreSQL C interface])
8672     AC_MSG_RESULT([$postgres_interface])
8674     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8675         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8676         save_CFLAGS=$CFLAGS
8677         save_CPPFLAGS=$CPPFLAGS
8678         save_LIBS=$LIBS
8679         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8680         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8681         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8682         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8683             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8684         CFLAGS=$save_CFLAGS
8685         CPPFLAGS=$save_CPPFLAGS
8686         LIBS=$save_LIBS
8687     fi
8688     BUILD_POSTGRESQL_SDBC=TRUE
8690 AC_SUBST(WITH_KRB5)
8691 AC_SUBST(WITH_GSSAPI)
8692 AC_SUBST(GSSAPI_LIBS)
8693 AC_SUBST(KRB5_LIBS)
8694 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8695 AC_SUBST(SYSTEM_POSTGRESQL)
8696 AC_SUBST(POSTGRESQL_INC)
8697 AC_SUBST(POSTGRESQL_LIB)
8699 dnl ===================================================================
8700 dnl Check for Firebird stuff
8701 dnl ===================================================================
8702 ENABLE_FIREBIRD_SDBC=""
8703 if test "$enable_firebird_sdbc" = "yes" ; then
8704     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8706     dnl ===================================================================
8707     dnl Check for system Firebird
8708     dnl ===================================================================
8709     AC_MSG_CHECKING([which Firebird to use])
8710     if test "$with_system_firebird" = "yes"; then
8711         AC_MSG_RESULT([external])
8712         SYSTEM_FIREBIRD=TRUE
8713         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8714         if test -z "$FIREBIRDCONFIG"; then
8715             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8716             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8717                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8718             ])
8719             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8720         else
8721             AC_MSG_NOTICE([fb_config found])
8722             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8723             AC_MSG_CHECKING([for Firebird Client library])
8724             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8725             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8726             FilterLibs "${FIREBIRD_LIBS}"
8727             FIREBIRD_LIBS="${filteredlibs}"
8728         fi
8729         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8730         AC_MSG_CHECKING([Firebird version])
8731         if test -n "${FIREBIRD_VERSION}"; then
8732             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8733             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8734             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8735                 AC_MSG_RESULT([OK])
8736             else
8737                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8738             fi
8739         else
8740             __save_CFLAGS="${CFLAGS}"
8741             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8742             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8743 #if defined(FB_API_VER) && FB_API_VER == 30
8744 int fb_api_is_30(void) { return 0; }
8745 #else
8746 #error "Wrong Firebird API version"
8747 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8748             CFLAGS="${__save_CFLAGS}"
8749         fi
8750         ENABLE_FIREBIRD_SDBC="TRUE"
8751     elif test "$enable_database_connectivity" != yes; then
8752         AC_MSG_RESULT([none])
8753     elif test "$cross_compiling" = "yes"; then
8754         AC_MSG_RESULT([none])
8755     else
8756         dnl Embedded Firebird has version 3.0
8757         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8758         dnl We need libatomic-ops for any non X86/X64 system
8759         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8760             dnl ===================================================================
8761             dnl Check for system libatomic-ops
8762             dnl ===================================================================
8763             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8764             if test "$with_system_libatomic_ops" = "yes"; then
8765                 SYSTEM_LIBATOMIC_OPS=TRUE
8766                 AC_CHECK_HEADERS(atomic_ops.h, [],
8767                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8768             else
8769                 SYSTEM_LIBATOMIC_OPS=
8770                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8771                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8772                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8773             fi
8774         fi
8776         AC_MSG_RESULT([internal])
8777         SYSTEM_FIREBIRD=
8778         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8779         FIREBIRD_LIBS="-lfbclient"
8781         if test "$with_system_libtommath" = "yes"; then
8782             SYSTEM_LIBTOMMATH=TRUE
8783             dnl check for tommath presence
8784             save_LIBS=$LIBS
8785             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8786             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8787             LIBS=$save_LIBS
8788         else
8789             SYSTEM_LIBTOMMATH=
8790             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8791             LIBTOMMATH_LIBS="-ltommath"
8792             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8793         fi
8795         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8796         ENABLE_FIREBIRD_SDBC="TRUE"
8797     fi
8799 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8800 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8801 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8802 AC_SUBST(LIBATOMIC_OPS_LIBS)
8803 AC_SUBST(SYSTEM_FIREBIRD)
8804 AC_SUBST(FIREBIRD_CFLAGS)
8805 AC_SUBST(FIREBIRD_LIBS)
8806 AC_SUBST([TOMMATH_CFLAGS])
8807 AC_SUBST([TOMMATH_LIBS])
8809 dnl ===================================================================
8810 dnl Check for system curl
8811 dnl ===================================================================
8812 AC_MSG_CHECKING([which libcurl to use])
8813 if test "$with_system_curl" = "auto"; then
8814     with_system_curl="$with_system_libs"
8817 if test "$with_system_curl" = "yes"; then
8818     AC_MSG_RESULT([external])
8819     SYSTEM_CURL=TRUE
8821     # First try PKGCONFIG and then fall back
8822     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8824     if test -n "$CURL_PKG_ERRORS"; then
8825         AC_PATH_PROG(CURLCONFIG, curl-config)
8826         if test -z "$CURLCONFIG"; then
8827             AC_MSG_ERROR([curl development files not found])
8828         fi
8829         CURL_LIBS=`$CURLCONFIG --libs`
8830         FilterLibs "${CURL_LIBS}"
8831         CURL_LIBS="${filteredlibs}"
8832         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8833         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8835         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8836         case $curl_version in
8837         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8838         dnl so they need to be doubled to end up in the configure script
8839         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8840             AC_MSG_RESULT([yes])
8841             ;;
8842         *)
8843             AC_MSG_ERROR([no, you have $curl_version])
8844             ;;
8845         esac
8846     fi
8848     libo_MINGW_CHECK_DLL([libcurl])
8849     libo_MINGW_TRY_DLL([libintl])
8850     libo_MINGW_TRY_DLL([libidn])
8851     libo_MINGW_TRY_DLL([libnspr4])
8852     libo_MINGW_TRY_DLL([nssutil3])
8853     libo_MINGW_TRY_DLL([libplc4])
8854     libo_MINGW_TRY_DLL([libplds4])
8855     libo_MINGW_TRY_DLL([nss3])
8856     libo_MINGW_TRY_DLL([ssl3])
8857     libo_MINGW_TRY_DLL([libgpg-error])
8858     libo_MINGW_TRY_DLL([libgcrypt])
8859     libo_MINGW_TRY_DLL([libssh2])
8860     ENABLE_CURL=TRUE
8861 elif test $_os = iOS; then
8862     # Let's see if we need curl, I think not?
8863     AC_MSG_RESULT([none])
8864     ENABLE_CURL=
8865 else
8866     AC_MSG_RESULT([internal])
8867     SYSTEM_CURL=
8868     BUILD_TYPE="$BUILD_TYPE CURL"
8869     ENABLE_CURL=TRUE
8871 AC_SUBST(SYSTEM_CURL)
8872 AC_SUBST(CURL_CFLAGS)
8873 AC_SUBST(CURL_LIBS)
8874 AC_SUBST(ENABLE_CURL)
8876 dnl ===================================================================
8877 dnl Check for system boost
8878 dnl ===================================================================
8879 AC_MSG_CHECKING([which boost to use])
8880 if test "$with_system_boost" = "yes"; then
8881     AC_MSG_RESULT([external])
8882     SYSTEM_BOOST=TRUE
8883     AX_BOOST_BASE(1.47)
8884     AX_BOOST_DATE_TIME
8885     AX_BOOST_FILESYSTEM
8886     AX_BOOST_IOSTREAMS
8887     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8888     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8889     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8890         # if not found, try again with 'lib' prefix
8891         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8892     fi
8893     AC_LANG_PUSH([C++])
8894     save_CXXFLAGS=$CXXFLAGS
8895     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8896     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8897        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8898     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8899        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8900     AC_CHECK_HEADER(boost/function.hpp, [],
8901        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8902     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8903     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8904     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8905 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8906     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8907         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8908     else
8909         AC_MSG_RESULT([yes])
8910     fi
8911     CXXFLAGS=$save_CXXFLAGS
8912     AC_LANG_POP([C++])
8913     # this is in m4/ax_boost_base.m4
8914     FilterLibs "${BOOST_LDFLAGS}"
8915     BOOST_LDFLAGS="${filteredlibs}"
8916 else
8917     AC_MSG_RESULT([internal])
8918     BUILD_TYPE="$BUILD_TYPE BOOST"
8919     SYSTEM_BOOST=
8920     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8921         # use warning-suppressing wrapper headers
8922         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8923     else
8924         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8925     fi
8927 AC_SUBST(SYSTEM_BOOST)
8929 dnl ===================================================================
8930 dnl Check for system mdds
8931 dnl ===================================================================
8932 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8934 dnl ===================================================================
8935 dnl Check for system glm
8936 dnl ===================================================================
8937 AC_MSG_CHECKING([which glm to use])
8938 if test "$with_system_glm" = "yes"; then
8939     AC_MSG_RESULT([external])
8940     SYSTEM_GLM=TRUE
8941     AC_LANG_PUSH([C++])
8942     AC_CHECK_HEADER([glm/glm.hpp], [],
8943        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8944     AC_LANG_POP([C++])
8945 else
8946     AC_MSG_RESULT([internal])
8947     BUILD_TYPE="$BUILD_TYPE GLM"
8948     SYSTEM_GLM=
8949     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8951 AC_SUBST([GLM_CFLAGS])
8952 AC_SUBST([SYSTEM_GLM])
8954 dnl ===================================================================
8955 dnl Check for system glew
8956 dnl ===================================================================
8957 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8958 AS_IF([test "$with_system_glew" = "yes"],
8959     [PKG_CHECK_EXISTS([glew >= 1.12.0], [AC_DEFINE([HAVE_GLEW_1_12])])],
8960     [AC_DEFINE([HAVE_GLEW_1_12])])
8962 dnl ===================================================================
8963 dnl Check for system odbc
8964 dnl ===================================================================
8965 AC_MSG_CHECKING([which odbc headers to use])
8966 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
8967     AC_MSG_RESULT([external])
8968     SYSTEM_ODBC_HEADERS=TRUE
8970     if test "$build_os" = "cygwin"; then
8971         save_CPPFLAGS=$CPPFLAGS
8972         find_winsdk
8973         PathFormat "$winsdktest"
8974         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"
8975         AC_CHECK_HEADER(sqlext.h, [],
8976             [AC_MSG_ERROR(odbc not found. install odbc)],
8977             [#include <windows.h>])
8978         CPPFLAGS=$save_CPPFLAGS
8979     else
8980         AC_CHECK_HEADER(sqlext.h, [],
8981             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8982     fi
8983 elif test "$enable_database_connectivity" != yes; then
8984     AC_MSG_RESULT([none])
8985 else
8986     AC_MSG_RESULT([internal])
8987     SYSTEM_ODBC_HEADERS=
8989 AC_SUBST(SYSTEM_ODBC_HEADERS)
8992 dnl ===================================================================
8993 dnl Check for system openldap
8994 dnl ===================================================================
8996 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8997 AC_MSG_CHECKING([which openldap library to use])
8998 if test "$with_system_openldap" = "yes"; then
8999     AC_MSG_RESULT([external])
9000     SYSTEM_OPENLDAP=TRUE
9001     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9002     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9003     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9004 else
9005     AC_MSG_RESULT([internal])
9006     SYSTEM_OPENLDAP=
9007     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9010 AC_SUBST(SYSTEM_OPENLDAP)
9012 dnl ===================================================================
9013 dnl Check for TLS/SSL and cryptographic implementation to use
9014 dnl ===================================================================
9015 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9016 if test -n "$with_tls"; then
9017     case $with_tls in
9018     openssl)
9019         AC_DEFINE(USE_TLS_OPENSSL)
9020         TLS=OPENSSL
9022         if test "$enable_openssl" != "yes"; then
9023             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9024         fi
9026         # warn that OpenSSL has been selected but not all TLS code has this option
9027         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
9028         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
9029         ;;
9030     nss)
9031         AC_DEFINE(USE_TLS_NSS)
9032         TLS=NSS
9033         ;;
9034     *)
9035         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9036 openssl - OpenSSL
9037 nss - Mozilla's Network Security Services (NSS)
9038     ])
9039         ;;
9040     esac
9041 elif test $_os = iOS -o $_os = Android; then
9042     # We don't build NSS for iOS and Android
9043     AC_DEFINE(USE_TLS_OPENSSL)
9044     TLS=OPENSSL
9045 else
9046     # default to using NSS, it results in smaller oox lib
9047     AC_DEFINE(USE_TLS_NSS)
9048     TLS=NSS
9050 AC_MSG_RESULT([$TLS])
9051 AC_SUBST(TLS)
9053 dnl ===================================================================
9054 dnl Check for system NSS
9055 dnl ===================================================================
9056 if test $_os != iOS; then
9057     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9059 if test "$with_system_nss" = "yes"; then
9060     libo_MINGW_CHECK_DLL([libnspr4])
9061     libo_MINGW_CHECK_DLL([libplc4])
9062     libo_MINGW_CHECK_DLL([libplds4])
9063     libo_MINGW_CHECK_DLL([nss3])
9064     libo_MINGW_CHECK_DLL([nssutil3])
9065     libo_MINGW_CHECK_DLL([smime3])
9066     libo_MINGW_CHECK_DLL([ssl3])
9069 dnl ===================================================================
9070 dnl Check for system sane
9071 dnl ===================================================================
9072 AC_MSG_CHECKING([which sane header to use])
9073 if test "$with_system_sane" = "yes"; then
9074     AC_MSG_RESULT([external])
9075     AC_CHECK_HEADER(sane/sane.h, [],
9076       [AC_MSG_ERROR(sane not found. install sane)], [])
9077 else
9078     AC_MSG_RESULT([internal])
9079     BUILD_TYPE="$BUILD_TYPE SANE"
9082 dnl ===================================================================
9083 dnl Check for system icu
9084 dnl ===================================================================
9085 SYSTEM_GENBRK=
9086 SYSTEM_GENCCODE=
9087 SYSTEM_GENCMN=
9089 ICU_MAJOR=58
9090 ICU_MINOR=1
9091 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9092 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9093 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9094 AC_MSG_CHECKING([which icu to use])
9095 if test "$with_system_icu" = "yes"; then
9096     AC_MSG_RESULT([external])
9097     SYSTEM_ICU=TRUE
9098     AC_LANG_PUSH([C++])
9099     AC_MSG_CHECKING([for unicode/rbbi.h])
9100     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9101     AC_LANG_POP([C++])
9103     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
9104         ICUPATH="$PATH"
9105         if test "$WITH_MINGW" = "yes"; then
9106             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
9107         fi
9108         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
9110         AC_MSG_CHECKING([ICU version])
9111         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9112         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9113         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9115         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "6" \); then
9116             AC_MSG_RESULT([OK, $ICU_VERSION])
9117         else
9118             AC_MSG_ERROR([not suitable, only >= 4.6 supported currently])
9119         fi
9120     fi
9122     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9123         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9124         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9125         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9126         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9127         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9128         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9129             AC_MSG_RESULT([yes])
9130         else
9131             AC_MSG_RESULT([no])
9132             if test "$with_system_icu_for_build" != "force"; then
9133                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9134 You can use --with-system-icu-for-build=force to use it anyway.])
9135             fi
9136         fi
9137     fi
9139     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9140         # using the system icu tools can lead to version confusion, use the
9141         # ones from the build environment when cross-compiling
9142         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9143         if test -z "$SYSTEM_GENBRK"; then
9144             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9145         fi
9146         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9147         if test -z "$SYSTEM_GENCCODE"; then
9148             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9149         fi
9150         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9151         if test -z "$SYSTEM_GENCMN"; then
9152             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9153         fi
9154         if test "$ICU_MAJOR" -ge "49"; then
9155             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9156             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9157             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9158         else
9159             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9160             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9161             ICU_RECLASSIFIED_HEBREW_LETTER=
9162         fi
9163     fi
9165     if test "$cross_compiling" = "yes"; then
9166         if test "$ICU_MAJOR" -ge "50"; then
9167             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9168             ICU_MINOR=""
9169         fi
9170     fi
9172     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9173     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9174     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9175 else
9176     AC_MSG_RESULT([internal])
9177     SYSTEM_ICU=
9178     BUILD_TYPE="$BUILD_TYPE ICU"
9179     # surprisingly set these only for "internal" (to be used by various other
9180     # external libs): the system icu-config is quite unhelpful and spits out
9181     # dozens of weird flags and also default path -I/usr/include
9182     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9183     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9185 AC_SUBST(SYSTEM_ICU)
9186 AC_SUBST(SYSTEM_GENBRK)
9187 AC_SUBST(SYSTEM_GENCCODE)
9188 AC_SUBST(SYSTEM_GENCMN)
9189 AC_SUBST(ICU_MAJOR)
9190 AC_SUBST(ICU_MINOR)
9191 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9192 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9193 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9194 AC_SUBST(ICU_CFLAGS)
9195 AC_SUBST(ICU_LIBS)
9197 dnl ===================================================================
9198 dnl Graphite
9199 dnl ===================================================================
9200 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9201 if test "$with_system_graphite" = "yes"; then
9202     libo_MINGW_CHECK_DLL([libgraphite2])
9204 if test "$COM" = "MSC"; then # override the above
9205     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9208 # This is the old Graphite support that will eventually be removed
9209 AC_MSG_CHECKING([whether to enable graphite support])
9210 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9211     AC_MSG_RESULT([yes])
9212     ENABLE_GRAPHITE="TRUE"
9213     AC_DEFINE(ENABLE_GRAPHITE)
9215 else
9216     AC_MSG_RESULT([no])
9218 AC_SUBST(ENABLE_GRAPHITE)
9220 dnl ==================================================================
9221 dnl Breakpad
9222 dnl ==================================================================
9223 AC_MSG_CHECKING([whether to enable breakpad])
9224 if test "$enable_breakpad" != yes; then
9225     AC_MSG_RESULT([no])
9226 else
9227     AC_MSG_RESULT([yes])
9228     ENABLE_BREAKPAD="TRUE"
9229     AC_DEFINE(ENABLE_BREAKPAD)
9230     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9231     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9233     AC_MSG_CHECKING([for crashreport config])
9234     if test "$with_symbol_config" = "no"; then
9235         BREAKPAD_SYMBOL_CONFIG="invalid"
9236         AC_MSG_RESULT([no])
9237     else
9238         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9239         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9240         AC_MSG_RESULT([yes])
9241     fi
9242     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9244 AC_SUBST(ENABLE_BREAKPAD)
9246 dnl ===================================================================
9247 dnl Orcus
9248 dnl ===================================================================
9250 AC_MSG_CHECKING([whether to enable orcus])
9251 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9252     AC_MSG_RESULT([yes])
9253     ENABLE_ORCUS="TRUE"
9254     AC_DEFINE(ENABLE_ORCUS)
9256     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.12 >= 0.12.0])
9257     if test "$with_system_orcus" != "yes"; then
9258         if test "$SYSTEM_BOOST" = "TRUE"; then
9259             # ===========================================================
9260             # Determine if we are going to need to link with Boost.System
9261             # ===========================================================
9262             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9263             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9264             dnl in documentation has no effect.
9265             AC_MSG_CHECKING([if we need to link with Boost.System])
9266             AC_LANG_PUSH([C++])
9267             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9268                     @%:@include <boost/version.hpp>
9269                 ]],[[
9270                     #if BOOST_VERSION >= 105000
9271                     #   error yes, we need to link with Boost.System
9272                     #endif
9273                 ]])],[
9274                     AC_MSG_RESULT([no])
9275                 ],[
9276                     AC_MSG_RESULT([yes])
9277                     AX_BOOST_SYSTEM
9278             ])
9279             AC_LANG_POP([C++])
9280         fi
9281     fi
9282     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9283     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9284     AC_SUBST([BOOST_SYSTEM_LIB])
9285     AC_SUBST(SYSTEM_LIBORCUS)
9287 else
9288     AC_MSG_RESULT([no])
9290 AC_SUBST(ENABLE_ORCUS)
9292 dnl ===================================================================
9293 dnl HarfBuzz
9294 dnl ===================================================================
9295 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9296 if test "$COM" = "MSC"; then # override the above
9297     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9299 if test "$with_system_harfbuzz" = "yes"; then
9300     if test "$with_system_graphite" = "no"; then
9301         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9302     fi
9303     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9304     _save_libs="$LIBS"
9305     _save_cflags="$CFLAGS"
9306     LIBS="$LIBS $HARFBUZZ_LIBS"
9307     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9308     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9309     LIBS="$_save_libs"
9310     CFLAGS="$_save_cflags"
9311 else
9312     if test "$with_system_graphite" = "yes"; then
9313         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9314     fi
9317 AC_MSG_CHECKING([whether to use X11])
9318 dnl ***************************************
9319 dnl testing for X libraries and includes...
9320 dnl ***************************************
9321 if test "$USING_X11" = TRUE; then
9322     AC_DEFINE(HAVE_FEATURE_X11)
9324 AC_MSG_RESULT([$USING_X11])
9326 if test "$USING_X11" = TRUE; then
9327     AC_PATH_X
9328     AC_PATH_XTRA
9329     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9331     if test -z "$x_includes"; then
9332         x_includes="default_x_includes"
9333     fi
9334     if test -z "$x_libraries"; then
9335         x_libraries="default_x_libraries"
9336     fi
9337     CFLAGS="$CFLAGS $X_CFLAGS"
9338     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9339     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9340 else
9341     x_includes="no_x_includes"
9342     x_libraries="no_x_libraries"
9345 if test "$USING_X11" = TRUE; then
9346     dnl ===================================================================
9347     dnl Check for Composite.h for Mozilla plugin
9348     dnl ===================================================================
9349     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9350      [#include <X11/Intrinsic.h>])
9352     dnl ===================================================================
9353     dnl Check for extension headers
9354     dnl ===================================================================
9355     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9356      [#include <X11/extensions/shape.h>])
9358     # vcl needs ICE and SM
9359     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9360     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9361         [AC_MSG_ERROR(ICE library not found)])
9362     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9363     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9364         [AC_MSG_ERROR(SM library not found)])
9367 dnl ===================================================================
9368 dnl Check for system Xrender
9369 dnl ===================================================================
9370 AC_MSG_CHECKING([whether to use Xrender])
9371 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9372     AC_MSG_RESULT([yes])
9373     PKG_CHECK_MODULES(XRENDER, xrender)
9374     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9375     FilterLibs "${XRENDER_LIBS}"
9376     XRENDER_LIBS="${filteredlibs}"
9377     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9378       [AC_MSG_ERROR(libXrender not found or functional)], [])
9379     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9380       [AC_MSG_ERROR(Xrender not found. install X)], [])
9381 else
9382     AC_MSG_RESULT([no])
9384 AC_SUBST(XRENDER_CFLAGS)
9385 AC_SUBST(XRENDER_LIBS)
9387 dnl ===================================================================
9388 dnl Check for XRandr
9389 dnl ===================================================================
9390 AC_MSG_CHECKING([whether to enable RandR support])
9391 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9392     AC_MSG_RESULT([yes])
9393     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9394     if test "$ENABLE_RANDR" != "TRUE"; then
9395         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9396                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9397         XRANDR_CFLAGS=" "
9398         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9399           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9400         XRANDR_LIBS="-lXrandr "
9401         ENABLE_RANDR="TRUE"
9402     fi
9403     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9404     FilterLibs "${XRANDR_LIBS}"
9405     XRANDR_LIBS="${filteredlibs}"
9406 else
9407     ENABLE_RANDR=""
9408     AC_MSG_RESULT([no])
9410 AC_SUBST(XRANDR_CFLAGS)
9411 AC_SUBST(XRANDR_LIBS)
9412 AC_SUBST(ENABLE_RANDR)
9414 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9415     WITH_WEBDAV="serf"
9417 if test $_os = iOS -o $_os = Android; then
9418     WITH_WEBDAV="no"
9420 AC_MSG_CHECKING([for webdav library])
9421 case "$WITH_WEBDAV" in
9422 serf)
9423     AC_MSG_RESULT([serf])
9424     # Check for system apr-util
9425     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9426                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9427                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9428     if test "$COM" = "MSC"; then
9429         APR_LIB_DIR="LibR"
9430         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9431         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9432     fi
9434     # Check for system serf
9435     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9436                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9437     if test "$COM" = "MSC"; then
9438         SERF_LIB_DIR="Release"
9439         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9440         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9441     fi
9442     ;;
9443 neon)
9444     AC_MSG_RESULT([neon])
9445     # Check for system neon
9446     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9447     if test "$with_system_neon" = "yes"; then
9448         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9449         libo_MINGW_CHECK_DLL([libneon])
9450         libo_MINGW_TRY_DLL([libtasn1])
9451         libo_MINGW_TRY_DLL([libgnutls])
9452     else
9453         NEON_VERSION=0295
9454     fi
9455     AC_SUBST(NEON_VERSION)
9456     ;;
9458     AC_MSG_RESULT([none, disabled])
9459     WITH_WEBDAV=""
9460     ;;
9461 esac
9462 AC_SUBST(WITH_WEBDAV)
9464 dnl ===================================================================
9465 dnl Check for disabling cve_tests
9466 dnl ===================================================================
9467 AC_MSG_CHECKING([whether to execute CVE tests])
9468 # If not explicitly enabled or disabled, default
9469 if test -z "$enable_cve_tests"; then
9470     case "$OS" in
9471     WNT)
9472         # Default cves off for windows with its wild and wonderful
9473         # varienty of AV software kicking in and panicing
9474         enable_cve_tests=no
9475         ;;
9476     *)
9477         # otherwise yes
9478         enable_cve_tests=yes
9479         ;;
9480     esac
9482 if test "$enable_cve_tests" = "no"; then
9483     AC_MSG_RESULT([no])
9484     DISABLE_CVE_TESTS=TRUE
9485     AC_SUBST(DISABLE_CVE_TESTS)
9486 else
9487     AC_MSG_RESULT([yes])
9490 dnl ===================================================================
9491 dnl Check for enabling chart XShape tests
9492 dnl ===================================================================
9493 AC_MSG_CHECKING([whether to execute chart XShape tests])
9494 if test "$enable_chart_tests" = "yes"; then
9495     AC_MSG_RESULT([yes])
9496     ENABLE_CHART_TESTS=TRUE
9497     AC_SUBST(ENABLE_CHART_TESTS)
9498 else
9499     AC_MSG_RESULT([no])
9502 dnl ===================================================================
9503 dnl Check for system openssl
9504 dnl ===================================================================
9505 DISABLE_OPENSSL=
9506 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9507 if test "$enable_openssl" = "yes"; then
9508     AC_MSG_RESULT([no])
9509     if test "$_os" = Darwin ; then
9510         # OpenSSL is deprecated when building for 10.7 or later.
9511         #
9512         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9513         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9515         with_system_openssl=no
9516         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9517     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9518             && test "$with_system_openssl" != "no"; then
9519         with_system_openssl=yes
9520         SYSTEM_OPENSSL=TRUE
9521         OPENSSL_CFLAGS=
9522         OPENSSL_LIBS="-lssl -lcrypto"
9523     else
9524         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9525     fi
9526     if test "$with_system_openssl" = "yes"; then
9527         libo_MINGW_CHECK_DLL([libssl])
9528         libo_MINGW_CHECK_DLL([libcrypto])
9529         AC_MSG_CHECKING([whether openssl supports SHA512])
9530         AC_LANG_PUSH([C])
9531         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9532             SHA512_CTX context;
9533 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9534         AC_LANG_POP(C)
9535     fi
9536 else
9537     AC_MSG_RESULT([yes])
9538     DISABLE_OPENSSL=TRUE
9540     # warn that although OpenSSL is disabled, system libraries may be depending on it
9541     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9542     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9545 AC_SUBST([DISABLE_OPENSSL])
9547 dnl ===================================================================
9548 dnl Check for building gnutls
9549 dnl ===================================================================
9550 AC_MSG_CHECKING([whether to use gnutls])
9551 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9552     AC_MSG_RESULT([yes])
9553     AM_PATH_LIBGCRYPT()
9554     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9555         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9556                       available in the system to use as replacement.]]))
9557     FilterLibs "${LIBGCRYPT_LIBS}"
9558     LIBGCRYPT_LIBS="${filteredlibs}"
9559 else
9560     AC_MSG_RESULT([no])
9563 AC_SUBST([LIBGCRYPT_CFLAGS])
9564 AC_SUBST([LIBGCRYPT_LIBS])
9566 dnl ===================================================================
9567 dnl Check for system redland
9568 dnl ===================================================================
9569 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9570 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9571 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9572 if test "$with_system_redland" = "yes"; then
9573     libo_MINGW_CHECK_DLL([librdf])
9574     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9575             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9576     libo_MINGW_TRY_DLL([libraptor])
9577     libo_MINGW_TRY_DLL([librasqal])
9578     libo_MINGW_TRY_DLL([libsqlite3])
9579 else
9580     RAPTOR_MAJOR="0"
9581     RASQAL_MAJOR="3"
9582     REDLAND_MAJOR="0"
9584 AC_SUBST(RAPTOR_MAJOR)
9585 AC_SUBST(RASQAL_MAJOR)
9586 AC_SUBST(REDLAND_MAJOR)
9588 dnl ===================================================================
9589 dnl Check for system hunspell
9590 dnl ===================================================================
9591 AC_MSG_CHECKING([which libhunspell to use])
9592 if test "$with_system_hunspell" = "yes"; then
9593     AC_MSG_RESULT([external])
9594     SYSTEM_HUNSPELL=TRUE
9595     AC_LANG_PUSH([C++])
9596     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9597     if test "$HUNSPELL_PC" != "TRUE"; then
9598         AC_CHECK_HEADER(hunspell.hxx, [],
9599             [
9600             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9601             [AC_MSG_ERROR(hunspell headers not found.)], [])
9602             ], [])
9603         AC_CHECK_LIB([hunspell], [main], [:],
9604            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9605         HUNSPELL_LIBS=-lhunspell
9606     fi
9607     AC_LANG_POP([C++])
9608     libo_MINGW_CHECK_DLL([libhunspell-1.6])
9609     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9610     FilterLibs "${HUNSPELL_LIBS}"
9611     HUNSPELL_LIBS="${filteredlibs}"
9612 else
9613     AC_MSG_RESULT([internal])
9614     SYSTEM_HUNSPELL=
9615     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9616     if test "$COM" = "MSC"; then
9617         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9618     else
9619         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9620     fi
9621     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9623 AC_SUBST(SYSTEM_HUNSPELL)
9624 AC_SUBST(HUNSPELL_CFLAGS)
9625 AC_SUBST(HUNSPELL_LIBS)
9627 dnl ===================================================================
9628 dnl Checking for altlinuxhyph
9629 dnl ===================================================================
9630 AC_MSG_CHECKING([which altlinuxhyph to use])
9631 if test "$with_system_altlinuxhyph" = "yes"; then
9632     AC_MSG_RESULT([external])
9633     SYSTEM_HYPH=TRUE
9634     AC_CHECK_HEADER(hyphen.h, [],
9635        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9636     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9637        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9638        [#include <hyphen.h>])
9639     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9640         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9641     if test -z "$HYPHEN_LIB"; then
9642         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9643            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9644     fi
9645     if test -z "$HYPHEN_LIB"; then
9646         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9647            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9648     fi
9649     libo_MINGW_CHECK_DLL([libhyphen])
9650 else
9651     AC_MSG_RESULT([internal])
9652     SYSTEM_HYPH=
9653     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9654     if test "$COM" = "MSC"; then
9655         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9656     else
9657         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9658     fi
9660 AC_SUBST(SYSTEM_HYPH)
9661 AC_SUBST(HYPHEN_LIB)
9663 dnl ===================================================================
9664 dnl Checking for mythes
9665 dnl ===================================================================
9666 AC_MSG_CHECKING([which mythes to use])
9667 if test "$with_system_mythes" = "yes"; then
9668     AC_MSG_RESULT([external])
9669     SYSTEM_MYTHES=TRUE
9670     AC_LANG_PUSH([C++])
9671     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9672     if test "$MYTHES_PKGCONFIG" = "no"; then
9673         AC_CHECK_HEADER(mythes.hxx, [],
9674             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9675         AC_CHECK_LIB([mythes-1.2], [main], [:],
9676             [ MYTHES_FOUND=no], [])
9677     if test "$MYTHES_FOUND" = "no"; then
9678         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9679                 [ MYTHES_FOUND=no], [])
9680     fi
9681     if test "$MYTHES_FOUND" = "no"; then
9682         AC_MSG_ERROR([mythes library not found!.])
9683     fi
9684     fi
9685     AC_LANG_POP([C++])
9686     libo_MINGW_CHECK_DLL([libmythes-1.2])
9687     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9688     FilterLibs "${MYTHES_LIBS}"
9689     MYTHES_LIBS="${filteredlibs}"
9690 else
9691     AC_MSG_RESULT([internal])
9692     SYSTEM_MYTHES=
9693     BUILD_TYPE="$BUILD_TYPE MYTHES"
9694     if test "$COM" = "MSC"; then
9695         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9696     else
9697         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9698     fi
9700 AC_SUBST(SYSTEM_MYTHES)
9701 AC_SUBST(MYTHES_CFLAGS)
9702 AC_SUBST(MYTHES_LIBS)
9704 dnl ===================================================================
9705 dnl How should we build the linear programming solver ?
9706 dnl ===================================================================
9708 ENABLE_COINMP=
9709 AC_MSG_CHECKING([whether to build with CoinMP])
9710 if test "$enable_coinmp" != "no"; then
9711     ENABLE_COINMP=TRUE
9712     AC_MSG_RESULT([yes])
9713     if test "$with_system_coinmp" = "yes"; then
9714         SYSTEM_COINMP=TRUE
9715         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9716         FilterLibs "${COINMP_LIBS}"
9717         COINMP_LIBS="${filteredlibs}"
9718     else
9719         BUILD_TYPE="$BUILD_TYPE COINMP"
9720     fi
9721 else
9722     AC_MSG_RESULT([no])
9724 AC_SUBST(ENABLE_COINMP)
9725 AC_SUBST(SYSTEM_COINMP)
9726 AC_SUBST(COINMP_CFLAGS)
9727 AC_SUBST(COINMP_LIBS)
9729 ENABLE_LPSOLVE=
9730 AC_MSG_CHECKING([whether to build with lpsolve])
9731 if test "$enable_lpsolve" != "no"; then
9732     ENABLE_LPSOLVE=TRUE
9733     AC_MSG_RESULT([yes])
9734 else
9735     AC_MSG_RESULT([no])
9737 AC_SUBST(ENABLE_LPSOLVE)
9739 if test "$ENABLE_LPSOLVE" = TRUE; then
9740     AC_MSG_CHECKING([which lpsolve to use])
9741     if test "$with_system_lpsolve" = "yes"; then
9742         AC_MSG_RESULT([external])
9743         SYSTEM_LPSOLVE=TRUE
9744         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9745            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9746         save_LIBS=$LIBS
9747         # some systems need this. Like Ubuntu....
9748         AC_CHECK_LIB(m, floor)
9749         AC_CHECK_LIB(dl, dlopen)
9750         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9751             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9752         LIBS=$save_LIBS
9753         libo_MINGW_CHECK_DLL([lpsolve55])
9754     else
9755         AC_MSG_RESULT([internal])
9756         SYSTEM_LPSOLVE=
9757         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9758     fi
9760 AC_SUBST(SYSTEM_LPSOLVE)
9762 dnl ===================================================================
9763 dnl Checking for libexttextcat
9764 dnl ===================================================================
9765 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9766 if test "$with_system_libexttextcat" = "yes"; then
9767     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9769 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9771 dnl ***************************************
9772 dnl testing libc version for Linux...
9773 dnl ***************************************
9774 if test "$_os" = "Linux"; then
9775     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9776     exec 6>/dev/null # no output
9777     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9778     exec 6>&1 # output on again
9779     if test "$HAVE_LIBC"; then
9780         AC_MSG_RESULT([yes])
9781     else
9782         AC_MSG_ERROR([no, upgrade libc])
9783     fi
9786 dnl =========================================
9787 dnl Check for the Windows  SDK.
9788 dnl =========================================
9789 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9790 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9791 if test "$_os" = "WINNT"; then
9792     AC_MSG_CHECKING([for Windows SDK])
9793     if test "$build_os" = "cygwin"; then
9794         find_winsdk
9795         WINDOWS_SDK_HOME=$winsdktest
9797         # normalize if found
9798         if test -n "$WINDOWS_SDK_HOME"; then
9799             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9800             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9801         fi
9803         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
9804     fi
9806     if test -n "$WINDOWS_SDK_HOME"; then
9807         # Remove a possible trailing backslash
9808         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9810         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9811              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9812              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9813             have_windows_sdk_headers=yes
9814         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9815              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9816              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9817             have_windows_sdk_headers=yes
9818         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
9819              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
9820              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
9821             have_windows_sdk_headers=yes
9822         else
9823             have_windows_sdk_headers=no
9824         fi
9826         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9827             have_windows_sdk_libs=yes
9828         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9829             have_windows_sdk_libs=yes
9830         else
9831             have_windows_sdk_libs=no
9832         fi
9834         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9835             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9836 the  Windows SDK are installed.])
9837         fi
9839         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9840              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9841              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9842              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9843         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9844              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9845              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9846              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9847         else
9848             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9849         fi
9850     fi
9852     if test -z "$WINDOWS_SDK_HOME"; then
9853         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9854     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
9855         WINDOWS_SDK_VERSION=70
9856         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9857     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9858         WINDOWS_SDK_VERSION=80
9859         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9860         dnl compatibility warning if not explicitly choosing the 80 SDK:
9861         if test -z "$with_windows_sdk"; then
9862             AC_MSG_WARN([If a build should run on Windows XP,])
9863             AC_MSG_WARN([use --with-windows-sdk=7.1A])
9864             add_warning "If a build should run on Windows XP,"
9865             add_warning "use --with-windows-sdk=7.1A"
9866         fi
9867     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
9868         WINDOWS_SDK_VERSION=81
9869         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
9870     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
9871         WINDOWS_SDK_VERSION=10
9872         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
9873     else
9874         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9875     fi
9876     PathFormat "$WINDOWS_SDK_HOME"
9877     WINDOWS_SDK_HOME="$formatted_path"
9878     if test "$build_os" = "cygwin"; then
9879         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9880         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9881             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9882         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
9883             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
9884         fi
9885     fi
9887     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9888     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9889     dnl but not in v8.0), so allow this to be overridden with a
9890     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9891     dnl and configuration error if no WiLangId.vbs is found would arguably be
9892     dnl better, but I do not know under which conditions exactly it is needed by
9893     dnl msiglobal.pm:
9894     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9895         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9896         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9897             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9898         fi
9899         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9900             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9901         fi
9902         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9903             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9904             add_warning "WiLangId.vbs not found - building translated packages will fail"
9905         fi
9906     fi
9908 AC_SUBST(WINDOWS_SDK_HOME)
9909 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
9910 AC_SUBST(WINDOWS_SDK_VERSION)
9911 AC_SUBST(WINDOWS_SDK_WILANGID)
9913 dnl =========================================
9914 dnl Check for uuidgen
9915 dnl =========================================
9916 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9917     if test "$WITH_MINGW" = "yes"; then
9918         AC_PATH_PROG([UUIDGEN], [uuid])
9919         if test -z "$UUIDGEN"; then
9920             AC_MSG_WARN([uuid is needed for building installation sets])
9921         fi
9922     else
9923         # presence is already tested above in the WINDOWS_SDK_HOME check
9924         UUIDGEN=uuidgen.exe
9925         AC_SUBST(UUIDGEN)
9926     fi
9927 else
9928     AC_PATH_PROG([UUIDGEN], [uuidgen])
9929     if test -z "$UUIDGEN"; then
9930         AC_MSG_WARN([uuid is needed for building installation sets])
9931     fi
9934 dnl ***************************************
9935 dnl Checking for bison and flex
9936 dnl ***************************************
9937 AC_PATH_PROG(BISON, bison)
9938 if test -z "$BISON"; then
9939     AC_MSG_ERROR([no bison found in \$PATH, install it])
9940 else
9941     AC_MSG_CHECKING([the bison version])
9942     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9943     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9944     # Accept newer than 2.0
9945     if test "$_bison_longver" -lt 2000; then
9946         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9947     fi
9950 AC_PATH_PROG(FLEX, flex)
9951 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9952     FLEX=`cygpath -m $FLEX`
9954 if test -z "$FLEX"; then
9955     AC_MSG_ERROR([no flex found in \$PATH, install it])
9956 else
9957     AC_MSG_CHECKING([the flex version])
9958     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9959     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9960         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9961     fi
9963 AC_SUBST([FLEX])
9964 dnl ***************************************
9965 dnl Checking for patch
9966 dnl ***************************************
9967 AC_PATH_PROG(PATCH, patch)
9968 if test -z "$PATCH"; then
9969     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9972 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9973 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9974     if test -z "$with_gnu_patch"; then
9975         GNUPATCH=$PATCH
9976     else
9977         if test -x "$with_gnu_patch"; then
9978             GNUPATCH=$with_gnu_patch
9979         else
9980             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9981         fi
9982     fi
9984     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9985     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9986         AC_MSG_RESULT([yes])
9987     else
9988         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9989     fi
9990 else
9991     GNUPATCH=$PATCH
9994 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9995     GNUPATCH=`cygpath -m $GNUPATCH`
9998 dnl We also need to check for --with-gnu-cp
10000 if test -z "$with_gnu_cp"; then
10001     # check the place where the good stuff is hidden on Solaris...
10002     if test -x /usr/gnu/bin/cp; then
10003         GNUCP=/usr/gnu/bin/cp
10004     else
10005         AC_PATH_PROGS(GNUCP, gnucp cp)
10006     fi
10007     if test -z $GNUCP; then
10008         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10009     fi
10010 else
10011     if test -x "$with_gnu_cp"; then
10012         GNUCP=$with_gnu_cp
10013     else
10014         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10015     fi
10018 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10019     GNUCP=`cygpath -m $GNUCP`
10022 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10023 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10024     AC_MSG_RESULT([yes])
10025 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10026     AC_MSG_RESULT([yes])
10027 else
10028     case "$build_os" in
10029     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10030         x_GNUCP=[\#]
10031         GNUCP=''
10032         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10033         ;;
10034     *)
10035         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10036         ;;
10037     esac
10040 AC_SUBST(GNUPATCH)
10041 AC_SUBST(GNUCP)
10042 AC_SUBST(x_GNUCP)
10044 dnl ***************************************
10045 dnl testing assembler path
10046 dnl ***************************************
10047 ML_EXE=""
10048 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
10049     if test "$BITNESS_OVERRIDE" = ""; then
10050         assembler=ml.exe
10051         assembler_bin=bin
10052     else
10053         if test "$vcexpress" = "Express"; then
10054             assembler=ml64.exe
10055             assembler_bin=bin/x86_amd64
10056         else
10057             assembler=ml64.exe
10058             assembler_bin=bin/amd64
10059         fi
10060     fi
10062     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
10063     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
10064         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
10065         AC_MSG_RESULT([found])
10066         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
10067     else
10068         AC_MSG_ERROR([Configure did not find $assembler assembler.])
10069     fi
10071     PathFormat "$ASM_HOME"
10072     ASM_HOME="$formatted_path"
10073 else
10074     ASM_HOME=""
10077 AC_SUBST(ML_EXE)
10079 dnl ===================================================================
10080 dnl We need zip and unzip
10081 dnl ===================================================================
10082 AC_PATH_PROG(ZIP, zip)
10083 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10084 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10085     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],,)
10088 AC_PATH_PROG(UNZIP, unzip)
10089 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10091 dnl ===================================================================
10092 dnl Zip must be a specific type for different build types.
10093 dnl ===================================================================
10094 if test $build_os = cygwin; then
10095     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10096         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10097     fi
10100 dnl ===================================================================
10101 dnl We need touch with -h option support.
10102 dnl ===================================================================
10103 AC_PATH_PROG(TOUCH, touch)
10104 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10105 touch warn
10106 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10107     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],,)
10110 dnl ===================================================================
10111 dnl Set vcl option: coordinate device in double or sal_Int32
10112 dnl ===================================================================
10114 dnl disabled for now, we don't want subtle differences between OSs
10115 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10116 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10117 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10118 dnl     AC_MSG_RESULT([double])
10119 dnl else
10120 dnl     AC_MSG_RESULT([sal_Int32])
10121 dnl fi
10123 dnl ===================================================================
10124 dnl Test which vclplugs have to be built.
10125 dnl ===================================================================
10126 R=""
10127 if test "$USING_X11" != TRUE; then
10128     enable_gtk=no
10129     enable_gtk3=no
10131 GTK3_CFLAGS=""
10132 GTK3_LIBS=""
10133 ENABLE_GTK3=""
10134 if test "x$enable_gtk3" = "xyes"; then
10135     if test "$with_system_cairo" = no; then
10136         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10137     fi
10138     : ${with_system_cairo:=yes}
10139     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="")
10140     if test "x$ENABLE_GTK3" = "xTRUE"; then
10141         R="gtk3"
10142         dnl Avoid installed by unpackaged files for now.
10143         if test -z "$PKGFORMAT"; then
10144             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10145         fi
10146     else
10147         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10148     fi
10149     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10150     FilterLibs "${GTK3_LIBS}"
10151     GTK3_LIBS="${filteredlibs}"
10153 AC_SUBST(GTK3_LIBS)
10154 AC_SUBST(GTK3_CFLAGS)
10155 AC_SUBST(ENABLE_GTK3)
10157 ENABLE_GTK=""
10158 if test "x$enable_gtk" = "xyes"; then
10159     if test "$with_system_cairo" = no; then
10160         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10161     fi
10162     : ${with_system_cairo:=yes}
10163     ENABLE_GTK="TRUE"
10164     AC_DEFINE(ENABLE_GTK)
10165     R="gtk $R"
10167 AC_SUBST(ENABLE_GTK)
10169 ENABLE_TDE=""
10170 if test "x$enable_tde" = "xyes"; then
10171     ENABLE_TDE="TRUE"
10172     AC_DEFINE(ENABLE_TDE)
10173     R="$R tde"
10175 AC_SUBST(ENABLE_TDE)
10177 ENABLE_KDE4=""
10178 if test "x$enable_kde4" = "xyes"; then
10179     ENABLE_KDE4="TRUE"
10180     AC_DEFINE(ENABLE_KDE4)
10181     R="$R kde4"
10183 AC_SUBST(ENABLE_KDE4)
10186 build_vcl_plugins="$R"
10187 if test -z "$build_vcl_plugins"; then
10188     build_vcl_plugins="none"
10190 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10192 dnl ===================================================================
10193 dnl check for dbus support
10194 dnl ===================================================================
10195 ENABLE_DBUS=""
10196 DBUS_CFLAGS=""
10197 DBUS_LIBS=""
10199 if test "$enable_dbus" = "no"; then
10200     test_dbus=no
10203 AC_MSG_CHECKING([whether to enable DBUS support])
10204 if test "$test_dbus" = "yes"; then
10205     ENABLE_DBUS="TRUE"
10206     AC_MSG_RESULT([yes])
10207     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10208     AC_DEFINE(ENABLE_DBUS)
10209     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10210     FilterLibs "${DBUS_LIBS}"
10211     DBUS_LIBS="${filteredlibs}"
10212 else
10213     AC_MSG_RESULT([no])
10216 AC_SUBST(ENABLE_DBUS)
10217 AC_SUBST(DBUS_CFLAGS)
10218 AC_SUBST(DBUS_LIBS)
10220 AC_MSG_CHECKING([whether to enable Impress remote control])
10221 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10222     AC_MSG_RESULT([yes])
10223     ENABLE_SDREMOTE=TRUE
10224     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10226     # If not explicitly enabled or disabled, default
10227     if test -z "$enable_sdremote_bluetooth"; then
10228         case "$OS" in
10229         LINUX|MACOSX|WNT)
10230             # Default to yes for these
10231             enable_sdremote_bluetooth=yes
10232             ;;
10233         *)
10234             # otherwise no
10235             enable_sdremote_bluetooth=no
10236             ;;
10237         esac
10238     fi
10239     # $enable_sdremote_bluetooth is guaranteed non-empty now
10241     if test "$enable_sdremote_bluetooth" != "no"; then
10242         if test "$OS" = "LINUX"; then
10243             if test "$ENABLE_DBUS" = "TRUE"; then
10244                 AC_MSG_RESULT([yes])
10245                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10246                 dnl ===================================================================
10247                 dnl Check for system bluez
10248                 dnl ===================================================================
10249                 AC_MSG_CHECKING([which Bluetooth header to use])
10250                 if test "$with_system_bluez" = "yes"; then
10251                     AC_MSG_RESULT([external])
10252                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10253                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10254                     SYSTEM_BLUEZ=TRUE
10255                 else
10256                     AC_MSG_RESULT([internal])
10257                     SYSTEM_BLUEZ=
10258                 fi
10259             else
10260                 AC_MSG_RESULT([no, dbus disabled])
10261                 ENABLE_SDREMOTE_BLUETOOTH=
10262                 SYSTEM_BLUEZ=
10263             fi
10264         else
10265             AC_MSG_RESULT([yes])
10266             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10267             SYSTEM_BLUEZ=
10268         fi
10269     else
10270         AC_MSG_RESULT([no])
10271         ENABLE_SDREMOTE_BLUETOOTH=
10272         SYSTEM_BLUEZ=
10273     fi
10274 else
10275     ENABLE_SDREMOTE=
10276     SYSTEM_BLUEZ=
10277     AC_MSG_RESULT([no])
10279 AC_SUBST(ENABLE_SDREMOTE)
10280 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10281 AC_SUBST(SYSTEM_BLUEZ)
10283 dnl ===================================================================
10284 dnl Check whether the gtk 2.0 libraries are available.
10285 dnl ===================================================================
10287 GTK_CFLAGS=""
10288 GTK_LIBS=""
10289 ENABLE_SYSTRAY_GTK=""
10290 if test  "$test_gtk" = "yes"; then
10292     if test "$ENABLE_GTK" = "TRUE"; then
10293         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]))
10294         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10295         FilterLibs "${GTK_LIBS}"
10296         GTK_LIBS="${filteredlibs}"
10297         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]))
10298         BUILD_TYPE="$BUILD_TYPE GTK"
10299         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10300         FilterLibs "${GTHREAD_LIBS}"
10301         GTHREAD_LIBS="${filteredlibs}"
10303         if test "x$enable_systray" = "xyes"; then
10304             ENABLE_SYSTRAY_GTK="TRUE"
10305         fi
10307         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10308         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10309                           [ENABLE_GTK_PRINT="TRUE"],
10310                           [ENABLE_GTK_PRINT=""])
10311         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10312         FilterLibs "${GTK_PRINT_LIBS}"
10313         GTK_PRINT_LIBS="${filteredlibs}"
10315         AC_MSG_CHECKING([whether to enable GIO support])
10316         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10317             dnl Need at least 2.26 for the dbus support.
10318             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10319                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10320             if test "$ENABLE_GIO" = "TRUE"; then
10321                 AC_DEFINE(ENABLE_GIO)
10322                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10323                 FilterLibs "${GIO_LIBS}"
10324                 GIO_LIBS="${filteredlibs}"
10325             fi
10326         else
10327             AC_MSG_RESULT([no])
10328         fi
10329     fi
10331 AC_SUBST(ENABLE_GIO)
10332 AC_SUBST(GIO_CFLAGS)
10333 AC_SUBST(GIO_LIBS)
10334 AC_SUBST(ENABLE_SYSTRAY_GTK)
10335 AC_SUBST(GTK_CFLAGS)
10336 AC_SUBST(GTK_LIBS)
10337 AC_SUBST(GTHREAD_CFLAGS)
10338 AC_SUBST(GTHREAD_LIBS)
10339 AC_SUBST([ENABLE_GTK_PRINT])
10340 AC_SUBST([GTK_PRINT_CFLAGS])
10341 AC_SUBST([GTK_PRINT_LIBS])
10344 dnl ===================================================================
10345 dnl Check whether the Telepathy libraries are available.
10346 dnl ===================================================================
10348 ENABLE_TELEPATHY=""
10349 TELEPATHY_CFLAGS=""
10350 TELEPATHY_LIBS=""
10352 AC_MSG_CHECKING([whether to enable Telepathy support])
10353 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10354     ENABLE_TELEPATHY="TRUE"
10355     AC_DEFINE(ENABLE_TELEPATHY)
10356     AC_MSG_RESULT([yes])
10357     PKG_CHECK_MODULES( TELEPATHY, telepathy-glib >= 0.18.0 glib-2.0 gobject-2.0 gthread-2.0 gio-2.0 gtk+-2.0 >= 2.18.0 )
10358     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10359     FilterLibs "${TELEPATHY_LIBS}"
10360     TELEPATHY_LIBS="${filteredlibs}"
10361 else
10362     AC_MSG_RESULT([no])
10365 AC_SUBST(ENABLE_TELEPATHY)
10366 AC_SUBST(TELEPATHY_CFLAGS)
10367 AC_SUBST(TELEPATHY_LIBS)
10370 dnl ===================================================================
10372 SPLIT_APP_MODULES=""
10373 if test "$enable_split_app_modules" = "yes"; then
10374     SPLIT_APP_MODULES="TRUE"
10376 AC_SUBST(SPLIT_APP_MODULES)
10378 SPLIT_OPT_FEATURES=""
10379 if test "$enable_split_opt_features" = "yes"; then
10380     SPLIT_OPT_FEATURES="TRUE"
10382 AC_SUBST(SPLIT_OPT_FEATURES)
10384 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10385     if test "$enable_cairo_canvas" = yes; then
10386         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10387     fi
10388     enable_cairo_canvas=no
10389 elif test -z "$enable_cairo_canvas"; then
10390     enable_cairo_canvas=yes
10393 ENABLE_CAIRO_CANVAS=""
10394 if test "$enable_cairo_canvas" = "yes"; then
10395     test_cairo=yes
10396     ENABLE_CAIRO_CANVAS="TRUE"
10397     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10399 AC_SUBST(ENABLE_CAIRO_CANVAS)
10401 dnl ===================================================================
10402 dnl Check whether the GStreamer libraries are available.
10403 dnl It's possible to build avmedia with both GStreamer backends!
10404 dnl ===================================================================
10406 ENABLE_GSTREAMER_1_0=""
10408 if test "$build_gstreamer_1_0" = "yes"; then
10410     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10411     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10412         ENABLE_GSTREAMER_1_0="TRUE"
10413         AC_MSG_RESULT([yes])
10414         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10415         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10416         FilterLibs "${GSTREAMER_1_0_LIBS}"
10417         GSTREAMER_1_0_LIBS="${filteredlibs}"
10418     else
10419         AC_MSG_RESULT([no])
10420     fi
10422 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10423 AC_SUBST(GSTREAMER_1_0_LIBS)
10424 AC_SUBST(ENABLE_GSTREAMER_1_0)
10427 ENABLE_GSTREAMER_0_10=""
10428 if test "$build_gstreamer_0_10" = "yes"; then
10430     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10431     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10432         ENABLE_GSTREAMER_0_10="TRUE"
10433         AC_MSG_RESULT([yes])
10434         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10435             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10436         ])
10437         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10438         FilterLibs "${GSTREAMER_0_10_LIBS}"
10439         GSTREAMER_0_10_LIBS="${filteredlibs}"
10440     else
10441         AC_MSG_RESULT([no])
10442     fi
10445 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10446 AC_SUBST(GSTREAMER_0_10_LIBS)
10447 AC_SUBST(ENABLE_GSTREAMER_0_10)
10449 dnl ===================================================================
10450 dnl Check whether to build the VLC avmedia backend
10451 dnl ===================================================================
10453 ENABLE_VLC=""
10455 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10456 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10457     ENABLE_VLC="TRUE"
10458     AC_MSG_RESULT([yes])
10459 else
10460     AC_MSG_RESULT([no])
10462 AC_SUBST(ENABLE_VLC)
10464 ENABLE_OPENGL_TRANSITIONS=
10465 ENABLE_OPENGL_CANVAS=
10466 if test $_os = iOS -o $_os = Android; then
10467    : # disable
10468 elif test "$_os" = "Darwin"; then
10469     # We use frameworks on Mac OS X, no need for detail checks
10470     ENABLE_OPENGL_TRANSITIONS=TRUE
10471     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10472     ENABLE_OPENGL_CANVAS=TRUE
10473 elif test $_os = WINNT; then
10474     ENABLE_OPENGL_TRANSITIONS=TRUE
10475     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10476     ENABLE_OPENGL_CANVAS=TRUE
10477 else
10478     if test "$USING_X11" = TRUE; then
10479         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10480         ENABLE_OPENGL_TRANSITIONS=TRUE
10481         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10482         ENABLE_OPENGL_CANVAS=TRUE
10483     fi
10486 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10487 AC_SUBST(ENABLE_OPENGL_CANVAS)
10489 dnl =================================================
10490 dnl Check whether to build with OpenCL support.
10491 dnl =================================================
10493 if test $_os != iOS -a $_os != Android; then
10494     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10495     # platform (optional at run-time, used through clew).
10496     BUILD_TYPE="$BUILD_TYPE OPENCL"
10497     AC_DEFINE(HAVE_FEATURE_OPENCL)
10500 dnl ===================================================================
10501 dnl Check whether to enable glTF support
10502 dnl ===================================================================
10503 AC_MSG_CHECKING([whether to enable glTF support])
10504 ENABLE_GLTF=
10505 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android -a "$ENABLE_HEADLESS" = ""; then
10506     ENABLE_GLTF=TRUE
10507     AC_MSG_RESULT([yes])
10508     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10509     if test "$with_system_libgltf" = "yes"; then
10510         SYSTEM_LIBGLTF=TRUE
10511         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10512         FilterLibs "${LIBGLTF_LIBS}"
10513         LIBGLTF_LIBS="${filteredlibs}"
10514     else
10515         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10516     fi
10517 else
10518     AC_MSG_RESULT([no])
10520 AC_SUBST(ENABLE_GLTF)
10521 AC_SUBST(SYSTEM_LIBGLTF)
10522 AC_SUBST(LIBGLTF_CFLAGS)
10523 AC_SUBST(LIBGLTF_LIBS)
10525 dnl ===================================================================
10526 dnl Check whether to enable COLLADA support
10527 dnl ===================================================================
10528 AC_MSG_CHECKING([whether to enable COLLADA support])
10529 ENABLE_COLLADA=
10530 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10531     AC_MSG_RESULT([yes])
10532     ENABLE_COLLADA=TRUE
10533     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10535     AC_MSG_CHECKING([which OPENCOLLADA to use])
10536     if test "$with_system_opencollada" = "yes"; then
10537         AC_MSG_RESULT([external])
10538         SYSTEM_OPENCOLLADA=TRUE
10539         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10540         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10541         AC_LANG_PUSH([C++])
10542         save_CXXFLAGS=$CXXFLAGS
10543         save_CPPFLAGS=$CPPFLAGS
10544         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10545         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10546         AC_CHECK_HEADERS(
10547                 COLLADABU.h \
10548                 COLLADAFW.h \
10549                 COLLADASaxFWLLoader.h \
10550                 GeneratedSaxParser.h,
10551             [],
10552             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10553             [])
10554         CXXFLAGS=$save_CXXFLAGS
10555         CPPFLAGS=$save_CPPFLAGS
10556         AC_LANG_POP([C++])
10557         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10558         FilterLibs "${OPENCOLLADA_LIBS}"
10559         OPENCOLLADA_LIBS="${filteredlibs}"
10560     else
10561         AC_MSG_RESULT([internal])
10562         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10563     fi
10565     AC_MSG_CHECKING([which collada2gltf to use])
10566     if test "$with_system_collada2gltf" = "yes"; then
10567         if test "$with_system_opencollada" = "no"; then
10568             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10569         fi
10570         AC_MSG_RESULT([external])
10571         SYSTEM_COLLADA2GLTF=TRUE
10572         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10573         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10574         AC_LANG_PUSH([C++])
10575         save_CXXFLAGS=$CXXFLAGS
10576         save_CPPFLAGS=$CPPFLAGS
10577         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10578         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10579         AC_CHECK_HEADERS(
10580                 GLTF.h \
10581                 encodingHelpers.h,
10582             [],
10583             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10584             [])
10585         CXXFLAGS=$save_CXXFLAGS
10586         CPPFLAGS=$save_CPPFLAGS
10587         AC_LANG_POP([C++])
10588         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10589         FilterLibs "${COLLADA2GLTF_LIBS}"
10590         COLLADA2GLTF_LIBS="${filteredlibs}"
10591     else
10592         AC_MSG_RESULT([internal])
10593         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10594     fi
10595 else
10596     AC_MSG_RESULT([no])
10598 AC_SUBST(ENABLE_COLLADA)
10599 AC_SUBST([OPENCOLLADA_CFLAGS])
10600 AC_SUBST([OPENCOLLADA_LIBS])
10601 AC_SUBST([SYSTEM_OPENCOLLADA])
10603 AC_SUBST([COLLADA2GLTF_CFLAGS])
10604 AC_SUBST([COLLADA2GLTF_LIBS])
10605 AC_SUBST([SYSTEM_COLLADA2GLTF])
10607 if test "$enable_dconf" != no; then
10608     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10609         if test "$enable_dconf" = yes; then
10610             AC_MSG_ERROR([dconf not found])
10611         else
10612             enable_dconf=no
10613         fi])
10615 AC_MSG_CHECKING([whether to enable dconf])
10616 if test "$enable_dconf" = no; then
10617     DCONF_CFLAGS=
10618     DCONF_LIBS=
10619     ENABLE_DCONF=
10620     AC_MSG_RESULT([no])
10621 else
10622     ENABLE_DCONF=TRUE
10623     AC_DEFINE(ENABLE_DCONF)
10624     AC_MSG_RESULT([yes])
10626 AC_SUBST([DCONF_CFLAGS])
10627 AC_SUBST([DCONF_LIBS])
10628 AC_SUBST([ENABLE_DCONF])
10630 # pdf import?
10631 AC_MSG_CHECKING([whether to build the PDF import feature])
10632 ENABLE_PDFIMPORT=
10633 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10634     AC_MSG_RESULT([yes])
10635     ENABLE_PDFIMPORT=TRUE
10636     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10638     dnl ===================================================================
10639     dnl Check for system poppler
10640     dnl ===================================================================
10641     AC_MSG_CHECKING([which PDF import backend to use])
10642     if test "$with_system_poppler" = "yes"; then
10643         AC_MSG_RESULT([external])
10644         SYSTEM_POPPLER=TRUE
10645         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10646         AC_LANG_PUSH([C++])
10647         save_CXXFLAGS=$CXXFLAGS
10648         save_CPPFLAGS=$CPPFLAGS
10649         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10650         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10651         AC_CHECK_HEADER([cpp/poppler-version.h],
10652             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10653             [])
10654         CXXFLAGS=$save_CXXFLAGS
10655         CPPFLAGS=$save_CPPFLAGS
10656         AC_LANG_POP([C++])
10657         libo_MINGW_CHECK_DLL([libpoppler])
10658         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10660         FilterLibs "${POPPLER_LIBS}"
10661         POPPLER_LIBS="${filteredlibs}"
10662     else
10663         AC_MSG_RESULT([internal])
10664         SYSTEM_POPPLER=
10665         BUILD_TYPE="$BUILD_TYPE POPPLER"
10666         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10667     fi
10668     AC_DEFINE([ENABLE_PDFIMPORT],1)
10669 else
10670     AC_MSG_RESULT([no])
10672 AC_SUBST(ENABLE_PDFIMPORT)
10673 AC_SUBST(SYSTEM_POPPLER)
10674 AC_SUBST(POPPLER_CFLAGS)
10675 AC_SUBST(POPPLER_LIBS)
10677 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10678 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10679     AC_MSG_RESULT([yes])
10680     ENABLE_MEDIAWIKI=TRUE
10681     BUILD_TYPE="$BUILD_TYPE XSLTML"
10682     if test  "x$with_java" = "xno"; then
10683         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10684     fi
10685 else
10686     AC_MSG_RESULT([no])
10687     ENABLE_MEDIAWIKI=
10688     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10690 AC_SUBST(ENABLE_MEDIAWIKI)
10692 AC_MSG_CHECKING([whether to build the Report Builder])
10693 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10694     AC_MSG_RESULT([yes])
10695     ENABLE_REPORTBUILDER=TRUE
10696     AC_MSG_CHECKING([which jfreereport libs to use])
10697     if test "$with_system_jfreereport" = "yes"; then
10698         SYSTEM_JFREEREPORT=TRUE
10699         AC_MSG_RESULT([external])
10700         if test -z $SAC_JAR; then
10701             SAC_JAR=/usr/share/java/sac.jar
10702         fi
10703         if ! test -f $SAC_JAR; then
10704              AC_MSG_ERROR(sac.jar not found.)
10705         fi
10707         if test -z $LIBXML_JAR; then
10708             if test -f /usr/share/java/libxml-1.0.0.jar; then
10709                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10710             elif test -f /usr/share/java/libxml.jar; then
10711                 LIBXML_JAR=/usr/share/java/libxml.jar
10712             else
10713                 AC_MSG_ERROR(libxml.jar replacement not found.)
10714             fi
10715         elif ! test -f $LIBXML_JAR; then
10716             AC_MSG_ERROR(libxml.jar not found.)
10717         fi
10719         if test -z $FLUTE_JAR; then
10720             if test -f/usr/share/java/flute-1.3.0.jar; then
10721                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10722             elif test -f /usr/share/java/flute.jar; then
10723                 FLUTE_JAR=/usr/share/java/flute.jar
10724             else
10725                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10726             fi
10727         elif ! test -f $FLUTE_JAR; then
10728             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10729         fi
10731         if test -z $JFREEREPORT_JAR; then
10732             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10733                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10734             elif test -f /usr/share/java/flow-engine.jar; then
10735                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10736             else
10737                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10738             fi
10739         elif ! test -f  $JFREEREPORT_JAR; then
10740                 AC_MSG_ERROR(jfreereport.jar not found.)
10741         fi
10743         if test -z $LIBLAYOUT_JAR; then
10744             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10745                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10746             elif test -f /usr/share/java/liblayout.jar; then
10747                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10748             else
10749                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10750             fi
10751         elif ! test -f $LIBLAYOUT_JAR; then
10752                 AC_MSG_ERROR(liblayout.jar not found.)
10753         fi
10755         if test -z $LIBLOADER_JAR; then
10756             if test -f /usr/share/java/libloader-1.0.0.jar; then
10757                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10758             elif test -f /usr/share/java/libloader.jar; then
10759                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10760             else
10761                 AC_MSG_ERROR(libloader.jar replacement not found.)
10762             fi
10763         elif ! test -f  $LIBLOADER_JAR; then
10764             AC_MSG_ERROR(libloader.jar not found.)
10765         fi
10767         if test -z $LIBFORMULA_JAR; then
10768             if test -f /usr/share/java/libformula-0.2.0.jar; then
10769                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10770             elif test -f /usr/share/java/libformula.jar; then
10771                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10772             else
10773                 AC_MSG_ERROR(libformula.jar replacement not found.)
10774             fi
10775         elif ! test -f $LIBFORMULA_JAR; then
10776                 AC_MSG_ERROR(libformula.jar not found.)
10777         fi
10779         if test -z $LIBREPOSITORY_JAR; then
10780             if test -f /usr/share/java/librepository-1.0.0.jar; then
10781                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10782             elif test -f /usr/share/java/librepository.jar; then
10783                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10784             else
10785                 AC_MSG_ERROR(librepository.jar replacement not found.)
10786             fi
10787         elif ! test -f $LIBREPOSITORY_JAR; then
10788             AC_MSG_ERROR(librepository.jar not found.)
10789         fi
10791         if test -z $LIBFONTS_JAR; then
10792             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10793                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10794             elif test -f /usr/share/java/libfonts.jar; then
10795                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10796             else
10797                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10798             fi
10799         elif ! test -f $LIBFONTS_JAR; then
10800                 AC_MSG_ERROR(libfonts.jar not found.)
10801         fi
10803         if test -z $LIBSERIALIZER_JAR; then
10804             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10805                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10806             elif test -f /usr/share/java/libserializer.jar; then
10807                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10808             else
10809                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10810             fi
10811         elif ! test -f $LIBSERIALIZER_JAR; then
10812                 AC_MSG_ERROR(libserializer.jar not found.)
10813         fi
10815         if test -z $LIBBASE_JAR; then
10816             if test -f /usr/share/java/libbase-1.0.0.jar; then
10817                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10818             elif test -f /usr/share/java/libbase.jar; then
10819                 LIBBASE_JAR=/usr/share/java/libbase.jar
10820             else
10821                 AC_MSG_ERROR(libbase.jar replacement not found.)
10822             fi
10823         elif ! test -f $LIBBASE_JAR; then
10824             AC_MSG_ERROR(libbase.jar not found.)
10825         fi
10827     else
10828         AC_MSG_RESULT([internal])
10829         SYSTEM_JFREEREPORT=
10830         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10831     fi
10832 else
10833     AC_MSG_RESULT([no])
10834     ENABLE_REPORTBUILDER=
10835     SYSTEM_JFREEREPORT=
10837 AC_SUBST(ENABLE_REPORTBUILDER)
10838 AC_SUBST(SYSTEM_JFREEREPORT)
10839 AC_SUBST(SAC_JAR)
10840 AC_SUBST(LIBXML_JAR)
10841 AC_SUBST(FLUTE_JAR)
10842 AC_SUBST(JFREEREPORT_JAR)
10843 AC_SUBST(LIBBASE_JAR)
10844 AC_SUBST(LIBLAYOUT_JAR)
10845 AC_SUBST(LIBLOADER_JAR)
10846 AC_SUBST(LIBFORMULA_JAR)
10847 AC_SUBST(LIBREPOSITORY_JAR)
10848 AC_SUBST(LIBFONTS_JAR)
10849 AC_SUBST(LIBSERIALIZER_JAR)
10851 # this has to be here because both the Wiki Publisher and the SRB use
10852 # commons-logging
10853 COMMONS_LOGGING_VERSION=1.2
10854 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10855     AC_MSG_CHECKING([which Apache commons-* libs to use])
10856     if test "$with_system_apache_commons" = "yes"; then
10857         SYSTEM_APACHE_COMMONS=TRUE
10858         AC_MSG_RESULT([external])
10859         if test -z $COMMONS_LOGGING_JAR; then
10860             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10861                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10862            elif test -f /usr/share/java/commons-logging.jar; then
10863                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10864             else
10865                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10866             fi
10867         elif ! test -f $COMMONS_LOGGING_JAR; then
10868             AC_MSG_ERROR(commons-logging.jar not found.)
10869         fi
10870     else
10871         AC_MSG_RESULT([internal])
10872         SYSTEM_APACHE_COMMONS=
10873         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10874     fi
10876 AC_SUBST(SYSTEM_APACHE_COMMONS)
10877 AC_SUBST(COMMONS_LOGGING_JAR)
10878 AC_SUBST(COMMONS_LOGGING_VERSION)
10880 # scripting provider for BeanShell?
10881 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10882 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10883     AC_MSG_RESULT([yes])
10884     ENABLE_SCRIPTING_BEANSHELL=TRUE
10886     dnl ===================================================================
10887     dnl Check for system beanshell
10888     dnl ===================================================================
10889     AC_MSG_CHECKING([which beanshell to use])
10890     if test "$with_system_beanshell" = "yes"; then
10891         AC_MSG_RESULT([external])
10892         SYSTEM_BSH=TRUE
10893         if test -z $BSH_JAR; then
10894             BSH_JAR=/usr/share/java/bsh.jar
10895         fi
10896         if ! test -f $BSH_JAR; then
10897             AC_MSG_ERROR(bsh.jar not found.)
10898         fi
10899     else
10900         AC_MSG_RESULT([internal])
10901         SYSTEM_BSH=
10902         BUILD_TYPE="$BUILD_TYPE BSH"
10903     fi
10904 else
10905     AC_MSG_RESULT([no])
10906     ENABLE_SCRIPTING_BEANSHELL=
10907     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10909 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10910 AC_SUBST(SYSTEM_BSH)
10911 AC_SUBST(BSH_JAR)
10913 # scripting provider for JavaScript?
10914 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10915 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10916     AC_MSG_RESULT([yes])
10917     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10919     dnl ===================================================================
10920     dnl Check for system rhino
10921     dnl ===================================================================
10922     AC_MSG_CHECKING([which rhino to use])
10923     if test "$with_system_rhino" = "yes"; then
10924         AC_MSG_RESULT([external])
10925         SYSTEM_RHINO=TRUE
10926         if test -z $RHINO_JAR; then
10927             RHINO_JAR=/usr/share/java/js.jar
10928         fi
10929         if ! test -f $RHINO_JAR; then
10930             AC_MSG_ERROR(js.jar not found.)
10931         fi
10932     else
10933         AC_MSG_RESULT([internal])
10934         SYSTEM_RHINO=
10935         BUILD_TYPE="$BUILD_TYPE RHINO"
10936     fi
10937 else
10938     AC_MSG_RESULT([no])
10939     ENABLE_SCRIPTING_JAVASCRIPT=
10940     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10942 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10943 AC_SUBST(SYSTEM_RHINO)
10944 AC_SUBST(RHINO_JAR)
10946 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10947 # paths should be added to library search path. So lets put all 64-bit
10948 # platforms there.
10949 supports_multilib=
10950 case "$host_cpu" in
10951 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10952     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10953         supports_multilib="yes"
10954     fi
10955     ;;
10957     ;;
10958 esac
10960 dnl ===================================================================
10961 dnl Check whether the TQt and TDE libraries are available.
10962 dnl ===================================================================
10964 TDE_CFLAGS=""
10965 TDE_LIBS=""
10966 if test "$_os" != "OpenBSD"; then
10967     TDE_MOC="moc"
10969 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10970     dnl Search paths for TQt and TDE
10971     if test -z "$supports_multilib"; then
10972         tqt_incdirs="$QTINC /usr/local/tqt3/include /usr/include/tqt3 /usr/include /usr/X11R6/include/X11/tqt3 /usr/X11R6/include/tqt3 /usr/lib/tqt3/include /usr/lib/tqt3/include /usr/share/tqt3/include /usr/local/include/X11/tqt3 $x_includes"
10973         tqt_libdirs="$QTLIB /usr/local/tqt3/lib /usr/lib/tqt3 /usr/lib /usr/X11R6/lib/X11/tqt3 /usr/X11R6/lib/tqt3 /usr/lib/tqt3/lib /usr/lib/tqt3/lib /usr/share/tqt3/lib /usr/local/lib/tqt3 $x_libraries"
10974     else
10975         tqt_incdirs="$QTINC /usr/local/tqt3/include /usr/include/tqt3 /usr/include /usr/X11R6/include/X11/tqt3 /usr/X11R6/include/tqt3 /usr/lib64/tqt3/include /usr/lib64/tqt3/include /usr/share/tqt3/include /usr/lib/tqt3/include /usr/lib/tqt3/include /usr/local/include/X11/tqt3 $x_includes"
10976         tqt_libdirs="$QTLIB /usr/local/tqt3/lib64 /usr/lib64/tqt3 /usr/lib64 /usr/X11R6/lib64/X11/tqt3 /usr/X11R6/lib64/tqt3 /usr/lib64/tqt3/lib64 /usr/lib64/tqt3/lib64 /usr/share/tqt3/lib64 /usr/local/tqt3/lib /usr/lib/tqt3 /usr/lib /usr/X11R6/lib/X11/tqt3 /usr/X11R6/lib/tqt3 /usr/lib/tqt3/lib /usr/lib/tqt3/lib /usr/share/tqt3/lib /usr/local/lib/tqt3 $x_libraries"
10977     fi
10978     if test -n "$TQTDIR"; then
10979         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10980         if test -z "$supports_multilib"; then
10981             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10982         else
10983             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10984         fi
10985     fi
10986     if test -z "$supports_multilib"; then
10987         tde_incdirs="/usr/lib/trinity/include /usr/local/trinity/include /usr/local/include /usr/trinity/include /usr/include/trinity /opt/trinity/include /opt/trinity/include $x_includes"
10988         tde_libdirs="/usr/lib/trinity/lib /usr/local/trinity/lib /usr/trinity/lib /usr/lib/trinity /usr/lib/trinity /usr/X11R6/lib /usr/local/lib /opt/trinity/lib /opt/trinity/lib /usr/X11R6/trinity/lib /usr/lib $x_libraries"
10989     else
10990         tde_incdirs="/usr/lib64/trinity/include /usr/lib/trinity/include /usr/local/trinity/include /usr/local/include /usr/trinity/include /usr/include/trinity /opt/trinity/include /opt/trinity/include $x_includes"
10991         tde_libdirs="/usr/lib64/trinity/lib64 /usr/local/trinity/lib64 /usr/trinity/lib64 /usr/lib64/trinity /usr/lib64/trinity /usr/X11R6/lib64 /usr/local/lib64 /opt/trinity/lib64 /opt/trinity/lib64 /usr/X11R6/trinity/lib64 /usr/lib/trinity/lib /usr/local/trinity/lib /usr/trinity/lib /usr/lib/trinity /usr/lib/trinity /usr/lib /usr/X11R6/lib /usr/local/lib /opt/trinity/lib /opt/trinity/lib /usr/X11R6/trinity/lib /usr/lib64 $x_libraries"
10992     fi
10993     if test -n "$TDEDIR"; then
10994         tde_incdirs="$TDEDIR/include $tde_incdirs"
10995         if test -z "$supports_multilib"; then
10996             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10997         else
10998             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10999         fi
11000     fi
11002     dnl What to test
11003     tqt_test_include="ntqstyle.h"
11004     tde_test_include="kapp.h"
11006     if test "$_os" != "OpenBSD"; then
11007         tqt_test_library="libtqt-mt.so"
11008         tde_test_library="libDCOP.so"
11009     else
11010         tqt_test_library="libtqt-mt.so*"
11011         tde_test_library="libDCOP.so*"
11012     fi
11014     dnl Check for TQt headers
11015     AC_MSG_CHECKING([for TQt headers])
11016     tqt_incdir="no"
11017     for tde_check in $tqt_incdirs; do
11018         if test -r "$tde_check/$tqt_test_include"; then
11019             tqt_incdir="$tde_check"
11020             break
11021         fi
11022     done
11023     AC_MSG_RESULT([$tqt_incdir])
11024     if test "x$tqt_incdir" = "xno"; then
11025         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
11026 your TQt installation by exporting TQTDIR before running "configure".])
11027     fi
11029     dnl Check for TQt libraries
11030     AC_MSG_CHECKING([for TQt libraries])
11031     tqt_libdir="no"
11032     for tqt_check in $tqt_libdirs; do
11033         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
11034             tqt_libdir="$tqt_check"
11035             break
11036         fi
11037     done
11038     AC_MSG_RESULT([$tqt_libdir])
11039     if test "x$tqt_libdir" = "xno"; then
11040         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
11041 your TQt installation by exporting TQTDIR before running "configure".])
11042     fi
11044     dnl Check for Meta Object Compiler
11045     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
11046     if test "$MOC" = "no"; then
11047         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
11048 the root of your TQt installation by exporting TQTDIR before running "configure".])
11049     fi
11051     dnl Check for TDE headers
11052     AC_MSG_CHECKING([for TDE headers])
11053     tde_incdir="no"
11054     for tde_check in $tde_incdirs; do
11055         if test -r "$tde_check/$tde_test_include"; then
11056             tde_incdir="$tde_check"
11057             break
11058         fi
11059     done
11060     AC_MSG_RESULT([$tde_incdir])
11061     if test "x$tde_incdir" = "xno"; then
11062         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
11063 your TDE installation by exporting TDEDIR before running "configure".])
11064     fi
11066     dnl Check for TDE libraries
11067     AC_MSG_CHECKING([for TDE libraries])
11068     tde_libdir="no"
11069     for tde_check in $tde_libdirs; do
11070         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
11071             tde_libdir="$tde_check"
11072             break
11073         fi
11074     done
11075     AC_MSG_RESULT([$tde_libdir])
11076     if test "x$tde_libdir" = "xno"; then
11077         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
11078 your TDE installation by exporting TDEDIR before running "configure".])
11079     fi
11081     dnl Set the variables
11082     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11083     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
11085 AC_SUBST(TDE_CFLAGS)
11086 AC_SUBST(TDE_LIBS)
11087 AC_SUBST(TDE_MOC)
11089 dnl ===================================================================
11090 dnl KDE4 Integration
11091 dnl ===================================================================
11093 KDE4_CFLAGS=""
11094 KDE4_LIBS=""
11095 QMAKE4="qmake"
11096 MOC4="moc"
11097 KDE4_GLIB_CFLAGS=""
11098 KDE4_GLIB_LIBS=""
11099 KDE4_HAVE_GLIB=""
11100 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11101     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11102     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11104     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
11105     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11107     if test -n "$supports_multilib"; then
11108         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11109         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11110     fi
11112     if test -n "$QTDIR"; then
11113         qt4_incdirs="$QTDIR/include $qt4_incdirs"
11114         if test -z "$supports_multilib"; then
11115             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
11116         else
11117             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
11118         fi
11119     fi
11120     if test -n "$QT4DIR"; then
11121         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
11122         if test -z "$supports_multilib"; then
11123             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
11124         else
11125             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
11126         fi
11127     fi
11129     if test -n "$KDEDIR"; then
11130         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
11131         if test -z "$supports_multilib"; then
11132             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
11133         else
11134             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
11135         fi
11136     fi
11137     if test -n "$KDE4DIR"; then
11138         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
11139         if test -z "$supports_multilib"; then
11140             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
11141         else
11142             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
11143         fi
11144     fi
11146     qt4_test_include="Qt/qobject.h"
11147     qt4_test_library="libQtNetwork.so"
11148     kde4_test_include="kwindowsystem.h"
11149     kde4_test_library="libsolid.so"
11151     AC_MSG_CHECKING([for Qt4 headers])
11152     qt4_header_dir="no"
11153     for inc_dir in $qt4_incdirs; do
11154         if test -r "$inc_dir/$qt4_test_include"; then
11155             qt4_header_dir="$inc_dir"
11156             break
11157         fi
11158     done
11160     AC_MSG_RESULT([$qt4_header_dir])
11161     if test "x$qt4_header_dir" = "xno"; then
11162         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11163     fi
11165     dnl Check for qmake
11166     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
11167     QMAKE4="$QMAKEQT4"
11168     if test "$QMAKE4" = "no"; then
11169         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
11170         if test "$QMAKE4" = "no"; then
11171             AC_MSG_ERROR([Qmake not found.  Please specify
11172 the root of your Qt installation by exporting QT4DIR before running "configure".])
11173         fi
11174     fi
11176     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
11177     AC_MSG_CHECKING([for Qt4 libraries])
11178     qt4_lib_dir="no"
11179     for lib_dir in $qt4_libdirs; do
11180         if test -r "$lib_dir/$qt4_test_library"; then
11181             qt4_lib_dir="$lib_dir"
11182             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11183             break
11184         fi
11185     done
11187     AC_MSG_RESULT([$qt4_lib_dir])
11189     if test "x$qt4_lib_dir" = "xno"; then
11190         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11191     fi
11193     dnl Check for Meta Object Compiler
11195     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11196     MOC4="$MOCQT4"
11197     if test "$MOC4" = "no"; then
11198         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11199         if test "$MOC4" = "no"; then
11200             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11201 the root of your Qt installation by exporting QT4DIR before running "configure".])
11202         fi
11203     fi
11205     dnl Check for KDE4 headers
11206     AC_MSG_CHECKING([for KDE4 headers])
11207     kde4_incdir="no"
11208     for kde4_check in $kde4_incdirs; do
11209         if test -r "$kde4_check/$kde4_test_include"; then
11210             kde4_incdir="$kde4_check"
11211             break
11212         fi
11213     done
11214     AC_MSG_RESULT([$kde4_incdir])
11215     if test "x$kde4_incdir" = "xno"; then
11216         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11217     fi
11218     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
11220     dnl Check for KDE4 libraries
11221     AC_MSG_CHECKING([for KDE4 libraries])
11222     kde4_libdir="no"
11223     for kde4_check in $kde4_libdirs; do
11224         if test -r "$kde4_check/$kde4_test_library"; then
11225             kde4_libdir="$kde4_check"
11226             break
11227         fi
11228     done
11230     AC_MSG_RESULT([$kde4_libdir])
11231     if test "x$kde4_libdir" = "xno"; then
11232         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11233     fi
11235     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11236     if ! test -z "$kde4_incdir"; then
11237         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11238     else
11239         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11240     fi
11242     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11243     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11244     FilterLibs "$KDE4_LIBS"
11245     KDE4_LIBS="$filteredlibs"
11247     AC_LANG_PUSH([C++])
11248     save_CXXFLAGS=$CXXFLAGS
11249     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11250     AC_MSG_CHECKING([whether KDE is >= 4.2])
11251        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11252 #include <kdeversion.h>
11254 int main(int argc, char **argv) {
11255        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11256        else return 1;
11258 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11259     CXXFLAGS=$save_CXXFLAGS
11260     AC_LANG_POP([C++])
11262     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11263     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11264     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11265         [
11266             KDE4_HAVE_GLIB=1
11267             AC_DEFINE(KDE4_HAVE_GLIB,1)
11268             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11269             FilterLibs "${KDE4_GLIB_LIBS}"
11270             KDE4_GLIB_LIBS="${filteredlibs}"
11272             qt4_fix_warning=
11274             AC_LANG_PUSH([C++])
11275             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11276             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11277             #  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
11278             #               ^~~~~~~~~~~~~~~~~~~~~~~
11279             #               vptr for 'QObjectPrivate'
11280             save_CXX=$CXX
11281             CXX=$(printf %s "$CXX" \
11282                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11283             save_CXXFLAGS=$CXXFLAGS
11284             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11285             save_LIBS=$LIBS
11286             LIBS="$LIBS $KDE4_LIBS"
11287             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11289             # Prepare meta object data
11290             TSTBASE="tst_exclude_socket_notifiers"
11291             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11292             ln -fs "${TSTMOC}.hxx"
11293             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11295             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11296 #include <cstdlib>
11297 #include "tst_exclude_socket_notifiers.moc"
11299 int main(int argc, char *argv[])
11301     QCoreApplication app(argc, argv);
11302     exit(tst_processEventsExcludeSocket());
11303     return 0;
11305             ]])],[
11306                 AC_MSG_RESULT([yes])
11307             ],[
11308                 AC_MSG_RESULT([no])
11309                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11310                 if test -z "$qt4_fix_warning"; then
11311                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11312                 fi
11313                 qt4_fix_warning=1
11314                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11315                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11317             # Remove meta object data
11318             rm -f "${TSTBASE}."*
11320             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11322             # Prepare meta object data
11323             TSTBASE="tst_exclude_posted_events"
11324             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11325             ln -fs "${TSTMOC}.hxx"
11326             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11328             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11329 #include <cstdlib>
11330 #include "tst_exclude_posted_events.moc"
11332 int main(int argc, char *argv[])
11334     QCoreApplication app(argc, argv);
11335     exit(tst_excludePostedEvents());
11336     return 0;
11338             ]])],[
11339                 AC_MSG_RESULT([yes])
11340             ],[
11341                 AC_MSG_RESULT([no])
11342                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11343                 if test -z "$qt4_fix_warning"; then
11344                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11345                 fi
11346                 qt4_fix_warning=1
11347                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11348             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11350             # Remove meta object data
11351             rm -f "${TSTBASE}."*
11353             if test -n "$qt4_fix_warning"; then
11354                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11355             fi
11357             LIBS=$save_LIBS
11358             CXXFLAGS=$save_CXXFLAGS
11359             CXX=$save_CXX
11360             AC_LANG_POP([C++])
11361         ],
11362         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11364 AC_SUBST(KDE4_CFLAGS)
11365 AC_SUBST(KDE4_LIBS)
11366 AC_SUBST(MOC4)
11367 AC_SUBST(KDE4_GLIB_CFLAGS)
11368 AC_SUBST(KDE4_GLIB_LIBS)
11369 AC_SUBST(KDE4_HAVE_GLIB)
11371 dnl ===================================================================
11372 dnl Test whether to include Evolution 2 support
11373 dnl ===================================================================
11374 AC_MSG_CHECKING([whether to enable evolution 2 support])
11375 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11376     AC_MSG_RESULT([yes])
11377     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11378     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11379     FilterLibs "${GOBJECT_LIBS}"
11380     GOBJECT_LIBS="${filteredlibs}"
11381     ENABLE_EVOAB2="TRUE"
11382 else
11383     ENABLE_EVOAB2=""
11384     AC_MSG_RESULT([no])
11386 AC_SUBST(ENABLE_EVOAB2)
11387 AC_SUBST(GOBJECT_CFLAGS)
11388 AC_SUBST(GOBJECT_LIBS)
11390 dnl ===================================================================
11391 dnl Test whether to include TDE AB support
11392 dnl ===================================================================
11393 AC_MSG_CHECKING([whether to enable TDE address book support])
11394 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11395     AC_MSG_RESULT([yes])
11396     AC_LANG_PUSH([C++])
11397     save_CXXFLAGS=$CXXFLAGS
11398     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11399     AC_MSG_CHECKING([whether TDE is at least R14.0])
11400        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11401 #include <tdeversion.h>
11403 int main(int argc, char **argv) {
11404        if (TDE_VERSION_MAJOR >= 14) return 0;
11405        else return 1;
11407        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([TDE version too old or too recent, please use another version of TDE or disable TDE address book support])],
11408        [AC_MSG_ERROR([TDE support not tested with cross compilation])])
11409     CXXFLAGS=$save_CXXFLAGS
11410     AC_LANG_POP([C++])
11411     ENABLE_TDEAB=TRUE
11412 else
11413     AC_MSG_RESULT([no])
11414     ENABLE_TDEAB=
11416 AC_SUBST(ENABLE_TDEAB)
11418 dnl ===================================================================
11419 dnl Test which themes to include
11420 dnl ===================================================================
11421 AC_MSG_CHECKING([which themes to include])
11422 # if none given use default subset of available themes
11423 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11424     with_theme="breeze breeze_dark galaxy hicontrast oxygen sifr tango"
11425     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11428 WITH_THEMES=""
11429 if test "x$with_theme" != "xno"; then
11430     for theme in $with_theme; do
11431         case $theme in
11432         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|tango|tango_testing) real_theme="$theme" ;;
11433         default) real_theme=galaxy ;;
11434         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11435         esac
11436         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11437     done
11439 AC_MSG_RESULT([$WITH_THEMES])
11440 AC_SUBST([WITH_THEMES])
11441 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11442 for theme in $with_theme; do
11443     case $theme in
11444     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11445     *) ;;
11446     esac
11447 done
11449 dnl ===================================================================
11450 dnl Test whether to integrate helppacks into the product's installer
11451 dnl ===================================================================
11452 AC_MSG_CHECKING([for helppack integration])
11453 if test "$with_helppack_integration" = "no"; then
11454     WITH_HELPPACK_INTEGRATION=
11455     AC_MSG_RESULT([no integration])
11456 else
11457     WITH_HELPPACK_INTEGRATION=TRUE
11458     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11459     AC_MSG_RESULT([integration])
11461 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11463 ###############################################################################
11464 # Extensions checking
11465 ###############################################################################
11466 AC_MSG_CHECKING([for extensions integration])
11467 if test "x$enable_extension_integration" != "xno"; then
11468     WITH_EXTENSION_INTEGRATION=TRUE
11469     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11470     AC_MSG_RESULT([yes, use integration])
11471 else
11472     WITH_EXTENSION_INTEGRATION=
11473     AC_MSG_RESULT([no, do not integrate])
11475 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11477 dnl Should any extra extensions be included?
11478 dnl There are standalone tests for each of these below.
11479 WITH_EXTRA_EXTENSIONS=
11480 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11482 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11483 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11484 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11485 if test "x$with_java" != "xno"; then
11486     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11487     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11490 TEST_FONTS_MISSING=0
11492 # $1  = font family
11493 # $2+ = accepted font mappings
11494 test_font_map()
11496     FONT="$1" ; shift
11497     AC_MSG_CHECKING([font mapping for '$FONT'])
11498     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11499     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11501     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11502     while test "$#" -ge 1 ; do
11503         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11504         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11505     done
11506     if test $TESTEXPR
11507     then
11508         AC_MSG_RESULT([ok])
11509     else
11510         AC_MSG_RESULT([unknown ($FONTFILE)])
11511         TEST_FONTS_MISSING=1
11512     fi
11515 dnl ===================================================================
11516 dnl Test whether to include fonts
11517 dnl ===================================================================
11518 AC_MSG_CHECKING([whether to include third-party fonts])
11519 if test "$with_fonts" != "no"; then
11520     AC_MSG_RESULT([yes])
11521     WITH_FONTS=TRUE
11522     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11523 else
11524     AC_MSG_RESULT([no])
11525     WITH_FONTS=
11526     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11527     if test "$test_fontconfig" = "yes"; then
11528         AC_PATH_PROG([FCMATCH], [fc-match])
11529         if test -z "$FCMATCH"; then
11530             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11531             TEST_FONTS_MISSING=1
11532         else
11533             test_font_map 'Calibri' 'Carlito'
11534             if test ${TEST_FONTS_MISSING} -eq 1
11535             then
11536                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11537             fi
11538         fi
11539     else
11540         TEST_FONTS_MISSING=0
11541     fi
11543 AC_SUBST(WITH_FONTS)
11544 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11547 dnl ===================================================================
11548 dnl Test whether to enable online update service
11549 dnl ===================================================================
11550 AC_MSG_CHECKING([whether to enable online update])
11551 ENABLE_ONLINE_UPDATE=
11552 ENABLE_ONLINE_UPDATE_MAR=
11553 if test "$enable_online_update" = ""; then
11554     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11555         AC_MSG_RESULT([yes])
11556         ENABLE_ONLINE_UPDATE="TRUE"
11557     else
11558         AC_MSG_RESULT([no])
11559     fi
11560 else
11561     if test "$enable_online_update" = "mar"; then
11562         AC_MSG_RESULT([yes - MAR-based online update])
11563         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11564     elif test "$enable_online_update" = "yes"; then
11565         AC_MSG_RESULT([yes])
11566         ENABLE_ONLINE_UPDATE="TRUE"
11567     else
11568         AC_MSG_RESULT([no])
11569     fi
11571 AC_SUBST(ENABLE_ONLINE_UPDATE)
11572 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11574 dnl ===================================================================
11575 dnl Test whether we need bzip2
11576 dnl ===================================================================
11577 SYSTEM_BZIP2=
11578 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11579     AC_MSG_CHECKING([whether to use system bzip2])
11580     if test "$with_system_bzip2" = yes; then
11581         SYSTEM_BZIP2=TRUE
11582         AC_MSG_RESULT([yes])
11583         PKG_CHECK_MODULES(BZIP2, bzip2)
11584         FilterLibs "${BZIP2_LIBS}"
11585         BZIP2_LIBS="${filteredlibs}"
11586     else
11587         AC_MSG_RESULT([no])
11588         BUILD_TYPE="$BUILD_TYPE BZIP2"
11589     fi
11591 AC_SUBST(SYSTEM_BZIP2)
11592 AC_SUBST(BZIP2_CFLAGS)
11593 AC_SUBST(BZIP2_LIBS)
11595 dnl ===================================================================
11596 dnl Test whether to enable extension update
11597 dnl ===================================================================
11598 AC_MSG_CHECKING([whether to enable extension update])
11599 ENABLE_EXTENSION_UPDATE=
11600 if test "x$enable_extension_update" = "xno"; then
11601     AC_MSG_RESULT([no])
11602 else
11603     AC_MSG_RESULT([yes])
11604     ENABLE_EXTENSION_UPDATE="TRUE"
11605     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11606     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11608 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11611 dnl ===================================================================
11612 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11613 dnl ===================================================================
11614 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11615 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11616     AC_MSG_RESULT([no])
11617     ENABLE_SILENT_MSI=
11618 else
11619     AC_MSG_RESULT([yes])
11620     ENABLE_SILENT_MSI=TRUE
11621     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11623 AC_SUBST(ENABLE_SILENT_MSI)
11625 AC_MSG_CHECKING([whether and how to use Xinerama])
11626 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11627     if test "$x_libraries" = "default_x_libraries"; then
11628         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11629         if test "x$XINERAMALIB" = x; then
11630            XINERAMALIB="/usr/lib"
11631         fi
11632     else
11633         XINERAMALIB="$x_libraries"
11634     fi
11635     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11636         # we have both versions, let the user decide but use the dynamic one
11637         # per default
11638         USE_XINERAMA=TRUE
11639         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11640             XINERAMA_LINK=dynamic
11641         else
11642             XINERAMA_LINK=static
11643         fi
11644     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11645         # we have only the dynamic version
11646         USE_XINERAMA=TRUE
11647         XINERAMA_LINK=dynamic
11648     elif test -e "$XINERAMALIB/libXinerama.a"; then
11649         # static version
11650         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11651             USE_XINERAMA=TRUE
11652             XINERAMA_LINK=static
11653         else
11654             USE_XINERAMA=
11655             XINERAMA_LINK=none
11656         fi
11657     else
11658         # no Xinerama
11659         USE_XINERAMA=
11660         XINERAMA_LINK=none
11661     fi
11662     if test "$USE_XINERAMA" = "TRUE"; then
11663         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11664         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11665             [AC_MSG_ERROR(Xinerama header not found.)], [])
11666         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11667         if test "x$XEXTLIB" = x; then
11668            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11669         fi
11670         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11671         if test "$_os" = "FreeBSD"; then
11672             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11673         fi
11674         if test "$_os" = "Linux"; then
11675             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11676         fi
11677         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11678             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11679     else
11680         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11681     fi
11682 else
11683     USE_XINERAMA=
11684     XINERAMA_LINK=none
11685     AC_MSG_RESULT([no])
11687 AC_SUBST(USE_XINERAMA)
11688 AC_SUBST(XINERAMA_LINK)
11690 dnl ===================================================================
11691 dnl Test whether to build cairo or rely on the system version
11692 dnl ===================================================================
11694 if test "$USING_X11" = TRUE; then
11695     # Used in vcl/Library_vclplug_gen.mk
11696     test_cairo=yes
11699 if test "$test_cairo" = "yes"; then
11700     AC_MSG_CHECKING([whether to use the system cairo])
11702     : ${with_system_cairo:=$with_system_libs}
11703     if test "$with_system_cairo" = "yes"; then
11704         SYSTEM_CAIRO=TRUE
11705         AC_MSG_RESULT([yes])
11707         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11708         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11709         FilterLibs "${CAIRO_LIBS}"
11710         CAIRO_LIBS="${filteredlibs}"
11712         if test "$test_xrender" = "yes"; then
11713             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11714             AC_LANG_PUSH([C])
11715             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11716 #ifdef PictStandardA8
11717 #else
11718       return fail;
11719 #endif
11720 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11722             AC_LANG_POP([C])
11723         fi
11724         libo_MINGW_CHECK_DLL([libcairo])
11725         libo_MINGW_TRY_DLL([libfontconfig])
11726         libo_MINGW_TRY_DLL([libfreetype])
11727         libo_MINGW_TRY_DLL([libpixman])
11728         libo_MINGW_TRY_DLL([libpng15])
11729     else
11730         SYSTEM_CAIRO=
11731         AC_MSG_RESULT([no])
11733         BUILD_TYPE="$BUILD_TYPE CAIRO"
11734     fi
11737 AC_SUBST(SYSTEM_CAIRO)
11738 AC_SUBST(CAIRO_CFLAGS)
11739 AC_SUBST(CAIRO_LIBS)
11741 dnl ===================================================================
11742 dnl Test whether to use avahi
11743 dnl ===================================================================
11744 if test "$_os" = "WINNT"; then
11745     # Windows uses bundled mDNSResponder
11746     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11747 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11748     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11749                       [ENABLE_AVAHI="TRUE"])
11750     AC_DEFINE(HAVE_FEATURE_AVAHI)
11751     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11752     FilterLibs "${AVAHI_LIBS}"
11753     AVAHI_LIBS="${filteredlibs}"
11756 AC_SUBST(ENABLE_AVAHI)
11757 AC_SUBST(AVAHI_CFLAGS)
11758 AC_SUBST(AVAHI_LIBS)
11760 dnl ===================================================================
11761 dnl Test whether to use liblangtag
11762 dnl ===================================================================
11763 ENABLE_LIBLANGTAG=
11764 SYSTEM_LIBLANGTAG=
11765 AC_MSG_CHECKING([whether to use liblangtag])
11766 if test "$enable_liblangtag" = "yes" -o \
11767         \( "$enable_liblangtag" = "" -a $_os != Emscripten \); then
11768     ENABLE_LIBLANGTAG=TRUE
11769     AC_MSG_RESULT([yes])
11770     AC_MSG_CHECKING([whether to use system liblangtag])
11771     if test "$with_system_liblangtag" = yes; then
11772         SYSTEM_LIBLANGTAG=TRUE
11773         AC_MSG_RESULT([yes])
11774         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11775         dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11776         PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11777         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11778         FilterLibs "${LIBLANGTAG_LIBS}"
11779         LIBLANGTAG_LIBS="${filteredlibs}"
11780         libo_MINGW_CHECK_DLL([liblangtag])
11781     else
11782         SYSTEM_LIBLANGTAG=
11783         AC_MSG_RESULT([no])
11784         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11785         LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/langtag"
11786         if test "$COM" = "MSC"; then
11787             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11788         else
11789             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11790         fi
11791     fi
11792     AC_DEFINE(ENABLE_LIBLANGTAG)
11793 else
11794     AC_MSG_RESULT([no])
11796 AC_SUBST(ENABLE_LIBLANGTAG)
11797 AC_SUBST(SYSTEM_LIBLANGTAG)
11798 AC_SUBST(LIBLANGTAG_CFLAGS)
11799 AC_SUBST(LIBLANGTAG_LIBS)
11801 dnl ===================================================================
11802 dnl Test whether to build libpng or rely on the system version
11803 dnl ===================================================================
11805 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11807 dnl ===================================================================
11808 dnl Check for runtime JVM search path
11809 dnl ===================================================================
11810 if test "$ENABLE_JAVA" != ""; then
11811     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11812     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11813         AC_MSG_RESULT([yes])
11814         if ! test -d "$with_jvm_path"; then
11815             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11816         fi
11817         if ! test -d "$with_jvm_path"jvm; then
11818             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11819         fi
11820         JVM_ONE_PATH_CHECK="$with_jvm_path"
11821         AC_SUBST(JVM_ONE_PATH_CHECK)
11822     else
11823         AC_MSG_RESULT([no])
11824     fi
11827 dnl ===================================================================
11828 dnl Test for the presence of Ant and that it works
11829 dnl ===================================================================
11831 if test "$ENABLE_JAVA" != ""; then
11832     ANT_HOME=; export ANT_HOME
11833     WITH_ANT_HOME=; export WITH_ANT_HOME
11834     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11835         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11836             if test "$_os" = "WINNT"; then
11837                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11838             else
11839                 with_ant_home="$LODE_HOME/opt/ant"
11840             fi
11841         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11842             with_ant_home="$LODE_HOME/opt/ant"
11843         fi
11844     fi
11845     if test -z "$with_ant_home"; then
11846         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11847     else
11848         if test "$_os" = "WINNT"; then
11849             # AC_PATH_PROGS needs unix path
11850             with_ant_home=`cygpath -u "$with_ant_home"`
11851         fi
11852         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11853         WITH_ANT_HOME=$with_ant_home
11854         ANT_HOME=$with_ant_home
11855     fi
11857     if test -z "$ANT"; then
11858         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11859     else
11860         # resolve relative or absolute symlink
11861         while test -h "$ANT"; do
11862             a_cwd=`pwd`
11863             a_basename=`basename "$ANT"`
11864             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11865             cd "`dirname "$ANT"`"
11866             cd "`dirname "$a_script"`"
11867             ANT="`pwd`"/"`basename "$a_script"`"
11868             cd "$a_cwd"
11869         done
11871         AC_MSG_CHECKING([if $ANT works])
11872         cat > conftest.java << EOF
11873         public class conftest {
11874             int testmethod(int a, int b) {
11875                     return a + b;
11876             }
11877         }
11880         cat > conftest.xml << EOF
11881         <project name="conftest" default="conftest">
11882         <target name="conftest">
11883             <javac srcdir="." includes="conftest.java">
11884             </javac>
11885         </target>
11886         </project>
11889         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11890         if test $? = 0 -a -f ./conftest.class; then
11891             AC_MSG_RESULT([Ant works])
11892             if test -z "$WITH_ANT_HOME"; then
11893                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11894                 if test -z "$ANT_HOME"; then
11895                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11896                 fi
11897             else
11898                 ANT_HOME="$WITH_ANT_HOME"
11899             fi
11900         else
11901             echo "configure: Ant test failed" >&5
11902             cat conftest.java >&5
11903             cat conftest.xml >&5
11904             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11905         fi
11906         rm -f conftest* core core.* *.core
11907     fi
11908     if test -z "$ANT_HOME"; then
11909         ANT_HOME="NO_ANT_HOME"
11910     else
11911         PathFormat "$ANT_HOME"
11912         ANT_HOME="$formatted_path"
11913         PathFormat "$ANT"
11914         ANT="$formatted_path"
11915     fi
11916     AC_SUBST(ANT_HOME)
11917     AC_SUBST(ANT)
11919     dnl Checking for ant.jar
11920     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11921         AC_MSG_CHECKING([Ant lib directory])
11922         if test -f $ANT_HOME/lib/ant.jar; then
11923             ANT_LIB="$ANT_HOME/lib"
11924         else
11925             if test -f $ANT_HOME/ant.jar; then
11926                 ANT_LIB="$ANT_HOME"
11927             else
11928                 if test -f /usr/share/java/ant.jar; then
11929                     ANT_LIB=/usr/share/java
11930                 else
11931                     if test -f /usr/share/ant-core/lib/ant.jar; then
11932                         ANT_LIB=/usr/share/ant-core/lib
11933                     else
11934                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11935                             ANT_LIB="$ANT_HOME/lib/ant"
11936                         else
11937                             if test -f /usr/share/lib/ant/ant.jar; then
11938                                 ANT_LIB=/usr/share/lib/ant
11939                             else
11940                                 AC_MSG_ERROR([Ant libraries not found!])
11941                             fi
11942                         fi
11943                     fi
11944                 fi
11945             fi
11946         fi
11947         PathFormat "$ANT_LIB"
11948         ANT_LIB="$formatted_path"
11949         AC_MSG_RESULT([Ant lib directory found.])
11950     fi
11951     AC_SUBST(ANT_LIB)
11953     ant_minver=1.6.0
11954     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11956     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11957     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11958     ant_version_major=`echo $ant_version | cut -d. -f1`
11959     ant_version_minor=`echo $ant_version | cut -d. -f2`
11960     echo "configure: ant_version $ant_version " >&5
11961     echo "configure: ant_version_major $ant_version_major " >&5
11962     echo "configure: ant_version_minor $ant_version_minor " >&5
11963     if test "$ant_version_major" -ge "2"; then
11964         AC_MSG_RESULT([yes, $ant_version])
11965     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11966         AC_MSG_RESULT([yes, $ant_version])
11967     else
11968         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11969     fi
11971     rm -f conftest* core core.* *.core
11974 OOO_JUNIT_JAR=
11975 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11976     AC_MSG_CHECKING([for JUnit 4])
11977     if test "$with_junit" = "yes"; then
11978         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11979             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11980         elif test -e /usr/share/java/junit4.jar; then
11981             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11982         else
11983            if test -e /usr/share/lib/java/junit.jar; then
11984               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11985            else
11986               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11987            fi
11988         fi
11989     else
11990         OOO_JUNIT_JAR=$with_junit
11991     fi
11992     if test "$_os" = "WINNT"; then
11993         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11994     fi
11995     printf 'import org.junit.Before;' > conftest.java
11996     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11997         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11998     else
11999         AC_MSG_ERROR(
12000 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12001  specify its pathname via --with-junit=..., or disable it via --without-junit])
12002     fi
12003     rm -f conftest.class conftest.java
12004     if test $OOO_JUNIT_JAR != ""; then
12005     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12006     fi
12008 AC_SUBST(OOO_JUNIT_JAR)
12010 HAMCREST_JAR=
12011 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12012     AC_MSG_CHECKING([for included Hamcrest])
12013     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12014     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12015         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12016     else
12017         AC_MSG_RESULT([Not included])
12018         AC_MSG_CHECKING([for standalone hamcrest jar.])
12019         if test "$with_hamcrest" = "yes"; then
12020             if test -e /usr/share/lib/java/hamcrest.jar; then
12021                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12022             elif test -e /usr/share/java/hamcrest/core.jar; then
12023                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12024             else
12025                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12026             fi
12027         else
12028             HAMCREST_JAR=$with_hamcrest
12029         fi
12030         if test "$_os" = "WINNT"; then
12031             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12032         fi
12033         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12034             AC_MSG_RESULT([$HAMCREST_JAR])
12035         else
12036             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),
12037                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12038         fi
12039     fi
12040     rm -f conftest.class conftest.java
12042 AC_SUBST(HAMCREST_JAR)
12045 AC_SUBST(SCPDEFS)
12048 # check for wget and curl
12050 WGET=
12051 CURL=
12053 if test "$enable_fetch_external" != "no"; then
12055 CURL=`which curl 2>/dev/null`
12057 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12058     # wget new enough?
12059     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12060     if test $? -eq 0; then
12061         WGET=$i
12062         break
12063     fi
12064 done
12066 if test -z "$WGET" -a -z "$CURL"; then
12067     AC_MSG_ERROR([neither wget nor curl found!])
12072 AC_SUBST(WGET)
12073 AC_SUBST(CURL)
12076 # check for md5sum
12078 MD5SUM=
12080 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12081     if test "$i" = "md5"; then
12082         eval "$i -x" > /dev/null 2>&1
12083     else
12084         eval "$i --version" > /dev/null 2>&1
12085     fi
12086     ret=$?
12087     if test $ret -eq 0; then
12088         MD5SUM=$i
12089         break
12090     fi
12091 done
12093 if test "$MD5SUM" = "md5"; then
12094     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12095         MD5SUM="$MD5SUM -r"
12096     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12097         MD5SUM="$MD5SUM -n"
12098     fi
12101 if test -z "$MD5SUM"; then
12102     AC_MSG_ERROR([no md5sum found!])
12105 AC_SUBST(MD5SUM)
12107 dnl ===================================================================
12108 dnl Dealing with l10n options
12109 dnl ===================================================================
12110 AC_MSG_CHECKING([which languages to be built])
12111 # get list of all languages
12112 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12113 # the sed command does the following:
12114 #   + if a line ends with a backslash, append the next line to it
12115 #   + adds " on the beginning of the value (after =)
12116 #   + adds " at the end of the value
12117 #   + removes en-US; we want to put it on the beginning
12118 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12119 [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)]
12120 ALL_LANGS="en-US $completelangiso"
12121 # check the configured localizations
12122 WITH_LANG="$with_lang"
12123 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12124     AC_MSG_RESULT([en-US])
12125 else
12126     AC_MSG_RESULT([$WITH_LANG])
12127     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12129 # check that the list is valid
12130 for lang in $WITH_LANG; do
12131     test "$lang" = "ALL" && continue
12132     # need to check for the exact string, so add space before and after the list of all languages
12133     for vl in $ALL_LANGS; do
12134         if test "$vl" = "$lang"; then
12135            break
12136         fi
12137     done
12138     if test "$vl" != "$lang"; then
12139         # if you're reading this - you prolly quoted your languages remove the quotes ...
12140         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12141     fi
12142 done
12143 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12144     echo $WITH_LANG | grep -q en-US
12145     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12147 # list with substituted ALL
12148 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12149 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12150 test "$WITH_LANG" = "en-US" && WITH_LANG=
12151 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12152     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12153     ALL_LANGS=`echo $ALL_LANGS qtz`
12155 AC_SUBST(ALL_LANGS)
12156 AC_SUBST(WITH_LANG)
12157 AC_SUBST(WITH_LANG_LIST)
12158 AC_SUBST(GIT_NEEDED_SUBMODULES)
12160 WITH_POOR_HELP_LOCALIZATIONS=
12161 if test -d "$SRC_ROOT/translations/source"; then
12162     for l in `ls -1 $SRC_ROOT/translations/source`; do
12163         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12164             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12165         fi
12166     done
12168 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12170 if test -n "$with_locales"; then
12171     WITH_LOCALES="$with_locales"
12173     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12174     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12175     # config_host/config_locales.h.in
12176     for locale in $WITH_LOCALES; do
12177         lang=${locale%_*}
12179         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12181         case $lang in
12182         hi|mr*ne)
12183             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12184             ;;
12185         bg|ru)
12186             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12187             ;;
12188         esac
12189     done
12190 else
12191     AC_DEFINE(WITH_LOCALE_ALL)
12193 AC_SUBST(WITH_LOCALES)
12195 dnl git submodule update --reference
12196 dnl ===================================================================
12197 if test -n "${GIT_REFERENCE_SRC}"; then
12198     for repo in ${GIT_NEEDED_SUBMODULES}; do
12199         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12200             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12201         fi
12202     done
12204 AC_SUBST(GIT_REFERENCE_SRC)
12206 dnl git submodules linked dirs
12207 dnl ===================================================================
12208 if test -n "${GIT_LINK_SRC}"; then
12209     for repo in ${GIT_NEEDED_SUBMODULES}; do
12210         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12211             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12212         fi
12213     done
12215 AC_SUBST(GIT_LINK_SRC)
12217 dnl branding
12218 dnl ===================================================================
12219 AC_MSG_CHECKING([for alternative branding images directory])
12220 # initialize mapped arrays
12221 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12222 brand_files="$BRAND_INTRO_IMAGES about.svg"
12224 if test -z "$with_branding" -o "$with_branding" = "no"; then
12225     AC_MSG_RESULT([none])
12226     DEFAULT_BRAND_IMAGES="$brand_files"
12227 else
12228     if ! test -d $with_branding ; then
12229         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12230     else
12231         AC_MSG_RESULT([$with_branding])
12232         CUSTOM_BRAND_DIR="$with_branding"
12233         for lfile in $brand_files
12234         do
12235             if ! test -f $with_branding/$lfile ; then
12236                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12237                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12238             else
12239                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12240             fi
12241         done
12242         check_for_progress="yes"
12243     fi
12245 AC_SUBST([BRAND_INTRO_IMAGES])
12246 AC_SUBST([CUSTOM_BRAND_DIR])
12247 AC_SUBST([CUSTOM_BRAND_IMAGES])
12248 AC_SUBST([DEFAULT_BRAND_IMAGES])
12251 AC_MSG_CHECKING([for 'intro' progress settings])
12252 PROGRESSBARCOLOR=
12253 PROGRESSSIZE=
12254 PROGRESSPOSITION=
12255 PROGRESSFRAMECOLOR=
12256 PROGRESSTEXTCOLOR=
12257 PROGRESSTEXTBASELINE=
12259 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12260     source "$with_branding/progress.conf"
12261     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12262 else
12263     AC_MSG_RESULT([none])
12266 AC_SUBST(PROGRESSBARCOLOR)
12267 AC_SUBST(PROGRESSSIZE)
12268 AC_SUBST(PROGRESSPOSITION)
12269 AC_SUBST(PROGRESSFRAMECOLOR)
12270 AC_SUBST(PROGRESSTEXTCOLOR)
12271 AC_SUBST(PROGRESSTEXTBASELINE)
12274 AC_MSG_CHECKING([for extra build ID])
12275 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12276     EXTRA_BUILDID="$with_extra_buildid"
12278 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12279 if test -n "$EXTRA_BUILDID" ; then
12280     AC_MSG_RESULT([$EXTRA_BUILDID])
12281 else
12282     AC_MSG_RESULT([not set])
12284 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12286 OOO_VENDOR=
12287 AC_MSG_CHECKING([for vendor])
12288 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12289     OOO_VENDOR="$USERNAME"
12291     if test -z "$OOO_VENDOR"; then
12292         OOO_VENDOR="$USER"
12293     fi
12295     if test -z "$OOO_VENDOR"; then
12296         OOO_VENDOR="`id -u -n`"
12297     fi
12299     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12300 else
12301     OOO_VENDOR="$with_vendor"
12302     AC_MSG_RESULT([$OOO_VENDOR])
12304 AC_SUBST(OOO_VENDOR)
12306 if echo "$host_os" | grep -q linux-android ; then
12307     ANDROID_PACKAGE_NAME=
12308     AC_MSG_CHECKING([for Android package name])
12309     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12310         if test -n "$ENABLE_DEBUG"; then
12311             # Default to the package name that makes ndk-gdb happy.
12312             ANDROID_PACKAGE_NAME="org.libreoffice"
12313         else
12314             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12315         fi
12317         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12318     else
12319         ANDROID_PACKAGE_NAME="$with_android_package_name"
12320         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12321     fi
12322     AC_SUBST(ANDROID_PACKAGE_NAME)
12325 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12326 if test "$with_compat_oowrappers" = "yes"; then
12327     WITH_COMPAT_OOWRAPPERS=TRUE
12328     AC_MSG_RESULT(yes)
12329 else
12330     WITH_COMPAT_OOWRAPPERS=
12331     AC_MSG_RESULT(no)
12333 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12335 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12336 AC_MSG_CHECKING([for install dirname])
12337 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12338     INSTALLDIRNAME="$with_install_dirname"
12340 AC_MSG_RESULT([$INSTALLDIRNAME])
12341 AC_SUBST(INSTALLDIRNAME)
12343 AC_MSG_CHECKING([for prefix])
12344 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12345 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12346 PREFIXDIR="$prefix"
12347 AC_MSG_RESULT([$PREFIXDIR])
12348 AC_SUBST(PREFIXDIR)
12350 LIBDIR=[$(eval echo $(eval echo $libdir))]
12351 AC_SUBST(LIBDIR)
12353 DATADIR=[$(eval echo $(eval echo $datadir))]
12354 AC_SUBST(DATADIR)
12356 MANDIR=[$(eval echo $(eval echo $mandir))]
12357 AC_SUBST(MANDIR)
12359 DOCDIR=[$(eval echo $(eval echo $docdir))]
12360 AC_SUBST(DOCDIR)
12362 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12363 AC_SUBST(INSTALLDIR)
12365 TESTINSTALLDIR="${BUILDDIR}/test-install"
12366 AC_SUBST(TESTINSTALLDIR)
12369 # ===================================================================
12370 # OAuth2 id and secrets
12371 # ===================================================================
12373 AC_MSG_CHECKING([for Google Drive client id and secret])
12374 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12375 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12376 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12377     GDRIVE_CLIENT_ID="\"\""
12380 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12381     GDRIVE_CLIENT_SECRET="\"\""
12384 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12385     AC_MSG_RESULT([not set])
12386 else
12387     AC_MSG_RESULT([set])
12390 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12391 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12393 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12394 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12395 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12396 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12397     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12400 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12401     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12404 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12405     AC_MSG_RESULT([not set])
12406 else
12407     AC_MSG_RESULT([set])
12409 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12410 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12412 AC_MSG_CHECKING([for OneDrive client id and secret])
12413 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12414 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12415 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12416     ONEDRIVE_CLIENT_ID="\"\""
12419 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12420     ONEDRIVE_CLIENT_SECRET="\"\""
12423 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12424     AC_MSG_RESULT([not set])
12425 else
12426     AC_MSG_RESULT([set])
12428 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12429 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12432 dnl ===================================================================
12433 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12434 dnl --enable-dependency-tracking configure option
12435 dnl ===================================================================
12436 AC_MSG_CHECKING([whether to enable dependency tracking])
12437 if test "$enable_dependency_tracking" = "no"; then
12438     nodep=TRUE
12439     AC_MSG_RESULT([no])
12440 else
12441     AC_MSG_RESULT([yes])
12443 AC_SUBST(nodep)
12445 dnl ===================================================================
12446 dnl Number of CPUs to use during the build
12447 dnl ===================================================================
12448 AC_MSG_CHECKING([for number of processors to use])
12449 # plain --with-parallelism is just the default
12450 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12451     if test "$with_parallelism" = "no"; then
12452         PARALLELISM=0
12453     else
12454         PARALLELISM=$with_parallelism
12455     fi
12456 else
12457     if test "$enable_icecream" = "yes"; then
12458         PARALLELISM="10"
12459     else
12460         case `uname -s` in
12462         Darwin|FreeBSD|NetBSD|OpenBSD)
12463             PARALLELISM=`sysctl -n hw.ncpu`
12464             ;;
12466         Linux)
12467             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12468         ;;
12469         # what else than above does profit here *and* has /proc?
12470         *)
12471             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12472             ;;
12473         esac
12475         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12476         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12477     fi
12480 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12481     if test -z "$with_parallelism"; then
12482             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12483             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12484             PARALLELISM="1"
12485     else
12486         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."
12487     fi
12490 if test $PARALLELISM -eq 0; then
12491     AC_MSG_RESULT([explicit make -j option needed])
12492 else
12493     AC_MSG_RESULT([$PARALLELISM])
12495 AC_SUBST(PARALLELISM)
12497 IWYU_PATH="$with_iwyu"
12498 AC_SUBST(IWYU_PATH)
12499 if test ! -z "$IWYU_PATH"; then
12500     if test ! -f "$IWYU_PATH"; then
12501         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12502     fi
12506 # Set up ILIB for MSVC build
12508 ILIB1=
12509 if test "$build_os" = "cygwin"; then
12510     ILIB="."
12511     if test -n "$JAVA_HOME"; then
12512         ILIB="$ILIB;$JAVA_HOME/lib"
12513     fi
12514     ILIB1=-link
12515     if test "$BITNESS_OVERRIDE" = 64; then
12516         ILIB="$ILIB;$COMPATH/lib/amd64"
12517         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12518         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12519         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12520         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12521             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12522             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12523         fi
12524         if test $VCVER = 140; then
12525             PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12526             ucrtlibpath_formatted=$formatted_path
12527             ILIB="$ILIB;$ucrtlibpath_formatted"
12528         fi
12529     else
12530         ILIB="$ILIB;$COMPATH/lib"
12531         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12532         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12533         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12534         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12535             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12536             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12537         fi
12538         if test $VCVER = 140; then
12539             PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12540             ucrtlibpath_formatted=$formatted_path
12541             ILIB="$ILIB;$ucrtlibpath_formatted"
12542         fi
12543     fi
12544     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12545         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12546     else
12547         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12548     fi
12550     AC_SUBST(ILIB)
12553 AC_MSG_CHECKING(
12554     [whether C++11 use of const_iterator in standard containers is broken])
12555 save_CXXFLAGS=$CXXFLAGS
12556 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12557 AC_LANG_PUSH([C++])
12558 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12559     #include <list>
12560     ]],[[
12561         std::list<int> l;
12562         l.erase(l.cbegin());
12563     ]])],
12564     [broken=no], [broken=yes])
12565 AC_LANG_POP([C++])
12566 LIBS=$save_LIBS
12567 CXXFLAGS=$save_CXXFLAGS
12568 AC_MSG_RESULT([$broken])
12569 if test "$broken" = yes; then
12570     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12574 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12575 save_CXXFLAGS=$CXXFLAGS
12576 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12577 save_LIBS=$LIBS
12578 if test -n "$ILIB1"; then
12579     LIBS="$LIBS $ILIB1"
12581 AC_LANG_PUSH([C++])
12582 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12583     // Exit with failure if the static initializer_list is stored on the
12584     // stack (as done by Clang < 3.4):
12585     #include <initializer_list>
12586     struct S {};
12587     bool g(void const * p1, void const * p2) {
12588         int n;
12589         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12590     }
12591     bool f(void const * p1) {
12592         static std::initializer_list<S> s { S() };
12593         return g(p1, s.begin());
12594     }
12595     ]],[[
12596         int n;
12597         return f(&n) ? 0 : 1;
12598     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12599 AC_LANG_POP([C++])
12600 LIBS=$save_LIBS
12601 CXXFLAGS=$save_CXXFLAGS
12602 AC_MSG_RESULT([$broken])
12603 if test "$broken" = yes; then
12604     AC_DEFINE([HAVE_BROKEN_STATIC_INITIALIZER_LIST])
12608 # ===================================================================
12609 # Creating bigger shared library to link against
12610 # ===================================================================
12611 AC_MSG_CHECKING([whether to create huge library])
12612 MERGELIBS=
12614 if test $_os = iOS -o $_os = Android; then
12615     # Never any point in mergelibs for these as we build just static
12616     # libraries anyway...
12617     enable_mergelibs=no
12620 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12621     if test $_os != Linux -a $_os != WINNT; then
12622         add_warning "--enable-mergelibs is not tested for this platform"
12623     fi
12624     MERGELIBS="TRUE"
12625     AC_MSG_RESULT([yes])
12626 else
12627     AC_MSG_RESULT([no])
12629 AC_SUBST([MERGELIBS])
12631 dnl ===================================================================
12632 dnl icerun is a wrapper that stops us spawning tens of processes
12633 dnl locally - for tools that can't be executed on the compile cluster
12634 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12635 dnl ===================================================================
12636 AC_MSG_CHECKING([whether to use icerun wrapper])
12637 ICECREAM_RUN=
12638 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12639     ICECREAM_RUN=icerun
12640     AC_MSG_RESULT([yes])
12641 else
12642     AC_MSG_RESULT([no])
12644 AC_SUBST(ICECREAM_RUN)
12646 dnl ===================================================================
12647 dnl Setup the ICECC_VERSION for the build the same way it was set for
12648 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12649 dnl ===================================================================
12650 x_ICECC_VERSION=[\#]
12651 if test -n "$ICECC_VERSION" ; then
12652     x_ICECC_VERSION=
12654 AC_SUBST(x_ICECC_VERSION)
12655 AC_SUBST(ICECC_VERSION)
12657 dnl ===================================================================
12659 AC_MSG_CHECKING([MPL subset])
12660 MPL_SUBSET=
12662 if test "$enable_mpl_subset" = "yes"; then
12663     warn_report=false
12664     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12665         warn_report=true
12666     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12667         warn_report=true
12668     fi
12669     if test "$warn_report" = "true"; then
12670         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12671     fi
12672     if test "x$enable_postgresql_sdbc" != "xno"; then
12673         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12674     fi
12675     if test "$enable_lotuswordpro" = "yes"; then
12676         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12677     fi
12678     if test "$WITH_WEBDAV" = "neon"; then
12679         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12680     fi
12681     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12682         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12683     fi
12684     if test -n "$ENABLE_PDFIMPORT"; then
12685         if test "x$SYSTEM_POPPLER" = "x"; then
12686             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12687         fi
12688     fi
12689     # cf. m4/libo_check_extension.m4
12690     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12691         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12692     fi
12693     for theme in $WITH_THEMES; do
12694         case $theme in
12695         breeze|crystal|default|hicontrast|oxygen|sifr)
12696             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12697         *) : ;;
12698         esac
12699     done
12701     ENABLE_OPENGL_TRANSITIONS=
12703     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12704         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12705     fi
12707     MPL_SUBSET="TRUE"
12708     AC_DEFINE(MPL_HAVE_SUBSET)
12709     AC_MSG_RESULT([only])
12710 else
12711     AC_MSG_RESULT([no restrictions])
12713 AC_SUBST(MPL_SUBSET)
12715 dnl ===================================================================
12717 AC_MSG_CHECKING([formula logger])
12718 ENABLE_FORMULA_LOGGER=
12720 if test "x$enable_formula_logger" = "xyes"; then
12721     AC_MSG_RESULT([yes])
12722     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12723     ENABLE_FORMULA_LOGGER=TRUE
12724 else
12725     AC_MSG_RESULT([no])
12728 AC_SUBST(ENABLE_FORMULA_LOGGER)
12730 dnl ===================================================================
12731 dnl Setting up the environment.
12732 dnl ===================================================================
12733 AC_MSG_NOTICE([setting up the build environment variables...])
12735 AC_SUBST(COMPATH)
12737 if test "$build_os" = "cygwin"; then
12738     if test -d "$COMPATH/atlmfc/lib"; then
12739         ATL_LIB="$COMPATH/atlmfc/lib"
12740         ATL_INCLUDE="$COMPATH/atlmfc/include"
12741     else
12742         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12743         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12744     fi
12745     if test "$BITNESS_OVERRIDE" = 64; then
12746         ATL_LIB="$ATL_LIB/amd64"
12747     fi
12748     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12749     PathFormat "/usr/bin/find.exe"
12750     FIND="$formatted_path"
12751     PathFormat "/usr/bin/sort.exe"
12752     SORT="$formatted_path"
12753     PathFormat "/usr/bin/grep.exe"
12754     WIN_GREP="$formatted_path"
12755     PathFormat "/usr/bin/ls.exe"
12756     WIN_LS="$formatted_path"
12757     PathFormat "/usr/bin/touch.exe"
12758     WIN_TOUCH="$formatted_path"
12759 else
12760     FIND=find
12761     SORT=sort
12764 AC_SUBST(ATL_INCLUDE)
12765 AC_SUBST(ATL_LIB)
12766 AC_SUBST(FIND)
12767 AC_SUBST(SORT)
12768 AC_SUBST(WIN_GREP)
12769 AC_SUBST(WIN_LS)
12770 AC_SUBST(WIN_TOUCH)
12772 AC_SUBST(BUILD_TYPE)
12774 AC_SUBST(SOLARINC)
12776 PathFormat "$PERL"
12777 PERL="$formatted_path"
12778 AC_SUBST(PERL)
12780 if test -n "$TMPDIR"; then
12781     TEMP_DIRECTORY="$TMPDIR"
12782 else
12783     TEMP_DIRECTORY="/tmp"
12785 if test "$build_os" = "cygwin"; then
12786     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12788 AC_SUBST(TEMP_DIRECTORY)
12790 # setup the PATH for the environment
12791 if test -n "$LO_PATH_FOR_BUILD"; then
12792     LO_PATH="$LO_PATH_FOR_BUILD"
12793 else
12794     LO_PATH="$PATH"
12796     case "$host_os" in
12798     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12799         if test "$ENABLE_JAVA" != ""; then
12800             pathmunge "$JAVA_HOME/bin" "after"
12801         fi
12802         ;;
12804     cygwin*)
12805         # Win32 make needs native paths
12806         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12807             LO_PATH=`cygpath -p -m "$PATH"`
12808         fi
12809         if test "$BITNESS_OVERRIDE" = 64; then
12810             # needed for msi packaging
12811             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12812         fi
12813         # .NET 4.6 and higher don't have bin directory
12814         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12815             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12816         fi
12817         pathmunge "$ASM_HOME" "before"
12818         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12819         pathmunge "$CSC_PATH" "before"
12820         pathmunge "$MIDL_PATH" "before"
12821         pathmunge "$AL_PATH" "before"
12822         pathmunge "$MSPDB_PATH" "before"
12823         if test -n "$MSBUILD_PATH" ; then
12824             pathmunge "$MSBUILD_PATH" "before"
12825         fi
12826         if test "$BITNESS_OVERRIDE" = 64; then
12827             if test "$vcexpress" = "Express"; then
12828                 pathmunge "$COMPATH/bin/x86_amd64" "before"
12829                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12830             else
12831                 pathmunge "$COMPATH/bin/amd64" "before"
12832                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12833             fi
12834         else
12835             pathmunge "$COMPATH/bin" "before"
12836             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12837         fi
12838         if test "$ENABLE_JAVA" != ""; then
12839             if test -d "$JAVA_HOME/jre/bin/client"; then
12840                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12841             fi
12842             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12843                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12844             fi
12845             pathmunge "$JAVA_HOME/bin" "before"
12846         fi
12847         ;;
12849     solaris*)
12850         pathmunge "/usr/css/bin" "before"
12851         if test "$ENABLE_JAVA" != ""; then
12852             pathmunge "$JAVA_HOME/bin" "after"
12853         fi
12854         ;;
12855     esac
12858 AC_SUBST(LO_PATH)
12860 # Generate a configuration md5 we can use for deps
12861 if test -f config_host.mk; then
12862     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12864 if test -f config_host_lang.mk; then
12865     config_lang_md5=`$MD5SUM config_host_lang.mk | sed "s/ .*//"`
12868 AC_CONFIG_FILES([config_host.mk
12869                  config_host_lang.mk
12870                  Makefile
12871                  lo.xcent
12872                  bin/bffvalidator.sh
12873                  bin/odfvalidator.sh
12874                  bin/officeotron.sh
12875                  instsetoo_native/util/openoffice.lst
12876                  sysui/desktop/macosx/Info.plist
12877                  ios/lo.xcconfig])
12878 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12879 AC_CONFIG_HEADERS([config_host/config_clang.h])
12880 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12881 AC_CONFIG_HEADERS([config_host/config_eot.h])
12882 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12883 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12884 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12885 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12886 AC_CONFIG_HEADERS([config_host/config_features.h])
12887 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12888 AC_CONFIG_HEADERS([config_host/config_folders.h])
12889 AC_CONFIG_HEADERS([config_host/config_gio.h])
12890 AC_CONFIG_HEADERS([config_host/config_global.h])
12891 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12892 AC_CONFIG_HEADERS([config_host/config_java.h])
12893 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12894 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12895 AC_CONFIG_HEADERS([config_host/config_locales.h])
12896 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12897 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12898 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12899 AC_CONFIG_HEADERS([config_host/config_oox.h])
12900 AC_CONFIG_HEADERS([config_host/config_opengl.h])
12901 AC_CONFIG_HEADERS([config_host/config_options.h])
12902 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12903 AC_CONFIG_HEADERS([config_host/config_test.h])
12904 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12905 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12906 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12907 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12908 AC_CONFIG_HEADERS([config_host/config_version.h])
12909 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12910 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12911 AC_CONFIG_HEADERS([config_host/config_python.h])
12912 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12913 AC_OUTPUT
12915 if test "$CROSS_COMPILING" = TRUE; then
12916     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12919 # touch the config timestamp file
12920 if test ! -f config_host.mk.stamp; then
12921     echo > config_host.mk.stamp
12922 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12923     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12924 else
12925     echo > config_host.mk.stamp
12928 # touch the config lang timestamp file
12929 if test ! -f config_host_lang.mk.stamp; then
12930     echo > config_host_lang.mk.stamp
12931 elif test "$config_lang_md5" = `$MD5SUM config_host_lang.mk | sed "s/ .*//"`; then
12932     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12933 else
12934     echo > config_host_lang.mk.stamp
12938 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12940 cat << _EOS
12941 ****************************************************************************
12942 WARNING:
12943 Your make version is known to be horribly slow, and hard to debug
12944 problems with. To get a reasonably functional make please do:
12946 to install a pre-compiled binary make for Win32
12948  mkdir -p /opt/lo/bin
12949  cd /opt/lo/bin
12950  wget http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12951  cp make-85047eb-msvc.exe make
12952  chmod +x make
12954 to install from source:
12955 place yourself in a working directory of you choice.
12957  git clone git://git.savannah.gnu.org/make.git
12959  [go to Start menu, click "All Programs", click "Visual Studio 2013", click "Visual Studio Tools", double-click "VS2013 x86 Native Tools Command Prompt" or "VS2013 x64 Native Tools Command Prompt"]
12960  set PATH=%PATH%;C:\Cygwin\bin
12961  [or Cygwin64, if that is what you have]
12962  cd path-to-make-repo-you-cloned-above
12963  build_w32.bat --without-guile
12965 should result in a WinRel/gnumake.exe.
12966 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12968 Then re-run autogen.sh
12970 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12971 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12973 _EOS
12976 cat << _EOF
12977 ****************************************************************************
12979 To build, run:
12980 $GNUMAKE
12982 To view some help, run:
12983 $GNUMAKE help
12985 _EOF
12987 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12988     cat << _EOF
12989 After the build has finished, you can immediately run it using:
12990 _EOF
12992     if test $_os = Darwin; then
12993         echo open instdir/$PRODUCTNAME.app
12994     else
12995         echo instdir/program/soffice
12996     fi
12997     cat << _EOF
12999 If you want to run the smoketest, run:
13000 $GNUMAKE check
13002 _EOF
13005 if test -f warn; then
13006     cat warn
13007     rm warn
13010 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: