build fix
[LibreOffice.git] / configure.ac
blobda84e3505b2956a17194a7c4f310d1b0bc875347
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([Collabora Office],[5.3.10.66],[],[],[https://collaboraoffice.com/])
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"
161     PRODUCTNAME=AC_PACKAGE_NAME
163 AC_MSG_RESULT([$PRODUCTNAME])
164 AC_SUBST(PRODUCTNAME)
165 PRODUCTNAME_WITHOUT_SPACES=${PRODUCTNAME// /}
166 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
168 dnl ===================================================================
169 dnl Our version is defined by the AC_INIT() at the top of this script.
170 dnl ===================================================================
172 AC_MSG_CHECKING([for package version])
173 if test -n "$with_package_version" -a "$with_package_version" != no; then
174     PACKAGE_VERSION="$with_package_version"
176 AC_MSG_RESULT([$PACKAGE_VERSION])
178 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
180 LIBO_VERSION_MAJOR=$1
181 LIBO_VERSION_MINOR=$2
182 LIBO_VERSION_MICRO=$3
183 LIBO_VERSION_PATCH=$4
185 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
186 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
187 # no way to encode that into an integer in general.
188 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
190 LIBO_VERSION_SUFFIX=$5
191 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
192 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
193 # they get undoubled before actually passed to sed.
194 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
195 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
196 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
197 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
199 AC_SUBST(LIBO_VERSION_MAJOR)
200 AC_SUBST(LIBO_VERSION_MINOR)
201 AC_SUBST(LIBO_VERSION_MICRO)
202 AC_SUBST(LIBO_VERSION_PATCH)
203 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
204 AC_SUBST(LIBO_VERSION_SUFFIX)
205 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
207 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
208 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
209 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
210 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
212 LIBO_THIS_YEAR=`date +%Y`
213 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
215 dnl ===================================================================
216 dnl Product version
217 dnl ===================================================================
218 AC_MSG_CHECKING([for product version])
219 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
220 AC_MSG_RESULT([$PRODUCTVERSION])
221 AC_SUBST(PRODUCTVERSION)
223 AC_PROG_EGREP
224 # AC_PROG_EGREP doesn't set GREP on all systems as well
225 AC_PATH_PROG(GREP, grep)
227 BUILDDIR=`pwd`
228 cd $srcdir
229 SRC_ROOT=`pwd`
230 cd $BUILDDIR
231 x_Cygwin=[\#]
233 dnl ======================================
234 dnl Required GObject introspection version
235 dnl ======================================
236 INTROSPECTION_REQUIRED_VERSION=1.32.0
238 dnl ===================================================================
239 dnl Search all the common names for GNU Make
240 dnl ===================================================================
241 AC_MSG_CHECKING([for GNU Make])
243 # try to use our own make if it is available and GNUMAKE was not already defined
244 if test -z "$GNUMAKE"; then
245     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
246         GNUMAKE="$LODE_HOME/opt/bin/make"
247     elif test -x "/opt/lo/bin/make"; then
248         GNUMAKE="/opt/lo/bin/make"
249     fi
252 GNUMAKE_WIN_NATIVE=
253 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
254     if test -n "$a"; then
255         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
256         if test $? -eq 0;  then
257             if test "$build_os" = "cygwin"; then
258                 if test -n "$($a -v | grep 'Built for Windows')" ; then
259                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
260                     GNUMAKE_WIN_NATIVE="TRUE"
261                 else
262                     GNUMAKE=`which $a`
263                 fi
264             else
265                 GNUMAKE=`which $a`
266             fi
267             break
268         fi
269     fi
270 done
271 AC_MSG_RESULT($GNUMAKE)
272 if test -z "$GNUMAKE"; then
273     AC_MSG_ERROR([not found. install GNU Make.])
274 else
275     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
276         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
277     fi
280 win_short_path_for_make()
282     local_short_path="$1"
283     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
284         cygpath -sm "$local_short_path"
285     else
286         cygpath -u "$(cygpath -d "$local_short_path")"
287     fi
291 if test "$build_os" = "cygwin"; then
292     PathFormat "$SRC_ROOT"
293     SRC_ROOT="$formatted_path"
294     PathFormat "$BUILDDIR"
295     BUILDDIR="$formatted_path"
296     x_Cygwin=
297     AC_MSG_CHECKING(for explicit COMSPEC)
298     if test -z "$COMSPEC"; then
299         AC_MSG_ERROR([COMSPEC not set in Environment, please set it an rerun])
300     fi
303 AC_SUBST(SRC_ROOT)
304 AC_SUBST(BUILDDIR)
305 AC_SUBST(x_Cygwin)
306 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
307 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
309 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
310     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
313 # need sed in os checks...
314 AC_PATH_PROGS(SED, sed)
315 if test -z "$SED"; then
316     AC_MSG_ERROR([install sed to run this script])
319 # Set the ENABLE_LTO variable
320 # ===================================================================
321 AC_MSG_CHECKING([whether to use link-time optimization])
322 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
323     ENABLE_LTO="TRUE"
324     AC_MSG_RESULT([yes])
325     AC_DEFINE(STATIC_LINKING)
326 else
327     ENABLE_LTO=""
328     AC_MSG_RESULT([no])
330 AC_SUBST(ENABLE_LTO)
332 dnl ===================================================================
333 dnl When building for Android, --with-android-ndk,
334 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
335 dnl mandatory
336 dnl ===================================================================
338 AC_ARG_WITH(android-ndk,
339     AS_HELP_STRING([--with-android-ndk],
340         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
343 AC_ARG_WITH(android-ndk-toolchain-version,
344     AS_HELP_STRING([--with-android-ndk-toolchain-version],
345         [Specify which toolchain version to use, of those present in the
346         Android NDK you are using. The default is 4.9 currently.]), ,)
348 AC_ARG_WITH(android-sdk,
349     AS_HELP_STRING([--with-android-sdk],
350         [Specify location of the Android SDK. Mandatory when building for Android,
351         or when building the Impress Remote Android app.]),
354 ANDROID_NDK_HOME=
355 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
356     with_android_ndk="$SRC_ROOT/external/android-ndk"
358 if test -n "$with_android_ndk"; then
359     ANDROID_NDK_HOME=$with_android_ndk
361     # Set up a lot of pre-canned defaults
363     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
364         if test ! -f $ANDROID_NDK_HOME/source.properties; then
365             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
366         fi
367         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
368     else
369         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
370     fi
371     if test -z "$ANDROID_NDK_VERSION";  then
372         AC_MSG_ERROR([Failed to determine android NDK version. Please check your installation.])
373     fi
374     case $ANDROID_NDK_VERSION in
375     r9*|r10*)
376         ;;
377     11.1.*|12.1.*|13.1.*)
378         ;;
379     *)
380         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.])
381         add_warning "Untested android NDK version $ANDROID_NDK_VERSION, only versions r9* til 13.1.* have been used successfully. Proceed at your own risk."
382         ;;
383     esac
385     if test $host_cpu = arm; then
386         android_cpu=arm
387         android_platform_prefix=$android_cpu-linux-androideabi
388     elif test $host_cpu = aarch64; then
389         android_cpu=aarch64
390         android_platform_prefix=$android_cpu-linux-android
391     elif test $host_cpu = mips; then
392         android_cpu=mips
393         android_platform_prefix=$android_cpu-linux-androideabi
394     else
395         # host_cpu is something like "i386" or "i686" I guess, NDK uses
396         # "x86" in some contexts
397         android_cpu=x86
398         android_platform_prefix=$android_cpu
399     fi
401     if test -z "$with_android_ndk_toolchain_version"; then
402         # Default to gcc 4.9
403         with_android_ndk_toolchain_version=4.9
404     fi
406     case "$with_android_ndk_toolchain_version" in
407     4.6|4.7|4.8|4.9)
408         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
409         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
410         ;;
411     clang3.3|clang3.4)
412         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
413         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
414         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
415         ANDROID_USING_CLANG=true
416         ;;
417     *)
418         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
419     esac
421     if test ! -d $ANDROID_BINUTILS_DIR; then
422         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
423     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
424         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
425     fi
427     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
428     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
429     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
430     # manage to link the (app-specific) single huge .so that is built for the app in
431     # android/source/ if there is debug information in a significant part of the object files.
432     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
433     # all objects have been built with debug information.)
434     toolchain_system='*'
435     case $build_os in
436     linux-gnu*)
437         ndk_build_os=linux
438         ;;
439     darwin*)
440         ndk_build_os=darwin
441         ;;
442     *)
443         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
444         ;;
445     esac
447     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
448     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
449     if test $build_cpu = x86_64; then
450         if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
451             ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
452         fi
453         if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
454             ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
455         fi
456     fi
457     ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
459     # This stays empty if there is just one version of the toolchain in the NDK
460     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
461     if test ! -d "$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/libs" ; then
462         # nope, won't work if empty...
463         # as is the case when using the ndk-bundle as installed with android studio
464         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
465         if test -n "$ANDROID_USING_CLANG"; then
466             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
467         fi
468     fi
470     ANDROID_API_LEVEL=15
471     if test $host_cpu = arm; then
472         android_gnu_prefix=arm-linux-androideabi
473     elif test $host_cpu = aarch64; then
474         android_gnu_prefix=aarch64-linux-android
475         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
476         ANDROID_API_LEVEL=L
477     elif test $host_cpu = mips; then
478         android_gnu_prefix=mipsel-linux-android
479     elif test $ANDROID_NDK_VERSION = r8; then
480         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
481         android_gnu_prefix=i686-android-linux
482     else
483         android_gnu_prefix=i686-linux-android
484     fi
486     ANDROID_ARCH=$android_cpu
487     if test $host_cpu = arm; then
488         ANDROID_APP_ABI=armeabi-v7a
489         if test -n "$ANDROID_USING_CLANG"; then
490             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
491             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
492             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
493         else
494             :
495         fi
496         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
497         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
498         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
499     elif test $host_cpu = aarch64; then
500         ANDROID_APP_ABI=arm64-v8a
501         ANDROID_ARCH=arm64
502     elif test $host_cpu = mips; then
503         ANDROID_APP_ABI=mips
504         ANDROIDCFLAGS=""
505     else # x86
506         ANDROID_APP_ABI=x86
507         ANDROIDCFLAGS="-march=atom"
508     fi
509     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
510     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
511     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
512     export PKG_CONFIG_LIBDIR="$ANDROID_BINUTILS_PREBUILT_ROOT/lib/pkgconfig"
514     if test -n "$ANDROID_USING_CLANG"; then
515         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
516     else
517         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
518     fi
520     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
521     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
522     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
523     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
524     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
525     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
527     # When using the 4.6 or newer toolchain, use the gold linker
528     case "$with_android_ndk_toolchain_version" in
529     4.[[6789]]*|[[56789]].*|clang*)
530         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
531             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
532         fi
533         ;;
534     esac
536     if test "$ENABLE_LTO" = TRUE; then
537         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
538         # $CC and $CXX when building external libraries
539          if test "$COM_IS_CLANG" = TRUE; then
540             ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
541         else
542             ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
543         fi
544     fi
546     # gdbserver can be in different locations
547     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
548         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
549     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
550         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
551     elif test $android_cpu = aarch64; then
552         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
553     else
554         AC_MSG_ERROR([Can't find gdbserver for your Android target])
555     fi
557     if test $host_cpu = arm; then
558         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"
559     elif test $host_cpu = mips; then
560         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"
561     else # x86
562         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/x86/include"
563     fi
565     if test -z "$CC"; then
566         case "$with_android_ndk_toolchain_version" in
567         4.*)
568             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
569             ;;
570         clang*)
571             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
572         esac
573     fi
574     if test -z "$CXX"; then
575         case "$with_android_ndk_toolchain_version" in
576         4.*)
577             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
578             ;;
579         clang*)
580             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
581             ;;
582         esac
583     fi
585     # remember to download the ownCloud Android library later
586     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
588 AC_SUBST(ANDROID_NDK_GDBSERVER)
589 AC_SUBST(ANDROID_APP_ABI)
591 dnl ===================================================================
592 dnl --with-android-sdk
593 dnl ===================================================================
594 ANDROID_SDK_HOME=
595 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
596     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
598 if test -n "$with_android_sdk"; then
599     ANDROID_SDK_HOME=$with_android_sdk
600     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
602 AC_SUBST(ANDROID_SDK_HOME)
604 dnl ===================================================================
605 dnl The following is a list of supported systems.
606 dnl Sequential to keep the logic very simple
607 dnl These values may be checked and reset later.
608 dnl ===================================================================
609 #defaults unless the os test overrides this:
610 test_randr=yes
611 test_xrender=yes
612 test_cups=yes
613 test_dbus=yes
614 test_fontconfig=yes
615 test_cairo=no
617 # Default values, as such probably valid just for Linux, set
618 # differently below just for Mac OSX,but at least better than
619 # hardcoding these as we used to do. Much of this is duplicated also
620 # in solenv for old build system and for gbuild, ideally we should
621 # perhaps define stuff like this only here in configure.ac?
623 LINKFLAGSSHL="-shared"
624 PICSWITCH="-fpic"
625 DLLPOST=".so"
627 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
629 INSTROOTSUFFIX=
630 SDKDIRNAME=sdk
632 case "$host_os" in
634 solaris*)
635     test_gtk=yes
636     build_gstreamer_1_0=yes
637     build_gstreamer_0_10=yes
638     test_tde=yes
639     test_freetype=yes
640     _os=SunOS
642     dnl ===========================================================
643     dnl Check whether we're using Solaris 10 - SPARC or Intel.
644     dnl ===========================================================
645     AC_MSG_CHECKING([the Solaris operating system release])
646     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
647     if test "$_os_release" -lt "10"; then
648         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
649     else
650         AC_MSG_RESULT([ok ($_os_release)])
651     fi
653     dnl Check whether we're using a SPARC or i386 processor
654     AC_MSG_CHECKING([the processor type])
655     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
656         AC_MSG_RESULT([ok ($host_cpu)])
657     else
658         AC_MSG_ERROR([only SPARC and i386 processors are supported])
659     fi
660     ;;
662 linux-gnu*|k*bsd*-gnu*)
663     test_gtk=yes
664     build_gstreamer_1_0=yes
665     build_gstreamer_0_10=yes
666     test_tde=yes
667     test_kde4=yes
668     test_freetype=yes
669     _os=Linux
670     ;;
672 gnu)
673     test_randr=no
674     test_xrender=no
675     _os=GNU
676      ;;
678 cygwin*|interix*|mingw32*)
680     # When building on Windows normally with MSVC under Cygwin,
681     # configure thinks that the host platform (the platform the
682     # built code will run on) is Cygwin, even if it obviously is
683     # Windows, which in Autoconf terminology is called
684     # "mingw32". (Which is misleading as MinGW is the name of the
685     # tool-chain, not an operating system.)
687     # Somewhat confusing, yes. But this configure script doesn't
688     # look at $host etc that much, it mostly uses its own $_os
689     # variable, set here in this case statement.
691     # When cross-compiling to Windows from Unix, the host platform
692     # is "mingw32" (because in that case it is the MinGW
693     # tool-chain that is used).
695     test_cups=no
696     test_dbus=no
697     test_randr=no
698     test_xrender=no
699     test_freetype=no
700     test_fontconfig=no
701     _os=WINNT
703     DLLPOST=".dll"
704     LINKFLAGSNOUNDEFS=
706     # If the host OS matches "mingw32*", that means we are using the
707     # MinGW cross-compiler, because we don't see the point in building
708     # LibreOffice using MinGW on Windows. If you want to build on
709     # Windows, use MSVC. If you want to use MinGW, surely you want to
710     # cross-compile (from Linux or some other Unix).
712     case "$host_os" in
713     mingw32*)
714         WITH_MINGW=yes
715         if test -z "$CC"; then
716             CC="$host_cpu-$host_vendor-$host_os-gcc"
717         fi
718         if test -z "$CXX"; then
719             CXX="$host_cpu-$host_vendor-$host_os-g++"
720         fi
721         ;;
722     esac
723     ;;
725 darwin*) # Mac OS X or iOS
726     test_gtk=yes
727     test_randr=no
728     test_xrender=no
729     test_freetype=no
730     test_fontconfig=no
731     test_dbus=no
732     if test "$host_cpu" = "arm"; then
733         _os=iOS
734         test_gtk=no
735         test_cups=no
736     else
737         _os=Darwin
738         if test -n "$LODE_HOME" ; then
739             mac_sanitize_path
740             AC_MSG_NOTICE([sanitized the PATH to $PATH])
741         fi
742         INSTROOTSUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app/Contents
743         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
744     fi
745     enable_systray=no
746     # See comment above the case "$host_os"
747     LINKFLAGSSHL="-dynamiclib -single_module"
749     # -fPIC is default
750     PICSWITCH=""
752     DLLPOST=".dylib"
754     # -undefined error is the default
755     LINKFLAGSNOUNDEFS=""
758 freebsd*)
759     test_gtk=yes
760     build_gstreamer_1_0=yes
761     build_gstreamer_0_10=yes
762     test_tde=yes
763     test_kde4=yes
764     test_freetype=yes
765     AC_MSG_CHECKING([the FreeBSD operating system release])
766     if test -n "$with_os_version"; then
767         OSVERSION="$with_os_version"
768     else
769         OSVERSION=`/sbin/sysctl -n kern.osreldate`
770     fi
771     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
772     AC_MSG_CHECKING([which thread library to use])
773     if test "$OSVERSION" -lt "500016"; then
774         PTHREAD_CFLAGS="-D_THREAD_SAFE"
775         PTHREAD_LIBS="-pthread"
776     elif test "$OSVERSION" -lt "502102"; then
777         PTHREAD_CFLAGS="-D_THREAD_SAFE"
778         PTHREAD_LIBS="-lc_r"
779     else
780         PTHREAD_CFLAGS=""
781         PTHREAD_LIBS="-pthread"
782     fi
783     AC_MSG_RESULT([$PTHREAD_LIBS])
784     _os=FreeBSD
785     ;;
787 *netbsd*)
788     test_gtk=yes
789     build_gstreamer_1_0=yes
790     build_gstreamer_0_10=yes
791     test_tde=no
792     test_kde4=yes
793     test_freetype=yes
794     PTHREAD_LIBS="-pthread -lpthread"
795     _os=NetBSD
796     ;;
798 aix*)
799     test_randr=no
800     test_freetype=yes
801     PTHREAD_LIBS=-pthread
802     _os=AIX
803     ;;
805 openbsd*)
806     test_gtk=yes
807     test_tde=yes
808     test_freetype=yes
809     PTHREAD_CFLAGS="-D_THREAD_SAFE"
810     PTHREAD_LIBS="-pthread"
811     _os=OpenBSD
812     ;;
814 dragonfly*)
815     test_gtk=yes
816     build_gstreamer_1_0=yes
817     build_gstreamer_0_10=yes
818     test_tde=yes
819     test_kde4=yes
820     test_freetype=yes
821     PTHREAD_LIBS="-pthread"
822     _os=DragonFly
823     ;;
825 linux-android*)
826     build_gstreamer_1_0=no
827     build_gstreamer_0_10=no
828     enable_lotuswordpro=no
829     enable_mpl_subset=yes
830     enable_coinmp=yes
831     enable_lpsolve=no
832     enable_report_builder=no
833     enable_odk=no
834     enable_postgresql_sdbc=no
835     enable_python=no
836     with_theme="tango"
837     test_cups=no
838     test_dbus=no
839     test_fontconfig=no
840     test_freetype=no
841     test_gtk=no
842     test_tde=no
843     test_kde4=no
844     test_randr=no
845     test_xrender=no
846     _os=Android
848     if test -z "$with_android_ndk"; then
849         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
850     fi
852     if test -z "$with_android_ndk_toolchain_version"; then
853         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
854     fi
856     # Verify that the NDK and SDK options are proper
857     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
858         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
859     fi
861     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
862     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
863     ;;
865 emscripten*)
866     build_gstreamer_1_0=no
867     build_gstreamer_0_10=no
868     enable_lotuswordpro=no
869     enable_mpl_subset=yes
870     enable_coinmp=yes
871     enable_lpsolve=no
872     enable_report_builder=no
873     with_theme="tango"
874     test_cups=no
875     test_dbus=no
876     test_fontconfig=no
877     test_freetype=no
878     test_gtk=no
879     test_tde=no
880     test_kde4=no
881     test_randr=no
882     test_xrender=no
883     _os=Emscripten
884     ;;
887     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
888     ;;
889 esac
891 if echo "$host_os" | grep -q linux-android ; then
892     if test -z "$with_android_sdk"; then
893         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
894     fi
896     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
897         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
898     fi
900     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
901     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
902         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
903                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
904                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
905         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
906         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
907         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
908     fi
909     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
910         AC_MSG_WARN([android support repository not found - install with
911                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
912                      to allow the build to download the specified version of the android support libraries])
913         add_warning "android support repository not found - install with"
914         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
915         add_warning "to allow the build to download the specified version of the android support libraries"
916     fi
919 if test "$_os" = "AIX"; then
920     AC_PATH_PROG(GAWK, gawk)
921     if test -z "$GAWK"; then
922         AC_MSG_ERROR([gawk not found in \$PATH])
923     fi
926 AC_SUBST(SDKDIRNAME)
928 AC_SUBST(WITH_MINGW)
929 AC_SUBST(PTHREAD_CFLAGS)
930 AC_SUBST(PTHREAD_LIBS)
932 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
933 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
934 dnl AC_PROG_CC internally.
935 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
936     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
937     save_CFLAGS=$CFLAGS
938     AC_PROG_CC
939     CFLAGS=$save_CFLAGS
942 if test $_os != "WINNT"; then
943     save_LIBS="$LIBS"
944     AC_SEARCH_LIBS([dlsym], [dl],
945         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
946         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
947     LIBS="$save_LIBS"
949 AC_SUBST(DLOPEN_LIBS)
951 ###############################################################################
952 # Extensions switches --enable/--disable
953 ###############################################################################
954 # By default these should be enabled unless having extra dependencies.
955 # If there is extra dependency over configure options then the enable should
956 # be automagic based on whether the requiring feature is enabled or not.
957 # All this options change anything only with --enable-extension-integration.
959 # The name of this option and its help string makes it sound as if
960 # extensions are built anyway, just not integrated in the installer,
961 # if you use --disable-extension-integration. Is that really the
962 # case?
964 AC_ARG_ENABLE(extension-integration,
965     AS_HELP_STRING([--disable-extension-integration],
966         [Disable integration of the built extensions in the installer of the
967          product. Use this switch to disable the integration.])
970 AC_ARG_ENABLE(export,
971     AS_HELP_STRING([--disable-export],
972         [Disable (some) code for document export. Useful when building viewer-only apps that lack
973          save/export functionality, to avoid having an excessive amount of code and data used
974          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
977 AC_ARG_ENABLE(avmedia,
978     AS_HELP_STRING([--disable-avmedia],
979         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
982 AC_ARG_ENABLE(database-connectivity,
983     AS_HELP_STRING([--disable-database-connectivity],
984         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
987 # This doesn't mean not building (or "integrating") extensions
988 # (although it probably should; i.e. it should imply
989 # --disable-extension-integration I guess), it means not supporting
990 # any extension mechanism at all
991 AC_ARG_ENABLE(extensions,
992     AS_HELP_STRING([--disable-extensions],
993         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
996 AC_ARG_ENABLE(scripting,
997     AS_HELP_STRING([--disable-scripting],
998         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1001 # This is mainly for Android and iOS, but could potentially be used in some
1002 # special case otherwise, too, so factored out as a separate setting
1004 AC_ARG_ENABLE(dynamic-loading,
1005     AS_HELP_STRING([--disable-dynamic-loading],
1006         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1009 AC_ARG_ENABLE(ext-mariadb-connector,
1010     AS_HELP_STRING([--enable-ext-mariadb-connector],
1011         [Enable the build of the MariaDB/MySQL Connector extension.])
1014 AC_ARG_ENABLE(report-builder,
1015     AS_HELP_STRING([--disable-report-builder],
1016         [Disable the Report Builder.])
1019 AC_ARG_ENABLE(ext-wiki-publisher,
1020     AS_HELP_STRING([--enable-ext-wiki-publisher],
1021         [Enable the Wiki Publisher extension.])
1024 AC_ARG_ENABLE(lpsolve,
1025     AS_HELP_STRING([--disable-lpsolve],
1026         [Disable compilation of the lp solve solver ])
1028 AC_ARG_ENABLE(coinmp,
1029     AS_HELP_STRING([--disable-coinmp],
1030         [Disable compilation of the CoinMP solver ])
1033 AC_ARG_ENABLE(pdfimport,
1034     AS_HELP_STRING([--disable-pdfimport],
1035         [Disable building the PDF import feature.])
1038 AC_ARG_ENABLE(pdfium,
1039     AS_HELP_STRING([--disable-pdfium],
1040         [Disable building PDFium.])
1043 ###############################################################################
1045 dnl ---------- *** ----------
1047 AC_ARG_ENABLE(mergelibs,
1048     AS_HELP_STRING([--enable-mergelibs],
1049         [Enables linking of big, merged, library. Experimental feature, tested
1050         only for Linux at some stage in history, but possibly does not work even
1051         for Linux any more. This will link a core set of libraries into libmerged.])
1054 AC_ARG_ENABLE(breakpad,
1055     AS_HELP_STRING([--enable-breakpad],
1056         [Enables breakpad for crash reporting.])
1059 AC_ARG_ENABLE(orcus,
1060     AS_HELP_STRING([--enable-orcus],
1061         [Enables orcus for extra file import filters for Calc.])
1064 AC_ARG_ENABLE(fetch-external,
1065     AS_HELP_STRING([--disable-fetch-external],
1066         [Disables fetching external tarballs from web sources.])
1069 AC_ARG_ENABLE(pch,
1070     AS_HELP_STRING([--enable-pch],
1071         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1074 AC_ARG_ENABLE(epm,
1075     AS_HELP_STRING([--enable-epm],
1076         [LibreOffice includes self-packaging code, that requires epm, however epm is
1077          useless for large scale package building.])
1080 AC_ARG_ENABLE(odk,
1081     AS_HELP_STRING([--disable-odk],
1082         [LibreOffice includes an ODK, office development kit which some packagers may
1083          wish to build without.])
1086 AC_ARG_ENABLE(mpl-subset,
1087     AS_HELP_STRING([--enable-mpl-subset],
1088         [Don't compile any pieces which are not MPL or more liberally licensed])
1091 AC_ARG_ENABLE(evolution2,
1092     AS_HELP_STRING([--enable-evolution2],
1093         [Allows the built-in evolution 2 addressbook connectivity build to be
1094          enabled.])
1097 AC_ARG_ENABLE(directx,
1098     AS_HELP_STRING([--disable-directx],
1099         [Remove DirectX implementation for the new XCanvas interface.
1100          The DirectX support requires more stuff installed on Windows to
1101          compile. (DirectX SDK, GDI+ libs)])
1104 AC_ARG_ENABLE(activex,
1105     AS_HELP_STRING([--disable-activex],
1106         [Disable the use of ActiveX for a Windows build.
1107         This switch is mandatory when using an Express edition of Visual Studio.])
1110 AC_ARG_ENABLE(atl,
1111     AS_HELP_STRING([--disable-atl],
1112         [Disable the use of ATL for a Windows build.])
1113     [
1114         This switch is mandatory when using an Express edition of Visual Studio.
1115     ],
1118 AC_ARG_ENABLE(avahi,
1119     AS_HELP_STRING([--enable-avahi],
1120         [Determines whether to use Avahi to advertise Impress to remote controls.]),
1123 AC_ARG_ENABLE(werror,
1124     AS_HELP_STRING([--enable-werror],
1125         [Turn warnings to errors. (Has no effect in modules where the treating
1126          of warnings as errors is disabled explicitly.)]),
1129 AC_ARG_ENABLE(assert-always-abort,
1130     AS_HELP_STRING([--enable-assert-always-abort],
1131         [make assert() abort even in release code.]),
1134 AC_ARG_ENABLE(dbgutil,
1135     AS_HELP_STRING([--enable-dbgutil],
1136         [Provide debugging support from --enable-debug and include additional debugging
1137          utilities such as object counting or more expensive checks.
1138          This is the recommended option for developers.
1139          Note that this makes the build ABI incompatible, it is not possible to mix object
1140          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1142 AC_ARG_ENABLE(debug,
1143     AS_HELP_STRING([--enable-debug],
1144         [Include debugging information, disable compiler optimization and inlining plus
1145          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1147 AC_ARG_ENABLE(sal-log,
1148     AS_HELP_STRING([--enable-sal-log],
1149         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1151 AC_ARG_ENABLE(selective-debuginfo,
1152     AS_HELP_STRING([--enable-selective-debuginfo],
1153         [If --enable-debug or --enable-dbgutil is used, build debugging information
1154          (-g compiler flag) only for the specified gbuild build targets
1155          (where all means everything, - prepended means not to enable, / appended means
1156          everything in the directory; there is no ordering, more specific overrides
1157          more general, and disabling takes precedence).
1158          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1160 AC_ARG_ENABLE(symbols,
1161     AS_HELP_STRING([--enable-symbols],
1162         [Generate debug information.
1163          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1164          otherwise.]))
1166 AC_ARG_ENABLE(runtime-optimizations,
1167     AS_HELP_STRING([--disable-runtime-optimizations],
1168         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1169          JVM JIT) that are known to interact badly with certain dynamic analysis
1170          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1171          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1172          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1174 AC_ARG_ENABLE(compiler-plugins,
1175     AS_HELP_STRING([--enable-compiler-plugins],
1176         [Enable compiler plugins that will perform additional checks during
1177          building. Enabled automatically by --enable-dbgutil.]))
1179 AC_ARG_ENABLE(ooenv,
1180     AS_HELP_STRING([--disable-ooenv],
1181         [Disable ooenv for the instdir installation.]))
1183 AC_ARG_ENABLE(lto,
1184     AS_HELP_STRING([--enable-lto],
1185         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1186          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1187          linker. For MSVC, this option is broken at the moment. This is experimental work
1188          in progress that shouldn't be used unless you are working on it.)]))
1190 AC_ARG_ENABLE(python,
1191     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1192         [Enables or disables Python support at run-time and build-time.
1193          Also specifies what Python to use. 'auto' is the default.
1194          'fully-internal' even forces the internal version for uses of Python
1195          during the build.]))
1197 AC_ARG_ENABLE(gtk,
1198     AS_HELP_STRING([--disable-gtk],
1199         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1200 ,enable_gtk=yes)
1202 AC_ARG_ENABLE(gtk3,
1203     AS_HELP_STRING([--disable-gtk3],
1204         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1205          This is experimental and may not work.]),
1206 ,enable_gtk3=yes)
1208 AC_ARG_ENABLE(systray,
1209     AS_HELP_STRING([--disable-systray],
1210         [Determines whether to build the systray quickstarter.]),
1211 ,enable_systray=yes)
1213 AC_ARG_ENABLE(split-app-modules,
1214     AS_HELP_STRING([--enable-split-app-modules],
1215         [Split file lists for app modules, e.g. base, calc.
1216          Has effect only with make distro-pack-install]),
1219 AC_ARG_ENABLE(split-opt-features,
1220     AS_HELP_STRING([--enable-split-opt-features],
1221         [Split file lists for some optional features, e.g. pyuno, testtool.
1222          Has effect only with make distro-pack-install]),
1225 AC_ARG_ENABLE(cairo-canvas,
1226     AS_HELP_STRING([--disable-cairo-canvas],
1227         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1230 AC_ARG_ENABLE(dbus,
1231     AS_HELP_STRING([--disable-dbus],
1232         [Determines whether to enable features that depend on dbus.
1233          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1234 ,enable_dbus=yes)
1236 AC_ARG_ENABLE(sdremote,
1237     AS_HELP_STRING([--disable-sdremote],
1238         [Determines whether to enable Impress remote control (i.e. the server component).]),
1239 ,enable_sdremote=yes)
1241 AC_ARG_ENABLE(sdremote-bluetooth,
1242     AS_HELP_STRING([--disable-sdremote-bluetooth],
1243         [Determines whether to build sdremote with bluetooth support.
1244          Requires dbus on Linux.]))
1246 AC_ARG_ENABLE(gio,
1247     AS_HELP_STRING([--disable-gio],
1248         [Determines whether to use the GIO support.]),
1249 ,enable_gio=yes)
1251 AC_ARG_ENABLE(telepathy,
1252     AS_HELP_STRING([--enable-telepathy],
1253         [Determines whether to enable Telepathy for collaboration.]),
1254 ,enable_telepathy=no)
1256 AC_ARG_ENABLE(tde,
1257     AS_HELP_STRING([--enable-tde],
1258         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1259          TDE are available.]),
1262 AC_ARG_ENABLE(tdeab,
1263     AS_HELP_STRING([--disable-tdeab],
1264         [Disable the TDE address book support.]),
1266     if test "$enable_tde" = "yes"; then
1267         enable_tdeab=yes
1268     fi
1271 AC_ARG_ENABLE(kde4,
1272     AS_HELP_STRING([--enable-kde4],
1273         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1274          KDE4 are available.]),
1277 AC_ARG_ENABLE(gui,
1278     AS_HELP_STRING([--disable-gui],
1279         [Disable X11/Wayland support to reduce dependencies. Maybe useful for
1280          headless servers, but soffice --headless works just fine without it.
1281          Work in progress, use only if you are hacking on it.]),
1282 ,enable_gui=yes)
1284 AC_ARG_ENABLE(randr,
1285     AS_HELP_STRING([--disable-randr],
1286         [Disable RandR support in the vcl project.]),
1287 ,enable_randr=yes)
1289 AC_ARG_ENABLE(gstreamer-1-0,
1290     AS_HELP_STRING([--disable-gstreamer-1-0],
1291         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1292 ,enable_gstreamer_1_0=yes)
1294 AC_ARG_ENABLE(gstreamer-0-10,
1295     AS_HELP_STRING([--enable-gstreamer-0-10],
1296         [Enable building with the gstreamer 0.10 avmedia backend.]),
1297 ,enable_gstreamer_0_10=no)
1299 AC_ARG_ENABLE(vlc,
1300     AS_HELP_STRING([--enable-vlc],
1301         [Enable building with the (experimental) VLC avmedia backend.]),
1302 ,enable_vlc=no)
1304 AC_ARG_ENABLE(neon,
1305     AS_HELP_STRING([--disable-neon],
1306         [Disable neon and the compilation of webdav binding.]),
1309 AC_ARG_ENABLE([eot],
1310     [AS_HELP_STRING([--enable-eot],
1311         [Enable support for Embedded OpenType fonts.])],
1312 , [enable_eot=no])
1314 AC_ARG_ENABLE(cve-tests,
1315     AS_HELP_STRING([--disable-cve-tests],
1316         [Prevent CVE tests to be executed]),
1319 AC_ARG_ENABLE(chart-tests,
1320     AS_HELP_STRING([--enable-chart-tests],
1321         [Executes chart XShape tests. In a perfect world these tests would be
1322          stable and everyone could run them, in reality it is best to run them
1323          only on a few machines that are known to work and maintained by people
1324          who can judge if a test failure is a regression or not.]),
1327 AC_ARG_ENABLE(build-unowinreg,
1328     AS_HELP_STRING([--enable-build-unowinreg],
1329         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1330          compiler is needed on Linux.]),
1333 AC_ARG_ENABLE(dependency-tracking,
1334     AS_HELP_STRING([--enable-dependency-tracking],
1335         [Do not reject slow dependency extractors.])[
1336   --disable-dependency-tracking
1337                           Disables generation of dependency information.
1338                           Speed up one-time builds.],
1341 AC_ARG_ENABLE(icecream,
1342     AS_HELP_STRING([--enable-icecream],
1343         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1344          It defaults to /opt/icecream for the location of the icecream gcc/g++
1345          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1348 AC_ARG_ENABLE(cups,
1349     AS_HELP_STRING([--disable-cups],
1350         [Do not build cups support.])
1353 AC_ARG_ENABLE(ccache,
1354     AS_HELP_STRING([--disable-ccache],
1355         [Do not try to use ccache automatically.
1356          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1357          CC/CXX are not yet set, and --enable-icecream is not given, we
1358          attempt to use ccache. --disable-ccache disables ccache completely.
1362 AC_ARG_ENABLE(64-bit,
1363     AS_HELP_STRING([--enable-64-bit],
1364         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1365          At the moment meaningful only for iOS and Windows.]), ,)
1367 AC_ARG_ENABLE(online-update,
1368     AS_HELP_STRING([--enable-online-update],
1369         [Enable the online update service that will check for new versions of
1370          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1371          If the value is "mar", the experimental Mozilla-like update will be
1372          enabled instead of the traditional update mechanism.]),
1375 AC_ARG_ENABLE(extension-update,
1376     AS_HELP_STRING([--disable-extension-update],
1377         [Disable possibility to update installed extensions.]),
1380 AC_ARG_ENABLE(release-build,
1381     AS_HELP_STRING([--enable-release-build],
1382         [Enable release build.
1383          See http://wiki.documentfoundation.org/Development/DevBuild]),
1386 AC_ARG_ENABLE(windows-build-signing,
1387     AS_HELP_STRING([--enable-windows-build-signing],
1388         [Enable signing of windows binaries (*.exe, *.dll)]),
1391 AC_ARG_ENABLE(silent-msi,
1392     AS_HELP_STRING([--enable-silent-msi],
1393         [Enable MSI with LIMITUI=1 (silent install).]),
1396 AC_ARG_ENABLE(macosx-code-signing,
1397     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1398         [Sign executables, dylibs, frameworks and the app bundle. If you
1399          don't provide an identity the first suitable certificate
1400          in your keychain is used.]),
1403 AC_ARG_ENABLE(macosx-package-signing,
1404     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1405         [Create a .pkg suitable for uploading to the Mac App Store and sign
1406          it. If you don't provide an identity the first suitable certificate
1407          in your keychain is used.]),
1410 AC_ARG_ENABLE(macosx-sandbox,
1411     AS_HELP_STRING([--enable-macosx-sandbox],
1412         [Make the app bundle run in a sandbox. Requires code signing.
1413          Is required by apps distributed in the Mac App Store, and implies
1414          adherence to App Store rules.]),
1417 AC_ARG_WITH(macosx-bundle-identifier,
1418     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1419         [Define the OS X bundle identifier. Default is the somewhat weird
1420          org.libreoffice.script ("script", huh?).]),
1421 ,with_macosx_bundle_identifier=org.libreoffice.script)
1423 AC_ARG_WITH(product-name,
1424     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1425         [Define the product name. Default is AC_PACKAGE_NAME.]),
1426 ,with_product_name=$PRODUCTNAME)
1428 AC_ARG_WITH(package-version,
1429     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1430         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1433 AC_ARG_ENABLE(ios-simulator,
1434     AS_HELP_STRING([--enable-ios-simulator],
1435         [Build for the iOS Simulator, not iOS device.]),
1438 AC_ARG_ENABLE(readonly-installset,
1439     AS_HELP_STRING([--enable-readonly-installset],
1440         [Prevents any attempts by LibreOffice to write into its installation. That means
1441          at least that no "system-wide" extensions can be added. Experimental work in
1442          progress.]),
1445 AC_ARG_ENABLE(postgresql-sdbc,
1446     AS_HELP_STRING([--disable-postgresql-sdbc],
1447         [Disable the build of the PostgreSQL-SDBC driver.])
1450 AC_ARG_ENABLE(lotuswordpro,
1451     AS_HELP_STRING([--disable-lotuswordpro],
1452         [Disable the build of the Lotus Word Pro filter.]),
1453 ,enable_lotuswordpro=yes)
1455 AC_ARG_ENABLE(firebird-sdbc,
1456     AS_HELP_STRING([--disable-firebird-sdbc],
1457         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1458 ,enable_firebird_sdbc=yes)
1460 AC_ARG_ENABLE(winegcc,
1461     AS_HELP_STRING([--enable-winegcc],
1462         [Enable use of winegcc during the build, in order to create msi* tools
1463          needed for MinGW cross-compilation.]),
1466 AC_ARG_ENABLE(liblangtag,
1467     AS_HELP_STRING([--disable-liblangtag],
1468         [Disable use of liblangtag, and instead use an own simple
1469          implementation.]),
1472 AC_ARG_ENABLE(bogus-pkg-config,
1473     AS_HELP_STRING([--enable-bogus-pkg-config],
1474         [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.]),
1477 AC_ARG_ENABLE(openssl,
1478     AS_HELP_STRING([--disable-openssl],
1479         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1480          components will either use GNUTLS or NSS. Work in progress,
1481          use only if you are hacking on it.]),
1482 ,enable_openssl=yes)
1484 AC_ARG_ENABLE(library-bin-tar,
1485     AS_HELP_STRING([--enable-library-bin-tar],
1486         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1487         Some libraries can save their build result in a tarball
1488         stored in TARFILE_LOCATION. That binary tarball is
1489         uniquely identified by the source tarball,
1490         the content of the config_host.mk file and the content
1491         of the top-level directory in core for that library
1492         If this option is enabled, then if such a tarfile exist, it will be untarred
1493         instead of the source tarfile, and the build step will be skipped for that
1494         library.
1495         If a proper tarfile does not exist, then the normal source-based
1496         build is done for that library and a proper binary tarfile is created
1497         for the next time.]),
1500 AC_ARG_ENABLE(gltf,
1501     AS_HELP_STRING([--disable-gltf],
1502         [Determines whether to build libraries related to glTF 3D model rendering.]))
1504 AC_ARG_ENABLE(collada,
1505     AS_HELP_STRING([--disable-collada],
1506         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1508 AC_ARG_ENABLE(dconf,
1509     AS_HELP_STRING([--disable-dconf],
1510         [Disable the dconf configuration backend (enabled by default where
1511          available).]))
1513 AC_ARG_ENABLE(formula-logger,
1514     AS_HELP_STRING(
1515         [--enable-formula-logger],
1516         [Enable formula logger for logging formula calculation flow in Calc.]
1517     )
1520 dnl ===================================================================
1521 dnl Optional Packages (--with/without-)
1522 dnl ===================================================================
1524 AC_ARG_WITH(gcc-home,
1525     AS_HELP_STRING([--with-gcc-home],
1526         [Specify the location of gcc/g++ manually. This can be used in conjunction
1527          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1528          non-default path.]),
1531 AC_ARG_WITH(gnu-patch,
1532     AS_HELP_STRING([--with-gnu-patch],
1533         [Specify location of GNU patch on Solaris or FreeBSD.]),
1536 AC_ARG_WITH(build-platform-configure-options,
1537     AS_HELP_STRING([--with-build-platform-configure-options],
1538         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1541 AC_ARG_WITH(gnu-cp,
1542     AS_HELP_STRING([--with-gnu-cp],
1543         [Specify location of GNU cp on Solaris or FreeBSD.]),
1546 AC_ARG_WITH(external-tar,
1547     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1548         [Specify an absolute path of where to find (and store) tarfiles.]),
1549     TARFILE_LOCATION=$withval ,
1552 AC_ARG_WITH(referenced-git,
1553     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1554         [Specify another checkout directory to reference. This makes use of
1555                  git submodule update --reference, and saves a lot of diskspace
1556                  when having multiple trees side-by-side.]),
1557     GIT_REFERENCE_SRC=$withval ,
1560 AC_ARG_WITH(linked-git,
1561     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1562         [Specify a directory where the repositories of submodules are located.
1563          This uses a method similar to git-new-workdir to get submodules.]),
1564     GIT_LINK_SRC=$withval ,
1567 AC_ARG_WITH(galleries,
1568     AS_HELP_STRING([--with-galleries],
1569         [Specify how galleries should be built. It is possible either to
1570          build these internally from source ("build"),
1571          or to disable them ("no")]),
1574 AC_ARG_WITH(theme,
1575     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1576         [Choose which themes to include. By default those themes with an '*' are included.
1577          Possible choices: *breeze, *breeze_dark, crystal, *galaxy, *hicontrast, *oxygen, *sifr, *tango, *tango_testing.]),
1580 AC_ARG_WITH(helppack-integration,
1581     AS_HELP_STRING([--without-helppack-integration],
1582         [It will not integrate the helppacks to the installer
1583          of the product. Please use this switch to use the online help
1584          or separate help packages.]),
1587 AC_ARG_WITH(fonts,
1588     AS_HELP_STRING([--without-fonts],
1589         [LibreOffice includes some third-party fonts to provide a reliable basis for
1590          help content, templates, samples, etc. When these fonts are already
1591          known to be available on the system then you should use this option.]),
1594 AC_ARG_ENABLE(noto-font,
1595     AS_HELP_STRING([--enable-noto-font],
1596         [Add Google Noto font.]),
1599 AC_ARG_WITH(epm,
1600     AS_HELP_STRING([--with-epm],
1601         [Decides which epm to use. Default is to use the one from the system if
1602          one is built. When either this is not there or you say =internal epm
1603          will be built.]),
1606 AC_ARG_WITH(package-format,
1607     AS_HELP_STRING([--with-package-format],
1608         [Specify package format(s) for LibreOffice installation sets. The
1609          implicit --without-package-format leads to no installation sets being
1610          generated. Possible values: aix, archive, bsd, deb, dmg,
1611          installed, msi, pkg, and rpm.
1612          Example: --with-package-format='deb rpm']),
1615 AC_ARG_WITH(tls,
1616     AS_HELP_STRING([--with-tls],
1617         [Decides which TLS/SSL and cryptographic implementations to use for
1618          LibreOffice's code. Notice that this doesn't apply for depending
1619          libraries like "neon", for example. Default is to use OpenSSL
1620          although NSS is also possible. Notice that selecting NSS restricts
1621          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1622          restrict by now the usage of NSS in LO's code. Possible values:
1623          openssl, nss. Example: --with-tls="nss"]),
1626 AC_ARG_WITH(system-libs,
1627     AS_HELP_STRING([--with-system-libs],
1628         [Use libraries already on system -- enables all --with-system-* flags.]),
1631 AC_ARG_WITH(system-bzip2,
1632     AS_HELP_STRING([--with-system-bzip2],
1633         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1634     [with_system_bzip2="$with_system_libs"])
1636 AC_ARG_WITH(system-headers,
1637     AS_HELP_STRING([--with-system-headers],
1638         [Use headers already on system -- enables all --with-system-* flags for
1639          external packages whose headers are the only entities used i.e.
1640          boost/odbc/sane-header(s).]),,
1641     [with_system_headers="$with_system_libs"])
1643 AC_ARG_WITH(system-jars,
1644     AS_HELP_STRING([--without-system-jars],
1645         [When building with --with-system-libs, also the needed jars are expected
1646          on the system. Use this to disable that]),,
1647     [with_system_jars="$with_system_libs"])
1649 AC_ARG_WITH(system-cairo,
1650     AS_HELP_STRING([--with-system-cairo],
1651         [Use cairo libraries already on system.  Happens automatically for
1652          (implicit) --enable-gtk and for --enable-gtk3.]))
1654 AC_ARG_WITH(myspell-dicts,
1655     AS_HELP_STRING([--with-myspell-dicts],
1656         [Adds myspell dictionaries to the LibreOffice installation set]),
1659 AC_ARG_WITH(system-dicts,
1660     AS_HELP_STRING([--without-system-dicts],
1661         [Do not use dictionaries from system paths.]),
1664 AC_ARG_WITH(external-dict-dir,
1665     AS_HELP_STRING([--with-external-dict-dir],
1666         [Specify external dictionary dir.]),
1669 AC_ARG_WITH(external-hyph-dir,
1670     AS_HELP_STRING([--with-external-hyph-dir],
1671         [Specify external hyphenation pattern dir.]),
1674 AC_ARG_WITH(external-thes-dir,
1675     AS_HELP_STRING([--with-external-thes-dir],
1676         [Specify external thesaurus dir.]),
1679 AC_ARG_WITH(system-zlib,
1680     AS_HELP_STRING([--with-system-zlib],
1681         [Use zlib already on system.]),,
1682     [with_system_zlib=auto])
1684 AC_ARG_WITH(system-jpeg,
1685     AS_HELP_STRING([--with-system-jpeg],
1686         [Use jpeg already on system.]),,
1687     [with_system_jpeg="$with_system_libs"])
1689 AC_ARG_WITH(system-libgltf,
1690     AS_HELP_STRING([--with-system-libgltf],
1691         [Use libgltf already on system.]),,
1692     [with_system_libgltf="$with_system_libs"])
1694 AC_ARG_WITH(system-clucene,
1695     AS_HELP_STRING([--with-system-clucene],
1696         [Use clucene already on system.]),,
1697     [with_system_clucene="$with_system_libs"])
1699 AC_ARG_WITH(system-expat,
1700     AS_HELP_STRING([--with-system-expat],
1701         [Use expat already on system.]),,
1702     [with_system_expat="$with_system_libs"])
1704 AC_ARG_WITH(system-libxml,
1705     AS_HELP_STRING([--with-system-libxml],
1706         [Use libxml/libxslt already on system.]),,
1707     [with_system_libxml=auto])
1709 AC_ARG_WITH(system-icu,
1710     AS_HELP_STRING([--with-system-icu],
1711         [Use icu already on system.]),,
1712     [with_system_icu="$with_system_libs"])
1714 AC_ARG_WITH(system-ucpp,
1715     AS_HELP_STRING([--with-system-ucpp],
1716         [Use ucpp already on system.]),,
1717     [])
1719 AC_ARG_WITH(system-opencollada,
1720     AS_HELP_STRING([--with-system-opencollada],
1721         [Use openCOLLADA already on system.]),,
1722     [with_system_opencollada=no])
1724 AC_ARG_WITH(system-collada2gltf,
1725     AS_HELP_STRING([--with-system-collada2gltf],
1726         [Use collada2gltf already on system.]),,
1727     [with_system_collada2gltf=no])
1729 AC_ARG_WITH(system-openldap,
1730     AS_HELP_STRING([--with-system-openldap],
1731         [Use the OpenLDAP LDAP SDK already on system.]),,
1732     [with_system_openldap="$with_system_libs"])
1734 AC_ARG_WITH(system-poppler,
1735     AS_HELP_STRING([--with-system-poppler],
1736         [Use system poppler (only needed for PDF import).]),,
1737     [with_system_poppler="$with_system_libs"])
1739 AC_ARG_WITH(system-apache-commons,
1740     AS_HELP_STRING([--with-system-apache-commons],
1741         [Use Apache commons libraries already on system.]),,
1742     [with_system_apache_commons="$with_system_jars"])
1744 AC_ARG_WITH(system-mariadb,
1745     AS_HELP_STRING([--with-system-mariadb],
1746         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1747          extension.]),,
1748     [with_system_mariadb="$with_system_libs"])
1750 AC_ARG_ENABLE(bundle-mariadb,
1751     AS_HELP_STRING([--enable-bundle-mariadb],
1752         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1755 AC_ARG_WITH(system-mysql-cppconn,
1756     AS_HELP_STRING([--with-system-mysql-cppconn],
1757         [Use MySQL C++ Connector libraries already on system.]),,
1758     [with_system_mysql_cppconn="$with_system_libs"])
1760 AC_ARG_WITH(system-postgresql,
1761     AS_HELP_STRING([--with-system-postgresql],
1762         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1763          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1764     [with_system_postgresql="$with_system_libs"])
1766 AC_ARG_WITH(libpq-path,
1767     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1768         [Use this PostgreSQL C interface (libpq) installation for building
1769          the PostgreSQL-SDBC extension.]),
1772 AC_ARG_WITH(system-firebird,
1773     AS_HELP_STRING([--with-system-firebird],
1774         [Use Firebird libraries already on system, for building the Firebird-SDBC
1775          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1776     [with_system_firebird="$with_system_libs"])
1778 AC_ARG_WITH(system-libtommath,
1779             AS_HELP_STRING([--with-system-libtommath],
1780                            [Use libtommath already on system]),,
1781             [with_system_libtommath="$with_system_libs"])
1783 AC_ARG_WITH(system-hsqldb,
1784     AS_HELP_STRING([--with-system-hsqldb],
1785         [Use hsqldb already on system.]))
1787 AC_ARG_WITH(hsqldb-jar,
1788     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1789         [Specify path to jarfile manually.]),
1790     HSQLDB_JAR=$withval)
1792 AC_ARG_ENABLE(scripting-beanshell,
1793     AS_HELP_STRING([--disable-scripting-beanshell],
1794         [Disable support for scripts in BeanShell.]),
1798 AC_ARG_WITH(system-beanshell,
1799     AS_HELP_STRING([--with-system-beanshell],
1800         [Use beanshell already on system.]),,
1801     [with_system_beanshell="$with_system_jars"])
1803 AC_ARG_WITH(beanshell-jar,
1804     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1805         [Specify path to jarfile manually.]),
1806     BSH_JAR=$withval)
1808 AC_ARG_ENABLE(scripting-javascript,
1809     AS_HELP_STRING([--disable-scripting-javascript],
1810         [Disable support for scripts in JavaScript.]),
1814 AC_ARG_WITH(system-rhino,
1815     AS_HELP_STRING([--with-system-rhino],
1816         [Use rhino already on system.]),,)
1817 #    [with_system_rhino="$with_system_jars"])
1818 # Above is not used as we have different debug interface
1819 # patched into internal rhino. This code needs to be fixed
1820 # before we can enable it by default.
1822 AC_ARG_WITH(rhino-jar,
1823     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1824         [Specify path to jarfile manually.]),
1825     RHINO_JAR=$withval)
1827 AC_ARG_WITH(commons-codec-jar,
1828     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1829         [Specify path to jarfile manually.]),
1830     COMMONS_CODEC_JAR=$withval)
1832 AC_ARG_WITH(commons-lang-jar,
1833     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1834         [Specify path to jarfile manually.]),
1835     COMMONS_LANG_JAR=$withval)
1837 AC_ARG_WITH(commons-httpclient-jar,
1838     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1839         [Specify path to jarfile manually.]),
1840     COMMONS_HTTPCLIENT_JAR=$withval)
1842 AC_ARG_WITH(commons-logging-jar,
1843     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1844         [Specify path to jarfile manually.]),
1845     COMMONS_LOGGING_JAR=$withval)
1847 AC_ARG_WITH(system-jfreereport,
1848     AS_HELP_STRING([--with-system-jfreereport],
1849         [Use JFreeReport already on system.]),,
1850     [with_system_jfreereport="$with_system_jars"])
1852 AC_ARG_WITH(sac-jar,
1853     AS_HELP_STRING([--with-sac-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     SAC_JAR=$withval)
1857 AC_ARG_WITH(libxml-jar,
1858     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     LIBXML_JAR=$withval)
1862 AC_ARG_WITH(flute-jar,
1863     AS_HELP_STRING([--with-flute-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     FLUTE_JAR=$withval)
1867 AC_ARG_WITH(jfreereport-jar,
1868     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     JFREEREPORT_JAR=$withval)
1872 AC_ARG_WITH(liblayout-jar,
1873     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     LIBLAYOUT_JAR=$withval)
1877 AC_ARG_WITH(libloader-jar,
1878     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     LIBLOADER_JAR=$withval)
1882 AC_ARG_WITH(libformula-jar,
1883     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     LIBFORMULA_JAR=$withval)
1887 AC_ARG_WITH(librepository-jar,
1888     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBREPOSITORY_JAR=$withval)
1892 AC_ARG_WITH(libfonts-jar,
1893     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1894         [Specify path to jarfile manually.]),
1895     LIBFONTS_JAR=$withval)
1897 AC_ARG_WITH(libserializer-jar,
1898     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1899         [Specify path to jarfile manually.]),
1900     LIBSERIALIZER_JAR=$withval)
1902 AC_ARG_WITH(libbase-jar,
1903     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1904         [Specify path to jarfile manually.]),
1905     LIBBASE_JAR=$withval)
1907 AC_ARG_WITH(system-odbc,
1908     AS_HELP_STRING([--with-system-odbc],
1909         [Use the odbc headers already on system.]),,
1910     [with_system_odbc="auto"])
1912 AC_ARG_WITH(system-sane,
1913     AS_HELP_STRING([--with-system-sane],
1914         [Use sane.h already on system.]),,
1915     [with_system_sane="$with_system_headers"])
1917 AC_ARG_WITH(system-bluez,
1918     AS_HELP_STRING([--with-system-bluez],
1919         [Use bluetooth.h already on system.]),,
1920     [with_system_bluez="$with_system_headers"])
1922 AC_ARG_WITH(system-curl,
1923     AS_HELP_STRING([--with-system-curl],
1924         [Use curl already on system.]),,
1925     [with_system_curl=auto])
1927 AC_ARG_WITH(system-boost,
1928     AS_HELP_STRING([--with-system-boost],
1929         [Use boost already on system.]),,
1930     [with_system_boost="$with_system_headers"])
1932 AC_ARG_WITH(system-glm,
1933     AS_HELP_STRING([--with-system-glm],
1934         [Use glm already on system.]),,
1935     [with_system_glm="$with_system_headers"])
1937 AC_ARG_WITH(system-hunspell,
1938     AS_HELP_STRING([--with-system-hunspell],
1939         [Use libhunspell already on system.]),,
1940     [with_system_hunspell="$with_system_libs"])
1942 AC_ARG_WITH(system-mythes,
1943     AS_HELP_STRING([--with-system-mythes],
1944         [Use mythes already on system.]),,
1945     [with_system_mythes="$with_system_libs"])
1947 AC_ARG_WITH(system-altlinuxhyph,
1948     AS_HELP_STRING([--with-system-altlinuxhyph],
1949         [Use ALTLinuxhyph already on system.]),,
1950     [with_system_altlinuxhyph="$with_system_libs"])
1952 AC_ARG_WITH(system-lpsolve,
1953     AS_HELP_STRING([--with-system-lpsolve],
1954         [Use lpsolve already on system.]),,
1955     [with_system_lpsolve="$with_system_libs"])
1957 AC_ARG_WITH(system-coinmp,
1958     AS_HELP_STRING([--with-system-coinmp],
1959         [Use CoinMP already on system.]),,
1960     [with_system_coinmp="$with_system_libs"])
1962 AC_ARG_WITH(system-liblangtag,
1963     AS_HELP_STRING([--with-system-liblangtag],
1964         [Use liblangtag library already on system.]),,
1965     [with_system_liblangtag="$with_system_libs"])
1967 AC_ARG_WITH(jpeg-turbo,
1968     AS_HELP_STRING([--with-jpeg-turbo],
1969         [Use internal libjpeg-turbo library.]),,
1970     [with_jpeg_turbo=auto])
1972 AC_ARG_WITH(webdav,
1973     AS_HELP_STRING([--with-webdav],
1974         [Specify which library to use for webdav implementation.
1975          Possible values: "neon", "serf", "no". The default value is "neon".
1976          Example: --with-webdav="serf"]),
1977     WITH_WEBDAV=$withval,
1978     WITH_WEBDAV="neon")
1980 AC_ARG_WITH(linker-hash-style,
1981     AS_HELP_STRING([--with-linker-hash-style],
1982         [Use linker with --hash-style=<style> when linking shared objects.
1983          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1984          if supported on the build system, and "sysv" otherwise.]))
1986 AC_ARG_WITH(jdk-home,
1987     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1988         [If you have installed JDK 1.3 or later on your system please supply the
1989          path here. Note that this is not the location of the java command but the
1990          location of the entire distribution.]),
1993 AC_ARG_WITH(help,
1994     AS_HELP_STRING([--with-help],
1995         [Enable the build of help. There is a special parameter "common" that
1996          can be used to bundle only the common part, .e.g help-specific icons.
1997          This is useful when you build the helpcontent separately.])
1998     [
1999                           Usage:     --with-help    build the entire local help
2000                                  --without-help     no local help (default)
2001                                  --with-help=common bundle common files for the local
2002                                                     help but do not build the whole help
2003     ],
2006 AC_ARG_WITH(java,
2007     AS_HELP_STRING([--with-java=<java command>],
2008         [Specify the name of the Java interpreter command. Typically "java"
2009          which is the default.
2011          To build without support for Java components, applets, accessibility
2012          or the XML filters written in Java, use --without-java or --with-java=no.]),
2013     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2014     [ with_java=java ]
2017 AC_ARG_WITH(jvm-path,
2018     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2019         [Use a specific JVM search path at runtime.
2020          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2023 AC_ARG_WITH(ant-home,
2024     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2025         [If you have installed Jakarta Ant on your system, please supply the path here.
2026          Note that this is not the location of the Ant binary but the location
2027          of the entire distribution.]),
2030 AC_ARG_WITH(symbol-config,
2031     AS_HELP_STRING([--with-symbol-config],
2032         [Configuration for the crashreport symbol upload]),
2033         [],
2034         [with_symbol_config=no])
2036 AC_ARG_WITH(export-validation,
2037     AS_HELP_STRING([--without-export-validation],
2038         [Disable validating OOXML and ODF files as exported from in-tree tests.
2039          Use this option e.g. if your system only provides Java 5.]),
2040 ,with_export_validation=yes)
2042 AC_ARG_WITH(bffvalidator,
2043     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2044         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2045          Requires installed Microsoft Office Binary File Format Validator.
2046          Note: export-validation (--with-export-validation) is required to be turned on.
2047          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2048 ,with_bffvalidator=no)
2050 AC_ARG_WITH(junit,
2051     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2052         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2053          --without-junit disables those tests. Not relevant in the --without-java case.]),
2054 ,with_junit=yes)
2056 AC_ARG_WITH(hamcrest,
2057     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2058         [Specifies the hamcrest jar file to use for JUnit-based tests.
2059          --without-junit disables those tests. Not relevant in the --without-java case.]),
2060 ,with_hamcrest=yes)
2062 AC_ARG_WITH(perl-home,
2063     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2064         [If you have installed Perl 5 Distribution, on your system, please
2065          supply the path here. Note that this is not the location of the Perl
2066          binary but the location of the entire distribution.]),
2069 AC_ARG_WITH(doxygen,
2070     AS_HELP_STRING(
2071         [--with-doxygen=<absolute path to doxygen executable>],
2072         [Specifies the doxygen executable to use when generating ODK C/C++
2073          documentation. --without-doxygen disables generation of ODK C/C++
2074          documentation. Not relevant in the --disable-odk case.]),
2075 ,with_doxygen=yes)
2077 AC_ARG_WITH(visual-studio,
2078     AS_HELP_STRING([--with-visual-studio=<2013/2015>],
2079         [Specify which Visual Studio version to use in case several are
2080          installed. If not specified, only 2013 is detected automatically
2081          because 2015 support is currently experimental.]),
2084 AC_ARG_WITH(windows-sdk,
2085     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2086         [Specify which Windows SDK, or "Windows Kit", version to use
2087          in case the one that came with the selected Visual Studio
2088          is not what you want for some reason. Note that not all compiler/SDK
2089          combinations are supported. The intent is that this option should not
2090          be needed.]),
2093 AC_ARG_WITH(lang,
2094     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2095         [Use this option to build LibreOffice with additional UI language support.
2096          English (US) is always included by default.
2097          Separate multiple languages with space.
2098          For all languages, use --with-lang=ALL.]),
2101 AC_ARG_WITH(locales,
2102     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2103         [Use this option to limit the locale information built in.
2104          Separate multiple locales with space.
2105          Very experimental and might well break stuff.
2106          Just a desperate measure to shrink code and data size.
2107          By default all the locales available is included.
2108          This option is completely unrelated to --with-lang.])
2109     [
2110                           Affects also our character encoding conversion
2111                           tables for encodings mainly targeted for a
2112                           particular locale, like EUC-CN and EUC-TW for
2113                           zh, ISO-2022-JP for ja.
2115                           Affects also our add-on break iterator data for
2116                           some languages.
2118                           For the default, all locales, don't use this switch at all.
2119                           Specifying just the language part of a locale means all matching
2120                           locales will be included.
2121     ],
2124 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2125 AC_ARG_WITH(krb5,
2126     AS_HELP_STRING([--with-krb5],
2127         [Enable MIT Kerberos 5 support in modules that support it.
2128          By default automatically enabled on platforms
2129          where a good system Kerberos 5 is available.]),
2132 AC_ARG_WITH(gssapi,
2133     AS_HELP_STRING([--with-gssapi],
2134         [Enable GSSAPI support in modules that support it.
2135          By default automatically enabled on platforms
2136          where a good system GSSAPI is available.]),
2139 AC_ARG_WITH(iwyu,
2140     AS_HELP_STRING([--with-iwyu],
2141         [Use given IWYU binary path to check unneeded includes instead of building.
2142          Use only if you are hacking on it.]),
2145 dnl ===================================================================
2146 dnl Branding
2147 dnl ===================================================================
2149 AC_ARG_WITH(branding,
2150     AS_HELP_STRING([--with-branding=/path/to/images],
2151         [Use given path to retrieve branding images set.])
2152     [
2153                           Search for intro.png about.svg and flat_logo.svg.
2154                           If any is missing, default ones will be used instead.
2156                           Search also progress.conf for progress
2157                           settings on intro screen :
2159                           PROGRESSBARCOLOR="255,255,255" Set color of
2160                           progress bar. Comma separated RGB decimal values.
2161                           PROGRESSSIZE="407,6" Set size of progress bar.
2162                           Comma separated decimal values (width, height).
2163                           PROGRESSPOSITION="61,317" Set position of progress
2164                           bar from left,top. Comma separated decimal values.
2165                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2166                           bar frame. Comma separated RGB decimal values.
2167                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2168                           bar text. Comma separated RGB decimal values.
2169                           PROGRESSTEXTBASELINE="287" Set vertical position of
2170                           progress bar text from top. Decimal value.
2172                           Default values will be used if not found.
2173     ],
2177 AC_ARG_WITH(extra-buildid,
2178     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2179         [Show addition build identification in about dialog.]),
2183 AC_ARG_WITH(vendor,
2184     AS_HELP_STRING([--with-vendor="John the Builder"],
2185         [Set vendor of the build.]),
2188 AC_ARG_WITH(android-package-name,
2189     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2190         [Set Android package name of the build.]),
2193 AC_ARG_WITH(compat-oowrappers,
2194     AS_HELP_STRING([--with-compat-oowrappers],
2195         [Install oo* wrappers in parallel with
2196          lo* ones to keep backward compatibility.
2197          Has effect only with make distro-pack-install]),
2200 AC_ARG_WITH(os-version,
2201     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2202         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2205 AC_ARG_WITH(mingw-cross-compiler,
2206     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2207         [Specify the MinGW cross-compiler to use.
2208          When building on the ODK on Unix and building unowinreg.dll,
2209          specify the MinGW C++ cross-compiler.]),
2212 AC_ARG_WITH(idlc-cpp,
2213     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2214         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2217 AC_ARG_WITH(build-version,
2218     AS_HELP_STRING([--with-build-version="Built by Jim"],
2219         [Allows the builder to add a custom version tag that will appear in the
2220          Help/About box for QA purposes.]),
2221 with_build_version=$withval,
2224 AC_ARG_WITH(alloc,
2225     AS_HELP_STRING([--with-alloc],
2226         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2227          Note that on FreeBSD/NetBSD system==jemalloc]),
2230 AC_ARG_WITH(parallelism,
2231     AS_HELP_STRING([--with-parallelism],
2232         [Number of jobs to run simultaneously during build. Parallel builds can
2233         save a lot of time on multi-cpu machines. Defaults to the number of
2234         CPUs on the machine, unless you configure --enable-icecream - then to
2235         10.]),
2238 AC_ARG_WITH(all-tarballs,
2239     AS_HELP_STRING([--with-all-tarballs],
2240         [Download all external tarballs unconditionally]))
2242 AC_ARG_WITH(gdrive-client-id,
2243     AS_HELP_STRING([--with-gdrive-client-id],
2244         [Provides the client id of the application for OAuth2 authentication
2245         on Google Drive. If either this or --with-gdrive-client-secret is
2246         empty, the feature will be disabled]),
2249 AC_ARG_WITH(gdrive-client-secret,
2250     AS_HELP_STRING([--with-gdrive-client-secret],
2251         [Provides the client secret of the application for OAuth2
2252         authentication on Google Drive. If either this or
2253         --with-gdrive-client-id is empty, the feature will be disabled]),
2256 AC_ARG_WITH(alfresco-cloud-client-id,
2257     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2258         [Provides the client id of the application for OAuth2 authentication
2259         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2260         empty, the feature will be disabled]),
2263 AC_ARG_WITH(alfresco-cloud-client-secret,
2264     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2265         [Provides the client secret of the application for OAuth2
2266         authentication on Alfresco Cloud. If either this or
2267         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2270 AC_ARG_WITH(onedrive-client-id,
2271     AS_HELP_STRING([--with-onedrive-client-id],
2272         [Provides the client id of the application for OAuth2 authentication
2273         on OneDrive. If either this or --with-onedrive-client-secret is
2274         empty, the feature will be disabled]),
2277 AC_ARG_WITH(onedrive-client-secret,
2278     AS_HELP_STRING([--with-onedrive-client-secret],
2279         [Provides the client secret of the application for OAuth2
2280         authentication on OneDrive. If either this or
2281         --with-onedrive-client-id is empty, the feature will be disabled]),
2283 dnl ===================================================================
2284 dnl Do we want to use pre-build binary tarball for recompile
2285 dnl ===================================================================
2287 if test "$enable_library_bin_tar" = "yes" ; then
2288     USE_LIBRARY_BIN_TAR=TRUE
2289 else
2290     USE_LIBRARY_BIN_TAR=
2292 AC_SUBST(USE_LIBRARY_BIN_TAR)
2294 dnl ===================================================================
2295 dnl Test whether build target is Release Build
2296 dnl ===================================================================
2297 AC_MSG_CHECKING([whether build target is Release Build])
2298 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2299     AC_MSG_RESULT([no])
2300     ENABLE_RELEASE_BUILD=
2301 else
2302     AC_MSG_RESULT([yes])
2303     ENABLE_RELEASE_BUILD=TRUE
2305 AC_SUBST(ENABLE_RELEASE_BUILD)
2307 dnl ===================================================================
2308 dnl Test whether to sign Windows Build
2309 dnl ===================================================================
2310 AC_MSG_CHECKING([whether to sign windows build])
2311 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2312     AC_MSG_RESULT([yes])
2313     WINDOWS_BUILD_SIGNING="TRUE"
2314 else
2315     AC_MSG_RESULT([no])
2316     WINDOWS_BUILD_SIGNING="FALSE"
2318 AC_SUBST(WINDOWS_BUILD_SIGNING)
2320 dnl ===================================================================
2321 dnl MacOSX build and runtime environment options
2322 dnl ===================================================================
2324 AC_ARG_WITH(macosx-sdk,
2325     AS_HELP_STRING([--with-macosx-sdk=<version>],
2326         [Prefer a specific SDK for building.])
2327     [
2328                           If the requested SDK is not available, a search for the oldest one will be done.
2329                           With current Xcode versions, only the latest SDK is included, so this option is
2330                           not terribly useful. It works fine to build with a new SDK and run the result
2331                           on an older OS.
2333                           e. g.: --with-macosx-sdk=10.8
2335                           there are 3 options to control the MacOSX build:
2336                           --with-macosx-sdk (referred as 'sdk' below)
2337                           --with-macosx-version-min-required (referred as 'min' below)
2338                           --with-macosx-version-max-allowed (referred as 'max' below)
2340                           the connection between these value and the default they take is as follow:
2341                           ( ? means not specified on the command line, s means the SDK version found,
2342                           constraint: 8 <= x <= y <= z)
2344                           ==========================================
2345                            command line      || config result
2346                           ==========================================
2347                           min  | max  | sdk  || min  | max  | sdk  |
2348                           ?    | ?    | ?    || 10.8 | 10.s | 10.s |
2349                           ?    | ?    | 10.x || 10.8 | 10.x | 10.x |
2350                           ?    | 10.x | ?    || 10.8 | 10.s | 10.s |
2351                           ?    | 10.x | 10.y || 10.8 | 10.x | 10.y |
2352                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2353                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2354                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2355                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2358                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2359                           for a detailed technical explanation of these variables
2361                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2362     ],
2365 AC_ARG_WITH(macosx-version-min-required,
2366     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2367         [set the minimum OS version needed to run the built LibreOffice])
2368     [
2369                           e. g.: --with-macos-version-min-required=10.8
2370                           see --with-macosx-sdk for more info
2371     ],
2374 AC_ARG_WITH(macosx-version-max-allowed,
2375     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2376         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2377     [
2378                           e. g.: --with-macos-version-max-allowed=10.8
2379                           see --with-macosx-sdk for more info
2380     ],
2384 dnl ===================================================================
2385 dnl options for stuff used during cross-compilation build
2386 dnl Not quite superseded by --with-build-platform-configure-options.
2387 dnl TODO: check, if the "force" option is still needed anywhere.
2388 dnl ===================================================================
2390 AC_ARG_WITH(system-icu-for-build,
2391     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2392         [Use icu already on system for build tools (cross-compilation only).]))
2395 dnl ===================================================================
2396 dnl check for required programs (grep, awk, sed, bash)
2397 dnl ===================================================================
2399 pathmunge ()
2401     if test -n "$1"; then
2402         if test "$build_os" = "cygwin"; then
2403             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2404                 PathFormat "$1"
2405                 new_path=`cygpath -sm "$formatted_path"`
2406             else
2407                 PathFormat "$1"
2408                 new_path=`cygpath -u "$formatted_path"`
2409             fi
2410         else
2411             new_path="$1"
2412         fi
2413         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2414             if test "$2" = "after"; then
2415                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2416             else
2417                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2418             fi
2419         fi
2420         unset new_path
2421     fi
2424 AC_PROG_AWK
2425 AC_PATH_PROG( AWK, $AWK)
2426 if test -z "$AWK"; then
2427     AC_MSG_ERROR([install awk to run this script])
2430 AC_PATH_PROG(BASH, bash)
2431 if test -z "$BASH"; then
2432     AC_MSG_ERROR([bash not found in \$PATH])
2434 AC_SUBST(BASH)
2436 AC_MSG_CHECKING([for GNU or BSD tar])
2437 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2438     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2439     if test $? -eq 0;  then
2440         GNUTAR=$a
2441         break
2442     fi
2443 done
2444 AC_MSG_RESULT($GNUTAR)
2445 if test -z "$GNUTAR"; then
2446     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2448 AC_SUBST(GNUTAR)
2450 AC_MSG_CHECKING([for tar's option to strip components])
2451 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2452 if test $? -eq 0; then
2453     STRIP_COMPONENTS="--strip-components"
2454 else
2455     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2456     if test $? -eq 0; then
2457         STRIP_COMPONENTS="--strip-path"
2458     else
2459         STRIP_COMPONENTS="unsupported"
2460     fi
2462 AC_MSG_RESULT($STRIP_COMPONENTS)
2463 if test x$STRIP_COMPONENTS = xunsupported; then
2464     AC_MSG_ERROR([you need a tar that is able to strip components.])
2466 AC_SUBST(STRIP_COMPONENTS)
2468 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2469 dnl desktop OSes from "mobile" ones.
2471 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2472 dnl In other words, that when building for an OS that is not a
2473 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2475 dnl Note the direction of the implication; there is no assumption that
2476 dnl cross-compiling would imply a non-desktop OS.
2478 if test $_os != iOS -a $_os != Android; then
2479     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2480     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2481     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2484 DISABLE_EXPORT=''
2485 if test "$enable_export" != no; then
2486     BUILD_TYPE="$BUILD_TYPE EXPORT"
2487 else
2488     DISABLE_EXPORT='TRUE'
2489     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2491 AC_SUBST(DISABLE_EXPORT)
2493 # Whether to build "avmedia" functionality or not.
2495 if test -z "$enable_avmedia"; then
2496     enable_avmedia=yes
2499 if test "$enable_avmedia" = yes; then
2500     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2501     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2502 else
2503     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2506 # Decide whether to build database connectivity stuff (including
2507 # Base) or not. We probably don't want to on non-desktop OSes.
2509 if test -z "$enable_database_connectivity"; then
2510     # --disable-database-connectivity is unfinished work in progress
2511     # and the iOS test app doesn't link if we actually try to use it.
2512     # if test $_os != iOS -a $_os != Android; then
2513         enable_database_connectivity=yes
2514     # fi
2517 if test "$enable_database_connectivity" = yes; then
2518     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2519     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2522 if test -z "$enable_extensions"; then
2523     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2524     if test $_os != iOS -a $_os != Android; then
2525         enable_extensions=yes
2526     fi
2529 if test "$enable_extensions" = yes; then
2530     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2531     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2534 if test -z "$enable_scripting"; then
2535     # Disable scripting for iOS unless specifically overridden
2536     # with --enable-scripting.
2537     if test $_os != iOS; then
2538         enable_scripting=yes
2539     fi
2542 DISABLE_SCRIPTING=''
2543 if test "$enable_scripting" = yes; then
2544     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2545     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2546 else
2547     DISABLE_SCRIPTING='TRUE'
2548     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2551 if test $_os = iOS -o $_os = Android; then
2552     # Disable dynamic_loading always for iOS and Android
2553     enable_dynamic_loading=no
2554 elif test -z "$enable_dynamic_loading"; then
2555     # Otherwise enable it unless speficically disabled
2556     enable_dynamic_loading=yes
2559 DISABLE_DYNLOADING=''
2560 if test "$enable_dynamic_loading" = yes; then
2561     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2562 else
2563     DISABLE_DYNLOADING='TRUE'
2564     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2566 AC_SUBST(DISABLE_DYNLOADING)
2568 # remenber SYSBASE value
2569 AC_SUBST(SYSBASE)
2571 dnl ===================================================================
2572 dnl  Sort out various gallery compilation options
2573 dnl ===================================================================
2574 AC_MSG_CHECKING([how to build and package galleries])
2575 if test -n "${with_galleries}"; then
2576     if test "$with_galleries" = "build"; then
2577         WITH_GALLERY_BUILD=TRUE
2578         AC_MSG_RESULT([build from source images internally])
2579     elif test "$with_galleries" = "no"; then
2580         WITH_GALLERY_BUILD=
2581         AC_MSG_RESULT([disable non-internal gallery build])
2582     else
2583         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2584     fi
2585 else
2586     if test $_os != iOS -a $_os != Android; then
2587         WITH_GALLERY_BUILD=TRUE
2588         AC_MSG_RESULT([internal src images for desktop])
2589     else
2590         WITH_GALLERY_BUILD=
2591         AC_MSG_RESULT([disable src image build])
2592     fi
2594 AC_SUBST(WITH_GALLERY_BUILD)
2596 dnl ===================================================================
2597 dnl  Checks if ccache is available
2598 dnl ===================================================================
2599 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
2600     # on windows/VC build do not use ccache
2601     CCACHE=""
2602 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2603     case "%$CC%$CXX%" in
2604     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2605     # assume that's good then
2606     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2607         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2608         ;;
2609     *)
2610         AC_PATH_PROG([CCACHE],[ccache],[not found])
2611         if test "$CCACHE" = "not found"; then
2612             CCACHE=""
2613         else
2614             # Need to check for ccache version: otherwise prevents
2615             # caching of the results (like "-x objective-c++" for Mac)
2616             if test $_os = Darwin -o $_os = iOS; then
2617                 # Check ccache version
2618                 AC_MSG_CHECKING([whether version of ccache is suitable])
2619                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2620                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2621                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2622                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2623                 else
2624                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2625                     CCACHE=""
2626                 fi
2627             fi
2628         fi
2629         ;;
2630     esac
2631 else
2632     CCACHE=""
2635 if test "$CCACHE" != ""; then
2636     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2637     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2638     if test "$ccache_size" = ""; then
2639         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2640         if test "$ccache_size" = ""; then
2641             ccache_size=0
2642         fi
2643         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2644         if test $ccache_size -lt 1024; then
2645             CCACHE=""
2646             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2647             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2648         else
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     else
2654         if test $ccache_size -lt 5; then
2655             #warn that ccache may be too small for debug build
2656             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2657             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2658         fi
2659     fi
2662 dnl ===================================================================
2663 dnl  Checks for C compiler,
2664 dnl  The check for the C++ compiler is later on.
2665 dnl ===================================================================
2666 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2667     GCC_HOME_SET="true"
2668     AC_MSG_CHECKING([gcc home])
2669     if test -z "$with_gcc_home"; then
2670         if test "$enable_icecream" = "yes"; then
2671             if test -d "/usr/lib/icecc/bin"; then
2672                 GCC_HOME="/usr/lib/icecc/"
2673             else
2674                 GCC_HOME="/opt/icecream/"
2675             fi
2676         else
2677             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2678             GCC_HOME_SET="false"
2679         fi
2680     else
2681         GCC_HOME="$with_gcc_home"
2682     fi
2683     AC_MSG_RESULT($GCC_HOME)
2684     AC_SUBST(GCC_HOME)
2686     if test "$GCC_HOME_SET" = "true"; then
2687         if test -z "$CC"; then
2688             CC="$GCC_HOME/bin/gcc"
2689         fi
2690         if test -z "$CXX"; then
2691             CXX="$GCC_HOME/bin/g++"
2692         fi
2693     fi
2696 COMPATH=`dirname "$CC"`
2697 if test "$COMPATH" = "."; then
2698     AC_PATH_PROGS(COMPATH, $CC)
2699     dnl double square bracket to get single because of M4 quote...
2700     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2702 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2704 dnl ===================================================================
2705 dnl Java support
2706 dnl ===================================================================
2707 AC_MSG_CHECKING([whether to build with Java support])
2708 if test "$with_java" != "no"; then
2709     if test "$DISABLE_SCRIPTING" = TRUE; then
2710         AC_MSG_RESULT([no, overridden by --disable-scripting])
2711         ENABLE_JAVA=""
2712         with_java=no
2713     else
2714         AC_MSG_RESULT([yes])
2715         ENABLE_JAVA="TRUE"
2716         AC_DEFINE(HAVE_FEATURE_JAVA)
2717     fi
2718 else
2719     AC_MSG_RESULT([no])
2720     ENABLE_JAVA=""
2723 AC_SUBST(ENABLE_JAVA)
2725 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2727 dnl ENABLE_JAVA="" indicate no Java support at all
2729 dnl ===================================================================
2730 dnl Check OS X SDK and compiler
2731 dnl ===================================================================
2733 if test $_os = Darwin; then
2735     # If no --with-macosx-sdk option is given, look for one
2737     # The intent is that for "most" Mac-based developers, a suitable
2738     # SDK will be found automatically without any configure options.
2740     # For developers with a current Xcode, the lowest-numbered SDK
2741     # higher than or equal to the minimum required should be found.
2743     AC_MSG_CHECKING([what Mac OS X SDK to use])
2744     for _macosx_sdk in $with_macosx_sdk 10.8 10.9 10.10 10.11 10.12 10.13 10.14; do
2745         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2746         if test -d "$MACOSX_SDK_PATH"; then
2747             with_macosx_sdk="${_macosx_sdk}"
2748             break
2749         else
2750             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2751             if test -d "$MACOSX_SDK_PATH"; then
2752                 with_macosx_sdk="${_macosx_sdk}"
2753                 break
2754             fi
2755         fi
2756     done
2757     if test ! -d "$MACOSX_SDK_PATH"; then
2758         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2759     fi
2760     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2762     case $with_macosx_sdk in
2763     10.8)
2764         MACOSX_SDK_VERSION=1080
2765         ;;
2766     10.9)
2767         MACOSX_SDK_VERSION=1090
2768         ;;
2769     10.10)
2770         MACOSX_SDK_VERSION=101000
2771         ;;
2772     10.11)
2773         MACOSX_SDK_VERSION=101100
2774         ;;
2775     10.12)
2776         MACOSX_SDK_VERSION=101200
2777         ;;
2778     10.13)
2779         MACOSX_SDK_VERSION=101300
2780         ;;
2781     10.14)
2782         MACOSX_SDK_VERSION=101400
2783         ;;
2784     *)
2785         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.8--13])
2786         ;;
2787     esac
2789     if test "$with_macosx_version_min_required" = "" ; then
2790         with_macosx_version_min_required="10.8";
2791     fi
2793     if test "$with_macosx_version_max_allowed" = "" ; then
2794         with_macosx_version_max_allowed="$with_macosx_sdk"
2795     fi
2797     # export this so that "xcrun" invocations later return matching values
2798     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2799     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2800     export DEVELOPER_DIR
2801     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2802     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2804     case "$with_macosx_version_min_required" in
2805     10.8)
2806         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2807         ;;
2808     10.9)
2809         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2810         ;;
2811     10.10)
2812         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2813         ;;
2814     10.11)
2815         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2816         ;;
2817     10.12)
2818         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2819         ;;
2820     10.13)
2821         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2822         ;;
2823     10.14)
2824         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2825         ;;
2826     *)
2827         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.8--13])
2828         ;;
2829     esac
2831     LIBTOOL=/usr/bin/libtool
2832     INSTALL_NAME_TOOL=install_name_tool
2833     if test -z "$save_CC"; then
2834         AC_MSG_CHECKING([what compiler to use])
2835         stdlib=-stdlib=libc++
2836         if test "$ENABLE_LTO" = TRUE; then
2837             lto=-flto
2838         fi
2839         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2840         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2841         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2842         AR=`xcrun -find ar`
2843         NM=`xcrun -find nm`
2844         STRIP=`xcrun -find strip`
2845         LIBTOOL=`xcrun -find libtool`
2846         RANLIB=`xcrun -find ranlib`
2847         AC_MSG_RESULT([$CC and $CXX])
2848     fi
2850     case "$with_macosx_version_max_allowed" in
2851     10.8)
2852         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2853         ;;
2854     10.9)
2855         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2856         ;;
2857     10.10)
2858         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2859         ;;
2860     10.11)
2861         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2862         ;;
2863     10.12)
2864         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2865         ;;
2866     10.13)
2867         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2868         ;;
2869     10.14)
2870         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2871         ;;
2872     *)
2873         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.8--13])
2874         ;;
2875     esac
2877     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2878     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2879         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2880     else
2881         AC_MSG_RESULT([ok])
2882     fi
2884     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2885     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2886         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2887     else
2888         AC_MSG_RESULT([ok])
2889     fi
2890     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2891     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2893     AC_MSG_CHECKING([whether to do code signing])
2895     if test "$enable_macosx_code_signing" = yes; then
2896         # By default use the first suitable certificate (?).
2898         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2899         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2900         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2901         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2902         # "Developer ID Application" one.
2904         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2905         if test -n "$identity"; then
2906             MACOSX_CODESIGNING_IDENTITY=$identity
2907             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2908             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2909         else
2910             AC_MSG_ERROR([cannot determine identity to use])
2911         fi
2912     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2913         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2914         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2915         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2916     else
2917         AC_MSG_RESULT([no])
2918     fi
2920     AC_MSG_CHECKING([whether to create a Mac App Store package])
2922     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2923         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2924     elif test "$enable_macosx_package_signing" = yes; then
2925         # By default use the first suitable certificate.
2926         # It should be a "3rd Party Mac Developer Installer" one
2928         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2929         if test -n "$identity"; then
2930             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2931             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2932             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2933         else
2934             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2935         fi
2936     elif test -n "$enable_macosx_package_signing"; then
2937         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2938         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2939         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2940     else
2941         AC_MSG_RESULT([no])
2942     fi
2944     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2945         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2946     fi
2948     AC_MSG_CHECKING([whether to sandbox the application])
2950     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2951         AC_MSG_ERROR([OS X sandboxing requires code signing])
2952     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2953         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2954     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2955         ENABLE_MACOSX_SANDBOX=TRUE
2956         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2957         AC_MSG_RESULT([yes])
2958     else
2959         AC_MSG_RESULT([no])
2960     fi
2962     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2963     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2964     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2966 AC_SUBST(MACOSX_SDK_PATH)
2967 AC_SUBST(MACOSX_SDK_VERSION)
2968 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2969 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2970 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2971 AC_SUBST(INSTALL_NAME_TOOL)
2972 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2973 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2974 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2975 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2976 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2978 dnl ===================================================================
2979 dnl Check iOS SDK and compiler
2980 dnl ===================================================================
2982 if test $_os = iOS; then
2984     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2985         :
2986     else
2987         BITNESS_OVERRIDE=64
2988     fi
2990     AC_MSG_CHECKING([what iOS SDK to use])
2992     if test "$enable_ios_simulator" = yes; then
2993         platform=iPhoneSimulator
2994     else
2995         platform=iPhoneOS
2996     fi
2998     xcode_developer=`xcode-select -print-path`
3000     current_sdk_ver=9.3
3001     for sdkver in 10.0 9.3 9.2; do
3002         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3003         if test -d $t; then
3004             ios_sdk=$sdkver
3005             sysroot=$t
3006             break
3007         fi
3008     done
3010     if test -z "$sysroot"; then
3011         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3012     fi
3014     AC_MSG_RESULT($sysroot)
3016     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
3018     if test "$enable_ios_simulator" = yes; then
3019         if test "$BITNESS_OVERRIDE" = 64; then
3020             XCODE_ARCHS=x86_64
3021             versionmin=-mios-simulator-version-min=9.0
3022         else
3023             XCODE_ARCHS=i386
3024             versionmin=-mios-simulator-version-min=9.0
3025         fi
3026     else
3027         platform=iPhoneOS
3028         if test "$BITNESS_OVERRIDE" = 64; then
3029             XCODE_ARCHS=arm64
3030         else
3031             XCODE_ARCHS=armv7
3032         fi
3033         versionmin=-miphoneos-version-min=9.0
3034     fi
3036     # LTO is not really recommended for iOS builds,
3037     # the link time will be astronomical
3038     if test "$ENABLE_LTO" = TRUE; then
3039         lto=-flto
3040     fi
3041     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3042     # get compiled with it, to avoid ld warnings when linking all that together into one
3043     # executable.
3045     XCODE_CLANG_CXX_LIBRARY=libc++
3046     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3048     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3049     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3051     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3052     AR=`xcrun -find ar`
3053     NM=`xcrun -find nm`
3054     STRIP=`xcrun -find strip`
3055     LIBTOOL=`xcrun -find libtool`
3056     RANLIB=`xcrun -find ranlib`
3059 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3060 AC_SUBST(XCODE_ARCHS)
3061 AC_SUBST(XCODEBUILD_SDK)
3063 AC_MSG_CHECKING([whether to treat the installation as read-only])
3065 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3066         "$enable_extensions" != yes; then
3067     enable_readonly_installset=yes
3069 if test "$enable_readonly_installset" = yes; then
3070     AC_MSG_RESULT([yes])
3071     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3072 else
3073     AC_MSG_RESULT([no])
3076 dnl ===================================================================
3077 dnl Structure of install set
3078 dnl ===================================================================
3080 if test $_os = Darwin; then
3081     LIBO_BIN_FOLDER=MacOS
3082     LIBO_ETC_FOLDER=Resources
3083     LIBO_LIBEXEC_FOLDER=MacOS
3084     LIBO_LIB_FOLDER=Frameworks
3085     LIBO_LIB_PYUNO_FOLDER=Resources
3086     LIBO_SHARE_FOLDER=Resources
3087     LIBO_SHARE_HELP_FOLDER=Resources/help
3088     LIBO_SHARE_JAVA_FOLDER=Resources/java
3089     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3090     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3091     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3092     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3093     LIBO_URE_BIN_FOLDER=MacOS
3094     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3095     LIBO_URE_LIB_FOLDER=Frameworks
3096     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3097     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3098 elif test $_os = WINNT; then
3099     LIBO_BIN_FOLDER=program
3100     LIBO_ETC_FOLDER=program
3101     LIBO_LIBEXEC_FOLDER=program
3102     LIBO_LIB_FOLDER=program
3103     LIBO_LIB_PYUNO_FOLDER=program
3104     LIBO_SHARE_FOLDER=share
3105     LIBO_SHARE_HELP_FOLDER=help
3106     LIBO_SHARE_JAVA_FOLDER=program/classes
3107     LIBO_SHARE_PRESETS_FOLDER=presets
3108     LIBO_SHARE_READMES_FOLDER=readmes
3109     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3110     LIBO_SHARE_SHELL_FOLDER=program/shell
3111     LIBO_URE_BIN_FOLDER=program
3112     LIBO_URE_ETC_FOLDER=program
3113     LIBO_URE_LIB_FOLDER=program
3114     LIBO_URE_MISC_FOLDER=program
3115     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3116 else
3117     LIBO_BIN_FOLDER=program
3118     LIBO_ETC_FOLDER=program
3119     LIBO_LIBEXEC_FOLDER=program
3120     LIBO_LIB_FOLDER=program
3121     LIBO_LIB_PYUNO_FOLDER=program
3122     LIBO_SHARE_FOLDER=share
3123     LIBO_SHARE_HELP_FOLDER=help
3124     LIBO_SHARE_JAVA_FOLDER=program/classes
3125     LIBO_SHARE_PRESETS_FOLDER=presets
3126     LIBO_SHARE_READMES_FOLDER=readmes
3127     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3128     LIBO_SHARE_SHELL_FOLDER=program/shell
3129     LIBO_URE_BIN_FOLDER=program
3130     LIBO_URE_ETC_FOLDER=program
3131     LIBO_URE_LIB_FOLDER=program
3132     LIBO_URE_MISC_FOLDER=program
3133     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3135 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3136 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3137 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3138 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3139 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3140 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3141 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3142 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3143 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3144 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3145 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3146 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3147 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3148 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3149 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3150 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3152 # Not all of them needed in config_host.mk, add more if need arises
3153 AC_SUBST(LIBO_BIN_FOLDER)
3154 AC_SUBST(LIBO_ETC_FOLDER)
3155 AC_SUBST(LIBO_LIB_FOLDER)
3156 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3157 AC_SUBST(LIBO_SHARE_FOLDER)
3158 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3159 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3160 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3161 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3162 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3163 AC_SUBST(LIBO_URE_BIN_FOLDER)
3164 AC_SUBST(LIBO_URE_ETC_FOLDER)
3165 AC_SUBST(LIBO_URE_LIB_FOLDER)
3166 AC_SUBST(LIBO_URE_MISC_FOLDER)
3167 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3169 dnl ===================================================================
3170 dnl Windows specific tests and stuff
3171 dnl ===================================================================
3173 reg_get_value()
3175     # Return value: $regvalue
3176     unset regvalue
3178     local _regentry="/proc/registry${1}/${2}"
3179     if test -f "$_regentry"; then
3180         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3181         # Registry keys read via /proc/registry* are always \0 terminated!
3182         local _regvalue=$(tr -d '\0' < "$_regentry")
3183         if test $? -eq 0; then
3184             regvalue=$_regvalue
3185         fi
3186     fi
3189 # Get a value from the 32-bit side of the Registry
3190 reg_get_value_32()
3192     reg_get_value "32" "$1"
3195 # Get a value from the 64-bit side of the Registry
3196 reg_get_value_64()
3198     reg_get_value "64" "$1"
3201 if test "$_os" = "WINNT"; then
3202     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3203     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3204         AC_MSG_RESULT([no])
3205         WINDOWS_SDK_ARCH="x86"
3206     else
3207         AC_MSG_RESULT([yes])
3208         WINDOWS_SDK_ARCH="x64"
3209         BITNESS_OVERRIDE=64
3210     fi
3213 if test "$cross_compiling" = "yes"; then
3214     export CROSS_COMPILING=TRUE
3215     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3216 else
3217     CROSS_COMPILING=
3218     BUILD_TYPE="$BUILD_TYPE NATIVE"
3220 AC_SUBST(CROSS_COMPILING)
3222 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3223 if test "$GCC" = "yes"; then
3224     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3225     bsymbolic_functions_ldflags_save=$LDFLAGS
3226     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3227     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3228 #include <stdio.h>
3229         ],[
3230 printf ("hello world\n");
3231         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3232     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3233         AC_MSG_RESULT( found )
3234     else
3235         AC_MSG_RESULT( not found )
3236     fi
3237     LDFLAGS=$bsymbolic_functions_ldflags_save
3239 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3241 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3242 # NOTE: must _not_ be used for bundled external libraries!
3243 ISYSTEM=
3244 if test "$GCC" = "yes"; then
3245     AC_MSG_CHECKING( for -isystem )
3246     save_CFLAGS=$CFLAGS
3247     CFLAGS="$CFLAGS -Werror"
3248     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3249     CFLAGS=$save_CFLAGS
3250     if test -n "$ISYSTEM"; then
3251         AC_MSG_RESULT(yes)
3252     else
3253         AC_MSG_RESULT(no)
3254     fi
3256 if test -z "$ISYSTEM"; then
3257     # fall back to using -I
3258     ISYSTEM=-I
3260 AC_SUBST(ISYSTEM)
3262 dnl ===================================================================
3263 dnl  Check which Visual Studio or MinGW compiler is used
3264 dnl ===================================================================
3266 map_vs_year_to_version()
3268     # Return value: $vsversion
3270     unset vsversion
3272     case $1 in
3273     2013)
3274         vsversion=12.0;;
3275     2015)
3276         vsversion=14.0;;
3277     *)
3278         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3279     esac
3282 vs_versions_to_check()
3284     # Args: $1 (optional) : versions to check, in the order of preference
3285     # Return value: $vsversions
3287     unset vsversions
3289     if test -n "$1"; then
3290         map_vs_year_to_version "$1"
3291         vsversions=$vsversion
3292     else
3293         # By default we prefer 2013/2015, in this order
3294         vsversions="12.0 14.0"
3295     fi
3298 find_msvs()
3300     # Find Visual Studio 2013/2015
3301     # Args: $1 (optional) : versions to check, in the order of preference
3302     # Return value: $vstest
3304     unset vstest
3306     vs_versions_to_check "$1"
3308     for ver in $vsversions; do
3309         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3310         if test -n "$regvalue"; then
3311             vstest=$regvalue
3312             break
3313         fi
3314         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3315         if test -n "$regvalue"; then
3316             vstest=$regvalue
3317             break
3318         fi
3319     done
3322 win_get_env_from_vsvars32bat()
3324     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3325     echo -e "@setlocal\r\n" >> $WRAPPERBATCHFILEPATH
3326     echo -e "@call \"`cygpath -w $VC_PRODUCT_DIR`/../Common7/Tools/vsvars32.bat\"\r\n" >> $WRAPPERBATCHFILEPATH
3327     echo -e "@echo %$1%\r\n" >> $WRAPPERBATCHFILEPATH
3328     echo -e "@endlocal\r\n" >> $WRAPPERBATCHFILEPATH
3329     chmod +x $WRAPPERBATCHFILEPATH
3330     _win_get_env_from_vsvars32bat=$($WRAPPERBATCHFILEPATH | tr -d "\r")
3331     rm -f $WRAPPERBATCHFILEPATH
3332     echo $_win_get_env_from_vsvars32bat
3335 find_ucrt()
3337     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3338     if test -n "$regvalue"; then
3339         PathFormat "$regvalue"
3340         UCRTSDKDIR=$formatted_path
3341         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3342         UCRTVERSION=$regvalue
3343     fi
3344     if test -z "$UCRTSDKDIR"; then
3345         if test -f "$VC_PRODUCT_DIR/../Common7/Tools/vsvars32.bat"; then
3346             PathFormat "`win_get_env_from_vsvars32bat "UniversalCRTSdkDir"`"
3347             UCRTSDKDIR=$formatted_path
3348             UCRTVERSION=`win_get_env_from_vsvars32bat "UCRTVersion"`
3349         fi
3350     fi
3353 find_msvc()
3355     # Find Visual C++ 2013/2015
3356     # Args: $1 (optional) : The VS version year
3357     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3359     unset vctest vcnum vcnumwithdot vcexpress
3361     vs_versions_to_check "$1"
3363     for ver in $vsversions; do
3364         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3365         if test -n "$regvalue"; then
3366             vctest=$regvalue
3367             break
3368         fi
3369         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3370         if test -n "$regvalue"; then
3371             vctest=$regvalue
3372             break
3373         fi
3374     done
3375     if test -n "$vctest"; then
3376         vcnumwithdot=$ver
3377         case "$vcnumwithdot" in
3378         12.0)
3379             vcyear=2013
3380             vcnum=120
3381             ;;
3382         14.0)
3383             vcyear=2015
3384             vcnum=140
3385             ;;
3386         esac
3387         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$vcnumwithdot/Setup/VC/ProductDir
3388         if test -n "$regvalue" -a "$regvalue" = "$vctest" ; then
3389             vcexpress=Express
3390         fi
3391     fi
3394 SOLARINC=
3395 SHOWINCLUDES_PREFIX=
3396 MSBUILD_PATH=
3397 DEVENV=
3398 if test "$_os" = "WINNT"; then
3399     if test "$WITH_MINGW" != "yes"; then
3400         AC_MSG_CHECKING([Visual C++])
3402         find_msvc "$with_visual_studio"
3403         if test -z "$vctest"; then
3404             if test -n "$with_visual_studio"; then
3405                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3406             else
3407                 AC_MSG_ERROR([No Visual Studio 2013/2015 installation found])
3408             fi
3409         fi
3411         if test "$BITNESS_OVERRIDE" = ""; then
3412             if test -f "$vctest/bin/cl.exe"; then
3413                 VC_PRODUCT_DIR=$vctest
3414             else
3415                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3416             fi
3417         else
3418             if test -f "$vctest/bin/amd64/cl.exe"; then
3419                 VC_PRODUCT_DIR=$vctest
3420             else
3421                 if test -f "$vctest/bin/x86_amd64/cl.exe" -a "$vcexpress" = "Express"; then
3422                     VC_PRODUCT_DIR=$vctest
3423                 else
3424                     AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3425                 fi
3426             fi
3427         fi
3429         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3430         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3432         AC_MSG_CHECKING([Is Visual C++ Express])
3433         if test "$vcexpress" = "Express" ; then
3434             AC_MSG_RESULT([Yes])
3435         else
3436             AC_MSG_RESULT([No])
3437         fi
3439         UCRTSDKDIR=
3440         UCRTVERSION=
3442         AC_MSG_CHECKING([whether UCRT is needed for this compiler version])
3443         if test "$vcnum" = "120"; then
3444             AC_MSG_RESULT([No])
3445         else
3446             AC_MSG_RESULT([Yes])
3447             AC_MSG_CHECKING([for UCRT location])
3448             find_ucrt
3449             if test -n "$UCRTSDKDIR"; then
3450                 AC_MSG_RESULT([found])
3451                 PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3452                 ucrtincpath_formatted=$formatted_path
3453                 # SOLARINC is used for external modules and must be set too.
3454                 # And no, it's not sufficient to set SOLARINC only, as configure
3455                 # itself doesn't honour it.
3456                 SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3457                 CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3458                 CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3459                 CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3460             else
3461                 AC_MSG_ERROR([not found])
3462             fi
3463         fi
3464         AC_SUBST(UCRTSDKDIR)
3465         AC_SUBST(UCRTVERSION)
3467         # Find the proper version of MSBuild.exe to use based on the VS version
3468         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3469         if test -n "$regvalue" ; then
3470             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3471         fi
3473         # Find the version of devenv.exe
3474         DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
3475         if test ! -e "$DEVENV" -a "$vcnum" = "120"; then
3476             # for Visual Studio 2013 Express, fall back
3477             DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/WDExpress.exe"
3478         fi
3479         if test ! -e "$DEVENV"; then
3480             AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3481         fi
3483         dnl ===========================================================
3484         dnl  Check for the corresponding mspdb*.dll
3485         dnl ===========================================================
3487         MSPDB_PATH=
3489         if test "$BITNESS_OVERRIDE" = ""; then
3490             if test "$vcnum" = "120"; then
3491                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3492             else
3493                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3494             fi
3495         else
3496             if test "$vcexpress" = "Express"; then
3497                 MSPDB_PATH="$VC_PRODUCT_DIR/bin"
3498             else
3499                 MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3500             fi
3501         fi
3503         mspdbnum=$vcnum
3505         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3506             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3507         fi
3509         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3510         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3512         dnl The path needs to be added before cl is called
3513         PATH="$MSPDB_PATH:$PATH"
3515         AC_MSG_CHECKING([cl.exe])
3517         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3518         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3519         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3520         # is not enough?
3522         if test -z "$CC"; then
3523             if test "$BITNESS_OVERRIDE" = ""; then
3524                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3525                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3526                 fi
3527             else
3528                 if test "$vcexpress" = "Express"; then
3529                    if test -f "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"; then
3530                         CC="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3531                    fi
3532                 else
3533                    if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3534                         CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3535                    fi
3536                 fi
3537             fi
3539             # This gives us a posix path with 8.3 filename restrictions
3540             CC=`win_short_path_for_make "$CC"`
3541         fi
3543         if test -n "$CC"; then
3544             # Remove /cl.exe from CC case insensitive
3545             AC_MSG_RESULT([found Visual C++ $vcyear $vcexpress ($CC)])
3546             if test "$BITNESS_OVERRIDE" = ""; then
3547                 COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3548             else
3549                 if test -n "$VC_PRODUCT_DIR"; then
3550                     COMPATH=$VC_PRODUCT_DIR
3551                 fi
3552             fi
3553             if test "$BITNESS_OVERRIDE" = ""; then
3554                 dnl since MSVC 2012, default for x86 is -arch:SSE2:
3555                 CC="$CC -arch:SSE"
3556             fi
3557             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3559             PathFormat "$COMPATH"
3560             COMPATH="$formatted_path"
3562             VCVER=$vcnum
3563             MSVSVER=$vcyear
3565             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3566             # are always "better", we list them in reverse chronological order.
3568             case $vcnum in
3569             120)
3570                 COMEX=15
3571                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0 7.1A"
3572                 ;;
3573             140)
3574                 COMEX=19
3575                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0A 10.0 8.1A 8.1 8.0 7.1A"
3576                 ;;
3577             esac
3579             # The expectation is that --with-windows-sdk should not need to be used
3580             if test -n "$with_windows_sdk"; then
3581                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3582                 *" "$with_windows_sdk" "*)
3583                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3584                     ;;
3585                 *)
3586                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3587                     ;;
3588                 esac
3589             fi
3591             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3592             ac_objext=obj
3593             ac_exeext=exe
3595         else
3596             AC_MSG_ERROR([Visual C++ not found after all, huh])
3597         fi
3599         dnl We need to guess the prefix of the -showIncludes output, it can be
3600         dnl localized
3601         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3602         echo "#include <stdlib.h>" > conftest.c
3603         dnl Filter out -FIIntrin.h when CC points at clang-cl.exe and needs to
3604         dnl explicitly state that argument:
3605         my_CC=
3606         for i in $CC; do
3607             case $i in
3608             -FIIntrin.h)
3609                 ;;
3610             *)
3611                 my_CC="$my_CC $i"
3612                 ;;
3613             esac
3614         done
3615         SHOWINCLUDES_PREFIX=`$my_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3616             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3617         rm -f conftest.c conftest.obj
3618         if test -z "$SHOWINCLUDES_PREFIX"; then
3619             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3620         else
3621             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3622         fi
3624         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3625         # version of the Explorer extension (and maybe other small
3626         # bits, too) needed when installing a 32-bit LibreOffice on a
3627         # 64-bit OS. The 64-bit Explorer extension is a feature that
3628         # has been present since long in OOo. Don't confuse it with
3629         # building LibreOffice itself as 64-bit code.
3631         BUILD_X64=
3632         CXX_X64_BINARY=
3633         LINK_X64_BINARY=
3635         if test "$BITNESS_OVERRIDE" = ""; then
3636             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3637             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3638                 # Prefer native x64 compiler to cross-compiler, in case we are running
3639                 # the build on a 64-bit OS.
3640                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3641                     BUILD_X64=TRUE
3642                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3643                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3644                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3645                     BUILD_X64=TRUE
3646                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3647                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3648                 fi
3649             fi
3650             if test "$BUILD_X64" = TRUE; then
3651                 AC_MSG_RESULT([found])
3652             else
3653                 AC_MSG_RESULT([not found])
3654                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3655             fi
3656         fi
3657         AC_SUBST(BUILD_X64)
3659         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3660         AC_SUBST(CXX_X64_BINARY)
3661         AC_SUBST(LINK_X64_BINARY)
3662     else
3663         AC_MSG_CHECKING([the compiler is MinGW])
3664         MACHINE_PREFIX=`$CC -dumpmachine`
3665         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3666             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3667             AC_MSG_RESULT([yes])
3668         else
3669             AC_MSG_ERROR([Compiler is not MinGW.])
3670         fi
3671     fi
3673 AC_SUBST(VCVER)
3674 AC_SUBST(DEVENV)
3675 PathFormat "$MSPDB_PATH"
3676 MSPDB_PATH="$formatted_path"
3677 AC_SUBST(SHOWINCLUDES_PREFIX)
3679 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3680     AC_MSG_CHECKING([whether to use DirectX])
3681     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3682         ENABLE_DIRECTX="TRUE"
3683         AC_MSG_RESULT([yes])
3684     else
3685         ENABLE_DIRECTX=""
3686         AC_MSG_RESULT([no])
3687     fi
3689     AC_MSG_CHECKING([whether to use ActiveX])
3690     if test "$enable_activex" = "yes" -o "$enable_activex" = "" -a "$vcexpress" != Express; then
3691         DISABLE_ACTIVEX=""
3692         AC_MSG_RESULT([yes])
3693     else
3694         DISABLE_ACTIVEX="TRUE"
3695         AC_MSG_RESULT([no])
3696     fi
3698     AC_MSG_CHECKING([whether to use ATL])
3699     if test "$enable_atl" = "yes" -o "$enable_atl" = "" -a "$vcexpress" != Express; then
3700         DISABLE_ATL=""
3701         AC_DEFINE(HAVE_FEATURE_ATL, 1)
3702         AC_MSG_RESULT([yes])
3703     else
3704         DISABLE_ATL="TRUE"
3705         AC_MSG_RESULT([no])
3706     fi
3707 else
3708     ENABLE_DIRECTX=""
3709     DISABLE_ACTIVEX="TRUE"
3710     DISABLE_ATL="TRUE"
3713 AC_SUBST(ENABLE_DIRECTX)
3714 AC_SUBST(DISABLE_ACTIVEX)
3715 AC_SUBST(DISABLE_ATL)
3718 # dbghelp.dll
3720 if test "$_os" = "WINNT"; then
3721     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3725 # unowinreg.dll
3727 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3728 AC_SUBST(UNOWINREG_DLL)
3730 COM_IS_CLANG=
3731 AC_MSG_CHECKING([whether the compiler is actually Clang])
3732 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3733     #ifndef __clang__
3734     you lose
3735     #endif
3736     int foo=42;
3737     ]])],
3738     [AC_MSG_RESULT([yes])
3739      COM_IS_CLANG=TRUE],
3740     [AC_MSG_RESULT([no])])
3742 if test "$COM_IS_CLANG" = TRUE; then
3743     AC_MSG_CHECKING([the Clang version])
3744     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | ${CC%-cl.exe*} -E -P -`
3745     CLANG_FULL_VERSION=`echo __clang_version__ | ${CC%-cl.exe*} -E -P -`
3746     CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3747     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3748     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3749     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3751 AC_SUBST(COM_IS_CLANG)
3754 # prefix C with ccache if needed
3756 if test "$CCACHE" != ""; then
3757     AC_MSG_CHECKING([whether $CC is already ccached])
3759     AC_LANG_PUSH([C])
3760     save_CFLAGS=$CFLAGS
3761     CFLAGS="$CFLAGS --ccache-skip -O2"
3762     dnl an empty program will do, we're checking the compiler flags
3763     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3764                       [use_ccache=yes], [use_ccache=no])
3765     if test $use_ccache = yes; then
3766         AC_MSG_RESULT([yes])
3767     else
3768         CC="$CCACHE $CC"
3769         AC_MSG_RESULT([no])
3770     fi
3771     CFLAGS=$save_CFLAGS
3772     AC_LANG_POP([C])
3775 # ===================================================================
3776 # check various GCC options that Clang does not support now but maybe
3777 # will somewhen in the future, check them even for GCC, so that the
3778 # flags are set
3779 # ===================================================================
3781 HAVE_GCC_GGDB2=
3782 HAVE_GCC_FINLINE_LIMIT=
3783 HAVE_GCC_FNO_INLINE=
3784 if test "$GCC" = "yes"; then
3785     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3786     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3787         # Option just ignored and silly warning that isn't a real
3788         # warning printed
3789         :
3790     else
3791         save_CFLAGS=$CFLAGS
3792         CFLAGS="$CFLAGS -Werror -ggdb2"
3793         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3794         CFLAGS=$save_CFLAGS
3795     fi
3796     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3797         AC_MSG_RESULT([yes])
3798     else
3799         AC_MSG_RESULT([no])
3800     fi
3802     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3803     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3804         # As above
3805         :
3806     else
3807         save_CFLAGS=$CFLAGS
3808         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3809         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3810         CFLAGS=$save_CFLAGS
3811     fi
3812     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3813         AC_MSG_RESULT([yes])
3814     else
3815         AC_MSG_RESULT([no])
3816     fi
3818     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3819     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3820         # Ditto
3821         :
3822     else
3823         save_CFLAGS=$CFLAGS
3824         CFLAGS="$CFLAGS -Werror -fno-inline"
3825         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3826         CFLAGS=$save_CFLAGS
3827     fi
3828     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3829         AC_MSG_RESULT([yes])
3830     else
3831         AC_MSG_RESULT([no])
3832     fi
3834 AC_SUBST(HAVE_GCC_GGDB2)
3835 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3836 AC_SUBST(HAVE_GCC_FNO_INLINE)
3838 dnl ===================================================================
3839 dnl  Test the gcc version
3840 dnl ===================================================================
3841 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3842     AC_MSG_CHECKING([the GCC version])
3843     _gcc_version=`$CC -dumpversion`
3844     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3846     AC_MSG_RESULT([gcc $_gcc_version])
3848     if test "$GCC_VERSION" -lt 0407; then
3849         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.7.0])
3850     fi
3851 else
3852     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3853     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3854     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3855     # (which reports itself as GCC 4.2.1).
3856     GCC_VERSION=
3858 AC_SUBST(GCC_VERSION)
3860 dnl Set the ENABLE_DBGUTIL variable
3861 dnl ===================================================================
3862 AC_MSG_CHECKING([whether to build with additional debug utilities])
3863 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3864     ENABLE_DBGUTIL="TRUE"
3865     # this is an extra var so it can have different default on different MSVC
3866     # versions (in case there are version specific problems with it)
3867     MSVC_USE_DEBUG_RUNTIME="TRUE"
3869     AC_MSG_RESULT([yes])
3870     # cppunit and graphite expose STL in public headers
3871     if test "$with_system_cppunit" = "yes"; then
3872         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3873     else
3874         with_system_cppunit=no
3875     fi
3876     if test "$with_system_graphite" = "yes"; then
3877         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3878     else
3879         with_system_graphite=no
3880     fi
3881     if test "$with_system_mysql_cppconn" = "yes"; then
3882         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3883     else
3884         with_system_mysql_cppconn=no
3885     fi
3886     if test "$with_system_orcus" = "yes"; then
3887         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3888     else
3889         with_system_orcus=no
3890     fi
3891     if test "$with_system_libcmis" = "yes"; then
3892         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3893     else
3894         with_system_libcmis=no
3895     fi
3896     if test "$with_system_libgltf" = "yes"; then
3897         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3898     else
3899         with_system_libgltf=no
3900     fi
3901     if test "$with_system_hunspell" = "yes"; then
3902         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3903     else
3904         with_system_hunspell=no
3905     fi
3906 else
3907     ENABLE_DBGUTIL=""
3908     MSVC_USE_DEBUG_RUNTIME=""
3909     AC_MSG_RESULT([no])
3911 AC_SUBST(ENABLE_DBGUTIL)
3912 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3914 dnl Set the ENABLE_DEBUG variable.
3915 dnl ===================================================================
3916 AC_MSG_CHECKING([whether to do a debug build])
3917 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3918     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3920 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3921     AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3924 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3925     ENABLE_DEBUG="TRUE"
3926     if test -n "$ENABLE_DBGUTIL" ; then
3927         AC_MSG_RESULT([yes (dbgutil)])
3928     else
3929         AC_MSG_RESULT([yes])
3930     fi
3931 else
3932     ENABLE_DEBUG=""
3933     AC_MSG_RESULT([no])
3935 AC_SUBST(ENABLE_DEBUG)
3937 if test "$enable_sal_log" = yes; then
3938     ENABLE_SAL_LOG=TRUE
3940 AC_SUBST(ENABLE_SAL_LOG)
3942 dnl Selective debuginfo
3943 ENABLE_DEBUGINFO_FOR=
3944 if test -n "$ENABLE_DEBUG"; then
3945     AC_MSG_CHECKING([whether to use selective debuginfo])
3946     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3947         if test "$enable_selective_debuginfo" = "yes"; then
3948             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3949         fi
3950         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3951         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3952     else
3953         ENABLE_DEBUGINFO_FOR=all
3954         AC_MSG_RESULT([no, for all])
3955     fi
3956 else
3957     if test -n "$enable_selective_debuginfo"; then
3958         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3959     fi
3961 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3963 dnl Check for enable symbols option
3964 dnl ===================================================================
3965 AC_MSG_CHECKING([whether to generate debug information])
3966 if test -z "$enable_symbols"; then
3967     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3968         enable_symbols=yes
3969     else
3970         enable_symbols=no
3971     fi
3973 if test "$enable_symbols" != no; then
3974     ENABLE_SYMBOLS=TRUE
3975     AC_MSG_RESULT([yes])
3976 else
3977     ENABLE_SYMBOLS=
3978     AC_MSG_RESULT([no])
3980 AC_SUBST(ENABLE_SYMBOLS)
3982 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3983     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3984     AC_MSG_CHECKING([whether enough memory is available for linking])
3985     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3986     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3987     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3988         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3989     else
3990         AC_MSG_RESULT([yes])
3991     fi
3994 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3995 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3996 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3997 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3998 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3999     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
4001 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
4003 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
4004 # By default use the ones specified by our build system,
4005 # but explicit override is possible.
4006 AC_MSG_CHECKING(for explicit AFLAGS)
4007 if test -n "$AFLAGS"; then
4008     AC_MSG_RESULT([$AFLAGS])
4009     x_AFLAGS=
4010 else
4011     AC_MSG_RESULT(no)
4012     x_AFLAGS=[\#]
4014 AC_MSG_CHECKING(for explicit CFLAGS)
4015 if test -n "$CFLAGS"; then
4016     AC_MSG_RESULT([$CFLAGS])
4017     x_CFLAGS=
4018 else
4019     AC_MSG_RESULT(no)
4020     x_CFLAGS=[\#]
4022 AC_MSG_CHECKING(for explicit CXXFLAGS)
4023 if test -n "$CXXFLAGS"; then
4024     AC_MSG_RESULT([$CXXFLAGS])
4025     x_CXXFLAGS=
4026 else
4027     AC_MSG_RESULT(no)
4028     x_CXXFLAGS=[\#]
4030 AC_MSG_CHECKING(for explicit OBJCFLAGS)
4031 if test -n "$OBJCFLAGS"; then
4032     AC_MSG_RESULT([$OBJCFLAGS])
4033     x_OBJCFLAGS=
4034 else
4035     AC_MSG_RESULT(no)
4036     x_OBJCFLAGS=[\#]
4038 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
4039 if test -n "$OBJCXXFLAGS"; then
4040     AC_MSG_RESULT([$OBJCXXFLAGS])
4041     x_OBJCXXFLAGS=
4042 else
4043     AC_MSG_RESULT(no)
4044     x_OBJCXXFLAGS=[\#]
4046 AC_MSG_CHECKING(for explicit LDFLAGS)
4047 if test -n "$LDFLAGS"; then
4048     AC_MSG_RESULT([$LDFLAGS])
4049     x_LDFLAGS=
4050 else
4051     AC_MSG_RESULT(no)
4052     x_LDFLAGS=[\#]
4054 AC_SUBST(AFLAGS)
4055 AC_SUBST(CFLAGS)
4056 AC_SUBST(CXXFLAGS)
4057 AC_SUBST(OBJCFLAGS)
4058 AC_SUBST(OBJCXXFLAGS)
4059 AC_SUBST(LDFLAGS)
4060 AC_SUBST(x_AFLAGS)
4061 AC_SUBST(x_CFLAGS)
4062 AC_SUBST(x_CXXFLAGS)
4063 AC_SUBST(x_OBJCFLAGS)
4064 AC_SUBST(x_OBJCXXFLAGS)
4065 AC_SUBST(x_LDFLAGS)
4068 # determine CPUNAME, OS, ...
4069 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4071 case "$host_os" in
4073 aix*)
4074     COM=GCC
4075     CPUNAME=POWERPC
4076     USING_X11=TRUE
4077     OS=AIX
4078     RTL_OS=AIX
4079     RTL_ARCH=PowerPC
4080     PLATFORMID=aix_powerpc
4081     P_SEP=:
4082     ;;
4084 cygwin*)
4085     COM=MSC
4086     USING_X11=
4087     OS=WNT
4088     RTL_OS=Windows
4089     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4090         P_SEP=";"
4091     else
4092         P_SEP=:
4093     fi
4094     case "$host_cpu" in
4095     i*86|x86_64)
4096         if test "$BITNESS_OVERRIDE" = 64; then
4097             CPUNAME=X86_64
4098             RTL_ARCH=X86_64
4099             PLATFORMID=windows_x86_64
4100             WINDOWS_X64=1
4101             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4102         else
4103             CPUNAME=INTEL
4104             RTL_ARCH=x86
4105             PLATFORMID=windows_x86
4106         fi
4107         ;;
4108     *)
4109         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4110         ;;
4111     esac
4112     SCPDEFS="$SCPDEFS -D_MSC_VER"
4113     ;;
4115 darwin*)
4116     COM=GCC
4117     USING_X11=
4118     OS=MACOSX
4119     RTL_OS=MacOSX
4120     P_SEP=:
4122     case "$host_cpu" in
4123     arm*)
4124         CPUNAME=ARM
4125         RTL_ARCH=ARM_EABI
4126         PLATFORMID=ios_arm
4127         OS=IOS
4128         ;;
4129     i*86)
4130         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4131         ;;
4132     x86_64)
4133         CPUNAME=X86_64
4134         RTL_ARCH=X86_64
4135         PLATFORMID=macosx_x86_64
4136         ;;
4137     *)
4138         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4139         ;;
4140     esac
4141     ;;
4143 dragonfly*)
4144     COM=GCC
4145     USING_X11=TRUE
4146     OS=DRAGONFLY
4147     RTL_OS=DragonFly
4148     P_SEP=:
4150     case "$host_cpu" in
4151     i*86)
4152         CPUNAME=INTEL
4153         RTL_ARCH=x86
4154         PLATFORMID=dragonfly_x86
4155         ;;
4156     x86_64)
4157         CPUNAME=X86_64
4158         RTL_ARCH=X86_64
4159         PLATFORMID=dragonfly_x86_64
4160         ;;
4161     *)
4162         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4163         ;;
4164     esac
4165     ;;
4167 freebsd*)
4168     COM=GCC
4169     USING_X11=TRUE
4170     RTL_OS=FreeBSD
4171     OS=FREEBSD
4172     P_SEP=:
4174     case "$host_cpu" in
4175     i*86)
4176         CPUNAME=INTEL
4177         RTL_ARCH=x86
4178         PLATFORMID=freebsd_x86
4179         ;;
4180     x86_64|amd64)
4181         CPUNAME=X86_64
4182         RTL_ARCH=X86_64
4183         PLATFORMID=freebsd_x86_64
4184         ;;
4185     *)
4186         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4187         ;;
4188     esac
4189     ;;
4191 kfreebsd*)
4192     COM=GCC
4193     USING_X11=TRUE
4194     OS=LINUX
4195     RTL_OS=kFreeBSD
4196     P_SEP=:
4198     case "$host_cpu" in
4200     i*86)
4201         CPUNAME=INTEL
4202         RTL_ARCH=x86
4203         PLATFORMID=kfreebsd_x86
4204         ;;
4205     x86_64)
4206         CPUNAME=X86_64
4207         RTL_ARCH=X86_64
4208         PLATFORMID=kfreebsd_x86_64
4209         ;;
4210     *)
4211         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4212         ;;
4213     esac
4214     ;;
4216 linux-gnu*)
4217     COM=GCC
4218     USING_X11=TRUE
4219     OS=LINUX
4220     RTL_OS=Linux
4221     P_SEP=:
4223     case "$host_cpu" in
4225     aarch64)
4226         CPUNAME=AARCH64
4227         PLATFORMID=linux_aarch64
4228         RTL_ARCH=AARCH64
4229         ;;
4230     alpha)
4231         CPUNAME=AXP
4232         RTL_ARCH=ALPHA
4233         PLATFORMID=linux_alpha
4234         ;;
4235     arm*)
4236         CPUNAME=ARM
4237         EPM_FLAGS="-a arm"
4238         RTL_ARCH=ARM_EABI
4239         PLATFORMID=linux_arm_eabi
4240         case "$host_cpu" in
4241         arm*-linux)
4242             RTL_ARCH=ARM_OABI
4243             PLATFORMID=linux_arm_oabi
4244             ;;
4245         esac
4246         ;;
4247     hppa)
4248         CPUNAME=HPPA
4249         RTL_ARCH=HPPA
4250         EPM_FLAGS="-a hppa"
4251         PLATFORMID=linux_hppa
4252         ;;
4253     i*86)
4254         CPUNAME=INTEL
4255         RTL_ARCH=x86
4256         PLATFORMID=linux_x86
4257         ;;
4258     ia64)
4259         CPUNAME=IA64
4260         RTL_ARCH=IA64
4261         PLATFORMID=linux_ia64
4262         ;;
4263     mips)
4264         CPUNAME=GODSON
4265         RTL_ARCH=MIPS_EB
4266         EPM_FLAGS="-a mips"
4267         PLATFORMID=linux_mips_eb
4268         ;;
4269     mips64)
4270         CPUNAME=GODSON64
4271         RTL_ARCH=MIPS64_EB
4272         EPM_FLAGS="-a mips64"
4273         PLATFORMID=linux_mips64_eb
4274         ;;
4275     mips64el)
4276         CPUNAME=GODSON64
4277         RTL_ARCH=MIPS64_EL
4278         EPM_FLAGS="-a mips64el"
4279         PLATFORMID=linux_mips64_el
4280         ;;
4281     mipsel)
4282         CPUNAME=GODSON
4283         RTL_ARCH=MIPS_EL
4284         EPM_FLAGS="-a mipsel"
4285         PLATFORMID=linux_mips_el
4286         ;;
4287     m68k)
4288         CPUNAME=M68K
4289         RTL_ARCH=M68K
4290         PLATFORMID=linux_m68k
4291         ;;
4292     powerpc)
4293         CPUNAME=POWERPC
4294         RTL_ARCH=PowerPC
4295         PLATFORMID=linux_powerpc
4296         ;;
4297     powerpc64)
4298         CPUNAME=POWERPC64
4299         RTL_ARCH=PowerPC_64
4300         PLATFORMID=linux_powerpc64
4301         ;;
4302     powerpc64le)
4303         CPUNAME=POWERPC64
4304         RTL_ARCH=PowerPC_64_LE
4305         PLATFORMID=linux_powerpc64_le
4306         ;;
4307     sparc)
4308         CPUNAME=SPARC
4309         RTL_ARCH=SPARC
4310         PLATFORMID=linux_sparc
4311         ;;
4312     sparc64)
4313         CPUNAME=SPARC64
4314         RTL_ARCH=SPARC64
4315         PLATFORMID=linux_sparc64
4316         ;;
4317     s390)
4318         CPUNAME=S390
4319         RTL_ARCH=S390
4320         PLATFORMID=linux_s390
4321         ;;
4322     s390x)
4323         CPUNAME=S390X
4324         RTL_ARCH=S390x
4325         PLATFORMID=linux_s390x
4326         ;;
4327     x86_64)
4328         CPUNAME=X86_64
4329         RTL_ARCH=X86_64
4330         PLATFORMID=linux_x86_64
4331         ;;
4332     *)
4333         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4334         ;;
4335     esac
4336     ;;
4338 linux-android*)
4339     COM=GCC
4340     USING_X11=
4341     OS=ANDROID
4342     RTL_OS=Android
4343     P_SEP=:
4345     case "$host_cpu" in
4347     arm|armel)
4348         CPUNAME=ARM
4349         RTL_ARCH=ARM_EABI
4350         PLATFORMID=android_arm_eabi
4351         ;;
4352     aarch64)
4353         CPUNAME=AARCH64
4354         RTL_ARCH=AARCH64
4355         PLATFORMID=android_aarch64
4356         ;;
4357     mips|mipsel)
4358         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4359         RTL_ARCH=MIPS_EL
4360         PLATFORMID=android_mips_el
4361         ;;
4362     i*86)
4363         CPUNAME=INTEL
4364         RTL_ARCH=x86
4365         PLATFORMID=android_x86
4366         ;;
4367     *)
4368         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4369         ;;
4370     esac
4371     ;;
4373 emscripten*)
4374     COM=emcc
4375     USING_X11=
4376     OS=EMSCRIPTEN
4377     RTL_OS=Emscripten
4378     P_SEP=:
4379     CPUNAME=INTEL
4380     RTL_ARCH=x86
4381     PLATFORMID=linux_x86
4382     ;;
4384 mingw*)
4385     COM=GCC
4386     USING_X11=
4387     OS=WNT
4388     RTL_OS=Windows
4389     P_SEP=:
4391     case "$host_cpu" in
4392     i*86|x86_64)
4393         if test "$BITNESS_OVERRIDE" = 64; then
4394             CPUNAME=X86_64
4395             RTL_ARCH=X86_84
4396             PLATFORMID=windows_x86_64
4397             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4398         else
4399             CPUNAME=INTEL
4400             RTL_ARCH=x86
4401             PLATFORMID=windows_x86
4402             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4403         fi
4404         ;;
4405     *)
4406         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4407         ;;
4408     esac
4409     ;;
4411 *netbsd*)
4412     COM=GCC
4413     USING_X11=TRUE
4414     OS=NETBSD
4415     RTL_OS=NetBSD
4416     P_SEP=:
4418     case "$host_cpu" in
4419     i*86)
4420         CPUNAME=INTEL
4421         RTL_ARCH=x86
4422         PLATFORMID=netbsd_x86
4423         ;;
4424     powerpc)
4425         CPUNAME=POWERPC
4426         RTL_ARCH=PowerPC
4427         PLATFORMID=netbsd_powerpc
4428         ;;
4429     sparc)
4430         CPUNAME=SPARC
4431         RTL_ARCH=SPARC
4432         PLATFORMID=netbsd_sparc
4433         ;;
4434     x86_64)
4435         CPUNAME=X86_64
4436         RTL_ARCH=X86_64
4437         PLATFORMID=netbsd_x86_64
4438         ;;
4439     *)
4440         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4441         ;;
4442     esac
4443     ;;
4445 openbsd*)
4446     COM=GCC
4447     USING_X11=TRUE
4448     OS=OPENBSD
4449     RTL_OS=OpenBSD
4450     P_SEP=:
4452     case "$host_cpu" in
4453     i*86)
4454         CPUNAME=INTEL
4455         RTL_ARCH=x86
4456         PLATFORMID=openbsd_x86
4457         ;;
4458     x86_64)
4459         CPUNAME=X86_64
4460         RTL_ARCH=X86_64
4461         PLATFORMID=openbsd_x86_64
4462         ;;
4463     *)
4464         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4465         ;;
4466     esac
4467     SOLARINC="$SOLARINC -I/usr/local/include"
4468     ;;
4470 solaris*)
4471     COM=GCC
4472     USING_X11=TRUE
4473     OS=SOLARIS
4474     RTL_OS=Solaris
4475     P_SEP=:
4477     case "$host_cpu" in
4478     i*86)
4479         CPUNAME=INTEL
4480         RTL_ARCH=x86
4481         PLATFORMID=solaris_x86
4482         ;;
4483     sparc)
4484         CPUNAME=SPARC
4485         RTL_ARCH=SPARC
4486         PLATFORMID=solaris_sparc
4487         ;;
4488     sparc64)
4489         CPUNAME=SPARC64
4490         RTL_ARCH=SPARC64
4491         PLATFORMID=solaris_sparc64
4492         ;;
4493     *)
4494         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4495         ;;
4496     esac
4497     SOLARINC="$SOLARINC -I/usr/local/include"
4498     ;;
4501     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4502     ;;
4503 esac
4505 if test "$with_x" = "no"; then
4506     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4509 ENABLE_HEADLESS=""
4510 if test "$enable_gui" = "no"; then
4511     if test "$USING_X11" != TRUE; then
4512         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4513     fi
4514     USING_X11=
4515     ENABLE_HEADLESS=TRUE
4516     AC_DEFINE(HAVE_FEATURE_UI,0)
4517     test_cairo=yes
4519 AC_SUBST(ENABLE_HEADLESS)
4521 WORKDIR="${BUILDDIR}/workdir"
4522 INSTDIR="${BUILDDIR}/instdir"
4523 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4524 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4525 AC_SUBST(COM)
4526 AC_SUBST(CPUNAME)
4527 AC_SUBST(RTL_OS)
4528 AC_SUBST(RTL_ARCH)
4529 AC_SUBST(EPM_FLAGS)
4530 AC_SUBST(USING_X11)
4531 AC_SUBST([INSTDIR])
4532 AC_SUBST([INSTROOT])
4533 AC_SUBST(OS)
4534 AC_SUBST(P_SEP)
4535 AC_SUBST(WORKDIR)
4536 AC_SUBST(PLATFORMID)
4537 AC_SUBST(WINDOWS_X64)
4538 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4540 dnl ===================================================================
4541 dnl Test which package format to use
4542 dnl ===================================================================
4543 AC_MSG_CHECKING([which package format to use])
4544 if test -n "$with_package_format" -a "$with_package_format" != no; then
4545     for i in $with_package_format; do
4546         case "$i" in
4547         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4548             ;;
4549         *)
4550             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4551 aix - AIX software distribution
4552 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4553 deb - Debian software distribution
4554 pkg - Solaris software distribution
4555 rpm - RedHat software distribution
4557 LibreOffice additionally supports:
4558 archive - .tar.gz or .zip
4559 dmg - Mac OS X .dmg
4560 installed - installation tree
4561 msi - Windows .msi
4562         ])
4563             ;;
4564         esac
4565     done
4566     PKGFORMAT="$with_package_format"
4567     AC_MSG_RESULT([$PKGFORMAT])
4568 else
4569     PKGFORMAT=
4570     AC_MSG_RESULT([none])
4572 AC_SUBST(PKGFORMAT)
4574 dnl ===================================================================
4575 dnl Set up a different compiler to produce tools to run on the build
4576 dnl machine when doing cross-compilation
4577 dnl ===================================================================
4579 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4580 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4581 if test "$cross_compiling" = "yes"; then
4582     AC_MSG_CHECKING([for BUILD platform configuration])
4583     echo
4584     rm -rf CONF-FOR-BUILD config_build.mk
4585     mkdir CONF-FOR-BUILD
4586     # Here must be listed all files needed when running the configure script. In particular, also
4587     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4588     # keep them in the same order as there.
4589     (cd $SRC_ROOT && tar cf - \
4590         config.guess \
4591         bin/get_config_variables \
4592         solenv/bin/getcompver.awk \
4593         solenv/inc/langlist.mk \
4594         config_host.mk.in \
4595         config_host_lang.mk.in \
4596         Makefile.in \
4597         lo.xcent.in \
4598         bin/bffvalidator.sh.in \
4599         bin/odfvalidator.sh.in \
4600         bin/officeotron.sh.in \
4601         instsetoo_native/util/openoffice.lst.in \
4602         config_host/*.in \
4603         sysui/desktop/macosx/Info.plist.in \
4604         ios/lo.xcconfig.in) \
4605     | (cd CONF-FOR-BUILD && tar xf -)
4606     cp configure CONF-FOR-BUILD
4607     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4608     (
4609     unset COM USING_X11 OS CPUNAME
4610     unset CC CXX SYSBASE CFLAGS
4611     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4612     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4613     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4614     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4615     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4616     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4617     cd CONF-FOR-BUILD
4618     sub_conf_opts=""
4619     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4620     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4621     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4622     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4623     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4624     # we need the msi build tools on mingw if we are creating the
4625     # installation set
4626     if test "$WITH_MINGW" = "yes"; then
4627         enable_winegcc_for_build=
4628         for pkgformat in $PKGFORMAT; do
4629             case "$pkgformat" in
4630             msi|native) enable_winegcc_for_build=yes ;;
4631             esac
4632         done
4633         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4634     fi
4635     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4636     # Don't bother having configure look for stuff not needed for the build platform anyway
4637     ./configure \
4638         --disable-cups \
4639         --disable-gtk3 \
4640         --disable-pdfimport \
4641         --disable-postgresql-sdbc \
4642         --with-parallelism="$with_parallelism" \
4643         --without-doxygen \
4644         --without-java \
4645         $sub_conf_opts \
4646         --srcdir=$srcdir \
4647         2>&1 | sed -e 's/^/    /'
4648     test -f ./config_host.mk 2>/dev/null || exit
4649     cp config_host.mk ../config_build.mk
4650     cp config_host_lang.mk ../config_build_lang.mk
4651     mv config.log ../config.Build.log
4652     mkdir -p ../config_build
4653     mv config_host/*.h ../config_build
4654     . ./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
4656     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
4657         VV='$'$V
4658         VV=`eval "echo $VV"`
4659         if test -n "$VV"; then
4660             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4661             echo "$line" >>build-config
4662         fi
4663     done
4665     for V in INSTDIR INSTROOT WORKDIR; do
4666         VV='$'$V
4667         VV=`eval "echo $VV"`
4668         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4669         if test -n "$VV"; then
4670             line="${V}_FOR_BUILD='$VV'"
4671             echo "$line" >>build-config
4672         fi
4673     done
4675     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4676     echo "$line" >>build-config
4678     )
4679     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4680     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])
4681     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4682              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4684     eval `cat CONF-FOR-BUILD/build-config`
4686     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4688     rm -rf CONF-FOR-BUILD
4689 else
4690     OS_FOR_BUILD="$OS"
4691     CC_FOR_BUILD="$CC"
4692     CXX_FOR_BUILD="$CXX"
4693     INSTDIR_FOR_BUILD="$INSTDIR"
4694     INSTROOT_FOR_BUILD="$INSTROOT"
4695     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4696     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4697     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4698     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4699     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4700     WORKDIR_FOR_BUILD="$WORKDIR"
4702 AC_SUBST(OS_FOR_BUILD)
4703 AC_SUBST(INSTDIR_FOR_BUILD)
4704 AC_SUBST(INSTROOT_FOR_BUILD)
4705 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4706 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4707 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4708 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4709 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4710 AC_SUBST(WORKDIR_FOR_BUILD)
4712 dnl ===================================================================
4713 dnl Check for syslog header
4714 dnl ===================================================================
4715 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4717 # placeholder for future crash reporter feature
4718 ENABLE_CRASHDUMP=""
4719 AC_SUBST(ENABLE_CRASHDUMP)
4721 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4722 dnl ===================================================================
4723 AC_MSG_CHECKING([whether to turn warnings to errors])
4724 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4725     ENABLE_WERROR="TRUE"
4726     AC_MSG_RESULT([yes])
4727 else
4728     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4729         ENABLE_WERROR="TRUE"
4730         AC_MSG_RESULT([yes])
4731     else
4732         AC_MSG_RESULT([no])
4733     fi
4735 AC_SUBST(ENABLE_WERROR)
4737 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4738 dnl ===================================================================
4739 AC_MSG_CHECKING([whether to have assert to abort in release code])
4740 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4741     ASSERT_ALWAYS_ABORT="TRUE"
4742     AC_MSG_RESULT([yes])
4743 else
4744     ASSERT_ALWAYS_ABORT="FALSE"
4745     AC_MSG_RESULT([no])
4747 AC_SUBST(ASSERT_ALWAYS_ABORT)
4749 # Determine whether to use ooenv for the instdir installation
4750 # ===================================================================
4751 if test $_os != "WINNT" -a $_os != "Darwin"; then
4752     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4753     if test "$enable_ooenv" = "no"; then
4754         AC_MSG_RESULT([no])
4755     else
4756         ENABLE_OOENV="TRUE"
4757         AC_MSG_RESULT([yes])
4758     fi
4760 AC_SUBST(ENABLE_OOENV)
4762 if test "$USING_X11" != TRUE; then
4763     # be sure to do not mess with unneeded stuff
4764     test_randr=no
4765     test_xrender=no
4766     test_cups=no
4767     test_dbus=no
4768     test_gtk=no
4769     build_gstreamer_1_0=no
4770     build_gstreamer_0_10=no
4771     test_tde=no
4772     test_kde4=no
4773     enable_cairo_canvas=no
4776 dnl ===================================================================
4777 dnl check for cups support
4778 dnl ===================================================================
4779 ENABLE_CUPS=""
4781 if test "$enable_cups" = "no"; then
4782     test_cups=no
4785 AC_MSG_CHECKING([whether to enable CUPS support])
4786 if test "$test_cups" = "yes"; then
4787     ENABLE_CUPS="TRUE"
4788     AC_MSG_RESULT([yes])
4790     AC_MSG_CHECKING([whether cups support is present])
4791     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4792     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4793     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4794         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4795     fi
4797 else
4798     AC_MSG_RESULT([no])
4801 AC_SUBST(ENABLE_CUPS)
4803 # fontconfig checks
4804 if test "$test_fontconfig" = "yes"; then
4805     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4806     SYSTEM_FONTCONFIG=TRUE
4807     FilterLibs "${FONTCONFIG_LIBS}"
4808     FONTCONFIG_LIBS="${filteredlibs}"
4810 AC_SUBST(FONTCONFIG_CFLAGS)
4811 AC_SUBST(FONTCONFIG_LIBS)
4812 AC_SUBST([SYSTEM_FONTCONFIG])
4814 dnl whether to find & fetch external tarballs?
4815 dnl ===================================================================
4816 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4817    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4818        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4819    else
4820        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4821    fi
4823 if test -z "$TARFILE_LOCATION"; then
4824     if test -d "$SRC_ROOT/src" ; then
4825         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4826         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4827     fi
4828     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4829 else
4830     AbsolutePath "$TARFILE_LOCATION"
4831     PathFormat "${absolute_path}"
4832     TARFILE_LOCATION="${formatted_path}"
4834 AC_SUBST(TARFILE_LOCATION)
4836 AC_MSG_CHECKING([whether we want to fetch tarballs])
4837 if test "$enable_fetch_external" != "no"; then
4838     if test "$with_all_tarballs" = "yes"; then
4839         AC_MSG_RESULT(["yes, all of them"])
4840         DO_FETCH_TARBALLS="ALL"
4841     else
4842         AC_MSG_RESULT(["yes, if we use them"])
4843         DO_FETCH_TARBALLS="TRUE"
4844     fi
4845 else
4846     AC_MSG_RESULT([no])
4847     DO_FETCH_TARBALLS=
4849 AC_SUBST(DO_FETCH_TARBALLS)
4851 AC_MSG_CHECKING([whether to build help])
4852 HELP_COMMON_ONLY=FALSE
4853 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4854     BUILD_TYPE="$BUILD_TYPE HELP"
4855     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4856     if test "$with_help" = "common" ; then
4857         HELP_COMMON_ONLY=TRUE
4858         AC_MSG_RESULT([common only])
4859     else
4860         SCPDEFS="$SCPDEFS -DWITH_HELP"
4861         AC_MSG_RESULT([yes])
4862     fi
4863 else
4864     AC_MSG_RESULT([no])
4866 AC_SUBST(HELP_COMMON_ONLY)
4868 dnl Test whether to include MySpell dictionaries
4869 dnl ===================================================================
4870 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4871 if test "$with_myspell_dicts" = "yes"; then
4872     AC_MSG_RESULT([yes])
4873     WITH_MYSPELL_DICTS=TRUE
4874     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4875     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4876 else
4877     AC_MSG_RESULT([no])
4878     WITH_MYSPELL_DICTS=
4880 AC_SUBST(WITH_MYSPELL_DICTS)
4882 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4883 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4884     if test "$with_system_dicts" = yes; then
4885         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4886     fi
4887     with_system_dicts=no
4890 AC_MSG_CHECKING([whether to use dicts from external paths])
4891 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4892     AC_MSG_RESULT([yes])
4893     SYSTEM_DICTS=TRUE
4894     AC_MSG_CHECKING([for spelling dictionary directory])
4895     if test -n "$with_external_dict_dir"; then
4896         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4897     else
4898         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4899         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4900             DICT_SYSTEM_DIR=file:///usr/share/myspell
4901         fi
4902     fi
4903     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4904     AC_MSG_CHECKING([for hyphenation patterns directory])
4905     if test -n "$with_external_hyph_dir"; then
4906         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4907     else
4908         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4909     fi
4910     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4911     AC_MSG_CHECKING([for thesaurus directory])
4912     if test -n "$with_external_thes_dir"; then
4913         THES_SYSTEM_DIR=file://$with_external_thes_dir
4914     else
4915         THES_SYSTEM_DIR=file:///usr/share/mythes
4916     fi
4917     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4918 else
4919     AC_MSG_RESULT([no])
4920     SYSTEM_DICTS=
4922 AC_SUBST(SYSTEM_DICTS)
4923 AC_SUBST(DICT_SYSTEM_DIR)
4924 AC_SUBST(HYPH_SYSTEM_DIR)
4925 AC_SUBST(THES_SYSTEM_DIR)
4927 dnl ===================================================================
4928 dnl enable pch by default on windows
4929 dnl enable it explicitly otherwise
4930 AC_MSG_CHECKING([whether to enable pch feature])
4931 ENABLE_PCH=""
4932 if test "$enable_pch" != "no"; then
4933     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4934         ENABLE_PCH="TRUE"
4935         AC_MSG_RESULT([yes])
4936     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4937         ENABLE_PCH="TRUE"
4938         AC_MSG_RESULT([yes])
4939     elif test -n "$enable_pch"; then
4940         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4941     else
4942         AC_MSG_RESULT([no])
4943     fi
4944 else
4945     AC_MSG_RESULT([no])
4947 AC_SUBST(ENABLE_PCH)
4949 TAB=`printf '\t'`
4951 AC_MSG_CHECKING([the GNU Make version])
4952 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4953 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4954 if test "$_make_longver" -ge "038200"; then
4955     AC_MSG_RESULT([$GNUMAKE $_make_version])
4957 elif test "$_make_longver" -ge "038100"; then
4958     if test "$build_os" = "cygwin"; then
4959         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4960     fi
4961     AC_MSG_RESULT([$GNUMAKE $_make_version])
4963     dnl ===================================================================
4964     dnl Search all the common names for sha1sum
4965     dnl ===================================================================
4966     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4967     if test -z "$SHA1SUM"; then
4968         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4969     elif test "$SHA1SUM" = "openssl"; then
4970         SHA1SUM="openssl sha1"
4971     fi
4972     AC_MSG_CHECKING([for GNU Make bug 20033])
4973     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4974     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4975 A := \$(wildcard *.a)
4977 .PHONY: all
4978 all: \$(A:.a=.b)
4979 <TAB>@echo survived bug20033.
4981 .PHONY: setup
4982 setup:
4983 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4985 define d1
4986 @echo lala \$(1)
4987 @sleep 1
4988 endef
4990 define d2
4991 @echo tyty \$(1)
4992 @sleep 1
4993 endef
4995 %.b : %.a
4996 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4997 <TAB>\$(call d1,\$(CHECKSUM)),\
4998 <TAB>\$(call d2,\$(CHECKSUM)))
5000     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5001         no_parallelism_make="YES"
5002         AC_MSG_RESULT([yes, disable parallelism])
5003     else
5004         AC_MSG_RESULT([no, keep parallelism enabled])
5005     fi
5006     rm -rf $TESTGMAKEBUG20033
5007 else
5008     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5011 # find if gnumake support file function
5012 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5013 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5014 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5015     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5017 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5018 \$(file >test.txt,Success )
5020 .PHONY: all
5021 all:
5022 <TAB>@cat test.txt
5025 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5026 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5027     HAVE_GNUMAKE_FILE_FUNC=TRUE
5028     AC_MSG_RESULT([yes])
5029 else
5030     AC_MSG_RESULT([no])
5032 rm -rf $TESTGMAKEFILEFUNC
5033 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5034 AC_SUBST(GNUMAKE_WIN_NATIVE)
5036 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5037 STALE_MAKE=
5038 if test "$_make_ver_check" = ""; then
5039    STALE_MAKE=TRUE
5042 HAVE_LD_HASH_STYLE=FALSE
5043 WITH_LINKER_HASH_STYLE=
5044 AC_MSG_CHECKING( for --hash-style gcc linker support )
5045 if test "$GCC" = "yes"; then
5046     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5047         hash_styles="gnu sysv"
5048     elif test "$with_linker_hash_style" = "no"; then
5049         hash_styles=
5050     else
5051         hash_styles="$with_linker_hash_style"
5052     fi
5054     for hash_style in $hash_styles; do
5055         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5056         hash_style_ldflags_save=$LDFLAGS
5057         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5059         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5060             [
5061 #include <stdio.h>
5062             ],[
5063 printf ("");
5064             ])],
5065             [
5066                   HAVE_LD_HASH_STYLE=TRUE
5067                   WITH_LINKER_HASH_STYLE=$hash_style
5068             ],
5069             [HAVE_LD_HASH_STYLE=FALSE],
5070             [HAVE_LD_HASH_STYLE=FALSE])
5071         LDFLAGS=$hash_style_ldflags_save
5072     done
5074     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5075         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5076     else
5077         AC_MSG_RESULT( no )
5078     fi
5079     LDFLAGS=$hash_style_ldflags_save
5080 else
5081     AC_MSG_RESULT( no )
5083 AC_SUBST(HAVE_LD_HASH_STYLE)
5084 AC_SUBST(WITH_LINKER_HASH_STYLE)
5086 dnl ===================================================================
5087 dnl Check whether there's a Perl version available.
5088 dnl ===================================================================
5089 if test -z "$with_perl_home"; then
5090     AC_PATH_PROG(PERL, perl)
5091 else
5092     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5093     _perl_path="$with_perl_home/bin/perl"
5094     if test -x "$_perl_path"; then
5095         PERL=$_perl_path
5096     else
5097         AC_MSG_ERROR([$_perl_path not found])
5098     fi
5101 dnl ===================================================================
5102 dnl Testing for Perl version 5 or greater.
5103 dnl $] is the Perl version variable, it is returned as an integer
5104 dnl ===================================================================
5105 if test "$PERL"; then
5106     AC_MSG_CHECKING([the Perl version])
5107     ${PERL} -e "exit($]);"
5108     _perl_version=$?
5109     if test "$_perl_version" -lt 5; then
5110         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5111     fi
5112     AC_MSG_RESULT([checked (perl $_perl_version)])
5113 else
5114     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5117 dnl ===================================================================
5118 dnl Testing for required Perl modules
5119 dnl ===================================================================
5121 AC_MSG_CHECKING([for required Perl modules])
5122 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5123     AC_MSG_RESULT([all modules found])
5124 else
5125     AC_MSG_RESULT([failed to find some modules])
5126     # Find out which modules are missing.
5127     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5128         missing_perl_modules="$missing_perl_modules Cwd"
5129     fi
5130     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5131         missing_perl_modules="$missing_perl_modules Digest::MD5"
5132     fi
5133        AC_MSG_ERROR([
5134     The missing Perl modules are: $missing_perl_modules
5135     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5138 dnl ===================================================================
5139 dnl Check for pkg-config
5140 dnl ===================================================================
5141 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5142     PKG_PROG_PKG_CONFIG
5145 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5147     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5148     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5149     # explicitly. Or put /path/to/compiler in PATH yourself.
5151     # Use wrappers for LTO
5152     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5153         AC_CHECK_TOOL(AR,gcc-ar)
5154         AC_CHECK_TOOL(NM,gcc-nm)
5155         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5156     else
5157         AC_CHECK_TOOL(AR,ar)
5158         AC_CHECK_TOOL(NM,nm)
5159         AC_CHECK_TOOL(RANLIB,ranlib)
5160     fi
5161     AC_CHECK_TOOL(OBJDUMP,objdump)
5162     AC_CHECK_TOOL(READELF,readelf)
5163     AC_CHECK_TOOL(STRIP,strip)
5164     if test "$_os" = "WINNT"; then
5165         AC_CHECK_TOOL(DLLTOOL,dlltool)
5166         AC_CHECK_TOOL(WINDRES,windres)
5167     fi
5169 AC_SUBST(AR)
5170 AC_SUBST(DLLTOOL)
5171 AC_SUBST(NM)
5172 AC_SUBST(OBJDUMP)
5173 AC_SUBST(PKG_CONFIG)
5174 AC_SUBST(RANLIB)
5175 AC_SUBST(READELF)
5176 AC_SUBST(STRIP)
5177 AC_SUBST(WINDRES)
5179 dnl ===================================================================
5180 dnl pkg-config checks on Mac OS X
5181 dnl ===================================================================
5183 if test $_os = Darwin; then
5184     AC_MSG_CHECKING([for bogus pkg-config])
5185     if test -n "$PKG_CONFIG"; then
5186         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5187             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5188         else
5189             if test "$enable_bogus_pkg_config" = "yes"; then
5190                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5191             else
5192                 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.])
5193             fi
5194         fi
5195     else
5196         AC_MSG_RESULT([no, good])
5197     fi
5200 find_csc()
5202     # Return value: $csctest
5204     unset csctest
5206     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5207     if test -n "$regvalue"; then
5208         csctest=$regvalue
5209         return
5210     fi
5213 find_al()
5215     # Return value: $altest
5217     unset altest
5219     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5220         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5221         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5222             altest=$regvalue
5223             return
5224         fi
5225     done
5228 find_dotnetsdk()
5230     # Return value: $frametest (that's a silly name...)
5232     unset frametest
5234     for ver in 1.1 2.0; do
5235         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5236         if test -n "$regvalue"; then
5237             frametest=$regvalue
5238             return
5239         fi
5240     done
5243 find_dotnetsdk46()
5245     unset frametest
5247     for ver in 4.6.1 4.6; do
5248         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5249         if test -n "$regvalue"; then
5250             frametest=$regvalue
5251             return
5252         fi
5253         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5254         if test -n "$regvalue"; then
5255             frametest=$regvalue
5256             return
5257         fi
5258     done
5261 find_winsdk_version()
5263     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5264     # Return values: $winsdktest, $winsdklibsubdir
5266     unset winsdktest winsdklibsubdir
5268     # Why we look for them in this particular order I don't know. But OTOH I
5269     case "$1" in
5270     7.*)
5271         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5272         if test -n "$regvalue"; then
5273             winsdktest=$regvalue
5274             winsdklibsubdir=.
5275             return
5276         fi
5277         ;;
5278     8.1|8.1A)
5279         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5280         if test -n "$regvalue"; then
5281             winsdktest=$regvalue
5282             winsdklibsubdir=winv6.3
5283             return
5284         fi
5285         ;;
5286     8.0|8.0A)
5287         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5288         if test -n "$regvalue"; then
5289             winsdktest=$regvalue
5290             winsdklibsubdir=win8
5291             return
5292         fi
5293         ;;
5294     10.0)
5295         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5296         if test -n "$regvalue"; then
5297             winsdktest=$regvalue
5298             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5299             winsdklibsubdir=$regvalue
5300             return
5301         fi
5302         ;;
5303     esac
5306 find_winsdk()
5308     # Args: $1 (optional) : list of acceptable SDK versions
5309     # Return value: $winsdktest
5311     unset winsdktest
5313     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5314         find_winsdk_version $ver
5315         if test -n "$winsdktest"; then
5316             return
5317         fi
5318     done
5321 find_msms()
5323     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5324     AC_MSG_CHECKING([for $my_msm_file])
5325     msmdir=
5326     for ver in 12.0 14.0; do
5327         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5328         if test -n "$regvalue"; then
5329             if test -e "$regvalue/$my_msm_file"; then
5330                 msmdir=$regvalue
5331                 break
5332             fi
5333         fi
5334     done
5335     dnl Is the following fallback really necessary, or was it added in response
5336     dnl to never having started Visual Studio on a given machine, so the
5337     dnl registry keys checked above had presumably not yet been created?
5338     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5339     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5340     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5341     dnl expanding to "C:\Program Files\Common Files"), which would need
5342     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5343     dnl obtain its value from cygwin:
5344     if test -z "$msmdir"; then
5345         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5346         if test -e "$my_msm_dir/$my_msm_file"; then
5347             msmdir=$my_msm_dir
5348         fi
5349     fi
5350     if test -n "$msmdir"; then
5351         msmdir=`cygpath -m "$msmdir"`
5352         AC_MSG_RESULT([$msmdir])
5353     else
5354         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5355             AC_MSG_ERROR([not found])
5356         else
5357             AC_MSG_WARN([not found])
5358         fi
5359     fi
5362 find_msvc_x64_dlls()
5364     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5365     # http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
5366     # Refactored C Runtime (CRT): This CTP contains the first preview of the substantially refactored CRT.
5367     # msvcr140.dll no longer exists. It is replaced by a trio of DLLs: vcruntime140.dll, appcrt140.dll,
5368     # and desktopcrt140.dll.
5369     if test "$VCVER" = 140; then
5370        msvcdlls="msvcp${VCVER}.dll vcruntime${VCVER}.dll"
5371     else
5372        msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5373     fi
5374     for dll in $msvcdlls; do
5375         if ! test -f "$msvcdllpath/$dll"; then
5376             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5377         fi
5378     done
5381 if test "$build_os" = "cygwin"; then
5382     dnl Check midl.exe
5383     AC_MSG_CHECKING([for midl.exe])
5385     find_winsdk
5386     if test -f "$winsdktest/Bin/midl.exe"; then
5387         MIDL_PATH="$winsdktest/Bin"
5388     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5389         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5390     fi
5391     if test ! -f "$MIDL_PATH/midl.exe"; then
5392         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5393     else
5394         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5395     fi
5397     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5398     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5400     dnl Check csc.exe
5401     AC_MSG_CHECKING([for csc.exe])
5402     find_csc
5403     if test -f "$csctest/csc.exe"; then
5404         CSC_PATH="$csctest"
5405     fi
5406     if test ! -f "$CSC_PATH/csc.exe"; then
5407         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5408     else
5409         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5410     fi
5412     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5414     dnl Check al.exe
5415     AC_MSG_CHECKING([for al.exe])
5416     find_winsdk
5417     if test -f "$winsdktest/Bin/al.exe"; then
5418         AL_PATH="$winsdktest/Bin"
5419     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5420         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5421     fi
5423     if test -z "$AL_PATH"; then
5424         find_al
5425         if test -f "$altest/bin/al.exe"; then
5426             AL_PATH="$altest/bin"
5427         elif test -f "$altest/al.exe"; then
5428             AL_PATH="$altest"
5429         fi
5430     fi
5431     if test ! -f "$AL_PATH/al.exe"; then
5432         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5433     else
5434         AC_MSG_RESULT([$AL_PATH/al.exe])
5435     fi
5437     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5439     dnl Check mscoree.lib / .NET Framework dir
5440     AC_MSG_CHECKING(.NET Framework find_dotnetsdk)
5441     find_dotnetsdk
5442     if test -f "$frametest/lib/mscoree.lib"; then
5443         DOTNET_FRAMEWORK_HOME="$frametest"
5444     else
5445         AC_MSG_CHECKING(.NET Framework find_winsdk)
5446         find_winsdk
5447         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5448             DOTNET_FRAMEWORK_HOME="$winsdktest"
5449         else
5450             AC_MSG_CHECKING(.NET Framework find_dotnetsdk46)
5451             find_dotnetsdk46
5452             PathFormat "$frametest"
5453             frametest="$formatted_path"
5454             AC_MSG_CHECKING(found: $frametest/um/$WINDOWS_SDK_ARCH/mscoree.lib)
5455             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5456                  DOTNET_FRAMEWORK_HOME="$frametest"
5457             fi
5458         fi
5459     fi
5461     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
5462         AC_MSG_ERROR([mscoree.lib not found])
5463     fi
5464     AC_MSG_RESULT(found)
5466     PathFormat "$MIDL_PATH"
5467     MIDL_PATH="$formatted_path"
5469     PathFormat "$AL_PATH"
5470     AL_PATH="$formatted_path"
5472     PathFormat "$DOTNET_FRAMEWORK_HOME"
5473     DOTNET_FRAMEWORK_HOME="$formatted_path"
5475     PathFormat "$CSC_PATH"
5476     CSC_PATH="$formatted_path"
5479 dnl ===================================================================
5480 dnl Check if stdc headers are available excluding MSVC.
5481 dnl ===================================================================
5482 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5483     AC_HEADER_STDC
5486 dnl ===================================================================
5487 dnl Testing for C++ compiler and version...
5488 dnl ===================================================================
5490 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5491     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5492     save_CXXFLAGS=$CXXFLAGS
5493     AC_PROG_CXX
5494     CXXFLAGS=$save_CXXFLAGS
5495 else
5496     if test -n "$CC" -a -z "$CXX"; then
5497         CXX="$CC"
5498     fi
5501 dnl check for GNU C++ compiler version
5502 if test "$GXX" = "yes" -a "$CXX" != "emcc"; then
5503     AC_MSG_CHECKING([the GNU C++ compiler version])
5505     _gpp_version=`$CXX -dumpversion`
5506     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5508     if test "$_gpp_majmin" -lt "401"; then
5509         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5510     else
5511         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5512     fi
5514     dnl see https://code.google.com/p/android/issues/detail?id=41770
5515     if test "$_gpp_majmin" -ge "401"; then
5516         glibcxx_threads=no
5517         AC_LANG_PUSH([C++])
5518         AC_REQUIRE_CPP
5519         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5520         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5521             #include <bits/c++config.h>]],[[
5522             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5523             && !defined(_GLIBCXX__PTHREADS) \
5524             && !defined(_GLIBCXX_HAS_GTHREADS)
5525             choke me
5526             #endif
5527         ]])],[AC_MSG_RESULT([yes])
5528         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5529         AC_LANG_POP([C++])
5530         if test $glibcxx_threads = yes; then
5531             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5532         fi
5533      fi
5535 AC_SUBST(BOOST_CXXFLAGS)
5538 # prefx CXX with ccache if needed
5540 if test "$CCACHE" != ""; then
5541     AC_MSG_CHECKING([whether $CXX is already ccached])
5542     AC_LANG_PUSH([C++])
5543     save_CXXFLAGS=$CXXFLAGS
5544     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5545     dnl an empty program will do, we're checking the compiler flags
5546     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5547                       [use_ccache=yes], [use_ccache=no])
5548     if test $use_ccache = yes; then
5549         AC_MSG_RESULT([yes])
5550     else
5551         CXX="$CCACHE $CXX"
5552         AC_MSG_RESULT([no])
5553     fi
5554     CXXFLAGS=$save_CXXFLAGS
5555     AC_LANG_POP([C++])
5558 dnl ===================================================================
5559 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5560 dnl ===================================================================
5562 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5563     AC_PROG_CXXCPP
5565     dnl Check whether there's a C pre-processor.
5566     AC_PROG_CPP
5570 dnl ===================================================================
5571 dnl Find integral type sizes and alignments
5572 dnl ===================================================================
5574 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5576     AC_CHECK_SIZEOF(long)
5577     AC_CHECK_SIZEOF(short)
5578     AC_CHECK_SIZEOF(int)
5579     AC_CHECK_SIZEOF(long long)
5580     AC_CHECK_SIZEOF(double)
5581     AC_CHECK_SIZEOF(void*)
5583     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5584     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5585     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5586     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5587     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5589     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5590     m4_pattern_allow([AC_CHECK_ALIGNOF])
5591     m4_ifdef([AC_CHECK_ALIGNOF],
5592         [
5593             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5594             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5595             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5596             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5597         ],
5598         [
5599             case "$_os-$host_cpu" in
5600             Linux-i686)
5601                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5602                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5603                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5604                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5605                 ;;
5606             Linux-x86_64)
5607                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5608                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5609                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5610                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5611                 ;;
5612             *)
5613                 if test -z "$ac_cv_alignof_short" -o \
5614                         -z "$ac_cv_alignof_int" -o \
5615                         -z "$ac_cv_alignof_long" -o \
5616                         -z "$ac_cv_alignof_double"; then
5617                    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.])
5618                 fi
5619                 ;;
5620             esac
5621         ])
5623     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5624     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5625     if test $ac_cv_sizeof_long -eq 8; then
5626         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5627     elif test $ac_cv_sizeof_double -eq 8; then
5628         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5629     else
5630         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5631     fi
5633     dnl Check for large file support
5634     AC_SYS_LARGEFILE
5635     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5636         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5637     fi
5638     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5639         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5640     fi
5641 else
5642     # Hardcode for MSVC
5643     SAL_TYPES_SIZEOFSHORT=2
5644     SAL_TYPES_SIZEOFINT=4
5645     SAL_TYPES_SIZEOFLONG=4
5646     SAL_TYPES_SIZEOFLONGLONG=8
5647     if test "$BITNESS_OVERRIDE" = ""; then
5648         SAL_TYPES_SIZEOFPOINTER=4
5649     else
5650         SAL_TYPES_SIZEOFPOINTER=8
5651     fi
5652     SAL_TYPES_ALIGNMENT2=2
5653     SAL_TYPES_ALIGNMENT4=4
5654     SAL_TYPES_ALIGNMENT8=8
5655     LFS_CFLAGS=''
5657 AC_SUBST(LFS_CFLAGS)
5659 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5660 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5661 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5662 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5663 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5664 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5665 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5666 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5668 dnl ===================================================================
5669 dnl Check whether to enable runtime optimizations
5670 dnl ===================================================================
5671 ENABLE_RUNTIME_OPTIMIZATIONS=
5672 AC_MSG_CHECKING([whether to enable runtime optimizations])
5673 if test -z "$enable_runtime_optimizations"; then
5674     for i in $CC; do
5675         case $i in
5676         -fsanitize=*)
5677             enable_runtime_optimizations=no
5678             break
5679             ;;
5680         esac
5681     done
5683 if test "$enable_runtime_optimizations" != no; then
5684     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5685     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5686     AC_MSG_RESULT([yes])
5687 else
5688     AC_MSG_RESULT([no])
5690 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5692 dnl ===================================================================
5693 dnl Check if valgrind headers are available
5694 dnl ===================================================================
5695 ENABLE_VALGRIND=
5696 if test "$cross_compiling" != yes; then
5697     prev_cppflags=$CPPFLAGS
5698     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5699     # or where does it come from?
5700     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5701     AC_CHECK_HEADER([valgrind/valgrind.h],
5702         [ENABLE_VALGRIND=TRUE])
5703     CPPFLAGS=$prev_cppflags
5705 AC_SUBST([ENABLE_VALGRIND])
5706 if test -z "$ENABLE_VALGRIND"; then
5707     VALGRIND_CFLAGS=
5709 AC_SUBST([VALGRIND_CFLAGS])
5712 dnl ===================================================================
5713 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5714 dnl ===================================================================
5716 # We need at least the sys/sdt.h include header.
5717 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5718 if test "$SDT_H_FOUND" = "TRUE"; then
5719     # Found sys/sdt.h header, now make sure the c++ compiler works.
5720     # Old g++ versions had problems with probes in constructors/destructors.
5721     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5722     AC_LANG_PUSH([C++])
5723     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5724     #include <sys/sdt.h>
5725     class ProbeClass
5726     {
5727     private:
5728       int& ref;
5729       const char *name;
5731     public:
5732       ProbeClass(int& v, const char *n) : ref(v), name(n)
5733       {
5734         DTRACE_PROBE2(_test_, cons, name, ref);
5735       }
5737       void method(int min)
5738       {
5739         DTRACE_PROBE3(_test_, meth, name, ref, min);
5740         ref -= min;
5741       }
5743       ~ProbeClass()
5744       {
5745         DTRACE_PROBE2(_test_, dest, name, ref);
5746       }
5747     };
5748     ]],[[
5749     int i = 64;
5750     DTRACE_PROBE1(_test_, call, i);
5751     ProbeClass inst = ProbeClass(i, "call");
5752     inst.method(24);
5753     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5754           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5755     AC_LANG_POP([C++])
5757 AC_CONFIG_HEADERS([config_host/config_probes.h])
5759 dnl ===================================================================
5760 dnl Set the MinGW sys-root
5761 dnl ===================================================================
5762 if test "$WITH_MINGW" = "yes"; then
5763     AC_MSG_CHECKING([for MinGW sysroot])
5764     sysroot=`$CC -print-sysroot`
5765     AS_IF([test -d "$sysroot"/mingw],
5766           [MINGW_SYSROOT="$sysroot"/mingw
5767            AC_MSG_RESULT([$MINGW_SYSROOT])],
5768           [AC_MSG_RESULT([not found])
5769            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5771 AC_SUBST([MINGW_DLLS])
5772 AC_SUBST([MINGW_SYSROOT])
5774 dnl ===================================================================
5775 dnl Set the MinGW include directories
5776 dnl ===================================================================
5777 if test "$WITH_MINGW" = "yes"; then
5778     AC_MSG_CHECKING([for MinGW include path])
5779     cat >conftest.$ac_ext <<_ACEOF
5780 #include <stddef.h>
5781 #include <bits/c++config.h>
5782 _ACEOF
5783     _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`
5784     rm conftest.$ac_ext
5785     if test -z "$_mingw_lib_include_path"; then
5786         _mingw_lib_include_path="NO_LIB_INCLUDE"
5787         AC_MSG_RESULT([no MinGW include path])
5788     else
5789         AC_MSG_RESULT([$_mingw_lib_include_path])
5790     fi
5791     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5792     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5794     AC_LANG_PUSH([C++])
5796     AC_MSG_CHECKING([for dynamic libgcc])
5797     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5798 #include <iostream>
5799 using namespace std;
5800 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5801             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5802             if test -n "$MINGW_GCCDLL"; then
5803                 MINGW_SHARED_GCCLIB=TRUE
5804                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5805             else
5806                 MINGW_SHARED_GCCLIB=
5807                 AC_MSG_RESULT([no])
5808             fi
5809        ],[ AC_MSG_RESULT([no])
5811     ])
5813     AC_MSG_CHECKING([for dynamic libstdc++])
5814     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5815 #include <iostream>
5816 using namespace std;
5817 ]], [[ cout << "Hello there." << endl; ]])],[
5818             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5819             if test -n "$MINGW_GXXDLL"; then
5820                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5821                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5822                 if test "$CROSS_COMPILING" = "TRUE"; then
5823                     dnl m4 escaping!
5824                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5825                 fi
5826                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5827                 MINGW_SHARED_GXXLIB=TRUE
5828                 AC_MSG_RESULT([$MINGW_GXXDLL])
5829             else
5830                 MINGW_SHARED_GXXLIB=
5831                 AC_MSG_RESULT([no])
5832             fi
5833        ],[ AC_MSG_RESULT([no])
5835     ])
5837     AC_LANG_POP([C++])
5839     AC_SUBST(MINGW_SHARED_GCCLIB)
5840     AC_SUBST(MINGW_SHARED_GXXLIB)
5841     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5842     AC_SUBST(MINGW_GCCDLL)
5843     AC_SUBST(MINGW_GXXDLL)
5846 dnl *************************************************************
5847 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5848 dnl *************************************************************
5849 if test "$WITH_MINGW" = "yes"; then
5850     AC_MSG_CHECKING([exception type])
5851     AC_LANG_PUSH([C++])
5852     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5854         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5856         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5857     ])
5858     AC_MSG_RESULT($exceptions_type)
5859     AC_LANG_POP([C++])
5862 EXCEPTIONS="$exceptions_type"
5863 AC_SUBST(EXCEPTIONS)
5865 dnl ===================================================================
5866 dnl thread-safe statics
5867 dnl ===================================================================
5868 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5869 unset HAVE_THREADSAFE_STATICS
5870 if test "$GCC" = "yes"; then
5871     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5872     dnl us.  However, some C++ runtimes use a single lock for all static
5873     dnl variables, which can cause deadlock in multi-threaded applications.
5874     dnl This is not easily tested here; for POSIX-based systems, if executing
5875     dnl the following C++ program does not terminate then the tool chain
5876     dnl apparently has this problem:
5877     dnl
5878     dnl   #include <pthread.h>
5879     dnl   int h() { return 0; }
5880     dnl   void * g(void * unused) {
5881     dnl     static int n = h();
5882     dnl     return &n;
5883     dnl   }
5884     dnl   int f() {
5885     dnl     pthread_t t;
5886     dnl     pthread_create(&t, 0, g, 0);
5887     dnl     pthread_join(t, 0);
5888     dnl     return 0;
5889     dnl   }
5890     dnl   int main() {
5891     dnl     static int n = f();
5892     dnl     return n;
5893     dnl   }
5894     dnl
5895     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5896     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5897     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5898     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5899     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5900     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5901     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5902     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5903     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5904     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5905     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5906     dnl "too old"):
5907     if test "$_os" = Darwin; then
5908         dnl On Mac OS X, both /usr/lib/libstdc++.6.dylib and
5909         dnl /usr/lib/libc++1.dylib delegate to /usr/lib/libc++abi.dylib for the
5910         dnl __cxa_guard_* functionality; up to 10.8, libc++abi.dylib is
5911         dnl apparently provided by a libcppabi project that has broken semantics
5912         dnl (cf. <http://www.opensource.apple.com/source/libcppabi/libcppabi-26/
5913         dnl src/cxa_guard.cxx>), while in 10.9 (verified at least on 10.9.4) it
5914         dnl is apparently provided by LLVM's libcxxabi project, which has good
5915         dnl semantics (cf. <http://llvm.org/svn/llvm-project/libcxxabi/trunk/
5916         dnl src/cxa_guard.cpp>):
5917         if test "$MAC_OS_X_VERSION_MIN_REQUIRED" -ge 1090; then
5918             HAVE_THREADSAFE_STATICS=TRUE
5919         fi
5920     elif test "$_os" != Android; then
5921         if test "$COM_IS_CLANG" = TRUE; then
5922             AC_LANG_PUSH([C++])
5923             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5924 #include <list>
5925 #if defined __GLIBCXX__
5926 #if __GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306
5927 #error
5928 #endif
5929 #endif
5930                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5931             AC_LANG_POP([C++])
5932         else # known to work in GCC since version 4.3
5933             HAVE_THREADSAFE_STATICS=TRUE
5934         fi
5935     fi
5936     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5937         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5938         AC_MSG_RESULT([yes])
5939     else
5940         AC_MSG_RESULT([broken (i.e., no)])
5941     fi
5942 else
5943     # MSVC has sprouted C++11 thread-safe statics in 2015
5944     # http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
5945     if test "$COM" = "MSC" -a "$VCVER" -ge "140"; then
5946         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5947         AC_MSG_RESULT([yes])
5948     else
5949         AC_MSG_RESULT([no])
5950     fi
5952 AC_SUBST(HAVE_THREADSAFE_STATICS)
5954 dnl ===================================================================
5955 dnl visibility and other gcc features
5956 dnl ===================================================================
5957 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5958     if test "$COM" != MSC; then
5959         AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5960         save_CFLAGS=$CFLAGS
5961         CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5962         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5963         CFLAGS=$save_CFLAGS
5964         if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5965             AC_MSG_RESULT([yes])
5966         else
5967             AC_MSG_ERROR([no  This is no longer supported.])
5968         fi
5969     fi
5971     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5972     save_CFLAGS=$CFLAGS
5973     CFLAGS="$CFLAGS -Werror -mno-avx"
5974     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5975     CFLAGS=$save_CFLAGS
5976     if test "$HAVE_GCC_AVX" = "TRUE"; then
5977         AC_MSG_RESULT([yes])
5978     else
5979         AC_MSG_RESULT([no])
5980     fi
5982     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5983     save_CFLAGS=$CFLAGS
5984     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5985     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5986     CFLAGS=$save_CFLAGS
5987     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5988         AC_MSG_RESULT([yes])
5989     else
5990         AC_MSG_RESULT([no])
5991     fi
5993     AC_MSG_CHECKING([whether $CC supports atomic functions])
5994     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5995     int v = 0;
5996     if (__sync_add_and_fetch(&v, 1) != 1 ||
5997         __sync_sub_and_fetch(&v, 1) != 0)
5998         return 1;
5999     __sync_synchronize();
6000     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6001         v != 1)
6002         return 1;
6003     return 0;
6004 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6005     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6006         AC_MSG_RESULT([yes])
6007         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6008     else
6009         AC_MSG_RESULT([no])
6010     fi
6012     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6013     save_CFLAGS=$CFLAGS
6014     CFLAGS="$CFLAGS -Werror"
6015     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6016             __attribute__((deprecated("test"))) void f();
6017         ])], [
6018             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6019             AC_MSG_RESULT([yes])
6020         ], [AC_MSG_RESULT([no])])
6021     CFLAGS=$save_CFLAGS
6023     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
6024     AC_LANG_PUSH([C++])
6025     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6026             #include <cstddef>
6027             #include <cxxabi.h>
6028             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6029         ])], [
6030             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6031             AC_MSG_RESULT([yes])
6032         ], [AC_MSG_RESULT([no])])
6033     AC_LANG_POP([C++])
6035     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
6036     AC_LANG_PUSH([C++])
6037     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6038             #include <cstddef>
6039             #include <cxxabi.h>
6040             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6041         ])], [
6042             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6043             AC_MSG_RESULT([yes])
6044         ], [AC_MSG_RESULT([no])])
6045     AC_LANG_POP([C++])
6047     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6048     AC_LANG_PUSH([C++])
6049     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6050             #include <cxxabi.h>
6051             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6052         ])], [
6053             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6054             AC_MSG_RESULT([yes])
6055         ], [AC_MSG_RESULT([no])])
6056     AC_LANG_POP([C++])
6058     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6059     AC_LANG_PUSH([C++])
6060     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6061             #include <cstddef>
6062             #include <cxxabi.h>
6063             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6064         ])], [
6065             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6066             AC_MSG_RESULT([yes])
6067         ], [AC_MSG_RESULT([no])])
6068     AC_LANG_POP([C++])
6070     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6071     AC_LANG_PUSH([C++])
6072     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6073             #include <cstddef>
6074             #include <cxxabi.h>
6075             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6076         ])], [
6077             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6078             AC_MSG_RESULT([yes])
6079         ], [AC_MSG_RESULT([no])])
6080     AC_LANG_POP([C++])
6082     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6083     AC_LANG_PUSH([C++])
6084     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6085             #include <cxxabi.h>
6086             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6087         ])], [
6088             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6089             AC_MSG_RESULT([yes])
6090         ], [AC_MSG_RESULT([no])])
6091     AC_LANG_POP([C++])
6093     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6094     AC_LANG_PUSH([C++])
6095     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6096             #include <cxxabi.h>
6097             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6098         ])], [
6099             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6100             AC_MSG_RESULT([yes])
6101         ], [AC_MSG_RESULT([no])])
6102     AC_LANG_POP([C++])
6104     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6105     AC_LANG_PUSH([C++])
6106     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6107             #include <cstddef>
6108             #include <cxxabi.h>
6109             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6110         ])], [
6111             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6112             AC_MSG_RESULT([yes])
6113         ], [AC_MSG_RESULT([no])])
6114     AC_LANG_POP([C++])
6116     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6117     AC_LANG_PUSH([C++])
6118     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6119             #include <cstddef>
6120             #include <cxxabi.h>
6121             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6122         ])], [
6123             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6124             AC_MSG_RESULT([yes])
6125         ], [AC_MSG_RESULT([no])])
6126     AC_LANG_POP([C++])
6128     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6129     AC_LANG_PUSH([C++])
6130     save_CXXFLAGS=$CXXFLAGS
6131     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
6132     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6133             #include <string>
6134             void f() { std::string s; }
6135         ])], [
6136             AC_MSG_RESULT([no])
6137         ], [
6138             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6139             AC_MSG_RESULT([yes])])
6140     CXXFLAGS=$save_CXXFLAGS
6141     AC_LANG_POP([C++])
6144 AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6145 AC_LANG_PUSH([C++])
6146 save_CXXFLAGS=$CXXFLAGS
6147 CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
6148 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6149         struct __attribute__((warn_unused)) dummy {};
6150     ])], [
6151         AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6152         AC_MSG_RESULT([yes])
6153     ], [AC_MSG_RESULT([no])])
6154 CXXFLAGS=$save_CXXFLAGS
6155 AC_LANG_POP([C++])
6157 AC_SUBST(HAVE_GCC_AVX)
6158 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6159 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6161 dnl ===================================================================
6162 dnl Identify the C++ library
6163 dnl ===================================================================
6165 AC_MSG_CHECKING([What the C++ library is])
6166 AC_LANG_PUSH([C++])
6167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6168 #include <utility>
6169 #ifndef __GLIBCXX__
6170 foo bar
6171 #endif
6172 ]])],
6173     [CPP_LIBRARY=GLIBCXX
6174      cpp_library_name="GNU libstdc++"
6175     ],
6176     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6177 #include <utility>
6178 #ifndef _LIBCPP_VERSION
6179 foo bar
6180 #endif
6181 ]])],
6182     [CPP_LIBRARY=LIBCPP
6183      cpp_library_name="LLVM libc++"
6184     ],
6185     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6186 #include <utility>
6187 #ifndef _MSC_VER
6188 foo bar
6189 #endif
6190 ]])],
6191     [CPP_LIBRARY=MSVCRT
6192      cpp_library_name="Microsoft"
6193     ],
6194     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6195 AC_MSG_RESULT([$cpp_library_name])
6196 AC_LANG_POP([C++])
6198 dnl ===================================================================
6199 dnl C++11
6200 dnl ===================================================================
6202 CXXFLAGS_CXX11=
6203 if test "$COM" = MSC; then
6204     AC_MSG_CHECKING([whether $CXX supports C++11])
6205     AC_MSG_RESULT(yes)
6206     # MSVC supports (a subset of) CXX11 without any switch
6207 elif test "$GCC" = "yes"; then
6208     HAVE_CXX11=
6209     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
6210     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
6211         save_CXXFLAGS=$CXXFLAGS
6212         CXXFLAGS="$CXXFLAGS $flag -Werror"
6213         AC_LANG_PUSH([C++])
6214         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6215             #include <algorithm>
6216             #include <functional>
6217             #include <vector>
6218             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6219                 std::sort(v.begin(), v.end(), fn);
6220             }
6221             ]])],[CXXFLAGS_CXX11=$flag])
6222         AC_LANG_POP([C++])
6223         CXXFLAGS=$save_CXXFLAGS
6224         if test -n "$CXXFLAGS_CXX11"; then
6225             HAVE_CXX11=TRUE
6226             break
6227         fi
6228     done
6229     if test "$HAVE_CXX11" = TRUE; then
6230         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6231     else
6232         AC_MSG_ERROR(no)
6233     fi
6236 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6237 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6238 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6239 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6240 dnl again towards 4.7.2:
6241 if test $CPP_LIBRARY = GLIBCXX; then
6242     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6243     AC_LANG_PUSH([C++])
6244     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6245 #include <list>
6246 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6247     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6248     //   GCC 4.7.0: 20120322
6249     //   GCC 4.7.1: 20120614
6250     // and using a range check is not possible as the mapping between
6251     // __GLIBCXX__ values and GCC versions is not monotonic
6252 /* ok */
6253 #else
6254 abi broken
6255 #endif
6256         ]])], [AC_MSG_RESULT(no, ok)],
6257         [AC_MSG_ERROR(yes)])
6258     AC_LANG_POP([C++])
6261 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6262 save_CXXFLAGS=$CXXFLAGS
6263 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6264 AC_LANG_PUSH([C++])
6266 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6267 #include <stddef.h>
6269 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6271 namespace
6273         struct b
6274         {
6275                 int i;
6276                 int j;
6277         };
6279 ]], [[
6280 struct a
6282         int i;
6283         int j;
6285 a thinga[]={{0,0}, {1,1}};
6286 b thingb[]={{0,0}, {1,1}};
6287 size_t i = sizeof(sal_n_array_size(thinga));
6288 size_t j = sizeof(sal_n_array_size(thingb));
6289 return !(i != 0 && j != 0);
6291     ], [ AC_MSG_RESULT(yes) ],
6292     [ AC_MSG_ERROR(no)])
6293 AC_LANG_POP([C++])
6294 CXXFLAGS=$save_CXXFLAGS
6296 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6297 save_CXXFLAGS=$CXXFLAGS
6298 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6299 AC_LANG_PUSH([C++])
6301 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6302 #include <vector>
6303     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6304     // (__float128)
6306     ],[ AC_MSG_RESULT(yes) ],
6307     [
6308         AC_MSG_RESULT(no)
6309         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6310         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6311         # __float128 is available during its build, but it's usually built using GCC,
6312         # and so c++config.h hardcodes __float128 being supported). As the only place
6313         # where __float128 is actually used is in a template specialization,
6314         # -D__float128=void will avoid the problem there while still causing a problem
6315         # if somebody actually uses the type.
6316         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6317         CXXFLAGS="$CXXFLAGS -D__float128=void"
6318         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6319 #include <vector>
6320     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6321     // (__float128)
6323     ],
6324     [
6325      AC_MSG_RESULT(yes)
6326      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6327     ],
6328     [
6329      AC_MSG_ERROR(no)
6330     ])
6333 AC_LANG_POP([C++])
6334 CXXFLAGS=$save_CXXFLAGS
6336 AC_SUBST(CXXFLAGS_CXX11)
6338 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6339 save_CXXFLAGS=$CXXFLAGS
6340 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6341 AC_LANG_PUSH([C++])
6342 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6343     struct S {
6344         int n_;
6345         constexpr S(int n): n_(n) {}
6346     };
6347     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6348 AC_LANG_POP([C++])
6349 CXXFLAGS=$save_CXXFLAGS
6350 AC_MSG_RESULT([$cxx11_constexpr])
6351 if test "$cxx11_constexpr" = yes; then
6352     AC_DEFINE([HAVE_CXX11_CONSTEXPR])
6355 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6356 save_CXXFLAGS=$CXXFLAGS
6357 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6358 AC_LANG_PUSH([C++])
6359 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6360     // A somewhat over-complicated way of checking for
6361     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6362     // in constexpr function":
6363     #include <cassert>
6364     template<typename T> inline constexpr T f(T x) { return x; }
6365     template<typename T> inline constexpr T g(T x) {
6366         assert(f(static_cast<int>(x)));
6367         return x;
6368     }
6369     enum E { e };
6370     auto v = g(E::e);
6372     struct S {
6373         int n_;
6374         constexpr bool f() {
6375             int n = n_;
6376             int i = 0;
6377             while (n > 0) { --n; ++i; }
6378             return i == 0;
6379         }
6380     };
6381     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6382 AC_LANG_POP([C++])
6383 CXXFLAGS=$save_CXXFLAGS
6384 AC_MSG_RESULT([$cxx14_constexpr])
6385 if test "$cxx14_constexpr" = yes; then
6386     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6389 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6390 save_CXXFLAGS=$CXXFLAGS
6391 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6392 AC_LANG_PUSH([C++])
6393 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6394     struct S {
6395         void f() &;
6396         void f() &&;
6397     };
6398     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6399 AC_LANG_POP([C++])
6400 CXXFLAGS=$save_CXXFLAGS
6401 AC_MSG_RESULT([$cxx11_ref_qualifier])
6402 if test "$cxx11_ref_qualifier" = yes; then
6403     AC_DEFINE([HAVE_CXX11_REF_QUALIFIER])
6406 AC_MSG_CHECKING([whether $CXX supports C++11 char16_t string literals])
6407 save_CXXFLAGS=$CXXFLAGS
6408 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6409 AC_LANG_PUSH([C++])
6410 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6411     auto s = u"";
6412     ]])], [cxx11_utf16_string_literal=yes], [cxx11_utf16_string_literal=no])
6413 AC_LANG_POP([C++])
6414 CXXFLAGS=$save_CXXFLAGS
6415 AC_MSG_RESULT([$cxx11_utf16_string_literal])
6416 if test "$cxx11_utf16_string_literal" = yes; then
6417     AC_DEFINE([HAVE_CXX11_UTF16_STRING_LITERAL])
6420 AC_MSG_CHECKING([whether $CXX supports C++14 sized deallocation])
6421 dnl At least Clang -fsanitize=address causes "multiple definition of
6422 dnl `operator delete(void*, unsigned long)'" also defined in
6423 dnl projects/compiler-rt/lib/asan/asan_new_delete.cc:
6424 save_CXX=$CXX
6425 if test "$COM_IS_CLANG" = TRUE; then
6426     my_CXX=
6427     for i in $CXX; do
6428         case $i in
6429         -fsanitize=address)
6430             ;;
6431         *)
6432             my_CXX="$my_CXX $i"
6433             ;;
6434         esac
6435     done
6436     CXX=$my_CXX
6438 save_CXXFLAGS=$CXXFLAGS
6439 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6440 AC_LANG_PUSH([C++])
6441 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
6442     #include <cstddef>
6443     #include <cstdlib>
6444     void operator delete(void *) throw () { std::exit(1); }
6445     void operator delete(void *, std::size_t) throw () { std::exit(0); }
6446     struct S { S() { throw 0; } };
6447     ]],[[
6448     try { new S; } catch (...) {}
6449     return 1;
6450     ]])], [cxx14_sized_deallocation=yes], [cxx14_sized_deallocation=no], [cxx14_sized_deallocation=no])
6451 AC_LANG_POP([C++])
6452 CXX=$save_CXX
6453 CXXFLAGS=$save_CXXFLAGS
6454 AC_MSG_RESULT([$cxx14_sized_deallocation])
6455 if test "$cxx14_sized_deallocation" = yes; then
6456     AC_DEFINE([HAVE_CXX14_SIZED_DEALLOCATION])
6459 HAVE_GCC_PRAGMA_OPERATOR=
6460 dnl _Pragma support (may require C++11)
6461 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6462     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6463     AC_LANG_PUSH([C++])
6464     save_CXXFLAGS=$CXXFLAGS
6465     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6466     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6467             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6468         ])], [
6469             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6470             HAVE_GCC_PRAGMA_OPERATOR=1
6471             AC_MSG_RESULT([yes])
6472         ], [AC_MSG_RESULT([no])])
6473     AC_LANG_POP([C++])
6474     CXXFLAGS=$save_CXXFLAGS
6476 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6478 HAVE_GCC_FNO_FNO_SIZED_DEALLOCATION=
6479 if test "$GCC" = yes; then
6480     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6481     AC_LANG_PUSH([C++])
6482     save_CXXFLAGS=$CXXFLAGS
6483     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6484     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6485     CXXFLAGS=$save_CXXFLAGS
6486     AC_LANG_POP([C++])
6487     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6488         AC_MSG_RESULT([yes])
6489     else
6490         AC_MSG_RESULT([no])
6491     fi
6493 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6495 dnl ===================================================================
6496 dnl system stl sanity tests
6497 dnl ===================================================================
6498 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6500     AC_LANG_PUSH([C++])
6502     save_CPPFLAGS="$CPPFLAGS"
6503     if test -n "$MACOSX_SDK_PATH"; then
6504         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6505     fi
6507     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6508     # only.
6509     if test "$CPP_LIBRARY" = GLIBCXX; then
6510         dnl gcc#19664, gcc#22482, rhbz#162935
6511         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6512         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6513         AC_MSG_RESULT([$stlvisok])
6514         if test "$stlvisok" = "no"; then
6515             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6516         fi
6517     fi
6519     sharedlink_ldflags_save=$LDFLAGS
6520     LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6522     AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6523     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6524 #include <sstream>
6525 using namespace std;
6526         ]], [[
6527 istringstream strm( "test" ); return 0;
6528         ]])],
6529         # Ugh, surely bad to assume an error message will contain
6530         # the word "unresolvable", a problem with
6531         # -fvisibility-inlines-hidden and STL headers might cause
6532         # some more obscure message on some platform, and anway,
6533         # the error message could be localised.
6534         [$EGREP -q unresolvable conftest.err;
6535         if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6536     ])
6537     AC_MSG_RESULT([$gccvisok])
6538     if test "$gccvisok" = "no"; then
6539         AC_MSG_ERROR([Your gcc is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6540     fi
6542     LDFLAGS=$sharedlink_ldflags_save
6544     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6545     # when we don't make any dynamic libraries?
6546     if test "$DISABLE_DYNLOADING" = ""; then
6547         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6548         cat > conftestlib1.cc <<_ACEOF
6549 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6550 struct S2: S1<int> { virtual ~S2(); };
6551 S2::~S2() {}
6552 _ACEOF
6553         cat > conftestlib2.cc <<_ACEOF
6554 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6555 struct S2: S1<int> { virtual ~S2(); };
6556 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6557 _ACEOF
6558         gccvisinlineshiddenok=yes
6559         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6560             gccvisinlineshiddenok=no
6561         else
6562             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6563             dnl known to not work with -z defs (unsetting which makes the test
6564             dnl moot, though):
6565             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6566             if test "$COM_IS_CLANG" = TRUE; then
6567                 for i in $CXX; do
6568                     case $i in
6569                     -fsanitize=*)
6570                         my_linkflagsnoundefs=
6571                         break
6572                         ;;
6573                     esac
6574                 done
6575             fi
6576             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6577                 gccvisinlineshiddenok=no
6578             fi
6579         fi
6581         rm -fr libconftest*
6582         AC_MSG_RESULT([$gccvisinlineshiddenok])
6583         if test "$gccvisinlineshiddenok" = "no"; then
6584             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6585         fi
6586     fi
6588     AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6589     cat >visibility.cxx <<_ACEOF
6590 #pragma GCC visibility push(hidden)
6591 struct __attribute__ ((visibility ("default"))) TestStruct {
6592   static void Init();
6594 __attribute__ ((visibility ("default"))) void TestFunc() {
6595   TestStruct::Init();
6597 _ACEOF
6598     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6599         gccvisbroken=yes
6600     else
6601         case "$host_cpu" in
6602         i?86|x86_64)
6603             if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6604                 gccvisbroken=no
6605             else
6606                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6607                     gccvisbroken=no
6608                 else
6609                     gccvisbroken=yes
6610                 fi
6611             fi
6612             ;;
6613         *)
6614             gccvisbroken=no
6615             ;;
6616         esac
6617     fi
6618     rm -f visibility.s visibility.cxx
6620     AC_MSG_RESULT([$gccvisbroken])
6621     if test "$gccvisbroken" = "yes"; then
6622         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6623     fi
6625     CPPFLAGS="$save_CPPFLAGS"
6627     AC_LANG_POP([C++])
6630 dnl ===================================================================
6631 dnl  Clang++ tests
6632 dnl ===================================================================
6634 HAVE_GCC_FNO_DEFAULT_INLINE=
6635 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6636 if test "$GCC" = "yes"; then
6637     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6638     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6639         # Option just ignored and silly warning that isn't a real
6640         # warning printed
6641         :
6642     else
6643         AC_LANG_PUSH([C++])
6644         save_CXXFLAGS=$CXXFLAGS
6645         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6646         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6647         CXXFLAGS=$save_CXXFLAGS
6648         AC_LANG_POP([C++])
6649     fi
6650     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6651         AC_MSG_RESULT([yes])
6652     else
6653         AC_MSG_RESULT([no])
6654     fi
6656     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6657     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6658         # As above
6659         :
6660     else
6661         AC_LANG_PUSH([C++])
6662         save_CXXFLAGS=$CXXFLAGS
6663         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6664         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6665         CXXFLAGS=$save_CXXFLAGS
6666         AC_LANG_POP([C++])
6667     fi
6668     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6669         AC_MSG_RESULT([yes])
6670     else
6671         AC_MSG_RESULT([no])
6672     fi
6674 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6675 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6677 dnl ===================================================================
6678 dnl Compiler plugins
6679 dnl ===================================================================
6681 COMPILER_PLUGINS=
6682 # currently only Clang
6683 if test "$COM_IS_CLANG" = "TRUE"; then
6684     if test -n "$enable_compiler_plugins"; then
6685         compiler_plugins="$enable_compiler_plugins"
6686     elif test -n "$ENABLE_DBGUTIL"; then
6687         compiler_plugins=test
6688     else
6689         compiler_plugins=no
6690     fi
6691     if test "$compiler_plugins" != "no"; then
6692         dnl The prefix where Clang resides, override to where Clang resides if
6693         dnl using a source build:
6694         if test -z "$CLANGDIR"; then
6695             CLANGDIR=/usr
6696         fi
6697         AC_LANG_PUSH([C++])
6698         save_CPPFLAGS=$CPPFLAGS
6699         save_CXX=$CXX
6700         # compiler plugins must be built with "native" bitness of clang
6701         # because they link against clang libraries
6702         CXX=${COMPILER_PLUGINS_CXX-$(echo $CXX | sed -e s/-m64// -e s/-m32//)}
6703         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6704         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6705             [COMPILER_PLUGINS=TRUE],
6706             [
6707             if test "$compiler_plugins" = "yes"; then
6708                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6709             else
6710                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6711                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6712             fi
6713             ])
6714         CXX=$save_CXX
6715         CPPFLAGS=$save_CPPFLAGS
6716         AC_LANG_POP([C++])
6717     fi
6718 else
6719     if test "$enable_compiler_plugins" = "yes"; then
6720         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6721     fi
6723 AC_SUBST(COMPILER_PLUGINS)
6724 AC_SUBST(COMPILER_PLUGINS_CXX)
6725 AC_SUBST(CLANGDIR)
6727 # Plugin to help linker.
6728 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6729 # This makes --enable-lto build with clang work.
6730 AC_SUBST(LD_PLUGIN)
6732 dnl ===================================================================
6733 dnl allocator
6734 dnl ===================================================================
6735 AC_MSG_CHECKING([which memory allocator to use])
6736 if test "$with_alloc" = "system"; then
6737     AC_MSG_RESULT([system])
6738     ALLOC="SYS_ALLOC"
6740 if test "$with_alloc" = "tcmalloc"; then
6741     AC_MSG_RESULT(tcmalloc)
6742     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6743         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6744     fi
6745     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6746         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6747     ALLOC="TCMALLOC"
6749 if test "$with_alloc" = "jemalloc"; then
6750     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6751         AC_MSG_RESULT(jemalloc)
6752         save_CFLAGS=$CFLAGS
6753         CFLAGS="$CFLAGS -pthread"
6754         AC_CHECK_LIB([jemalloc], [malloc], [:],
6755             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6756         ALLOC="JEMALLOC"
6757         CFLAGS=$save_CFLAGS
6758     else
6759         AC_MSG_RESULT([system])
6760         ALLOC="SYS_ALLOC"
6761     fi
6763 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6764     AC_MSG_RESULT([internal])
6766 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6767 AC_SUBST(HAVE_POSIX_FALLOCATE)
6768 AC_SUBST(ALLOC)
6770 dnl ===================================================================
6771 dnl Custom build version
6772 dnl ===================================================================
6774 AC_MSG_CHECKING([whether to add custom build version])
6775 if test "$with_build_version" != ""; then
6776     BUILD_VER_STRING=$with_build_version
6777     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6778 else
6779     BUILD_VER_STRING=
6780     AC_MSG_RESULT([no])
6782 AC_SUBST(BUILD_VER_STRING)
6784 JITC_PROCESSOR_TYPE=""
6785 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6786     # IBMs JDK needs this...
6787     JITC_PROCESSOR_TYPE=6
6788     export JITC_PROCESSOR_TYPE
6790 AC_SUBST([JITC_PROCESSOR_TYPE])
6792 # Misc Windows Stuff
6793 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6794     find_msvc_x64_dlls
6795     find_msms
6796     MSVC_DLL_PATH="$msvcdllpath"
6797     MSVC_DLLS="$msvcdlls"
6798     MSM_PATH="$msmdir"
6799     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6802 AC_SUBST(MSVC_DLL_PATH)
6803 AC_SUBST(MSVC_DLLS)
6804 AC_SUBST(MSM_PATH)
6806 dnl ===================================================================
6807 dnl Checks for Java
6808 dnl ===================================================================
6809 if test "$ENABLE_JAVA" != ""; then
6811     # Windows-specific tests
6812     if test "$build_os" = "cygwin"; then
6813         if test "$BITNESS_OVERRIDE" = 64; then
6814             bitness=64
6815         else
6816             bitness=32
6817         fi
6819         if test -z "$with_jdk_home"; then
6820             for ver in 1.8 1.7 1.6; do
6821                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6822                 if test -n "$regvalue"; then
6823                     _jdk_home=$regvalue
6824                     break
6825                 fi
6826             done
6827             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6828                 with_jdk_home="$_jdk_home"
6829                 howfound="found automatically"
6830             else
6831                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6832             fi
6833         else
6834             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6835             howfound="you passed"
6836         fi
6837     fi
6839     # 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.
6840     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6841     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6842         with_jdk_home=`/usr/libexec/java_home`
6843     fi
6845     JAVA_HOME=; export JAVA_HOME
6846     if test -z "$with_jdk_home"; then
6847         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6848     else
6849         _java_path="$with_jdk_home/bin/$with_java"
6850         dnl Check if there is a Java interpreter at all.
6851         if test -x "$_java_path"; then
6852             JAVAINTERPRETER=$_java_path
6853         else
6854             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6855         fi
6856     fi
6858     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6859     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6860     dnl loaded by java to run JunitTests:
6861     if test "$build_os" = "cygwin"; then
6862         shortjdkhome=`cygpath -d "$with_jdk_home"`
6863         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
6864             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6865             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6866         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
6867             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6868             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6869         fi
6871         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6872             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6873         fi
6874         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6875     elif test "$cross_compiling" != "yes"; then
6876         case $CPUNAME in
6877             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6878                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6879                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6880                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6881                 fi
6882                 ;;
6883             *) # assumption: everything else 32-bit
6884                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6885                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6886                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6887                 fi
6888                 ;;
6889         esac
6890     fi
6893 HAVE_JAVA9=
6894 dnl ===================================================================
6895 dnl Checks for JDK.
6896 dnl ===================================================================
6898 # Note that JAVA_HOME as for now always means the *build* platform's
6899 # JAVA_HOME. Whether all the complexity here actually is needed any
6900 # more or not, no idea.
6902 if test "$ENABLE_JAVA" != ""; then
6903     _gij_longver=0
6904     AC_MSG_CHECKING([the installed JDK])
6905     if test -n "$JAVAINTERPRETER"; then
6906         dnl java -version sends output to stderr!
6907         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6908             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6909         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6910             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6911         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6912             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6913         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6914             JDK=ibm
6916             dnl IBM JDK specific tests
6917             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6918             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6920             if test "$_jdk_ver" -lt 10600; then
6921                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6922             fi
6924             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6926             if test "$with_jdk_home" = ""; then
6927                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6928 you must use the "--with-jdk-home" configure option explicitly])
6929             fi
6931             JAVA_HOME=$with_jdk_home
6932         else
6933             JDK=sun
6935             dnl Sun JDK specific tests
6936             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6937             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6939             if test "$_jdk_ver" -lt 10600; then
6940                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6941             fi
6942             if test "$_jdk_ver" -gt 10600; then
6943                 JAVA_CLASSPATH_NOT_SET="1"
6944             fi
6945             if test "$_jdk_ver" -ge 10900; then
6946                 HAVE_JAVA9=TRUE
6947             fi
6949             AC_MSG_RESULT([checked (JDK $_jdk)])
6950             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6951             if test "$_os" = "WINNT"; then
6952                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6953             fi
6955             # set to limit VM usage for JunitTests
6956             JAVAIFLAGS=-Xmx64M
6957             # set to limit VM usage for javac
6958             JAVAFLAGS=-J-Xmx128M
6959         fi
6960     else
6961         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6962     fi
6963 else
6964     dnl Java disabled
6965     JAVA_HOME=
6966     export JAVA_HOME
6969 dnl ===================================================================
6970 dnl Set target Java bytecode version
6971 dnl ===================================================================
6972 if test "$ENABLE_JAVA" != ""; then
6973     if test "$HAVE_JAVA9" = "TRUE"; then
6974         _java_target_ver="1.6"
6975     else
6976         _java_target_ver="1.5"
6977     fi
6978     JAVA_SOURCE_VER="$_java_target_ver"
6979     JAVA_TARGET_VER="$_java_target_ver"
6982 dnl ===================================================================
6983 dnl Checks for javac
6984 dnl ===================================================================
6985 if test "$ENABLE_JAVA" != ""; then
6986     javacompiler="javac"
6987     if test -z "$with_jdk_home"; then
6988         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6989     else
6990         _javac_path="$with_jdk_home/bin/$javacompiler"
6991         dnl Check if there is a Java compiler at all.
6992         if test -x "$_javac_path"; then
6993             JAVACOMPILER=$_javac_path
6994         fi
6995     fi
6996     if test -z "$JAVACOMPILER"; then
6997         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6998     fi
6999     if test "$build_os" = "cygwin"; then
7000         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7001             JAVACOMPILER="${JAVACOMPILER}.exe"
7002         fi
7003         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7004     fi
7007 dnl ===================================================================
7008 dnl Checks for javadoc
7009 dnl ===================================================================
7010 if test "$ENABLE_JAVA" != ""; then
7011     if test -z "$with_jdk_home"; then
7012         AC_PATH_PROG(JAVADOC, javadoc)
7013     else
7014         _javadoc_path="$with_jdk_home/bin/javadoc"
7015         dnl Check if there is a javadoc at all.
7016         if test -x "$_javadoc_path"; then
7017             JAVADOC=$_javadoc_path
7018         else
7019             AC_PATH_PROG(JAVADOC, javadoc)
7020         fi
7021     fi
7022     if test -z "$JAVADOC"; then
7023         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7024     fi
7025     if test "$build_os" = "cygwin"; then
7026         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7027             JAVADOC="${JAVADOC}.exe"
7028         fi
7029         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7030     fi
7032     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7033     JAVADOCISGJDOC="yes"
7034     fi
7036 AC_SUBST(JAVADOCISGJDOC)
7038 if test "$ENABLE_JAVA" != ""; then
7039     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7040     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7041         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7042            # try to recover first by looking whether we have a alternatives
7043            # system as in Debian or newer SuSEs where following /usr/bin/javac
7044            # over /etc/alternatives/javac leads to the right bindir where we
7045            # just need to strip a bit away to get a valid JAVA_HOME
7046            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7047         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7048             # maybe only one level of symlink (e.g. on Mac)
7049             JAVA_HOME=$(readlink $JAVACOMPILER)
7050             if test "$(dirname $JAVA_HOME)" = "."; then
7051                 # we've got no path to trim back
7052                 JAVA_HOME=""
7053             fi
7054         else
7055             # else warn
7056             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7057             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7058             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7059             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7060         fi
7061         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7062         if test "$JAVA_HOME" != "/usr"; then
7063             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7064                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7065                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7066                 dnl Tiger already returns a JDK path..
7067                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7068             else
7069                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7070                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7071                 dnl that checks which version to run
7072                 if test -f "$JAVA_HOME"; then
7073                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7074                 fi
7075             fi
7076         fi
7077     fi
7078     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7080     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7081     if test -z "$JAVA_HOME"; then
7082         if test "x$with_jdk_home" = "x"; then
7083             cat > findhome.java <<_ACEOF
7084 [import java.io.File;
7086 class findhome
7088     public static void main(String args[])
7089     {
7090         String jrelocation = System.getProperty("java.home");
7091         File jre = new File(jrelocation);
7092         System.out.println(jre.getParent());
7093     }
7095 _ACEOF
7096             AC_MSG_CHECKING([if javac works])
7097             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7098             AC_TRY_EVAL(javac_cmd)
7099             if test $? = 0 -a -f ./findhome.class; then
7100                 AC_MSG_RESULT([javac works])
7101             else
7102                 echo "configure: javac test failed" >&5
7103                 cat findhome.java >&5
7104                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7105             fi
7106             AC_MSG_CHECKING([if gij knows its java.home])
7107             JAVA_HOME=`$JAVAINTERPRETER findhome`
7108             if test $? = 0 -a "$JAVA_HOME" != ""; then
7109                 AC_MSG_RESULT([$JAVA_HOME])
7110             else
7111                 echo "configure: java test failed" >&5
7112                 cat findhome.java >&5
7113                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7114             fi
7115             # clean-up after ourselves
7116             rm -f ./findhome.java ./findhome.class
7117         else
7118             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7119         fi
7120     fi
7122     # now check if $JAVA_HOME is really valid
7123     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7124         case "${JAVA_HOME}" in
7125             /Library/Java/JavaVirtualMachines/*)
7126                 ;;
7127             *)
7128                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7129                 ;;
7130         esac
7131         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7132             JAVA_HOME_OK="NO"
7133         fi
7134     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7135         JAVA_HOME_OK="NO"
7136     fi
7137     if test "$JAVA_HOME_OK" = "NO"; then
7138         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7139         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7140         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7141         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7142         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7143         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7144     fi
7145     PathFormat "$JAVA_HOME"
7146     JAVA_HOME="$formatted_path"
7149 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7150     "$_os" != Darwin
7151 then
7152     AC_MSG_CHECKING([for JAWT lib])
7153     if test "$_os" = WINNT; then
7154         if test "$WITH_MINGW" = yes; then
7155             # The path is taken care of in gb_LinkTarget__use_jawt
7156             # in RepositoryExternal.mk:
7157             JAWTLIB=-ljawt
7158         else
7159             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7160             JAWTLIB=jawt.lib
7161         fi
7162     else
7163         case "$host_cpu" in
7164         arm*)
7165             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7166             JAVA_ARCH=$my_java_arch
7167             ;;
7168         i*86)
7169             my_java_arch=i386
7170             ;;
7171         m68k)
7172             my_java_arch=m68k
7173             ;;
7174         powerpc)
7175             my_java_arch=ppc
7176             ;;
7177         powerpc64)
7178             my_java_arch=ppc64
7179             ;;
7180         powerpc64le)
7181             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7182             JAVA_ARCH=$my_java_arch
7183             ;;
7184         sparc64)
7185             my_java_arch=sparcv9
7186             ;;
7187         x86_64)
7188             my_java_arch=amd64
7189             ;;
7190         *)
7191             my_java_arch=$host_cpu
7192             ;;
7193         esac
7194         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7195         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7196     fi
7197     AC_MSG_RESULT([$JAWTLIB])
7199 AC_SUBST(JAWTLIB)
7201 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7202     case "$host_os" in
7204     aix*)
7205         JAVAINC="-I$JAVA_HOME/include"
7206         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7207         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7208         ;;
7210     cygwin*)
7211         JAVAINC="-I$JAVA_HOME/include/win32"
7212         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7213         ;;
7215     darwin*)
7216         if test -d "$JAVA_HOME/include/darwin"; then
7217             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7218         else
7219             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7220         fi
7221         ;;
7223     dragonfly*)
7224         JAVAINC="-I$JAVA_HOME/include"
7225         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7226         ;;
7228     freebsd*)
7229         JAVAINC="-I$JAVA_HOME/include"
7230         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7231         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7232         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7233         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7234         ;;
7236     k*bsd*-gnu*)
7237         JAVAINC="-I$JAVA_HOME/include"
7238         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7239         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7240         ;;
7242     linux-gnu*)
7243         JAVAINC="-I$JAVA_HOME/include"
7244         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7245         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7246         ;;
7248     mingw*)
7249         JAVAINC="-I$JAVA_HOME/include"
7250         ;;
7252     *netbsd*)
7253         JAVAINC="-I$JAVA_HOME/include"
7254         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7255         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7256        ;;
7258     openbsd*)
7259         JAVAINC="-I$JAVA_HOME/include"
7260         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7261         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7262         ;;
7264     solaris*)
7265         JAVAINC="-I$JAVA_HOME/include"
7266         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7267         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7268         ;;
7269     esac
7271 SOLARINC="$SOLARINC $JAVAINC"
7273 AC_SUBST(JAVACOMPILER)
7274 AC_SUBST(JAVADOC)
7275 AC_SUBST(JAVAINTERPRETER)
7276 AC_SUBST(JAVAIFLAGS)
7277 AC_SUBST(JAVAFLAGS)
7278 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7279 AC_SUBST(JAVA_HOME)
7280 AC_SUBST(JAVA_SOURCE_VER)
7281 AC_SUBST(JAVA_TARGET_VER)
7282 AC_SUBST(JDK)
7285 dnl ===================================================================
7286 dnl Export file validation
7287 dnl ===================================================================
7288 AC_MSG_CHECKING([whether to enable export file validation])
7289 if test "$with_export_validation" = yes; then
7290     if test -z "$ENABLE_JAVA"; then
7291         AC_MSG_RESULT([no, as Java is disabled])
7292     else
7293         AC_MSG_RESULT([yes])
7294         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7296         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7297         if test -z "$ODFVALIDATOR"; then
7298             # remember to download the ODF toolkit with validator later
7299             AC_MSG_NOTICE([no odfvalidator found, will download it])
7300             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7301             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7303             # and fetch name of odfvalidator jar name from download.lst
7304             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7305             AC_SUBST(ODFVALIDATOR_JAR)
7307             if test -z "$ODFVALIDATOR_JAR"; then
7308                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7309             fi
7310         fi
7311         if test "$build_os" = "cygwin"; then
7312             # In case of CygWin it will be executed from Windows,
7313             # so we need to run bash and absolute path to validator
7314             # so instead of "odfvalidator" it will be
7315             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7316             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7317         else
7318             ODFVALIDATOR="sh $ODFVALIDATOR"
7319         fi
7320         AC_SUBST(ODFVALIDATOR)
7323         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7324         if test -z "$OFFICEOTRON"; then
7325             # remember to download the officeotron with validator later
7326             AC_MSG_NOTICE([no officeotron found, will download it])
7327             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7328             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7330             # and fetch name of officeotron jar name from download.lst
7331             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7332             AC_SUBST(OFFICEOTRON_JAR)
7334             if test -z "$OFFICEOTRON_JAR"; then
7335                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7336             fi
7337         else
7338             # check version of existing officeotron
7339             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7340             if test 0"$OFFICEOTRON_VER" -lt 704; then
7341                 AC_MSG_ERROR([officeotron too old])
7342             fi
7343         fi
7344         if test "$build_os" = "cygwin"; then
7345             # In case of CygWin it will be executed from Windows,
7346             # so we need to run bash and absolute path to validator
7347             # so instead of "odfvalidator" it will be
7348             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7349             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7350         else
7351             OFFICEOTRON="sh $OFFICEOTRON"
7352         fi
7353     fi
7354     AC_SUBST(OFFICEOTRON)
7355 else
7356     AC_MSG_RESULT([no])
7359 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7360 if test "$with_bffvalidator" != "no"; then
7361     AC_DEFINE(HAVE_BFFVALIDATOR)
7363     if test "$with_export_validation" != "yes"; then
7364         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7365     fi
7367     if test "$with_bffvalidator" = "yes"; then
7368         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7369     else
7370         BFFVALIDATOR="$with_bffvalidator"
7371     fi
7373     if test "$build_os" = "cygwin"; then
7374         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7375             AC_MSG_RESULT($BFFVALIDATOR)
7376         else
7377             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7378         fi
7379     elif test -n "$BFFVALIDATOR"; then
7380         # We are not in CygWin but need to run Windows binary with wine
7381         AC_PATH_PROGS(WINE, wine)
7383         # so swap in a shell wrapper that converts paths transparently
7384         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7385         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7386         AC_SUBST(BFFVALIDATOR_EXE)
7387         AC_MSG_RESULT($BFFVALIDATOR)
7388     else
7389         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7390     fi
7391     AC_SUBST(BFFVALIDATOR)
7392 else
7393     AC_MSG_RESULT([no])
7396 dnl ===================================================================
7397 dnl Check for C preprocessor to use
7398 dnl ===================================================================
7399 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7400 if test -n "$with_idlc_cpp"; then
7401     AC_MSG_RESULT([$with_idlc_cpp])
7402     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7403 else
7404     AC_MSG_RESULT([ucpp])
7405     AC_MSG_CHECKING([which ucpp tp use])
7406     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7407         AC_MSG_RESULT([external])
7408         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7409     else
7410         AC_MSG_RESULT([internal])
7411         BUILD_TYPE="$BUILD_TYPE UCPP"
7412     fi
7414 AC_SUBST(SYSTEM_UCPP)
7416 dnl ===================================================================
7417 dnl Check for epm (not needed for Windows)
7418 dnl ===================================================================
7419 AC_MSG_CHECKING([whether to enable EPM for packing])
7420 if test "$enable_epm" = "yes"; then
7421     AC_MSG_RESULT([yes])
7422     if test "$_os" != "WINNT"; then
7423         if test $_os = Darwin; then
7424             EPM=internal
7425         elif test -n "$with_epm"; then
7426             EPM=$with_epm
7427         else
7428             AC_PATH_PROG(EPM, epm, no)
7429         fi
7430         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7431             AC_MSG_NOTICE([EPM will be built.])
7432             BUILD_TYPE="$BUILD_TYPE EPM"
7433             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7434         else
7435             # Gentoo has some epm which is something different...
7436             AC_MSG_CHECKING([whether the found epm is the right epm])
7437             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7438                 AC_MSG_RESULT([yes])
7439             else
7440                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7441             fi
7442             AC_MSG_CHECKING([epm version])
7443             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7444             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7445                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7446                 AC_MSG_RESULT([OK, >= 3.7])
7447             else
7448                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7449                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7450             fi
7451         fi
7452     fi
7454     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7455         AC_MSG_CHECKING([for rpm])
7456         for a in "$RPM" rpmbuild rpm; do
7457             $a --usage >/dev/null 2> /dev/null
7458             if test $? -eq 0; then
7459                 RPM=$a
7460                 break
7461             else
7462                 $a --version >/dev/null 2> /dev/null
7463                 if test $? -eq 0; then
7464                     RPM=$a
7465                     break
7466                 fi
7467             fi
7468         done
7469         if test -z "$RPM"; then
7470             AC_MSG_ERROR([not found])
7471         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7472             RPM_PATH=`which $RPM`
7473             AC_MSG_RESULT([$RPM_PATH])
7474             SCPDEFS="$SCPDEFS -DWITH_RPM"
7475         else
7476             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7477         fi
7478     fi
7479     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7480         AC_PATH_PROG(DPKG, dpkg, no)
7481         if test "$DPKG" = "no"; then
7482             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7483         fi
7484     fi
7485     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7486        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7487         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7488             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7489                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7490                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7491                     AC_MSG_RESULT([yes])
7492                 else
7493                     AC_MSG_RESULT([no])
7494                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7495                         _pt="rpm"
7496                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7497                         add_warning "the rpms will need to be installed with --nodeps"
7498                     else
7499                         _pt="pkg"
7500                     fi
7501                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7502                     add_warning "the ${_pt}s will not be relocateable"
7503                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7504                                  relocation will work, you need to patch your epm with the
7505                                  patch in epm/epm-3.7.patch or build with
7506                                  --with-epm=internal which will build a suitable epm])
7507                 fi
7508             fi
7509         fi
7510     fi
7511     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7512         AC_PATH_PROG(PKGMK, pkgmk, no)
7513         if test "$PKGMK" = "no"; then
7514             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7515         fi
7516     fi
7517     AC_SUBST(RPM)
7518     AC_SUBST(DPKG)
7519     AC_SUBST(PKGMK)
7520 else
7521     for i in $PKGFORMAT; do
7522         case "$i" in
7523         aix | bsd | deb | pkg | rpm | native | portable)
7524             AC_MSG_ERROR(
7525                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7526             ;;
7527         esac
7528     done
7529     AC_MSG_RESULT([no])
7530     EPM=NO
7532 AC_SUBST(EPM)
7534 dnl ===================================================================
7535 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7536 dnl ===================================================================
7537 WINEGCC=
7538 if test "$enable_winegcc" = "yes"; then
7539     AC_PATH_PROG(WINEGCC, winegcc)
7540     if test "$WINEGCC" = ""; then
7541         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7542     fi
7543     CC_save="$CC"
7544     ac_exeext_save="$ac_exeext"
7545     CC="$WINEGCC -m32"
7546     ac_exeext=".exe"
7547     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7548 #include <stdio.h>
7549         ],[
7550 printf ("hello world\n");
7551         ])],,
7552         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7553     )
7554     CC="$CC_save"
7555     ac_exeext="$ac_exeext_save"
7557 AC_SUBST(WINEGCC)
7559 if test $_os = iOS; then
7560     enable_mpl_subset=yes
7561     enable_lotuswordpro=no
7562     enable_coinmp=yes
7563     enable_lpsolve=no
7564     enable_postgresql_sdbc=no
7565     enable_extension_integration=no
7566     enable_report_builder=no
7567     with_theme="tango"
7568     with_ppds=no
7571 ENABLE_LWP=
7572 if test "$enable_lotuswordpro" = "yes"; then
7573     ENABLE_LWP="TRUE"
7574     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7576 AC_SUBST(ENABLE_LWP)
7578 dnl ===================================================================
7579 dnl Check for gperf
7580 dnl ===================================================================
7581 AC_PATH_PROG(GPERF, gperf)
7582 if test -z "$GPERF"; then
7583     AC_MSG_ERROR([gperf not found but needed. Install it.])
7585 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7586     GPERF=`cygpath -m $GPERF`
7588 AC_MSG_CHECKING([gperf version])
7589 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7590     AC_MSG_RESULT([OK])
7591 else
7592     AC_MSG_ERROR([too old, you need at least 3.0.0])
7594 AC_SUBST(GPERF)
7596 dnl ===================================================================
7597 dnl Check for building ODK
7598 dnl ===================================================================
7599 if test "$enable_odk" = no; then
7600     unset DOXYGEN
7601 else
7602     if test "$with_doxygen" = no; then
7603         AC_MSG_CHECKING([for doxygen])
7604         unset DOXYGEN
7605         AC_MSG_RESULT([no])
7606     else
7607         if test "$with_doxygen" = yes; then
7608             AC_PATH_PROG([DOXYGEN], [doxygen])
7609             if test -z "$DOXYGEN"; then
7610                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7611             fi
7612         else
7613             AC_MSG_CHECKING([for doxygen])
7614             DOXYGEN=$with_doxygen
7615             AC_MSG_RESULT([$DOXYGEN])
7616         fi
7617         if test -n "$DOXYGEN"; then
7618             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7619             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7620             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7621                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7622             fi
7623         fi
7624     fi
7626 AC_SUBST([DOXYGEN])
7628 AC_MSG_CHECKING([whether to build the ODK])
7629 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7630     AC_MSG_RESULT([yes])
7632     if test "$with_java" != "no"; then
7633         AC_MSG_CHECKING([whether to build unowinreg.dll])
7634         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7635             # build on Win by default
7636             enable_build_unowinreg=yes
7637         fi
7638         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7639             AC_MSG_RESULT([no])
7640             BUILD_UNOWINREG=
7641         else
7642             AC_MSG_RESULT([yes])
7643             BUILD_UNOWINREG=TRUE
7644         fi
7645         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7646             if test -z "$with_mingw_cross_compiler"; then
7647                 dnl Guess...
7648                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7649             elif test -x "$with_mingw_cross_compiler"; then
7650                  MINGWCXX="$with_mingw_cross_compiler"
7651             else
7652                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7653             fi
7655             if test "$MINGWCXX" = "false"; then
7656                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7657             fi
7659             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7660             if test -x "$mingwstrip_test"; then
7661                 MINGWSTRIP="$mingwstrip_test"
7662             else
7663                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7664             fi
7666             if test "$MINGWSTRIP" = "false"; then
7667                 AC_MSG_ERROR(MinGW32 binutils not found.)
7668             fi
7669         fi
7670     fi
7671     BUILD_TYPE="$BUILD_TYPE ODK"
7672 else
7673     AC_MSG_RESULT([no])
7674     BUILD_UNOWINREG=
7676 AC_SUBST(BUILD_UNOWINREG)
7677 AC_SUBST(MINGWCXX)
7678 AC_SUBST(MINGWSTRIP)
7680 dnl ===================================================================
7681 dnl Check for system zlib
7682 dnl ===================================================================
7683 if test "$with_system_zlib" = "auto"; then
7684     case "$_os" in
7685     WINNT)
7686         with_system_zlib="$with_system_libs"
7687         ;;
7688     *)
7689         with_system_zlib=yes
7690         ;;
7691     esac
7694 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7695 dnl and has no pkg-config for it at least on some tinderboxes,
7696 dnl so leaving that out for now
7697 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7698 AC_MSG_CHECKING([which zlib to use])
7699 if test "$with_system_zlib" = "yes"; then
7700     AC_MSG_RESULT([external])
7701     SYSTEM_ZLIB=TRUE
7702     if test "$_os" != "Emscripten"; then
7703         # Emscripten provides its own zlib, don't check for that
7704         AC_CHECK_HEADER(zlib.h, [],
7705             [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7706         AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7707             [AC_MSG_ERROR(zlib not found or functional)], [])
7708     fi
7709 else
7710     AC_MSG_RESULT([internal])
7711     SYSTEM_ZLIB=
7712     BUILD_TYPE="$BUILD_TYPE ZLIB"
7713     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7714     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7716 AC_SUBST(ZLIB_CFLAGS)
7717 AC_SUBST(ZLIB_LIBS)
7718 AC_SUBST(SYSTEM_ZLIB)
7720 dnl ===================================================================
7721 dnl Check for system jpeg
7722 dnl ===================================================================
7723 AC_MSG_CHECKING([which libjpeg to use])
7724 if test "$with_jpeg_turbo" = "auto"; then
7725     # TODO use jpeg-turbo on Darwin too
7726     case "$_os" in
7727     WINNT)
7728         with_jpeg_turbo=yes
7729         ;;
7730     *)
7731         with_jpeg_turbo=no
7732         ;;
7733     esac
7736 if test "$with_system_jpeg" = "yes"; then
7737     AC_MSG_RESULT([external])
7738     SYSTEM_JPEG=TRUE
7739     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7740         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7741     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7742         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7743     libo_MINGW_CHECK_DLL([libjpeg])
7744 else
7745     SYSTEM_JPEG=
7746     if test "$with_jpeg_turbo" = "yes"; then
7747         AC_MSG_RESULT([internal, jpeg-turbo])
7748         BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7749         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7751         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7752             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7753                 NASM="$LODE_HOME/opt/bin/nasm"
7754             elif test -x "/opt/lo/bin/nasm"; then
7755                 NASM="/opt/lo/bin/nasm"
7756             fi
7757         fi
7758         if test -z "$NASM"; then
7759 cat << _EOS
7760 ****************************************************************************
7761 You need nasm (Netwide Assembler) to build internal jpeg library.
7762 To get one please do:
7764 _EOS
7765         if test "$build_os" = "cygwin"; then
7766 cat << _EOS
7767 install a pre-compiled binary for Win32
7769  mkdir -p /opt/lo/bin
7770  cd /opt/lo/bin
7771  wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7772  chmod +x nasm
7773 _EOS
7774             else
7775 cat << _EOS
7776 consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
7777 _EOS
7778             fi
7779 cat << _EOS
7781 or get and install one from http://www.nasm.us/
7783 Then re-run autogen.sh
7785 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7786 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7788 _EOS
7789         AC_MSG_ERROR([no nasm (Netwide Assembler) found])
7790         fi
7791         LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg-turbo"
7792         if test "$COM" = "MSC"; then
7793             LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs/libjpeg.lib"
7794         else
7795             LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs -ljpeg"
7796         fi
7797     else
7798         AC_MSG_RESULT([internal, jpeg])
7799         BUILD_TYPE="$BUILD_TYPE JPEG"
7800         LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg"
7801         if test "$COM" = "MSC"; then
7802             LIBJPEG_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/libjpeg.lib"
7803         else
7804             LIBJPEG_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -ljpeg"
7805         fi
7806     fi
7808 AC_SUBST(NASM)
7809 AC_SUBST(LIBJPEG_CFLAGS)
7810 AC_SUBST(LIBJPEG_LIBS)
7811 AC_SUBST(SYSTEM_JPEG)
7813 dnl ===================================================================
7814 dnl Check for system clucene
7815 dnl ===================================================================
7816 dnl we should rather be using
7817 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7818 dnl but the contribs-lib check seems tricky
7819 AC_MSG_CHECKING([which clucene to use])
7820 if test "$with_system_clucene" = "yes"; then
7821     AC_MSG_RESULT([external])
7822     SYSTEM_CLUCENE=TRUE
7823     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7824     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7825     FilterLibs "${CLUCENE_LIBS}"
7826     CLUCENE_LIBS="${filteredlibs}"
7827     AC_LANG_PUSH([C++])
7828     save_CXXFLAGS=$CXXFLAGS
7829     save_CPPFLAGS=$CPPFLAGS
7830     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7831     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7832     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7833     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7834     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7835                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7836     CXXFLAGS=$save_CXXFLAGS
7837     CPPFLAGS=$save_CPPFLAGS
7838     AC_LANG_POP([C++])
7840     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7841 else
7842     AC_MSG_RESULT([internal])
7843     SYSTEM_CLUCENE=
7844     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7846 AC_SUBST(SYSTEM_CLUCENE)
7847 AC_SUBST(CLUCENE_CFLAGS)
7848 AC_SUBST(CLUCENE_LIBS)
7850 dnl ===================================================================
7851 dnl Check for system expat
7852 dnl ===================================================================
7853 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7854 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7855 AC_MSG_CHECKING([which expat to use])
7856 if test "$with_system_expat" = "yes"; then
7857     AC_MSG_RESULT([external])
7858     SYSTEM_EXPAT=TRUE
7859     AC_CHECK_HEADER(expat.h, [],
7860         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7861     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7862         [AC_MSG_RESULT(expat library not found or functional.)], [])
7863     libo_MINGW_CHECK_DLL([libexpat])
7864 else
7865     AC_MSG_RESULT([internal])
7866     SYSTEM_EXPAT=
7867     BUILD_TYPE="$BUILD_TYPE EXPAT"
7869 AC_SUBST(SYSTEM_EXPAT)
7871 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7872 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7873     ENABLE_EOT="TRUE"
7874     AC_DEFINE([ENABLE_EOT])
7875     AC_MSG_RESULT([yes])
7877     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7878 else
7879     ENABLE_EOT=
7880     AC_MSG_RESULT([no])
7882 AC_SUBST([ENABLE_EOT])
7884 dnl ===================================================================
7885 dnl Check for DLP libs
7886 dnl ===================================================================
7887 AS_IF([test "$COM" = "MSC"],
7888       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7889       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7891 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7893 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7895 AS_IF([test "$COM" = "MSC"],
7896       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7897       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7899 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7901 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7903 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7904 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.4])
7906 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7908 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7910 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7912 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7913 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.9])
7915 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7916 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
7918 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7920 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7921 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7923 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7925 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7927 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7929 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7930 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.2])
7932 dnl ===================================================================
7933 dnl Check for system libcmis
7934 dnl ===================================================================
7935 # libcmis requires curl and we can't build curl for iOS
7936 if test $_os != iOS; then
7937     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7938     ENABLE_CMIS=TRUE
7939 else
7940     ENABLE_CMIS=
7942 AC_SUBST(ENABLE_CMIS)
7944 dnl ===================================================================
7945 dnl Check for system lcms2
7946 dnl ===================================================================
7947 if test "$with_system_lcms2" = "yes"; then
7948     libo_MINGW_CHECK_DLL([liblcms2])
7949 else
7950     SYSTEM_LCMS2=
7952 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7953 if test "$GCC" = "yes"; then
7954     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7956 if test "$COM" = "MSC"; then # override the above
7957     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7960 dnl ===================================================================
7961 dnl Check for system cppunit
7962 dnl ===================================================================
7963 if test "$cross_compiling" != "yes"; then
7964     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7967 dnl ===================================================================
7968 dnl Check whether freetype is available
7969 dnl ===================================================================
7970 if test  "$test_freetype" = "yes"; then
7971     AC_MSG_CHECKING([whether freetype is available])
7972     # FreeType has 3 different kinds of versions
7973     # * release, like 2.4.10
7974     # * libtool, like 13.0.7 (this what pkg-config returns)
7975     # * soname
7976     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7977     #
7978     # 9.9.3 is 2.2.0
7979     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7980     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7981     FilterLibs "${FREETYPE_LIBS}"
7982     FREETYPE_LIBS="${filteredlibs}"
7983     SYSTEM_FREETYPE=TRUE
7984     _save_libs="$LIBS"
7985     _save_cflags="$CFLAGS"
7986     LIBS="$LIBS $FREETYPE_LIBS"
7987     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7988     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7989     LIBS="$_save_libs"
7990     CFLAGS="$_save_cflags"
7992 AC_SUBST(FREETYPE_CFLAGS)
7993 AC_SUBST(FREETYPE_LIBS)
7994 AC_SUBST([SYSTEM_FREETYPE])
7996 # ===================================================================
7997 # Check for system libxslt
7998 # to prevent incompatibilities between internal libxml2 and external libxslt,
7999 # or vice versa, use with_system_libxml here
8000 # ===================================================================
8001 if test "$with_system_libxml" = "auto"; then
8002     case "$_os" in
8003     WINNT|iOS|Android)
8004         with_system_libxml="$with_system_libs"
8005         ;;
8006     *)
8007         with_system_libxml=yes
8008         ;;
8009     esac
8012 AC_MSG_CHECKING([which libxslt to use])
8013 if test "$with_system_libxml" = "yes"; then
8014     AC_MSG_RESULT([external])
8015     SYSTEM_LIBXSLT=TRUE
8016     if test "$_os" = "Darwin"; then
8017         dnl make sure to use SDK path
8018         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8019         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8020         dnl omit -L/usr/lib
8021         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8022         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8023     else
8024         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8025         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8026         FilterLibs "${LIBXSLT_LIBS}"
8027         LIBXSLT_LIBS="${filteredlibs}"
8028         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8029         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8030         FilterLibs "${LIBEXSLT_LIBS}"
8031         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8032     fi
8034     dnl Check for xsltproc
8035     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8036     if test "$XSLTPROC" = "no"; then
8037         AC_MSG_ERROR([xsltproc is required])
8038     fi
8040     libo_MINGW_CHECK_DLL([libxslt])
8041     libo_MINGW_CHECK_DLL([libexslt])
8042     libo_MINGW_TRY_DLL([iconv])
8043 else
8044     AC_MSG_RESULT([internal])
8045     SYSTEM_LIBXSLT=
8046     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8048     if test "$cross_compiling" = "yes"; then
8049         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8050         if test "$XSLTPROC" = "no"; then
8051             AC_MSG_ERROR([xsltproc is required])
8052         fi
8053     fi
8055 AC_SUBST(SYSTEM_LIBXSLT)
8056 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8057     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8059 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8061 AC_SUBST(LIBEXSLT_CFLAGS)
8062 AC_SUBST(LIBEXSLT_LIBS)
8063 AC_SUBST(LIBXSLT_CFLAGS)
8064 AC_SUBST(LIBXSLT_LIBS)
8065 AC_SUBST(XSLTPROC)
8067 # ===================================================================
8068 # Check for system libxml
8069 # ===================================================================
8070 AC_MSG_CHECKING([which libxml to use])
8071 if test "$with_system_libxml" = "yes"; then
8072     AC_MSG_RESULT([external])
8073     SYSTEM_LIBXML=TRUE
8074     if test "$_os" = "Darwin"; then
8075         dnl make sure to use SDK path
8076         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8077         dnl omit -L/usr/lib
8078         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8079     elif test $_os = iOS; then
8080         dnl make sure to use SDK path
8081         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8082         LIBXML_CFLAGS="-I$usr/include/libxml2"
8083         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8084     else
8085         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8086         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8087         FilterLibs "${LIBXML_LIBS}"
8088         LIBXML_LIBS="${filteredlibs}"
8089     fi
8091     dnl Check for xmllint
8092     AC_PATH_PROG(XMLLINT, xmllint, no)
8093     if test "$XMLLINT" = "no"; then
8094         AC_MSG_ERROR([xmllint is required])
8095     fi
8097     libo_MINGW_CHECK_DLL([libxml2])
8098     libo_MINGW_TRY_DLL([zlib1])
8099 else
8100     AC_MSG_RESULT([internal])
8101     SYSTEM_LIBXML=
8102     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
8103     if test "$COM" = "MSC"; then
8104         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8105     fi
8106     if test "$COM" = "MSC"; then
8107         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
8108     else
8109         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
8110     fi
8111     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8113 AC_SUBST(SYSTEM_LIBXML)
8114 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8115     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8117 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8118 AC_SUBST(LIBXML_CFLAGS)
8119 AC_SUBST(LIBXML_LIBS)
8120 AC_SUBST(XMLLINT)
8122 # =====================================================================
8123 # Checking for a Python interpreter with version >= 2.6.
8124 # Build and runtime requires Python 3 compatible version (>= 2.6).
8125 # Optionally user can pass an option to configure, i. e.
8126 # ./configure PYTHON=/usr/bin/python
8127 # =====================================================================
8128 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8129     # This allows a lack of system python with no error, we use internal one in that case.
8130     AM_PATH_PYTHON([2.6],, [:])
8131     # Clean PYTHON_VERSION checked below if cross-compiling
8132     PYTHON_VERSION=""
8133     if test "$PYTHON" != ":"; then
8134         PYTHON_FOR_BUILD=$PYTHON
8135     fi
8137 AC_SUBST(PYTHON_FOR_BUILD)
8139 # Checks for Python to use for Pyuno
8140 AC_MSG_CHECKING([which Python to use for Pyuno])
8141 case "$enable_python" in
8142 no|disable)
8143     if test -z $PYTHON_FOR_BUILD; then
8144         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8145         # requirement from the choice whether to include Python stuff in the installer, but why
8146         # bother?
8147         AC_MSG_ERROR([Python is required at build time.])
8148     fi
8149     enable_python=no
8150     AC_MSG_RESULT([none])
8151     ;;
8152 ""|yes|auto)
8153     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8154         AC_MSG_RESULT([no, overridden by --disable-scripting])
8155         enable_python=no
8156     elif test $build_os = cygwin; then
8157         dnl When building on Windows we don't attempt to use any installed
8158         dnl "system"  Python.
8159         dnl
8160         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
8161         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
8162         dnl MinGW cross-compilation setups.)
8163         AC_MSG_RESULT([fully internal])
8164         enable_python=internal
8165     elif test "$cross_compiling" = yes; then
8166         AC_MSG_RESULT([system])
8167         enable_python=system
8168     else
8169         # Unset variables set by the above AM_PATH_PYTHON so that
8170         # we actually do check anew.
8171         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
8172         AM_PATH_PYTHON([3.3],, [:])
8173         if test "$PYTHON" = ":"; then
8174             if test -z "$PYTHON_FOR_BUILD"; then
8175                 AC_MSG_RESULT([fully internal])
8176             else
8177                 AC_MSG_RESULT([internal])
8178             fi
8179             enable_python=internal
8180         else
8181             AC_MSG_RESULT([system])
8182             enable_python=system
8183         fi
8184     fi
8185     ;;
8186 internal)
8187     AC_MSG_RESULT([internal])
8188     ;;
8189 fully-internal)
8190     AC_MSG_RESULT([fully internal])
8191     enable_python=internal
8192     ;;
8193 system)
8194     AC_MSG_RESULT([system])
8195     ;;
8197     AC_MSG_ERROR([Incorrect --enable-python option])
8198     ;;
8199 esac
8201 if test $enable_python != no; then
8202     BUILD_TYPE="$BUILD_TYPE PYUNO"
8205 if test $enable_python = system; then
8206     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8207         python_version=2.7
8208         PYTHON=python$python_version
8209         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8210             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8211             PYTHON_LIBS="-framework Python"
8212         else
8213             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8214             PYTHON_LIBS="`$PYTHON-config --libs`"
8215         fi
8216     fi
8217     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8218         # Fallback: Accept these in the environment, or as set above
8219         # for MacOSX.
8220         :
8221     elif test "$cross_compiling" != yes; then
8222         # Unset variables set by the above AM_PATH_PYTHON so that
8223         # we actually do check anew.
8224         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
8225         # This causes an error if no python command is found
8226         AM_PATH_PYTHON([3.3])
8227         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8228         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8229         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8230         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8231         if test -z "$PKG_CONFIG"; then
8232             PYTHON_CFLAGS="-I$python_include"
8233             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8234         elif $PKG_CONFIG --exists python-$python_version; then
8235             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8236             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8237         else
8238             PYTHON_CFLAGS="-I$python_include"
8239             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8240         fi
8241         FilterLibs "${PYTHON_LIBS}"
8242         PYTHON_LIBS="${filteredlibs}"
8243     else
8244         dnl How to find out the cross-compilation Python installation path?
8245         dnl Let's hardocode what we know for different distributions for now...
8246         for python_version in 2.6; do
8247             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8248                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8249                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8250                 AC_MSG_CHECKING([for python.exe])
8251                 libo_MINGW_CHECK_DLL([libpython$python_version])
8252                 libo_MINGW_CHECK_DLL([libreadline6])
8253                 libo_MINGW_CHECK_DLL([libtermcap])
8254                 # could we somehow extract the really mingw python version from
8255                 # actual distro package?
8256                 # 2.6.2 currently on OpenSUSE 12.1?
8257                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8258                 PYTHON_VERSION=$python_version.2
8259                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8260                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8261                 break
8262             fi
8263         done
8264         AC_MSG_CHECKING([for python version])
8265         AS_IF([test -n "$PYTHON_VERSION"],
8266               [AC_MSG_RESULT([$PYTHON_VERSION])],
8267               [AC_MSG_RESULT([not found])
8268                AC_MSG_ERROR([no usable python found])])
8269         test -n "$PYTHON_CFLAGS" && break
8270     fi
8271     # let the PYTHON_FOR_BUILD match the same python installation that
8272     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8273     # better for PythonTests.
8274     PYTHON_FOR_BUILD=$PYTHON
8277 dnl By now enable_python should be "system", "internal" or "no"
8278 case $enable_python in
8279 system)
8280     SYSTEM_PYTHON=TRUE
8282     dnl Check if the headers really work
8283     save_CPPFLAGS="$CPPFLAGS"
8284     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8285     AC_CHECK_HEADER(Python.h, [],
8286        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8287        [])
8288     CPPFLAGS="$save_CPPFLAGS"
8290     AC_LANG_PUSH(C)
8291     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8292     AC_MSG_CHECKING([for correct python library version])
8293        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8294 #include <Python.h>
8296 int main(int argc, char **argv) {
8297    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8298        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8299    else return 1;
8301        ]])],[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])])
8302     CFLAGS=$save_CFLAGS
8303     AC_LANG_POP(C)
8305     dnl FIXME Check if the Python library can be linked with, too?
8306     ;;
8308 internal)
8309     SYSTEM_PYTHON=
8310     PYTHON_VERSION_MAJOR=3
8311     # On windows we are supporting two different python versions: 3.3 and 3.5.
8312     # We msut do it as long as we support MSVC 2013. Python 3.3 can be removed
8313     # when MSVC 2013 support was dropped.
8314     if test "$COM" = "MSC" -a "$VCVER" = "120"; then
8315         PYTHON_VERSION_MINOR=3
8316     else
8317         PYTHON_VERSION_MINOR=5
8318     fi
8319     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
8320     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8321     BUILD_TYPE="$BUILD_TYPE PYTHON"
8322     # Embedded Python dies without Home set
8323     if test "$HOME" = ""; then
8324         export HOME=""
8325     fi
8326     # bz2 tarball and bzip2 is not standard
8327     if test -z "$BZIP2"; then
8328         AC_PATH_PROG( BZIP2, bzip2)
8329         if test -z "$BZIP2"; then
8330             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8331         fi
8332     fi
8333     ;;
8335     DISABLE_PYTHON=TRUE
8336     SYSTEM_PYTHON=
8337     ;;
8339     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8340     ;;
8341 esac
8343 AC_SUBST(DISABLE_PYTHON)
8344 AC_SUBST(SYSTEM_PYTHON)
8345 AC_SUBST(PYTHON_CFLAGS)
8346 AC_SUBST(PYTHON_LIBS)
8347 AC_SUBST(PYTHON_VERSION)
8348 AC_SUBST(PYTHON_VERSION_MAJOR)
8349 AC_SUBST(PYTHON_VERSION_MINOR)
8351 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8352 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8353     AC_MSG_RESULT([yes])
8354     ENABLE_MARIADBC=TRUE
8355     MARIADBC_MAJOR=1
8356     MARIADBC_MINOR=0
8357     MARIADBC_MICRO=2
8358     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8359 else
8360     AC_MSG_RESULT([no])
8361     ENABLE_MARIADBC=
8363 AC_SUBST(ENABLE_MARIADBC)
8364 AC_SUBST(MARIADBC_MAJOR)
8365 AC_SUBST(MARIADBC_MINOR)
8366 AC_SUBST(MARIADBC_MICRO)
8368 if test "$ENABLE_MARIADBC" = "TRUE"; then
8370     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8372     dnl ===================================================================
8373     dnl Check for system MariaDB
8374     dnl ===================================================================
8375     AC_MSG_CHECKING([which MariaDB to use])
8376     if test "$with_system_mariadb" = "yes"; then
8377         AC_MSG_RESULT([external])
8378         SYSTEM_MARIADB=TRUE
8379         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8380         if test -z "$MARIADBCONFIG"; then
8381             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8382             if test -z "$MARIADBCONFIG"; then
8383                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8384                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8385             fi
8386         fi
8387         AC_MSG_CHECKING([MariaDB version])
8388         MARIADB_VERSION=`$MARIADBCONFIG --version`
8389         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8390         if test "$MARIADB_MAJOR" -ge "5"; then
8391             AC_MSG_RESULT([OK])
8392         else
8393             AC_MSG_ERROR([too old, use 5.0.x or later])
8394         fi
8395         AC_MSG_CHECKING([for MariaDB Client library])
8396         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8397         if test "$COM_IS_CLANG" = TRUE; then
8398             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8399         fi
8400         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8401         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8402         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8403         dnl linux32:
8404         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8405             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8406             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8407                 | sed -e 's|/lib64/|/lib/|')
8408         fi
8409         FilterLibs "${MARIADB_LIBS}"
8410         MARIADB_LIBS="${filteredlibs}"
8411         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8412         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8413         if test "$enable_bundle_mariadb" = "yes"; then
8414             AC_MSG_RESULT([yes])
8415             BUNDLE_MARIADB=TRUE
8416             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8418 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8420 /g' | grep -E '(mysqlclient|mariadb)')
8421             if test "$_os" = "Darwin"; then
8422                 LIBMARIADB=${LIBMARIADB}.dylib
8423             elif test "$_os" = "WINNT"; then
8424                 LIBMARIADB=${LIBMARIADB}.dll
8425             else
8426                 LIBMARIADB=${LIBMARIADB}.so
8427             fi
8428             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8429             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8430             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8431                 AC_MSG_RESULT([found.])
8432                 PathFormat "$LIBMARIADB_PATH"
8433                 LIBMARIADB_PATH="$formatted_path"
8434             else
8435                 AC_MSG_ERROR([not found.])
8436             fi
8437         else
8438             AC_MSG_RESULT([no])
8439             BUNDLE_MARIADB=
8440         fi
8441     else
8442         AC_MSG_RESULT([internal])
8443         SYSTEM_MARIADB=
8444         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8445         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8446         BUILD_TYPE="$BUILD_TYPE MARIADB"
8447     fi
8449     AC_SUBST(SYSTEM_MARIADB)
8450     AC_SUBST(MARIADB_CFLAGS)
8451     AC_SUBST(MARIADB_LIBS)
8452     AC_SUBST(LIBMARIADB)
8453     AC_SUBST(LIBMARIADB_PATH)
8454     AC_SUBST(BUNDLE_MARIADB)
8456     AC_LANG_PUSH([C++])
8457     dnl ===================================================================
8458     dnl Check for system MySQL C++ Connector
8459     dnl ===================================================================
8460     # FIXME!
8461     # who thought this too-generic cppconn dir was a good idea?
8462     AC_MSG_CHECKING([MySQL Connector/C++])
8463     if test "$with_system_mysql_cppconn" = "yes"; then
8464         AC_MSG_RESULT([external])
8465         SYSTEM_MYSQL_CPPCONN=TRUE
8466         AC_LANG_PUSH([C++])
8467         AC_CHECK_HEADER(mysql_driver.h, [],
8468                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8469         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8470                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8471         save_LIBS=$LIBS
8472         LIBS="$LIBS -lmysqlcppconn"
8473         AC_MSG_CHECKING([version])
8474         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8475 #include <mysql_driver.h>
8477 int main(int argc, char **argv) {
8478     sql::Driver *driver;
8479     driver = get_driver_instance();
8480     if (driver->getMajorVersion() > 1 || \
8481        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8482        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8483         return 0;
8484       else
8485         return 1;
8487       ]])],[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])])
8489         AC_LANG_POP([C++])
8490         LIBS=$save_LIBS
8491     else
8492         AC_MSG_RESULT([internal])
8493         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8494         SYSTEM_MYSQL_CPPCONN=
8495     fi
8496     AC_LANG_POP([C++])
8498 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8500 dnl ===================================================================
8501 dnl Check for system hsqldb
8502 dnl ===================================================================
8503 if test "$with_java" != "no"; then
8504     HSQLDB_USE_JDBC_4_1=
8505     AC_MSG_CHECKING([which hsqldb to use])
8506     if test "$with_system_hsqldb" = "yes"; then
8507         AC_MSG_RESULT([external])
8508         SYSTEM_HSQLDB=TRUE
8509         if test -z $HSQLDB_JAR; then
8510             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8511         fi
8512         if ! test -f $HSQLDB_JAR; then
8513                AC_MSG_ERROR(hsqldb.jar not found.)
8514         fi
8515         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8516         export HSQLDB_JAR
8517         if $PERL -e \
8518            'use Archive::Zip;
8519             my $file = "$ENV{'HSQLDB_JAR'}";
8520             my $zip = Archive::Zip->new( $file );
8521             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8522             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8523             {
8524                 push @l, split(/\n/, $mf);
8525                 foreach my $line (@l)
8526                 {
8527                     if ($line =~ m/Specification-Version:/)
8528                     {
8529                         ($t, $version) = split (/:/,$line);
8530                         $version =~ s/^\s//;
8531                         ($a, $b, $c, $d) = split (/\./,$version);
8532                         if ($c == "0" && $d > "8")
8533                         {
8534                             exit 0;
8535                         }
8536                         else
8537                         {
8538                             exit 1;
8539                         }
8540                     }
8541                 }
8542             }
8543             else
8544             {
8545                 exit 1;
8546             }'; then
8547             AC_MSG_RESULT([yes])
8548         else
8549             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8550         fi
8551     else
8552         AC_MSG_RESULT([internal])
8553         SYSTEM_HSQLDB=
8554         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8555         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8556         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8557         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8558             AC_MSG_RESULT([yes])
8559             HSQLDB_USE_JDBC_4_1=TRUE
8560         else
8561             AC_MSG_RESULT([no])
8562         fi
8563     fi
8564     AC_SUBST(SYSTEM_HSQLDB)
8565     AC_SUBST(HSQLDB_JAR)
8566     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8569 dnl ===================================================================
8570 dnl Check for PostgreSQL stuff
8571 dnl ===================================================================
8572 if test "x$enable_postgresql_sdbc" != "xno"; then
8573     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8575     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8576         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8577     fi
8578     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8579         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8580     fi
8582     postgres_interface=""
8583     if test "$with_system_postgresql" = "yes"; then
8584         postgres_interface="external PostgreSQL"
8585         SYSTEM_POSTGRESQL=TRUE
8586         if test "$_os" = Darwin; then
8587             supp_path=''
8588             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8589                 pg_supp_path="$P_SEP$d$pg_supp_path"
8590             done
8591         fi
8592         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8593         if test -z "$PGCONFIG"; then
8594             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8595         fi
8596         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8597         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8598         FilterLibs "${POSTGRESQL_LIB}"
8599         POSTGRESQL_LIB="${filteredlibs}"
8600     else
8601         # if/when anything else than PostgreSQL uses Kerberos,
8602         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8603         WITH_KRB5=
8604         WITH_GSSAPI=
8605         case "$_os" in
8606         Darwin)
8607             # MacOS X has system MIT Kerberos 5 since 10.4
8608             if test "$with_krb5" != "no"; then
8609                 WITH_KRB5=TRUE
8610                 save_LIBS=$LIBS
8611                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8612                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8613                 KRB5_LIBS=$LIBS
8614                 LIBS=$save_LIBS
8615                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8616                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8617                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8618                 LIBS=$save_LIBS
8619             fi
8620             if test "$with_gssapi" != "no"; then
8621                 WITH_GSSAPI=TRUE
8622                 save_LIBS=$LIBS
8623                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8624                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8625                 GSSAPI_LIBS=$LIBS
8626                 LIBS=$save_LIBS
8627             fi
8628             ;;
8629         WINNT)
8630             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8631                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8632             fi
8633             ;;
8634         Linux|GNU|*BSD|DragonFly)
8635             if test "$with_krb5" != "no"; 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" != "no"; 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                 GSSAPI_LIBS=$LIBS
8653                 LIBS=$save_LIBS
8654             fi
8655             ;;
8656         *)
8657             if test "$with_krb5" = "yes"; then
8658                 WITH_KRB5=TRUE
8659                 save_LIBS=$LIBS
8660                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8661                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8662                 KRB5_LIBS=$LIBS
8663                 LIBS=$save_LIBS
8664                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8665                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8666                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8667                 LIBS=$save_LIBS
8668             fi
8669             if test "$with_gssapi" = "yes"; then
8670                 WITH_GSSAPI=TRUE
8671                 save_LIBS=$LIBS
8672                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8673                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8674                 LIBS=$save_LIBS
8675                 GSSAPI_LIBS=$LIBS
8676             fi
8677         esac
8679         if test -n "$with_libpq_path"; then
8680             SYSTEM_POSTGRESQL=TRUE
8681             postgres_interface="external libpq"
8682             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8683             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8684         else
8685             SYSTEM_POSTGRESQL=
8686             postgres_interface="internal"
8687             POSTGRESQL_LIB=""
8688             POSTGRESQL_INC="%OVERRIDE_ME%"
8689             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8690         fi
8691     fi
8693     AC_MSG_CHECKING([PostgreSQL C interface])
8694     AC_MSG_RESULT([$postgres_interface])
8696     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8697         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8698         save_CFLAGS=$CFLAGS
8699         save_CPPFLAGS=$CPPFLAGS
8700         save_LIBS=$LIBS
8701         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8702         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8703         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8704         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8705             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8706         CFLAGS=$save_CFLAGS
8707         CPPFLAGS=$save_CPPFLAGS
8708         LIBS=$save_LIBS
8709     fi
8710     BUILD_POSTGRESQL_SDBC=TRUE
8712 AC_SUBST(WITH_KRB5)
8713 AC_SUBST(WITH_GSSAPI)
8714 AC_SUBST(GSSAPI_LIBS)
8715 AC_SUBST(KRB5_LIBS)
8716 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8717 AC_SUBST(SYSTEM_POSTGRESQL)
8718 AC_SUBST(POSTGRESQL_INC)
8719 AC_SUBST(POSTGRESQL_LIB)
8721 dnl ===================================================================
8722 dnl Check for Firebird stuff
8723 dnl ===================================================================
8724 ENABLE_FIREBIRD_SDBC=""
8725 if test "$enable_firebird_sdbc" = "yes" ; then
8726     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8728     dnl ===================================================================
8729     dnl Check for system Firebird
8730     dnl ===================================================================
8731     AC_MSG_CHECKING([which Firebird to use])
8732     if test "$with_system_firebird" = "yes"; then
8733         AC_MSG_RESULT([external])
8734         SYSTEM_FIREBIRD=TRUE
8735         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8736         if test -z "$FIREBIRDCONFIG"; then
8737             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8738             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8739                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8740             ])
8741             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8742         else
8743             AC_MSG_NOTICE([fb_config found])
8744             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8745             AC_MSG_CHECKING([for Firebird Client library])
8746             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8747             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8748             FilterLibs "${FIREBIRD_LIBS}"
8749             FIREBIRD_LIBS="${filteredlibs}"
8750         fi
8751         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8752         AC_MSG_CHECKING([Firebird version])
8753         if test -n "${FIREBIRD_VERSION}"; then
8754             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8755             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8756             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8757                 AC_MSG_RESULT([OK])
8758             else
8759                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8760             fi
8761         else
8762             __save_CFLAGS="${CFLAGS}"
8763             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8764             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8765 #if defined(FB_API_VER) && FB_API_VER == 30
8766 int fb_api_is_30(void) { return 0; }
8767 #else
8768 #error "Wrong Firebird API version"
8769 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8770             CFLAGS="${__save_CFLAGS}"
8771         fi
8772         ENABLE_FIREBIRD_SDBC="TRUE"
8773     elif test "$enable_database_connectivity" != yes; then
8774         AC_MSG_RESULT([none])
8775     elif test "$cross_compiling" = "yes"; then
8776         AC_MSG_RESULT([none])
8777     else
8778         dnl Embedded Firebird has version 3.0
8779         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8780         dnl We need libatomic-ops for any non X86/X64 system
8781         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8782             dnl ===================================================================
8783             dnl Check for system libatomic-ops
8784             dnl ===================================================================
8785             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8786             if test "$with_system_libatomic_ops" = "yes"; then
8787                 SYSTEM_LIBATOMIC_OPS=TRUE
8788                 AC_CHECK_HEADERS(atomic_ops.h, [],
8789                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8790             else
8791                 SYSTEM_LIBATOMIC_OPS=
8792                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8793                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8794                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8795             fi
8796         fi
8798         AC_MSG_RESULT([internal])
8799         SYSTEM_FIREBIRD=
8800         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8801         FIREBIRD_LIBS="-lfbclient"
8803         if test "$with_system_libtommath" = "yes"; then
8804             SYSTEM_LIBTOMMATH=TRUE
8805             dnl check for tommath presence
8806             save_LIBS=$LIBS
8807             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8808             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8809             LIBS=$save_LIBS
8810         else
8811             SYSTEM_LIBTOMMATH=
8812             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8813             LIBTOMMATH_LIBS="-ltommath"
8814             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8815         fi
8817         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8818         ENABLE_FIREBIRD_SDBC="TRUE"
8819     fi
8821 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8822 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8823 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8824 AC_SUBST(LIBATOMIC_OPS_LIBS)
8825 AC_SUBST(SYSTEM_FIREBIRD)
8826 AC_SUBST(FIREBIRD_CFLAGS)
8827 AC_SUBST(FIREBIRD_LIBS)
8828 AC_SUBST([TOMMATH_CFLAGS])
8829 AC_SUBST([TOMMATH_LIBS])
8831 dnl ===================================================================
8832 dnl Check for system curl
8833 dnl ===================================================================
8834 AC_MSG_CHECKING([which libcurl to use])
8835 if test "$with_system_curl" = "auto"; then
8836     with_system_curl="$with_system_libs"
8839 if test "$with_system_curl" = "yes"; then
8840     AC_MSG_RESULT([external])
8841     SYSTEM_CURL=TRUE
8843     # First try PKGCONFIG and then fall back
8844     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8846     if test -n "$CURL_PKG_ERRORS"; then
8847         AC_PATH_PROG(CURLCONFIG, curl-config)
8848         if test -z "$CURLCONFIG"; then
8849             AC_MSG_ERROR([curl development files not found])
8850         fi
8851         CURL_LIBS=`$CURLCONFIG --libs`
8852         FilterLibs "${CURL_LIBS}"
8853         CURL_LIBS="${filteredlibs}"
8854         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8855         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8857         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8858         case $curl_version in
8859         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8860         dnl so they need to be doubled to end up in the configure script
8861         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8862             AC_MSG_RESULT([yes])
8863             ;;
8864         *)
8865             AC_MSG_ERROR([no, you have $curl_version])
8866             ;;
8867         esac
8868     fi
8870     libo_MINGW_CHECK_DLL([libcurl])
8871     libo_MINGW_TRY_DLL([libintl])
8872     libo_MINGW_TRY_DLL([libidn])
8873     libo_MINGW_TRY_DLL([libnspr4])
8874     libo_MINGW_TRY_DLL([nssutil3])
8875     libo_MINGW_TRY_DLL([libplc4])
8876     libo_MINGW_TRY_DLL([libplds4])
8877     libo_MINGW_TRY_DLL([nss3])
8878     libo_MINGW_TRY_DLL([ssl3])
8879     libo_MINGW_TRY_DLL([libgpg-error])
8880     libo_MINGW_TRY_DLL([libgcrypt])
8881     libo_MINGW_TRY_DLL([libssh2])
8882     ENABLE_CURL=TRUE
8883 elif test $_os = iOS; then
8884     # Let's see if we need curl, I think not?
8885     AC_MSG_RESULT([none])
8886     ENABLE_CURL=
8887 else
8888     AC_MSG_RESULT([internal])
8889     SYSTEM_CURL=
8890     BUILD_TYPE="$BUILD_TYPE CURL"
8891     ENABLE_CURL=TRUE
8893 AC_SUBST(SYSTEM_CURL)
8894 AC_SUBST(CURL_CFLAGS)
8895 AC_SUBST(CURL_LIBS)
8896 AC_SUBST(ENABLE_CURL)
8898 dnl ===================================================================
8899 dnl Check for system boost
8900 dnl ===================================================================
8901 AC_MSG_CHECKING([which boost to use])
8902 if test "$with_system_boost" = "yes"; then
8903     AC_MSG_RESULT([external])
8904     SYSTEM_BOOST=TRUE
8905     AX_BOOST_BASE(1.47)
8906     AX_BOOST_DATE_TIME
8907     AX_BOOST_FILESYSTEM
8908     AX_BOOST_IOSTREAMS
8909     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8910     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8911     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8912         # if not found, try again with 'lib' prefix
8913         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8914     fi
8915     AC_LANG_PUSH([C++])
8916     save_CXXFLAGS=$CXXFLAGS
8917     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8918     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8919        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8920     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8921        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8922     AC_CHECK_HEADER(boost/function.hpp, [],
8923        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8924     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8925     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8926     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8927 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8928     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8929         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8930     else
8931         AC_MSG_RESULT([yes])
8932     fi
8933     CXXFLAGS=$save_CXXFLAGS
8934     AC_LANG_POP([C++])
8935     # this is in m4/ax_boost_base.m4
8936     FilterLibs "${BOOST_LDFLAGS}"
8937     BOOST_LDFLAGS="${filteredlibs}"
8938 else
8939     AC_MSG_RESULT([internal])
8940     BUILD_TYPE="$BUILD_TYPE BOOST"
8941     SYSTEM_BOOST=
8942     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8943         # use warning-suppressing wrapper headers
8944         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8945     else
8946         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8947     fi
8949 AC_SUBST(SYSTEM_BOOST)
8951 dnl ===================================================================
8952 dnl Check for system mdds
8953 dnl ===================================================================
8954 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8956 dnl ===================================================================
8957 dnl Check for system glm
8958 dnl ===================================================================
8959 AC_MSG_CHECKING([which glm to use])
8960 if test "$with_system_glm" = "yes"; then
8961     AC_MSG_RESULT([external])
8962     SYSTEM_GLM=TRUE
8963     AC_LANG_PUSH([C++])
8964     AC_CHECK_HEADER([glm/glm.hpp], [],
8965        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8966     AC_LANG_POP([C++])
8967 else
8968     AC_MSG_RESULT([internal])
8969     BUILD_TYPE="$BUILD_TYPE GLM"
8970     SYSTEM_GLM=
8971     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8973 AC_SUBST([GLM_CFLAGS])
8974 AC_SUBST([SYSTEM_GLM])
8976 dnl ===================================================================
8977 dnl Check for system glew
8978 dnl ===================================================================
8979 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8980 AS_IF([test "$with_system_glew" = "yes"],
8981     [PKG_CHECK_EXISTS([glew >= 1.12.0], [AC_DEFINE([HAVE_GLEW_1_12])])],
8982     [AC_DEFINE([HAVE_GLEW_1_12])])
8984 dnl ===================================================================
8985 dnl Check for system odbc
8986 dnl ===================================================================
8987 AC_MSG_CHECKING([which odbc headers to use])
8988 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
8989     AC_MSG_RESULT([external])
8990     SYSTEM_ODBC_HEADERS=TRUE
8992     if test "$build_os" = "cygwin"; then
8993         save_CPPFLAGS=$CPPFLAGS
8994         find_winsdk
8995         PathFormat "$winsdktest"
8996         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"
8997         AC_CHECK_HEADER(sqlext.h, [],
8998             [AC_MSG_ERROR(odbc not found. install odbc)],
8999             [#include <windows.h>])
9000         CPPFLAGS=$save_CPPFLAGS
9001     else
9002         AC_CHECK_HEADER(sqlext.h, [],
9003             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9004     fi
9005 elif test "$enable_database_connectivity" != yes; then
9006     AC_MSG_RESULT([none])
9007 else
9008     AC_MSG_RESULT([internal])
9009     SYSTEM_ODBC_HEADERS=
9011 AC_SUBST(SYSTEM_ODBC_HEADERS)
9014 dnl ===================================================================
9015 dnl Check for system openldap
9016 dnl ===================================================================
9018 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9019 AC_MSG_CHECKING([which openldap library to use])
9020 if test "$with_system_openldap" = "yes"; then
9021     AC_MSG_RESULT([external])
9022     SYSTEM_OPENLDAP=TRUE
9023     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9024     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9025     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9026 else
9027     AC_MSG_RESULT([internal])
9028     SYSTEM_OPENLDAP=
9029     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9032 AC_SUBST(SYSTEM_OPENLDAP)
9034 dnl ===================================================================
9035 dnl Check for TLS/SSL and cryptographic implementation to use
9036 dnl ===================================================================
9037 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9038 if test -n "$with_tls"; then
9039     case $with_tls in
9040     openssl)
9041         AC_DEFINE(USE_TLS_OPENSSL)
9042         TLS=OPENSSL
9044         if test "$enable_openssl" != "yes"; then
9045             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9046         fi
9048         # warn that OpenSSL has been selected but not all TLS code has this option
9049         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
9050         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
9051         ;;
9052     nss)
9053         AC_DEFINE(USE_TLS_NSS)
9054         TLS=NSS
9055         ;;
9056     *)
9057         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9058 openssl - OpenSSL
9059 nss - Mozilla's Network Security Services (NSS)
9060     ])
9061         ;;
9062     esac
9063 elif test $_os = iOS -o $_os = Android; then
9064     # We don't build NSS for iOS and Android
9065     AC_DEFINE(USE_TLS_OPENSSL)
9066     TLS=OPENSSL
9067 else
9068     # default to using NSS, it results in smaller oox lib
9069     AC_DEFINE(USE_TLS_NSS)
9070     TLS=NSS
9072 AC_MSG_RESULT([$TLS])
9073 AC_SUBST(TLS)
9075 dnl ===================================================================
9076 dnl Check for system NSS
9077 dnl ===================================================================
9078 if test $_os != iOS; then
9079     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9081 if test "$with_system_nss" = "yes"; then
9082     libo_MINGW_CHECK_DLL([libnspr4])
9083     libo_MINGW_CHECK_DLL([libplc4])
9084     libo_MINGW_CHECK_DLL([libplds4])
9085     libo_MINGW_CHECK_DLL([nss3])
9086     libo_MINGW_CHECK_DLL([nssutil3])
9087     libo_MINGW_CHECK_DLL([smime3])
9088     libo_MINGW_CHECK_DLL([ssl3])
9091 dnl ===================================================================
9092 dnl Check for system sane
9093 dnl ===================================================================
9094 AC_MSG_CHECKING([which sane header to use])
9095 if test "$with_system_sane" = "yes"; then
9096     AC_MSG_RESULT([external])
9097     AC_CHECK_HEADER(sane/sane.h, [],
9098       [AC_MSG_ERROR(sane not found. install sane)], [])
9099 else
9100     AC_MSG_RESULT([internal])
9101     BUILD_TYPE="$BUILD_TYPE SANE"
9104 dnl ===================================================================
9105 dnl Check for system icu
9106 dnl ===================================================================
9107 SYSTEM_GENBRK=
9108 SYSTEM_GENCCODE=
9109 SYSTEM_GENCMN=
9111 ICU_MAJOR=58
9112 ICU_MINOR=1
9113 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9114 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9115 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9116 AC_MSG_CHECKING([which icu to use])
9117 if test "$with_system_icu" = "yes"; then
9118     AC_MSG_RESULT([external])
9119     SYSTEM_ICU=TRUE
9120     AC_LANG_PUSH([C++])
9121     AC_MSG_CHECKING([for unicode/rbbi.h])
9122     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9123     AC_LANG_POP([C++])
9125     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
9126         ICUPATH="$PATH"
9127         if test "$WITH_MINGW" = "yes"; then
9128             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
9129         fi
9130         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
9132         AC_MSG_CHECKING([ICU version])
9133         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9134         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9135         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9137         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "6" \); then
9138             AC_MSG_RESULT([OK, $ICU_VERSION])
9139         else
9140             AC_MSG_ERROR([not suitable, only >= 4.6 supported currently])
9141         fi
9142     fi
9144     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9145         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9146         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9147         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9148         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9149         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9150         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9151             AC_MSG_RESULT([yes])
9152         else
9153             AC_MSG_RESULT([no])
9154             if test "$with_system_icu_for_build" != "force"; then
9155                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9156 You can use --with-system-icu-for-build=force to use it anyway.])
9157             fi
9158         fi
9159     fi
9161     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9162         # using the system icu tools can lead to version confusion, use the
9163         # ones from the build environment when cross-compiling
9164         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9165         if test -z "$SYSTEM_GENBRK"; then
9166             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9167         fi
9168         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9169         if test -z "$SYSTEM_GENCCODE"; then
9170             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9171         fi
9172         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9173         if test -z "$SYSTEM_GENCMN"; then
9174             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9175         fi
9176         if test "$ICU_MAJOR" -ge "49"; then
9177             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9178             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9179             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9180         else
9181             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9182             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9183             ICU_RECLASSIFIED_HEBREW_LETTER=
9184         fi
9185     fi
9187     if test "$cross_compiling" = "yes"; then
9188         if test "$ICU_MAJOR" -ge "50"; then
9189             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9190             ICU_MINOR=""
9191         fi
9192     fi
9194     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9195     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9196     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9197 else
9198     AC_MSG_RESULT([internal])
9199     SYSTEM_ICU=
9200     BUILD_TYPE="$BUILD_TYPE ICU"
9201     # surprisingly set these only for "internal" (to be used by various other
9202     # external libs): the system icu-config is quite unhelpful and spits out
9203     # dozens of weird flags and also default path -I/usr/include
9204     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9205     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9207 AC_SUBST(SYSTEM_ICU)
9208 AC_SUBST(SYSTEM_GENBRK)
9209 AC_SUBST(SYSTEM_GENCCODE)
9210 AC_SUBST(SYSTEM_GENCMN)
9211 AC_SUBST(ICU_MAJOR)
9212 AC_SUBST(ICU_MINOR)
9213 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9214 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9215 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9216 AC_SUBST(ICU_CFLAGS)
9217 AC_SUBST(ICU_LIBS)
9219 dnl ==================================================================
9220 dnl Breakpad
9221 dnl ==================================================================
9222 AC_MSG_CHECKING([whether to enable breakpad])
9223 if test "$enable_breakpad" != yes; then
9224     AC_MSG_RESULT([no])
9225 else
9226     AC_MSG_RESULT([yes])
9227     ENABLE_BREAKPAD="TRUE"
9228     AC_DEFINE(ENABLE_BREAKPAD)
9229     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9230     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9232     AC_MSG_CHECKING([for crashreport config])
9233     if test "$with_symbol_config" = "no"; then
9234         BREAKPAD_SYMBOL_CONFIG="invalid"
9235         AC_MSG_RESULT([no])
9236     else
9237         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9238         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9239         AC_MSG_RESULT([yes])
9240     fi
9241     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9243 AC_SUBST(ENABLE_BREAKPAD)
9245 dnl ===================================================================
9246 dnl Orcus
9247 dnl ===================================================================
9249 AC_MSG_CHECKING([whether to enable orcus])
9250 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9251     AC_MSG_RESULT([yes])
9252     ENABLE_ORCUS="TRUE"
9253     AC_DEFINE(ENABLE_ORCUS)
9255     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.12 >= 0.12.0])
9256     if test "$with_system_orcus" != "yes"; then
9257         if test "$SYSTEM_BOOST" = "TRUE"; then
9258             # ===========================================================
9259             # Determine if we are going to need to link with Boost.System
9260             # ===========================================================
9261             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9262             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9263             dnl in documentation has no effect.
9264             AC_MSG_CHECKING([if we need to link with Boost.System])
9265             AC_LANG_PUSH([C++])
9266             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9267                     @%:@include <boost/version.hpp>
9268                 ]],[[
9269                     #if BOOST_VERSION >= 105000
9270                     #   error yes, we need to link with Boost.System
9271                     #endif
9272                 ]])],[
9273                     AC_MSG_RESULT([no])
9274                 ],[
9275                     AC_MSG_RESULT([yes])
9276                     AX_BOOST_SYSTEM
9277             ])
9278             AC_LANG_POP([C++])
9279         fi
9280     fi
9281     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9282     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9283     AC_SUBST([BOOST_SYSTEM_LIB])
9284     AC_SUBST(SYSTEM_LIBORCUS)
9286 else
9287     AC_MSG_RESULT([no])
9289 AC_SUBST(ENABLE_ORCUS)
9291 dnl ===================================================================
9292 dnl HarfBuzz
9293 dnl ===================================================================
9294 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9295                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9296                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9298 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9299                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9300                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9302  if test "$COM" = "MSC"; then # override the above
9303     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9304     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9307 if test "$with_system_harfbuzz" = "yes"; then
9308     if test "$with_system_graphite" = "no"; then
9309         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9310     fi
9311     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9312     _save_libs="$LIBS"
9313     _save_cflags="$CFLAGS"
9314     LIBS="$LIBS $HARFBUZZ_LIBS"
9315     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9316     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9317     LIBS="$_save_libs"
9318     CFLAGS="$_save_cflags"
9319 else
9320     if test "$with_system_graphite" = "yes"; then
9321         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9322     fi
9325 AC_MSG_CHECKING([whether to use X11])
9326 dnl ***************************************
9327 dnl testing for X libraries and includes...
9328 dnl ***************************************
9329 if test "$USING_X11" = TRUE; then
9330     AC_DEFINE(HAVE_FEATURE_X11)
9332 AC_MSG_RESULT([$USING_X11])
9334 if test "$USING_X11" = TRUE; then
9335     AC_PATH_X
9336     AC_PATH_XTRA
9337     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9339     if test -z "$x_includes"; then
9340         x_includes="default_x_includes"
9341     fi
9342     if test -z "$x_libraries"; then
9343         x_libraries="default_x_libraries"
9344     fi
9345     CFLAGS="$CFLAGS $X_CFLAGS"
9346     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9347     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9348 else
9349     x_includes="no_x_includes"
9350     x_libraries="no_x_libraries"
9353 if test "$USING_X11" = TRUE; then
9354     dnl ===================================================================
9355     dnl Check for Composite.h for Mozilla plugin
9356     dnl ===================================================================
9357     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9358      [#include <X11/Intrinsic.h>])
9360     dnl ===================================================================
9361     dnl Check for extension headers
9362     dnl ===================================================================
9363     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9364      [#include <X11/extensions/shape.h>])
9366     # vcl needs ICE and SM
9367     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9368     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9369         [AC_MSG_ERROR(ICE library not found)])
9370     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9371     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9372         [AC_MSG_ERROR(SM library not found)])
9375 dnl ===================================================================
9376 dnl Check for system Xrender
9377 dnl ===================================================================
9378 AC_MSG_CHECKING([whether to use Xrender])
9379 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9380     AC_MSG_RESULT([yes])
9381     PKG_CHECK_MODULES(XRENDER, xrender)
9382     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9383     FilterLibs "${XRENDER_LIBS}"
9384     XRENDER_LIBS="${filteredlibs}"
9385     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9386       [AC_MSG_ERROR(libXrender not found or functional)], [])
9387     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9388       [AC_MSG_ERROR(Xrender not found. install X)], [])
9389 else
9390     AC_MSG_RESULT([no])
9392 AC_SUBST(XRENDER_CFLAGS)
9393 AC_SUBST(XRENDER_LIBS)
9395 dnl ===================================================================
9396 dnl Check for XRandr
9397 dnl ===================================================================
9398 AC_MSG_CHECKING([whether to enable RandR support])
9399 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9400     AC_MSG_RESULT([yes])
9401     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9402     if test "$ENABLE_RANDR" != "TRUE"; then
9403         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9404                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9405         XRANDR_CFLAGS=" "
9406         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9407           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9408         XRANDR_LIBS="-lXrandr "
9409         ENABLE_RANDR="TRUE"
9410     fi
9411     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9412     FilterLibs "${XRANDR_LIBS}"
9413     XRANDR_LIBS="${filteredlibs}"
9414 else
9415     ENABLE_RANDR=""
9416     AC_MSG_RESULT([no])
9418 AC_SUBST(XRANDR_CFLAGS)
9419 AC_SUBST(XRANDR_LIBS)
9420 AC_SUBST(ENABLE_RANDR)
9422 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9423     WITH_WEBDAV="serf"
9425 if test $_os = iOS -o $_os = Android; then
9426     WITH_WEBDAV="no"
9428 AC_MSG_CHECKING([for webdav library])
9429 case "$WITH_WEBDAV" in
9430 serf)
9431     AC_MSG_RESULT([serf])
9432     # Check for system apr-util
9433     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9434                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9435                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9436     if test "$COM" = "MSC"; then
9437         APR_LIB_DIR="LibR"
9438         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9439         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9440     fi
9442     # Check for system serf
9443     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9444                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9445     if test "$COM" = "MSC"; then
9446         SERF_LIB_DIR="Release"
9447         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9448         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9449     fi
9450     ;;
9451 neon)
9452     AC_MSG_RESULT([neon])
9453     # Check for system neon
9454     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9455     if test "$with_system_neon" = "yes"; then
9456         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9457         libo_MINGW_CHECK_DLL([libneon])
9458         libo_MINGW_TRY_DLL([libtasn1])
9459         libo_MINGW_TRY_DLL([libgnutls])
9460     else
9461         NEON_VERSION=0295
9462     fi
9463     AC_SUBST(NEON_VERSION)
9464     ;;
9466     AC_MSG_RESULT([none, disabled])
9467     WITH_WEBDAV=""
9468     ;;
9469 esac
9470 AC_SUBST(WITH_WEBDAV)
9472 dnl ===================================================================
9473 dnl Check for disabling cve_tests
9474 dnl ===================================================================
9475 AC_MSG_CHECKING([whether to execute CVE tests])
9476 # If not explicitly enabled or disabled, default
9477 if test -z "$enable_cve_tests"; then
9478     case "$OS" in
9479     WNT)
9480         # Default cves off for windows with its wild and wonderful
9481         # varienty of AV software kicking in and panicing
9482         enable_cve_tests=no
9483         ;;
9484     *)
9485         # otherwise yes
9486         enable_cve_tests=yes
9487         ;;
9488     esac
9490 if test "$enable_cve_tests" = "no"; then
9491     AC_MSG_RESULT([no])
9492     DISABLE_CVE_TESTS=TRUE
9493     AC_SUBST(DISABLE_CVE_TESTS)
9494 else
9495     AC_MSG_RESULT([yes])
9498 dnl ===================================================================
9499 dnl Check for enabling chart XShape tests
9500 dnl ===================================================================
9501 AC_MSG_CHECKING([whether to execute chart XShape tests])
9502 if test "$enable_chart_tests" = "yes"; then
9503     AC_MSG_RESULT([yes])
9504     ENABLE_CHART_TESTS=TRUE
9505     AC_SUBST(ENABLE_CHART_TESTS)
9506 else
9507     AC_MSG_RESULT([no])
9510 dnl ===================================================================
9511 dnl Check for system openssl
9512 dnl ===================================================================
9513 DISABLE_OPENSSL=
9514 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9515 if test "$enable_openssl" = "yes"; then
9516     AC_MSG_RESULT([no])
9517     if test "$_os" = Darwin ; then
9518         # OpenSSL is deprecated when building for 10.7 or later.
9519         #
9520         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9521         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9523         with_system_openssl=no
9524         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9525     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9526             && test "$with_system_openssl" != "no"; then
9527         with_system_openssl=yes
9528         SYSTEM_OPENSSL=TRUE
9529         OPENSSL_CFLAGS=
9530         OPENSSL_LIBS="-lssl -lcrypto"
9531     else
9532         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9533     fi
9534     if test "$with_system_openssl" = "yes"; then
9535         libo_MINGW_CHECK_DLL([libssl])
9536         libo_MINGW_CHECK_DLL([libcrypto])
9537         AC_MSG_CHECKING([whether openssl supports SHA512])
9538         AC_LANG_PUSH([C])
9539         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9540             SHA512_CTX context;
9541 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9542         AC_LANG_POP(C)
9543     fi
9544 else
9545     AC_MSG_RESULT([yes])
9546     DISABLE_OPENSSL=TRUE
9548     # warn that although OpenSSL is disabled, system libraries may be depending on it
9549     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9550     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9553 AC_SUBST([DISABLE_OPENSSL])
9555 dnl ===================================================================
9556 dnl Check for building gnutls
9557 dnl ===================================================================
9558 AC_MSG_CHECKING([whether to use gnutls])
9559 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9560     AC_MSG_RESULT([yes])
9561     AM_PATH_LIBGCRYPT()
9562     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9563         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9564                       available in the system to use as replacement.]]))
9565     FilterLibs "${LIBGCRYPT_LIBS}"
9566     LIBGCRYPT_LIBS="${filteredlibs}"
9567 else
9568     AC_MSG_RESULT([no])
9571 AC_SUBST([LIBGCRYPT_CFLAGS])
9572 AC_SUBST([LIBGCRYPT_LIBS])
9574 dnl ===================================================================
9575 dnl Check for system redland
9576 dnl ===================================================================
9577 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9578 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9579 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9580 if test "$with_system_redland" = "yes"; then
9581     libo_MINGW_CHECK_DLL([librdf])
9582     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9583             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9584     libo_MINGW_TRY_DLL([libraptor])
9585     libo_MINGW_TRY_DLL([librasqal])
9586     libo_MINGW_TRY_DLL([libsqlite3])
9587 else
9588     RAPTOR_MAJOR="0"
9589     RASQAL_MAJOR="3"
9590     REDLAND_MAJOR="0"
9592 AC_SUBST(RAPTOR_MAJOR)
9593 AC_SUBST(RASQAL_MAJOR)
9594 AC_SUBST(REDLAND_MAJOR)
9596 dnl ===================================================================
9597 dnl Check for system hunspell
9598 dnl ===================================================================
9599 AC_MSG_CHECKING([which libhunspell to use])
9600 if test "$with_system_hunspell" = "yes"; then
9601     AC_MSG_RESULT([external])
9602     SYSTEM_HUNSPELL=TRUE
9603     AC_LANG_PUSH([C++])
9604     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9605     if test "$HUNSPELL_PC" != "TRUE"; then
9606         AC_CHECK_HEADER(hunspell.hxx, [],
9607             [
9608             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9609             [AC_MSG_ERROR(hunspell headers not found.)], [])
9610             ], [])
9611         AC_CHECK_LIB([hunspell], [main], [:],
9612            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9613         HUNSPELL_LIBS=-lhunspell
9614     fi
9615     AC_LANG_POP([C++])
9616     libo_MINGW_CHECK_DLL([libhunspell-1.6])
9617     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9618     FilterLibs "${HUNSPELL_LIBS}"
9619     HUNSPELL_LIBS="${filteredlibs}"
9620 else
9621     AC_MSG_RESULT([internal])
9622     SYSTEM_HUNSPELL=
9623     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9624     if test "$COM" = "MSC"; then
9625         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9626     else
9627         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9628     fi
9629     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9631 AC_SUBST(SYSTEM_HUNSPELL)
9632 AC_SUBST(HUNSPELL_CFLAGS)
9633 AC_SUBST(HUNSPELL_LIBS)
9635 dnl ===================================================================
9636 dnl Checking for altlinuxhyph
9637 dnl ===================================================================
9638 AC_MSG_CHECKING([which altlinuxhyph to use])
9639 if test "$with_system_altlinuxhyph" = "yes"; then
9640     AC_MSG_RESULT([external])
9641     SYSTEM_HYPH=TRUE
9642     AC_CHECK_HEADER(hyphen.h, [],
9643        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9644     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9645        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9646        [#include <hyphen.h>])
9647     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9648         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9649     if test -z "$HYPHEN_LIB"; then
9650         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9651            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9652     fi
9653     if test -z "$HYPHEN_LIB"; then
9654         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9655            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9656     fi
9657     libo_MINGW_CHECK_DLL([libhyphen])
9658 else
9659     AC_MSG_RESULT([internal])
9660     SYSTEM_HYPH=
9661     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9662     if test "$COM" = "MSC"; then
9663         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9664     else
9665         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9666     fi
9668 AC_SUBST(SYSTEM_HYPH)
9669 AC_SUBST(HYPHEN_LIB)
9671 dnl ===================================================================
9672 dnl Checking for mythes
9673 dnl ===================================================================
9674 AC_MSG_CHECKING([which mythes to use])
9675 if test "$with_system_mythes" = "yes"; then
9676     AC_MSG_RESULT([external])
9677     SYSTEM_MYTHES=TRUE
9678     AC_LANG_PUSH([C++])
9679     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9680     if test "$MYTHES_PKGCONFIG" = "no"; then
9681         AC_CHECK_HEADER(mythes.hxx, [],
9682             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9683         AC_CHECK_LIB([mythes-1.2], [main], [:],
9684             [ MYTHES_FOUND=no], [])
9685     if test "$MYTHES_FOUND" = "no"; then
9686         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9687                 [ MYTHES_FOUND=no], [])
9688     fi
9689     if test "$MYTHES_FOUND" = "no"; then
9690         AC_MSG_ERROR([mythes library not found!.])
9691     fi
9692     fi
9693     AC_LANG_POP([C++])
9694     libo_MINGW_CHECK_DLL([libmythes-1.2])
9695     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9696     FilterLibs "${MYTHES_LIBS}"
9697     MYTHES_LIBS="${filteredlibs}"
9698 else
9699     AC_MSG_RESULT([internal])
9700     SYSTEM_MYTHES=
9701     BUILD_TYPE="$BUILD_TYPE MYTHES"
9702     if test "$COM" = "MSC"; then
9703         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9704     else
9705         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9706     fi
9708 AC_SUBST(SYSTEM_MYTHES)
9709 AC_SUBST(MYTHES_CFLAGS)
9710 AC_SUBST(MYTHES_LIBS)
9712 dnl ===================================================================
9713 dnl How should we build the linear programming solver ?
9714 dnl ===================================================================
9716 ENABLE_COINMP=
9717 AC_MSG_CHECKING([whether to build with CoinMP])
9718 if test "$enable_coinmp" != "no"; then
9719     ENABLE_COINMP=TRUE
9720     AC_MSG_RESULT([yes])
9721     if test "$with_system_coinmp" = "yes"; then
9722         SYSTEM_COINMP=TRUE
9723         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9724         FilterLibs "${COINMP_LIBS}"
9725         COINMP_LIBS="${filteredlibs}"
9726     else
9727         BUILD_TYPE="$BUILD_TYPE COINMP"
9728     fi
9729 else
9730     AC_MSG_RESULT([no])
9732 AC_SUBST(ENABLE_COINMP)
9733 AC_SUBST(SYSTEM_COINMP)
9734 AC_SUBST(COINMP_CFLAGS)
9735 AC_SUBST(COINMP_LIBS)
9737 ENABLE_LPSOLVE=
9738 AC_MSG_CHECKING([whether to build with lpsolve])
9739 if test "$enable_lpsolve" != "no"; then
9740     ENABLE_LPSOLVE=TRUE
9741     AC_MSG_RESULT([yes])
9742 else
9743     AC_MSG_RESULT([no])
9745 AC_SUBST(ENABLE_LPSOLVE)
9747 if test "$ENABLE_LPSOLVE" = TRUE; then
9748     AC_MSG_CHECKING([which lpsolve to use])
9749     if test "$with_system_lpsolve" = "yes"; then
9750         AC_MSG_RESULT([external])
9751         SYSTEM_LPSOLVE=TRUE
9752         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9753            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9754         save_LIBS=$LIBS
9755         # some systems need this. Like Ubuntu....
9756         AC_CHECK_LIB(m, floor)
9757         AC_CHECK_LIB(dl, dlopen)
9758         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9759             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9760         LIBS=$save_LIBS
9761         libo_MINGW_CHECK_DLL([lpsolve55])
9762     else
9763         AC_MSG_RESULT([internal])
9764         SYSTEM_LPSOLVE=
9765         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9766     fi
9768 AC_SUBST(SYSTEM_LPSOLVE)
9770 dnl ===================================================================
9771 dnl Checking for libexttextcat
9772 dnl ===================================================================
9773 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9774 if test "$with_system_libexttextcat" = "yes"; then
9775     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9777 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9779 dnl ***************************************
9780 dnl testing libc version for Linux...
9781 dnl ***************************************
9782 if test "$_os" = "Linux"; then
9783     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9784     exec 6>/dev/null # no output
9785     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9786     exec 6>&1 # output on again
9787     if test "$HAVE_LIBC"; then
9788         AC_MSG_RESULT([yes])
9789     else
9790         AC_MSG_ERROR([no, upgrade libc])
9791     fi
9794 dnl =========================================
9795 dnl Check for the Windows  SDK.
9796 dnl =========================================
9797 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9798 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9799 if test "$_os" = "WINNT"; then
9800     AC_MSG_CHECKING([for Windows SDK])
9801     if test "$build_os" = "cygwin"; then
9802         find_winsdk
9803         WINDOWS_SDK_HOME=$winsdktest
9805         # normalize if found
9806         if test -n "$WINDOWS_SDK_HOME"; then
9807             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9808             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9809         fi
9811         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
9812     fi
9814     if test -n "$WINDOWS_SDK_HOME"; then
9815         # Remove a possible trailing backslash
9816         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9818         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9819              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9820              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9821             have_windows_sdk_headers=yes
9822         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9823              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9824              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9825             have_windows_sdk_headers=yes
9826         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
9827              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
9828              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
9829             have_windows_sdk_headers=yes
9830         else
9831             have_windows_sdk_headers=no
9832         fi
9834         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9835             have_windows_sdk_libs=yes
9836         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9837             have_windows_sdk_libs=yes
9838         else
9839             have_windows_sdk_libs=no
9840         fi
9842         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9843             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9844 the  Windows SDK are installed.])
9845         fi
9847         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9848              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9849              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9850              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9851         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9852              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9853              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9854              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9855         else
9856             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9857         fi
9858     fi
9860     if test -z "$WINDOWS_SDK_HOME"; then
9861         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9862     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
9863         WINDOWS_SDK_VERSION=70
9864         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9865     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9866         WINDOWS_SDK_VERSION=80
9867         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9868         dnl compatibility warning if not explicitly choosing the 80 SDK:
9869         if test -z "$with_windows_sdk"; then
9870             AC_MSG_WARN([If a build should run on Windows XP,])
9871             AC_MSG_WARN([use --with-windows-sdk=7.1A])
9872             add_warning "If a build should run on Windows XP,"
9873             add_warning "use --with-windows-sdk=7.1A"
9874         fi
9875     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
9876         WINDOWS_SDK_VERSION=81
9877         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
9878     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
9879         WINDOWS_SDK_VERSION=10
9880         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
9881     else
9882         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9883     fi
9884     PathFormat "$WINDOWS_SDK_HOME"
9885     WINDOWS_SDK_HOME="$formatted_path"
9886     if test "$build_os" = "cygwin"; then
9887         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9888         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9889             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9890         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
9891             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
9892         fi
9893     fi
9895     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9896     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9897     dnl but not in v8.0), so allow this to be overridden with a
9898     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9899     dnl and configuration error if no WiLangId.vbs is found would arguably be
9900     dnl better, but I do not know under which conditions exactly it is needed by
9901     dnl msiglobal.pm:
9902     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9903         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9904         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9905             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9906         fi
9907         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9908             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9909         fi
9910         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9911             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9912             add_warning "WiLangId.vbs not found - building translated packages will fail"
9913         fi
9914     fi
9916 AC_SUBST(WINDOWS_SDK_HOME)
9917 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
9918 AC_SUBST(WINDOWS_SDK_VERSION)
9919 AC_SUBST(WINDOWS_SDK_WILANGID)
9921 dnl =========================================
9922 dnl Check for uuidgen
9923 dnl =========================================
9924 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9925     if test "$WITH_MINGW" = "yes"; then
9926         AC_PATH_PROG([UUIDGEN], [uuid])
9927         if test -z "$UUIDGEN"; then
9928             AC_MSG_WARN([uuid is needed for building installation sets])
9929         fi
9930     else
9931         # presence is already tested above in the WINDOWS_SDK_HOME check
9932         UUIDGEN=uuidgen.exe
9933         AC_SUBST(UUIDGEN)
9934     fi
9935 else
9936     AC_PATH_PROG([UUIDGEN], [uuidgen])
9937     if test -z "$UUIDGEN"; then
9938         AC_MSG_WARN([uuid is needed for building installation sets])
9939     fi
9942 dnl ***************************************
9943 dnl Checking for bison and flex
9944 dnl ***************************************
9945 AC_PATH_PROG(BISON, bison)
9946 if test -z "$BISON"; then
9947     AC_MSG_ERROR([no bison found in \$PATH, install it])
9948 else
9949     AC_MSG_CHECKING([the bison version])
9950     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9951     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9952     # Accept newer than 2.0
9953     if test "$_bison_longver" -lt 2000; then
9954         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9955     fi
9958 AC_PATH_PROG(FLEX, flex)
9959 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9960     FLEX=`cygpath -m $FLEX`
9962 if test -z "$FLEX"; then
9963     AC_MSG_ERROR([no flex found in \$PATH, install it])
9964 else
9965     AC_MSG_CHECKING([the flex version])
9966     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9967     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9968         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9969     fi
9971 AC_SUBST([FLEX])
9972 dnl ***************************************
9973 dnl Checking for patch
9974 dnl ***************************************
9975 AC_PATH_PROG(PATCH, patch)
9976 if test -z "$PATCH"; then
9977     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9980 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9981 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9982     if test -z "$with_gnu_patch"; then
9983         GNUPATCH=$PATCH
9984     else
9985         if test -x "$with_gnu_patch"; then
9986             GNUPATCH=$with_gnu_patch
9987         else
9988             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9989         fi
9990     fi
9992     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9993     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9994         AC_MSG_RESULT([yes])
9995     else
9996         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9997     fi
9998 else
9999     GNUPATCH=$PATCH
10002 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10003     GNUPATCH=`cygpath -m $GNUPATCH`
10006 dnl We also need to check for --with-gnu-cp
10008 if test -z "$with_gnu_cp"; then
10009     # check the place where the good stuff is hidden on Solaris...
10010     if test -x /usr/gnu/bin/cp; then
10011         GNUCP=/usr/gnu/bin/cp
10012     else
10013         AC_PATH_PROGS(GNUCP, gnucp cp)
10014     fi
10015     if test -z $GNUCP; then
10016         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10017     fi
10018 else
10019     if test -x "$with_gnu_cp"; then
10020         GNUCP=$with_gnu_cp
10021     else
10022         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10023     fi
10026 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10027     GNUCP=`cygpath -m $GNUCP`
10030 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10031 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10032     AC_MSG_RESULT([yes])
10033 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10034     AC_MSG_RESULT([yes])
10035 else
10036     case "$build_os" in
10037     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10038         x_GNUCP=[\#]
10039         GNUCP=''
10040         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10041         ;;
10042     *)
10043         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10044         ;;
10045     esac
10048 AC_SUBST(GNUPATCH)
10049 AC_SUBST(GNUCP)
10050 AC_SUBST(x_GNUCP)
10052 dnl ***************************************
10053 dnl testing assembler path
10054 dnl ***************************************
10055 ML_EXE=""
10056 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
10057     if test "$BITNESS_OVERRIDE" = ""; then
10058         assembler=ml.exe
10059         assembler_bin=bin
10060     else
10061         if test "$vcexpress" = "Express"; then
10062             assembler=ml64.exe
10063             assembler_bin=bin/x86_amd64
10064         else
10065             assembler=ml64.exe
10066             assembler_bin=bin/amd64
10067         fi
10068     fi
10070     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
10071     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
10072         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
10073         AC_MSG_RESULT([found])
10074         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
10075     else
10076         AC_MSG_ERROR([Configure did not find $assembler assembler.])
10077     fi
10079     PathFormat "$ASM_HOME"
10080     ASM_HOME="$formatted_path"
10081 else
10082     ASM_HOME=""
10085 AC_SUBST(ML_EXE)
10087 dnl ===================================================================
10088 dnl We need zip and unzip
10089 dnl ===================================================================
10090 AC_PATH_PROG(ZIP, zip)
10091 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10092 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10093     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],,)
10096 AC_PATH_PROG(UNZIP, unzip)
10097 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10099 dnl ===================================================================
10100 dnl Zip must be a specific type for different build types.
10101 dnl ===================================================================
10102 if test $build_os = cygwin; then
10103     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10104         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10105     fi
10108 dnl ===================================================================
10109 dnl We need touch with -h option support.
10110 dnl ===================================================================
10111 AC_PATH_PROG(TOUCH, touch)
10112 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10113 touch warn
10114 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10115     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],,)
10118 dnl ===================================================================
10119 dnl Set vcl option: coordinate device in double or sal_Int32
10120 dnl ===================================================================
10122 dnl disabled for now, we don't want subtle differences between OSs
10123 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10124 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10125 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10126 dnl     AC_MSG_RESULT([double])
10127 dnl else
10128 dnl     AC_MSG_RESULT([sal_Int32])
10129 dnl fi
10131 dnl ===================================================================
10132 dnl Test which vclplugs have to be built.
10133 dnl ===================================================================
10134 R=""
10135 if test "$USING_X11" != TRUE; then
10136     enable_gtk=no
10137     enable_gtk3=no
10139 GTK3_CFLAGS=""
10140 GTK3_LIBS=""
10141 ENABLE_GTK3=""
10142 if test "x$enable_gtk3" = "xyes"; then
10143     if test "$with_system_cairo" = no; then
10144         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10145     fi
10146     : ${with_system_cairo:=yes}
10147     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="")
10148     if test "x$ENABLE_GTK3" = "xTRUE"; then
10149         R="gtk3"
10150         dnl Avoid installed by unpackaged files for now.
10151         if test -z "$PKGFORMAT"; then
10152             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10153         fi
10154     else
10155         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10156     fi
10157     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10158     FilterLibs "${GTK3_LIBS}"
10159     GTK3_LIBS="${filteredlibs}"
10161 AC_SUBST(GTK3_LIBS)
10162 AC_SUBST(GTK3_CFLAGS)
10163 AC_SUBST(ENABLE_GTK3)
10165 ENABLE_GTK=""
10166 if test "x$enable_gtk" = "xyes"; then
10167     if test "$with_system_cairo" = no; then
10168         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10169     fi
10170     : ${with_system_cairo:=yes}
10171     ENABLE_GTK="TRUE"
10172     AC_DEFINE(ENABLE_GTK)
10173     R="gtk $R"
10175 AC_SUBST(ENABLE_GTK)
10177 ENABLE_TDE=""
10178 if test "x$enable_tde" = "xyes"; then
10179     ENABLE_TDE="TRUE"
10180     AC_DEFINE(ENABLE_TDE)
10181     R="$R tde"
10183 AC_SUBST(ENABLE_TDE)
10185 ENABLE_KDE4=""
10186 if test "x$enable_kde4" = "xyes"; then
10187     ENABLE_KDE4="TRUE"
10188     AC_DEFINE(ENABLE_KDE4)
10189     R="$R kde4"
10191 AC_SUBST(ENABLE_KDE4)
10194 build_vcl_plugins="$R"
10195 if test -z "$build_vcl_plugins"; then
10196     build_vcl_plugins="none"
10198 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10200 dnl ===================================================================
10201 dnl check for dbus support
10202 dnl ===================================================================
10203 ENABLE_DBUS=""
10204 DBUS_CFLAGS=""
10205 DBUS_LIBS=""
10207 if test "$enable_dbus" = "no"; then
10208     test_dbus=no
10211 AC_MSG_CHECKING([whether to enable DBUS support])
10212 if test "$test_dbus" = "yes"; then
10213     ENABLE_DBUS="TRUE"
10214     AC_MSG_RESULT([yes])
10215     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10216     AC_DEFINE(ENABLE_DBUS)
10217     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10218     FilterLibs "${DBUS_LIBS}"
10219     DBUS_LIBS="${filteredlibs}"
10220 else
10221     AC_MSG_RESULT([no])
10224 AC_SUBST(ENABLE_DBUS)
10225 AC_SUBST(DBUS_CFLAGS)
10226 AC_SUBST(DBUS_LIBS)
10228 AC_MSG_CHECKING([whether to enable Impress remote control])
10229 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10230     AC_MSG_RESULT([yes])
10231     ENABLE_SDREMOTE=TRUE
10232     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10234     # If not explicitly enabled or disabled, default
10235     if test -z "$enable_sdremote_bluetooth"; then
10236         case "$OS" in
10237         LINUX|MACOSX|WNT)
10238             # Default to yes for these
10239             enable_sdremote_bluetooth=yes
10240             ;;
10241         *)
10242             # otherwise no
10243             enable_sdremote_bluetooth=no
10244             ;;
10245         esac
10246     fi
10247     # $enable_sdremote_bluetooth is guaranteed non-empty now
10249     if test "$enable_sdremote_bluetooth" != "no"; then
10250         if test "$OS" = "LINUX"; then
10251             if test "$ENABLE_DBUS" = "TRUE"; then
10252                 AC_MSG_RESULT([yes])
10253                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10254                 dnl ===================================================================
10255                 dnl Check for system bluez
10256                 dnl ===================================================================
10257                 AC_MSG_CHECKING([which Bluetooth header to use])
10258                 if test "$with_system_bluez" = "yes"; then
10259                     AC_MSG_RESULT([external])
10260                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10261                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10262                     SYSTEM_BLUEZ=TRUE
10263                 else
10264                     AC_MSG_RESULT([internal])
10265                     SYSTEM_BLUEZ=
10266                 fi
10267             else
10268                 AC_MSG_RESULT([no, dbus disabled])
10269                 ENABLE_SDREMOTE_BLUETOOTH=
10270                 SYSTEM_BLUEZ=
10271             fi
10272         else
10273             AC_MSG_RESULT([yes])
10274             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10275             SYSTEM_BLUEZ=
10276         fi
10277     else
10278         AC_MSG_RESULT([no])
10279         ENABLE_SDREMOTE_BLUETOOTH=
10280         SYSTEM_BLUEZ=
10281     fi
10282 else
10283     ENABLE_SDREMOTE=
10284     SYSTEM_BLUEZ=
10285     AC_MSG_RESULT([no])
10287 AC_SUBST(ENABLE_SDREMOTE)
10288 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10289 AC_SUBST(SYSTEM_BLUEZ)
10291 dnl ===================================================================
10292 dnl Check whether the gtk 2.0 libraries are available.
10293 dnl ===================================================================
10295 GTK_CFLAGS=""
10296 GTK_LIBS=""
10297 ENABLE_SYSTRAY_GTK=""
10298 if test  "$test_gtk" = "yes"; then
10300     if test "$ENABLE_GTK" = "TRUE"; then
10301         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]))
10302         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10303         FilterLibs "${GTK_LIBS}"
10304         GTK_LIBS="${filteredlibs}"
10305         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]))
10306         BUILD_TYPE="$BUILD_TYPE GTK"
10307         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10308         FilterLibs "${GTHREAD_LIBS}"
10309         GTHREAD_LIBS="${filteredlibs}"
10311         if test "x$enable_systray" = "xyes"; then
10312             ENABLE_SYSTRAY_GTK="TRUE"
10313         fi
10315         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10316         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10317                           [ENABLE_GTK_PRINT="TRUE"],
10318                           [ENABLE_GTK_PRINT=""])
10319         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10320         FilterLibs "${GTK_PRINT_LIBS}"
10321         GTK_PRINT_LIBS="${filteredlibs}"
10323         AC_MSG_CHECKING([whether to enable GIO support])
10324         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10325             dnl Need at least 2.26 for the dbus support.
10326             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10327                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10328             if test "$ENABLE_GIO" = "TRUE"; then
10329                 AC_DEFINE(ENABLE_GIO)
10330                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10331                 FilterLibs "${GIO_LIBS}"
10332                 GIO_LIBS="${filteredlibs}"
10333             fi
10334         else
10335             AC_MSG_RESULT([no])
10336         fi
10337     fi
10339 AC_SUBST(ENABLE_GIO)
10340 AC_SUBST(GIO_CFLAGS)
10341 AC_SUBST(GIO_LIBS)
10342 AC_SUBST(ENABLE_SYSTRAY_GTK)
10343 AC_SUBST(GTK_CFLAGS)
10344 AC_SUBST(GTK_LIBS)
10345 AC_SUBST(GTHREAD_CFLAGS)
10346 AC_SUBST(GTHREAD_LIBS)
10347 AC_SUBST([ENABLE_GTK_PRINT])
10348 AC_SUBST([GTK_PRINT_CFLAGS])
10349 AC_SUBST([GTK_PRINT_LIBS])
10352 dnl ===================================================================
10353 dnl Check whether the Telepathy libraries are available.
10354 dnl ===================================================================
10356 ENABLE_TELEPATHY=""
10357 TELEPATHY_CFLAGS=""
10358 TELEPATHY_LIBS=""
10360 AC_MSG_CHECKING([whether to enable Telepathy support])
10361 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10362     ENABLE_TELEPATHY="TRUE"
10363     AC_DEFINE(ENABLE_TELEPATHY)
10364     AC_MSG_RESULT([yes])
10365     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 )
10366     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10367     FilterLibs "${TELEPATHY_LIBS}"
10368     TELEPATHY_LIBS="${filteredlibs}"
10369 else
10370     AC_MSG_RESULT([no])
10373 AC_SUBST(ENABLE_TELEPATHY)
10374 AC_SUBST(TELEPATHY_CFLAGS)
10375 AC_SUBST(TELEPATHY_LIBS)
10378 dnl ===================================================================
10380 SPLIT_APP_MODULES=""
10381 if test "$enable_split_app_modules" = "yes"; then
10382     SPLIT_APP_MODULES="TRUE"
10384 AC_SUBST(SPLIT_APP_MODULES)
10386 SPLIT_OPT_FEATURES=""
10387 if test "$enable_split_opt_features" = "yes"; then
10388     SPLIT_OPT_FEATURES="TRUE"
10390 AC_SUBST(SPLIT_OPT_FEATURES)
10392 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10393     if test "$enable_cairo_canvas" = yes; then
10394         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10395     fi
10396     enable_cairo_canvas=no
10397 elif test -z "$enable_cairo_canvas"; then
10398     enable_cairo_canvas=yes
10401 ENABLE_CAIRO_CANVAS=""
10402 if test "$enable_cairo_canvas" = "yes"; then
10403     test_cairo=yes
10404     ENABLE_CAIRO_CANVAS="TRUE"
10405     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10407 AC_SUBST(ENABLE_CAIRO_CANVAS)
10409 dnl ===================================================================
10410 dnl Check whether the GStreamer libraries are available.
10411 dnl It's possible to build avmedia with both GStreamer backends!
10412 dnl ===================================================================
10414 ENABLE_GSTREAMER_1_0=""
10416 if test "$build_gstreamer_1_0" = "yes"; then
10418     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10419     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10420         ENABLE_GSTREAMER_1_0="TRUE"
10421         AC_MSG_RESULT([yes])
10422         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10423         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10424         FilterLibs "${GSTREAMER_1_0_LIBS}"
10425         GSTREAMER_1_0_LIBS="${filteredlibs}"
10426     else
10427         AC_MSG_RESULT([no])
10428     fi
10430 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10431 AC_SUBST(GSTREAMER_1_0_LIBS)
10432 AC_SUBST(ENABLE_GSTREAMER_1_0)
10435 ENABLE_GSTREAMER_0_10=""
10436 if test "$build_gstreamer_0_10" = "yes"; then
10438     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10439     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10440         ENABLE_GSTREAMER_0_10="TRUE"
10441         AC_MSG_RESULT([yes])
10442         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10443             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10444         ])
10445         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10446         FilterLibs "${GSTREAMER_0_10_LIBS}"
10447         GSTREAMER_0_10_LIBS="${filteredlibs}"
10448     else
10449         AC_MSG_RESULT([no])
10450     fi
10453 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10454 AC_SUBST(GSTREAMER_0_10_LIBS)
10455 AC_SUBST(ENABLE_GSTREAMER_0_10)
10457 dnl ===================================================================
10458 dnl Check whether to build the VLC avmedia backend
10459 dnl ===================================================================
10461 ENABLE_VLC=""
10463 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10464 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10465     ENABLE_VLC="TRUE"
10466     AC_MSG_RESULT([yes])
10467 else
10468     AC_MSG_RESULT([no])
10470 AC_SUBST(ENABLE_VLC)
10472 ENABLE_OPENGL_TRANSITIONS=
10473 ENABLE_OPENGL_CANVAS=
10474 if test $_os = iOS -o $_os = Android; then
10475    : # disable
10476 elif test "$_os" = "Darwin"; then
10477     # We use frameworks on Mac OS X, no need for detail checks
10478     ENABLE_OPENGL_TRANSITIONS=TRUE
10479     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10480     ENABLE_OPENGL_CANVAS=TRUE
10481 elif test $_os = WINNT; then
10482     ENABLE_OPENGL_TRANSITIONS=TRUE
10483     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10484     ENABLE_OPENGL_CANVAS=TRUE
10485 else
10486     if test "$USING_X11" = TRUE; then
10487         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10488         ENABLE_OPENGL_TRANSITIONS=TRUE
10489         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10490         ENABLE_OPENGL_CANVAS=TRUE
10491     fi
10494 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10495 AC_SUBST(ENABLE_OPENGL_CANVAS)
10497 dnl =================================================
10498 dnl Check whether to build with OpenCL support.
10499 dnl =================================================
10501 if test $_os != iOS -a $_os != Android; then
10502     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10503     # platform (optional at run-time, used through clew).
10504     BUILD_TYPE="$BUILD_TYPE OPENCL"
10505     AC_DEFINE(HAVE_FEATURE_OPENCL)
10508 dnl ===================================================================
10509 dnl Check whether to enable glTF support
10510 dnl ===================================================================
10511 AC_MSG_CHECKING([whether to enable glTF support])
10512 ENABLE_GLTF=
10513 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android -a "$ENABLE_HEADLESS" = ""; then
10514     ENABLE_GLTF=TRUE
10515     AC_MSG_RESULT([yes])
10516     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10517     if test "$with_system_libgltf" = "yes"; then
10518         SYSTEM_LIBGLTF=TRUE
10519         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10520         FilterLibs "${LIBGLTF_LIBS}"
10521         LIBGLTF_LIBS="${filteredlibs}"
10522     else
10523         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10524     fi
10525 else
10526     AC_MSG_RESULT([no])
10528 AC_SUBST(ENABLE_GLTF)
10529 AC_SUBST(SYSTEM_LIBGLTF)
10530 AC_SUBST(LIBGLTF_CFLAGS)
10531 AC_SUBST(LIBGLTF_LIBS)
10533 dnl ===================================================================
10534 dnl Check whether to enable COLLADA support
10535 dnl ===================================================================
10536 AC_MSG_CHECKING([whether to enable COLLADA support])
10537 ENABLE_COLLADA=
10538 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10539     AC_MSG_RESULT([yes])
10540     ENABLE_COLLADA=TRUE
10541     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10543     AC_MSG_CHECKING([which OPENCOLLADA to use])
10544     if test "$with_system_opencollada" = "yes"; then
10545         AC_MSG_RESULT([external])
10546         SYSTEM_OPENCOLLADA=TRUE
10547         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10548         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10549         AC_LANG_PUSH([C++])
10550         save_CXXFLAGS=$CXXFLAGS
10551         save_CPPFLAGS=$CPPFLAGS
10552         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10553         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10554         AC_CHECK_HEADERS(
10555                 COLLADABU.h \
10556                 COLLADAFW.h \
10557                 COLLADASaxFWLLoader.h \
10558                 GeneratedSaxParser.h,
10559             [],
10560             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10561             [])
10562         CXXFLAGS=$save_CXXFLAGS
10563         CPPFLAGS=$save_CPPFLAGS
10564         AC_LANG_POP([C++])
10565         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10566         FilterLibs "${OPENCOLLADA_LIBS}"
10567         OPENCOLLADA_LIBS="${filteredlibs}"
10568     else
10569         AC_MSG_RESULT([internal])
10570         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10571     fi
10573     AC_MSG_CHECKING([which collada2gltf to use])
10574     if test "$with_system_collada2gltf" = "yes"; then
10575         if test "$with_system_opencollada" = "no"; then
10576             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10577         fi
10578         AC_MSG_RESULT([external])
10579         SYSTEM_COLLADA2GLTF=TRUE
10580         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10581         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10582         AC_LANG_PUSH([C++])
10583         save_CXXFLAGS=$CXXFLAGS
10584         save_CPPFLAGS=$CPPFLAGS
10585         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10586         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10587         AC_CHECK_HEADERS(
10588                 GLTF.h \
10589                 encodingHelpers.h,
10590             [],
10591             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10592             [])
10593         CXXFLAGS=$save_CXXFLAGS
10594         CPPFLAGS=$save_CPPFLAGS
10595         AC_LANG_POP([C++])
10596         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10597         FilterLibs "${COLLADA2GLTF_LIBS}"
10598         COLLADA2GLTF_LIBS="${filteredlibs}"
10599     else
10600         AC_MSG_RESULT([internal])
10601         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10602     fi
10603 else
10604     AC_MSG_RESULT([no])
10606 AC_SUBST(ENABLE_COLLADA)
10607 AC_SUBST([OPENCOLLADA_CFLAGS])
10608 AC_SUBST([OPENCOLLADA_LIBS])
10609 AC_SUBST([SYSTEM_OPENCOLLADA])
10611 AC_SUBST([COLLADA2GLTF_CFLAGS])
10612 AC_SUBST([COLLADA2GLTF_LIBS])
10613 AC_SUBST([SYSTEM_COLLADA2GLTF])
10615 if test "$enable_dconf" != no; then
10616     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10617         if test "$enable_dconf" = yes; then
10618             AC_MSG_ERROR([dconf not found])
10619         else
10620             enable_dconf=no
10621         fi])
10623 AC_MSG_CHECKING([whether to enable dconf])
10624 if test "$enable_dconf" = no; then
10625     DCONF_CFLAGS=
10626     DCONF_LIBS=
10627     ENABLE_DCONF=
10628     AC_MSG_RESULT([no])
10629 else
10630     ENABLE_DCONF=TRUE
10631     AC_DEFINE(ENABLE_DCONF)
10632     AC_MSG_RESULT([yes])
10634 AC_SUBST([DCONF_CFLAGS])
10635 AC_SUBST([DCONF_LIBS])
10636 AC_SUBST([ENABLE_DCONF])
10638 # pdf import?
10639 AC_MSG_CHECKING([whether to build the PDF import feature])
10640 ENABLE_PDFIMPORT=
10641 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10642     AC_MSG_RESULT([yes])
10643     ENABLE_PDFIMPORT=TRUE
10644     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10646     dnl ===================================================================
10647     dnl Check for system poppler
10648     dnl ===================================================================
10649     AC_MSG_CHECKING([which PDF import backend to use])
10650     if test "$with_system_poppler" = "yes"; then
10651         AC_MSG_RESULT([external])
10652         SYSTEM_POPPLER=TRUE
10653         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10654         AC_LANG_PUSH([C++])
10655         save_CXXFLAGS=$CXXFLAGS
10656         save_CPPFLAGS=$CPPFLAGS
10657         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10658         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10659         AC_CHECK_HEADER([cpp/poppler-version.h],
10660             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10661             [])
10662         CXXFLAGS=$save_CXXFLAGS
10663         CPPFLAGS=$save_CPPFLAGS
10664         AC_LANG_POP([C++])
10665         libo_MINGW_CHECK_DLL([libpoppler])
10666         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10668         FilterLibs "${POPPLER_LIBS}"
10669         POPPLER_LIBS="${filteredlibs}"
10670     else
10671         AC_MSG_RESULT([internal])
10672         SYSTEM_POPPLER=
10673         BUILD_TYPE="$BUILD_TYPE POPPLER"
10674         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10675     fi
10676     AC_DEFINE([ENABLE_PDFIMPORT],1)
10677 else
10678     AC_MSG_RESULT([no])
10680 AC_SUBST(ENABLE_PDFIMPORT)
10681 AC_SUBST(SYSTEM_POPPLER)
10682 AC_SUBST(POPPLER_CFLAGS)
10683 AC_SUBST(POPPLER_LIBS)
10685 # pdf import?
10686 AC_MSG_CHECKING([whether to build PDFium])
10687 ENABLE_PDFIUM=
10688 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10689     AC_MSG_RESULT([yes])
10690     ENABLE_PDFIUM=TRUE
10691     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10692     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10693 else
10694     AC_MSG_RESULT([no])
10696 AC_SUBST(ENABLE_PDFIUM)
10698 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10699 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10700     AC_MSG_RESULT([yes])
10701     ENABLE_MEDIAWIKI=TRUE
10702     BUILD_TYPE="$BUILD_TYPE XSLTML"
10703     if test  "x$with_java" = "xno"; then
10704         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10705     fi
10706 else
10707     AC_MSG_RESULT([no])
10708     ENABLE_MEDIAWIKI=
10709     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10711 AC_SUBST(ENABLE_MEDIAWIKI)
10713 AC_MSG_CHECKING([whether to build the Report Builder])
10714 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10715     AC_MSG_RESULT([yes])
10716     ENABLE_REPORTBUILDER=TRUE
10717     AC_MSG_CHECKING([which jfreereport libs to use])
10718     if test "$with_system_jfreereport" = "yes"; then
10719         SYSTEM_JFREEREPORT=TRUE
10720         AC_MSG_RESULT([external])
10721         if test -z $SAC_JAR; then
10722             SAC_JAR=/usr/share/java/sac.jar
10723         fi
10724         if ! test -f $SAC_JAR; then
10725              AC_MSG_ERROR(sac.jar not found.)
10726         fi
10728         if test -z $LIBXML_JAR; then
10729             if test -f /usr/share/java/libxml-1.0.0.jar; then
10730                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10731             elif test -f /usr/share/java/libxml.jar; then
10732                 LIBXML_JAR=/usr/share/java/libxml.jar
10733             else
10734                 AC_MSG_ERROR(libxml.jar replacement not found.)
10735             fi
10736         elif ! test -f $LIBXML_JAR; then
10737             AC_MSG_ERROR(libxml.jar not found.)
10738         fi
10740         if test -z $FLUTE_JAR; then
10741             if test -f/usr/share/java/flute-1.3.0.jar; then
10742                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10743             elif test -f /usr/share/java/flute.jar; then
10744                 FLUTE_JAR=/usr/share/java/flute.jar
10745             else
10746                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10747             fi
10748         elif ! test -f $FLUTE_JAR; then
10749             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10750         fi
10752         if test -z $JFREEREPORT_JAR; then
10753             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10754                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10755             elif test -f /usr/share/java/flow-engine.jar; then
10756                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10757             else
10758                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10759             fi
10760         elif ! test -f  $JFREEREPORT_JAR; then
10761                 AC_MSG_ERROR(jfreereport.jar not found.)
10762         fi
10764         if test -z $LIBLAYOUT_JAR; then
10765             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10766                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10767             elif test -f /usr/share/java/liblayout.jar; then
10768                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10769             else
10770                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10771             fi
10772         elif ! test -f $LIBLAYOUT_JAR; then
10773                 AC_MSG_ERROR(liblayout.jar not found.)
10774         fi
10776         if test -z $LIBLOADER_JAR; then
10777             if test -f /usr/share/java/libloader-1.0.0.jar; then
10778                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10779             elif test -f /usr/share/java/libloader.jar; then
10780                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10781             else
10782                 AC_MSG_ERROR(libloader.jar replacement not found.)
10783             fi
10784         elif ! test -f  $LIBLOADER_JAR; then
10785             AC_MSG_ERROR(libloader.jar not found.)
10786         fi
10788         if test -z $LIBFORMULA_JAR; then
10789             if test -f /usr/share/java/libformula-0.2.0.jar; then
10790                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10791             elif test -f /usr/share/java/libformula.jar; then
10792                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10793             else
10794                 AC_MSG_ERROR(libformula.jar replacement not found.)
10795             fi
10796         elif ! test -f $LIBFORMULA_JAR; then
10797                 AC_MSG_ERROR(libformula.jar not found.)
10798         fi
10800         if test -z $LIBREPOSITORY_JAR; then
10801             if test -f /usr/share/java/librepository-1.0.0.jar; then
10802                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10803             elif test -f /usr/share/java/librepository.jar; then
10804                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10805             else
10806                 AC_MSG_ERROR(librepository.jar replacement not found.)
10807             fi
10808         elif ! test -f $LIBREPOSITORY_JAR; then
10809             AC_MSG_ERROR(librepository.jar not found.)
10810         fi
10812         if test -z $LIBFONTS_JAR; then
10813             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10814                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10815             elif test -f /usr/share/java/libfonts.jar; then
10816                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10817             else
10818                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10819             fi
10820         elif ! test -f $LIBFONTS_JAR; then
10821                 AC_MSG_ERROR(libfonts.jar not found.)
10822         fi
10824         if test -z $LIBSERIALIZER_JAR; then
10825             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10826                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10827             elif test -f /usr/share/java/libserializer.jar; then
10828                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10829             else
10830                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10831             fi
10832         elif ! test -f $LIBSERIALIZER_JAR; then
10833                 AC_MSG_ERROR(libserializer.jar not found.)
10834         fi
10836         if test -z $LIBBASE_JAR; then
10837             if test -f /usr/share/java/libbase-1.0.0.jar; then
10838                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10839             elif test -f /usr/share/java/libbase.jar; then
10840                 LIBBASE_JAR=/usr/share/java/libbase.jar
10841             else
10842                 AC_MSG_ERROR(libbase.jar replacement not found.)
10843             fi
10844         elif ! test -f $LIBBASE_JAR; then
10845             AC_MSG_ERROR(libbase.jar not found.)
10846         fi
10848     else
10849         AC_MSG_RESULT([internal])
10850         SYSTEM_JFREEREPORT=
10851         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10852     fi
10853 else
10854     AC_MSG_RESULT([no])
10855     ENABLE_REPORTBUILDER=
10856     SYSTEM_JFREEREPORT=
10858 AC_SUBST(ENABLE_REPORTBUILDER)
10859 AC_SUBST(SYSTEM_JFREEREPORT)
10860 AC_SUBST(SAC_JAR)
10861 AC_SUBST(LIBXML_JAR)
10862 AC_SUBST(FLUTE_JAR)
10863 AC_SUBST(JFREEREPORT_JAR)
10864 AC_SUBST(LIBBASE_JAR)
10865 AC_SUBST(LIBLAYOUT_JAR)
10866 AC_SUBST(LIBLOADER_JAR)
10867 AC_SUBST(LIBFORMULA_JAR)
10868 AC_SUBST(LIBREPOSITORY_JAR)
10869 AC_SUBST(LIBFONTS_JAR)
10870 AC_SUBST(LIBSERIALIZER_JAR)
10872 # this has to be here because both the Wiki Publisher and the SRB use
10873 # commons-logging
10874 COMMONS_LOGGING_VERSION=1.2
10875 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10876     AC_MSG_CHECKING([which Apache commons-* libs to use])
10877     if test "$with_system_apache_commons" = "yes"; then
10878         SYSTEM_APACHE_COMMONS=TRUE
10879         AC_MSG_RESULT([external])
10880         if test -z $COMMONS_LOGGING_JAR; then
10881             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10882                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10883            elif test -f /usr/share/java/commons-logging.jar; then
10884                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10885             else
10886                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10887             fi
10888         elif ! test -f $COMMONS_LOGGING_JAR; then
10889             AC_MSG_ERROR(commons-logging.jar not found.)
10890         fi
10891     else
10892         AC_MSG_RESULT([internal])
10893         SYSTEM_APACHE_COMMONS=
10894         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10895     fi
10897 AC_SUBST(SYSTEM_APACHE_COMMONS)
10898 AC_SUBST(COMMONS_LOGGING_JAR)
10899 AC_SUBST(COMMONS_LOGGING_VERSION)
10901 # scripting provider for BeanShell?
10902 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10903 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10904     AC_MSG_RESULT([yes])
10905     ENABLE_SCRIPTING_BEANSHELL=TRUE
10907     dnl ===================================================================
10908     dnl Check for system beanshell
10909     dnl ===================================================================
10910     AC_MSG_CHECKING([which beanshell to use])
10911     if test "$with_system_beanshell" = "yes"; then
10912         AC_MSG_RESULT([external])
10913         SYSTEM_BSH=TRUE
10914         if test -z $BSH_JAR; then
10915             BSH_JAR=/usr/share/java/bsh.jar
10916         fi
10917         if ! test -f $BSH_JAR; then
10918             AC_MSG_ERROR(bsh.jar not found.)
10919         fi
10920     else
10921         AC_MSG_RESULT([internal])
10922         SYSTEM_BSH=
10923         BUILD_TYPE="$BUILD_TYPE BSH"
10924     fi
10925 else
10926     AC_MSG_RESULT([no])
10927     ENABLE_SCRIPTING_BEANSHELL=
10928     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10930 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10931 AC_SUBST(SYSTEM_BSH)
10932 AC_SUBST(BSH_JAR)
10934 # scripting provider for JavaScript?
10935 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10936 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10937     AC_MSG_RESULT([yes])
10938     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10940     dnl ===================================================================
10941     dnl Check for system rhino
10942     dnl ===================================================================
10943     AC_MSG_CHECKING([which rhino to use])
10944     if test "$with_system_rhino" = "yes"; then
10945         AC_MSG_RESULT([external])
10946         SYSTEM_RHINO=TRUE
10947         if test -z $RHINO_JAR; then
10948             RHINO_JAR=/usr/share/java/js.jar
10949         fi
10950         if ! test -f $RHINO_JAR; then
10951             AC_MSG_ERROR(js.jar not found.)
10952         fi
10953     else
10954         AC_MSG_RESULT([internal])
10955         SYSTEM_RHINO=
10956         BUILD_TYPE="$BUILD_TYPE RHINO"
10957     fi
10958 else
10959     AC_MSG_RESULT([no])
10960     ENABLE_SCRIPTING_JAVASCRIPT=
10961     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10963 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10964 AC_SUBST(SYSTEM_RHINO)
10965 AC_SUBST(RHINO_JAR)
10967 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10968 # paths should be added to library search path. So lets put all 64-bit
10969 # platforms there.
10970 supports_multilib=
10971 case "$host_cpu" in
10972 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10973     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10974         supports_multilib="yes"
10975     fi
10976     ;;
10978     ;;
10979 esac
10981 dnl ===================================================================
10982 dnl Check whether the TQt and TDE libraries are available.
10983 dnl ===================================================================
10985 TDE_CFLAGS=""
10986 TDE_LIBS=""
10987 if test "$_os" != "OpenBSD"; then
10988     TDE_MOC="moc"
10990 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10991     dnl Search paths for TQt and TDE
10992     if test -z "$supports_multilib"; then
10993         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"
10994         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"
10995     else
10996         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"
10997         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"
10998     fi
10999     if test -n "$TQTDIR"; then
11000         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
11001         if test -z "$supports_multilib"; then
11002             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
11003         else
11004             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
11005         fi
11006     fi
11007     if test -z "$supports_multilib"; then
11008         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"
11009         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"
11010     else
11011         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"
11012         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"
11013     fi
11014     if test -n "$TDEDIR"; then
11015         tde_incdirs="$TDEDIR/include $tde_incdirs"
11016         if test -z "$supports_multilib"; then
11017             tde_libdirs="$TDEDIR/lib $tde_libdirs"
11018         else
11019             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
11020         fi
11021     fi
11023     dnl What to test
11024     tqt_test_include="ntqstyle.h"
11025     tde_test_include="kapp.h"
11027     if test "$_os" != "OpenBSD"; then
11028         tqt_test_library="libtqt-mt.so"
11029         tde_test_library="libDCOP.so"
11030     else
11031         tqt_test_library="libtqt-mt.so*"
11032         tde_test_library="libDCOP.so*"
11033     fi
11035     dnl Check for TQt headers
11036     AC_MSG_CHECKING([for TQt headers])
11037     tqt_incdir="no"
11038     for tde_check in $tqt_incdirs; do
11039         if test -r "$tde_check/$tqt_test_include"; then
11040             tqt_incdir="$tde_check"
11041             break
11042         fi
11043     done
11044     AC_MSG_RESULT([$tqt_incdir])
11045     if test "x$tqt_incdir" = "xno"; then
11046         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
11047 your TQt installation by exporting TQTDIR before running "configure".])
11048     fi
11050     dnl Check for TQt libraries
11051     AC_MSG_CHECKING([for TQt libraries])
11052     tqt_libdir="no"
11053     for tqt_check in $tqt_libdirs; do
11054         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
11055             tqt_libdir="$tqt_check"
11056             break
11057         fi
11058     done
11059     AC_MSG_RESULT([$tqt_libdir])
11060     if test "x$tqt_libdir" = "xno"; then
11061         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
11062 your TQt installation by exporting TQTDIR before running "configure".])
11063     fi
11065     dnl Check for Meta Object Compiler
11066     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
11067     if test "$MOC" = "no"; then
11068         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
11069 the root of your TQt installation by exporting TQTDIR before running "configure".])
11070     fi
11072     dnl Check for TDE headers
11073     AC_MSG_CHECKING([for TDE headers])
11074     tde_incdir="no"
11075     for tde_check in $tde_incdirs; do
11076         if test -r "$tde_check/$tde_test_include"; then
11077             tde_incdir="$tde_check"
11078             break
11079         fi
11080     done
11081     AC_MSG_RESULT([$tde_incdir])
11082     if test "x$tde_incdir" = "xno"; then
11083         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
11084 your TDE installation by exporting TDEDIR before running "configure".])
11085     fi
11087     dnl Check for TDE libraries
11088     AC_MSG_CHECKING([for TDE libraries])
11089     tde_libdir="no"
11090     for tde_check in $tde_libdirs; do
11091         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
11092             tde_libdir="$tde_check"
11093             break
11094         fi
11095     done
11096     AC_MSG_RESULT([$tde_libdir])
11097     if test "x$tde_libdir" = "xno"; then
11098         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
11099 your TDE installation by exporting TDEDIR before running "configure".])
11100     fi
11102     dnl Set the variables
11103     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11104     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
11106 AC_SUBST(TDE_CFLAGS)
11107 AC_SUBST(TDE_LIBS)
11108 AC_SUBST(TDE_MOC)
11110 dnl ===================================================================
11111 dnl KDE4 Integration
11112 dnl ===================================================================
11114 KDE4_CFLAGS=""
11115 KDE4_LIBS=""
11116 QMAKE4="qmake"
11117 MOC4="moc"
11118 KDE4_GLIB_CFLAGS=""
11119 KDE4_GLIB_LIBS=""
11120 KDE4_HAVE_GLIB=""
11121 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11122     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11123     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11125     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
11126     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11128     if test -n "$supports_multilib"; then
11129         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11130         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11131     fi
11133     if test -n "$QTDIR"; then
11134         qt4_incdirs="$QTDIR/include $qt4_incdirs"
11135         if test -z "$supports_multilib"; then
11136             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
11137         else
11138             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
11139         fi
11140     fi
11141     if test -n "$QT4DIR"; then
11142         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
11143         if test -z "$supports_multilib"; then
11144             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
11145         else
11146             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
11147         fi
11148     fi
11150     if test -n "$KDEDIR"; then
11151         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
11152         if test -z "$supports_multilib"; then
11153             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
11154         else
11155             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
11156         fi
11157     fi
11158     if test -n "$KDE4DIR"; then
11159         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
11160         if test -z "$supports_multilib"; then
11161             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
11162         else
11163             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
11164         fi
11165     fi
11167     qt4_test_include="Qt/qobject.h"
11168     qt4_test_library="libQtNetwork.so"
11169     kde4_test_include="kwindowsystem.h"
11170     kde4_test_library="libsolid.so"
11172     AC_MSG_CHECKING([for Qt4 headers])
11173     qt4_header_dir="no"
11174     for inc_dir in $qt4_incdirs; do
11175         if test -r "$inc_dir/$qt4_test_include"; then
11176             qt4_header_dir="$inc_dir"
11177             break
11178         fi
11179     done
11181     AC_MSG_RESULT([$qt4_header_dir])
11182     if test "x$qt4_header_dir" = "xno"; then
11183         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11184     fi
11186     dnl Check for qmake
11187     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
11188     QMAKE4="$QMAKEQT4"
11189     if test "$QMAKE4" = "no"; then
11190         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
11191         if test "$QMAKE4" = "no"; then
11192             AC_MSG_ERROR([Qmake not found.  Please specify
11193 the root of your Qt installation by exporting QT4DIR before running "configure".])
11194         fi
11195     fi
11197     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
11198     AC_MSG_CHECKING([for Qt4 libraries])
11199     qt4_lib_dir="no"
11200     for lib_dir in $qt4_libdirs; do
11201         if test -r "$lib_dir/$qt4_test_library"; then
11202             qt4_lib_dir="$lib_dir"
11203             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11204             break
11205         fi
11206     done
11208     AC_MSG_RESULT([$qt4_lib_dir])
11210     if test "x$qt4_lib_dir" = "xno"; then
11211         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11212     fi
11214     dnl Check for Meta Object Compiler
11216     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11217     MOC4="$MOCQT4"
11218     if test "$MOC4" = "no"; then
11219         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11220         if test "$MOC4" = "no"; then
11221             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11222 the root of your Qt installation by exporting QT4DIR before running "configure".])
11223         fi
11224     fi
11226     dnl Check for KDE4 headers
11227     AC_MSG_CHECKING([for KDE4 headers])
11228     kde4_incdir="no"
11229     for kde4_check in $kde4_incdirs; do
11230         if test -r "$kde4_check/$kde4_test_include"; then
11231             kde4_incdir="$kde4_check"
11232             break
11233         fi
11234     done
11235     AC_MSG_RESULT([$kde4_incdir])
11236     if test "x$kde4_incdir" = "xno"; then
11237         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11238     fi
11239     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
11241     dnl Check for KDE4 libraries
11242     AC_MSG_CHECKING([for KDE4 libraries])
11243     kde4_libdir="no"
11244     for kde4_check in $kde4_libdirs; do
11245         if test -r "$kde4_check/$kde4_test_library"; then
11246             kde4_libdir="$kde4_check"
11247             break
11248         fi
11249     done
11251     AC_MSG_RESULT([$kde4_libdir])
11252     if test "x$kde4_libdir" = "xno"; then
11253         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11254     fi
11256     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11257     if ! test -z "$kde4_incdir"; then
11258         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11259     else
11260         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11261     fi
11263     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11264     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11265     FilterLibs "$KDE4_LIBS"
11266     KDE4_LIBS="$filteredlibs"
11268     AC_LANG_PUSH([C++])
11269     save_CXXFLAGS=$CXXFLAGS
11270     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11271     AC_MSG_CHECKING([whether KDE is >= 4.2])
11272        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11273 #include <kdeversion.h>
11275 int main(int argc, char **argv) {
11276        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11277        else return 1;
11279 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11280     CXXFLAGS=$save_CXXFLAGS
11281     AC_LANG_POP([C++])
11283     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11284     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11285     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11286         [
11287             KDE4_HAVE_GLIB=1
11288             AC_DEFINE(KDE4_HAVE_GLIB,1)
11289             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11290             FilterLibs "${KDE4_GLIB_LIBS}"
11291             KDE4_GLIB_LIBS="${filteredlibs}"
11293             qt4_fix_warning=
11295             AC_LANG_PUSH([C++])
11296             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11297             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11298             #  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
11299             #               ^~~~~~~~~~~~~~~~~~~~~~~
11300             #               vptr for 'QObjectPrivate'
11301             save_CXX=$CXX
11302             CXX=$(printf %s "$CXX" \
11303                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11304             save_CXXFLAGS=$CXXFLAGS
11305             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11306             save_LIBS=$LIBS
11307             LIBS="$LIBS $KDE4_LIBS"
11308             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11310             # Prepare meta object data
11311             TSTBASE="tst_exclude_socket_notifiers"
11312             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11313             ln -fs "${TSTMOC}.hxx"
11314             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11316             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11317 #include <cstdlib>
11318 #include "tst_exclude_socket_notifiers.moc"
11320 int main(int argc, char *argv[])
11322     QCoreApplication app(argc, argv);
11323     exit(tst_processEventsExcludeSocket());
11324     return 0;
11326             ]])],[
11327                 AC_MSG_RESULT([yes])
11328             ],[
11329                 AC_MSG_RESULT([no])
11330                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11331                 if test -z "$qt4_fix_warning"; then
11332                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11333                 fi
11334                 qt4_fix_warning=1
11335                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11336                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11338             # Remove meta object data
11339             rm -f "${TSTBASE}."*
11341             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11343             # Prepare meta object data
11344             TSTBASE="tst_exclude_posted_events"
11345             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11346             ln -fs "${TSTMOC}.hxx"
11347             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11349             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11350 #include <cstdlib>
11351 #include "tst_exclude_posted_events.moc"
11353 int main(int argc, char *argv[])
11355     QCoreApplication app(argc, argv);
11356     exit(tst_excludePostedEvents());
11357     return 0;
11359             ]])],[
11360                 AC_MSG_RESULT([yes])
11361             ],[
11362                 AC_MSG_RESULT([no])
11363                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11364                 if test -z "$qt4_fix_warning"; then
11365                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11366                 fi
11367                 qt4_fix_warning=1
11368                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11369             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11371             # Remove meta object data
11372             rm -f "${TSTBASE}."*
11374             if test -n "$qt4_fix_warning"; then
11375                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11376             fi
11378             LIBS=$save_LIBS
11379             CXXFLAGS=$save_CXXFLAGS
11380             CXX=$save_CXX
11381             AC_LANG_POP([C++])
11382         ],
11383         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11385 AC_SUBST(KDE4_CFLAGS)
11386 AC_SUBST(KDE4_LIBS)
11387 AC_SUBST(MOC4)
11388 AC_SUBST(KDE4_GLIB_CFLAGS)
11389 AC_SUBST(KDE4_GLIB_LIBS)
11390 AC_SUBST(KDE4_HAVE_GLIB)
11392 dnl ===================================================================
11393 dnl Test whether to include Evolution 2 support
11394 dnl ===================================================================
11395 AC_MSG_CHECKING([whether to enable evolution 2 support])
11396 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11397     AC_MSG_RESULT([yes])
11398     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11399     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11400     FilterLibs "${GOBJECT_LIBS}"
11401     GOBJECT_LIBS="${filteredlibs}"
11402     ENABLE_EVOAB2="TRUE"
11403 else
11404     ENABLE_EVOAB2=""
11405     AC_MSG_RESULT([no])
11407 AC_SUBST(ENABLE_EVOAB2)
11408 AC_SUBST(GOBJECT_CFLAGS)
11409 AC_SUBST(GOBJECT_LIBS)
11411 dnl ===================================================================
11412 dnl Test whether to include TDE AB support
11413 dnl ===================================================================
11414 AC_MSG_CHECKING([whether to enable TDE address book support])
11415 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11416     AC_MSG_RESULT([yes])
11417     AC_LANG_PUSH([C++])
11418     save_CXXFLAGS=$CXXFLAGS
11419     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11420     AC_MSG_CHECKING([whether TDE is at least R14.0])
11421        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11422 #include <tdeversion.h>
11424 int main(int argc, char **argv) {
11425        if (TDE_VERSION_MAJOR >= 14) return 0;
11426        else return 1;
11428        ]])],[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])],
11429        [AC_MSG_ERROR([TDE support not tested with cross compilation])])
11430     CXXFLAGS=$save_CXXFLAGS
11431     AC_LANG_POP([C++])
11432     ENABLE_TDEAB=TRUE
11433 else
11434     AC_MSG_RESULT([no])
11435     ENABLE_TDEAB=
11437 AC_SUBST(ENABLE_TDEAB)
11439 dnl ===================================================================
11440 dnl Test which themes to include
11441 dnl ===================================================================
11442 AC_MSG_CHECKING([which themes to include])
11443 # if none given use default subset of available themes
11444 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11445     with_theme="breeze breeze_dark galaxy hicontrast oxygen sifr tango"
11446     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11449 WITH_THEMES=""
11450 if test "x$with_theme" != "xno"; then
11451     for theme in $with_theme; do
11452         case $theme in
11453         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|tango|tango_testing) real_theme="$theme" ;;
11454         default) real_theme=galaxy ;;
11455         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11456         esac
11457         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11458     done
11460 AC_MSG_RESULT([$WITH_THEMES])
11461 AC_SUBST([WITH_THEMES])
11462 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11463 for theme in $with_theme; do
11464     case $theme in
11465     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11466     *) ;;
11467     esac
11468 done
11470 dnl ===================================================================
11471 dnl Test whether to integrate helppacks into the product's installer
11472 dnl ===================================================================
11473 AC_MSG_CHECKING([for helppack integration])
11474 if test "$with_helppack_integration" = "no"; then
11475     WITH_HELPPACK_INTEGRATION=
11476     AC_MSG_RESULT([no integration])
11477 else
11478     WITH_HELPPACK_INTEGRATION=TRUE
11479     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11480     AC_MSG_RESULT([integration])
11482 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11484 ###############################################################################
11485 # Extensions checking
11486 ###############################################################################
11487 AC_MSG_CHECKING([for extensions integration])
11488 if test "x$enable_extension_integration" != "xno"; then
11489     WITH_EXTENSION_INTEGRATION=TRUE
11490     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11491     AC_MSG_RESULT([yes, use integration])
11492 else
11493     WITH_EXTENSION_INTEGRATION=
11494     AC_MSG_RESULT([no, do not integrate])
11496 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11498 dnl Should any extra extensions be included?
11499 dnl There are standalone tests for each of these below.
11500 WITH_EXTRA_EXTENSIONS=
11501 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11503 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11504 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11505 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11506 if test "x$with_java" != "xno"; then
11507     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11508     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11511 TEST_FONTS_MISSING=0
11513 # $1  = font family
11514 # $2+ = accepted font mappings
11515 test_font_map()
11517     FONT="$1" ; shift
11518     AC_MSG_CHECKING([font mapping for '$FONT'])
11519     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11520     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11522     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11523     while test "$#" -ge 1 ; do
11524         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11525         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11526     done
11527     if test $TESTEXPR
11528     then
11529         AC_MSG_RESULT([ok])
11530     else
11531         AC_MSG_RESULT([unknown ($FONTFILE)])
11532         TEST_FONTS_MISSING=1
11533     fi
11536 dnl ===================================================================
11537 dnl Test whether to include fonts
11538 dnl ===================================================================
11539 AC_MSG_CHECKING([whether to include third-party fonts])
11540 if test "$with_fonts" != "no"; then
11541     AC_MSG_RESULT([yes])
11542     WITH_FONTS=TRUE
11543     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11544 else
11545     AC_MSG_RESULT([no])
11546     WITH_FONTS=
11547     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11548     if test "$test_fontconfig" = "yes"; then
11549         AC_PATH_PROG([FCMATCH], [fc-match])
11550         if test -z "$FCMATCH"; then
11551             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11552             TEST_FONTS_MISSING=1
11553         else
11554             test_font_map 'Calibri' 'Carlito'
11555             if test ${TEST_FONTS_MISSING} -eq 1
11556             then
11557                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11558             fi
11559         fi
11560     else
11561         TEST_FONTS_MISSING=0
11562     fi
11564 AC_SUBST(WITH_FONTS)
11565 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11567 dnl Test whether to include Google Noto fonts
11568 dnl ===================================================================
11569 AC_MSG_CHECKING([whether to include Google Noto fonts])
11570 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11571     AC_MSG_RESULT([no])
11572     WITH_NOTO_FONT=
11573 else
11574     AC_MSG_RESULT([yes])
11575     WITH_NOTO_FONT=TRUE
11576     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11577     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11579 AC_SUBST(WITH_NOTO_FONT)
11581 dnl ===================================================================
11583 dnl ===================================================================
11584 dnl Test whether to enable online update service
11585 dnl ===================================================================
11586 AC_MSG_CHECKING([whether to enable online update])
11587 ENABLE_ONLINE_UPDATE=
11588 ENABLE_ONLINE_UPDATE_MAR=
11589 if test "$enable_online_update" = ""; then
11590     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11591         AC_MSG_RESULT([yes])
11592         ENABLE_ONLINE_UPDATE="TRUE"
11593     else
11594         AC_MSG_RESULT([no])
11595     fi
11596 else
11597     if test "$enable_online_update" = "mar"; then
11598         AC_MSG_RESULT([yes - MAR-based online update])
11599         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11600     elif test "$enable_online_update" = "yes"; then
11601         AC_MSG_RESULT([yes])
11602         ENABLE_ONLINE_UPDATE="TRUE"
11603     else
11604         AC_MSG_RESULT([no])
11605     fi
11607 AC_SUBST(ENABLE_ONLINE_UPDATE)
11608 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11610 dnl ===================================================================
11611 dnl Test whether we need bzip2
11612 dnl ===================================================================
11613 SYSTEM_BZIP2=
11614 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11615     AC_MSG_CHECKING([whether to use system bzip2])
11616     if test "$with_system_bzip2" = yes; then
11617         SYSTEM_BZIP2=TRUE
11618         AC_MSG_RESULT([yes])
11619         PKG_CHECK_MODULES(BZIP2, bzip2)
11620         FilterLibs "${BZIP2_LIBS}"
11621         BZIP2_LIBS="${filteredlibs}"
11622     else
11623         AC_MSG_RESULT([no])
11624         BUILD_TYPE="$BUILD_TYPE BZIP2"
11625     fi
11627 AC_SUBST(SYSTEM_BZIP2)
11628 AC_SUBST(BZIP2_CFLAGS)
11629 AC_SUBST(BZIP2_LIBS)
11631 dnl ===================================================================
11632 dnl Test whether to enable extension update
11633 dnl ===================================================================
11634 AC_MSG_CHECKING([whether to enable extension update])
11635 ENABLE_EXTENSION_UPDATE=
11636 if test "x$enable_extension_update" = "xno"; then
11637     AC_MSG_RESULT([no])
11638 else
11639     AC_MSG_RESULT([yes])
11640     ENABLE_EXTENSION_UPDATE="TRUE"
11641     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11642     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11644 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11647 dnl ===================================================================
11648 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11649 dnl ===================================================================
11650 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11651 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11652     AC_MSG_RESULT([no])
11653     ENABLE_SILENT_MSI=
11654 else
11655     AC_MSG_RESULT([yes])
11656     ENABLE_SILENT_MSI=TRUE
11657     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11659 AC_SUBST(ENABLE_SILENT_MSI)
11661 AC_MSG_CHECKING([whether and how to use Xinerama])
11662 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11663     if test "$x_libraries" = "default_x_libraries"; then
11664         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11665         if test "x$XINERAMALIB" = x; then
11666            XINERAMALIB="/usr/lib"
11667         fi
11668     else
11669         XINERAMALIB="$x_libraries"
11670     fi
11671     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11672         # we have both versions, let the user decide but use the dynamic one
11673         # per default
11674         USE_XINERAMA=TRUE
11675         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11676             XINERAMA_LINK=dynamic
11677         else
11678             XINERAMA_LINK=static
11679         fi
11680     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11681         # we have only the dynamic version
11682         USE_XINERAMA=TRUE
11683         XINERAMA_LINK=dynamic
11684     elif test -e "$XINERAMALIB/libXinerama.a"; then
11685         # static version
11686         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11687             USE_XINERAMA=TRUE
11688             XINERAMA_LINK=static
11689         else
11690             USE_XINERAMA=
11691             XINERAMA_LINK=none
11692         fi
11693     else
11694         # no Xinerama
11695         USE_XINERAMA=
11696         XINERAMA_LINK=none
11697     fi
11698     if test "$USE_XINERAMA" = "TRUE"; then
11699         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11700         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11701             [AC_MSG_ERROR(Xinerama header not found.)], [])
11702         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11703         if test "x$XEXTLIB" = x; then
11704            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11705         fi
11706         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11707         if test "$_os" = "FreeBSD"; then
11708             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11709         fi
11710         if test "$_os" = "Linux"; then
11711             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11712         fi
11713         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11714             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11715     else
11716         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11717     fi
11718 else
11719     USE_XINERAMA=
11720     XINERAMA_LINK=none
11721     AC_MSG_RESULT([no])
11723 AC_SUBST(USE_XINERAMA)
11724 AC_SUBST(XINERAMA_LINK)
11726 dnl ===================================================================
11727 dnl Test whether to build cairo or rely on the system version
11728 dnl ===================================================================
11730 if test "$USING_X11" = TRUE; then
11731     # Used in vcl/Library_vclplug_gen.mk
11732     test_cairo=yes
11735 if test "$test_cairo" = "yes"; then
11736     AC_MSG_CHECKING([whether to use the system cairo])
11738     : ${with_system_cairo:=$with_system_libs}
11739     if test "$with_system_cairo" = "yes"; then
11740         SYSTEM_CAIRO=TRUE
11741         AC_MSG_RESULT([yes])
11743         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11744         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11745         FilterLibs "${CAIRO_LIBS}"
11746         CAIRO_LIBS="${filteredlibs}"
11748         if test "$test_xrender" = "yes"; then
11749             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11750             AC_LANG_PUSH([C])
11751             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11752 #ifdef PictStandardA8
11753 #else
11754       return fail;
11755 #endif
11756 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11758             AC_LANG_POP([C])
11759         fi
11760         libo_MINGW_CHECK_DLL([libcairo])
11761         libo_MINGW_TRY_DLL([libfontconfig])
11762         libo_MINGW_TRY_DLL([libfreetype])
11763         libo_MINGW_TRY_DLL([libpixman])
11764         libo_MINGW_TRY_DLL([libpng15])
11765     else
11766         SYSTEM_CAIRO=
11767         AC_MSG_RESULT([no])
11769         BUILD_TYPE="$BUILD_TYPE CAIRO"
11770     fi
11773 AC_SUBST(SYSTEM_CAIRO)
11774 AC_SUBST(CAIRO_CFLAGS)
11775 AC_SUBST(CAIRO_LIBS)
11777 dnl ===================================================================
11778 dnl Test whether to use avahi
11779 dnl ===================================================================
11780 if test "$_os" = "WINNT"; then
11781     # Windows uses bundled mDNSResponder
11782     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11783 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11784     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11785                       [ENABLE_AVAHI="TRUE"])
11786     AC_DEFINE(HAVE_FEATURE_AVAHI)
11787     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11788     FilterLibs "${AVAHI_LIBS}"
11789     AVAHI_LIBS="${filteredlibs}"
11792 AC_SUBST(ENABLE_AVAHI)
11793 AC_SUBST(AVAHI_CFLAGS)
11794 AC_SUBST(AVAHI_LIBS)
11796 dnl ===================================================================
11797 dnl Test whether to use liblangtag
11798 dnl ===================================================================
11799 ENABLE_LIBLANGTAG=
11800 SYSTEM_LIBLANGTAG=
11801 AC_MSG_CHECKING([whether to use liblangtag])
11802 if test "$enable_liblangtag" = "yes" -o \
11803         \( "$enable_liblangtag" = "" -a $_os != Emscripten \); then
11804     ENABLE_LIBLANGTAG=TRUE
11805     AC_MSG_RESULT([yes])
11806     AC_MSG_CHECKING([whether to use system liblangtag])
11807     if test "$with_system_liblangtag" = yes; then
11808         SYSTEM_LIBLANGTAG=TRUE
11809         AC_MSG_RESULT([yes])
11810         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11811         dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11812         PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11813         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11814         FilterLibs "${LIBLANGTAG_LIBS}"
11815         LIBLANGTAG_LIBS="${filteredlibs}"
11816         libo_MINGW_CHECK_DLL([liblangtag])
11817     else
11818         SYSTEM_LIBLANGTAG=
11819         AC_MSG_RESULT([no])
11820         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11821         LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/langtag"
11822         if test "$COM" = "MSC"; then
11823             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11824         else
11825             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11826         fi
11827     fi
11828     AC_DEFINE(ENABLE_LIBLANGTAG)
11829 else
11830     AC_MSG_RESULT([no])
11832 AC_SUBST(ENABLE_LIBLANGTAG)
11833 AC_SUBST(SYSTEM_LIBLANGTAG)
11834 AC_SUBST(LIBLANGTAG_CFLAGS)
11835 AC_SUBST(LIBLANGTAG_LIBS)
11837 dnl ===================================================================
11838 dnl Test whether to build libpng or rely on the system version
11839 dnl ===================================================================
11841 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11843 dnl ===================================================================
11844 dnl Check for runtime JVM search path
11845 dnl ===================================================================
11846 if test "$ENABLE_JAVA" != ""; then
11847     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11848     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11849         AC_MSG_RESULT([yes])
11850         if ! test -d "$with_jvm_path"; then
11851             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11852         fi
11853         if ! test -d "$with_jvm_path"jvm; then
11854             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11855         fi
11856         JVM_ONE_PATH_CHECK="$with_jvm_path"
11857         AC_SUBST(JVM_ONE_PATH_CHECK)
11858     else
11859         AC_MSG_RESULT([no])
11860     fi
11863 dnl ===================================================================
11864 dnl Test for the presence of Ant and that it works
11865 dnl ===================================================================
11867 if test "$ENABLE_JAVA" != ""; then
11868     ANT_HOME=; export ANT_HOME
11869     WITH_ANT_HOME=; export WITH_ANT_HOME
11870     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11871         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11872             if test "$_os" = "WINNT"; then
11873                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11874             else
11875                 with_ant_home="$LODE_HOME/opt/ant"
11876             fi
11877         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11878             with_ant_home="$LODE_HOME/opt/ant"
11879         fi
11880     fi
11881     if test -z "$with_ant_home"; then
11882         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11883     else
11884         if test "$_os" = "WINNT"; then
11885             # AC_PATH_PROGS needs unix path
11886             with_ant_home=`cygpath -u "$with_ant_home"`
11887         fi
11888         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11889         WITH_ANT_HOME=$with_ant_home
11890         ANT_HOME=$with_ant_home
11891     fi
11893     if test -z "$ANT"; then
11894         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11895     else
11896         # resolve relative or absolute symlink
11897         while test -h "$ANT"; do
11898             a_cwd=`pwd`
11899             a_basename=`basename "$ANT"`
11900             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11901             cd "`dirname "$ANT"`"
11902             cd "`dirname "$a_script"`"
11903             ANT="`pwd`"/"`basename "$a_script"`"
11904             cd "$a_cwd"
11905         done
11907         AC_MSG_CHECKING([if $ANT works])
11908         cat > conftest.java << EOF
11909         public class conftest {
11910             int testmethod(int a, int b) {
11911                     return a + b;
11912             }
11913         }
11916         cat > conftest.xml << EOF
11917         <project name="conftest" default="conftest">
11918         <target name="conftest">
11919             <javac srcdir="." includes="conftest.java">
11920             </javac>
11921         </target>
11922         </project>
11925         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11926         if test $? = 0 -a -f ./conftest.class; then
11927             AC_MSG_RESULT([Ant works])
11928             if test -z "$WITH_ANT_HOME"; then
11929                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11930                 if test -z "$ANT_HOME"; then
11931                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11932                 fi
11933             else
11934                 ANT_HOME="$WITH_ANT_HOME"
11935             fi
11936         else
11937             echo "configure: Ant test failed" >&5
11938             cat conftest.java >&5
11939             cat conftest.xml >&5
11940             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11941         fi
11942         rm -f conftest* core core.* *.core
11943     fi
11944     if test -z "$ANT_HOME"; then
11945         ANT_HOME="NO_ANT_HOME"
11946     else
11947         PathFormat "$ANT_HOME"
11948         ANT_HOME="$formatted_path"
11949         PathFormat "$ANT"
11950         ANT="$formatted_path"
11951     fi
11952     AC_SUBST(ANT_HOME)
11953     AC_SUBST(ANT)
11955     dnl Checking for ant.jar
11956     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11957         AC_MSG_CHECKING([Ant lib directory])
11958         if test -f $ANT_HOME/lib/ant.jar; then
11959             ANT_LIB="$ANT_HOME/lib"
11960         else
11961             if test -f $ANT_HOME/ant.jar; then
11962                 ANT_LIB="$ANT_HOME"
11963             else
11964                 if test -f /usr/share/java/ant.jar; then
11965                     ANT_LIB=/usr/share/java
11966                 else
11967                     if test -f /usr/share/ant-core/lib/ant.jar; then
11968                         ANT_LIB=/usr/share/ant-core/lib
11969                     else
11970                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11971                             ANT_LIB="$ANT_HOME/lib/ant"
11972                         else
11973                             if test -f /usr/share/lib/ant/ant.jar; then
11974                                 ANT_LIB=/usr/share/lib/ant
11975                             else
11976                                 AC_MSG_ERROR([Ant libraries not found!])
11977                             fi
11978                         fi
11979                     fi
11980                 fi
11981             fi
11982         fi
11983         PathFormat "$ANT_LIB"
11984         ANT_LIB="$formatted_path"
11985         AC_MSG_RESULT([Ant lib directory found.])
11986     fi
11987     AC_SUBST(ANT_LIB)
11989     ant_minver=1.6.0
11990     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11992     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11993     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11994     ant_version_major=`echo $ant_version | cut -d. -f1`
11995     ant_version_minor=`echo $ant_version | cut -d. -f2`
11996     echo "configure: ant_version $ant_version " >&5
11997     echo "configure: ant_version_major $ant_version_major " >&5
11998     echo "configure: ant_version_minor $ant_version_minor " >&5
11999     if test "$ant_version_major" -ge "2"; then
12000         AC_MSG_RESULT([yes, $ant_version])
12001     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12002         AC_MSG_RESULT([yes, $ant_version])
12003     else
12004         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12005     fi
12007     rm -f conftest* core core.* *.core
12010 OOO_JUNIT_JAR=
12011 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12012     AC_MSG_CHECKING([for JUnit 4])
12013     if test "$with_junit" = "yes"; then
12014         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12015             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12016         elif test -e /usr/share/java/junit4.jar; then
12017             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12018         else
12019            if test -e /usr/share/lib/java/junit.jar; then
12020               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12021            else
12022               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12023            fi
12024         fi
12025     else
12026         OOO_JUNIT_JAR=$with_junit
12027     fi
12028     if test "$_os" = "WINNT"; then
12029         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12030     fi
12031     printf 'import org.junit.Before;' > conftest.java
12032     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12033         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12034     else
12035         AC_MSG_ERROR(
12036 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12037  specify its pathname via --with-junit=..., or disable it via --without-junit])
12038     fi
12039     rm -f conftest.class conftest.java
12040     if test $OOO_JUNIT_JAR != ""; then
12041     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12042     fi
12044 AC_SUBST(OOO_JUNIT_JAR)
12046 HAMCREST_JAR=
12047 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12048     AC_MSG_CHECKING([for included Hamcrest])
12049     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12050     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12051         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12052     else
12053         AC_MSG_RESULT([Not included])
12054         AC_MSG_CHECKING([for standalone hamcrest jar.])
12055         if test "$with_hamcrest" = "yes"; then
12056             if test -e /usr/share/lib/java/hamcrest.jar; then
12057                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12058             elif test -e /usr/share/java/hamcrest/core.jar; then
12059                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12060             else
12061                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12062             fi
12063         else
12064             HAMCREST_JAR=$with_hamcrest
12065         fi
12066         if test "$_os" = "WINNT"; then
12067             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12068         fi
12069         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12070             AC_MSG_RESULT([$HAMCREST_JAR])
12071         else
12072             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),
12073                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12074         fi
12075     fi
12076     rm -f conftest.class conftest.java
12078 AC_SUBST(HAMCREST_JAR)
12081 AC_SUBST(SCPDEFS)
12084 # check for wget and curl
12086 WGET=
12087 CURL=
12089 if test "$enable_fetch_external" != "no"; then
12091 CURL=`which curl 2>/dev/null`
12093 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12094     # wget new enough?
12095     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12096     if test $? -eq 0; then
12097         WGET=$i
12098         break
12099     fi
12100 done
12102 if test -z "$WGET" -a -z "$CURL"; then
12103     AC_MSG_ERROR([neither wget nor curl found!])
12108 AC_SUBST(WGET)
12109 AC_SUBST(CURL)
12112 # check for md5sum
12114 MD5SUM=
12116 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12117     if test "$i" = "md5"; then
12118         eval "$i -x" > /dev/null 2>&1
12119     else
12120         eval "$i --version" > /dev/null 2>&1
12121     fi
12122     ret=$?
12123     if test $ret -eq 0; then
12124         MD5SUM=$i
12125         break
12126     fi
12127 done
12129 if test "$MD5SUM" = "md5"; then
12130     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12131         MD5SUM="$MD5SUM -r"
12132     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12133         MD5SUM="$MD5SUM -n"
12134     fi
12137 if test -z "$MD5SUM"; then
12138     AC_MSG_ERROR([no md5sum found!])
12141 AC_SUBST(MD5SUM)
12143 dnl ===================================================================
12144 dnl Dealing with l10n options
12145 dnl ===================================================================
12146 AC_MSG_CHECKING([which languages to be built])
12147 # get list of all languages
12148 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12149 # the sed command does the following:
12150 #   + if a line ends with a backslash, append the next line to it
12151 #   + adds " on the beginning of the value (after =)
12152 #   + adds " at the end of the value
12153 #   + removes en-US; we want to put it on the beginning
12154 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12155 [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)]
12156 ALL_LANGS="en-US $completelangiso"
12157 # check the configured localizations
12158 WITH_LANG="$with_lang"
12159 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12160     AC_MSG_RESULT([en-US])
12161 else
12162     AC_MSG_RESULT([$WITH_LANG])
12163     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12165 # check that the list is valid
12166 for lang in $WITH_LANG; do
12167     test "$lang" = "ALL" && continue
12168     # need to check for the exact string, so add space before and after the list of all languages
12169     for vl in $ALL_LANGS; do
12170         if test "$vl" = "$lang"; then
12171            break
12172         fi
12173     done
12174     if test "$vl" != "$lang"; then
12175         # if you're reading this - you prolly quoted your languages remove the quotes ...
12176         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12177     fi
12178 done
12179 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12180     echo $WITH_LANG | grep -q en-US
12181     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12183 # list with substituted ALL
12184 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12185 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12186 test "$WITH_LANG" = "en-US" && WITH_LANG=
12187 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12188     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12189     ALL_LANGS=`echo $ALL_LANGS qtz`
12191 AC_SUBST(ALL_LANGS)
12192 AC_SUBST(WITH_LANG)
12193 AC_SUBST(WITH_LANG_LIST)
12194 AC_SUBST(GIT_NEEDED_SUBMODULES)
12196 WITH_POOR_HELP_LOCALIZATIONS=
12197 if test -d "$SRC_ROOT/translations/source"; then
12198     for l in `ls -1 $SRC_ROOT/translations/source`; do
12199         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12200             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12201         fi
12202     done
12204 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12206 if test -n "$with_locales"; then
12207     WITH_LOCALES="$with_locales"
12209     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12210     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12211     # config_host/config_locales.h.in
12212     for locale in $WITH_LOCALES; do
12213         lang=${locale%_*}
12215         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12217         case $lang in
12218         hi|mr*ne)
12219             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12220             ;;
12221         bg|ru)
12222             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12223             ;;
12224         esac
12225     done
12226 else
12227     AC_DEFINE(WITH_LOCALE_ALL)
12229 AC_SUBST(WITH_LOCALES)
12231 dnl git submodule update --reference
12232 dnl ===================================================================
12233 if test -n "${GIT_REFERENCE_SRC}"; then
12234     for repo in ${GIT_NEEDED_SUBMODULES}; do
12235         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12236             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12237         fi
12238     done
12240 AC_SUBST(GIT_REFERENCE_SRC)
12242 dnl git submodules linked dirs
12243 dnl ===================================================================
12244 if test -n "${GIT_LINK_SRC}"; then
12245     for repo in ${GIT_NEEDED_SUBMODULES}; do
12246         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12247             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12248         fi
12249     done
12251 AC_SUBST(GIT_LINK_SRC)
12253 dnl branding
12254 dnl ===================================================================
12255 AC_MSG_CHECKING([for alternative branding images directory])
12256 # initialize mapped arrays
12257 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12258 brand_files="$BRAND_INTRO_IMAGES about.svg"
12260 if test -z "$with_branding" -o "$with_branding" = "no"; then
12261     AC_MSG_RESULT([none])
12262     DEFAULT_BRAND_IMAGES="$brand_files"
12263 else
12264     if ! test -d $with_branding ; then
12265         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12266     else
12267         AC_MSG_RESULT([$with_branding])
12268         CUSTOM_BRAND_DIR="$with_branding"
12269         for lfile in $brand_files
12270         do
12271             if ! test -f $with_branding/$lfile ; then
12272                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12273                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12274             else
12275                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12276             fi
12277         done
12278         check_for_progress="yes"
12279     fi
12281 AC_SUBST([BRAND_INTRO_IMAGES])
12282 AC_SUBST([CUSTOM_BRAND_DIR])
12283 AC_SUBST([CUSTOM_BRAND_IMAGES])
12284 AC_SUBST([DEFAULT_BRAND_IMAGES])
12287 AC_MSG_CHECKING([for 'intro' progress settings])
12288 PROGRESSBARCOLOR=
12289 PROGRESSSIZE=
12290 PROGRESSPOSITION=
12291 PROGRESSFRAMECOLOR=
12292 PROGRESSTEXTCOLOR=
12293 PROGRESSTEXTBASELINE=
12295 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12296     source "$with_branding/progress.conf"
12297     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12298 else
12299     AC_MSG_RESULT([none])
12302 AC_SUBST(PROGRESSBARCOLOR)
12303 AC_SUBST(PROGRESSSIZE)
12304 AC_SUBST(PROGRESSPOSITION)
12305 AC_SUBST(PROGRESSFRAMECOLOR)
12306 AC_SUBST(PROGRESSTEXTCOLOR)
12307 AC_SUBST(PROGRESSTEXTBASELINE)
12310 AC_MSG_CHECKING([for extra build ID])
12311 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12312     EXTRA_BUILDID="$with_extra_buildid"
12314 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12315 if test -n "$EXTRA_BUILDID" ; then
12316     AC_MSG_RESULT([$EXTRA_BUILDID])
12317 else
12318     AC_MSG_RESULT([not set])
12320 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12322 OOO_VENDOR=
12323 AC_MSG_CHECKING([for vendor])
12324 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12325     OOO_VENDOR="$USERNAME"
12327     if test -z "$OOO_VENDOR"; then
12328         OOO_VENDOR="$USER"
12329     fi
12331     if test -z "$OOO_VENDOR"; then
12332         OOO_VENDOR="`id -u -n`"
12333     fi
12335     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12336 else
12337     OOO_VENDOR="$with_vendor"
12338     AC_MSG_RESULT([$OOO_VENDOR])
12340 AC_SUBST(OOO_VENDOR)
12342 if echo "$host_os" | grep -q linux-android ; then
12343     ANDROID_PACKAGE_NAME=
12344     AC_MSG_CHECKING([for Android package name])
12345     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12346         if test -n "$ENABLE_DEBUG"; then
12347             # Default to the package name that makes ndk-gdb happy.
12348             ANDROID_PACKAGE_NAME="org.libreoffice"
12349         else
12350             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12351         fi
12353         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12354     else
12355         ANDROID_PACKAGE_NAME="$with_android_package_name"
12356         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12357     fi
12358     AC_SUBST(ANDROID_PACKAGE_NAME)
12361 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12362 if test "$with_compat_oowrappers" = "yes"; then
12363     WITH_COMPAT_OOWRAPPERS=TRUE
12364     AC_MSG_RESULT(yes)
12365 else
12366     WITH_COMPAT_OOWRAPPERS=
12367     AC_MSG_RESULT(no)
12369 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12371 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12372 AC_MSG_CHECKING([for install dirname])
12373 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12374     INSTALLDIRNAME="$with_install_dirname"
12376 AC_MSG_RESULT([$INSTALLDIRNAME])
12377 AC_SUBST(INSTALLDIRNAME)
12379 AC_MSG_CHECKING([for prefix])
12380 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12381 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12382 PREFIXDIR="$prefix"
12383 AC_MSG_RESULT([$PREFIXDIR])
12384 AC_SUBST(PREFIXDIR)
12386 LIBDIR=[$(eval echo $(eval echo $libdir))]
12387 AC_SUBST(LIBDIR)
12389 DATADIR=[$(eval echo $(eval echo $datadir))]
12390 AC_SUBST(DATADIR)
12392 MANDIR=[$(eval echo $(eval echo $mandir))]
12393 AC_SUBST(MANDIR)
12395 DOCDIR=[$(eval echo $(eval echo $docdir))]
12396 AC_SUBST(DOCDIR)
12398 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12399 AC_SUBST(INSTALLDIR)
12401 TESTINSTALLDIR="${BUILDDIR}/test-install"
12402 AC_SUBST(TESTINSTALLDIR)
12405 # ===================================================================
12406 # OAuth2 id and secrets
12407 # ===================================================================
12409 AC_MSG_CHECKING([for Google Drive client id and secret])
12410 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12411 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12412 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12413     GDRIVE_CLIENT_ID="\"\""
12416 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12417     GDRIVE_CLIENT_SECRET="\"\""
12420 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12421     AC_MSG_RESULT([not set])
12422 else
12423     AC_MSG_RESULT([set])
12426 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12427 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12429 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12430 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12431 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12432 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12433     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12436 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12437     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12440 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12441     AC_MSG_RESULT([not set])
12442 else
12443     AC_MSG_RESULT([set])
12445 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12446 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12448 AC_MSG_CHECKING([for OneDrive client id and secret])
12449 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12450 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12451 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12452     ONEDRIVE_CLIENT_ID="\"\""
12455 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12456     ONEDRIVE_CLIENT_SECRET="\"\""
12459 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12460     AC_MSG_RESULT([not set])
12461 else
12462     AC_MSG_RESULT([set])
12464 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12465 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12468 dnl ===================================================================
12469 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12470 dnl --enable-dependency-tracking configure option
12471 dnl ===================================================================
12472 AC_MSG_CHECKING([whether to enable dependency tracking])
12473 if test "$enable_dependency_tracking" = "no"; then
12474     nodep=TRUE
12475     AC_MSG_RESULT([no])
12476 else
12477     AC_MSG_RESULT([yes])
12479 AC_SUBST(nodep)
12481 dnl ===================================================================
12482 dnl Number of CPUs to use during the build
12483 dnl ===================================================================
12484 AC_MSG_CHECKING([for number of processors to use])
12485 # plain --with-parallelism is just the default
12486 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12487     if test "$with_parallelism" = "no"; then
12488         PARALLELISM=0
12489     else
12490         PARALLELISM=$with_parallelism
12491     fi
12492 else
12493     if test "$enable_icecream" = "yes"; then
12494         PARALLELISM="10"
12495     else
12496         case `uname -s` in
12498         Darwin|FreeBSD|NetBSD|OpenBSD)
12499             PARALLELISM=`sysctl -n hw.ncpu`
12500             ;;
12502         Linux)
12503             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12504         ;;
12505         # what else than above does profit here *and* has /proc?
12506         *)
12507             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12508             ;;
12509         esac
12511         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12512         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12513     fi
12516 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12517     if test -z "$with_parallelism"; then
12518             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12519             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12520             PARALLELISM="1"
12521     else
12522         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."
12523     fi
12526 if test $PARALLELISM -eq 0; then
12527     AC_MSG_RESULT([explicit make -j option needed])
12528 else
12529     AC_MSG_RESULT([$PARALLELISM])
12531 AC_SUBST(PARALLELISM)
12533 IWYU_PATH="$with_iwyu"
12534 AC_SUBST(IWYU_PATH)
12535 if test ! -z "$IWYU_PATH"; then
12536     if test ! -f "$IWYU_PATH"; then
12537         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12538     fi
12542 # Set up ILIB for MSVC build
12544 ILIB1=
12545 if test "$build_os" = "cygwin"; then
12546     ILIB="."
12547     if test -n "$JAVA_HOME"; then
12548         ILIB="$ILIB;$JAVA_HOME/lib"
12549     fi
12550     ILIB1=-link
12551     if test "$BITNESS_OVERRIDE" = 64; then
12552         ILIB="$ILIB;$COMPATH/lib/amd64"
12553         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12554         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12555         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12556         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12557             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12558             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12559         fi
12560         if test $VCVER = 140; then
12561             PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12562             ucrtlibpath_formatted=$formatted_path
12563             ILIB="$ILIB;$ucrtlibpath_formatted"
12564         fi
12565     else
12566         ILIB="$ILIB;$COMPATH/lib"
12567         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12568         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12569         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12570         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12571             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12572             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12573         fi
12574         if test $VCVER = 140; then
12575             PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12576             ucrtlibpath_formatted=$formatted_path
12577             ILIB="$ILIB;$ucrtlibpath_formatted"
12578         fi
12579     fi
12580     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12581         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12582     else
12583         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12584     fi
12586     AC_SUBST(ILIB)
12589 AC_MSG_CHECKING(
12590     [whether C++11 use of const_iterator in standard containers is broken])
12591 save_CXXFLAGS=$CXXFLAGS
12592 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12593 AC_LANG_PUSH([C++])
12594 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12595     #include <list>
12596     ]],[[
12597         std::list<int> l;
12598         l.erase(l.cbegin());
12599     ]])],
12600     [broken=no], [broken=yes])
12601 AC_LANG_POP([C++])
12602 LIBS=$save_LIBS
12603 CXXFLAGS=$save_CXXFLAGS
12604 AC_MSG_RESULT([$broken])
12605 if test "$broken" = yes; then
12606     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12610 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12611 save_CXXFLAGS=$CXXFLAGS
12612 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12613 save_LIBS=$LIBS
12614 if test -n "$ILIB1"; then
12615     LIBS="$LIBS $ILIB1"
12617 AC_LANG_PUSH([C++])
12618 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12619     // Exit with failure if the static initializer_list is stored on the
12620     // stack (as done by Clang < 3.4):
12621     #include <initializer_list>
12622     struct S {};
12623     bool g(void const * p1, void const * p2) {
12624         int n;
12625         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12626     }
12627     bool f(void const * p1) {
12628         static std::initializer_list<S> s { S() };
12629         return g(p1, s.begin());
12630     }
12631     ]],[[
12632         int n;
12633         return f(&n) ? 0 : 1;
12634     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12635 AC_LANG_POP([C++])
12636 LIBS=$save_LIBS
12637 CXXFLAGS=$save_CXXFLAGS
12638 AC_MSG_RESULT([$broken])
12639 if test "$broken" = yes; then
12640     AC_DEFINE([HAVE_BROKEN_STATIC_INITIALIZER_LIST])
12644 # ===================================================================
12645 # Creating bigger shared library to link against
12646 # ===================================================================
12647 AC_MSG_CHECKING([whether to create huge library])
12648 MERGELIBS=
12650 if test $_os = iOS -o $_os = Android; then
12651     # Never any point in mergelibs for these as we build just static
12652     # libraries anyway...
12653     enable_mergelibs=no
12656 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12657     if test $_os != Linux -a $_os != WINNT; then
12658         add_warning "--enable-mergelibs is not tested for this platform"
12659     fi
12660     MERGELIBS="TRUE"
12661     AC_MSG_RESULT([yes])
12662 else
12663     AC_MSG_RESULT([no])
12665 AC_SUBST([MERGELIBS])
12667 dnl ===================================================================
12668 dnl icerun is a wrapper that stops us spawning tens of processes
12669 dnl locally - for tools that can't be executed on the compile cluster
12670 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12671 dnl ===================================================================
12672 AC_MSG_CHECKING([whether to use icerun wrapper])
12673 ICECREAM_RUN=
12674 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12675     ICECREAM_RUN=icerun
12676     AC_MSG_RESULT([yes])
12677 else
12678     AC_MSG_RESULT([no])
12680 AC_SUBST(ICECREAM_RUN)
12682 dnl ===================================================================
12683 dnl Setup the ICECC_VERSION for the build the same way it was set for
12684 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12685 dnl ===================================================================
12686 x_ICECC_VERSION=[\#]
12687 if test -n "$ICECC_VERSION" ; then
12688     x_ICECC_VERSION=
12690 AC_SUBST(x_ICECC_VERSION)
12691 AC_SUBST(ICECC_VERSION)
12693 dnl ===================================================================
12695 AC_MSG_CHECKING([MPL subset])
12696 MPL_SUBSET=
12698 if test "$enable_mpl_subset" = "yes"; then
12699     warn_report=false
12700     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12701         warn_report=true
12702     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12703         warn_report=true
12704     fi
12705     if test "$warn_report" = "true"; then
12706         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12707     fi
12708     if test "x$enable_postgresql_sdbc" != "xno"; then
12709         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12710     fi
12711     if test "$enable_lotuswordpro" = "yes"; then
12712         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12713     fi
12714     if test "$WITH_WEBDAV" = "neon"; then
12715         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12716     fi
12717     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12718         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12719     fi
12720     if test -n "$ENABLE_PDFIMPORT"; then
12721         if test "x$SYSTEM_POPPLER" = "x"; then
12722             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12723         fi
12724     fi
12725     # cf. m4/libo_check_extension.m4
12726     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12727         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12728     fi
12729     for theme in $WITH_THEMES; do
12730         case $theme in
12731         crystal|default|hicontrast|oxygen)
12732             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12733         *) : ;;
12734         esac
12735     done
12737     ENABLE_OPENGL_TRANSITIONS=
12739     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12740         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12741     fi
12743     MPL_SUBSET="TRUE"
12744     AC_DEFINE(MPL_HAVE_SUBSET)
12745     AC_MSG_RESULT([only])
12746 else
12747     AC_MSG_RESULT([no restrictions])
12749 AC_SUBST(MPL_SUBSET)
12751 dnl ===================================================================
12753 AC_MSG_CHECKING([formula logger])
12754 ENABLE_FORMULA_LOGGER=
12756 if test "x$enable_formula_logger" = "xyes"; then
12757     AC_MSG_RESULT([yes])
12758     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12759     ENABLE_FORMULA_LOGGER=TRUE
12760 else
12761     AC_MSG_RESULT([no])
12764 AC_SUBST(ENABLE_FORMULA_LOGGER)
12766 dnl ===================================================================
12767 dnl Setting up the environment.
12768 dnl ===================================================================
12769 AC_MSG_NOTICE([setting up the build environment variables...])
12771 AC_SUBST(COMPATH)
12773 if test "$build_os" = "cygwin"; then
12774     if test -d "$COMPATH/atlmfc/lib"; then
12775         ATL_LIB="$COMPATH/atlmfc/lib"
12776         ATL_INCLUDE="$COMPATH/atlmfc/include"
12777     else
12778         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12779         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12780     fi
12781     if test "$BITNESS_OVERRIDE" = 64; then
12782         ATL_LIB="$ATL_LIB/amd64"
12783     fi
12784     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12785     PathFormat "/usr/bin/find.exe"
12786     FIND="$formatted_path"
12787     PathFormat "/usr/bin/sort.exe"
12788     SORT="$formatted_path"
12789     PathFormat "/usr/bin/grep.exe"
12790     WIN_GREP="$formatted_path"
12791     PathFormat "/usr/bin/ls.exe"
12792     WIN_LS="$formatted_path"
12793     PathFormat "/usr/bin/touch.exe"
12794     WIN_TOUCH="$formatted_path"
12795 else
12796     FIND=find
12797     SORT=sort
12800 AC_SUBST(ATL_INCLUDE)
12801 AC_SUBST(ATL_LIB)
12802 AC_SUBST(FIND)
12803 AC_SUBST(SORT)
12804 AC_SUBST(WIN_GREP)
12805 AC_SUBST(WIN_LS)
12806 AC_SUBST(WIN_TOUCH)
12808 AC_SUBST(BUILD_TYPE)
12810 AC_SUBST(SOLARINC)
12812 PathFormat "$PERL"
12813 PERL="$formatted_path"
12814 AC_SUBST(PERL)
12816 if test -n "$TMPDIR"; then
12817     TEMP_DIRECTORY="$TMPDIR"
12818 else
12819     TEMP_DIRECTORY="/tmp"
12821 if test "$build_os" = "cygwin"; then
12822     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12824 AC_SUBST(TEMP_DIRECTORY)
12826 # setup the PATH for the environment
12827 if test -n "$LO_PATH_FOR_BUILD"; then
12828     LO_PATH="$LO_PATH_FOR_BUILD"
12829 else
12830     LO_PATH="$PATH"
12832     case "$host_os" in
12834     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12835         if test "$ENABLE_JAVA" != ""; then
12836             pathmunge "$JAVA_HOME/bin" "after"
12837         fi
12838         ;;
12840     cygwin*)
12841         # Win32 make needs native paths
12842         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12843             LO_PATH=`cygpath -p -m "$PATH"`
12844         fi
12845         if test "$BITNESS_OVERRIDE" = 64; then
12846             # needed for msi packaging
12847             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12848         fi
12849         # .NET 4.6 and higher don't have bin directory
12850         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12851             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12852         fi
12853         pathmunge "$ASM_HOME" "before"
12854         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12855         pathmunge "$CSC_PATH" "before"
12856         pathmunge "$MIDL_PATH" "before"
12857         pathmunge "$AL_PATH" "before"
12858         pathmunge "$MSPDB_PATH" "before"
12859         if test -n "$MSBUILD_PATH" ; then
12860             pathmunge "$MSBUILD_PATH" "before"
12861         fi
12862         if test "$BITNESS_OVERRIDE" = 64; then
12863             if test "$vcexpress" = "Express"; then
12864                 pathmunge "$COMPATH/bin/x86_amd64" "before"
12865                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12866             else
12867                 pathmunge "$COMPATH/bin/amd64" "before"
12868                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12869             fi
12870         else
12871             pathmunge "$COMPATH/bin" "before"
12872             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12873         fi
12874         if test "$ENABLE_JAVA" != ""; then
12875             if test -d "$JAVA_HOME/jre/bin/client"; then
12876                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12877             fi
12878             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12879                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12880             fi
12881             pathmunge "$JAVA_HOME/bin" "before"
12882         fi
12883         ;;
12885     solaris*)
12886         pathmunge "/usr/css/bin" "before"
12887         if test "$ENABLE_JAVA" != ""; then
12888             pathmunge "$JAVA_HOME/bin" "after"
12889         fi
12890         ;;
12891     esac
12894 AC_SUBST(LO_PATH)
12896 # Generate a configuration md5 we can use for deps
12897 if test -f config_host.mk; then
12898     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12900 if test -f config_host_lang.mk; then
12901     config_lang_md5=`$MD5SUM config_host_lang.mk | sed "s/ .*//"`
12904 AC_CONFIG_FILES([config_host.mk
12905                  config_host_lang.mk
12906                  Makefile
12907                  lo.xcent
12908                  bin/bffvalidator.sh
12909                  bin/odfvalidator.sh
12910                  bin/officeotron.sh
12911                  instsetoo_native/util/openoffice.lst
12912                  sysui/desktop/macosx/Info.plist
12913                  ios/lo.xcconfig])
12914 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12915 AC_CONFIG_HEADERS([config_host/config_clang.h])
12916 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12917 AC_CONFIG_HEADERS([config_host/config_eot.h])
12918 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12919 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12920 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12921 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12922 AC_CONFIG_HEADERS([config_host/config_features.h])
12923 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12924 AC_CONFIG_HEADERS([config_host/config_folders.h])
12925 AC_CONFIG_HEADERS([config_host/config_gio.h])
12926 AC_CONFIG_HEADERS([config_host/config_global.h])
12927 AC_CONFIG_HEADERS([config_host/config_java.h])
12928 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12929 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12930 AC_CONFIG_HEADERS([config_host/config_locales.h])
12931 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12932 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12933 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12934 AC_CONFIG_HEADERS([config_host/config_oox.h])
12935 AC_CONFIG_HEADERS([config_host/config_opengl.h])
12936 AC_CONFIG_HEADERS([config_host/config_options.h])
12937 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12938 AC_CONFIG_HEADERS([config_host/config_test.h])
12939 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12940 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12941 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12942 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12943 AC_CONFIG_HEADERS([config_host/config_version.h])
12944 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12945 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12946 AC_CONFIG_HEADERS([config_host/config_python.h])
12947 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12948 AC_OUTPUT
12950 if test "$CROSS_COMPILING" = TRUE; then
12951     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12954 # touch the config timestamp file
12955 if test ! -f config_host.mk.stamp; then
12956     echo > config_host.mk.stamp
12957 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12958     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12959 else
12960     echo > config_host.mk.stamp
12963 # touch the config lang timestamp file
12964 if test ! -f config_host_lang.mk.stamp; then
12965     echo > config_host_lang.mk.stamp
12966 elif test "$config_lang_md5" = `$MD5SUM config_host_lang.mk | sed "s/ .*//"`; then
12967     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12968 else
12969     echo > config_host_lang.mk.stamp
12973 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12975 cat << _EOS
12976 ****************************************************************************
12977 WARNING:
12978 Your make version is known to be horribly slow, and hard to debug
12979 problems with. To get a reasonably functional make please do:
12981 to install a pre-compiled binary make for Win32
12983  mkdir -p /opt/lo/bin
12984  cd /opt/lo/bin
12985  wget http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12986  cp make-85047eb-msvc.exe make
12987  chmod +x make
12989 to install from source:
12990 place yourself in a working directory of you choice.
12992  git clone git://git.savannah.gnu.org/make.git
12994  [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"]
12995  set PATH=%PATH%;C:\Cygwin\bin
12996  [or Cygwin64, if that is what you have]
12997  cd path-to-make-repo-you-cloned-above
12998  build_w32.bat --without-guile
13000 should result in a WinRel/gnumake.exe.
13001 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13003 Then re-run autogen.sh
13005 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13006 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13008 _EOS
13011 cat << _EOF
13012 ****************************************************************************
13014 To build, run:
13015 $GNUMAKE
13017 To view some help, run:
13018 $GNUMAKE help
13020 _EOF
13022 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13023     cat << _EOF
13024 After the build has finished, you can immediately run it using:
13025 _EOF
13027     if test $_os = Darwin; then
13028         echo open instdir/$PRODUCTNAME.app
13029     else
13030         echo instdir/program/soffice
13031     fi
13032     cat << _EOF
13034 If you want to run the smoketest, run:
13035 $GNUMAKE check
13037 _EOF
13040 if test -f warn; then
13041     cat warn
13042     rm warn
13045 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: