Bump version to 5.3-67
[LibreOffice.git] / configure.ac
blob9dafa17c62a9cfb89faa921f7ebebfe771b98f5e
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.67],[],[],[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         [Merge several of the smaller libraries into one big, "merged", one.])
1052 AC_ARG_ENABLE(graphite,
1053     AS_HELP_STRING([--disable-graphite],
1054         [Disables the compilation of Graphite smart font rendering.])
1057 AC_ARG_ENABLE(breakpad,
1058     AS_HELP_STRING([--enable-breakpad],
1059         [Enables breakpad for crash reporting.])
1062 AC_ARG_ENABLE(orcus,
1063     AS_HELP_STRING([--enable-orcus],
1064         [Enables orcus for extra file import filters for Calc.])
1067 AC_ARG_ENABLE(fetch-external,
1068     AS_HELP_STRING([--disable-fetch-external],
1069         [Disables fetching external tarballs from web sources.])
1072 AC_ARG_ENABLE(pch,
1073     AS_HELP_STRING([--enable-pch],
1074         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1077 AC_ARG_ENABLE(epm,
1078     AS_HELP_STRING([--enable-epm],
1079         [LibreOffice includes self-packaging code, that requires epm, however epm is
1080          useless for large scale package building.])
1083 AC_ARG_ENABLE(odk,
1084     AS_HELP_STRING([--disable-odk],
1085         [LibreOffice includes an ODK, office development kit which some packagers may
1086          wish to build without.])
1089 AC_ARG_ENABLE(mpl-subset,
1090     AS_HELP_STRING([--enable-mpl-subset],
1091         [Don't compile any pieces which are not MPL or more liberally licensed])
1094 AC_ARG_ENABLE(evolution2,
1095     AS_HELP_STRING([--enable-evolution2],
1096         [Allows the built-in evolution 2 addressbook connectivity build to be
1097          enabled.])
1100 AC_ARG_ENABLE(directx,
1101     AS_HELP_STRING([--disable-directx],
1102         [Remove DirectX implementation for the new XCanvas interface.
1103          The DirectX support requires more stuff installed on Windows to
1104          compile. (DirectX SDK, GDI+ libs)])
1107 AC_ARG_ENABLE(activex,
1108     AS_HELP_STRING([--disable-activex],
1109         [Disable the use of ActiveX for a Windows build.
1110         This switch is mandatory when using an Express edition of Visual Studio.])
1113 AC_ARG_ENABLE(atl,
1114     AS_HELP_STRING([--disable-atl],
1115         [Disable the use of ATL for a Windows build.])
1116     [
1117         This switch is mandatory when using an Express edition of Visual Studio.
1118     ],
1121 AC_ARG_ENABLE(avahi,
1122     AS_HELP_STRING([--enable-avahi],
1123         [Determines whether to use Avahi to advertise Impress to remote controls.]),
1126 AC_ARG_ENABLE(werror,
1127     AS_HELP_STRING([--enable-werror],
1128         [Turn warnings to errors. (Has no effect in modules where the treating
1129          of warnings as errors is disabled explicitly.)]),
1132 AC_ARG_ENABLE(assert-always-abort,
1133     AS_HELP_STRING([--enable-assert-always-abort],
1134         [make assert() abort even in release code.]),
1137 AC_ARG_ENABLE(dbgutil,
1138     AS_HELP_STRING([--enable-dbgutil],
1139         [Provide debugging support from --enable-debug and include additional debugging
1140          utilities such as object counting or more expensive checks.
1141          This is the recommended option for developers.
1142          Note that this makes the build ABI incompatible, it is not possible to mix object
1143          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1145 AC_ARG_ENABLE(debug,
1146     AS_HELP_STRING([--enable-debug],
1147         [Include debugging information, disable compiler optimization and inlining plus
1148          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1150 AC_ARG_ENABLE(sal-log,
1151     AS_HELP_STRING([--enable-sal-log],
1152         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1154 AC_ARG_ENABLE(selective-debuginfo,
1155     AS_HELP_STRING([--enable-selective-debuginfo],
1156         [If --enable-debug or --enable-dbgutil is used, build debugging information
1157          (-g compiler flag) only for the specified gbuild build targets
1158          (where all means everything, - prepended means not to enable, / appended means
1159          everything in the directory; there is no ordering, more specific overrides
1160          more general, and disabling takes precedence).
1161          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1163 AC_ARG_ENABLE(symbols,
1164     AS_HELP_STRING([--enable-symbols],
1165         [Generate debug information.
1166          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1167          otherwise.]))
1169 AC_ARG_ENABLE(runtime-optimizations,
1170     AS_HELP_STRING([--disable-runtime-optimizations],
1171         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1172          JVM JIT) that are known to interact badly with certain dynamic analysis
1173          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1174          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1175          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1177 AC_ARG_ENABLE(compiler-plugins,
1178     AS_HELP_STRING([--enable-compiler-plugins],
1179         [Enable compiler plugins that will perform additional checks during
1180          building. Enabled automatically by --enable-dbgutil.]))
1182 AC_ARG_ENABLE(ooenv,
1183     AS_HELP_STRING([--disable-ooenv],
1184         [Disable ooenv for the instdir installation.]))
1186 AC_ARG_ENABLE(lto,
1187     AS_HELP_STRING([--enable-lto],
1188         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1189          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1190          linker. For MSVC, this option is broken at the moment. This is experimental work
1191          in progress that shouldn't be used unless you are working on it.)]))
1193 AC_ARG_ENABLE(python,
1194     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1195         [Enables or disables Python support at run-time and build-time.
1196          Also specifies what Python to use. 'auto' is the default.
1197          'fully-internal' even forces the internal version for uses of Python
1198          during the build.]))
1200 AC_ARG_ENABLE(gtk,
1201     AS_HELP_STRING([--disable-gtk],
1202         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1203 ,enable_gtk=yes)
1205 AC_ARG_ENABLE(gtk3,
1206     AS_HELP_STRING([--disable-gtk3],
1207         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1208          This is experimental and may not work.]),
1209 ,enable_gtk3=yes)
1211 AC_ARG_ENABLE(systray,
1212     AS_HELP_STRING([--disable-systray],
1213         [Determines whether to build the systray quickstarter.]),
1214 ,enable_systray=yes)
1216 AC_ARG_ENABLE(split-app-modules,
1217     AS_HELP_STRING([--enable-split-app-modules],
1218         [Split file lists for app modules, e.g. base, calc.
1219          Has effect only with make distro-pack-install]),
1222 AC_ARG_ENABLE(split-opt-features,
1223     AS_HELP_STRING([--enable-split-opt-features],
1224         [Split file lists for some optional features, e.g. pyuno, testtool.
1225          Has effect only with make distro-pack-install]),
1228 AC_ARG_ENABLE(cairo-canvas,
1229     AS_HELP_STRING([--disable-cairo-canvas],
1230         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1233 AC_ARG_ENABLE(dbus,
1234     AS_HELP_STRING([--disable-dbus],
1235         [Determines whether to enable features that depend on dbus.
1236          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1237 ,enable_dbus=yes)
1239 AC_ARG_ENABLE(sdremote,
1240     AS_HELP_STRING([--disable-sdremote],
1241         [Determines whether to enable Impress remote control (i.e. the server component).]),
1242 ,enable_sdremote=yes)
1244 AC_ARG_ENABLE(sdremote-bluetooth,
1245     AS_HELP_STRING([--disable-sdremote-bluetooth],
1246         [Determines whether to build sdremote with bluetooth support.
1247          Requires dbus on Linux.]))
1249 AC_ARG_ENABLE(gio,
1250     AS_HELP_STRING([--disable-gio],
1251         [Determines whether to use the GIO support.]),
1252 ,enable_gio=yes)
1254 AC_ARG_ENABLE(telepathy,
1255     AS_HELP_STRING([--enable-telepathy],
1256         [Determines whether to enable Telepathy for collaboration.]),
1257 ,enable_telepathy=no)
1259 AC_ARG_ENABLE(tde,
1260     AS_HELP_STRING([--enable-tde],
1261         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1262          TDE are available.]),
1265 AC_ARG_ENABLE(tdeab,
1266     AS_HELP_STRING([--disable-tdeab],
1267         [Disable the TDE address book support.]),
1269     if test "$enable_tde" = "yes"; then
1270         enable_tdeab=yes
1271     fi
1274 AC_ARG_ENABLE(kde4,
1275     AS_HELP_STRING([--enable-kde4],
1276         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1277          KDE4 are available.]),
1280 AC_ARG_ENABLE(gui,
1281     AS_HELP_STRING([--disable-gui],
1282         [Disable X11/Wayland support to reduce dependencies. Maybe useful for
1283          headless servers, but soffice --headless works just fine without it.
1284          Work in progress, use only if you are hacking on it.]),
1285 ,enable_gui=yes)
1287 AC_ARG_ENABLE(randr,
1288     AS_HELP_STRING([--disable-randr],
1289         [Disable RandR support in the vcl project.]),
1290 ,enable_randr=yes)
1292 AC_ARG_ENABLE(gstreamer-1-0,
1293     AS_HELP_STRING([--disable-gstreamer-1-0],
1294         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1295 ,enable_gstreamer_1_0=yes)
1297 AC_ARG_ENABLE(gstreamer-0-10,
1298     AS_HELP_STRING([--enable-gstreamer-0-10],
1299         [Enable building with the gstreamer 0.10 avmedia backend.]),
1300 ,enable_gstreamer_0_10=no)
1302 AC_ARG_ENABLE(vlc,
1303     AS_HELP_STRING([--enable-vlc],
1304         [Enable building with the (experimental) VLC avmedia backend.]),
1305 ,enable_vlc=no)
1307 AC_ARG_ENABLE(neon,
1308     AS_HELP_STRING([--disable-neon],
1309         [Disable neon and the compilation of webdav binding.]),
1312 AC_ARG_ENABLE([eot],
1313     [AS_HELP_STRING([--enable-eot],
1314         [Enable support for Embedded OpenType fonts.])],
1315 , [enable_eot=no])
1317 AC_ARG_ENABLE(cve-tests,
1318     AS_HELP_STRING([--disable-cve-tests],
1319         [Prevent CVE tests to be executed]),
1322 AC_ARG_ENABLE(chart-tests,
1323     AS_HELP_STRING([--enable-chart-tests],
1324         [Executes chart XShape tests. In a perfect world these tests would be
1325          stable and everyone could run them, in reality it is best to run them
1326          only on a few machines that are known to work and maintained by people
1327          who can judge if a test failure is a regression or not.]),
1330 AC_ARG_ENABLE(build-unowinreg,
1331     AS_HELP_STRING([--enable-build-unowinreg],
1332         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1333          compiler is needed on Linux.]),
1336 AC_ARG_ENABLE(dependency-tracking,
1337     AS_HELP_STRING([--enable-dependency-tracking],
1338         [Do not reject slow dependency extractors.])[
1339   --disable-dependency-tracking
1340                           Disables generation of dependency information.
1341                           Speed up one-time builds.],
1344 AC_ARG_ENABLE(icecream,
1345     AS_HELP_STRING([--enable-icecream],
1346         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1347          It defaults to /opt/icecream for the location of the icecream gcc/g++
1348          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1351 AC_ARG_ENABLE(cups,
1352     AS_HELP_STRING([--disable-cups],
1353         [Do not build cups support.])
1356 AC_ARG_ENABLE(ccache,
1357     AS_HELP_STRING([--disable-ccache],
1358         [Do not try to use ccache automatically.
1359          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1360          CC/CXX are not yet set, and --enable-icecream is not given, we
1361          attempt to use ccache. --disable-ccache disables ccache completely.
1365 AC_ARG_ENABLE(64-bit,
1366     AS_HELP_STRING([--enable-64-bit],
1367         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1368          At the moment meaningful only for iOS and Windows.]), ,)
1370 AC_ARG_ENABLE(online-update,
1371     AS_HELP_STRING([--enable-online-update],
1372         [Enable the online update service that will check for new versions of
1373          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1374          If the value is "mar", the experimental Mozilla-like update will be
1375          enabled instead of the traditional update mechanism.]),
1378 AC_ARG_ENABLE(extension-update,
1379     AS_HELP_STRING([--disable-extension-update],
1380         [Disable possibility to update installed extensions.]),
1383 AC_ARG_ENABLE(release-build,
1384     AS_HELP_STRING([--enable-release-build],
1385         [Enable release build.
1386          See http://wiki.documentfoundation.org/Development/DevBuild]),
1389 AC_ARG_ENABLE(windows-build-signing,
1390     AS_HELP_STRING([--enable-windows-build-signing],
1391         [Enable signing of windows binaries (*.exe, *.dll)]),
1394 AC_ARG_ENABLE(silent-msi,
1395     AS_HELP_STRING([--enable-silent-msi],
1396         [Enable MSI with LIMITUI=1 (silent install).]),
1399 AC_ARG_ENABLE(macosx-code-signing,
1400     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1401         [Sign executables, dylibs, frameworks and the app bundle. If you
1402          don't provide an identity the first suitable certificate
1403          in your keychain is used.]),
1406 AC_ARG_ENABLE(macosx-package-signing,
1407     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1408         [Create a .pkg suitable for uploading to the Mac App Store and sign
1409          it. If you don't provide an identity the first suitable certificate
1410          in your keychain is used.]),
1413 AC_ARG_ENABLE(macosx-sandbox,
1414     AS_HELP_STRING([--enable-macosx-sandbox],
1415         [Make the app bundle run in a sandbox. Requires code signing.
1416          Is required by apps distributed in the Mac App Store, and implies
1417          adherence to App Store rules.]),
1420 AC_ARG_WITH(macosx-bundle-identifier,
1421     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1422         [Define the OS X bundle identifier. Default is the somewhat weird
1423          org.libreoffice.script ("script", huh?).]),
1424 ,with_macosx_bundle_identifier=org.libreoffice.script)
1426 AC_ARG_WITH(product-name,
1427     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1428         [Define the product name. Default is AC_PACKAGE_NAME.]),
1429 ,with_product_name=$PRODUCTNAME)
1431 AC_ARG_WITH(package-version,
1432     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1433         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1436 AC_ARG_ENABLE(ios-simulator,
1437     AS_HELP_STRING([--enable-ios-simulator],
1438         [Build for the iOS Simulator, not iOS device.]),
1441 AC_ARG_ENABLE(readonly-installset,
1442     AS_HELP_STRING([--enable-readonly-installset],
1443         [Prevents any attempts by LibreOffice to write into its installation. That means
1444          at least that no "system-wide" extensions can be added. Experimental work in
1445          progress.]),
1448 AC_ARG_ENABLE(postgresql-sdbc,
1449     AS_HELP_STRING([--disable-postgresql-sdbc],
1450         [Disable the build of the PostgreSQL-SDBC driver.])
1453 AC_ARG_ENABLE(lotuswordpro,
1454     AS_HELP_STRING([--disable-lotuswordpro],
1455         [Disable the build of the Lotus Word Pro filter.]),
1456 ,enable_lotuswordpro=yes)
1458 AC_ARG_ENABLE(firebird-sdbc,
1459     AS_HELP_STRING([--disable-firebird-sdbc],
1460         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1461 ,enable_firebird_sdbc=yes)
1463 AC_ARG_ENABLE(winegcc,
1464     AS_HELP_STRING([--enable-winegcc],
1465         [Enable use of winegcc during the build, in order to create msi* tools
1466          needed for MinGW cross-compilation.]),
1469 AC_ARG_ENABLE(liblangtag,
1470     AS_HELP_STRING([--disable-liblangtag],
1471         [Disable use of liblangtag, and instead use an own simple
1472          implementation.]),
1475 AC_ARG_ENABLE(bogus-pkg-config,
1476     AS_HELP_STRING([--enable-bogus-pkg-config],
1477         [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.]),
1480 AC_ARG_ENABLE(openssl,
1481     AS_HELP_STRING([--disable-openssl],
1482         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1483          components will either use GNUTLS or NSS. Work in progress,
1484          use only if you are hacking on it.]),
1485 ,enable_openssl=yes)
1487 AC_ARG_ENABLE(library-bin-tar,
1488     AS_HELP_STRING([--enable-library-bin-tar],
1489         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1490         Some libraries can save their build result in a tarball
1491         stored in TARFILE_LOCATION. That binary tarball is
1492         uniquely identified by the source tarball,
1493         the content of the config_host.mk file and the content
1494         of the top-level directory in core for that library
1495         If this option is enabled, then if such a tarfile exist, it will be untarred
1496         instead of the source tarfile, and the build step will be skipped for that
1497         library.
1498         If a proper tarfile does not exist, then the normal source-based
1499         build is done for that library and a proper binary tarfile is created
1500         for the next time.]),
1503 AC_ARG_ENABLE(gltf,
1504     AS_HELP_STRING([--disable-gltf],
1505         [Determines whether to build libraries related to glTF 3D model rendering.]))
1507 AC_ARG_ENABLE(collada,
1508     AS_HELP_STRING([--disable-collada],
1509         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1511 AC_ARG_ENABLE(dconf,
1512     AS_HELP_STRING([--disable-dconf],
1513         [Disable the dconf configuration backend (enabled by default where
1514          available).]))
1516 AC_ARG_ENABLE(formula-logger,
1517     AS_HELP_STRING(
1518         [--enable-formula-logger],
1519         [Enable formula logger for logging formula calculation flow in Calc.]
1520     )
1523 dnl ===================================================================
1524 dnl Optional Packages (--with/without-)
1525 dnl ===================================================================
1527 AC_ARG_WITH(gcc-home,
1528     AS_HELP_STRING([--with-gcc-home],
1529         [Specify the location of gcc/g++ manually. This can be used in conjunction
1530          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1531          non-default path.]),
1534 AC_ARG_WITH(gnu-patch,
1535     AS_HELP_STRING([--with-gnu-patch],
1536         [Specify location of GNU patch on Solaris or FreeBSD.]),
1539 AC_ARG_WITH(build-platform-configure-options,
1540     AS_HELP_STRING([--with-build-platform-configure-options],
1541         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1544 AC_ARG_WITH(gnu-cp,
1545     AS_HELP_STRING([--with-gnu-cp],
1546         [Specify location of GNU cp on Solaris or FreeBSD.]),
1549 AC_ARG_WITH(external-tar,
1550     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1551         [Specify an absolute path of where to find (and store) tarfiles.]),
1552     TARFILE_LOCATION=$withval ,
1555 AC_ARG_WITH(referenced-git,
1556     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1557         [Specify another checkout directory to reference. This makes use of
1558                  git submodule update --reference, and saves a lot of diskspace
1559                  when having multiple trees side-by-side.]),
1560     GIT_REFERENCE_SRC=$withval ,
1563 AC_ARG_WITH(linked-git,
1564     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1565         [Specify a directory where the repositories of submodules are located.
1566          This uses a method similar to git-new-workdir to get submodules.]),
1567     GIT_LINK_SRC=$withval ,
1570 AC_ARG_WITH(galleries,
1571     AS_HELP_STRING([--with-galleries],
1572         [Specify how galleries should be built. It is possible either to
1573          build these internally from source ("build"),
1574          or to disable them ("no")]),
1577 AC_ARG_WITH(theme,
1578     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1579         [Choose which themes to include. By default those themes with an '*' are included.
1580          Possible choices: *breeze, *breeze_dark, crystal, *galaxy, *hicontrast, *oxygen, *sifr, *tango, *tango_testing.]),
1583 AC_ARG_WITH(helppack-integration,
1584     AS_HELP_STRING([--without-helppack-integration],
1585         [It will not integrate the helppacks to the installer
1586          of the product. Please use this switch to use the online help
1587          or separate help packages.]),
1590 AC_ARG_WITH(fonts,
1591     AS_HELP_STRING([--without-fonts],
1592         [LibreOffice includes some third-party fonts to provide a reliable basis for
1593          help content, templates, samples, etc. When these fonts are already
1594          known to be available on the system then you should use this option.]),
1597 AC_ARG_ENABLE(noto-font,
1598     AS_HELP_STRING([--enable-noto-font],
1599         [Add Google Noto font.]),
1602 AC_ARG_WITH(epm,
1603     AS_HELP_STRING([--with-epm],
1604         [Decides which epm to use. Default is to use the one from the system if
1605          one is built. When either this is not there or you say =internal epm
1606          will be built.]),
1609 AC_ARG_WITH(package-format,
1610     AS_HELP_STRING([--with-package-format],
1611         [Specify package format(s) for LibreOffice installation sets. The
1612          implicit --without-package-format leads to no installation sets being
1613          generated. Possible values: aix, archive, bsd, deb, dmg,
1614          installed, msi, pkg, and rpm.
1615          Example: --with-package-format='deb rpm']),
1618 AC_ARG_WITH(tls,
1619     AS_HELP_STRING([--with-tls],
1620         [Decides which TLS/SSL and cryptographic implementations to use for
1621          LibreOffice's code. Notice that this doesn't apply for depending
1622          libraries like "neon", for example. Default is to use OpenSSL
1623          although NSS is also possible. Notice that selecting NSS restricts
1624          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1625          restrict by now the usage of NSS in LO's code. Possible values:
1626          openssl, nss. Example: --with-tls="nss"]),
1629 AC_ARG_WITH(system-libs,
1630     AS_HELP_STRING([--with-system-libs],
1631         [Use libraries already on system -- enables all --with-system-* flags.]),
1634 AC_ARG_WITH(system-bzip2,
1635     AS_HELP_STRING([--with-system-bzip2],
1636         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1637     [with_system_bzip2="$with_system_libs"])
1639 AC_ARG_WITH(system-headers,
1640     AS_HELP_STRING([--with-system-headers],
1641         [Use headers already on system -- enables all --with-system-* flags for
1642          external packages whose headers are the only entities used i.e.
1643          boost/odbc/sane-header(s).]),,
1644     [with_system_headers="$with_system_libs"])
1646 AC_ARG_WITH(system-jars,
1647     AS_HELP_STRING([--without-system-jars],
1648         [When building with --with-system-libs, also the needed jars are expected
1649          on the system. Use this to disable that]),,
1650     [with_system_jars="$with_system_libs"])
1652 AC_ARG_WITH(system-cairo,
1653     AS_HELP_STRING([--with-system-cairo],
1654         [Use cairo libraries already on system.  Happens automatically for
1655          (implicit) --enable-gtk and for --enable-gtk3.]))
1657 AC_ARG_WITH(myspell-dicts,
1658     AS_HELP_STRING([--with-myspell-dicts],
1659         [Adds myspell dictionaries to the LibreOffice installation set]),
1662 AC_ARG_WITH(system-dicts,
1663     AS_HELP_STRING([--without-system-dicts],
1664         [Do not use dictionaries from system paths.]),
1667 AC_ARG_WITH(external-dict-dir,
1668     AS_HELP_STRING([--with-external-dict-dir],
1669         [Specify external dictionary dir.]),
1672 AC_ARG_WITH(external-hyph-dir,
1673     AS_HELP_STRING([--with-external-hyph-dir],
1674         [Specify external hyphenation pattern dir.]),
1677 AC_ARG_WITH(external-thes-dir,
1678     AS_HELP_STRING([--with-external-thes-dir],
1679         [Specify external thesaurus dir.]),
1682 AC_ARG_WITH(system-zlib,
1683     AS_HELP_STRING([--with-system-zlib],
1684         [Use zlib already on system.]),,
1685     [with_system_zlib=auto])
1687 AC_ARG_WITH(system-jpeg,
1688     AS_HELP_STRING([--with-system-jpeg],
1689         [Use jpeg already on system.]),,
1690     [with_system_jpeg="$with_system_libs"])
1692 AC_ARG_WITH(system-libgltf,
1693     AS_HELP_STRING([--with-system-libgltf],
1694         [Use libgltf already on system.]),,
1695     [with_system_libgltf="$with_system_libs"])
1697 AC_ARG_WITH(system-clucene,
1698     AS_HELP_STRING([--with-system-clucene],
1699         [Use clucene already on system.]),,
1700     [with_system_clucene="$with_system_libs"])
1702 AC_ARG_WITH(system-expat,
1703     AS_HELP_STRING([--with-system-expat],
1704         [Use expat already on system.]),,
1705     [with_system_expat="$with_system_libs"])
1707 AC_ARG_WITH(system-libxml,
1708     AS_HELP_STRING([--with-system-libxml],
1709         [Use libxml/libxslt already on system.]),,
1710     [with_system_libxml=auto])
1712 AC_ARG_WITH(system-icu,
1713     AS_HELP_STRING([--with-system-icu],
1714         [Use icu already on system.]),,
1715     [with_system_icu="$with_system_libs"])
1717 AC_ARG_WITH(system-ucpp,
1718     AS_HELP_STRING([--with-system-ucpp],
1719         [Use ucpp already on system.]),,
1720     [])
1722 AC_ARG_WITH(system-opencollada,
1723     AS_HELP_STRING([--with-system-opencollada],
1724         [Use openCOLLADA already on system.]),,
1725     [with_system_opencollada=no])
1727 AC_ARG_WITH(system-collada2gltf,
1728     AS_HELP_STRING([--with-system-collada2gltf],
1729         [Use collada2gltf already on system.]),,
1730     [with_system_collada2gltf=no])
1732 AC_ARG_WITH(system-openldap,
1733     AS_HELP_STRING([--with-system-openldap],
1734         [Use the OpenLDAP LDAP SDK already on system.]),,
1735     [with_system_openldap="$with_system_libs"])
1737 AC_ARG_WITH(system-poppler,
1738     AS_HELP_STRING([--with-system-poppler],
1739         [Use system poppler (only needed for PDF import).]),,
1740     [with_system_poppler="$with_system_libs"])
1742 AC_ARG_WITH(system-apache-commons,
1743     AS_HELP_STRING([--with-system-apache-commons],
1744         [Use Apache commons libraries already on system.]),,
1745     [with_system_apache_commons="$with_system_jars"])
1747 AC_ARG_WITH(system-mariadb,
1748     AS_HELP_STRING([--with-system-mariadb],
1749         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1750          extension.]),,
1751     [with_system_mariadb="$with_system_libs"])
1753 AC_ARG_ENABLE(bundle-mariadb,
1754     AS_HELP_STRING([--enable-bundle-mariadb],
1755         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1758 AC_ARG_WITH(system-mysql-cppconn,
1759     AS_HELP_STRING([--with-system-mysql-cppconn],
1760         [Use MySQL C++ Connector libraries already on system.]),,
1761     [with_system_mysql_cppconn="$with_system_libs"])
1763 AC_ARG_WITH(system-postgresql,
1764     AS_HELP_STRING([--with-system-postgresql],
1765         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1766          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1767     [with_system_postgresql="$with_system_libs"])
1769 AC_ARG_WITH(libpq-path,
1770     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1771         [Use this PostgreSQL C interface (libpq) installation for building
1772          the PostgreSQL-SDBC extension.]),
1775 AC_ARG_WITH(system-firebird,
1776     AS_HELP_STRING([--with-system-firebird],
1777         [Use Firebird libraries already on system, for building the Firebird-SDBC
1778          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1779     [with_system_firebird="$with_system_libs"])
1781 AC_ARG_WITH(system-libtommath,
1782             AS_HELP_STRING([--with-system-libtommath],
1783                            [Use libtommath already on system]),,
1784             [with_system_libtommath="$with_system_libs"])
1786 AC_ARG_WITH(system-hsqldb,
1787     AS_HELP_STRING([--with-system-hsqldb],
1788         [Use hsqldb already on system.]))
1790 AC_ARG_WITH(hsqldb-jar,
1791     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1792         [Specify path to jarfile manually.]),
1793     HSQLDB_JAR=$withval)
1795 AC_ARG_ENABLE(scripting-beanshell,
1796     AS_HELP_STRING([--disable-scripting-beanshell],
1797         [Disable support for scripts in BeanShell.]),
1801 AC_ARG_WITH(system-beanshell,
1802     AS_HELP_STRING([--with-system-beanshell],
1803         [Use beanshell already on system.]),,
1804     [with_system_beanshell="$with_system_jars"])
1806 AC_ARG_WITH(beanshell-jar,
1807     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1808         [Specify path to jarfile manually.]),
1809     BSH_JAR=$withval)
1811 AC_ARG_ENABLE(scripting-javascript,
1812     AS_HELP_STRING([--disable-scripting-javascript],
1813         [Disable support for scripts in JavaScript.]),
1817 AC_ARG_WITH(system-rhino,
1818     AS_HELP_STRING([--with-system-rhino],
1819         [Use rhino already on system.]),,)
1820 #    [with_system_rhino="$with_system_jars"])
1821 # Above is not used as we have different debug interface
1822 # patched into internal rhino. This code needs to be fixed
1823 # before we can enable it by default.
1825 AC_ARG_WITH(rhino-jar,
1826     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1827         [Specify path to jarfile manually.]),
1828     RHINO_JAR=$withval)
1830 AC_ARG_WITH(commons-codec-jar,
1831     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1832         [Specify path to jarfile manually.]),
1833     COMMONS_CODEC_JAR=$withval)
1835 AC_ARG_WITH(commons-lang-jar,
1836     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1837         [Specify path to jarfile manually.]),
1838     COMMONS_LANG_JAR=$withval)
1840 AC_ARG_WITH(commons-httpclient-jar,
1841     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1842         [Specify path to jarfile manually.]),
1843     COMMONS_HTTPCLIENT_JAR=$withval)
1845 AC_ARG_WITH(commons-logging-jar,
1846     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1847         [Specify path to jarfile manually.]),
1848     COMMONS_LOGGING_JAR=$withval)
1850 AC_ARG_WITH(system-jfreereport,
1851     AS_HELP_STRING([--with-system-jfreereport],
1852         [Use JFreeReport already on system.]),,
1853     [with_system_jfreereport="$with_system_jars"])
1855 AC_ARG_WITH(sac-jar,
1856     AS_HELP_STRING([--with-sac-jar=JARFILE],
1857         [Specify path to jarfile manually.]),
1858     SAC_JAR=$withval)
1860 AC_ARG_WITH(libxml-jar,
1861     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1862         [Specify path to jarfile manually.]),
1863     LIBXML_JAR=$withval)
1865 AC_ARG_WITH(flute-jar,
1866     AS_HELP_STRING([--with-flute-jar=JARFILE],
1867         [Specify path to jarfile manually.]),
1868     FLUTE_JAR=$withval)
1870 AC_ARG_WITH(jfreereport-jar,
1871     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1872         [Specify path to jarfile manually.]),
1873     JFREEREPORT_JAR=$withval)
1875 AC_ARG_WITH(liblayout-jar,
1876     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1877         [Specify path to jarfile manually.]),
1878     LIBLAYOUT_JAR=$withval)
1880 AC_ARG_WITH(libloader-jar,
1881     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1882         [Specify path to jarfile manually.]),
1883     LIBLOADER_JAR=$withval)
1885 AC_ARG_WITH(libformula-jar,
1886     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1887         [Specify path to jarfile manually.]),
1888     LIBFORMULA_JAR=$withval)
1890 AC_ARG_WITH(librepository-jar,
1891     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1892         [Specify path to jarfile manually.]),
1893     LIBREPOSITORY_JAR=$withval)
1895 AC_ARG_WITH(libfonts-jar,
1896     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1897         [Specify path to jarfile manually.]),
1898     LIBFONTS_JAR=$withval)
1900 AC_ARG_WITH(libserializer-jar,
1901     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1902         [Specify path to jarfile manually.]),
1903     LIBSERIALIZER_JAR=$withval)
1905 AC_ARG_WITH(libbase-jar,
1906     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1907         [Specify path to jarfile manually.]),
1908     LIBBASE_JAR=$withval)
1910 AC_ARG_WITH(system-odbc,
1911     AS_HELP_STRING([--with-system-odbc],
1912         [Use the odbc headers already on system.]),,
1913     [with_system_odbc="auto"])
1915 AC_ARG_WITH(system-sane,
1916     AS_HELP_STRING([--with-system-sane],
1917         [Use sane.h already on system.]),,
1918     [with_system_sane="$with_system_headers"])
1920 AC_ARG_WITH(system-bluez,
1921     AS_HELP_STRING([--with-system-bluez],
1922         [Use bluetooth.h already on system.]),,
1923     [with_system_bluez="$with_system_headers"])
1925 AC_ARG_WITH(system-curl,
1926     AS_HELP_STRING([--with-system-curl],
1927         [Use curl already on system.]),,
1928     [with_system_curl=auto])
1930 AC_ARG_WITH(system-boost,
1931     AS_HELP_STRING([--with-system-boost],
1932         [Use boost already on system.]),,
1933     [with_system_boost="$with_system_headers"])
1935 AC_ARG_WITH(system-glm,
1936     AS_HELP_STRING([--with-system-glm],
1937         [Use glm already on system.]),,
1938     [with_system_glm="$with_system_headers"])
1940 AC_ARG_WITH(system-hunspell,
1941     AS_HELP_STRING([--with-system-hunspell],
1942         [Use libhunspell already on system.]),,
1943     [with_system_hunspell="$with_system_libs"])
1945 AC_ARG_WITH(system-mythes,
1946     AS_HELP_STRING([--with-system-mythes],
1947         [Use mythes already on system.]),,
1948     [with_system_mythes="$with_system_libs"])
1950 AC_ARG_WITH(system-altlinuxhyph,
1951     AS_HELP_STRING([--with-system-altlinuxhyph],
1952         [Use ALTLinuxhyph already on system.]),,
1953     [with_system_altlinuxhyph="$with_system_libs"])
1955 AC_ARG_WITH(system-lpsolve,
1956     AS_HELP_STRING([--with-system-lpsolve],
1957         [Use lpsolve already on system.]),,
1958     [with_system_lpsolve="$with_system_libs"])
1960 AC_ARG_WITH(system-coinmp,
1961     AS_HELP_STRING([--with-system-coinmp],
1962         [Use CoinMP already on system.]),,
1963     [with_system_coinmp="$with_system_libs"])
1965 AC_ARG_WITH(system-liblangtag,
1966     AS_HELP_STRING([--with-system-liblangtag],
1967         [Use liblangtag library already on system.]),,
1968     [with_system_liblangtag="$with_system_libs"])
1970 AC_ARG_WITH(jpeg-turbo,
1971     AS_HELP_STRING([--with-jpeg-turbo],
1972         [Use internal libjpeg-turbo library.]),,
1973     [with_jpeg_turbo=auto])
1975 AC_ARG_WITH(webdav,
1976     AS_HELP_STRING([--with-webdav],
1977         [Specify which library to use for webdav implementation.
1978          Possible values: "neon", "serf", "no". The default value is "neon".
1979          Example: --with-webdav="serf"]),
1980     WITH_WEBDAV=$withval,
1981     WITH_WEBDAV="neon")
1983 AC_ARG_WITH(linker-hash-style,
1984     AS_HELP_STRING([--with-linker-hash-style],
1985         [Use linker with --hash-style=<style> when linking shared objects.
1986          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1987          if supported on the build system, and "sysv" otherwise.]))
1989 AC_ARG_WITH(jdk-home,
1990     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1991         [If you have installed JDK 1.3 or later on your system please supply the
1992          path here. Note that this is not the location of the java command but the
1993          location of the entire distribution.]),
1996 AC_ARG_WITH(help,
1997     AS_HELP_STRING([--with-help],
1998         [Enable the build of help. There is a special parameter "common" that
1999          can be used to bundle only the common part, .e.g help-specific icons.
2000          This is useful when you build the helpcontent separately.])
2001     [
2002                           Usage:     --with-help    build the entire local help
2003                                  --without-help     no local help (default)
2004                                  --with-help=common bundle common files for the local
2005                                                     help but do not build the whole help
2006     ],
2009 AC_ARG_WITH(java,
2010     AS_HELP_STRING([--with-java=<java command>],
2011         [Specify the name of the Java interpreter command. Typically "java"
2012          which is the default.
2014          To build without support for Java components, applets, accessibility
2015          or the XML filters written in Java, use --without-java or --with-java=no.]),
2016     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2017     [ with_java=java ]
2020 AC_ARG_WITH(jvm-path,
2021     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2022         [Use a specific JVM search path at runtime.
2023          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2026 AC_ARG_WITH(ant-home,
2027     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2028         [If you have installed Jakarta Ant on your system, please supply the path here.
2029          Note that this is not the location of the Ant binary but the location
2030          of the entire distribution.]),
2033 AC_ARG_WITH(symbol-config,
2034     AS_HELP_STRING([--with-symbol-config],
2035         [Configuration for the crashreport symbol upload]),
2036         [],
2037         [with_symbol_config=no])
2039 AC_ARG_WITH(export-validation,
2040     AS_HELP_STRING([--without-export-validation],
2041         [Disable validating OOXML and ODF files as exported from in-tree tests.
2042          Use this option e.g. if your system only provides Java 5.]),
2043 ,with_export_validation=yes)
2045 AC_ARG_WITH(bffvalidator,
2046     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2047         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2048          Requires installed Microsoft Office Binary File Format Validator.
2049          Note: export-validation (--with-export-validation) is required to be turned on.
2050          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2051 ,with_bffvalidator=no)
2053 AC_ARG_WITH(junit,
2054     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2055         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2056          --without-junit disables those tests. Not relevant in the --without-java case.]),
2057 ,with_junit=yes)
2059 AC_ARG_WITH(hamcrest,
2060     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2061         [Specifies the hamcrest jar file to use for JUnit-based tests.
2062          --without-junit disables those tests. Not relevant in the --without-java case.]),
2063 ,with_hamcrest=yes)
2065 AC_ARG_WITH(perl-home,
2066     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2067         [If you have installed Perl 5 Distribution, on your system, please
2068          supply the path here. Note that this is not the location of the Perl
2069          binary but the location of the entire distribution.]),
2072 AC_ARG_WITH(doxygen,
2073     AS_HELP_STRING(
2074         [--with-doxygen=<absolute path to doxygen executable>],
2075         [Specifies the doxygen executable to use when generating ODK C/C++
2076          documentation. --without-doxygen disables generation of ODK C/C++
2077          documentation. Not relevant in the --disable-odk case.]),
2078 ,with_doxygen=yes)
2080 AC_ARG_WITH(visual-studio,
2081     AS_HELP_STRING([--with-visual-studio=<2013/2015>],
2082         [Specify which Visual Studio version to use in case several are
2083          installed. If not specified, only 2013 is detected automatically
2084          because 2015 support is currently experimental.]),
2087 AC_ARG_WITH(windows-sdk,
2088     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2089         [Specify which Windows SDK, or "Windows Kit", version to use
2090          in case the one that came with the selected Visual Studio
2091          is not what you want for some reason. Note that not all compiler/SDK
2092          combinations are supported. The intent is that this option should not
2093          be needed.]),
2096 AC_ARG_WITH(lang,
2097     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2098         [Use this option to build LibreOffice with additional UI language support.
2099          English (US) is always included by default.
2100          Separate multiple languages with space.
2101          For all languages, use --with-lang=ALL.]),
2104 AC_ARG_WITH(locales,
2105     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2106         [Use this option to limit the locale information built in.
2107          Separate multiple locales with space.
2108          Very experimental and might well break stuff.
2109          Just a desperate measure to shrink code and data size.
2110          By default all the locales available is included.
2111          This option is completely unrelated to --with-lang.])
2112     [
2113                           Affects also our character encoding conversion
2114                           tables for encodings mainly targeted for a
2115                           particular locale, like EUC-CN and EUC-TW for
2116                           zh, ISO-2022-JP for ja.
2118                           Affects also our add-on break iterator data for
2119                           some languages.
2121                           For the default, all locales, don't use this switch at all.
2122                           Specifying just the language part of a locale means all matching
2123                           locales will be included.
2124     ],
2127 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2128 AC_ARG_WITH(krb5,
2129     AS_HELP_STRING([--with-krb5],
2130         [Enable MIT Kerberos 5 support in modules that support it.
2131          By default automatically enabled on platforms
2132          where a good system Kerberos 5 is available.]),
2135 AC_ARG_WITH(gssapi,
2136     AS_HELP_STRING([--with-gssapi],
2137         [Enable GSSAPI support in modules that support it.
2138          By default automatically enabled on platforms
2139          where a good system GSSAPI is available.]),
2142 AC_ARG_WITH(iwyu,
2143     AS_HELP_STRING([--with-iwyu],
2144         [Use given IWYU binary path to check unneeded includes instead of building.
2145          Use only if you are hacking on it.]),
2148 dnl ===================================================================
2149 dnl Branding
2150 dnl ===================================================================
2152 AC_ARG_WITH(branding,
2153     AS_HELP_STRING([--with-branding=/path/to/images],
2154         [Use given path to retrieve branding images set.])
2155     [
2156                           Search for intro.png about.svg and flat_logo.svg.
2157                           If any is missing, default ones will be used instead.
2159                           Search also progress.conf for progress
2160                           settings on intro screen :
2162                           PROGRESSBARCOLOR="255,255,255" Set color of
2163                           progress bar. Comma separated RGB decimal values.
2164                           PROGRESSSIZE="407,6" Set size of progress bar.
2165                           Comma separated decimal values (width, height).
2166                           PROGRESSPOSITION="61,317" Set position of progress
2167                           bar from left,top. Comma separated decimal values.
2168                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2169                           bar frame. Comma separated RGB decimal values.
2170                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2171                           bar text. Comma separated RGB decimal values.
2172                           PROGRESSTEXTBASELINE="287" Set vertical position of
2173                           progress bar text from top. Decimal value.
2175                           Default values will be used if not found.
2176     ],
2180 AC_ARG_WITH(extra-buildid,
2181     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2182         [Show addition build identification in about dialog.]),
2186 AC_ARG_WITH(vendor,
2187     AS_HELP_STRING([--with-vendor="John the Builder"],
2188         [Set vendor of the build.]),
2191 AC_ARG_WITH(android-package-name,
2192     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2193         [Set Android package name of the build.]),
2196 AC_ARG_WITH(compat-oowrappers,
2197     AS_HELP_STRING([--with-compat-oowrappers],
2198         [Install oo* wrappers in parallel with
2199          lo* ones to keep backward compatibility.
2200          Has effect only with make distro-pack-install]),
2203 AC_ARG_WITH(os-version,
2204     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2205         [For FreeBSD users, use this option option to override the detected OSVERSION.]),
2208 AC_ARG_WITH(mingw-cross-compiler,
2209     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2210         [Specify the MinGW cross-compiler to use.
2211          When building on the ODK on Unix and building unowinreg.dll,
2212          specify the MinGW C++ cross-compiler.]),
2215 AC_ARG_WITH(idlc-cpp,
2216     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2217         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2220 AC_ARG_WITH(build-version,
2221     AS_HELP_STRING([--with-build-version="Built by Jim"],
2222         [Allows the builder to add a custom version tag that will appear in the
2223          Help/About box for QA purposes.]),
2224 with_build_version=$withval,
2227 AC_ARG_WITH(alloc,
2228     AS_HELP_STRING([--with-alloc],
2229         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2230          Note that on FreeBSD/NetBSD system==jemalloc]),
2233 AC_ARG_WITH(parallelism,
2234     AS_HELP_STRING([--with-parallelism],
2235         [Number of jobs to run simultaneously during build. Parallel builds can
2236         save a lot of time on multi-cpu machines. Defaults to the number of
2237         CPUs on the machine, unless you configure --enable-icecream - then to
2238         10.]),
2241 AC_ARG_WITH(all-tarballs,
2242     AS_HELP_STRING([--with-all-tarballs],
2243         [Download all external tarballs unconditionally]))
2245 AC_ARG_WITH(gdrive-client-id,
2246     AS_HELP_STRING([--with-gdrive-client-id],
2247         [Provides the client id of the application for OAuth2 authentication
2248         on Google Drive. If either this or --with-gdrive-client-secret is
2249         empty, the feature will be disabled]),
2252 AC_ARG_WITH(gdrive-client-secret,
2253     AS_HELP_STRING([--with-gdrive-client-secret],
2254         [Provides the client secret of the application for OAuth2
2255         authentication on Google Drive. If either this or
2256         --with-gdrive-client-id is empty, the feature will be disabled]),
2259 AC_ARG_WITH(alfresco-cloud-client-id,
2260     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2261         [Provides the client id of the application for OAuth2 authentication
2262         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2263         empty, the feature will be disabled]),
2266 AC_ARG_WITH(alfresco-cloud-client-secret,
2267     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2268         [Provides the client secret of the application for OAuth2
2269         authentication on Alfresco Cloud. If either this or
2270         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2273 AC_ARG_WITH(onedrive-client-id,
2274     AS_HELP_STRING([--with-onedrive-client-id],
2275         [Provides the client id of the application for OAuth2 authentication
2276         on OneDrive. If either this or --with-onedrive-client-secret is
2277         empty, the feature will be disabled]),
2280 AC_ARG_WITH(onedrive-client-secret,
2281     AS_HELP_STRING([--with-onedrive-client-secret],
2282         [Provides the client secret of the application for OAuth2
2283         authentication on OneDrive. If either this or
2284         --with-onedrive-client-id is empty, the feature will be disabled]),
2286 dnl ===================================================================
2287 dnl Do we want to use pre-build binary tarball for recompile
2288 dnl ===================================================================
2290 if test "$enable_library_bin_tar" = "yes" ; then
2291     USE_LIBRARY_BIN_TAR=TRUE
2292 else
2293     USE_LIBRARY_BIN_TAR=
2295 AC_SUBST(USE_LIBRARY_BIN_TAR)
2297 dnl ===================================================================
2298 dnl Test whether build target is Release Build
2299 dnl ===================================================================
2300 AC_MSG_CHECKING([whether build target is Release Build])
2301 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2302     AC_MSG_RESULT([no])
2303     ENABLE_RELEASE_BUILD=
2304 else
2305     AC_MSG_RESULT([yes])
2306     ENABLE_RELEASE_BUILD=TRUE
2308 AC_SUBST(ENABLE_RELEASE_BUILD)
2310 dnl ===================================================================
2311 dnl Test whether to sign Windows Build
2312 dnl ===================================================================
2313 AC_MSG_CHECKING([whether to sign windows build])
2314 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2315     AC_MSG_RESULT([yes])
2316     WINDOWS_BUILD_SIGNING="TRUE"
2317 else
2318     AC_MSG_RESULT([no])
2319     WINDOWS_BUILD_SIGNING="FALSE"
2321 AC_SUBST(WINDOWS_BUILD_SIGNING)
2323 dnl ===================================================================
2324 dnl MacOSX build and runtime environment options
2325 dnl ===================================================================
2327 AC_ARG_WITH(macosx-sdk,
2328     AS_HELP_STRING([--with-macosx-sdk=<version>],
2329         [Prefer a specific SDK for building.])
2330     [
2331                           If the requested SDK is not available, a search for the oldest one will be done.
2332                           With current Xcode versions, only the latest SDK is included, so this option is
2333                           not terribly useful. It works fine to build with a new SDK and run the result
2334                           on an older OS.
2336                           e. g.: --with-macosx-sdk=10.8
2338                           there are 3 options to control the MacOSX build:
2339                           --with-macosx-sdk (referred as 'sdk' below)
2340                           --with-macosx-version-min-required (referred as 'min' below)
2341                           --with-macosx-version-max-allowed (referred as 'max' below)
2343                           the connection between these value and the default they take is as follow:
2344                           ( ? means not specified on the command line, s means the SDK version found,
2345                           constraint: 8 <= x <= y <= z)
2347                           ==========================================
2348                            command line      || config result
2349                           ==========================================
2350                           min  | max  | sdk  || min  | max  | sdk  |
2351                           ?    | ?    | ?    || 10.8 | 10.s | 10.s |
2352                           ?    | ?    | 10.x || 10.8 | 10.x | 10.x |
2353                           ?    | 10.x | ?    || 10.8 | 10.s | 10.s |
2354                           ?    | 10.x | 10.y || 10.8 | 10.x | 10.y |
2355                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2356                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2357                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2358                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2361                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2362                           for a detailed technical explanation of these variables
2364                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2365     ],
2368 AC_ARG_WITH(macosx-version-min-required,
2369     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2370         [set the minimum OS version needed to run the built LibreOffice])
2371     [
2372                           e. g.: --with-macos-version-min-required=10.8
2373                           see --with-macosx-sdk for more info
2374     ],
2377 AC_ARG_WITH(macosx-version-max-allowed,
2378     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2379         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2380     [
2381                           e. g.: --with-macos-version-max-allowed=10.8
2382                           see --with-macosx-sdk for more info
2383     ],
2387 dnl ===================================================================
2388 dnl options for stuff used during cross-compilation build
2389 dnl Not quite superseded by --with-build-platform-configure-options.
2390 dnl TODO: check, if the "force" option is still needed anywhere.
2391 dnl ===================================================================
2393 AC_ARG_WITH(system-icu-for-build,
2394     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2395         [Use icu already on system for build tools (cross-compilation only).]))
2398 dnl ===================================================================
2399 dnl check for required programs (grep, awk, sed, bash)
2400 dnl ===================================================================
2402 pathmunge ()
2404     if test -n "$1"; then
2405         if test "$build_os" = "cygwin"; then
2406             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2407                 PathFormat "$1"
2408                 new_path=`cygpath -sm "$formatted_path"`
2409             else
2410                 PathFormat "$1"
2411                 new_path=`cygpath -u "$formatted_path"`
2412             fi
2413         else
2414             new_path="$1"
2415         fi
2416         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2417             if test "$2" = "after"; then
2418                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2419             else
2420                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2421             fi
2422         fi
2423         unset new_path
2424     fi
2427 AC_PROG_AWK
2428 AC_PATH_PROG( AWK, $AWK)
2429 if test -z "$AWK"; then
2430     AC_MSG_ERROR([install awk to run this script])
2433 AC_PATH_PROG(BASH, bash)
2434 if test -z "$BASH"; then
2435     AC_MSG_ERROR([bash not found in \$PATH])
2437 AC_SUBST(BASH)
2439 AC_MSG_CHECKING([for GNU or BSD tar])
2440 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2441     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2442     if test $? -eq 0;  then
2443         GNUTAR=$a
2444         break
2445     fi
2446 done
2447 AC_MSG_RESULT($GNUTAR)
2448 if test -z "$GNUTAR"; then
2449     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2451 AC_SUBST(GNUTAR)
2453 AC_MSG_CHECKING([for tar's option to strip components])
2454 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2455 if test $? -eq 0; then
2456     STRIP_COMPONENTS="--strip-components"
2457 else
2458     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2459     if test $? -eq 0; then
2460         STRIP_COMPONENTS="--strip-path"
2461     else
2462         STRIP_COMPONENTS="unsupported"
2463     fi
2465 AC_MSG_RESULT($STRIP_COMPONENTS)
2466 if test x$STRIP_COMPONENTS = xunsupported; then
2467     AC_MSG_ERROR([you need a tar that is able to strip components.])
2469 AC_SUBST(STRIP_COMPONENTS)
2471 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2472 dnl desktop OSes from "mobile" ones.
2474 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2475 dnl In other words, that when building for an OS that is not a
2476 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2478 dnl Note the direction of the implication; there is no assumption that
2479 dnl cross-compiling would imply a non-desktop OS.
2481 if test $_os != iOS -a $_os != Android; then
2482     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2483     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2484     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2487 DISABLE_EXPORT=''
2488 if test "$enable_export" != no; then
2489     BUILD_TYPE="$BUILD_TYPE EXPORT"
2490 else
2491     DISABLE_EXPORT='TRUE'
2492     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2494 AC_SUBST(DISABLE_EXPORT)
2496 # Whether to build "avmedia" functionality or not.
2498 if test -z "$enable_avmedia"; then
2499     enable_avmedia=yes
2502 if test "$enable_avmedia" = yes; then
2503     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2504     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2505 else
2506     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2509 # Decide whether to build database connectivity stuff (including
2510 # Base) or not. We probably don't want to on non-desktop OSes.
2512 if test -z "$enable_database_connectivity"; then
2513     # --disable-database-connectivity is unfinished work in progress
2514     # and the iOS test app doesn't link if we actually try to use it.
2515     # if test $_os != iOS -a $_os != Android; then
2516         enable_database_connectivity=yes
2517     # fi
2520 if test "$enable_database_connectivity" = yes; then
2521     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2522     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2525 if test -z "$enable_extensions"; then
2526     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2527     if test $_os != iOS -a $_os != Android; then
2528         enable_extensions=yes
2529     fi
2532 if test "$enable_extensions" = yes; then
2533     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2534     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2537 if test -z "$enable_scripting"; then
2538     # Disable scripting for iOS unless specifically overridden
2539     # with --enable-scripting.
2540     if test $_os != iOS; then
2541         enable_scripting=yes
2542     fi
2545 DISABLE_SCRIPTING=''
2546 if test "$enable_scripting" = yes; then
2547     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2548     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2549 else
2550     DISABLE_SCRIPTING='TRUE'
2551     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2554 if test $_os = iOS -o $_os = Android; then
2555     # Disable dynamic_loading always for iOS and Android
2556     enable_dynamic_loading=no
2557 elif test -z "$enable_dynamic_loading"; then
2558     # Otherwise enable it unless speficically disabled
2559     enable_dynamic_loading=yes
2562 DISABLE_DYNLOADING=''
2563 if test "$enable_dynamic_loading" = yes; then
2564     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2565 else
2566     DISABLE_DYNLOADING='TRUE'
2567     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2569 AC_SUBST(DISABLE_DYNLOADING)
2571 # remenber SYSBASE value
2572 AC_SUBST(SYSBASE)
2574 dnl ===================================================================
2575 dnl  Sort out various gallery compilation options
2576 dnl ===================================================================
2577 AC_MSG_CHECKING([how to build and package galleries])
2578 if test -n "${with_galleries}"; then
2579     if test "$with_galleries" = "build"; then
2580         WITH_GALLERY_BUILD=TRUE
2581         AC_MSG_RESULT([build from source images internally])
2582     elif test "$with_galleries" = "no"; then
2583         WITH_GALLERY_BUILD=
2584         AC_MSG_RESULT([disable non-internal gallery build])
2585     else
2586         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2587     fi
2588 else
2589     if test $_os != iOS -a $_os != Android; then
2590         WITH_GALLERY_BUILD=TRUE
2591         AC_MSG_RESULT([internal src images for desktop])
2592     else
2593         WITH_GALLERY_BUILD=
2594         AC_MSG_RESULT([disable src image build])
2595     fi
2597 AC_SUBST(WITH_GALLERY_BUILD)
2599 dnl ===================================================================
2600 dnl  Checks if ccache is available
2601 dnl ===================================================================
2602 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
2603     # on windows/VC build do not use ccache
2604     CCACHE=""
2605 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2606     case "%$CC%$CXX%" in
2607     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2608     # assume that's good then
2609     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2610         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2611         ;;
2612     *)
2613         AC_PATH_PROG([CCACHE],[ccache],[not found])
2614         if test "$CCACHE" = "not found"; then
2615             CCACHE=""
2616         else
2617             # Need to check for ccache version: otherwise prevents
2618             # caching of the results (like "-x objective-c++" for Mac)
2619             if test $_os = Darwin -o $_os = iOS; then
2620                 # Check ccache version
2621                 AC_MSG_CHECKING([whether version of ccache is suitable])
2622                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2623                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2624                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2625                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2626                 else
2627                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2628                     CCACHE=""
2629                 fi
2630             fi
2631         fi
2632         ;;
2633     esac
2634 else
2635     CCACHE=""
2638 if test "$CCACHE" != ""; then
2639     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2640     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2641     if test "$ccache_size" = ""; then
2642         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2643         if test "$ccache_size" = ""; then
2644             ccache_size=0
2645         fi
2646         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2647         if test $ccache_size -lt 1024; then
2648             CCACHE=""
2649             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2650             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2651         else
2652             # warn that ccache may be too small for debug build
2653             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2654             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2655         fi
2656     else
2657         if test $ccache_size -lt 5; then
2658             #warn that ccache may be too small for debug build
2659             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2660             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2661         fi
2662     fi
2665 dnl ===================================================================
2666 dnl  Checks for C compiler,
2667 dnl  The check for the C++ compiler is later on.
2668 dnl ===================================================================
2669 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2670     GCC_HOME_SET="true"
2671     AC_MSG_CHECKING([gcc home])
2672     if test -z "$with_gcc_home"; then
2673         if test "$enable_icecream" = "yes"; then
2674             if test -d "/usr/lib/icecc/bin"; then
2675                 GCC_HOME="/usr/lib/icecc/"
2676             else
2677                 GCC_HOME="/opt/icecream/"
2678             fi
2679         else
2680             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2681             GCC_HOME_SET="false"
2682         fi
2683     else
2684         GCC_HOME="$with_gcc_home"
2685     fi
2686     AC_MSG_RESULT($GCC_HOME)
2687     AC_SUBST(GCC_HOME)
2689     if test "$GCC_HOME_SET" = "true"; then
2690         if test -z "$CC"; then
2691             CC="$GCC_HOME/bin/gcc"
2692         fi
2693         if test -z "$CXX"; then
2694             CXX="$GCC_HOME/bin/g++"
2695         fi
2696     fi
2699 COMPATH=`dirname "$CC"`
2700 if test "$COMPATH" = "."; then
2701     AC_PATH_PROGS(COMPATH, $CC)
2702     dnl double square bracket to get single because of M4 quote...
2703     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2705 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2707 dnl ===================================================================
2708 dnl Java support
2709 dnl ===================================================================
2710 AC_MSG_CHECKING([whether to build with Java support])
2711 if test "$with_java" != "no"; then
2712     if test "$DISABLE_SCRIPTING" = TRUE; then
2713         AC_MSG_RESULT([no, overridden by --disable-scripting])
2714         ENABLE_JAVA=""
2715         with_java=no
2716     else
2717         AC_MSG_RESULT([yes])
2718         ENABLE_JAVA="TRUE"
2719         AC_DEFINE(HAVE_FEATURE_JAVA)
2720     fi
2721 else
2722     AC_MSG_RESULT([no])
2723     ENABLE_JAVA=""
2726 AC_SUBST(ENABLE_JAVA)
2728 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2730 dnl ENABLE_JAVA="" indicate no Java support at all
2732 dnl ===================================================================
2733 dnl Check OS X SDK and compiler
2734 dnl ===================================================================
2736 if test $_os = Darwin; then
2738     # If no --with-macosx-sdk option is given, look for one
2740     # The intent is that for "most" Mac-based developers, a suitable
2741     # SDK will be found automatically without any configure options.
2743     # For developers with a current Xcode, the lowest-numbered SDK
2744     # higher than or equal to the minimum required should be found.
2746     AC_MSG_CHECKING([what Mac OS X SDK to use])
2747     for _macosx_sdk in $with_macosx_sdk 10.8 10.9 10.10 10.11 10.12 10.13 10.14; do
2748         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2749         if test -d "$MACOSX_SDK_PATH"; then
2750             with_macosx_sdk="${_macosx_sdk}"
2751             break
2752         else
2753             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2754             if test -d "$MACOSX_SDK_PATH"; then
2755                 with_macosx_sdk="${_macosx_sdk}"
2756                 break
2757             fi
2758         fi
2759     done
2760     if test ! -d "$MACOSX_SDK_PATH"; then
2761         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2762     fi
2763     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2765     case $with_macosx_sdk in
2766     10.8)
2767         MACOSX_SDK_VERSION=1080
2768         ;;
2769     10.9)
2770         MACOSX_SDK_VERSION=1090
2771         ;;
2772     10.10)
2773         MACOSX_SDK_VERSION=101000
2774         ;;
2775     10.11)
2776         MACOSX_SDK_VERSION=101100
2777         ;;
2778     10.12)
2779         MACOSX_SDK_VERSION=101200
2780         ;;
2781     10.13)
2782         MACOSX_SDK_VERSION=101300
2783         ;;
2784     10.14)
2785         MACOSX_SDK_VERSION=101400
2786         ;;
2787     *)
2788         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.8--13])
2789         ;;
2790     esac
2792     if test "$with_macosx_version_min_required" = "" ; then
2793         with_macosx_version_min_required="10.8";
2794     fi
2796     if test "$with_macosx_version_max_allowed" = "" ; then
2797         with_macosx_version_max_allowed="$with_macosx_sdk"
2798     fi
2800     # export this so that "xcrun" invocations later return matching values
2801     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2802     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2803     export DEVELOPER_DIR
2804     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2805     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2807     case "$with_macosx_version_min_required" in
2808     10.8)
2809         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2810         ;;
2811     10.9)
2812         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2813         ;;
2814     10.10)
2815         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2816         ;;
2817     10.11)
2818         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2819         ;;
2820     10.12)
2821         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2822         ;;
2823     10.13)
2824         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2825         ;;
2826     10.14)
2827         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2828         ;;
2829     *)
2830         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.8--13])
2831         ;;
2832     esac
2834     LIBTOOL=/usr/bin/libtool
2835     INSTALL_NAME_TOOL=install_name_tool
2836     if test -z "$save_CC"; then
2837         AC_MSG_CHECKING([what compiler to use])
2838         stdlib=-stdlib=libc++
2839         if test "$ENABLE_LTO" = TRUE; then
2840             lto=-flto
2841         fi
2842         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2843         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2844         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2845         AR=`xcrun -find ar`
2846         NM=`xcrun -find nm`
2847         STRIP=`xcrun -find strip`
2848         LIBTOOL=`xcrun -find libtool`
2849         RANLIB=`xcrun -find ranlib`
2850         AC_MSG_RESULT([$CC and $CXX])
2851     fi
2853     case "$with_macosx_version_max_allowed" in
2854     10.8)
2855         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2856         ;;
2857     10.9)
2858         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2859         ;;
2860     10.10)
2861         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2862         ;;
2863     10.11)
2864         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2865         ;;
2866     10.12)
2867         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2868         ;;
2869     10.13)
2870         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2871         ;;
2872     10.14)
2873         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2874         ;;
2875     *)
2876         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.8--13])
2877         ;;
2878     esac
2880     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2881     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2882         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2883     else
2884         AC_MSG_RESULT([ok])
2885     fi
2887     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2888     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2889         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2890     else
2891         AC_MSG_RESULT([ok])
2892     fi
2893     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2894     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2896     AC_MSG_CHECKING([whether to do code signing])
2898     if test "$enable_macosx_code_signing" = yes; then
2899         # By default use the first suitable certificate (?).
2901         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2902         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2903         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2904         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2905         # "Developer ID Application" one.
2907         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2908         if test -n "$identity"; then
2909             MACOSX_CODESIGNING_IDENTITY=$identity
2910             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2911             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2912         else
2913             AC_MSG_ERROR([cannot determine identity to use])
2914         fi
2915     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2916         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2917         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2918         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2919     else
2920         AC_MSG_RESULT([no])
2921     fi
2923     AC_MSG_CHECKING([whether to create a Mac App Store package])
2925     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2926         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2927     elif test "$enable_macosx_package_signing" = yes; then
2928         # By default use the first suitable certificate.
2929         # It should be a "3rd Party Mac Developer Installer" one
2931         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2932         if test -n "$identity"; then
2933             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2934             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2935             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2936         else
2937             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2938         fi
2939     elif test -n "$enable_macosx_package_signing"; then
2940         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2941         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2942         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2943     else
2944         AC_MSG_RESULT([no])
2945     fi
2947     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2948         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2949     fi
2951     AC_MSG_CHECKING([whether to sandbox the application])
2953     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2954         AC_MSG_ERROR([OS X sandboxing requires code signing])
2955     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2956         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2957     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2958         ENABLE_MACOSX_SANDBOX=TRUE
2959         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2960         AC_MSG_RESULT([yes])
2961     else
2962         AC_MSG_RESULT([no])
2963     fi
2965     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2966     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2967     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2969 AC_SUBST(MACOSX_SDK_PATH)
2970 AC_SUBST(MACOSX_SDK_VERSION)
2971 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2972 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2973 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2974 AC_SUBST(INSTALL_NAME_TOOL)
2975 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2976 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2977 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2978 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2979 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2981 dnl ===================================================================
2982 dnl Check iOS SDK and compiler
2983 dnl ===================================================================
2985 if test $_os = iOS; then
2987     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2988         :
2989     else
2990         BITNESS_OVERRIDE=64
2991     fi
2993     AC_MSG_CHECKING([what iOS SDK to use])
2995     if test "$enable_ios_simulator" = yes; then
2996         platform=iPhoneSimulator
2997     else
2998         platform=iPhoneOS
2999     fi
3001     xcode_developer=`xcode-select -print-path`
3003     current_sdk_ver=9.3
3004     for sdkver in 10.0 9.3 9.2; do
3005         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3006         if test -d $t; then
3007             ios_sdk=$sdkver
3008             sysroot=$t
3009             break
3010         fi
3011     done
3013     if test -z "$sysroot"; then
3014         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3015     fi
3017     AC_MSG_RESULT($sysroot)
3019     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
3021     if test "$enable_ios_simulator" = yes; then
3022         if test "$BITNESS_OVERRIDE" = 64; then
3023             XCODE_ARCHS=x86_64
3024             versionmin=-mios-simulator-version-min=9.0
3025         else
3026             XCODE_ARCHS=i386
3027             versionmin=-mios-simulator-version-min=9.0
3028         fi
3029     else
3030         platform=iPhoneOS
3031         if test "$BITNESS_OVERRIDE" = 64; then
3032             XCODE_ARCHS=arm64
3033         else
3034             XCODE_ARCHS=armv7
3035         fi
3036         versionmin=-miphoneos-version-min=9.0
3037     fi
3039     # LTO is not really recommended for iOS builds,
3040     # the link time will be astronomical
3041     if test "$ENABLE_LTO" = TRUE; then
3042         lto=-flto
3043     fi
3044     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3045     # get compiled with it, to avoid ld warnings when linking all that together into one
3046     # executable.
3048     XCODE_CLANG_CXX_LIBRARY=libc++
3049     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3051     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3052     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3054     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3055     AR=`xcrun -find ar`
3056     NM=`xcrun -find nm`
3057     STRIP=`xcrun -find strip`
3058     LIBTOOL=`xcrun -find libtool`
3059     RANLIB=`xcrun -find ranlib`
3062 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3063 AC_SUBST(XCODE_ARCHS)
3064 AC_SUBST(XCODEBUILD_SDK)
3066 AC_MSG_CHECKING([whether to treat the installation as read-only])
3068 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3069         "$enable_extensions" != yes; then
3070     enable_readonly_installset=yes
3072 if test "$enable_readonly_installset" = yes; then
3073     AC_MSG_RESULT([yes])
3074     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3075 else
3076     AC_MSG_RESULT([no])
3079 dnl ===================================================================
3080 dnl Structure of install set
3081 dnl ===================================================================
3083 if test $_os = Darwin; then
3084     LIBO_BIN_FOLDER=MacOS
3085     LIBO_ETC_FOLDER=Resources
3086     LIBO_LIBEXEC_FOLDER=MacOS
3087     LIBO_LIB_FOLDER=Frameworks
3088     LIBO_LIB_PYUNO_FOLDER=Resources
3089     LIBO_SHARE_FOLDER=Resources
3090     LIBO_SHARE_HELP_FOLDER=Resources/help
3091     LIBO_SHARE_JAVA_FOLDER=Resources/java
3092     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3093     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3094     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3095     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3096     LIBO_URE_BIN_FOLDER=MacOS
3097     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3098     LIBO_URE_LIB_FOLDER=Frameworks
3099     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3100     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3101 elif test $_os = WINNT; then
3102     LIBO_BIN_FOLDER=program
3103     LIBO_ETC_FOLDER=program
3104     LIBO_LIBEXEC_FOLDER=program
3105     LIBO_LIB_FOLDER=program
3106     LIBO_LIB_PYUNO_FOLDER=program
3107     LIBO_SHARE_FOLDER=share
3108     LIBO_SHARE_HELP_FOLDER=help
3109     LIBO_SHARE_JAVA_FOLDER=program/classes
3110     LIBO_SHARE_PRESETS_FOLDER=presets
3111     LIBO_SHARE_READMES_FOLDER=readmes
3112     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3113     LIBO_SHARE_SHELL_FOLDER=program/shell
3114     LIBO_URE_BIN_FOLDER=program
3115     LIBO_URE_ETC_FOLDER=program
3116     LIBO_URE_LIB_FOLDER=program
3117     LIBO_URE_MISC_FOLDER=program
3118     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3119 else
3120     LIBO_BIN_FOLDER=program
3121     LIBO_ETC_FOLDER=program
3122     LIBO_LIBEXEC_FOLDER=program
3123     LIBO_LIB_FOLDER=program
3124     LIBO_LIB_PYUNO_FOLDER=program
3125     LIBO_SHARE_FOLDER=share
3126     LIBO_SHARE_HELP_FOLDER=help
3127     LIBO_SHARE_JAVA_FOLDER=program/classes
3128     LIBO_SHARE_PRESETS_FOLDER=presets
3129     LIBO_SHARE_READMES_FOLDER=readmes
3130     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3131     LIBO_SHARE_SHELL_FOLDER=program/shell
3132     LIBO_URE_BIN_FOLDER=program
3133     LIBO_URE_ETC_FOLDER=program
3134     LIBO_URE_LIB_FOLDER=program
3135     LIBO_URE_MISC_FOLDER=program
3136     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3138 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3139 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3140 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3141 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3142 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3143 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3144 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3145 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3146 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3147 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3148 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3149 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3150 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3151 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3152 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3153 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3155 # Not all of them needed in config_host.mk, add more if need arises
3156 AC_SUBST(LIBO_BIN_FOLDER)
3157 AC_SUBST(LIBO_ETC_FOLDER)
3158 AC_SUBST(LIBO_LIB_FOLDER)
3159 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3160 AC_SUBST(LIBO_SHARE_FOLDER)
3161 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3162 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3163 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3164 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3165 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3166 AC_SUBST(LIBO_URE_BIN_FOLDER)
3167 AC_SUBST(LIBO_URE_ETC_FOLDER)
3168 AC_SUBST(LIBO_URE_LIB_FOLDER)
3169 AC_SUBST(LIBO_URE_MISC_FOLDER)
3170 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3172 dnl ===================================================================
3173 dnl Windows specific tests and stuff
3174 dnl ===================================================================
3176 reg_get_value()
3178     # Return value: $regvalue
3179     unset regvalue
3181     local _regentry="/proc/registry${1}/${2}"
3182     if test -f "$_regentry"; then
3183         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3184         # Registry keys read via /proc/registry* are always \0 terminated!
3185         local _regvalue=$(tr -d '\0' < "$_regentry")
3186         if test $? -eq 0; then
3187             regvalue=$_regvalue
3188         fi
3189     fi
3192 # Get a value from the 32-bit side of the Registry
3193 reg_get_value_32()
3195     reg_get_value "32" "$1"
3198 # Get a value from the 64-bit side of the Registry
3199 reg_get_value_64()
3201     reg_get_value "64" "$1"
3204 if test "$_os" = "WINNT"; then
3205     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3206     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3207         AC_MSG_RESULT([no])
3208         WINDOWS_SDK_ARCH="x86"
3209     else
3210         AC_MSG_RESULT([yes])
3211         WINDOWS_SDK_ARCH="x64"
3212         BITNESS_OVERRIDE=64
3213     fi
3216 if test "$cross_compiling" = "yes"; then
3217     export CROSS_COMPILING=TRUE
3218     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3219 else
3220     CROSS_COMPILING=
3221     BUILD_TYPE="$BUILD_TYPE NATIVE"
3223 AC_SUBST(CROSS_COMPILING)
3225 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3226 if test "$GCC" = "yes"; then
3227     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3228     bsymbolic_functions_ldflags_save=$LDFLAGS
3229     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3230     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3231 #include <stdio.h>
3232         ],[
3233 printf ("hello world\n");
3234         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3235     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3236         AC_MSG_RESULT( found )
3237     else
3238         AC_MSG_RESULT( not found )
3239     fi
3240     LDFLAGS=$bsymbolic_functions_ldflags_save
3242 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3244 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3245 # NOTE: must _not_ be used for bundled external libraries!
3246 ISYSTEM=
3247 if test "$GCC" = "yes"; then
3248     AC_MSG_CHECKING( for -isystem )
3249     save_CFLAGS=$CFLAGS
3250     CFLAGS="$CFLAGS -Werror"
3251     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3252     CFLAGS=$save_CFLAGS
3253     if test -n "$ISYSTEM"; then
3254         AC_MSG_RESULT(yes)
3255     else
3256         AC_MSG_RESULT(no)
3257     fi
3259 if test -z "$ISYSTEM"; then
3260     # fall back to using -I
3261     ISYSTEM=-I
3263 AC_SUBST(ISYSTEM)
3265 dnl ===================================================================
3266 dnl  Check which Visual Studio or MinGW compiler is used
3267 dnl ===================================================================
3269 map_vs_year_to_version()
3271     # Return value: $vsversion
3273     unset vsversion
3275     case $1 in
3276     2013)
3277         vsversion=12.0;;
3278     2015)
3279         vsversion=14.0;;
3280     *)
3281         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3282     esac
3285 vs_versions_to_check()
3287     # Args: $1 (optional) : versions to check, in the order of preference
3288     # Return value: $vsversions
3290     unset vsversions
3292     if test -n "$1"; then
3293         map_vs_year_to_version "$1"
3294         vsversions=$vsversion
3295     else
3296         # By default we prefer 2013/2015, in this order
3297         vsversions="12.0 14.0"
3298     fi
3301 find_msvs()
3303     # Find Visual Studio 2013/2015
3304     # Args: $1 (optional) : versions to check, in the order of preference
3305     # Return value: $vstest
3307     unset vstest
3309     vs_versions_to_check "$1"
3311     for ver in $vsversions; do
3312         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3313         if test -n "$regvalue"; then
3314             vstest=$regvalue
3315             break
3316         fi
3317         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3318         if test -n "$regvalue"; then
3319             vstest=$regvalue
3320             break
3321         fi
3322     done
3325 win_get_env_from_vsvars32bat()
3327     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3328     echo -e "@setlocal\r\n" >> $WRAPPERBATCHFILEPATH
3329     echo -e "@call \"`cygpath -w $VC_PRODUCT_DIR`/../Common7/Tools/vsvars32.bat\"\r\n" >> $WRAPPERBATCHFILEPATH
3330     echo -e "@echo %$1%\r\n" >> $WRAPPERBATCHFILEPATH
3331     echo -e "@endlocal\r\n" >> $WRAPPERBATCHFILEPATH
3332     chmod +x $WRAPPERBATCHFILEPATH
3333     _win_get_env_from_vsvars32bat=$($WRAPPERBATCHFILEPATH | tr -d "\r")
3334     rm -f $WRAPPERBATCHFILEPATH
3335     echo $_win_get_env_from_vsvars32bat
3338 find_ucrt()
3340     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3341     if test -n "$regvalue"; then
3342         PathFormat "$regvalue"
3343         UCRTSDKDIR=$formatted_path
3344         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3345         UCRTVERSION=$regvalue
3346     fi
3347     if test -z "$UCRTSDKDIR"; then
3348         if test -f "$VC_PRODUCT_DIR/../Common7/Tools/vsvars32.bat"; then
3349             PathFormat "`win_get_env_from_vsvars32bat "UniversalCRTSdkDir"`"
3350             UCRTSDKDIR=$formatted_path
3351             UCRTVERSION=`win_get_env_from_vsvars32bat "UCRTVersion"`
3352         fi
3353     fi
3356 find_msvc()
3358     # Find Visual C++ 2013/2015
3359     # Args: $1 (optional) : The VS version year
3360     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3362     unset vctest vcnum vcnumwithdot vcexpress
3364     vs_versions_to_check "$1"
3366     for ver in $vsversions; do
3367         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3368         if test -n "$regvalue"; then
3369             vctest=$regvalue
3370             break
3371         fi
3372         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3373         if test -n "$regvalue"; then
3374             vctest=$regvalue
3375             break
3376         fi
3377     done
3378     if test -n "$vctest"; then
3379         vcnumwithdot=$ver
3380         case "$vcnumwithdot" in
3381         12.0)
3382             vcyear=2013
3383             vcnum=120
3384             ;;
3385         14.0)
3386             vcyear=2015
3387             vcnum=140
3388             ;;
3389         esac
3390         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$vcnumwithdot/Setup/VC/ProductDir
3391         if test -n "$regvalue" -a "$regvalue" = "$vctest" ; then
3392             vcexpress=Express
3393         fi
3394     fi
3397 SOLARINC=
3398 SHOWINCLUDES_PREFIX=
3399 MSBUILD_PATH=
3400 DEVENV=
3401 if test "$_os" = "WINNT"; then
3402     if test "$WITH_MINGW" != "yes"; then
3403         AC_MSG_CHECKING([Visual C++])
3405         find_msvc "$with_visual_studio"
3406         if test -z "$vctest"; then
3407             if test -n "$with_visual_studio"; then
3408                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3409             else
3410                 AC_MSG_ERROR([No Visual Studio 2013/2015 installation found])
3411             fi
3412         fi
3414         if test "$BITNESS_OVERRIDE" = ""; then
3415             if test -f "$vctest/bin/cl.exe"; then
3416                 VC_PRODUCT_DIR=$vctest
3417             else
3418                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3419             fi
3420         else
3421             if test -f "$vctest/bin/amd64/cl.exe"; then
3422                 VC_PRODUCT_DIR=$vctest
3423             else
3424                 if test -f "$vctest/bin/x86_amd64/cl.exe" -a "$vcexpress" = "Express"; then
3425                     VC_PRODUCT_DIR=$vctest
3426                 else
3427                     AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3428                 fi
3429             fi
3430         fi
3432         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3433         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3435         AC_MSG_CHECKING([Is Visual C++ Express])
3436         if test "$vcexpress" = "Express" ; then
3437             AC_MSG_RESULT([Yes])
3438         else
3439             AC_MSG_RESULT([No])
3440         fi
3442         UCRTSDKDIR=
3443         UCRTVERSION=
3445         AC_MSG_CHECKING([whether UCRT is needed for this compiler version])
3446         if test "$vcnum" = "120"; then
3447             AC_MSG_RESULT([No])
3448         else
3449             AC_MSG_RESULT([Yes])
3450             AC_MSG_CHECKING([for UCRT location])
3451             find_ucrt
3452             if test -n "$UCRTSDKDIR"; then
3453                 AC_MSG_RESULT([found])
3454                 PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3455                 ucrtincpath_formatted=$formatted_path
3456                 # SOLARINC is used for external modules and must be set too.
3457                 # And no, it's not sufficient to set SOLARINC only, as configure
3458                 # itself doesn't honour it.
3459                 SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3460                 CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3461                 CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3462                 CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3463             else
3464                 AC_MSG_ERROR([not found])
3465             fi
3466         fi
3467         AC_SUBST(UCRTSDKDIR)
3468         AC_SUBST(UCRTVERSION)
3470         # Find the proper version of MSBuild.exe to use based on the VS version
3471         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3472         if test -n "$regvalue" ; then
3473             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3474         fi
3476         # Find the version of devenv.exe
3477         DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
3478         if test ! -e "$DEVENV" -a "$vcnum" = "120"; then
3479             # for Visual Studio 2013 Express, fall back
3480             DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/WDExpress.exe"
3481         fi
3482         if test ! -e "$DEVENV"; then
3483             AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3484         fi
3486         dnl ===========================================================
3487         dnl  Check for the corresponding mspdb*.dll
3488         dnl ===========================================================
3490         MSPDB_PATH=
3492         if test "$BITNESS_OVERRIDE" = ""; then
3493             if test "$vcnum" = "120"; then
3494                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3495             else
3496                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3497             fi
3498         else
3499             if test "$vcexpress" = "Express"; then
3500                 MSPDB_PATH="$VC_PRODUCT_DIR/bin"
3501             else
3502                 MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3503             fi
3504         fi
3506         mspdbnum=$vcnum
3508         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3509             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3510         fi
3512         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3513         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3515         dnl The path needs to be added before cl is called
3516         PATH="$MSPDB_PATH:$PATH"
3518         AC_MSG_CHECKING([cl.exe])
3520         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3521         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3522         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3523         # is not enough?
3525         if test -z "$CC"; then
3526             if test "$BITNESS_OVERRIDE" = ""; then
3527                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3528                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3529                 fi
3530             else
3531                 if test "$vcexpress" = "Express"; then
3532                    if test -f "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"; then
3533                         CC="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3534                    fi
3535                 else
3536                    if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3537                         CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3538                    fi
3539                 fi
3540             fi
3542             # This gives us a posix path with 8.3 filename restrictions
3543             CC=`win_short_path_for_make "$CC"`
3544         fi
3546         if test -n "$CC"; then
3547             # Remove /cl.exe from CC case insensitive
3548             AC_MSG_RESULT([found Visual C++ $vcyear $vcexpress ($CC)])
3549             if test "$BITNESS_OVERRIDE" = ""; then
3550                 COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3551             else
3552                 if test -n "$VC_PRODUCT_DIR"; then
3553                     COMPATH=$VC_PRODUCT_DIR
3554                 fi
3555             fi
3556             if test "$BITNESS_OVERRIDE" = ""; then
3557                 dnl since MSVC 2012, default for x86 is -arch:SSE2:
3558                 CC="$CC -arch:SSE"
3559             fi
3560             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3562             PathFormat "$COMPATH"
3563             COMPATH="$formatted_path"
3565             VCVER=$vcnum
3566             MSVSVER=$vcyear
3568             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3569             # are always "better", we list them in reverse chronological order.
3571             case $vcnum in
3572             120)
3573                 COMEX=15
3574                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0 7.1A"
3575                 ;;
3576             140)
3577                 COMEX=19
3578                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0A 10.0 8.1A 8.1 8.0 7.1A"
3579                 ;;
3580             esac
3582             # The expectation is that --with-windows-sdk should not need to be used
3583             if test -n "$with_windows_sdk"; then
3584                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3585                 *" "$with_windows_sdk" "*)
3586                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3587                     ;;
3588                 *)
3589                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3590                     ;;
3591                 esac
3592             fi
3594             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3595             ac_objext=obj
3596             ac_exeext=exe
3598         else
3599             AC_MSG_ERROR([Visual C++ not found after all, huh])
3600         fi
3602         dnl We need to guess the prefix of the -showIncludes output, it can be
3603         dnl localized
3604         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3605         echo "#include <stdlib.h>" > conftest.c
3606         dnl Filter out -FIIntrin.h when CC points at clang-cl.exe and needs to
3607         dnl explicitly state that argument:
3608         my_CC=
3609         for i in $CC; do
3610             case $i in
3611             -FIIntrin.h)
3612                 ;;
3613             *)
3614                 my_CC="$my_CC $i"
3615                 ;;
3616             esac
3617         done
3618         SHOWINCLUDES_PREFIX=`$my_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3619             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3620         rm -f conftest.c conftest.obj
3621         if test -z "$SHOWINCLUDES_PREFIX"; then
3622             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3623         else
3624             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3625         fi
3627         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3628         # version of the Explorer extension (and maybe other small
3629         # bits, too) needed when installing a 32-bit LibreOffice on a
3630         # 64-bit OS. The 64-bit Explorer extension is a feature that
3631         # has been present since long in OOo. Don't confuse it with
3632         # building LibreOffice itself as 64-bit code.
3634         BUILD_X64=
3635         CXX_X64_BINARY=
3636         LINK_X64_BINARY=
3638         if test "$BITNESS_OVERRIDE" = ""; then
3639             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3640             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3641                 # Prefer native x64 compiler to cross-compiler, in case we are running
3642                 # the build on a 64-bit OS.
3643                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3644                     BUILD_X64=TRUE
3645                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3646                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3647                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3648                     BUILD_X64=TRUE
3649                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3650                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3651                 fi
3652             fi
3653             if test "$BUILD_X64" = TRUE; then
3654                 AC_MSG_RESULT([found])
3655             else
3656                 AC_MSG_RESULT([not found])
3657                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3658             fi
3659         fi
3660         AC_SUBST(BUILD_X64)
3662         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3663         AC_SUBST(CXX_X64_BINARY)
3664         AC_SUBST(LINK_X64_BINARY)
3665     else
3666         AC_MSG_CHECKING([the compiler is MinGW])
3667         MACHINE_PREFIX=`$CC -dumpmachine`
3668         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3669             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3670             AC_MSG_RESULT([yes])
3671         else
3672             AC_MSG_ERROR([Compiler is not MinGW.])
3673         fi
3674     fi
3676 AC_SUBST(VCVER)
3677 AC_SUBST(DEVENV)
3678 PathFormat "$MSPDB_PATH"
3679 MSPDB_PATH="$formatted_path"
3680 AC_SUBST(SHOWINCLUDES_PREFIX)
3682 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3683     AC_MSG_CHECKING([whether to use DirectX])
3684     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3685         ENABLE_DIRECTX="TRUE"
3686         AC_MSG_RESULT([yes])
3687     else
3688         ENABLE_DIRECTX=""
3689         AC_MSG_RESULT([no])
3690     fi
3692     AC_MSG_CHECKING([whether to use ActiveX])
3693     if test "$enable_activex" = "yes" -o "$enable_activex" = "" -a "$vcexpress" != Express; then
3694         DISABLE_ACTIVEX=""
3695         AC_MSG_RESULT([yes])
3696     else
3697         DISABLE_ACTIVEX="TRUE"
3698         AC_MSG_RESULT([no])
3699     fi
3701     AC_MSG_CHECKING([whether to use ATL])
3702     if test "$enable_atl" = "yes" -o "$enable_atl" = "" -a "$vcexpress" != Express; then
3703         DISABLE_ATL=""
3704         AC_DEFINE(HAVE_FEATURE_ATL, 1)
3705         AC_MSG_RESULT([yes])
3706     else
3707         DISABLE_ATL="TRUE"
3708         AC_MSG_RESULT([no])
3709     fi
3710 else
3711     ENABLE_DIRECTX=""
3712     DISABLE_ACTIVEX="TRUE"
3713     DISABLE_ATL="TRUE"
3716 AC_SUBST(ENABLE_DIRECTX)
3717 AC_SUBST(DISABLE_ACTIVEX)
3718 AC_SUBST(DISABLE_ATL)
3721 # dbghelp.dll
3723 if test "$_os" = "WINNT"; then
3724     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3728 # unowinreg.dll
3730 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3731 AC_SUBST(UNOWINREG_DLL)
3733 COM_IS_CLANG=
3734 AC_MSG_CHECKING([whether the compiler is actually Clang])
3735 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3736     #ifndef __clang__
3737     you lose
3738     #endif
3739     int foo=42;
3740     ]])],
3741     [AC_MSG_RESULT([yes])
3742      COM_IS_CLANG=TRUE],
3743     [AC_MSG_RESULT([no])])
3745 if test "$COM_IS_CLANG" = TRUE; then
3746     AC_MSG_CHECKING([the Clang version])
3747     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | ${CC%-cl.exe*} -E -P -`
3748     CLANG_FULL_VERSION=`echo __clang_version__ | ${CC%-cl.exe*} -E -P -`
3749     CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3750     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3751     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3752     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3754 AC_SUBST(COM_IS_CLANG)
3757 # prefix C with ccache if needed
3759 if test "$CCACHE" != ""; then
3760     AC_MSG_CHECKING([whether $CC is already ccached])
3762     AC_LANG_PUSH([C])
3763     save_CFLAGS=$CFLAGS
3764     CFLAGS="$CFLAGS --ccache-skip -O2"
3765     dnl an empty program will do, we're checking the compiler flags
3766     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3767                       [use_ccache=yes], [use_ccache=no])
3768     if test $use_ccache = yes; then
3769         AC_MSG_RESULT([yes])
3770     else
3771         CC="$CCACHE $CC"
3772         AC_MSG_RESULT([no])
3773     fi
3774     CFLAGS=$save_CFLAGS
3775     AC_LANG_POP([C])
3778 # ===================================================================
3779 # check various GCC options that Clang does not support now but maybe
3780 # will somewhen in the future, check them even for GCC, so that the
3781 # flags are set
3782 # ===================================================================
3784 HAVE_GCC_GGDB2=
3785 HAVE_GCC_FINLINE_LIMIT=
3786 HAVE_GCC_FNO_INLINE=
3787 if test "$GCC" = "yes"; then
3788     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3789     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3790         # Option just ignored and silly warning that isn't a real
3791         # warning printed
3792         :
3793     else
3794         save_CFLAGS=$CFLAGS
3795         CFLAGS="$CFLAGS -Werror -ggdb2"
3796         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3797         CFLAGS=$save_CFLAGS
3798     fi
3799     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3800         AC_MSG_RESULT([yes])
3801     else
3802         AC_MSG_RESULT([no])
3803     fi
3805     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3806     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3807         # As above
3808         :
3809     else
3810         save_CFLAGS=$CFLAGS
3811         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3812         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3813         CFLAGS=$save_CFLAGS
3814     fi
3815     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3816         AC_MSG_RESULT([yes])
3817     else
3818         AC_MSG_RESULT([no])
3819     fi
3821     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3822     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3823         # Ditto
3824         :
3825     else
3826         save_CFLAGS=$CFLAGS
3827         CFLAGS="$CFLAGS -Werror -fno-inline"
3828         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3829         CFLAGS=$save_CFLAGS
3830     fi
3831     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3832         AC_MSG_RESULT([yes])
3833     else
3834         AC_MSG_RESULT([no])
3835     fi
3837 AC_SUBST(HAVE_GCC_GGDB2)
3838 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3839 AC_SUBST(HAVE_GCC_FNO_INLINE)
3841 dnl ===================================================================
3842 dnl  Test the gcc version
3843 dnl ===================================================================
3844 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3845     AC_MSG_CHECKING([the GCC version])
3846     _gcc_version=`$CC -dumpversion`
3847     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3849     AC_MSG_RESULT([gcc $_gcc_version])
3851     if test "$GCC_VERSION" -lt 0407; then
3852         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.7.0])
3853     fi
3854 else
3855     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3856     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3857     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3858     # (which reports itself as GCC 4.2.1).
3859     GCC_VERSION=
3861 AC_SUBST(GCC_VERSION)
3863 dnl Set the ENABLE_DBGUTIL variable
3864 dnl ===================================================================
3865 AC_MSG_CHECKING([whether to build with additional debug utilities])
3866 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3867     ENABLE_DBGUTIL="TRUE"
3868     # this is an extra var so it can have different default on different MSVC
3869     # versions (in case there are version specific problems with it)
3870     MSVC_USE_DEBUG_RUNTIME="TRUE"
3872     AC_MSG_RESULT([yes])
3873     # cppunit and graphite expose STL in public headers
3874     if test "$with_system_cppunit" = "yes"; then
3875         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3876     else
3877         with_system_cppunit=no
3878     fi
3879     if test "$with_system_graphite" = "yes"; then
3880         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3881     else
3882         with_system_graphite=no
3883     fi
3884     if test "$with_system_mysql_cppconn" = "yes"; then
3885         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3886     else
3887         with_system_mysql_cppconn=no
3888     fi
3889     if test "$with_system_orcus" = "yes"; then
3890         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3891     else
3892         with_system_orcus=no
3893     fi
3894     if test "$with_system_libcmis" = "yes"; then
3895         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3896     else
3897         with_system_libcmis=no
3898     fi
3899     if test "$with_system_libgltf" = "yes"; then
3900         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3901     else
3902         with_system_libgltf=no
3903     fi
3904     if test "$with_system_hunspell" = "yes"; then
3905         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3906     else
3907         with_system_hunspell=no
3908     fi
3909 else
3910     ENABLE_DBGUTIL=""
3911     MSVC_USE_DEBUG_RUNTIME=""
3912     AC_MSG_RESULT([no])
3914 AC_SUBST(ENABLE_DBGUTIL)
3915 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3917 dnl Set the ENABLE_DEBUG variable.
3918 dnl ===================================================================
3919 AC_MSG_CHECKING([whether to do a debug build])
3920 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3921     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3923 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3924     AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3927 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3928     ENABLE_DEBUG="TRUE"
3929     if test -n "$ENABLE_DBGUTIL" ; then
3930         AC_MSG_RESULT([yes (dbgutil)])
3931     else
3932         AC_MSG_RESULT([yes])
3933     fi
3934 else
3935     ENABLE_DEBUG=""
3936     AC_MSG_RESULT([no])
3938 AC_SUBST(ENABLE_DEBUG)
3940 if test "$enable_sal_log" = yes; then
3941     ENABLE_SAL_LOG=TRUE
3943 AC_SUBST(ENABLE_SAL_LOG)
3945 dnl Selective debuginfo
3946 ENABLE_DEBUGINFO_FOR=
3947 if test -n "$ENABLE_DEBUG"; then
3948     AC_MSG_CHECKING([whether to use selective debuginfo])
3949     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3950         if test "$enable_selective_debuginfo" = "yes"; then
3951             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3952         fi
3953         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3954         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3955     else
3956         ENABLE_DEBUGINFO_FOR=all
3957         AC_MSG_RESULT([no, for all])
3958     fi
3959 else
3960     if test -n "$enable_selective_debuginfo"; then
3961         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3962     fi
3964 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3966 dnl Check for enable symbols option
3967 dnl ===================================================================
3968 AC_MSG_CHECKING([whether to generate debug information])
3969 if test -z "$enable_symbols"; then
3970     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3971         enable_symbols=yes
3972     else
3973         enable_symbols=no
3974     fi
3976 if test "$enable_symbols" != no; then
3977     ENABLE_SYMBOLS=TRUE
3978     AC_MSG_RESULT([yes])
3979 else
3980     ENABLE_SYMBOLS=
3981     AC_MSG_RESULT([no])
3983 AC_SUBST(ENABLE_SYMBOLS)
3985 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3986     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3987     AC_MSG_CHECKING([whether enough memory is available for linking])
3988     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3989     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3990     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3991         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3992     else
3993         AC_MSG_RESULT([yes])
3994     fi
3997 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3998 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3999 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
4000 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
4001 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
4002     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
4004 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
4006 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
4007 # By default use the ones specified by our build system,
4008 # but explicit override is possible.
4009 AC_MSG_CHECKING(for explicit AFLAGS)
4010 if test -n "$AFLAGS"; then
4011     AC_MSG_RESULT([$AFLAGS])
4012     x_AFLAGS=
4013 else
4014     AC_MSG_RESULT(no)
4015     x_AFLAGS=[\#]
4017 AC_MSG_CHECKING(for explicit CFLAGS)
4018 if test -n "$CFLAGS"; then
4019     AC_MSG_RESULT([$CFLAGS])
4020     x_CFLAGS=
4021 else
4022     AC_MSG_RESULT(no)
4023     x_CFLAGS=[\#]
4025 AC_MSG_CHECKING(for explicit CXXFLAGS)
4026 if test -n "$CXXFLAGS"; then
4027     AC_MSG_RESULT([$CXXFLAGS])
4028     x_CXXFLAGS=
4029 else
4030     AC_MSG_RESULT(no)
4031     x_CXXFLAGS=[\#]
4033 AC_MSG_CHECKING(for explicit OBJCFLAGS)
4034 if test -n "$OBJCFLAGS"; then
4035     AC_MSG_RESULT([$OBJCFLAGS])
4036     x_OBJCFLAGS=
4037 else
4038     AC_MSG_RESULT(no)
4039     x_OBJCFLAGS=[\#]
4041 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
4042 if test -n "$OBJCXXFLAGS"; then
4043     AC_MSG_RESULT([$OBJCXXFLAGS])
4044     x_OBJCXXFLAGS=
4045 else
4046     AC_MSG_RESULT(no)
4047     x_OBJCXXFLAGS=[\#]
4049 AC_MSG_CHECKING(for explicit LDFLAGS)
4050 if test -n "$LDFLAGS"; then
4051     AC_MSG_RESULT([$LDFLAGS])
4052     x_LDFLAGS=
4053 else
4054     AC_MSG_RESULT(no)
4055     x_LDFLAGS=[\#]
4057 AC_SUBST(AFLAGS)
4058 AC_SUBST(CFLAGS)
4059 AC_SUBST(CXXFLAGS)
4060 AC_SUBST(OBJCFLAGS)
4061 AC_SUBST(OBJCXXFLAGS)
4062 AC_SUBST(LDFLAGS)
4063 AC_SUBST(x_AFLAGS)
4064 AC_SUBST(x_CFLAGS)
4065 AC_SUBST(x_CXXFLAGS)
4066 AC_SUBST(x_OBJCFLAGS)
4067 AC_SUBST(x_OBJCXXFLAGS)
4068 AC_SUBST(x_LDFLAGS)
4071 # determine CPUNAME, OS, ...
4072 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4074 case "$host_os" in
4076 aix*)
4077     COM=GCC
4078     CPUNAME=POWERPC
4079     USING_X11=TRUE
4080     OS=AIX
4081     RTL_OS=AIX
4082     RTL_ARCH=PowerPC
4083     PLATFORMID=aix_powerpc
4084     P_SEP=:
4085     ;;
4087 cygwin*)
4088     COM=MSC
4089     USING_X11=
4090     OS=WNT
4091     RTL_OS=Windows
4092     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4093         P_SEP=";"
4094     else
4095         P_SEP=:
4096     fi
4097     case "$host_cpu" in
4098     i*86|x86_64)
4099         if test "$BITNESS_OVERRIDE" = 64; then
4100             CPUNAME=X86_64
4101             RTL_ARCH=X86_64
4102             PLATFORMID=windows_x86_64
4103             WINDOWS_X64=1
4104             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4105         else
4106             CPUNAME=INTEL
4107             RTL_ARCH=x86
4108             PLATFORMID=windows_x86
4109         fi
4110         ;;
4111     *)
4112         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4113         ;;
4114     esac
4115     SCPDEFS="$SCPDEFS -D_MSC_VER"
4116     ;;
4118 darwin*)
4119     COM=GCC
4120     USING_X11=
4121     OS=MACOSX
4122     RTL_OS=MacOSX
4123     P_SEP=:
4125     case "$host_cpu" in
4126     arm*)
4127         CPUNAME=ARM
4128         RTL_ARCH=ARM_EABI
4129         PLATFORMID=ios_arm
4130         OS=IOS
4131         ;;
4132     i*86)
4133         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4134         ;;
4135     x86_64)
4136         CPUNAME=X86_64
4137         RTL_ARCH=X86_64
4138         PLATFORMID=macosx_x86_64
4139         ;;
4140     *)
4141         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4142         ;;
4143     esac
4144     ;;
4146 dragonfly*)
4147     COM=GCC
4148     USING_X11=TRUE
4149     OS=DRAGONFLY
4150     RTL_OS=DragonFly
4151     P_SEP=:
4153     case "$host_cpu" in
4154     i*86)
4155         CPUNAME=INTEL
4156         RTL_ARCH=x86
4157         PLATFORMID=dragonfly_x86
4158         ;;
4159     x86_64)
4160         CPUNAME=X86_64
4161         RTL_ARCH=X86_64
4162         PLATFORMID=dragonfly_x86_64
4163         ;;
4164     *)
4165         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4166         ;;
4167     esac
4168     ;;
4170 freebsd*)
4171     COM=GCC
4172     USING_X11=TRUE
4173     RTL_OS=FreeBSD
4174     OS=FREEBSD
4175     P_SEP=:
4177     case "$host_cpu" in
4178     i*86)
4179         CPUNAME=INTEL
4180         RTL_ARCH=x86
4181         PLATFORMID=freebsd_x86
4182         ;;
4183     x86_64|amd64)
4184         CPUNAME=X86_64
4185         RTL_ARCH=X86_64
4186         PLATFORMID=freebsd_x86_64
4187         ;;
4188     *)
4189         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4190         ;;
4191     esac
4192     ;;
4194 kfreebsd*)
4195     COM=GCC
4196     USING_X11=TRUE
4197     OS=LINUX
4198     RTL_OS=kFreeBSD
4199     P_SEP=:
4201     case "$host_cpu" in
4203     i*86)
4204         CPUNAME=INTEL
4205         RTL_ARCH=x86
4206         PLATFORMID=kfreebsd_x86
4207         ;;
4208     x86_64)
4209         CPUNAME=X86_64
4210         RTL_ARCH=X86_64
4211         PLATFORMID=kfreebsd_x86_64
4212         ;;
4213     *)
4214         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4215         ;;
4216     esac
4217     ;;
4219 linux-gnu*)
4220     COM=GCC
4221     USING_X11=TRUE
4222     OS=LINUX
4223     RTL_OS=Linux
4224     P_SEP=:
4226     case "$host_cpu" in
4228     aarch64)
4229         CPUNAME=AARCH64
4230         PLATFORMID=linux_aarch64
4231         RTL_ARCH=AARCH64
4232         ;;
4233     alpha)
4234         CPUNAME=AXP
4235         RTL_ARCH=ALPHA
4236         PLATFORMID=linux_alpha
4237         ;;
4238     arm*)
4239         CPUNAME=ARM
4240         EPM_FLAGS="-a arm"
4241         RTL_ARCH=ARM_EABI
4242         PLATFORMID=linux_arm_eabi
4243         case "$host_cpu" in
4244         arm*-linux)
4245             RTL_ARCH=ARM_OABI
4246             PLATFORMID=linux_arm_oabi
4247             ;;
4248         esac
4249         ;;
4250     hppa)
4251         CPUNAME=HPPA
4252         RTL_ARCH=HPPA
4253         EPM_FLAGS="-a hppa"
4254         PLATFORMID=linux_hppa
4255         ;;
4256     i*86)
4257         CPUNAME=INTEL
4258         RTL_ARCH=x86
4259         PLATFORMID=linux_x86
4260         ;;
4261     ia64)
4262         CPUNAME=IA64
4263         RTL_ARCH=IA64
4264         PLATFORMID=linux_ia64
4265         ;;
4266     mips)
4267         CPUNAME=GODSON
4268         RTL_ARCH=MIPS_EB
4269         EPM_FLAGS="-a mips"
4270         PLATFORMID=linux_mips_eb
4271         ;;
4272     mips64)
4273         CPUNAME=GODSON64
4274         RTL_ARCH=MIPS64_EB
4275         EPM_FLAGS="-a mips64"
4276         PLATFORMID=linux_mips64_eb
4277         ;;
4278     mips64el)
4279         CPUNAME=GODSON64
4280         RTL_ARCH=MIPS64_EL
4281         EPM_FLAGS="-a mips64el"
4282         PLATFORMID=linux_mips64_el
4283         ;;
4284     mipsel)
4285         CPUNAME=GODSON
4286         RTL_ARCH=MIPS_EL
4287         EPM_FLAGS="-a mipsel"
4288         PLATFORMID=linux_mips_el
4289         ;;
4290     m68k)
4291         CPUNAME=M68K
4292         RTL_ARCH=M68K
4293         PLATFORMID=linux_m68k
4294         ;;
4295     powerpc)
4296         CPUNAME=POWERPC
4297         RTL_ARCH=PowerPC
4298         PLATFORMID=linux_powerpc
4299         ;;
4300     powerpc64)
4301         CPUNAME=POWERPC64
4302         RTL_ARCH=PowerPC_64
4303         PLATFORMID=linux_powerpc64
4304         ;;
4305     powerpc64le)
4306         CPUNAME=POWERPC64
4307         RTL_ARCH=PowerPC_64_LE
4308         PLATFORMID=linux_powerpc64_le
4309         ;;
4310     sparc)
4311         CPUNAME=SPARC
4312         RTL_ARCH=SPARC
4313         PLATFORMID=linux_sparc
4314         ;;
4315     sparc64)
4316         CPUNAME=SPARC64
4317         RTL_ARCH=SPARC64
4318         PLATFORMID=linux_sparc64
4319         ;;
4320     s390)
4321         CPUNAME=S390
4322         RTL_ARCH=S390
4323         PLATFORMID=linux_s390
4324         ;;
4325     s390x)
4326         CPUNAME=S390X
4327         RTL_ARCH=S390x
4328         PLATFORMID=linux_s390x
4329         ;;
4330     x86_64)
4331         CPUNAME=X86_64
4332         RTL_ARCH=X86_64
4333         PLATFORMID=linux_x86_64
4334         ;;
4335     *)
4336         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4337         ;;
4338     esac
4339     ;;
4341 linux-android*)
4342     COM=GCC
4343     USING_X11=
4344     OS=ANDROID
4345     RTL_OS=Android
4346     P_SEP=:
4348     case "$host_cpu" in
4350     arm|armel)
4351         CPUNAME=ARM
4352         RTL_ARCH=ARM_EABI
4353         PLATFORMID=android_arm_eabi
4354         ;;
4355     aarch64)
4356         CPUNAME=AARCH64
4357         RTL_ARCH=AARCH64
4358         PLATFORMID=android_aarch64
4359         ;;
4360     mips|mipsel)
4361         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4362         RTL_ARCH=MIPS_EL
4363         PLATFORMID=android_mips_el
4364         ;;
4365     i*86)
4366         CPUNAME=INTEL
4367         RTL_ARCH=x86
4368         PLATFORMID=android_x86
4369         ;;
4370     *)
4371         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4372         ;;
4373     esac
4374     ;;
4376 emscripten*)
4377     COM=emcc
4378     USING_X11=
4379     OS=EMSCRIPTEN
4380     RTL_OS=Emscripten
4381     P_SEP=:
4382     CPUNAME=INTEL
4383     RTL_ARCH=x86
4384     PLATFORMID=linux_x86
4385     ;;
4387 mingw*)
4388     COM=GCC
4389     USING_X11=
4390     OS=WNT
4391     RTL_OS=Windows
4392     P_SEP=:
4394     case "$host_cpu" in
4395     i*86|x86_64)
4396         if test "$BITNESS_OVERRIDE" = 64; then
4397             CPUNAME=X86_64
4398             RTL_ARCH=X86_84
4399             PLATFORMID=windows_x86_64
4400             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4401         else
4402             CPUNAME=INTEL
4403             RTL_ARCH=x86
4404             PLATFORMID=windows_x86
4405             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4406         fi
4407         ;;
4408     *)
4409         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4410         ;;
4411     esac
4412     ;;
4414 *netbsd*)
4415     COM=GCC
4416     USING_X11=TRUE
4417     OS=NETBSD
4418     RTL_OS=NetBSD
4419     P_SEP=:
4421     case "$host_cpu" in
4422     i*86)
4423         CPUNAME=INTEL
4424         RTL_ARCH=x86
4425         PLATFORMID=netbsd_x86
4426         ;;
4427     powerpc)
4428         CPUNAME=POWERPC
4429         RTL_ARCH=PowerPC
4430         PLATFORMID=netbsd_powerpc
4431         ;;
4432     sparc)
4433         CPUNAME=SPARC
4434         RTL_ARCH=SPARC
4435         PLATFORMID=netbsd_sparc
4436         ;;
4437     x86_64)
4438         CPUNAME=X86_64
4439         RTL_ARCH=X86_64
4440         PLATFORMID=netbsd_x86_64
4441         ;;
4442     *)
4443         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4444         ;;
4445     esac
4446     ;;
4448 openbsd*)
4449     COM=GCC
4450     USING_X11=TRUE
4451     OS=OPENBSD
4452     RTL_OS=OpenBSD
4453     P_SEP=:
4455     case "$host_cpu" in
4456     i*86)
4457         CPUNAME=INTEL
4458         RTL_ARCH=x86
4459         PLATFORMID=openbsd_x86
4460         ;;
4461     x86_64)
4462         CPUNAME=X86_64
4463         RTL_ARCH=X86_64
4464         PLATFORMID=openbsd_x86_64
4465         ;;
4466     *)
4467         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4468         ;;
4469     esac
4470     SOLARINC="$SOLARINC -I/usr/local/include"
4471     ;;
4473 solaris*)
4474     COM=GCC
4475     USING_X11=TRUE
4476     OS=SOLARIS
4477     RTL_OS=Solaris
4478     P_SEP=:
4480     case "$host_cpu" in
4481     i*86)
4482         CPUNAME=INTEL
4483         RTL_ARCH=x86
4484         PLATFORMID=solaris_x86
4485         ;;
4486     sparc)
4487         CPUNAME=SPARC
4488         RTL_ARCH=SPARC
4489         PLATFORMID=solaris_sparc
4490         ;;
4491     sparc64)
4492         CPUNAME=SPARC64
4493         RTL_ARCH=SPARC64
4494         PLATFORMID=solaris_sparc64
4495         ;;
4496     *)
4497         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4498         ;;
4499     esac
4500     SOLARINC="$SOLARINC -I/usr/local/include"
4501     ;;
4504     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4505     ;;
4506 esac
4508 if test "$with_x" = "no"; then
4509     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4512 ENABLE_HEADLESS=""
4513 if test "$enable_gui" = "no"; then
4514     if test "$USING_X11" != TRUE; then
4515         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4516     fi
4517     USING_X11=
4518     ENABLE_HEADLESS=TRUE
4519     AC_DEFINE(HAVE_FEATURE_UI,0)
4520     test_cairo=yes
4522 AC_SUBST(ENABLE_HEADLESS)
4524 WORKDIR="${BUILDDIR}/workdir"
4525 INSTDIR="${BUILDDIR}/instdir"
4526 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4527 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4528 AC_SUBST(COM)
4529 AC_SUBST(CPUNAME)
4530 AC_SUBST(RTL_OS)
4531 AC_SUBST(RTL_ARCH)
4532 AC_SUBST(EPM_FLAGS)
4533 AC_SUBST(USING_X11)
4534 AC_SUBST([INSTDIR])
4535 AC_SUBST([INSTROOT])
4536 AC_SUBST(OS)
4537 AC_SUBST(P_SEP)
4538 AC_SUBST(WORKDIR)
4539 AC_SUBST(PLATFORMID)
4540 AC_SUBST(WINDOWS_X64)
4541 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4543 dnl ===================================================================
4544 dnl Test which package format to use
4545 dnl ===================================================================
4546 AC_MSG_CHECKING([which package format to use])
4547 if test -n "$with_package_format" -a "$with_package_format" != no; then
4548     for i in $with_package_format; do
4549         case "$i" in
4550         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4551             ;;
4552         *)
4553             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4554 aix - AIX software distribution
4555 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4556 deb - Debian software distribution
4557 pkg - Solaris software distribution
4558 rpm - RedHat software distribution
4560 LibreOffice additionally supports:
4561 archive - .tar.gz or .zip
4562 dmg - Mac OS X .dmg
4563 installed - installation tree
4564 msi - Windows .msi
4565         ])
4566             ;;
4567         esac
4568     done
4569     PKGFORMAT="$with_package_format"
4570     AC_MSG_RESULT([$PKGFORMAT])
4571 else
4572     PKGFORMAT=
4573     AC_MSG_RESULT([none])
4575 AC_SUBST(PKGFORMAT)
4577 dnl ===================================================================
4578 dnl Set up a different compiler to produce tools to run on the build
4579 dnl machine when doing cross-compilation
4580 dnl ===================================================================
4582 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4583 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4584 if test "$cross_compiling" = "yes"; then
4585     AC_MSG_CHECKING([for BUILD platform configuration])
4586     echo
4587     rm -rf CONF-FOR-BUILD config_build.mk
4588     mkdir CONF-FOR-BUILD
4589     # Here must be listed all files needed when running the configure script. In particular, also
4590     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4591     # keep them in the same order as there.
4592     (cd $SRC_ROOT && tar cf - \
4593         config.guess \
4594         bin/get_config_variables \
4595         solenv/bin/getcompver.awk \
4596         solenv/inc/langlist.mk \
4597         config_host.mk.in \
4598         config_host_lang.mk.in \
4599         Makefile.in \
4600         lo.xcent.in \
4601         bin/bffvalidator.sh.in \
4602         bin/odfvalidator.sh.in \
4603         bin/officeotron.sh.in \
4604         instsetoo_native/util/openoffice.lst.in \
4605         config_host/*.in \
4606         sysui/desktop/macosx/Info.plist.in \
4607         ios/lo.xcconfig.in) \
4608     | (cd CONF-FOR-BUILD && tar xf -)
4609     cp configure CONF-FOR-BUILD
4610     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4611     (
4612     unset COM USING_X11 OS CPUNAME
4613     unset CC CXX SYSBASE CFLAGS
4614     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4615     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4616     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4617     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4618     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4619     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4620     cd CONF-FOR-BUILD
4621     sub_conf_opts=""
4622     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4623     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4624     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4625     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4626     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4627     # we need the msi build tools on mingw if we are creating the
4628     # installation set
4629     if test "$WITH_MINGW" = "yes"; then
4630         enable_winegcc_for_build=
4631         for pkgformat in $PKGFORMAT; do
4632             case "$pkgformat" in
4633             msi|native) enable_winegcc_for_build=yes ;;
4634             esac
4635         done
4636         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4637     fi
4638     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4639     # Don't bother having configure look for stuff not needed for the build platform anyway
4640     ./configure \
4641         --disable-cups \
4642         --disable-graphite \
4643         --disable-gtk3 \
4644         --disable-pdfimport \
4645         --disable-postgresql-sdbc \
4646         --with-parallelism="$with_parallelism" \
4647         --without-doxygen \
4648         --without-java \
4649         $sub_conf_opts \
4650         --srcdir=$srcdir \
4651         2>&1 | sed -e 's/^/    /'
4652     test -f ./config_host.mk 2>/dev/null || exit
4653     cp config_host.mk ../config_build.mk
4654     cp config_host_lang.mk ../config_build_lang.mk
4655     mv config.log ../config.Build.log
4656     mkdir -p ../config_build
4657     mv config_host/*.h ../config_build
4658     . ./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
4660     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
4661         VV='$'$V
4662         VV=`eval "echo $VV"`
4663         if test -n "$VV"; then
4664             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4665             echo "$line" >>build-config
4666         fi
4667     done
4669     for V in INSTDIR INSTROOT WORKDIR; do
4670         VV='$'$V
4671         VV=`eval "echo $VV"`
4672         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4673         if test -n "$VV"; then
4674             line="${V}_FOR_BUILD='$VV'"
4675             echo "$line" >>build-config
4676         fi
4677     done
4679     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4680     echo "$line" >>build-config
4682     )
4683     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4684     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])
4685     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4686              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4688     eval `cat CONF-FOR-BUILD/build-config`
4690     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4692     rm -rf CONF-FOR-BUILD
4693 else
4694     OS_FOR_BUILD="$OS"
4695     CC_FOR_BUILD="$CC"
4696     CXX_FOR_BUILD="$CXX"
4697     INSTDIR_FOR_BUILD="$INSTDIR"
4698     INSTROOT_FOR_BUILD="$INSTROOT"
4699     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4700     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4701     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4702     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4703     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4704     WORKDIR_FOR_BUILD="$WORKDIR"
4706 AC_SUBST(OS_FOR_BUILD)
4707 AC_SUBST(INSTDIR_FOR_BUILD)
4708 AC_SUBST(INSTROOT_FOR_BUILD)
4709 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4710 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4711 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4712 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4713 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4714 AC_SUBST(WORKDIR_FOR_BUILD)
4716 dnl ===================================================================
4717 dnl Check for syslog header
4718 dnl ===================================================================
4719 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4721 # placeholder for future crash reporter feature
4722 ENABLE_CRASHDUMP=""
4723 AC_SUBST(ENABLE_CRASHDUMP)
4725 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4726 dnl ===================================================================
4727 AC_MSG_CHECKING([whether to turn warnings to errors])
4728 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4729     ENABLE_WERROR="TRUE"
4730     AC_MSG_RESULT([yes])
4731 else
4732     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4733         ENABLE_WERROR="TRUE"
4734         AC_MSG_RESULT([yes])
4735     else
4736         AC_MSG_RESULT([no])
4737     fi
4739 AC_SUBST(ENABLE_WERROR)
4741 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4742 dnl ===================================================================
4743 AC_MSG_CHECKING([whether to have assert to abort in release code])
4744 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4745     ASSERT_ALWAYS_ABORT="TRUE"
4746     AC_MSG_RESULT([yes])
4747 else
4748     ASSERT_ALWAYS_ABORT="FALSE"
4749     AC_MSG_RESULT([no])
4751 AC_SUBST(ASSERT_ALWAYS_ABORT)
4753 # Determine whether to use ooenv for the instdir installation
4754 # ===================================================================
4755 if test $_os != "WINNT" -a $_os != "Darwin"; then
4756     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4757     if test "$enable_ooenv" = "no"; then
4758         AC_MSG_RESULT([no])
4759     else
4760         ENABLE_OOENV="TRUE"
4761         AC_MSG_RESULT([yes])
4762     fi
4764 AC_SUBST(ENABLE_OOENV)
4766 if test "$USING_X11" != TRUE; then
4767     # be sure to do not mess with unneeded stuff
4768     test_randr=no
4769     test_xrender=no
4770     test_cups=no
4771     test_dbus=no
4772     test_gtk=no
4773     build_gstreamer_1_0=no
4774     build_gstreamer_0_10=no
4775     test_tde=no
4776     test_kde4=no
4777     enable_cairo_canvas=no
4780 dnl ===================================================================
4781 dnl check for cups support
4782 dnl ===================================================================
4783 ENABLE_CUPS=""
4785 if test "$enable_cups" = "no"; then
4786     test_cups=no
4789 AC_MSG_CHECKING([whether to enable CUPS support])
4790 if test "$test_cups" = "yes"; then
4791     ENABLE_CUPS="TRUE"
4792     AC_MSG_RESULT([yes])
4794     AC_MSG_CHECKING([whether cups support is present])
4795     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4796     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4797     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4798         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4799     fi
4801 else
4802     AC_MSG_RESULT([no])
4805 AC_SUBST(ENABLE_CUPS)
4807 # fontconfig checks
4808 if test "$test_fontconfig" = "yes"; then
4809     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4810     SYSTEM_FONTCONFIG=TRUE
4811     FilterLibs "${FONTCONFIG_LIBS}"
4812     FONTCONFIG_LIBS="${filteredlibs}"
4814 AC_SUBST(FONTCONFIG_CFLAGS)
4815 AC_SUBST(FONTCONFIG_LIBS)
4816 AC_SUBST([SYSTEM_FONTCONFIG])
4818 dnl whether to find & fetch external tarballs?
4819 dnl ===================================================================
4820 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4821    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4822        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4823    else
4824        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4825    fi
4827 if test -z "$TARFILE_LOCATION"; then
4828     if test -d "$SRC_ROOT/src" ; then
4829         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4830         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4831     fi
4832     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4833 else
4834     AbsolutePath "$TARFILE_LOCATION"
4835     PathFormat "${absolute_path}"
4836     TARFILE_LOCATION="${formatted_path}"
4838 AC_SUBST(TARFILE_LOCATION)
4840 AC_MSG_CHECKING([whether we want to fetch tarballs])
4841 if test "$enable_fetch_external" != "no"; then
4842     if test "$with_all_tarballs" = "yes"; then
4843         AC_MSG_RESULT(["yes, all of them"])
4844         DO_FETCH_TARBALLS="ALL"
4845     else
4846         AC_MSG_RESULT(["yes, if we use them"])
4847         DO_FETCH_TARBALLS="TRUE"
4848     fi
4849 else
4850     AC_MSG_RESULT([no])
4851     DO_FETCH_TARBALLS=
4853 AC_SUBST(DO_FETCH_TARBALLS)
4855 AC_MSG_CHECKING([whether to build help])
4856 HELP_COMMON_ONLY=FALSE
4857 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4858     BUILD_TYPE="$BUILD_TYPE HELP"
4859     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4860     if test "$with_help" = "common" ; then
4861         HELP_COMMON_ONLY=TRUE
4862         AC_MSG_RESULT([common only])
4863     else
4864         SCPDEFS="$SCPDEFS -DWITH_HELP"
4865         AC_MSG_RESULT([yes])
4866     fi
4867 else
4868     AC_MSG_RESULT([no])
4870 AC_SUBST(HELP_COMMON_ONLY)
4872 dnl Test whether to include MySpell dictionaries
4873 dnl ===================================================================
4874 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4875 if test "$with_myspell_dicts" = "yes"; then
4876     AC_MSG_RESULT([yes])
4877     WITH_MYSPELL_DICTS=TRUE
4878     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4879     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4880 else
4881     AC_MSG_RESULT([no])
4882     WITH_MYSPELL_DICTS=
4884 AC_SUBST(WITH_MYSPELL_DICTS)
4886 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4887 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4888     if test "$with_system_dicts" = yes; then
4889         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4890     fi
4891     with_system_dicts=no
4894 AC_MSG_CHECKING([whether to use dicts from external paths])
4895 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4896     AC_MSG_RESULT([yes])
4897     SYSTEM_DICTS=TRUE
4898     AC_MSG_CHECKING([for spelling dictionary directory])
4899     if test -n "$with_external_dict_dir"; then
4900         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4901     else
4902         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4903         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4904             DICT_SYSTEM_DIR=file:///usr/share/myspell
4905         fi
4906     fi
4907     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4908     AC_MSG_CHECKING([for hyphenation patterns directory])
4909     if test -n "$with_external_hyph_dir"; then
4910         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4911     else
4912         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4913     fi
4914     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4915     AC_MSG_CHECKING([for thesaurus directory])
4916     if test -n "$with_external_thes_dir"; then
4917         THES_SYSTEM_DIR=file://$with_external_thes_dir
4918     else
4919         THES_SYSTEM_DIR=file:///usr/share/mythes
4920     fi
4921     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4922 else
4923     AC_MSG_RESULT([no])
4924     SYSTEM_DICTS=
4926 AC_SUBST(SYSTEM_DICTS)
4927 AC_SUBST(DICT_SYSTEM_DIR)
4928 AC_SUBST(HYPH_SYSTEM_DIR)
4929 AC_SUBST(THES_SYSTEM_DIR)
4931 dnl ===================================================================
4932 dnl enable pch by default on windows
4933 dnl enable it explicitly otherwise
4934 AC_MSG_CHECKING([whether to enable pch feature])
4935 ENABLE_PCH=""
4936 if test "$enable_pch" != "no"; then
4937     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4938         ENABLE_PCH="TRUE"
4939         AC_MSG_RESULT([yes])
4940     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4941         ENABLE_PCH="TRUE"
4942         AC_MSG_RESULT([yes])
4943     elif test -n "$enable_pch"; then
4944         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4945     else
4946         AC_MSG_RESULT([no])
4947     fi
4948 else
4949     AC_MSG_RESULT([no])
4951 AC_SUBST(ENABLE_PCH)
4953 TAB=`printf '\t'`
4955 AC_MSG_CHECKING([the GNU Make version])
4956 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4957 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4958 if test "$_make_longver" -ge "038200"; then
4959     AC_MSG_RESULT([$GNUMAKE $_make_version])
4961 elif test "$_make_longver" -ge "038100"; then
4962     if test "$build_os" = "cygwin"; then
4963         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4964     fi
4965     AC_MSG_RESULT([$GNUMAKE $_make_version])
4967     dnl ===================================================================
4968     dnl Search all the common names for sha1sum
4969     dnl ===================================================================
4970     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4971     if test -z "$SHA1SUM"; then
4972         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4973     elif test "$SHA1SUM" = "openssl"; then
4974         SHA1SUM="openssl sha1"
4975     fi
4976     AC_MSG_CHECKING([for GNU Make bug 20033])
4977     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4978     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4979 A := \$(wildcard *.a)
4981 .PHONY: all
4982 all: \$(A:.a=.b)
4983 <TAB>@echo survived bug20033.
4985 .PHONY: setup
4986 setup:
4987 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4989 define d1
4990 @echo lala \$(1)
4991 @sleep 1
4992 endef
4994 define d2
4995 @echo tyty \$(1)
4996 @sleep 1
4997 endef
4999 %.b : %.a
5000 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5001 <TAB>\$(call d1,\$(CHECKSUM)),\
5002 <TAB>\$(call d2,\$(CHECKSUM)))
5004     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5005         no_parallelism_make="YES"
5006         AC_MSG_RESULT([yes, disable parallelism])
5007     else
5008         AC_MSG_RESULT([no, keep parallelism enabled])
5009     fi
5010     rm -rf $TESTGMAKEBUG20033
5011 else
5012     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5015 # find if gnumake support file function
5016 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5017 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5018 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5019     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5021 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5022 \$(file >test.txt,Success )
5024 .PHONY: all
5025 all:
5026 <TAB>@cat test.txt
5029 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5030 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5031     HAVE_GNUMAKE_FILE_FUNC=TRUE
5032     AC_MSG_RESULT([yes])
5033 else
5034     AC_MSG_RESULT([no])
5036 rm -rf $TESTGMAKEFILEFUNC
5037 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5038 AC_SUBST(GNUMAKE_WIN_NATIVE)
5040 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5041 STALE_MAKE=
5042 if test "$_make_ver_check" = ""; then
5043    STALE_MAKE=TRUE
5046 HAVE_LD_HASH_STYLE=FALSE
5047 WITH_LINKER_HASH_STYLE=
5048 AC_MSG_CHECKING( for --hash-style gcc linker support )
5049 if test "$GCC" = "yes"; then
5050     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5051         hash_styles="gnu sysv"
5052     elif test "$with_linker_hash_style" = "no"; then
5053         hash_styles=
5054     else
5055         hash_styles="$with_linker_hash_style"
5056     fi
5058     for hash_style in $hash_styles; do
5059         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5060         hash_style_ldflags_save=$LDFLAGS
5061         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5063         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5064             [
5065 #include <stdio.h>
5066             ],[
5067 printf ("");
5068             ])],
5069             [
5070                   HAVE_LD_HASH_STYLE=TRUE
5071                   WITH_LINKER_HASH_STYLE=$hash_style
5072             ],
5073             [HAVE_LD_HASH_STYLE=FALSE],
5074             [HAVE_LD_HASH_STYLE=FALSE])
5075         LDFLAGS=$hash_style_ldflags_save
5076     done
5078     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5079         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5080     else
5081         AC_MSG_RESULT( no )
5082     fi
5083     LDFLAGS=$hash_style_ldflags_save
5084 else
5085     AC_MSG_RESULT( no )
5087 AC_SUBST(HAVE_LD_HASH_STYLE)
5088 AC_SUBST(WITH_LINKER_HASH_STYLE)
5090 dnl ===================================================================
5091 dnl Check whether there's a Perl version available.
5092 dnl ===================================================================
5093 if test -z "$with_perl_home"; then
5094     AC_PATH_PROG(PERL, perl)
5095 else
5096     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5097     _perl_path="$with_perl_home/bin/perl"
5098     if test -x "$_perl_path"; then
5099         PERL=$_perl_path
5100     else
5101         AC_MSG_ERROR([$_perl_path not found])
5102     fi
5105 dnl ===================================================================
5106 dnl Testing for Perl version 5 or greater.
5107 dnl $] is the Perl version variable, it is returned as an integer
5108 dnl ===================================================================
5109 if test "$PERL"; then
5110     AC_MSG_CHECKING([the Perl version])
5111     ${PERL} -e "exit($]);"
5112     _perl_version=$?
5113     if test "$_perl_version" -lt 5; then
5114         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5115     fi
5116     AC_MSG_RESULT([checked (perl $_perl_version)])
5117 else
5118     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5121 dnl ===================================================================
5122 dnl Testing for required Perl modules
5123 dnl ===================================================================
5125 AC_MSG_CHECKING([for required Perl modules])
5126 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5127     AC_MSG_RESULT([all modules found])
5128 else
5129     AC_MSG_RESULT([failed to find some modules])
5130     # Find out which modules are missing.
5131     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5132         missing_perl_modules="$missing_perl_modules Cwd"
5133     fi
5134     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5135         missing_perl_modules="$missing_perl_modules Digest::MD5"
5136     fi
5137        AC_MSG_ERROR([
5138     The missing Perl modules are: $missing_perl_modules
5139     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5142 dnl ===================================================================
5143 dnl Check for pkg-config
5144 dnl ===================================================================
5145 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5146     PKG_PROG_PKG_CONFIG
5149 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5151     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5152     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5153     # explicitly. Or put /path/to/compiler in PATH yourself.
5155     # Use wrappers for LTO
5156     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5157         AC_CHECK_TOOL(AR,gcc-ar)
5158         AC_CHECK_TOOL(NM,gcc-nm)
5159         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5160     else
5161         AC_CHECK_TOOL(AR,ar)
5162         AC_CHECK_TOOL(NM,nm)
5163         AC_CHECK_TOOL(RANLIB,ranlib)
5164     fi
5165     AC_CHECK_TOOL(OBJDUMP,objdump)
5166     AC_CHECK_TOOL(READELF,readelf)
5167     AC_CHECK_TOOL(STRIP,strip)
5168     if test "$_os" = "WINNT"; then
5169         AC_CHECK_TOOL(DLLTOOL,dlltool)
5170         AC_CHECK_TOOL(WINDRES,windres)
5171     fi
5173 AC_SUBST(AR)
5174 AC_SUBST(DLLTOOL)
5175 AC_SUBST(NM)
5176 AC_SUBST(OBJDUMP)
5177 AC_SUBST(PKG_CONFIG)
5178 AC_SUBST(RANLIB)
5179 AC_SUBST(READELF)
5180 AC_SUBST(STRIP)
5181 AC_SUBST(WINDRES)
5183 dnl ===================================================================
5184 dnl pkg-config checks on Mac OS X
5185 dnl ===================================================================
5187 if test $_os = Darwin; then
5188     AC_MSG_CHECKING([for bogus pkg-config])
5189     if test -n "$PKG_CONFIG"; then
5190         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5191             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5192         else
5193             if test "$enable_bogus_pkg_config" = "yes"; then
5194                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5195             else
5196                 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.])
5197             fi
5198         fi
5199     else
5200         AC_MSG_RESULT([no, good])
5201     fi
5204 find_csc()
5206     # Return value: $csctest
5208     unset csctest
5210     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5211     if test -n "$regvalue"; then
5212         csctest=$regvalue
5213         return
5214     fi
5217 find_al()
5219     # Return value: $altest
5221     unset altest
5223     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5224         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5225         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5226             altest=$regvalue
5227             return
5228         fi
5229     done
5232 find_dotnetsdk()
5234     # Return value: $frametest (that's a silly name...)
5236     unset frametest
5238     for ver in 1.1 2.0; do
5239         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5240         if test -n "$regvalue"; then
5241             frametest=$regvalue
5242             return
5243         fi
5244     done
5247 find_dotnetsdk46()
5249     unset frametest
5251     for ver in 4.6.1 4.6; do
5252         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5253         if test -n "$regvalue"; then
5254             frametest=$regvalue
5255             return
5256         fi
5257         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5258         if test -n "$regvalue"; then
5259             frametest=$regvalue
5260             return
5261         fi
5262     done
5265 find_winsdk_version()
5267     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5268     # Return values: $winsdktest, $winsdklibsubdir
5270     unset winsdktest winsdklibsubdir
5272     # Why we look for them in this particular order I don't know. But OTOH I
5273     case "$1" in
5274     7.*)
5275         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5276         if test -n "$regvalue"; then
5277             winsdktest=$regvalue
5278             winsdklibsubdir=.
5279             return
5280         fi
5281         ;;
5282     8.1|8.1A)
5283         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5284         if test -n "$regvalue"; then
5285             winsdktest=$regvalue
5286             winsdklibsubdir=winv6.3
5287             return
5288         fi
5289         ;;
5290     8.0|8.0A)
5291         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5292         if test -n "$regvalue"; then
5293             winsdktest=$regvalue
5294             winsdklibsubdir=win8
5295             return
5296         fi
5297         ;;
5298     10.0)
5299         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5300         if test -n "$regvalue"; then
5301             winsdktest=$regvalue
5302             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5303             winsdklibsubdir=$regvalue
5304             return
5305         fi
5306         ;;
5307     esac
5310 find_winsdk()
5312     # Args: $1 (optional) : list of acceptable SDK versions
5313     # Return value: $winsdktest
5315     unset winsdktest
5317     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5318         find_winsdk_version $ver
5319         if test -n "$winsdktest"; then
5320             return
5321         fi
5322     done
5325 find_msms()
5327     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5328     AC_MSG_CHECKING([for $my_msm_file])
5329     msmdir=
5330     for ver in 12.0 14.0; do
5331         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5332         if test -n "$regvalue"; then
5333             if test -e "$regvalue/$my_msm_file"; then
5334                 msmdir=$regvalue
5335                 break
5336             fi
5337         fi
5338     done
5339     dnl Is the following fallback really necessary, or was it added in response
5340     dnl to never having started Visual Studio on a given machine, so the
5341     dnl registry keys checked above had presumably not yet been created?
5342     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5343     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5344     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5345     dnl expanding to "C:\Program Files\Common Files"), which would need
5346     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5347     dnl obtain its value from cygwin:
5348     if test -z "$msmdir"; then
5349         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5350         if test -e "$my_msm_dir/$my_msm_file"; then
5351             msmdir=$my_msm_dir
5352         fi
5353     fi
5354     if test -n "$msmdir"; then
5355         msmdir=`cygpath -m "$msmdir"`
5356         AC_MSG_RESULT([$msmdir])
5357     else
5358         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5359             AC_MSG_ERROR([not found])
5360         else
5361             AC_MSG_WARN([not found])
5362         fi
5363     fi
5366 find_msvc_x64_dlls()
5368     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5369     # http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
5370     # Refactored C Runtime (CRT): This CTP contains the first preview of the substantially refactored CRT.
5371     # msvcr140.dll no longer exists. It is replaced by a trio of DLLs: vcruntime140.dll, appcrt140.dll,
5372     # and desktopcrt140.dll.
5373     if test "$VCVER" = 140; then
5374        msvcdlls="msvcp${VCVER}.dll vcruntime${VCVER}.dll"
5375     else
5376        msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5377     fi
5378     for dll in $msvcdlls; do
5379         if ! test -f "$msvcdllpath/$dll"; then
5380             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5381         fi
5382     done
5385 if test "$build_os" = "cygwin"; then
5386     dnl Check midl.exe
5387     AC_MSG_CHECKING([for midl.exe])
5389     find_winsdk
5390     if test -f "$winsdktest/Bin/midl.exe"; then
5391         MIDL_PATH="$winsdktest/Bin"
5392     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5393         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5394     fi
5395     if test ! -f "$MIDL_PATH/midl.exe"; then
5396         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5397     else
5398         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5399     fi
5401     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5402     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5404     dnl Check csc.exe
5405     AC_MSG_CHECKING([for csc.exe])
5406     find_csc
5407     if test -f "$csctest/csc.exe"; then
5408         CSC_PATH="$csctest"
5409     fi
5410     if test ! -f "$CSC_PATH/csc.exe"; then
5411         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5412     else
5413         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5414     fi
5416     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5418     dnl Check al.exe
5419     AC_MSG_CHECKING([for al.exe])
5420     find_winsdk
5421     if test -f "$winsdktest/Bin/al.exe"; then
5422         AL_PATH="$winsdktest/Bin"
5423     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5424         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5425     fi
5427     if test -z "$AL_PATH"; then
5428         find_al
5429         if test -f "$altest/bin/al.exe"; then
5430             AL_PATH="$altest/bin"
5431         elif test -f "$altest/al.exe"; then
5432             AL_PATH="$altest"
5433         fi
5434     fi
5435     if test ! -f "$AL_PATH/al.exe"; then
5436         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5437     else
5438         AC_MSG_RESULT([$AL_PATH/al.exe])
5439     fi
5441     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5443     dnl Check mscoree.lib / .NET Framework dir
5444     AC_MSG_CHECKING(.NET Framework find_dotnetsdk)
5445     find_dotnetsdk
5446     if test -f "$frametest/lib/mscoree.lib"; then
5447         DOTNET_FRAMEWORK_HOME="$frametest"
5448     else
5449         AC_MSG_CHECKING(.NET Framework find_winsdk)
5450         find_winsdk
5451         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5452             DOTNET_FRAMEWORK_HOME="$winsdktest"
5453         else
5454             AC_MSG_CHECKING(.NET Framework find_dotnetsdk46)
5455             find_dotnetsdk46
5456             PathFormat "$frametest"
5457             frametest="$formatted_path"
5458             AC_MSG_CHECKING(found: $frametest/um/$WINDOWS_SDK_ARCH/mscoree.lib)
5459             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5460                  DOTNET_FRAMEWORK_HOME="$frametest"
5461             fi
5462         fi
5463     fi
5465     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
5466         AC_MSG_ERROR([mscoree.lib not found])
5467     fi
5468     AC_MSG_RESULT(found)
5470     PathFormat "$MIDL_PATH"
5471     MIDL_PATH="$formatted_path"
5473     PathFormat "$AL_PATH"
5474     AL_PATH="$formatted_path"
5476     PathFormat "$DOTNET_FRAMEWORK_HOME"
5477     DOTNET_FRAMEWORK_HOME="$formatted_path"
5479     PathFormat "$CSC_PATH"
5480     CSC_PATH="$formatted_path"
5483 dnl ===================================================================
5484 dnl Check if stdc headers are available excluding MSVC.
5485 dnl ===================================================================
5486 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5487     AC_HEADER_STDC
5490 dnl ===================================================================
5491 dnl Testing for C++ compiler and version...
5492 dnl ===================================================================
5494 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5495     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5496     save_CXXFLAGS=$CXXFLAGS
5497     AC_PROG_CXX
5498     CXXFLAGS=$save_CXXFLAGS
5499 else
5500     if test -n "$CC" -a -z "$CXX"; then
5501         CXX="$CC"
5502     fi
5505 dnl check for GNU C++ compiler version
5506 if test "$GXX" = "yes" -a "$CXX" != "emcc"; then
5507     AC_MSG_CHECKING([the GNU C++ compiler version])
5509     _gpp_version=`$CXX -dumpversion`
5510     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5512     if test "$_gpp_majmin" -lt "401"; then
5513         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5514     else
5515         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5516     fi
5518     dnl see https://code.google.com/p/android/issues/detail?id=41770
5519     if test "$_gpp_majmin" -ge "401"; then
5520         glibcxx_threads=no
5521         AC_LANG_PUSH([C++])
5522         AC_REQUIRE_CPP
5523         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5524         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5525             #include <bits/c++config.h>]],[[
5526             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5527             && !defined(_GLIBCXX__PTHREADS) \
5528             && !defined(_GLIBCXX_HAS_GTHREADS)
5529             choke me
5530             #endif
5531         ]])],[AC_MSG_RESULT([yes])
5532         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5533         AC_LANG_POP([C++])
5534         if test $glibcxx_threads = yes; then
5535             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5536         fi
5537      fi
5539 AC_SUBST(BOOST_CXXFLAGS)
5542 # prefx CXX with ccache if needed
5544 if test "$CCACHE" != ""; then
5545     AC_MSG_CHECKING([whether $CXX is already ccached])
5546     AC_LANG_PUSH([C++])
5547     save_CXXFLAGS=$CXXFLAGS
5548     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5549     dnl an empty program will do, we're checking the compiler flags
5550     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5551                       [use_ccache=yes], [use_ccache=no])
5552     if test $use_ccache = yes; then
5553         AC_MSG_RESULT([yes])
5554     else
5555         CXX="$CCACHE $CXX"
5556         AC_MSG_RESULT([no])
5557     fi
5558     CXXFLAGS=$save_CXXFLAGS
5559     AC_LANG_POP([C++])
5562 dnl ===================================================================
5563 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5564 dnl ===================================================================
5566 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5567     AC_PROG_CXXCPP
5569     dnl Check whether there's a C pre-processor.
5570     AC_PROG_CPP
5574 dnl ===================================================================
5575 dnl Find integral type sizes and alignments
5576 dnl ===================================================================
5578 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5580     AC_CHECK_SIZEOF(long)
5581     AC_CHECK_SIZEOF(short)
5582     AC_CHECK_SIZEOF(int)
5583     AC_CHECK_SIZEOF(long long)
5584     AC_CHECK_SIZEOF(double)
5585     AC_CHECK_SIZEOF(void*)
5587     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5588     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5589     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5590     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5591     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5593     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5594     m4_pattern_allow([AC_CHECK_ALIGNOF])
5595     m4_ifdef([AC_CHECK_ALIGNOF],
5596         [
5597             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5598             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5599             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5600             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5601         ],
5602         [
5603             case "$_os-$host_cpu" in
5604             Linux-i686)
5605                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5606                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5607                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5608                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5609                 ;;
5610             Linux-x86_64)
5611                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5612                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5613                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5614                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5615                 ;;
5616             *)
5617                 if test -z "$ac_cv_alignof_short" -o \
5618                         -z "$ac_cv_alignof_int" -o \
5619                         -z "$ac_cv_alignof_long" -o \
5620                         -z "$ac_cv_alignof_double"; then
5621                    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.])
5622                 fi
5623                 ;;
5624             esac
5625         ])
5627     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5628     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5629     if test $ac_cv_sizeof_long -eq 8; then
5630         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5631     elif test $ac_cv_sizeof_double -eq 8; then
5632         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5633     else
5634         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5635     fi
5637     dnl Check for large file support
5638     AC_SYS_LARGEFILE
5639     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5640         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5641     fi
5642     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5643         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5644     fi
5645 else
5646     # Hardcode for MSVC
5647     SAL_TYPES_SIZEOFSHORT=2
5648     SAL_TYPES_SIZEOFINT=4
5649     SAL_TYPES_SIZEOFLONG=4
5650     SAL_TYPES_SIZEOFLONGLONG=8
5651     if test "$BITNESS_OVERRIDE" = ""; then
5652         SAL_TYPES_SIZEOFPOINTER=4
5653     else
5654         SAL_TYPES_SIZEOFPOINTER=8
5655     fi
5656     SAL_TYPES_ALIGNMENT2=2
5657     SAL_TYPES_ALIGNMENT4=4
5658     SAL_TYPES_ALIGNMENT8=8
5659     LFS_CFLAGS=''
5661 AC_SUBST(LFS_CFLAGS)
5663 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5664 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5665 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5666 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5667 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5668 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5669 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5670 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5672 dnl ===================================================================
5673 dnl Check whether to enable runtime optimizations
5674 dnl ===================================================================
5675 ENABLE_RUNTIME_OPTIMIZATIONS=
5676 AC_MSG_CHECKING([whether to enable runtime optimizations])
5677 if test -z "$enable_runtime_optimizations"; then
5678     for i in $CC; do
5679         case $i in
5680         -fsanitize=*)
5681             enable_runtime_optimizations=no
5682             break
5683             ;;
5684         esac
5685     done
5687 if test "$enable_runtime_optimizations" != no; then
5688     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5689     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5690     AC_MSG_RESULT([yes])
5691 else
5692     AC_MSG_RESULT([no])
5694 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5696 dnl ===================================================================
5697 dnl Check if valgrind headers are available
5698 dnl ===================================================================
5699 ENABLE_VALGRIND=
5700 if test "$cross_compiling" != yes; then
5701     prev_cppflags=$CPPFLAGS
5702     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5703     # or where does it come from?
5704     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5705     AC_CHECK_HEADER([valgrind/valgrind.h],
5706         [ENABLE_VALGRIND=TRUE])
5707     CPPFLAGS=$prev_cppflags
5709 AC_SUBST([ENABLE_VALGRIND])
5710 if test -z "$ENABLE_VALGRIND"; then
5711     VALGRIND_CFLAGS=
5713 AC_SUBST([VALGRIND_CFLAGS])
5716 dnl ===================================================================
5717 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5718 dnl ===================================================================
5720 # We need at least the sys/sdt.h include header.
5721 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5722 if test "$SDT_H_FOUND" = "TRUE"; then
5723     # Found sys/sdt.h header, now make sure the c++ compiler works.
5724     # Old g++ versions had problems with probes in constructors/destructors.
5725     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5726     AC_LANG_PUSH([C++])
5727     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5728     #include <sys/sdt.h>
5729     class ProbeClass
5730     {
5731     private:
5732       int& ref;
5733       const char *name;
5735     public:
5736       ProbeClass(int& v, const char *n) : ref(v), name(n)
5737       {
5738         DTRACE_PROBE2(_test_, cons, name, ref);
5739       }
5741       void method(int min)
5742       {
5743         DTRACE_PROBE3(_test_, meth, name, ref, min);
5744         ref -= min;
5745       }
5747       ~ProbeClass()
5748       {
5749         DTRACE_PROBE2(_test_, dest, name, ref);
5750       }
5751     };
5752     ]],[[
5753     int i = 64;
5754     DTRACE_PROBE1(_test_, call, i);
5755     ProbeClass inst = ProbeClass(i, "call");
5756     inst.method(24);
5757     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5758           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5759     AC_LANG_POP([C++])
5761 AC_CONFIG_HEADERS([config_host/config_probes.h])
5763 dnl ===================================================================
5764 dnl Set the MinGW sys-root
5765 dnl ===================================================================
5766 if test "$WITH_MINGW" = "yes"; then
5767     AC_MSG_CHECKING([for MinGW sysroot])
5768     sysroot=`$CC -print-sysroot`
5769     AS_IF([test -d "$sysroot"/mingw],
5770           [MINGW_SYSROOT="$sysroot"/mingw
5771            AC_MSG_RESULT([$MINGW_SYSROOT])],
5772           [AC_MSG_RESULT([not found])
5773            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5775 AC_SUBST([MINGW_DLLS])
5776 AC_SUBST([MINGW_SYSROOT])
5778 dnl ===================================================================
5779 dnl Set the MinGW include directories
5780 dnl ===================================================================
5781 if test "$WITH_MINGW" = "yes"; then
5782     AC_MSG_CHECKING([for MinGW include path])
5783     cat >conftest.$ac_ext <<_ACEOF
5784 #include <stddef.h>
5785 #include <bits/c++config.h>
5786 _ACEOF
5787     _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`
5788     rm conftest.$ac_ext
5789     if test -z "$_mingw_lib_include_path"; then
5790         _mingw_lib_include_path="NO_LIB_INCLUDE"
5791         AC_MSG_RESULT([no MinGW include path])
5792     else
5793         AC_MSG_RESULT([$_mingw_lib_include_path])
5794     fi
5795     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5796     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5798     AC_LANG_PUSH([C++])
5800     AC_MSG_CHECKING([for dynamic libgcc])
5801     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5802 #include <iostream>
5803 using namespace std;
5804 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5805             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5806             if test -n "$MINGW_GCCDLL"; then
5807                 MINGW_SHARED_GCCLIB=TRUE
5808                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5809             else
5810                 MINGW_SHARED_GCCLIB=
5811                 AC_MSG_RESULT([no])
5812             fi
5813        ],[ AC_MSG_RESULT([no])
5815     ])
5817     AC_MSG_CHECKING([for dynamic libstdc++])
5818     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5819 #include <iostream>
5820 using namespace std;
5821 ]], [[ cout << "Hello there." << endl; ]])],[
5822             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5823             if test -n "$MINGW_GXXDLL"; then
5824                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5825                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5826                 if test "$CROSS_COMPILING" = "TRUE"; then
5827                     dnl m4 escaping!
5828                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5829                 fi
5830                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5831                 MINGW_SHARED_GXXLIB=TRUE
5832                 AC_MSG_RESULT([$MINGW_GXXDLL])
5833             else
5834                 MINGW_SHARED_GXXLIB=
5835                 AC_MSG_RESULT([no])
5836             fi
5837        ],[ AC_MSG_RESULT([no])
5839     ])
5841     AC_LANG_POP([C++])
5843     AC_SUBST(MINGW_SHARED_GCCLIB)
5844     AC_SUBST(MINGW_SHARED_GXXLIB)
5845     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5846     AC_SUBST(MINGW_GCCDLL)
5847     AC_SUBST(MINGW_GXXDLL)
5850 dnl *************************************************************
5851 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5852 dnl *************************************************************
5853 if test "$WITH_MINGW" = "yes"; then
5854     AC_MSG_CHECKING([exception type])
5855     AC_LANG_PUSH([C++])
5856     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5858         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5860         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5861     ])
5862     AC_MSG_RESULT($exceptions_type)
5863     AC_LANG_POP([C++])
5866 EXCEPTIONS="$exceptions_type"
5867 AC_SUBST(EXCEPTIONS)
5869 dnl ===================================================================
5870 dnl thread-safe statics
5871 dnl ===================================================================
5872 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5873 unset HAVE_THREADSAFE_STATICS
5874 if test "$GCC" = "yes"; then
5875     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5876     dnl us.  However, some C++ runtimes use a single lock for all static
5877     dnl variables, which can cause deadlock in multi-threaded applications.
5878     dnl This is not easily tested here; for POSIX-based systems, if executing
5879     dnl the following C++ program does not terminate then the tool chain
5880     dnl apparently has this problem:
5881     dnl
5882     dnl   #include <pthread.h>
5883     dnl   int h() { return 0; }
5884     dnl   void * g(void * unused) {
5885     dnl     static int n = h();
5886     dnl     return &n;
5887     dnl   }
5888     dnl   int f() {
5889     dnl     pthread_t t;
5890     dnl     pthread_create(&t, 0, g, 0);
5891     dnl     pthread_join(t, 0);
5892     dnl     return 0;
5893     dnl   }
5894     dnl   int main() {
5895     dnl     static int n = f();
5896     dnl     return n;
5897     dnl   }
5898     dnl
5899     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5900     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5901     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5902     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5903     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5904     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5905     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5906     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5907     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5908     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5909     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5910     dnl "too old"):
5911     if test "$_os" = Darwin; then
5912         dnl On Mac OS X, both /usr/lib/libstdc++.6.dylib and
5913         dnl /usr/lib/libc++1.dylib delegate to /usr/lib/libc++abi.dylib for the
5914         dnl __cxa_guard_* functionality; up to 10.8, libc++abi.dylib is
5915         dnl apparently provided by a libcppabi project that has broken semantics
5916         dnl (cf. <http://www.opensource.apple.com/source/libcppabi/libcppabi-26/
5917         dnl src/cxa_guard.cxx>), while in 10.9 (verified at least on 10.9.4) it
5918         dnl is apparently provided by LLVM's libcxxabi project, which has good
5919         dnl semantics (cf. <http://llvm.org/svn/llvm-project/libcxxabi/trunk/
5920         dnl src/cxa_guard.cpp>):
5921         if test "$MAC_OS_X_VERSION_MIN_REQUIRED" -ge 1090; then
5922             HAVE_THREADSAFE_STATICS=TRUE
5923         fi
5924     elif test "$_os" != Android; then
5925         if test "$COM_IS_CLANG" = TRUE; then
5926             AC_LANG_PUSH([C++])
5927             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5928 #include <list>
5929 #if defined __GLIBCXX__
5930 #if __GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306
5931 #error
5932 #endif
5933 #endif
5934                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5935             AC_LANG_POP([C++])
5936         else # known to work in GCC since version 4.3
5937             HAVE_THREADSAFE_STATICS=TRUE
5938         fi
5939     fi
5940     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5941         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5942         AC_MSG_RESULT([yes])
5943     else
5944         AC_MSG_RESULT([broken (i.e., no)])
5945     fi
5946 else
5947     # MSVC has sprouted C++11 thread-safe statics in 2015
5948     # http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
5949     if test "$COM" = "MSC" -a "$VCVER" -ge "140"; then
5950         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5951         AC_MSG_RESULT([yes])
5952     else
5953         AC_MSG_RESULT([no])
5954     fi
5956 AC_SUBST(HAVE_THREADSAFE_STATICS)
5958 dnl ===================================================================
5959 dnl visibility and other gcc features
5960 dnl ===================================================================
5961 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5962     if test "$COM" != MSC; then
5963         AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5964         save_CFLAGS=$CFLAGS
5965         CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5966         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5967         CFLAGS=$save_CFLAGS
5968         if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5969             AC_MSG_RESULT([yes])
5970         else
5971             AC_MSG_ERROR([no  This is no longer supported.])
5972         fi
5973     fi
5975     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5976     save_CFLAGS=$CFLAGS
5977     CFLAGS="$CFLAGS -Werror -mno-avx"
5978     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5979     CFLAGS=$save_CFLAGS
5980     if test "$HAVE_GCC_AVX" = "TRUE"; then
5981         AC_MSG_RESULT([yes])
5982     else
5983         AC_MSG_RESULT([no])
5984     fi
5986     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5987     save_CFLAGS=$CFLAGS
5988     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5989     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5990     CFLAGS=$save_CFLAGS
5991     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5992         AC_MSG_RESULT([yes])
5993     else
5994         AC_MSG_RESULT([no])
5995     fi
5997     AC_MSG_CHECKING([whether $CC supports atomic functions])
5998     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5999     int v = 0;
6000     if (__sync_add_and_fetch(&v, 1) != 1 ||
6001         __sync_sub_and_fetch(&v, 1) != 0)
6002         return 1;
6003     __sync_synchronize();
6004     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6005         v != 1)
6006         return 1;
6007     return 0;
6008 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6009     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6010         AC_MSG_RESULT([yes])
6011         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6012     else
6013         AC_MSG_RESULT([no])
6014     fi
6016     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6017     save_CFLAGS=$CFLAGS
6018     CFLAGS="$CFLAGS -Werror"
6019     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6020             __attribute__((deprecated("test"))) void f();
6021         ])], [
6022             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6023             AC_MSG_RESULT([yes])
6024         ], [AC_MSG_RESULT([no])])
6025     CFLAGS=$save_CFLAGS
6027     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
6028     AC_LANG_PUSH([C++])
6029     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6030             #include <cstddef>
6031             #include <cxxabi.h>
6032             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6033         ])], [
6034             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6035             AC_MSG_RESULT([yes])
6036         ], [AC_MSG_RESULT([no])])
6037     AC_LANG_POP([C++])
6039     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
6040     AC_LANG_PUSH([C++])
6041     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6042             #include <cstddef>
6043             #include <cxxabi.h>
6044             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6045         ])], [
6046             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6047             AC_MSG_RESULT([yes])
6048         ], [AC_MSG_RESULT([no])])
6049     AC_LANG_POP([C++])
6051     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6052     AC_LANG_PUSH([C++])
6053     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6054             #include <cxxabi.h>
6055             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6056         ])], [
6057             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6058             AC_MSG_RESULT([yes])
6059         ], [AC_MSG_RESULT([no])])
6060     AC_LANG_POP([C++])
6062     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6063     AC_LANG_PUSH([C++])
6064     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6065             #include <cstddef>
6066             #include <cxxabi.h>
6067             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6068         ])], [
6069             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6070             AC_MSG_RESULT([yes])
6071         ], [AC_MSG_RESULT([no])])
6072     AC_LANG_POP([C++])
6074     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6075     AC_LANG_PUSH([C++])
6076     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6077             #include <cstddef>
6078             #include <cxxabi.h>
6079             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6080         ])], [
6081             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6082             AC_MSG_RESULT([yes])
6083         ], [AC_MSG_RESULT([no])])
6084     AC_LANG_POP([C++])
6086     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6087     AC_LANG_PUSH([C++])
6088     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6089             #include <cxxabi.h>
6090             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6091         ])], [
6092             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6093             AC_MSG_RESULT([yes])
6094         ], [AC_MSG_RESULT([no])])
6095     AC_LANG_POP([C++])
6097     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6098     AC_LANG_PUSH([C++])
6099     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6100             #include <cxxabi.h>
6101             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6102         ])], [
6103             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6104             AC_MSG_RESULT([yes])
6105         ], [AC_MSG_RESULT([no])])
6106     AC_LANG_POP([C++])
6108     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6109     AC_LANG_PUSH([C++])
6110     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6111             #include <cstddef>
6112             #include <cxxabi.h>
6113             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6114         ])], [
6115             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6116             AC_MSG_RESULT([yes])
6117         ], [AC_MSG_RESULT([no])])
6118     AC_LANG_POP([C++])
6120     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6121     AC_LANG_PUSH([C++])
6122     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6123             #include <cstddef>
6124             #include <cxxabi.h>
6125             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6126         ])], [
6127             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6128             AC_MSG_RESULT([yes])
6129         ], [AC_MSG_RESULT([no])])
6130     AC_LANG_POP([C++])
6132     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6133     AC_LANG_PUSH([C++])
6134     save_CXXFLAGS=$CXXFLAGS
6135     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
6136     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6137             #include <string>
6138             void f() { std::string s; }
6139         ])], [
6140             AC_MSG_RESULT([no])
6141         ], [
6142             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6143             AC_MSG_RESULT([yes])])
6144     CXXFLAGS=$save_CXXFLAGS
6145     AC_LANG_POP([C++])
6148 AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6149 AC_LANG_PUSH([C++])
6150 save_CXXFLAGS=$CXXFLAGS
6151 CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
6152 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6153         struct __attribute__((warn_unused)) dummy {};
6154     ])], [
6155         AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6156         AC_MSG_RESULT([yes])
6157     ], [AC_MSG_RESULT([no])])
6158 CXXFLAGS=$save_CXXFLAGS
6159 AC_LANG_POP([C++])
6161 AC_SUBST(HAVE_GCC_AVX)
6162 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6163 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6165 dnl ===================================================================
6166 dnl Identify the C++ library
6167 dnl ===================================================================
6169 AC_MSG_CHECKING([What the C++ library is])
6170 AC_LANG_PUSH([C++])
6171 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6172 #include <utility>
6173 #ifndef __GLIBCXX__
6174 foo bar
6175 #endif
6176 ]])],
6177     [CPP_LIBRARY=GLIBCXX
6178      cpp_library_name="GNU libstdc++"
6179     ],
6180     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6181 #include <utility>
6182 #ifndef _LIBCPP_VERSION
6183 foo bar
6184 #endif
6185 ]])],
6186     [CPP_LIBRARY=LIBCPP
6187      cpp_library_name="LLVM libc++"
6188     ],
6189     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6190 #include <utility>
6191 #ifndef _MSC_VER
6192 foo bar
6193 #endif
6194 ]])],
6195     [CPP_LIBRARY=MSVCRT
6196      cpp_library_name="Microsoft"
6197     ],
6198     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6199 AC_MSG_RESULT([$cpp_library_name])
6200 AC_LANG_POP([C++])
6202 dnl ===================================================================
6203 dnl C++11
6204 dnl ===================================================================
6206 CXXFLAGS_CXX11=
6207 if test "$COM" = MSC; then
6208     AC_MSG_CHECKING([whether $CXX supports C++11])
6209     AC_MSG_RESULT(yes)
6210     # MSVC supports (a subset of) CXX11 without any switch
6211 elif test "$GCC" = "yes"; then
6212     HAVE_CXX11=
6213     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
6214     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
6215         save_CXXFLAGS=$CXXFLAGS
6216         CXXFLAGS="$CXXFLAGS $flag -Werror"
6217         AC_LANG_PUSH([C++])
6218         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6219             #include <algorithm>
6220             #include <functional>
6221             #include <vector>
6222             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6223                 std::sort(v.begin(), v.end(), fn);
6224             }
6225             ]])],[CXXFLAGS_CXX11=$flag])
6226         AC_LANG_POP([C++])
6227         CXXFLAGS=$save_CXXFLAGS
6228         if test -n "$CXXFLAGS_CXX11"; then
6229             HAVE_CXX11=TRUE
6230             break
6231         fi
6232     done
6233     if test "$HAVE_CXX11" = TRUE; then
6234         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6235     else
6236         AC_MSG_ERROR(no)
6237     fi
6240 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6241 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6242 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6243 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6244 dnl again towards 4.7.2:
6245 if test $CPP_LIBRARY = GLIBCXX; then
6246     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6247     AC_LANG_PUSH([C++])
6248     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6249 #include <list>
6250 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6251     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6252     //   GCC 4.7.0: 20120322
6253     //   GCC 4.7.1: 20120614
6254     // and using a range check is not possible as the mapping between
6255     // __GLIBCXX__ values and GCC versions is not monotonic
6256 /* ok */
6257 #else
6258 abi broken
6259 #endif
6260         ]])], [AC_MSG_RESULT(no, ok)],
6261         [AC_MSG_ERROR(yes)])
6262     AC_LANG_POP([C++])
6265 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6266 save_CXXFLAGS=$CXXFLAGS
6267 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6268 AC_LANG_PUSH([C++])
6270 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6271 #include <stddef.h>
6273 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6275 namespace
6277         struct b
6278         {
6279                 int i;
6280                 int j;
6281         };
6283 ]], [[
6284 struct a
6286         int i;
6287         int j;
6289 a thinga[]={{0,0}, {1,1}};
6290 b thingb[]={{0,0}, {1,1}};
6291 size_t i = sizeof(sal_n_array_size(thinga));
6292 size_t j = sizeof(sal_n_array_size(thingb));
6293 return !(i != 0 && j != 0);
6295     ], [ AC_MSG_RESULT(yes) ],
6296     [ AC_MSG_ERROR(no)])
6297 AC_LANG_POP([C++])
6298 CXXFLAGS=$save_CXXFLAGS
6300 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6301 save_CXXFLAGS=$CXXFLAGS
6302 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6303 AC_LANG_PUSH([C++])
6305 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6306 #include <vector>
6307     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6308     // (__float128)
6310     ],[ AC_MSG_RESULT(yes) ],
6311     [
6312         AC_MSG_RESULT(no)
6313         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6314         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6315         # __float128 is available during its build, but it's usually built using GCC,
6316         # and so c++config.h hardcodes __float128 being supported). As the only place
6317         # where __float128 is actually used is in a template specialization,
6318         # -D__float128=void will avoid the problem there while still causing a problem
6319         # if somebody actually uses the type.
6320         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6321         CXXFLAGS="$CXXFLAGS -D__float128=void"
6322         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6323 #include <vector>
6324     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6325     // (__float128)
6327     ],
6328     [
6329      AC_MSG_RESULT(yes)
6330      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6331     ],
6332     [
6333      AC_MSG_ERROR(no)
6334     ])
6337 AC_LANG_POP([C++])
6338 CXXFLAGS=$save_CXXFLAGS
6340 AC_SUBST(CXXFLAGS_CXX11)
6342 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6343 save_CXXFLAGS=$CXXFLAGS
6344 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6345 AC_LANG_PUSH([C++])
6346 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6347     struct S {
6348         int n_;
6349         constexpr S(int n): n_(n) {}
6350     };
6351     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6352 AC_LANG_POP([C++])
6353 CXXFLAGS=$save_CXXFLAGS
6354 AC_MSG_RESULT([$cxx11_constexpr])
6355 if test "$cxx11_constexpr" = yes; then
6356     AC_DEFINE([HAVE_CXX11_CONSTEXPR])
6359 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6360 save_CXXFLAGS=$CXXFLAGS
6361 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6362 AC_LANG_PUSH([C++])
6363 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6364     // A somewhat over-complicated way of checking for
6365     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6366     // in constexpr function":
6367     #include <cassert>
6368     template<typename T> inline constexpr T f(T x) { return x; }
6369     template<typename T> inline constexpr T g(T x) {
6370         assert(f(static_cast<int>(x)));
6371         return x;
6372     }
6373     enum E { e };
6374     auto v = g(E::e);
6376     struct S {
6377         int n_;
6378         constexpr bool f() {
6379             int n = n_;
6380             int i = 0;
6381             while (n > 0) { --n; ++i; }
6382             return i == 0;
6383         }
6384     };
6385     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6386 AC_LANG_POP([C++])
6387 CXXFLAGS=$save_CXXFLAGS
6388 AC_MSG_RESULT([$cxx14_constexpr])
6389 if test "$cxx14_constexpr" = yes; then
6390     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6393 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6394 save_CXXFLAGS=$CXXFLAGS
6395 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6396 AC_LANG_PUSH([C++])
6397 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6398     struct S {
6399         void f() &;
6400         void f() &&;
6401     };
6402     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6403 AC_LANG_POP([C++])
6404 CXXFLAGS=$save_CXXFLAGS
6405 AC_MSG_RESULT([$cxx11_ref_qualifier])
6406 if test "$cxx11_ref_qualifier" = yes; then
6407     AC_DEFINE([HAVE_CXX11_REF_QUALIFIER])
6410 AC_MSG_CHECKING([whether $CXX supports C++11 char16_t string literals])
6411 save_CXXFLAGS=$CXXFLAGS
6412 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6413 AC_LANG_PUSH([C++])
6414 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6415     auto s = u"";
6416     ]])], [cxx11_utf16_string_literal=yes], [cxx11_utf16_string_literal=no])
6417 AC_LANG_POP([C++])
6418 CXXFLAGS=$save_CXXFLAGS
6419 AC_MSG_RESULT([$cxx11_utf16_string_literal])
6420 if test "$cxx11_utf16_string_literal" = yes; then
6421     AC_DEFINE([HAVE_CXX11_UTF16_STRING_LITERAL])
6424 AC_MSG_CHECKING([whether $CXX supports C++14 sized deallocation])
6425 dnl At least Clang -fsanitize=address causes "multiple definition of
6426 dnl `operator delete(void*, unsigned long)'" also defined in
6427 dnl projects/compiler-rt/lib/asan/asan_new_delete.cc:
6428 save_CXX=$CXX
6429 if test "$COM_IS_CLANG" = TRUE; then
6430     my_CXX=
6431     for i in $CXX; do
6432         case $i in
6433         -fsanitize=address)
6434             ;;
6435         *)
6436             my_CXX="$my_CXX $i"
6437             ;;
6438         esac
6439     done
6440     CXX=$my_CXX
6442 save_CXXFLAGS=$CXXFLAGS
6443 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6444 AC_LANG_PUSH([C++])
6445 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
6446     #include <cstddef>
6447     #include <cstdlib>
6448     void operator delete(void *) throw () { std::exit(1); }
6449     void operator delete(void *, std::size_t) throw () { std::exit(0); }
6450     struct S { S() { throw 0; } };
6451     ]],[[
6452     try { new S; } catch (...) {}
6453     return 1;
6454     ]])], [cxx14_sized_deallocation=yes], [cxx14_sized_deallocation=no], [cxx14_sized_deallocation=no])
6455 AC_LANG_POP([C++])
6456 CXX=$save_CXX
6457 CXXFLAGS=$save_CXXFLAGS
6458 AC_MSG_RESULT([$cxx14_sized_deallocation])
6459 if test "$cxx14_sized_deallocation" = yes; then
6460     AC_DEFINE([HAVE_CXX14_SIZED_DEALLOCATION])
6463 HAVE_GCC_PRAGMA_OPERATOR=
6464 dnl _Pragma support (may require C++11)
6465 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6466     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6467     AC_LANG_PUSH([C++])
6468     save_CXXFLAGS=$CXXFLAGS
6469     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6470     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6471             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6472         ])], [
6473             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6474             HAVE_GCC_PRAGMA_OPERATOR=1
6475             AC_MSG_RESULT([yes])
6476         ], [AC_MSG_RESULT([no])])
6477     AC_LANG_POP([C++])
6478     CXXFLAGS=$save_CXXFLAGS
6480 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6482 HAVE_GCC_FNO_FNO_SIZED_DEALLOCATION=
6483 if test "$GCC" = yes; then
6484     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6485     AC_LANG_PUSH([C++])
6486     save_CXXFLAGS=$CXXFLAGS
6487     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6488     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6489     CXXFLAGS=$save_CXXFLAGS
6490     AC_LANG_POP([C++])
6491     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6492         AC_MSG_RESULT([yes])
6493     else
6494         AC_MSG_RESULT([no])
6495     fi
6497 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6499 dnl ===================================================================
6500 dnl system stl sanity tests
6501 dnl ===================================================================
6502 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6504     AC_LANG_PUSH([C++])
6506     save_CPPFLAGS="$CPPFLAGS"
6507     if test -n "$MACOSX_SDK_PATH"; then
6508         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6509     fi
6511     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6512     # only.
6513     if test "$CPP_LIBRARY" = GLIBCXX; then
6514         dnl gcc#19664, gcc#22482, rhbz#162935
6515         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6516         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6517         AC_MSG_RESULT([$stlvisok])
6518         if test "$stlvisok" = "no"; then
6519             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6520         fi
6521     fi
6523     sharedlink_ldflags_save=$LDFLAGS
6524     LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6526     AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6527     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6528 #include <sstream>
6529 using namespace std;
6530         ]], [[
6531 istringstream strm( "test" ); return 0;
6532         ]])],
6533         # Ugh, surely bad to assume an error message will contain
6534         # the word "unresolvable", a problem with
6535         # -fvisibility-inlines-hidden and STL headers might cause
6536         # some more obscure message on some platform, and anway,
6537         # the error message could be localised.
6538         [$EGREP -q unresolvable conftest.err;
6539         if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6540     ])
6541     AC_MSG_RESULT([$gccvisok])
6542     if test "$gccvisok" = "no"; then
6543         AC_MSG_ERROR([Your gcc is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6544     fi
6546     LDFLAGS=$sharedlink_ldflags_save
6548     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6549     # when we don't make any dynamic libraries?
6550     if test "$DISABLE_DYNLOADING" = ""; then
6551         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6552         cat > conftestlib1.cc <<_ACEOF
6553 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6554 struct S2: S1<int> { virtual ~S2(); };
6555 S2::~S2() {}
6556 _ACEOF
6557         cat > conftestlib2.cc <<_ACEOF
6558 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6559 struct S2: S1<int> { virtual ~S2(); };
6560 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6561 _ACEOF
6562         gccvisinlineshiddenok=yes
6563         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6564             gccvisinlineshiddenok=no
6565         else
6566             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6567             dnl known to not work with -z defs (unsetting which makes the test
6568             dnl moot, though):
6569             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6570             if test "$COM_IS_CLANG" = TRUE; then
6571                 for i in $CXX; do
6572                     case $i in
6573                     -fsanitize=*)
6574                         my_linkflagsnoundefs=
6575                         break
6576                         ;;
6577                     esac
6578                 done
6579             fi
6580             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6581                 gccvisinlineshiddenok=no
6582             fi
6583         fi
6585         rm -fr libconftest*
6586         AC_MSG_RESULT([$gccvisinlineshiddenok])
6587         if test "$gccvisinlineshiddenok" = "no"; then
6588             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6589         fi
6590     fi
6592     AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6593     cat >visibility.cxx <<_ACEOF
6594 #pragma GCC visibility push(hidden)
6595 struct __attribute__ ((visibility ("default"))) TestStruct {
6596   static void Init();
6598 __attribute__ ((visibility ("default"))) void TestFunc() {
6599   TestStruct::Init();
6601 _ACEOF
6602     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6603         gccvisbroken=yes
6604     else
6605         case "$host_cpu" in
6606         i?86|x86_64)
6607             if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6608                 gccvisbroken=no
6609             else
6610                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6611                     gccvisbroken=no
6612                 else
6613                     gccvisbroken=yes
6614                 fi
6615             fi
6616             ;;
6617         *)
6618             gccvisbroken=no
6619             ;;
6620         esac
6621     fi
6622     rm -f visibility.s visibility.cxx
6624     AC_MSG_RESULT([$gccvisbroken])
6625     if test "$gccvisbroken" = "yes"; then
6626         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6627     fi
6629     CPPFLAGS="$save_CPPFLAGS"
6631     AC_LANG_POP([C++])
6634 dnl ===================================================================
6635 dnl  Clang++ tests
6636 dnl ===================================================================
6638 HAVE_GCC_FNO_DEFAULT_INLINE=
6639 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6640 if test "$GCC" = "yes"; then
6641     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6642     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6643         # Option just ignored and silly warning that isn't a real
6644         # warning printed
6645         :
6646     else
6647         AC_LANG_PUSH([C++])
6648         save_CXXFLAGS=$CXXFLAGS
6649         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6650         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6651         CXXFLAGS=$save_CXXFLAGS
6652         AC_LANG_POP([C++])
6653     fi
6654     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6655         AC_MSG_RESULT([yes])
6656     else
6657         AC_MSG_RESULT([no])
6658     fi
6660     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6661     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6662         # As above
6663         :
6664     else
6665         AC_LANG_PUSH([C++])
6666         save_CXXFLAGS=$CXXFLAGS
6667         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6668         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6669         CXXFLAGS=$save_CXXFLAGS
6670         AC_LANG_POP([C++])
6671     fi
6672     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6673         AC_MSG_RESULT([yes])
6674     else
6675         AC_MSG_RESULT([no])
6676     fi
6678 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6679 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6681 dnl ===================================================================
6682 dnl Compiler plugins
6683 dnl ===================================================================
6685 COMPILER_PLUGINS=
6686 # currently only Clang
6687 if test "$COM_IS_CLANG" = "TRUE"; then
6688     if test -n "$enable_compiler_plugins"; then
6689         compiler_plugins="$enable_compiler_plugins"
6690     elif test -n "$ENABLE_DBGUTIL"; then
6691         compiler_plugins=test
6692     else
6693         compiler_plugins=no
6694     fi
6695     if test "$compiler_plugins" != "no"; then
6696         dnl The prefix where Clang resides, override to where Clang resides if
6697         dnl using a source build:
6698         if test -z "$CLANGDIR"; then
6699             CLANGDIR=/usr
6700         fi
6701         AC_LANG_PUSH([C++])
6702         save_CPPFLAGS=$CPPFLAGS
6703         save_CXX=$CXX
6704         # compiler plugins must be built with "native" bitness of clang
6705         # because they link against clang libraries
6706         CXX=${COMPILER_PLUGINS_CXX-$(echo $CXX | sed -e s/-m64// -e s/-m32//)}
6707         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6708         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6709             [COMPILER_PLUGINS=TRUE],
6710             [
6711             if test "$compiler_plugins" = "yes"; then
6712                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6713             else
6714                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6715                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6716             fi
6717             ])
6718         CXX=$save_CXX
6719         CPPFLAGS=$save_CPPFLAGS
6720         AC_LANG_POP([C++])
6721     fi
6722 else
6723     if test "$enable_compiler_plugins" = "yes"; then
6724         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6725     fi
6727 AC_SUBST(COMPILER_PLUGINS)
6728 AC_SUBST(COMPILER_PLUGINS_CXX)
6729 AC_SUBST(CLANGDIR)
6731 # Plugin to help linker.
6732 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6733 # This makes --enable-lto build with clang work.
6734 AC_SUBST(LD_PLUGIN)
6736 dnl ===================================================================
6737 dnl allocator
6738 dnl ===================================================================
6739 AC_MSG_CHECKING([which memory allocator to use])
6740 if test "$with_alloc" = "system"; then
6741     AC_MSG_RESULT([system])
6742     ALLOC="SYS_ALLOC"
6744 if test "$with_alloc" = "tcmalloc"; then
6745     AC_MSG_RESULT(tcmalloc)
6746     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6747         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6748     fi
6749     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6750         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6751     ALLOC="TCMALLOC"
6753 if test "$with_alloc" = "jemalloc"; then
6754     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6755         AC_MSG_RESULT(jemalloc)
6756         save_CFLAGS=$CFLAGS
6757         CFLAGS="$CFLAGS -pthread"
6758         AC_CHECK_LIB([jemalloc], [malloc], [:],
6759             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6760         ALLOC="JEMALLOC"
6761         CFLAGS=$save_CFLAGS
6762     else
6763         AC_MSG_RESULT([system])
6764         ALLOC="SYS_ALLOC"
6765     fi
6767 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6768     AC_MSG_RESULT([internal])
6770 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6771 AC_SUBST(HAVE_POSIX_FALLOCATE)
6772 AC_SUBST(ALLOC)
6774 dnl ===================================================================
6775 dnl Custom build version
6776 dnl ===================================================================
6778 AC_MSG_CHECKING([whether to add custom build version])
6779 if test "$with_build_version" != ""; then
6780     BUILD_VER_STRING=$with_build_version
6781     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6782 else
6783     BUILD_VER_STRING=
6784     AC_MSG_RESULT([no])
6786 AC_SUBST(BUILD_VER_STRING)
6788 JITC_PROCESSOR_TYPE=""
6789 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6790     # IBMs JDK needs this...
6791     JITC_PROCESSOR_TYPE=6
6792     export JITC_PROCESSOR_TYPE
6794 AC_SUBST([JITC_PROCESSOR_TYPE])
6796 # Misc Windows Stuff
6797 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6798     find_msvc_x64_dlls
6799     find_msms
6800     MSVC_DLL_PATH="$msvcdllpath"
6801     MSVC_DLLS="$msvcdlls"
6802     MSM_PATH="$msmdir"
6803     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6806 AC_SUBST(MSVC_DLL_PATH)
6807 AC_SUBST(MSVC_DLLS)
6808 AC_SUBST(MSM_PATH)
6810 dnl ===================================================================
6811 dnl Checks for Java
6812 dnl ===================================================================
6813 if test "$ENABLE_JAVA" != ""; then
6815     # Windows-specific tests
6816     if test "$build_os" = "cygwin"; then
6817         if test "$BITNESS_OVERRIDE" = 64; then
6818             bitness=64
6819         else
6820             bitness=32
6821         fi
6823         if test -z "$with_jdk_home"; then
6824             for ver in 1.8 1.7 1.6; do
6825                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6826                 if test -n "$regvalue"; then
6827                     _jdk_home=$regvalue
6828                     break
6829                 fi
6830             done
6831             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6832                 with_jdk_home="$_jdk_home"
6833                 howfound="found automatically"
6834             else
6835                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6836             fi
6837         else
6838             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6839             howfound="you passed"
6840         fi
6841     fi
6843     # 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.
6844     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6845     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6846         with_jdk_home=`/usr/libexec/java_home`
6847     fi
6849     JAVA_HOME=; export JAVA_HOME
6850     if test -z "$with_jdk_home"; then
6851         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6852     else
6853         _java_path="$with_jdk_home/bin/$with_java"
6854         dnl Check if there is a Java interpreter at all.
6855         if test -x "$_java_path"; then
6856             JAVAINTERPRETER=$_java_path
6857         else
6858             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6859         fi
6860     fi
6862     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6863     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6864     dnl loaded by java to run JunitTests:
6865     if test "$build_os" = "cygwin"; then
6866         shortjdkhome=`cygpath -d "$with_jdk_home"`
6867         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
6868             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6869             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6870         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
6871             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6872             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6873         fi
6875         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6876             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6877         fi
6878         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6879     elif test "$cross_compiling" != "yes"; then
6880         case $CPUNAME in
6881             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6882                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6883                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6884                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6885                 fi
6886                 ;;
6887             *) # assumption: everything else 32-bit
6888                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6889                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6890                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6891                 fi
6892                 ;;
6893         esac
6894     fi
6897 HAVE_JAVA9=
6898 dnl ===================================================================
6899 dnl Checks for JDK.
6900 dnl ===================================================================
6902 # Note that JAVA_HOME as for now always means the *build* platform's
6903 # JAVA_HOME. Whether all the complexity here actually is needed any
6904 # more or not, no idea.
6906 if test "$ENABLE_JAVA" != ""; then
6907     _gij_longver=0
6908     AC_MSG_CHECKING([the installed JDK])
6909     if test -n "$JAVAINTERPRETER"; then
6910         dnl java -version sends output to stderr!
6911         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -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 | $GREP -c "GNU libgcj"` -gt 0; then
6914             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6915         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6916             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6917         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6918             JDK=ibm
6920             dnl IBM JDK specific tests
6921             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6922             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6924             if test "$_jdk_ver" -lt 10600; then
6925                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6926             fi
6928             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6930             if test "$with_jdk_home" = ""; then
6931                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6932 you must use the "--with-jdk-home" configure option explicitly])
6933             fi
6935             JAVA_HOME=$with_jdk_home
6936         else
6937             JDK=sun
6939             dnl Sun JDK specific tests
6940             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6941             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6943             if test "$_jdk_ver" -lt 10600; then
6944                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6945             fi
6946             if test "$_jdk_ver" -gt 10600; then
6947                 JAVA_CLASSPATH_NOT_SET="1"
6948             fi
6949             if test "$_jdk_ver" -ge 10900; then
6950                 HAVE_JAVA9=TRUE
6951             fi
6953             AC_MSG_RESULT([checked (JDK $_jdk)])
6954             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6955             if test "$_os" = "WINNT"; then
6956                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6957             fi
6959             # set to limit VM usage for JunitTests
6960             JAVAIFLAGS=-Xmx64M
6961             # set to limit VM usage for javac
6962             JAVAFLAGS=-J-Xmx128M
6963         fi
6964     else
6965         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6966     fi
6967 else
6968     dnl Java disabled
6969     JAVA_HOME=
6970     export JAVA_HOME
6973 dnl ===================================================================
6974 dnl Set target Java bytecode version
6975 dnl ===================================================================
6976 if test "$ENABLE_JAVA" != ""; then
6977     if test "$HAVE_JAVA9" = "TRUE"; then
6978         _java_target_ver="1.6"
6979     else
6980         _java_target_ver="1.5"
6981     fi
6982     JAVA_SOURCE_VER="$_java_target_ver"
6983     JAVA_TARGET_VER="$_java_target_ver"
6986 dnl ===================================================================
6987 dnl Checks for javac
6988 dnl ===================================================================
6989 if test "$ENABLE_JAVA" != ""; then
6990     javacompiler="javac"
6991     if test -z "$with_jdk_home"; then
6992         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6993     else
6994         _javac_path="$with_jdk_home/bin/$javacompiler"
6995         dnl Check if there is a Java compiler at all.
6996         if test -x "$_javac_path"; then
6997             JAVACOMPILER=$_javac_path
6998         fi
6999     fi
7000     if test -z "$JAVACOMPILER"; then
7001         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7002     fi
7003     if test "$build_os" = "cygwin"; then
7004         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7005             JAVACOMPILER="${JAVACOMPILER}.exe"
7006         fi
7007         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7008     fi
7011 dnl ===================================================================
7012 dnl Checks for javadoc
7013 dnl ===================================================================
7014 if test "$ENABLE_JAVA" != ""; then
7015     if test -z "$with_jdk_home"; then
7016         AC_PATH_PROG(JAVADOC, javadoc)
7017     else
7018         _javadoc_path="$with_jdk_home/bin/javadoc"
7019         dnl Check if there is a javadoc at all.
7020         if test -x "$_javadoc_path"; then
7021             JAVADOC=$_javadoc_path
7022         else
7023             AC_PATH_PROG(JAVADOC, javadoc)
7024         fi
7025     fi
7026     if test -z "$JAVADOC"; then
7027         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7028     fi
7029     if test "$build_os" = "cygwin"; then
7030         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7031             JAVADOC="${JAVADOC}.exe"
7032         fi
7033         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7034     fi
7036     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7037     JAVADOCISGJDOC="yes"
7038     fi
7040 AC_SUBST(JAVADOCISGJDOC)
7042 if test "$ENABLE_JAVA" != ""; then
7043     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7044     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7045         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7046            # try to recover first by looking whether we have a alternatives
7047            # system as in Debian or newer SuSEs where following /usr/bin/javac
7048            # over /etc/alternatives/javac leads to the right bindir where we
7049            # just need to strip a bit away to get a valid JAVA_HOME
7050            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7051         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7052             # maybe only one level of symlink (e.g. on Mac)
7053             JAVA_HOME=$(readlink $JAVACOMPILER)
7054             if test "$(dirname $JAVA_HOME)" = "."; then
7055                 # we've got no path to trim back
7056                 JAVA_HOME=""
7057             fi
7058         else
7059             # else warn
7060             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7061             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7062             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7063             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7064         fi
7065         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7066         if test "$JAVA_HOME" != "/usr"; then
7067             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7068                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7069                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7070                 dnl Tiger already returns a JDK path..
7071                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7072             else
7073                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7074                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7075                 dnl that checks which version to run
7076                 if test -f "$JAVA_HOME"; then
7077                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7078                 fi
7079             fi
7080         fi
7081     fi
7082     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7084     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7085     if test -z "$JAVA_HOME"; then
7086         if test "x$with_jdk_home" = "x"; then
7087             cat > findhome.java <<_ACEOF
7088 [import java.io.File;
7090 class findhome
7092     public static void main(String args[])
7093     {
7094         String jrelocation = System.getProperty("java.home");
7095         File jre = new File(jrelocation);
7096         System.out.println(jre.getParent());
7097     }
7099 _ACEOF
7100             AC_MSG_CHECKING([if javac works])
7101             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7102             AC_TRY_EVAL(javac_cmd)
7103             if test $? = 0 -a -f ./findhome.class; then
7104                 AC_MSG_RESULT([javac works])
7105             else
7106                 echo "configure: javac test failed" >&5
7107                 cat findhome.java >&5
7108                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7109             fi
7110             AC_MSG_CHECKING([if gij knows its java.home])
7111             JAVA_HOME=`$JAVAINTERPRETER findhome`
7112             if test $? = 0 -a "$JAVA_HOME" != ""; then
7113                 AC_MSG_RESULT([$JAVA_HOME])
7114             else
7115                 echo "configure: java test failed" >&5
7116                 cat findhome.java >&5
7117                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7118             fi
7119             # clean-up after ourselves
7120             rm -f ./findhome.java ./findhome.class
7121         else
7122             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7123         fi
7124     fi
7126     # now check if $JAVA_HOME is really valid
7127     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7128         case "${JAVA_HOME}" in
7129             /Library/Java/JavaVirtualMachines/*)
7130                 ;;
7131             *)
7132                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7133                 ;;
7134         esac
7135         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7136             JAVA_HOME_OK="NO"
7137         fi
7138     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7139         JAVA_HOME_OK="NO"
7140     fi
7141     if test "$JAVA_HOME_OK" = "NO"; then
7142         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7143         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7144         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7145         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7146         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7147         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7148     fi
7149     PathFormat "$JAVA_HOME"
7150     JAVA_HOME="$formatted_path"
7153 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7154     "$_os" != Darwin
7155 then
7156     AC_MSG_CHECKING([for JAWT lib])
7157     if test "$_os" = WINNT; then
7158         if test "$WITH_MINGW" = yes; then
7159             # The path is taken care of in gb_LinkTarget__use_jawt
7160             # in RepositoryExternal.mk:
7161             JAWTLIB=-ljawt
7162         else
7163             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7164             JAWTLIB=jawt.lib
7165         fi
7166     else
7167         case "$host_cpu" in
7168         arm*)
7169             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7170             JAVA_ARCH=$my_java_arch
7171             ;;
7172         i*86)
7173             my_java_arch=i386
7174             ;;
7175         m68k)
7176             my_java_arch=m68k
7177             ;;
7178         powerpc)
7179             my_java_arch=ppc
7180             ;;
7181         powerpc64)
7182             my_java_arch=ppc64
7183             ;;
7184         powerpc64le)
7185             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7186             JAVA_ARCH=$my_java_arch
7187             ;;
7188         sparc64)
7189             my_java_arch=sparcv9
7190             ;;
7191         x86_64)
7192             my_java_arch=amd64
7193             ;;
7194         *)
7195             my_java_arch=$host_cpu
7196             ;;
7197         esac
7198         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7199         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7200     fi
7201     AC_MSG_RESULT([$JAWTLIB])
7203 AC_SUBST(JAWTLIB)
7205 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7206     case "$host_os" in
7208     aix*)
7209         JAVAINC="-I$JAVA_HOME/include"
7210         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7211         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7212         ;;
7214     cygwin*)
7215         JAVAINC="-I$JAVA_HOME/include/win32"
7216         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7217         ;;
7219     darwin*)
7220         if test -d "$JAVA_HOME/include/darwin"; then
7221             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7222         else
7223             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7224         fi
7225         ;;
7227     dragonfly*)
7228         JAVAINC="-I$JAVA_HOME/include"
7229         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7230         ;;
7232     freebsd*)
7233         JAVAINC="-I$JAVA_HOME/include"
7234         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7235         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7236         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7237         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7238         ;;
7240     k*bsd*-gnu*)
7241         JAVAINC="-I$JAVA_HOME/include"
7242         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7243         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7244         ;;
7246     linux-gnu*)
7247         JAVAINC="-I$JAVA_HOME/include"
7248         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7249         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7250         ;;
7252     mingw*)
7253         JAVAINC="-I$JAVA_HOME/include"
7254         ;;
7256     *netbsd*)
7257         JAVAINC="-I$JAVA_HOME/include"
7258         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7259         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7260        ;;
7262     openbsd*)
7263         JAVAINC="-I$JAVA_HOME/include"
7264         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7265         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7266         ;;
7268     solaris*)
7269         JAVAINC="-I$JAVA_HOME/include"
7270         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7271         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7272         ;;
7273     esac
7275 SOLARINC="$SOLARINC $JAVAINC"
7277 AC_SUBST(JAVACOMPILER)
7278 AC_SUBST(JAVADOC)
7279 AC_SUBST(JAVAINTERPRETER)
7280 AC_SUBST(JAVAIFLAGS)
7281 AC_SUBST(JAVAFLAGS)
7282 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7283 AC_SUBST(JAVA_HOME)
7284 AC_SUBST(JAVA_SOURCE_VER)
7285 AC_SUBST(JAVA_TARGET_VER)
7286 AC_SUBST(JDK)
7289 dnl ===================================================================
7290 dnl Export file validation
7291 dnl ===================================================================
7292 AC_MSG_CHECKING([whether to enable export file validation])
7293 if test "$with_export_validation" = yes; then
7294     if test -z "$ENABLE_JAVA"; then
7295         AC_MSG_RESULT([no, as Java is disabled])
7296     else
7297         AC_MSG_RESULT([yes])
7298         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7300         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7301         if test -z "$ODFVALIDATOR"; then
7302             # remember to download the ODF toolkit with validator later
7303             AC_MSG_NOTICE([no odfvalidator found, will download it])
7304             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7305             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7307             # and fetch name of odfvalidator jar name from download.lst
7308             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7309             AC_SUBST(ODFVALIDATOR_JAR)
7311             if test -z "$ODFVALIDATOR_JAR"; then
7312                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7313             fi
7314         fi
7315         if test "$build_os" = "cygwin"; then
7316             # In case of CygWin it will be executed from Windows,
7317             # so we need to run bash and absolute path to validator
7318             # so instead of "odfvalidator" it will be
7319             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7320             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7321         else
7322             ODFVALIDATOR="sh $ODFVALIDATOR"
7323         fi
7324         AC_SUBST(ODFVALIDATOR)
7327         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7328         if test -z "$OFFICEOTRON"; then
7329             # remember to download the officeotron with validator later
7330             AC_MSG_NOTICE([no officeotron found, will download it])
7331             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7332             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7334             # and fetch name of officeotron jar name from download.lst
7335             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7336             AC_SUBST(OFFICEOTRON_JAR)
7338             if test -z "$OFFICEOTRON_JAR"; then
7339                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7340             fi
7341         else
7342             # check version of existing officeotron
7343             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7344             if test 0"$OFFICEOTRON_VER" -lt 704; then
7345                 AC_MSG_ERROR([officeotron too old])
7346             fi
7347         fi
7348         if test "$build_os" = "cygwin"; then
7349             # In case of CygWin it will be executed from Windows,
7350             # so we need to run bash and absolute path to validator
7351             # so instead of "odfvalidator" it will be
7352             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7353             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7354         else
7355             OFFICEOTRON="sh $OFFICEOTRON"
7356         fi
7357     fi
7358     AC_SUBST(OFFICEOTRON)
7359 else
7360     AC_MSG_RESULT([no])
7363 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7364 if test "$with_bffvalidator" != "no"; then
7365     AC_DEFINE(HAVE_BFFVALIDATOR)
7367     if test "$with_export_validation" != "yes"; then
7368         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7369     fi
7371     if test "$with_bffvalidator" = "yes"; then
7372         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7373     else
7374         BFFVALIDATOR="$with_bffvalidator"
7375     fi
7377     if test "$build_os" = "cygwin"; then
7378         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7379             AC_MSG_RESULT($BFFVALIDATOR)
7380         else
7381             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7382         fi
7383     elif test -n "$BFFVALIDATOR"; then
7384         # We are not in CygWin but need to run Windows binary with wine
7385         AC_PATH_PROGS(WINE, wine)
7387         # so swap in a shell wrapper that converts paths transparently
7388         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7389         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7390         AC_SUBST(BFFVALIDATOR_EXE)
7391         AC_MSG_RESULT($BFFVALIDATOR)
7392     else
7393         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7394     fi
7395     AC_SUBST(BFFVALIDATOR)
7396 else
7397     AC_MSG_RESULT([no])
7400 dnl ===================================================================
7401 dnl Check for C preprocessor to use
7402 dnl ===================================================================
7403 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7404 if test -n "$with_idlc_cpp"; then
7405     AC_MSG_RESULT([$with_idlc_cpp])
7406     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7407 else
7408     AC_MSG_RESULT([ucpp])
7409     AC_MSG_CHECKING([which ucpp tp use])
7410     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7411         AC_MSG_RESULT([external])
7412         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7413     else
7414         AC_MSG_RESULT([internal])
7415         BUILD_TYPE="$BUILD_TYPE UCPP"
7416     fi
7418 AC_SUBST(SYSTEM_UCPP)
7420 dnl ===================================================================
7421 dnl Check for epm (not needed for Windows)
7422 dnl ===================================================================
7423 AC_MSG_CHECKING([whether to enable EPM for packing])
7424 if test "$enable_epm" = "yes"; then
7425     AC_MSG_RESULT([yes])
7426     if test "$_os" != "WINNT"; then
7427         if test $_os = Darwin; then
7428             EPM=internal
7429         elif test -n "$with_epm"; then
7430             EPM=$with_epm
7431         else
7432             AC_PATH_PROG(EPM, epm, no)
7433         fi
7434         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7435             AC_MSG_NOTICE([EPM will be built.])
7436             BUILD_TYPE="$BUILD_TYPE EPM"
7437             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7438         else
7439             # Gentoo has some epm which is something different...
7440             AC_MSG_CHECKING([whether the found epm is the right epm])
7441             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7442                 AC_MSG_RESULT([yes])
7443             else
7444                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7445             fi
7446             AC_MSG_CHECKING([epm version])
7447             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7448             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7449                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7450                 AC_MSG_RESULT([OK, >= 3.7])
7451             else
7452                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7453                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7454             fi
7455         fi
7456     fi
7458     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7459         AC_MSG_CHECKING([for rpm])
7460         for a in "$RPM" rpmbuild rpm; do
7461             $a --usage >/dev/null 2> /dev/null
7462             if test $? -eq 0; then
7463                 RPM=$a
7464                 break
7465             else
7466                 $a --version >/dev/null 2> /dev/null
7467                 if test $? -eq 0; then
7468                     RPM=$a
7469                     break
7470                 fi
7471             fi
7472         done
7473         if test -z "$RPM"; then
7474             AC_MSG_ERROR([not found])
7475         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7476             RPM_PATH=`which $RPM`
7477             AC_MSG_RESULT([$RPM_PATH])
7478             SCPDEFS="$SCPDEFS -DWITH_RPM"
7479         else
7480             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7481         fi
7482     fi
7483     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7484         AC_PATH_PROG(DPKG, dpkg, no)
7485         if test "$DPKG" = "no"; then
7486             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7487         fi
7488     fi
7489     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7490        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7491         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7492             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7493                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7494                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7495                     AC_MSG_RESULT([yes])
7496                 else
7497                     AC_MSG_RESULT([no])
7498                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7499                         _pt="rpm"
7500                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7501                         add_warning "the rpms will need to be installed with --nodeps"
7502                     else
7503                         _pt="pkg"
7504                     fi
7505                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7506                     add_warning "the ${_pt}s will not be relocateable"
7507                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7508                                  relocation will work, you need to patch your epm with the
7509                                  patch in epm/epm-3.7.patch or build with
7510                                  --with-epm=internal which will build a suitable epm])
7511                 fi
7512             fi
7513         fi
7514     fi
7515     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7516         AC_PATH_PROG(PKGMK, pkgmk, no)
7517         if test "$PKGMK" = "no"; then
7518             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7519         fi
7520     fi
7521     AC_SUBST(RPM)
7522     AC_SUBST(DPKG)
7523     AC_SUBST(PKGMK)
7524 else
7525     for i in $PKGFORMAT; do
7526         case "$i" in
7527         aix | bsd | deb | pkg | rpm | native | portable)
7528             AC_MSG_ERROR(
7529                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7530             ;;
7531         esac
7532     done
7533     AC_MSG_RESULT([no])
7534     EPM=NO
7536 AC_SUBST(EPM)
7538 dnl ===================================================================
7539 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7540 dnl ===================================================================
7541 WINEGCC=
7542 if test "$enable_winegcc" = "yes"; then
7543     AC_PATH_PROG(WINEGCC, winegcc)
7544     if test "$WINEGCC" = ""; then
7545         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7546     fi
7547     CC_save="$CC"
7548     ac_exeext_save="$ac_exeext"
7549     CC="$WINEGCC -m32"
7550     ac_exeext=".exe"
7551     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7552 #include <stdio.h>
7553         ],[
7554 printf ("hello world\n");
7555         ])],,
7556         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7557     )
7558     CC="$CC_save"
7559     ac_exeext="$ac_exeext_save"
7561 AC_SUBST(WINEGCC)
7563 if test $_os = iOS; then
7564     enable_mpl_subset=yes
7565     enable_lotuswordpro=no
7566     enable_coinmp=yes
7567     enable_lpsolve=no
7568     enable_postgresql_sdbc=no
7569     enable_extension_integration=no
7570     enable_report_builder=no
7571     with_theme="tango"
7572     with_ppds=no
7575 ENABLE_LWP=
7576 if test "$enable_lotuswordpro" = "yes"; then
7577     ENABLE_LWP="TRUE"
7578     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7580 AC_SUBST(ENABLE_LWP)
7582 dnl ===================================================================
7583 dnl Check for gperf
7584 dnl ===================================================================
7585 AC_PATH_PROG(GPERF, gperf)
7586 if test -z "$GPERF"; then
7587     AC_MSG_ERROR([gperf not found but needed. Install it.])
7589 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7590     GPERF=`cygpath -m $GPERF`
7592 AC_MSG_CHECKING([gperf version])
7593 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7594     AC_MSG_RESULT([OK])
7595 else
7596     AC_MSG_ERROR([too old, you need at least 3.0.0])
7598 AC_SUBST(GPERF)
7600 dnl ===================================================================
7601 dnl Check for building ODK
7602 dnl ===================================================================
7603 if test "$enable_odk" = no; then
7604     unset DOXYGEN
7605 else
7606     if test "$with_doxygen" = no; then
7607         AC_MSG_CHECKING([for doxygen])
7608         unset DOXYGEN
7609         AC_MSG_RESULT([no])
7610     else
7611         if test "$with_doxygen" = yes; then
7612             AC_PATH_PROG([DOXYGEN], [doxygen])
7613             if test -z "$DOXYGEN"; then
7614                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7615             fi
7616         else
7617             AC_MSG_CHECKING([for doxygen])
7618             DOXYGEN=$with_doxygen
7619             AC_MSG_RESULT([$DOXYGEN])
7620         fi
7621         if test -n "$DOXYGEN"; then
7622             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7623             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7624             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7625                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7626             fi
7627         fi
7628     fi
7630 AC_SUBST([DOXYGEN])
7632 AC_MSG_CHECKING([whether to build the ODK])
7633 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7634     AC_MSG_RESULT([yes])
7636     if test "$with_java" != "no"; then
7637         AC_MSG_CHECKING([whether to build unowinreg.dll])
7638         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7639             # build on Win by default
7640             enable_build_unowinreg=yes
7641         fi
7642         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7643             AC_MSG_RESULT([no])
7644             BUILD_UNOWINREG=
7645         else
7646             AC_MSG_RESULT([yes])
7647             BUILD_UNOWINREG=TRUE
7648         fi
7649         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7650             if test -z "$with_mingw_cross_compiler"; then
7651                 dnl Guess...
7652                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7653             elif test -x "$with_mingw_cross_compiler"; then
7654                  MINGWCXX="$with_mingw_cross_compiler"
7655             else
7656                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7657             fi
7659             if test "$MINGWCXX" = "false"; then
7660                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7661             fi
7663             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7664             if test -x "$mingwstrip_test"; then
7665                 MINGWSTRIP="$mingwstrip_test"
7666             else
7667                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7668             fi
7670             if test "$MINGWSTRIP" = "false"; then
7671                 AC_MSG_ERROR(MinGW32 binutils not found.)
7672             fi
7673         fi
7674     fi
7675     BUILD_TYPE="$BUILD_TYPE ODK"
7676 else
7677     AC_MSG_RESULT([no])
7678     BUILD_UNOWINREG=
7680 AC_SUBST(BUILD_UNOWINREG)
7681 AC_SUBST(MINGWCXX)
7682 AC_SUBST(MINGWSTRIP)
7684 dnl ===================================================================
7685 dnl Check for system zlib
7686 dnl ===================================================================
7687 if test "$with_system_zlib" = "auto"; then
7688     case "$_os" in
7689     WINNT)
7690         with_system_zlib="$with_system_libs"
7691         ;;
7692     *)
7693         with_system_zlib=yes
7694         ;;
7695     esac
7698 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7699 dnl and has no pkg-config for it at least on some tinderboxes,
7700 dnl so leaving that out for now
7701 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7702 AC_MSG_CHECKING([which zlib to use])
7703 if test "$with_system_zlib" = "yes"; then
7704     AC_MSG_RESULT([external])
7705     SYSTEM_ZLIB=TRUE
7706     if test "$_os" != "Emscripten"; then
7707         # Emscripten provides its own zlib, don't check for that
7708         AC_CHECK_HEADER(zlib.h, [],
7709             [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7710         AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7711             [AC_MSG_ERROR(zlib not found or functional)], [])
7712     fi
7713 else
7714     AC_MSG_RESULT([internal])
7715     SYSTEM_ZLIB=
7716     BUILD_TYPE="$BUILD_TYPE ZLIB"
7717     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7718     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7720 AC_SUBST(ZLIB_CFLAGS)
7721 AC_SUBST(ZLIB_LIBS)
7722 AC_SUBST(SYSTEM_ZLIB)
7724 dnl ===================================================================
7725 dnl Check for system jpeg
7726 dnl ===================================================================
7727 AC_MSG_CHECKING([which libjpeg to use])
7728 if test "$with_jpeg_turbo" = "auto"; then
7729     # TODO use jpeg-turbo on Darwin too
7730     case "$_os" in
7731     WINNT)
7732         with_jpeg_turbo=yes
7733         ;;
7734     *)
7735         with_jpeg_turbo=no
7736         ;;
7737     esac
7740 if test "$with_system_jpeg" = "yes"; then
7741     AC_MSG_RESULT([external])
7742     SYSTEM_JPEG=TRUE
7743     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7744         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7745     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7746         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7747     libo_MINGW_CHECK_DLL([libjpeg])
7748 else
7749     SYSTEM_JPEG=
7750     if test "$with_jpeg_turbo" = "yes"; then
7751         AC_MSG_RESULT([internal, jpeg-turbo])
7752         BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7753         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7755         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7756             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7757                 NASM="$LODE_HOME/opt/bin/nasm"
7758             elif test -x "/opt/lo/bin/nasm"; then
7759                 NASM="/opt/lo/bin/nasm"
7760             fi
7761         fi
7762         if test -z "$NASM"; then
7763 cat << _EOS
7764 ****************************************************************************
7765 You need nasm (Netwide Assembler) to build internal jpeg library.
7766 To get one please do:
7768 _EOS
7769         if test "$build_os" = "cygwin"; then
7770 cat << _EOS
7771 install a pre-compiled binary for Win32
7773  mkdir -p /opt/lo/bin
7774  cd /opt/lo/bin
7775  wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7776  chmod +x nasm
7777 _EOS
7778             else
7779 cat << _EOS
7780 consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
7781 _EOS
7782             fi
7783 cat << _EOS
7785 or get and install one from http://www.nasm.us/
7787 Then re-run autogen.sh
7789 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7790 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7792 _EOS
7793         AC_MSG_ERROR([no nasm (Netwide Assembler) found])
7794         fi
7795         LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg-turbo"
7796         if test "$COM" = "MSC"; then
7797             LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs/libjpeg.lib"
7798         else
7799             LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs -ljpeg"
7800         fi
7801     else
7802         AC_MSG_RESULT([internal, jpeg])
7803         BUILD_TYPE="$BUILD_TYPE JPEG"
7804         LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg"
7805         if test "$COM" = "MSC"; then
7806             LIBJPEG_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/libjpeg.lib"
7807         else
7808             LIBJPEG_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -ljpeg"
7809         fi
7810     fi
7812 AC_SUBST(NASM)
7813 AC_SUBST(LIBJPEG_CFLAGS)
7814 AC_SUBST(LIBJPEG_LIBS)
7815 AC_SUBST(SYSTEM_JPEG)
7817 dnl ===================================================================
7818 dnl Check for system clucene
7819 dnl ===================================================================
7820 dnl we should rather be using
7821 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7822 dnl but the contribs-lib check seems tricky
7823 AC_MSG_CHECKING([which clucene to use])
7824 if test "$with_system_clucene" = "yes"; then
7825     AC_MSG_RESULT([external])
7826     SYSTEM_CLUCENE=TRUE
7827     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7828     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7829     FilterLibs "${CLUCENE_LIBS}"
7830     CLUCENE_LIBS="${filteredlibs}"
7831     AC_LANG_PUSH([C++])
7832     save_CXXFLAGS=$CXXFLAGS
7833     save_CPPFLAGS=$CPPFLAGS
7834     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7835     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7836     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7837     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7838     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7839                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7840     CXXFLAGS=$save_CXXFLAGS
7841     CPPFLAGS=$save_CPPFLAGS
7842     AC_LANG_POP([C++])
7844     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7845 else
7846     AC_MSG_RESULT([internal])
7847     SYSTEM_CLUCENE=
7848     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7850 AC_SUBST(SYSTEM_CLUCENE)
7851 AC_SUBST(CLUCENE_CFLAGS)
7852 AC_SUBST(CLUCENE_LIBS)
7854 dnl ===================================================================
7855 dnl Check for system expat
7856 dnl ===================================================================
7857 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7858 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7859 AC_MSG_CHECKING([which expat to use])
7860 if test "$with_system_expat" = "yes"; then
7861     AC_MSG_RESULT([external])
7862     SYSTEM_EXPAT=TRUE
7863     AC_CHECK_HEADER(expat.h, [],
7864         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7865     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7866         [AC_MSG_RESULT(expat library not found or functional.)], [])
7867     libo_MINGW_CHECK_DLL([libexpat])
7868 else
7869     AC_MSG_RESULT([internal])
7870     SYSTEM_EXPAT=
7871     BUILD_TYPE="$BUILD_TYPE EXPAT"
7873 AC_SUBST(SYSTEM_EXPAT)
7875 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7876 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7877     ENABLE_EOT="TRUE"
7878     AC_DEFINE([ENABLE_EOT])
7879     AC_MSG_RESULT([yes])
7881     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7882 else
7883     ENABLE_EOT=
7884     AC_MSG_RESULT([no])
7886 AC_SUBST([ENABLE_EOT])
7888 dnl ===================================================================
7889 dnl Check for DLP libs
7890 dnl ===================================================================
7891 AS_IF([test "$COM" = "MSC"],
7892       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7893       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7895 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7897 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7899 AS_IF([test "$COM" = "MSC"],
7900       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7901       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7903 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7905 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7907 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7908 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.4])
7910 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7912 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7914 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7916 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7917 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.9])
7919 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7920 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
7922 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7924 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7925 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7927 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7929 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7931 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7933 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7934 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.2])
7936 dnl ===================================================================
7937 dnl Check for system libcmis
7938 dnl ===================================================================
7939 # libcmis requires curl and we can't build curl for iOS
7940 if test $_os != iOS; then
7941     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7942     ENABLE_CMIS=TRUE
7943 else
7944     ENABLE_CMIS=
7946 AC_SUBST(ENABLE_CMIS)
7948 dnl ===================================================================
7949 dnl Check for system lcms2
7950 dnl ===================================================================
7951 if test "$with_system_lcms2" = "yes"; then
7952     libo_MINGW_CHECK_DLL([liblcms2])
7953 else
7954     SYSTEM_LCMS2=
7956 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7957 if test "$GCC" = "yes"; then
7958     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7960 if test "$COM" = "MSC"; then # override the above
7961     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7964 dnl ===================================================================
7965 dnl Check for system cppunit
7966 dnl ===================================================================
7967 if test "$cross_compiling" != "yes"; then
7968     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7971 dnl ===================================================================
7972 dnl Check whether freetype is available
7973 dnl ===================================================================
7974 if test  "$test_freetype" = "yes"; then
7975     AC_MSG_CHECKING([whether freetype is available])
7976     # FreeType has 3 different kinds of versions
7977     # * release, like 2.4.10
7978     # * libtool, like 13.0.7 (this what pkg-config returns)
7979     # * soname
7980     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7981     #
7982     # 9.9.3 is 2.2.0
7983     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7984     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7985     FilterLibs "${FREETYPE_LIBS}"
7986     FREETYPE_LIBS="${filteredlibs}"
7987     SYSTEM_FREETYPE=TRUE
7988     _save_libs="$LIBS"
7989     _save_cflags="$CFLAGS"
7990     LIBS="$LIBS $FREETYPE_LIBS"
7991     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7992     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7993     LIBS="$_save_libs"
7994     CFLAGS="$_save_cflags"
7996 AC_SUBST(FREETYPE_CFLAGS)
7997 AC_SUBST(FREETYPE_LIBS)
7998 AC_SUBST([SYSTEM_FREETYPE])
8000 # ===================================================================
8001 # Check for system libxslt
8002 # to prevent incompatibilities between internal libxml2 and external libxslt,
8003 # or vice versa, use with_system_libxml here
8004 # ===================================================================
8005 if test "$with_system_libxml" = "auto"; then
8006     case "$_os" in
8007     WINNT|iOS|Android)
8008         with_system_libxml="$with_system_libs"
8009         ;;
8010     *)
8011         with_system_libxml=yes
8012         ;;
8013     esac
8016 AC_MSG_CHECKING([which libxslt to use])
8017 if test "$with_system_libxml" = "yes"; then
8018     AC_MSG_RESULT([external])
8019     SYSTEM_LIBXSLT=TRUE
8020     if test "$_os" = "Darwin"; then
8021         dnl make sure to use SDK path
8022         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8023         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8024         dnl omit -L/usr/lib
8025         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8026         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8027     else
8028         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8029         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8030         FilterLibs "${LIBXSLT_LIBS}"
8031         LIBXSLT_LIBS="${filteredlibs}"
8032         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8033         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8034         FilterLibs "${LIBEXSLT_LIBS}"
8035         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8036     fi
8038     dnl Check for xsltproc
8039     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8040     if test "$XSLTPROC" = "no"; then
8041         AC_MSG_ERROR([xsltproc is required])
8042     fi
8044     libo_MINGW_CHECK_DLL([libxslt])
8045     libo_MINGW_CHECK_DLL([libexslt])
8046     libo_MINGW_TRY_DLL([iconv])
8047 else
8048     AC_MSG_RESULT([internal])
8049     SYSTEM_LIBXSLT=
8050     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8052     if test "$cross_compiling" = "yes"; then
8053         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8054         if test "$XSLTPROC" = "no"; then
8055             AC_MSG_ERROR([xsltproc is required])
8056         fi
8057     fi
8059 AC_SUBST(SYSTEM_LIBXSLT)
8060 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8061     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8063 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8065 AC_SUBST(LIBEXSLT_CFLAGS)
8066 AC_SUBST(LIBEXSLT_LIBS)
8067 AC_SUBST(LIBXSLT_CFLAGS)
8068 AC_SUBST(LIBXSLT_LIBS)
8069 AC_SUBST(XSLTPROC)
8071 # ===================================================================
8072 # Check for system libxml
8073 # ===================================================================
8074 AC_MSG_CHECKING([which libxml to use])
8075 if test "$with_system_libxml" = "yes"; then
8076     AC_MSG_RESULT([external])
8077     SYSTEM_LIBXML=TRUE
8078     if test "$_os" = "Darwin"; then
8079         dnl make sure to use SDK path
8080         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8081         dnl omit -L/usr/lib
8082         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8083     elif test $_os = iOS; then
8084         dnl make sure to use SDK path
8085         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8086         LIBXML_CFLAGS="-I$usr/include/libxml2"
8087         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8088     else
8089         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8090         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8091         FilterLibs "${LIBXML_LIBS}"
8092         LIBXML_LIBS="${filteredlibs}"
8093     fi
8095     dnl Check for xmllint
8096     AC_PATH_PROG(XMLLINT, xmllint, no)
8097     if test "$XMLLINT" = "no"; then
8098         AC_MSG_ERROR([xmllint is required])
8099     fi
8101     libo_MINGW_CHECK_DLL([libxml2])
8102     libo_MINGW_TRY_DLL([zlib1])
8103 else
8104     AC_MSG_RESULT([internal])
8105     SYSTEM_LIBXML=
8106     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
8107     if test "$COM" = "MSC"; then
8108         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8109     fi
8110     if test "$COM" = "MSC"; then
8111         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
8112     else
8113         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
8114     fi
8115     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8117 AC_SUBST(SYSTEM_LIBXML)
8118 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8119     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8121 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8122 AC_SUBST(LIBXML_CFLAGS)
8123 AC_SUBST(LIBXML_LIBS)
8124 AC_SUBST(XMLLINT)
8126 # =====================================================================
8127 # Checking for a Python interpreter with version >= 2.6.
8128 # Build and runtime requires Python 3 compatible version (>= 2.6).
8129 # Optionally user can pass an option to configure, i. e.
8130 # ./configure PYTHON=/usr/bin/python
8131 # =====================================================================
8132 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8133     # This allows a lack of system python with no error, we use internal one in that case.
8134     AM_PATH_PYTHON([2.6],, [:])
8135     # Clean PYTHON_VERSION checked below if cross-compiling
8136     PYTHON_VERSION=""
8137     if test "$PYTHON" != ":"; then
8138         PYTHON_FOR_BUILD=$PYTHON
8139     fi
8141 AC_SUBST(PYTHON_FOR_BUILD)
8143 # Checks for Python to use for Pyuno
8144 AC_MSG_CHECKING([which Python to use for Pyuno])
8145 case "$enable_python" in
8146 no|disable)
8147     if test -z $PYTHON_FOR_BUILD; then
8148         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8149         # requirement from the choice whether to include Python stuff in the installer, but why
8150         # bother?
8151         AC_MSG_ERROR([Python is required at build time.])
8152     fi
8153     enable_python=no
8154     AC_MSG_RESULT([none])
8155     ;;
8156 ""|yes|auto)
8157     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8158         AC_MSG_RESULT([no, overridden by --disable-scripting])
8159         enable_python=no
8160     elif test $build_os = cygwin; then
8161         dnl When building on Windows we don't attempt to use any installed
8162         dnl "system"  Python.
8163         dnl
8164         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
8165         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
8166         dnl MinGW cross-compilation setups.)
8167         AC_MSG_RESULT([fully internal])
8168         enable_python=internal
8169     elif test "$cross_compiling" = yes; then
8170         AC_MSG_RESULT([system])
8171         enable_python=system
8172     else
8173         # Unset variables set by the above AM_PATH_PYTHON so that
8174         # we actually do check anew.
8175         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
8176         AM_PATH_PYTHON([3.3],, [:])
8177         if test "$PYTHON" = ":"; then
8178             if test -z "$PYTHON_FOR_BUILD"; then
8179                 AC_MSG_RESULT([fully internal])
8180             else
8181                 AC_MSG_RESULT([internal])
8182             fi
8183             enable_python=internal
8184         else
8185             AC_MSG_RESULT([system])
8186             enable_python=system
8187         fi
8188     fi
8189     ;;
8190 internal)
8191     AC_MSG_RESULT([internal])
8192     ;;
8193 fully-internal)
8194     AC_MSG_RESULT([fully internal])
8195     enable_python=internal
8196     ;;
8197 system)
8198     AC_MSG_RESULT([system])
8199     ;;
8201     AC_MSG_ERROR([Incorrect --enable-python option])
8202     ;;
8203 esac
8205 if test $enable_python != no; then
8206     BUILD_TYPE="$BUILD_TYPE PYUNO"
8209 if test $enable_python = system; then
8210     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8211         python_version=2.7
8212         PYTHON=python$python_version
8213         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8214             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8215             PYTHON_LIBS="-framework Python"
8216         else
8217             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8218             PYTHON_LIBS="`$PYTHON-config --libs`"
8219         fi
8220     fi
8221     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8222         # Fallback: Accept these in the environment, or as set above
8223         # for MacOSX.
8224         :
8225     elif test "$cross_compiling" != yes; then
8226         # Unset variables set by the above AM_PATH_PYTHON so that
8227         # we actually do check anew.
8228         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
8229         # This causes an error if no python command is found
8230         AM_PATH_PYTHON([3.3])
8231         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8232         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8233         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8234         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8235         if test -z "$PKG_CONFIG"; then
8236             PYTHON_CFLAGS="-I$python_include"
8237             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8238         elif $PKG_CONFIG --exists python-$python_version; then
8239             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8240             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8241         else
8242             PYTHON_CFLAGS="-I$python_include"
8243             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8244         fi
8245         FilterLibs "${PYTHON_LIBS}"
8246         PYTHON_LIBS="${filteredlibs}"
8247     else
8248         dnl How to find out the cross-compilation Python installation path?
8249         dnl Let's hardocode what we know for different distributions for now...
8250         for python_version in 2.6; do
8251             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8252                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8253                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8254                 AC_MSG_CHECKING([for python.exe])
8255                 libo_MINGW_CHECK_DLL([libpython$python_version])
8256                 libo_MINGW_CHECK_DLL([libreadline6])
8257                 libo_MINGW_CHECK_DLL([libtermcap])
8258                 # could we somehow extract the really mingw python version from
8259                 # actual distro package?
8260                 # 2.6.2 currently on OpenSUSE 12.1?
8261                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8262                 PYTHON_VERSION=$python_version.2
8263                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8264                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8265                 break
8266             fi
8267         done
8268         AC_MSG_CHECKING([for python version])
8269         AS_IF([test -n "$PYTHON_VERSION"],
8270               [AC_MSG_RESULT([$PYTHON_VERSION])],
8271               [AC_MSG_RESULT([not found])
8272                AC_MSG_ERROR([no usable python found])])
8273         test -n "$PYTHON_CFLAGS" && break
8274     fi
8275     # let the PYTHON_FOR_BUILD match the same python installation that
8276     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8277     # better for PythonTests.
8278     PYTHON_FOR_BUILD=$PYTHON
8281 dnl By now enable_python should be "system", "internal" or "no"
8282 case $enable_python in
8283 system)
8284     SYSTEM_PYTHON=TRUE
8286     dnl Check if the headers really work
8287     save_CPPFLAGS="$CPPFLAGS"
8288     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8289     AC_CHECK_HEADER(Python.h, [],
8290        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8291        [])
8292     CPPFLAGS="$save_CPPFLAGS"
8294     AC_LANG_PUSH(C)
8295     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8296     AC_MSG_CHECKING([for correct python library version])
8297        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8298 #include <Python.h>
8300 int main(int argc, char **argv) {
8301    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8302        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8303    else return 1;
8305        ]])],[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])])
8306     CFLAGS=$save_CFLAGS
8307     AC_LANG_POP(C)
8309     dnl FIXME Check if the Python library can be linked with, too?
8310     ;;
8312 internal)
8313     SYSTEM_PYTHON=
8314     PYTHON_VERSION_MAJOR=3
8315     # On windows we are supporting two different python versions: 3.3 and 3.5.
8316     # We msut do it as long as we support MSVC 2013. Python 3.3 can be removed
8317     # when MSVC 2013 support was dropped.
8318     if test "$COM" = "MSC" -a "$VCVER" = "120"; then
8319         PYTHON_VERSION_MINOR=3
8320     else
8321         PYTHON_VERSION_MINOR=5
8322     fi
8323     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
8324     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8325     BUILD_TYPE="$BUILD_TYPE PYTHON"
8326     # Embedded Python dies without Home set
8327     if test "$HOME" = ""; then
8328         export HOME=""
8329     fi
8330     # bz2 tarball and bzip2 is not standard
8331     if test -z "$BZIP2"; then
8332         AC_PATH_PROG( BZIP2, bzip2)
8333         if test -z "$BZIP2"; then
8334             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8335         fi
8336     fi
8337     ;;
8339     DISABLE_PYTHON=TRUE
8340     SYSTEM_PYTHON=
8341     ;;
8343     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8344     ;;
8345 esac
8347 AC_SUBST(DISABLE_PYTHON)
8348 AC_SUBST(SYSTEM_PYTHON)
8349 AC_SUBST(PYTHON_CFLAGS)
8350 AC_SUBST(PYTHON_LIBS)
8351 AC_SUBST(PYTHON_VERSION)
8352 AC_SUBST(PYTHON_VERSION_MAJOR)
8353 AC_SUBST(PYTHON_VERSION_MINOR)
8355 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8356 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8357     AC_MSG_RESULT([yes])
8358     ENABLE_MARIADBC=TRUE
8359     MARIADBC_MAJOR=1
8360     MARIADBC_MINOR=0
8361     MARIADBC_MICRO=2
8362     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8363 else
8364     AC_MSG_RESULT([no])
8365     ENABLE_MARIADBC=
8367 AC_SUBST(ENABLE_MARIADBC)
8368 AC_SUBST(MARIADBC_MAJOR)
8369 AC_SUBST(MARIADBC_MINOR)
8370 AC_SUBST(MARIADBC_MICRO)
8372 if test "$ENABLE_MARIADBC" = "TRUE"; then
8374     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8376     dnl ===================================================================
8377     dnl Check for system MariaDB
8378     dnl ===================================================================
8379     AC_MSG_CHECKING([which MariaDB to use])
8380     if test "$with_system_mariadb" = "yes"; then
8381         AC_MSG_RESULT([external])
8382         SYSTEM_MARIADB=TRUE
8383         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8384         if test -z "$MARIADBCONFIG"; then
8385             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8386             if test -z "$MARIADBCONFIG"; then
8387                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8388                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8389             fi
8390         fi
8391         AC_MSG_CHECKING([MariaDB version])
8392         MARIADB_VERSION=`$MARIADBCONFIG --version`
8393         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8394         if test "$MARIADB_MAJOR" -ge "5"; then
8395             AC_MSG_RESULT([OK])
8396         else
8397             AC_MSG_ERROR([too old, use 5.0.x or later])
8398         fi
8399         AC_MSG_CHECKING([for MariaDB Client library])
8400         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8401         if test "$COM_IS_CLANG" = TRUE; then
8402             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8403         fi
8404         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8405         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8406         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8407         dnl linux32:
8408         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8409             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8410             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8411                 | sed -e 's|/lib64/|/lib/|')
8412         fi
8413         FilterLibs "${MARIADB_LIBS}"
8414         MARIADB_LIBS="${filteredlibs}"
8415         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8416         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8417         if test "$enable_bundle_mariadb" = "yes"; then
8418             AC_MSG_RESULT([yes])
8419             BUNDLE_MARIADB=TRUE
8420             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8422 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8424 /g' | grep -E '(mysqlclient|mariadb)')
8425             if test "$_os" = "Darwin"; then
8426                 LIBMARIADB=${LIBMARIADB}.dylib
8427             elif test "$_os" = "WINNT"; then
8428                 LIBMARIADB=${LIBMARIADB}.dll
8429             else
8430                 LIBMARIADB=${LIBMARIADB}.so
8431             fi
8432             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8433             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8434             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8435                 AC_MSG_RESULT([found.])
8436                 PathFormat "$LIBMARIADB_PATH"
8437                 LIBMARIADB_PATH="$formatted_path"
8438             else
8439                 AC_MSG_ERROR([not found.])
8440             fi
8441         else
8442             AC_MSG_RESULT([no])
8443             BUNDLE_MARIADB=
8444         fi
8445     else
8446         AC_MSG_RESULT([internal])
8447         SYSTEM_MARIADB=
8448         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8449         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8450         BUILD_TYPE="$BUILD_TYPE MARIADB"
8451     fi
8453     AC_SUBST(SYSTEM_MARIADB)
8454     AC_SUBST(MARIADB_CFLAGS)
8455     AC_SUBST(MARIADB_LIBS)
8456     AC_SUBST(LIBMARIADB)
8457     AC_SUBST(LIBMARIADB_PATH)
8458     AC_SUBST(BUNDLE_MARIADB)
8460     AC_LANG_PUSH([C++])
8461     dnl ===================================================================
8462     dnl Check for system MySQL C++ Connector
8463     dnl ===================================================================
8464     # FIXME!
8465     # who thought this too-generic cppconn dir was a good idea?
8466     AC_MSG_CHECKING([MySQL Connector/C++])
8467     if test "$with_system_mysql_cppconn" = "yes"; then
8468         AC_MSG_RESULT([external])
8469         SYSTEM_MYSQL_CPPCONN=TRUE
8470         AC_LANG_PUSH([C++])
8471         AC_CHECK_HEADER(mysql_driver.h, [],
8472                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8473         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8474                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8475         save_LIBS=$LIBS
8476         LIBS="$LIBS -lmysqlcppconn"
8477         AC_MSG_CHECKING([version])
8478         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8479 #include <mysql_driver.h>
8481 int main(int argc, char **argv) {
8482     sql::Driver *driver;
8483     driver = get_driver_instance();
8484     if (driver->getMajorVersion() > 1 || \
8485        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8486        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8487         return 0;
8488       else
8489         return 1;
8491       ]])],[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])])
8493         AC_LANG_POP([C++])
8494         LIBS=$save_LIBS
8495     else
8496         AC_MSG_RESULT([internal])
8497         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8498         SYSTEM_MYSQL_CPPCONN=
8499     fi
8500     AC_LANG_POP([C++])
8502 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8504 dnl ===================================================================
8505 dnl Check for system hsqldb
8506 dnl ===================================================================
8507 if test "$with_java" != "no"; then
8508     HSQLDB_USE_JDBC_4_1=
8509     AC_MSG_CHECKING([which hsqldb to use])
8510     if test "$with_system_hsqldb" = "yes"; then
8511         AC_MSG_RESULT([external])
8512         SYSTEM_HSQLDB=TRUE
8513         if test -z $HSQLDB_JAR; then
8514             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8515         fi
8516         if ! test -f $HSQLDB_JAR; then
8517                AC_MSG_ERROR(hsqldb.jar not found.)
8518         fi
8519         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8520         export HSQLDB_JAR
8521         if $PERL -e \
8522            'use Archive::Zip;
8523             my $file = "$ENV{'HSQLDB_JAR'}";
8524             my $zip = Archive::Zip->new( $file );
8525             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8526             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8527             {
8528                 push @l, split(/\n/, $mf);
8529                 foreach my $line (@l)
8530                 {
8531                     if ($line =~ m/Specification-Version:/)
8532                     {
8533                         ($t, $version) = split (/:/,$line);
8534                         $version =~ s/^\s//;
8535                         ($a, $b, $c, $d) = split (/\./,$version);
8536                         if ($c == "0" && $d > "8")
8537                         {
8538                             exit 0;
8539                         }
8540                         else
8541                         {
8542                             exit 1;
8543                         }
8544                     }
8545                 }
8546             }
8547             else
8548             {
8549                 exit 1;
8550             }'; then
8551             AC_MSG_RESULT([yes])
8552         else
8553             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8554         fi
8555     else
8556         AC_MSG_RESULT([internal])
8557         SYSTEM_HSQLDB=
8558         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8559         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8560         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8561         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8562             AC_MSG_RESULT([yes])
8563             HSQLDB_USE_JDBC_4_1=TRUE
8564         else
8565             AC_MSG_RESULT([no])
8566         fi
8567     fi
8568     AC_SUBST(SYSTEM_HSQLDB)
8569     AC_SUBST(HSQLDB_JAR)
8570     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8573 dnl ===================================================================
8574 dnl Check for PostgreSQL stuff
8575 dnl ===================================================================
8576 if test "x$enable_postgresql_sdbc" != "xno"; then
8577     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8579     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8580         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8581     fi
8582     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8583         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8584     fi
8586     postgres_interface=""
8587     if test "$with_system_postgresql" = "yes"; then
8588         postgres_interface="external PostgreSQL"
8589         SYSTEM_POSTGRESQL=TRUE
8590         if test "$_os" = Darwin; then
8591             supp_path=''
8592             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8593                 pg_supp_path="$P_SEP$d$pg_supp_path"
8594             done
8595         fi
8596         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8597         if test -z "$PGCONFIG"; then
8598             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8599         fi
8600         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8601         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8602         FilterLibs "${POSTGRESQL_LIB}"
8603         POSTGRESQL_LIB="${filteredlibs}"
8604     else
8605         # if/when anything else than PostgreSQL uses Kerberos,
8606         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8607         WITH_KRB5=
8608         WITH_GSSAPI=
8609         case "$_os" in
8610         Darwin)
8611             # MacOS X has system MIT Kerberos 5 since 10.4
8612             if test "$with_krb5" != "no"; then
8613                 WITH_KRB5=TRUE
8614                 save_LIBS=$LIBS
8615                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8616                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8617                 KRB5_LIBS=$LIBS
8618                 LIBS=$save_LIBS
8619                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8620                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8621                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8622                 LIBS=$save_LIBS
8623             fi
8624             if test "$with_gssapi" != "no"; then
8625                 WITH_GSSAPI=TRUE
8626                 save_LIBS=$LIBS
8627                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8628                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8629                 GSSAPI_LIBS=$LIBS
8630                 LIBS=$save_LIBS
8631             fi
8632             ;;
8633         WINNT)
8634             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8635                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8636             fi
8637             ;;
8638         Linux|GNU|*BSD|DragonFly)
8639             if test "$with_krb5" != "no"; then
8640                 WITH_KRB5=TRUE
8641                 save_LIBS=$LIBS
8642                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8643                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8644                 KRB5_LIBS=$LIBS
8645                 LIBS=$save_LIBS
8646                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8647                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8648                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8649                 LIBS=$save_LIBS
8650             fi
8651             if test "$with_gssapi" != "no"; then
8652                 WITH_GSSAPI=TRUE
8653                 save_LIBS=$LIBS
8654                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8655                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8656                 GSSAPI_LIBS=$LIBS
8657                 LIBS=$save_LIBS
8658             fi
8659             ;;
8660         *)
8661             if test "$with_krb5" = "yes"; then
8662                 WITH_KRB5=TRUE
8663                 save_LIBS=$LIBS
8664                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8665                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8666                 KRB5_LIBS=$LIBS
8667                 LIBS=$save_LIBS
8668                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8669                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8670                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8671                 LIBS=$save_LIBS
8672             fi
8673             if test "$with_gssapi" = "yes"; then
8674                 WITH_GSSAPI=TRUE
8675                 save_LIBS=$LIBS
8676                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8677                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8678                 LIBS=$save_LIBS
8679                 GSSAPI_LIBS=$LIBS
8680             fi
8681         esac
8683         if test -n "$with_libpq_path"; then
8684             SYSTEM_POSTGRESQL=TRUE
8685             postgres_interface="external libpq"
8686             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8687             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8688         else
8689             SYSTEM_POSTGRESQL=
8690             postgres_interface="internal"
8691             POSTGRESQL_LIB=""
8692             POSTGRESQL_INC="%OVERRIDE_ME%"
8693             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8694         fi
8695     fi
8697     AC_MSG_CHECKING([PostgreSQL C interface])
8698     AC_MSG_RESULT([$postgres_interface])
8700     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8701         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8702         save_CFLAGS=$CFLAGS
8703         save_CPPFLAGS=$CPPFLAGS
8704         save_LIBS=$LIBS
8705         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8706         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8707         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8708         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8709             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8710         CFLAGS=$save_CFLAGS
8711         CPPFLAGS=$save_CPPFLAGS
8712         LIBS=$save_LIBS
8713     fi
8714     BUILD_POSTGRESQL_SDBC=TRUE
8716 AC_SUBST(WITH_KRB5)
8717 AC_SUBST(WITH_GSSAPI)
8718 AC_SUBST(GSSAPI_LIBS)
8719 AC_SUBST(KRB5_LIBS)
8720 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8721 AC_SUBST(SYSTEM_POSTGRESQL)
8722 AC_SUBST(POSTGRESQL_INC)
8723 AC_SUBST(POSTGRESQL_LIB)
8725 dnl ===================================================================
8726 dnl Check for Firebird stuff
8727 dnl ===================================================================
8728 ENABLE_FIREBIRD_SDBC=""
8729 if test "$enable_firebird_sdbc" = "yes" ; then
8730     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8732     dnl ===================================================================
8733     dnl Check for system Firebird
8734     dnl ===================================================================
8735     AC_MSG_CHECKING([which Firebird to use])
8736     if test "$with_system_firebird" = "yes"; then
8737         AC_MSG_RESULT([external])
8738         SYSTEM_FIREBIRD=TRUE
8739         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8740         if test -z "$FIREBIRDCONFIG"; then
8741             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8742             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8743                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8744             ])
8745             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8746         else
8747             AC_MSG_NOTICE([fb_config found])
8748             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8749             AC_MSG_CHECKING([for Firebird Client library])
8750             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8751             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8752             FilterLibs "${FIREBIRD_LIBS}"
8753             FIREBIRD_LIBS="${filteredlibs}"
8754         fi
8755         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8756         AC_MSG_CHECKING([Firebird version])
8757         if test -n "${FIREBIRD_VERSION}"; then
8758             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8759             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8760             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8761                 AC_MSG_RESULT([OK])
8762             else
8763                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8764             fi
8765         else
8766             __save_CFLAGS="${CFLAGS}"
8767             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8768             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8769 #if defined(FB_API_VER) && FB_API_VER == 30
8770 int fb_api_is_30(void) { return 0; }
8771 #else
8772 #error "Wrong Firebird API version"
8773 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8774             CFLAGS="${__save_CFLAGS}"
8775         fi
8776         ENABLE_FIREBIRD_SDBC="TRUE"
8777     elif test "$enable_database_connectivity" != yes; then
8778         AC_MSG_RESULT([none])
8779     elif test "$cross_compiling" = "yes"; then
8780         AC_MSG_RESULT([none])
8781     else
8782         dnl Embedded Firebird has version 3.0
8783         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8784         dnl We need libatomic-ops for any non X86/X64 system
8785         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8786             dnl ===================================================================
8787             dnl Check for system libatomic-ops
8788             dnl ===================================================================
8789             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8790             if test "$with_system_libatomic_ops" = "yes"; then
8791                 SYSTEM_LIBATOMIC_OPS=TRUE
8792                 AC_CHECK_HEADERS(atomic_ops.h, [],
8793                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8794             else
8795                 SYSTEM_LIBATOMIC_OPS=
8796                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8797                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8798                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8799             fi
8800         fi
8802         AC_MSG_RESULT([internal])
8803         SYSTEM_FIREBIRD=
8804         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8805         FIREBIRD_LIBS="-lfbclient"
8807         if test "$with_system_libtommath" = "yes"; then
8808             SYSTEM_LIBTOMMATH=TRUE
8809             dnl check for tommath presence
8810             save_LIBS=$LIBS
8811             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8812             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8813             LIBS=$save_LIBS
8814         else
8815             SYSTEM_LIBTOMMATH=
8816             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8817             LIBTOMMATH_LIBS="-ltommath"
8818             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8819         fi
8821         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8822         ENABLE_FIREBIRD_SDBC="TRUE"
8823     fi
8825 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8826 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8827 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8828 AC_SUBST(LIBATOMIC_OPS_LIBS)
8829 AC_SUBST(SYSTEM_FIREBIRD)
8830 AC_SUBST(FIREBIRD_CFLAGS)
8831 AC_SUBST(FIREBIRD_LIBS)
8832 AC_SUBST([TOMMATH_CFLAGS])
8833 AC_SUBST([TOMMATH_LIBS])
8835 dnl ===================================================================
8836 dnl Check for system curl
8837 dnl ===================================================================
8838 AC_MSG_CHECKING([which libcurl to use])
8839 if test "$with_system_curl" = "auto"; then
8840     with_system_curl="$with_system_libs"
8843 if test "$with_system_curl" = "yes"; then
8844     AC_MSG_RESULT([external])
8845     SYSTEM_CURL=TRUE
8847     # First try PKGCONFIG and then fall back
8848     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8850     if test -n "$CURL_PKG_ERRORS"; then
8851         AC_PATH_PROG(CURLCONFIG, curl-config)
8852         if test -z "$CURLCONFIG"; then
8853             AC_MSG_ERROR([curl development files not found])
8854         fi
8855         CURL_LIBS=`$CURLCONFIG --libs`
8856         FilterLibs "${CURL_LIBS}"
8857         CURL_LIBS="${filteredlibs}"
8858         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8859         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8861         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8862         case $curl_version in
8863         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8864         dnl so they need to be doubled to end up in the configure script
8865         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8866             AC_MSG_RESULT([yes])
8867             ;;
8868         *)
8869             AC_MSG_ERROR([no, you have $curl_version])
8870             ;;
8871         esac
8872     fi
8874     libo_MINGW_CHECK_DLL([libcurl])
8875     libo_MINGW_TRY_DLL([libintl])
8876     libo_MINGW_TRY_DLL([libidn])
8877     libo_MINGW_TRY_DLL([libnspr4])
8878     libo_MINGW_TRY_DLL([nssutil3])
8879     libo_MINGW_TRY_DLL([libplc4])
8880     libo_MINGW_TRY_DLL([libplds4])
8881     libo_MINGW_TRY_DLL([nss3])
8882     libo_MINGW_TRY_DLL([ssl3])
8883     libo_MINGW_TRY_DLL([libgpg-error])
8884     libo_MINGW_TRY_DLL([libgcrypt])
8885     libo_MINGW_TRY_DLL([libssh2])
8886     ENABLE_CURL=TRUE
8887 elif test $_os = iOS; then
8888     # Let's see if we need curl, I think not?
8889     AC_MSG_RESULT([none])
8890     ENABLE_CURL=
8891 else
8892     AC_MSG_RESULT([internal])
8893     SYSTEM_CURL=
8894     BUILD_TYPE="$BUILD_TYPE CURL"
8895     ENABLE_CURL=TRUE
8897 AC_SUBST(SYSTEM_CURL)
8898 AC_SUBST(CURL_CFLAGS)
8899 AC_SUBST(CURL_LIBS)
8900 AC_SUBST(ENABLE_CURL)
8902 dnl ===================================================================
8903 dnl Check for system boost
8904 dnl ===================================================================
8905 AC_MSG_CHECKING([which boost to use])
8906 if test "$with_system_boost" = "yes"; then
8907     AC_MSG_RESULT([external])
8908     SYSTEM_BOOST=TRUE
8909     AX_BOOST_BASE(1.47)
8910     AX_BOOST_DATE_TIME
8911     AX_BOOST_FILESYSTEM
8912     AX_BOOST_IOSTREAMS
8913     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8914     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8915     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8916         # if not found, try again with 'lib' prefix
8917         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8918     fi
8919     AC_LANG_PUSH([C++])
8920     save_CXXFLAGS=$CXXFLAGS
8921     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8922     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8923        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8924     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8925        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8926     AC_CHECK_HEADER(boost/function.hpp, [],
8927        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8928     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8929     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8930     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8931 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8932     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8933         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8934     else
8935         AC_MSG_RESULT([yes])
8936     fi
8937     CXXFLAGS=$save_CXXFLAGS
8938     AC_LANG_POP([C++])
8939     # this is in m4/ax_boost_base.m4
8940     FilterLibs "${BOOST_LDFLAGS}"
8941     BOOST_LDFLAGS="${filteredlibs}"
8942 else
8943     AC_MSG_RESULT([internal])
8944     BUILD_TYPE="$BUILD_TYPE BOOST"
8945     SYSTEM_BOOST=
8946     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8947         # use warning-suppressing wrapper headers
8948         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8949     else
8950         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8951     fi
8953 AC_SUBST(SYSTEM_BOOST)
8955 dnl ===================================================================
8956 dnl Check for system mdds
8957 dnl ===================================================================
8958 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8960 dnl ===================================================================
8961 dnl Check for system glm
8962 dnl ===================================================================
8963 AC_MSG_CHECKING([which glm to use])
8964 if test "$with_system_glm" = "yes"; then
8965     AC_MSG_RESULT([external])
8966     SYSTEM_GLM=TRUE
8967     AC_LANG_PUSH([C++])
8968     AC_CHECK_HEADER([glm/glm.hpp], [],
8969        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8970     AC_LANG_POP([C++])
8971 else
8972     AC_MSG_RESULT([internal])
8973     BUILD_TYPE="$BUILD_TYPE GLM"
8974     SYSTEM_GLM=
8975     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8977 AC_SUBST([GLM_CFLAGS])
8978 AC_SUBST([SYSTEM_GLM])
8980 dnl ===================================================================
8981 dnl Check for system glew
8982 dnl ===================================================================
8983 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8984 AS_IF([test "$with_system_glew" = "yes"],
8985     [PKG_CHECK_EXISTS([glew >= 1.12.0], [AC_DEFINE([HAVE_GLEW_1_12])])],
8986     [AC_DEFINE([HAVE_GLEW_1_12])])
8988 dnl ===================================================================
8989 dnl Check for system odbc
8990 dnl ===================================================================
8991 AC_MSG_CHECKING([which odbc headers to use])
8992 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
8993     AC_MSG_RESULT([external])
8994     SYSTEM_ODBC_HEADERS=TRUE
8996     if test "$build_os" = "cygwin"; then
8997         save_CPPFLAGS=$CPPFLAGS
8998         find_winsdk
8999         PathFormat "$winsdktest"
9000         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"
9001         AC_CHECK_HEADER(sqlext.h, [],
9002             [AC_MSG_ERROR(odbc not found. install odbc)],
9003             [#include <windows.h>])
9004         CPPFLAGS=$save_CPPFLAGS
9005     else
9006         AC_CHECK_HEADER(sqlext.h, [],
9007             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9008     fi
9009 elif test "$enable_database_connectivity" != yes; then
9010     AC_MSG_RESULT([none])
9011 else
9012     AC_MSG_RESULT([internal])
9013     SYSTEM_ODBC_HEADERS=
9015 AC_SUBST(SYSTEM_ODBC_HEADERS)
9018 dnl ===================================================================
9019 dnl Check for system openldap
9020 dnl ===================================================================
9022 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9023 AC_MSG_CHECKING([which openldap library to use])
9024 if test "$with_system_openldap" = "yes"; then
9025     AC_MSG_RESULT([external])
9026     SYSTEM_OPENLDAP=TRUE
9027     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9028     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9029     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9030 else
9031     AC_MSG_RESULT([internal])
9032     SYSTEM_OPENLDAP=
9033     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9036 AC_SUBST(SYSTEM_OPENLDAP)
9038 dnl ===================================================================
9039 dnl Check for TLS/SSL and cryptographic implementation to use
9040 dnl ===================================================================
9041 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9042 if test -n "$with_tls"; then
9043     case $with_tls in
9044     openssl)
9045         AC_DEFINE(USE_TLS_OPENSSL)
9046         TLS=OPENSSL
9048         if test "$enable_openssl" != "yes"; then
9049             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9050         fi
9052         # warn that OpenSSL has been selected but not all TLS code has this option
9053         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
9054         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
9055         ;;
9056     nss)
9057         AC_DEFINE(USE_TLS_NSS)
9058         TLS=NSS
9059         ;;
9060     *)
9061         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9062 openssl - OpenSSL
9063 nss - Mozilla's Network Security Services (NSS)
9064     ])
9065         ;;
9066     esac
9067 elif test $_os = iOS -o $_os = Android; then
9068     # We don't build NSS for iOS and Android
9069     AC_DEFINE(USE_TLS_OPENSSL)
9070     TLS=OPENSSL
9071 else
9072     # default to using NSS, it results in smaller oox lib
9073     AC_DEFINE(USE_TLS_NSS)
9074     TLS=NSS
9076 AC_MSG_RESULT([$TLS])
9077 AC_SUBST(TLS)
9079 dnl ===================================================================
9080 dnl Check for system NSS
9081 dnl ===================================================================
9082 if test $_os != iOS; then
9083     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9085 if test "$with_system_nss" = "yes"; then
9086     libo_MINGW_CHECK_DLL([libnspr4])
9087     libo_MINGW_CHECK_DLL([libplc4])
9088     libo_MINGW_CHECK_DLL([libplds4])
9089     libo_MINGW_CHECK_DLL([nss3])
9090     libo_MINGW_CHECK_DLL([nssutil3])
9091     libo_MINGW_CHECK_DLL([smime3])
9092     libo_MINGW_CHECK_DLL([ssl3])
9095 dnl ===================================================================
9096 dnl Check for system sane
9097 dnl ===================================================================
9098 AC_MSG_CHECKING([which sane header to use])
9099 if test "$with_system_sane" = "yes"; then
9100     AC_MSG_RESULT([external])
9101     AC_CHECK_HEADER(sane/sane.h, [],
9102       [AC_MSG_ERROR(sane not found. install sane)], [])
9103 else
9104     AC_MSG_RESULT([internal])
9105     BUILD_TYPE="$BUILD_TYPE SANE"
9108 dnl ===================================================================
9109 dnl Check for system icu
9110 dnl ===================================================================
9111 SYSTEM_GENBRK=
9112 SYSTEM_GENCCODE=
9113 SYSTEM_GENCMN=
9115 ICU_MAJOR=58
9116 ICU_MINOR=1
9117 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9118 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9119 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9120 AC_MSG_CHECKING([which icu to use])
9121 if test "$with_system_icu" = "yes"; then
9122     AC_MSG_RESULT([external])
9123     SYSTEM_ICU=TRUE
9124     AC_LANG_PUSH([C++])
9125     AC_MSG_CHECKING([for unicode/rbbi.h])
9126     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9127     AC_LANG_POP([C++])
9129     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
9130         ICUPATH="$PATH"
9131         if test "$WITH_MINGW" = "yes"; then
9132             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
9133         fi
9134         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
9136         AC_MSG_CHECKING([ICU version])
9137         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9138         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9139         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9141         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "6" \); then
9142             AC_MSG_RESULT([OK, $ICU_VERSION])
9143         else
9144             AC_MSG_ERROR([not suitable, only >= 4.6 supported currently])
9145         fi
9146     fi
9148     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9149         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9150         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9151         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9152         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9153         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9154         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9155             AC_MSG_RESULT([yes])
9156         else
9157             AC_MSG_RESULT([no])
9158             if test "$with_system_icu_for_build" != "force"; then
9159                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9160 You can use --with-system-icu-for-build=force to use it anyway.])
9161             fi
9162         fi
9163     fi
9165     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9166         # using the system icu tools can lead to version confusion, use the
9167         # ones from the build environment when cross-compiling
9168         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9169         if test -z "$SYSTEM_GENBRK"; then
9170             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9171         fi
9172         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9173         if test -z "$SYSTEM_GENCCODE"; then
9174             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9175         fi
9176         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9177         if test -z "$SYSTEM_GENCMN"; then
9178             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9179         fi
9180         if test "$ICU_MAJOR" -ge "49"; then
9181             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9182             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9183             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9184         else
9185             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9186             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9187             ICU_RECLASSIFIED_HEBREW_LETTER=
9188         fi
9189     fi
9191     if test "$cross_compiling" = "yes"; then
9192         if test "$ICU_MAJOR" -ge "50"; then
9193             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9194             ICU_MINOR=""
9195         fi
9196     fi
9198     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9199     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9200     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9201 else
9202     AC_MSG_RESULT([internal])
9203     SYSTEM_ICU=
9204     BUILD_TYPE="$BUILD_TYPE ICU"
9205     # surprisingly set these only for "internal" (to be used by various other
9206     # external libs): the system icu-config is quite unhelpful and spits out
9207     # dozens of weird flags and also default path -I/usr/include
9208     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9209     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9211 AC_SUBST(SYSTEM_ICU)
9212 AC_SUBST(SYSTEM_GENBRK)
9213 AC_SUBST(SYSTEM_GENCCODE)
9214 AC_SUBST(SYSTEM_GENCMN)
9215 AC_SUBST(ICU_MAJOR)
9216 AC_SUBST(ICU_MINOR)
9217 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9218 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9219 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9220 AC_SUBST(ICU_CFLAGS)
9221 AC_SUBST(ICU_LIBS)
9223 dnl ===================================================================
9224 dnl Graphite
9225 dnl ===================================================================
9226 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9227 if test "$with_system_graphite" = "yes"; then
9228     libo_MINGW_CHECK_DLL([libgraphite2])
9230 if test "$COM" = "MSC"; then # override the above
9231     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9234 # This is the old Graphite support that will eventually be removed
9235 AC_MSG_CHECKING([whether to enable graphite support])
9236 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9237     AC_MSG_RESULT([yes])
9238     ENABLE_GRAPHITE="TRUE"
9239     AC_DEFINE(ENABLE_GRAPHITE)
9241 else
9242     AC_MSG_RESULT([no])
9244 AC_SUBST(ENABLE_GRAPHITE)
9246 dnl ==================================================================
9247 dnl Breakpad
9248 dnl ==================================================================
9249 AC_MSG_CHECKING([whether to enable breakpad])
9250 if test "$enable_breakpad" != yes; then
9251     AC_MSG_RESULT([no])
9252 else
9253     AC_MSG_RESULT([yes])
9254     ENABLE_BREAKPAD="TRUE"
9255     AC_DEFINE(ENABLE_BREAKPAD)
9256     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9257     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9259     AC_MSG_CHECKING([for crashreport config])
9260     if test "$with_symbol_config" = "no"; then
9261         BREAKPAD_SYMBOL_CONFIG="invalid"
9262         AC_MSG_RESULT([no])
9263     else
9264         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9265         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9266         AC_MSG_RESULT([yes])
9267     fi
9268     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9270 AC_SUBST(ENABLE_BREAKPAD)
9272 dnl ===================================================================
9273 dnl Orcus
9274 dnl ===================================================================
9276 AC_MSG_CHECKING([whether to enable orcus])
9277 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9278     AC_MSG_RESULT([yes])
9279     ENABLE_ORCUS="TRUE"
9280     AC_DEFINE(ENABLE_ORCUS)
9282     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.12 >= 0.12.0])
9283     if test "$with_system_orcus" != "yes"; then
9284         if test "$SYSTEM_BOOST" = "TRUE"; then
9285             # ===========================================================
9286             # Determine if we are going to need to link with Boost.System
9287             # ===========================================================
9288             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9289             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9290             dnl in documentation has no effect.
9291             AC_MSG_CHECKING([if we need to link with Boost.System])
9292             AC_LANG_PUSH([C++])
9293             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9294                     @%:@include <boost/version.hpp>
9295                 ]],[[
9296                     #if BOOST_VERSION >= 105000
9297                     #   error yes, we need to link with Boost.System
9298                     #endif
9299                 ]])],[
9300                     AC_MSG_RESULT([no])
9301                 ],[
9302                     AC_MSG_RESULT([yes])
9303                     AX_BOOST_SYSTEM
9304             ])
9305             AC_LANG_POP([C++])
9306         fi
9307     fi
9308     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9309     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9310     AC_SUBST([BOOST_SYSTEM_LIB])
9311     AC_SUBST(SYSTEM_LIBORCUS)
9313 else
9314     AC_MSG_RESULT([no])
9316 AC_SUBST(ENABLE_ORCUS)
9318 dnl ===================================================================
9319 dnl HarfBuzz
9320 dnl ===================================================================
9321 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9322 if test "$COM" = "MSC"; then # override the above
9323     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9325 if test "$with_system_harfbuzz" = "yes"; then
9326     if test "$with_system_graphite" = "no"; then
9327         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9328     fi
9329     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9330     _save_libs="$LIBS"
9331     _save_cflags="$CFLAGS"
9332     LIBS="$LIBS $HARFBUZZ_LIBS"
9333     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9334     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9335     LIBS="$_save_libs"
9336     CFLAGS="$_save_cflags"
9337 else
9338     if test "$with_system_graphite" = "yes"; then
9339         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9340     fi
9343 AC_MSG_CHECKING([whether to use X11])
9344 dnl ***************************************
9345 dnl testing for X libraries and includes...
9346 dnl ***************************************
9347 if test "$USING_X11" = TRUE; then
9348     AC_DEFINE(HAVE_FEATURE_X11)
9350 AC_MSG_RESULT([$USING_X11])
9352 if test "$USING_X11" = TRUE; then
9353     AC_PATH_X
9354     AC_PATH_XTRA
9355     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9357     if test -z "$x_includes"; then
9358         x_includes="default_x_includes"
9359     fi
9360     if test -z "$x_libraries"; then
9361         x_libraries="default_x_libraries"
9362     fi
9363     CFLAGS="$CFLAGS $X_CFLAGS"
9364     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9365     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9366 else
9367     x_includes="no_x_includes"
9368     x_libraries="no_x_libraries"
9371 if test "$USING_X11" = TRUE; then
9372     dnl ===================================================================
9373     dnl Check for Composite.h for Mozilla plugin
9374     dnl ===================================================================
9375     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9376      [#include <X11/Intrinsic.h>])
9378     dnl ===================================================================
9379     dnl Check for extension headers
9380     dnl ===================================================================
9381     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9382      [#include <X11/extensions/shape.h>])
9384     # vcl needs ICE and SM
9385     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9386     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9387         [AC_MSG_ERROR(ICE library not found)])
9388     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9389     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9390         [AC_MSG_ERROR(SM library not found)])
9393 dnl ===================================================================
9394 dnl Check for system Xrender
9395 dnl ===================================================================
9396 AC_MSG_CHECKING([whether to use Xrender])
9397 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9398     AC_MSG_RESULT([yes])
9399     PKG_CHECK_MODULES(XRENDER, xrender)
9400     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9401     FilterLibs "${XRENDER_LIBS}"
9402     XRENDER_LIBS="${filteredlibs}"
9403     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9404       [AC_MSG_ERROR(libXrender not found or functional)], [])
9405     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9406       [AC_MSG_ERROR(Xrender not found. install X)], [])
9407 else
9408     AC_MSG_RESULT([no])
9410 AC_SUBST(XRENDER_CFLAGS)
9411 AC_SUBST(XRENDER_LIBS)
9413 dnl ===================================================================
9414 dnl Check for XRandr
9415 dnl ===================================================================
9416 AC_MSG_CHECKING([whether to enable RandR support])
9417 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9418     AC_MSG_RESULT([yes])
9419     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9420     if test "$ENABLE_RANDR" != "TRUE"; then
9421         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9422                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9423         XRANDR_CFLAGS=" "
9424         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9425           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9426         XRANDR_LIBS="-lXrandr "
9427         ENABLE_RANDR="TRUE"
9428     fi
9429     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9430     FilterLibs "${XRANDR_LIBS}"
9431     XRANDR_LIBS="${filteredlibs}"
9432 else
9433     ENABLE_RANDR=""
9434     AC_MSG_RESULT([no])
9436 AC_SUBST(XRANDR_CFLAGS)
9437 AC_SUBST(XRANDR_LIBS)
9438 AC_SUBST(ENABLE_RANDR)
9440 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9441     WITH_WEBDAV="serf"
9443 if test $_os = iOS -o $_os = Android; then
9444     WITH_WEBDAV="no"
9446 AC_MSG_CHECKING([for webdav library])
9447 case "$WITH_WEBDAV" in
9448 serf)
9449     AC_MSG_RESULT([serf])
9450     # Check for system apr-util
9451     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9452                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9453                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9454     if test "$COM" = "MSC"; then
9455         APR_LIB_DIR="LibR"
9456         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9457         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9458     fi
9460     # Check for system serf
9461     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9462                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9463     if test "$COM" = "MSC"; then
9464         SERF_LIB_DIR="Release"
9465         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9466         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9467     fi
9468     ;;
9469 neon)
9470     AC_MSG_RESULT([neon])
9471     # Check for system neon
9472     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9473     if test "$with_system_neon" = "yes"; then
9474         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9475         libo_MINGW_CHECK_DLL([libneon])
9476         libo_MINGW_TRY_DLL([libtasn1])
9477         libo_MINGW_TRY_DLL([libgnutls])
9478     else
9479         NEON_VERSION=0295
9480     fi
9481     AC_SUBST(NEON_VERSION)
9482     ;;
9484     AC_MSG_RESULT([none, disabled])
9485     WITH_WEBDAV=""
9486     ;;
9487 esac
9488 AC_SUBST(WITH_WEBDAV)
9490 dnl ===================================================================
9491 dnl Check for disabling cve_tests
9492 dnl ===================================================================
9493 AC_MSG_CHECKING([whether to execute CVE tests])
9494 # If not explicitly enabled or disabled, default
9495 if test -z "$enable_cve_tests"; then
9496     case "$OS" in
9497     WNT)
9498         # Default cves off for windows with its wild and wonderful
9499         # varienty of AV software kicking in and panicing
9500         enable_cve_tests=no
9501         ;;
9502     *)
9503         # otherwise yes
9504         enable_cve_tests=yes
9505         ;;
9506     esac
9508 if test "$enable_cve_tests" = "no"; then
9509     AC_MSG_RESULT([no])
9510     DISABLE_CVE_TESTS=TRUE
9511     AC_SUBST(DISABLE_CVE_TESTS)
9512 else
9513     AC_MSG_RESULT([yes])
9516 dnl ===================================================================
9517 dnl Check for enabling chart XShape tests
9518 dnl ===================================================================
9519 AC_MSG_CHECKING([whether to execute chart XShape tests])
9520 if test "$enable_chart_tests" = "yes"; then
9521     AC_MSG_RESULT([yes])
9522     ENABLE_CHART_TESTS=TRUE
9523     AC_SUBST(ENABLE_CHART_TESTS)
9524 else
9525     AC_MSG_RESULT([no])
9528 dnl ===================================================================
9529 dnl Check for system openssl
9530 dnl ===================================================================
9531 DISABLE_OPENSSL=
9532 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9533 if test "$enable_openssl" = "yes"; then
9534     AC_MSG_RESULT([no])
9535     if test "$_os" = Darwin ; then
9536         # OpenSSL is deprecated when building for 10.7 or later.
9537         #
9538         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9539         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9541         with_system_openssl=no
9542         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9543     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9544             && test "$with_system_openssl" != "no"; then
9545         with_system_openssl=yes
9546         SYSTEM_OPENSSL=TRUE
9547         OPENSSL_CFLAGS=
9548         OPENSSL_LIBS="-lssl -lcrypto"
9549     else
9550         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9551     fi
9552     if test "$with_system_openssl" = "yes"; then
9553         libo_MINGW_CHECK_DLL([libssl])
9554         libo_MINGW_CHECK_DLL([libcrypto])
9555         AC_MSG_CHECKING([whether openssl supports SHA512])
9556         AC_LANG_PUSH([C])
9557         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9558             SHA512_CTX context;
9559 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9560         AC_LANG_POP(C)
9561     fi
9562 else
9563     AC_MSG_RESULT([yes])
9564     DISABLE_OPENSSL=TRUE
9566     # warn that although OpenSSL is disabled, system libraries may be depending on it
9567     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9568     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9571 AC_SUBST([DISABLE_OPENSSL])
9573 dnl ===================================================================
9574 dnl Check for building gnutls
9575 dnl ===================================================================
9576 AC_MSG_CHECKING([whether to use gnutls])
9577 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9578     AC_MSG_RESULT([yes])
9579     AM_PATH_LIBGCRYPT()
9580     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9581         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9582                       available in the system to use as replacement.]]))
9583     FilterLibs "${LIBGCRYPT_LIBS}"
9584     LIBGCRYPT_LIBS="${filteredlibs}"
9585 else
9586     AC_MSG_RESULT([no])
9589 AC_SUBST([LIBGCRYPT_CFLAGS])
9590 AC_SUBST([LIBGCRYPT_LIBS])
9592 dnl ===================================================================
9593 dnl Check for system redland
9594 dnl ===================================================================
9595 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9596 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9597 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9598 if test "$with_system_redland" = "yes"; then
9599     libo_MINGW_CHECK_DLL([librdf])
9600     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9601             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9602     libo_MINGW_TRY_DLL([libraptor])
9603     libo_MINGW_TRY_DLL([librasqal])
9604     libo_MINGW_TRY_DLL([libsqlite3])
9605 else
9606     RAPTOR_MAJOR="0"
9607     RASQAL_MAJOR="3"
9608     REDLAND_MAJOR="0"
9610 AC_SUBST(RAPTOR_MAJOR)
9611 AC_SUBST(RASQAL_MAJOR)
9612 AC_SUBST(REDLAND_MAJOR)
9614 dnl ===================================================================
9615 dnl Check for system hunspell
9616 dnl ===================================================================
9617 AC_MSG_CHECKING([which libhunspell to use])
9618 if test "$with_system_hunspell" = "yes"; then
9619     AC_MSG_RESULT([external])
9620     SYSTEM_HUNSPELL=TRUE
9621     AC_LANG_PUSH([C++])
9622     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9623     if test "$HUNSPELL_PC" != "TRUE"; then
9624         AC_CHECK_HEADER(hunspell.hxx, [],
9625             [
9626             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9627             [AC_MSG_ERROR(hunspell headers not found.)], [])
9628             ], [])
9629         AC_CHECK_LIB([hunspell], [main], [:],
9630            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9631         HUNSPELL_LIBS=-lhunspell
9632     fi
9633     AC_LANG_POP([C++])
9634     libo_MINGW_CHECK_DLL([libhunspell-1.6])
9635     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9636     FilterLibs "${HUNSPELL_LIBS}"
9637     HUNSPELL_LIBS="${filteredlibs}"
9638 else
9639     AC_MSG_RESULT([internal])
9640     SYSTEM_HUNSPELL=
9641     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9642     if test "$COM" = "MSC"; then
9643         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9644     else
9645         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9646     fi
9647     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9649 AC_SUBST(SYSTEM_HUNSPELL)
9650 AC_SUBST(HUNSPELL_CFLAGS)
9651 AC_SUBST(HUNSPELL_LIBS)
9653 dnl ===================================================================
9654 dnl Checking for altlinuxhyph
9655 dnl ===================================================================
9656 AC_MSG_CHECKING([which altlinuxhyph to use])
9657 if test "$with_system_altlinuxhyph" = "yes"; then
9658     AC_MSG_RESULT([external])
9659     SYSTEM_HYPH=TRUE
9660     AC_CHECK_HEADER(hyphen.h, [],
9661        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9662     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9663        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9664        [#include <hyphen.h>])
9665     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9666         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9667     if test -z "$HYPHEN_LIB"; then
9668         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9669            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9670     fi
9671     if test -z "$HYPHEN_LIB"; then
9672         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9673            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9674     fi
9675     libo_MINGW_CHECK_DLL([libhyphen])
9676 else
9677     AC_MSG_RESULT([internal])
9678     SYSTEM_HYPH=
9679     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9680     if test "$COM" = "MSC"; then
9681         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9682     else
9683         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9684     fi
9686 AC_SUBST(SYSTEM_HYPH)
9687 AC_SUBST(HYPHEN_LIB)
9689 dnl ===================================================================
9690 dnl Checking for mythes
9691 dnl ===================================================================
9692 AC_MSG_CHECKING([which mythes to use])
9693 if test "$with_system_mythes" = "yes"; then
9694     AC_MSG_RESULT([external])
9695     SYSTEM_MYTHES=TRUE
9696     AC_LANG_PUSH([C++])
9697     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9698     if test "$MYTHES_PKGCONFIG" = "no"; then
9699         AC_CHECK_HEADER(mythes.hxx, [],
9700             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9701         AC_CHECK_LIB([mythes-1.2], [main], [:],
9702             [ MYTHES_FOUND=no], [])
9703     if test "$MYTHES_FOUND" = "no"; then
9704         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9705                 [ MYTHES_FOUND=no], [])
9706     fi
9707     if test "$MYTHES_FOUND" = "no"; then
9708         AC_MSG_ERROR([mythes library not found!.])
9709     fi
9710     fi
9711     AC_LANG_POP([C++])
9712     libo_MINGW_CHECK_DLL([libmythes-1.2])
9713     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9714     FilterLibs "${MYTHES_LIBS}"
9715     MYTHES_LIBS="${filteredlibs}"
9716 else
9717     AC_MSG_RESULT([internal])
9718     SYSTEM_MYTHES=
9719     BUILD_TYPE="$BUILD_TYPE MYTHES"
9720     if test "$COM" = "MSC"; then
9721         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9722     else
9723         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9724     fi
9726 AC_SUBST(SYSTEM_MYTHES)
9727 AC_SUBST(MYTHES_CFLAGS)
9728 AC_SUBST(MYTHES_LIBS)
9730 dnl ===================================================================
9731 dnl How should we build the linear programming solver ?
9732 dnl ===================================================================
9734 ENABLE_COINMP=
9735 AC_MSG_CHECKING([whether to build with CoinMP])
9736 if test "$enable_coinmp" != "no"; then
9737     ENABLE_COINMP=TRUE
9738     AC_MSG_RESULT([yes])
9739     if test "$with_system_coinmp" = "yes"; then
9740         SYSTEM_COINMP=TRUE
9741         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9742         FilterLibs "${COINMP_LIBS}"
9743         COINMP_LIBS="${filteredlibs}"
9744     else
9745         BUILD_TYPE="$BUILD_TYPE COINMP"
9746     fi
9747 else
9748     AC_MSG_RESULT([no])
9750 AC_SUBST(ENABLE_COINMP)
9751 AC_SUBST(SYSTEM_COINMP)
9752 AC_SUBST(COINMP_CFLAGS)
9753 AC_SUBST(COINMP_LIBS)
9755 ENABLE_LPSOLVE=
9756 AC_MSG_CHECKING([whether to build with lpsolve])
9757 if test "$enable_lpsolve" != "no"; then
9758     ENABLE_LPSOLVE=TRUE
9759     AC_MSG_RESULT([yes])
9760 else
9761     AC_MSG_RESULT([no])
9763 AC_SUBST(ENABLE_LPSOLVE)
9765 if test "$ENABLE_LPSOLVE" = TRUE; then
9766     AC_MSG_CHECKING([which lpsolve to use])
9767     if test "$with_system_lpsolve" = "yes"; then
9768         AC_MSG_RESULT([external])
9769         SYSTEM_LPSOLVE=TRUE
9770         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9771            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9772         save_LIBS=$LIBS
9773         # some systems need this. Like Ubuntu....
9774         AC_CHECK_LIB(m, floor)
9775         AC_CHECK_LIB(dl, dlopen)
9776         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9777             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9778         LIBS=$save_LIBS
9779         libo_MINGW_CHECK_DLL([lpsolve55])
9780     else
9781         AC_MSG_RESULT([internal])
9782         SYSTEM_LPSOLVE=
9783         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9784     fi
9786 AC_SUBST(SYSTEM_LPSOLVE)
9788 dnl ===================================================================
9789 dnl Checking for libexttextcat
9790 dnl ===================================================================
9791 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9792 if test "$with_system_libexttextcat" = "yes"; then
9793     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9795 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9797 dnl ***************************************
9798 dnl testing libc version for Linux...
9799 dnl ***************************************
9800 if test "$_os" = "Linux"; then
9801     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9802     exec 6>/dev/null # no output
9803     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9804     exec 6>&1 # output on again
9805     if test "$HAVE_LIBC"; then
9806         AC_MSG_RESULT([yes])
9807     else
9808         AC_MSG_ERROR([no, upgrade libc])
9809     fi
9812 dnl =========================================
9813 dnl Check for the Windows  SDK.
9814 dnl =========================================
9815 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9816 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9817 if test "$_os" = "WINNT"; then
9818     AC_MSG_CHECKING([for Windows SDK])
9819     if test "$build_os" = "cygwin"; then
9820         find_winsdk
9821         WINDOWS_SDK_HOME=$winsdktest
9823         # normalize if found
9824         if test -n "$WINDOWS_SDK_HOME"; then
9825             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9826             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9827         fi
9829         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
9830     fi
9832     if test -n "$WINDOWS_SDK_HOME"; then
9833         # Remove a possible trailing backslash
9834         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9836         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9837              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9838              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9839             have_windows_sdk_headers=yes
9840         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9841              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9842              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9843             have_windows_sdk_headers=yes
9844         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
9845              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
9846              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
9847             have_windows_sdk_headers=yes
9848         else
9849             have_windows_sdk_headers=no
9850         fi
9852         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9853             have_windows_sdk_libs=yes
9854         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9855             have_windows_sdk_libs=yes
9856         else
9857             have_windows_sdk_libs=no
9858         fi
9860         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9861             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9862 the  Windows SDK are installed.])
9863         fi
9865         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9866              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9867              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9868              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9869         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9870              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9871              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9872              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9873         else
9874             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9875         fi
9876     fi
9878     if test -z "$WINDOWS_SDK_HOME"; then
9879         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9880     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
9881         WINDOWS_SDK_VERSION=70
9882         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9883     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9884         WINDOWS_SDK_VERSION=80
9885         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9886         dnl compatibility warning if not explicitly choosing the 80 SDK:
9887         if test -z "$with_windows_sdk"; then
9888             AC_MSG_WARN([If a build should run on Windows XP,])
9889             AC_MSG_WARN([use --with-windows-sdk=7.1A])
9890             add_warning "If a build should run on Windows XP,"
9891             add_warning "use --with-windows-sdk=7.1A"
9892         fi
9893     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
9894         WINDOWS_SDK_VERSION=81
9895         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
9896     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
9897         WINDOWS_SDK_VERSION=10
9898         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
9899     else
9900         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9901     fi
9902     PathFormat "$WINDOWS_SDK_HOME"
9903     WINDOWS_SDK_HOME="$formatted_path"
9904     if test "$build_os" = "cygwin"; then
9905         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9906         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9907             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9908         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
9909             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
9910         fi
9911     fi
9913     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9914     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9915     dnl but not in v8.0), so allow this to be overridden with a
9916     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9917     dnl and configuration error if no WiLangId.vbs is found would arguably be
9918     dnl better, but I do not know under which conditions exactly it is needed by
9919     dnl msiglobal.pm:
9920     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9921         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9922         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9923             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9924         fi
9925         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9926             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9927         fi
9928         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9929             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9930             add_warning "WiLangId.vbs not found - building translated packages will fail"
9931         fi
9932     fi
9934 AC_SUBST(WINDOWS_SDK_HOME)
9935 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
9936 AC_SUBST(WINDOWS_SDK_VERSION)
9937 AC_SUBST(WINDOWS_SDK_WILANGID)
9939 dnl =========================================
9940 dnl Check for uuidgen
9941 dnl =========================================
9942 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9943     if test "$WITH_MINGW" = "yes"; then
9944         AC_PATH_PROG([UUIDGEN], [uuid])
9945         if test -z "$UUIDGEN"; then
9946             AC_MSG_WARN([uuid is needed for building installation sets])
9947         fi
9948     else
9949         # presence is already tested above in the WINDOWS_SDK_HOME check
9950         UUIDGEN=uuidgen.exe
9951         AC_SUBST(UUIDGEN)
9952     fi
9953 else
9954     AC_PATH_PROG([UUIDGEN], [uuidgen])
9955     if test -z "$UUIDGEN"; then
9956         AC_MSG_WARN([uuid is needed for building installation sets])
9957     fi
9960 dnl ***************************************
9961 dnl Checking for bison and flex
9962 dnl ***************************************
9963 AC_PATH_PROG(BISON, bison)
9964 if test -z "$BISON"; then
9965     AC_MSG_ERROR([no bison found in \$PATH, install it])
9966 else
9967     AC_MSG_CHECKING([the bison version])
9968     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9969     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9970     # Accept newer than 2.0
9971     if test "$_bison_longver" -lt 2000; then
9972         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9973     fi
9976 AC_PATH_PROG(FLEX, flex)
9977 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9978     FLEX=`cygpath -m $FLEX`
9980 if test -z "$FLEX"; then
9981     AC_MSG_ERROR([no flex found in \$PATH, install it])
9982 else
9983     AC_MSG_CHECKING([the flex version])
9984     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9985     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9986         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9987     fi
9989 AC_SUBST([FLEX])
9990 dnl ***************************************
9991 dnl Checking for patch
9992 dnl ***************************************
9993 AC_PATH_PROG(PATCH, patch)
9994 if test -z "$PATCH"; then
9995     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9998 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9999 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10000     if test -z "$with_gnu_patch"; then
10001         GNUPATCH=$PATCH
10002     else
10003         if test -x "$with_gnu_patch"; then
10004             GNUPATCH=$with_gnu_patch
10005         else
10006             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10007         fi
10008     fi
10010     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10011     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10012         AC_MSG_RESULT([yes])
10013     else
10014         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10015     fi
10016 else
10017     GNUPATCH=$PATCH
10020 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10021     GNUPATCH=`cygpath -m $GNUPATCH`
10024 dnl We also need to check for --with-gnu-cp
10026 if test -z "$with_gnu_cp"; then
10027     # check the place where the good stuff is hidden on Solaris...
10028     if test -x /usr/gnu/bin/cp; then
10029         GNUCP=/usr/gnu/bin/cp
10030     else
10031         AC_PATH_PROGS(GNUCP, gnucp cp)
10032     fi
10033     if test -z $GNUCP; then
10034         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10035     fi
10036 else
10037     if test -x "$with_gnu_cp"; then
10038         GNUCP=$with_gnu_cp
10039     else
10040         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10041     fi
10044 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10045     GNUCP=`cygpath -m $GNUCP`
10048 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10049 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10050     AC_MSG_RESULT([yes])
10051 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10052     AC_MSG_RESULT([yes])
10053 else
10054     case "$build_os" in
10055     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10056         x_GNUCP=[\#]
10057         GNUCP=''
10058         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10059         ;;
10060     *)
10061         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10062         ;;
10063     esac
10066 AC_SUBST(GNUPATCH)
10067 AC_SUBST(GNUCP)
10068 AC_SUBST(x_GNUCP)
10070 dnl ***************************************
10071 dnl testing assembler path
10072 dnl ***************************************
10073 ML_EXE=""
10074 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
10075     if test "$BITNESS_OVERRIDE" = ""; then
10076         assembler=ml.exe
10077         assembler_bin=bin
10078     else
10079         if test "$vcexpress" = "Express"; then
10080             assembler=ml64.exe
10081             assembler_bin=bin/x86_amd64
10082         else
10083             assembler=ml64.exe
10084             assembler_bin=bin/amd64
10085         fi
10086     fi
10088     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
10089     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
10090         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
10091         AC_MSG_RESULT([found])
10092         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
10093     else
10094         AC_MSG_ERROR([Configure did not find $assembler assembler.])
10095     fi
10097     PathFormat "$ASM_HOME"
10098     ASM_HOME="$formatted_path"
10099 else
10100     ASM_HOME=""
10103 AC_SUBST(ML_EXE)
10105 dnl ===================================================================
10106 dnl We need zip and unzip
10107 dnl ===================================================================
10108 AC_PATH_PROG(ZIP, zip)
10109 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10110 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10111     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],,)
10114 AC_PATH_PROG(UNZIP, unzip)
10115 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10117 dnl ===================================================================
10118 dnl Zip must be a specific type for different build types.
10119 dnl ===================================================================
10120 if test $build_os = cygwin; then
10121     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10122         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10123     fi
10126 dnl ===================================================================
10127 dnl We need touch with -h option support.
10128 dnl ===================================================================
10129 AC_PATH_PROG(TOUCH, touch)
10130 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10131 touch warn
10132 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10133     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],,)
10136 dnl ===================================================================
10137 dnl Set vcl option: coordinate device in double or sal_Int32
10138 dnl ===================================================================
10140 dnl disabled for now, we don't want subtle differences between OSs
10141 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10142 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10143 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10144 dnl     AC_MSG_RESULT([double])
10145 dnl else
10146 dnl     AC_MSG_RESULT([sal_Int32])
10147 dnl fi
10149 dnl ===================================================================
10150 dnl Test which vclplugs have to be built.
10151 dnl ===================================================================
10152 R=""
10153 if test "$USING_X11" != TRUE; then
10154     enable_gtk=no
10155     enable_gtk3=no
10157 GTK3_CFLAGS=""
10158 GTK3_LIBS=""
10159 ENABLE_GTK3=""
10160 if test "x$enable_gtk3" = "xyes"; then
10161     if test "$with_system_cairo" = no; then
10162         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10163     fi
10164     : ${with_system_cairo:=yes}
10165     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="")
10166     if test "x$ENABLE_GTK3" = "xTRUE"; then
10167         R="gtk3"
10168         dnl Avoid installed by unpackaged files for now.
10169         if test -z "$PKGFORMAT"; then
10170             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10171         fi
10172     else
10173         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10174     fi
10175     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10176     FilterLibs "${GTK3_LIBS}"
10177     GTK3_LIBS="${filteredlibs}"
10179 AC_SUBST(GTK3_LIBS)
10180 AC_SUBST(GTK3_CFLAGS)
10181 AC_SUBST(ENABLE_GTK3)
10183 ENABLE_GTK=""
10184 if test "x$enable_gtk" = "xyes"; then
10185     if test "$with_system_cairo" = no; then
10186         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10187     fi
10188     : ${with_system_cairo:=yes}
10189     ENABLE_GTK="TRUE"
10190     AC_DEFINE(ENABLE_GTK)
10191     R="gtk $R"
10193 AC_SUBST(ENABLE_GTK)
10195 ENABLE_TDE=""
10196 if test "x$enable_tde" = "xyes"; then
10197     ENABLE_TDE="TRUE"
10198     AC_DEFINE(ENABLE_TDE)
10199     R="$R tde"
10201 AC_SUBST(ENABLE_TDE)
10203 ENABLE_KDE4=""
10204 if test "x$enable_kde4" = "xyes"; then
10205     ENABLE_KDE4="TRUE"
10206     AC_DEFINE(ENABLE_KDE4)
10207     R="$R kde4"
10209 AC_SUBST(ENABLE_KDE4)
10212 build_vcl_plugins="$R"
10213 if test -z "$build_vcl_plugins"; then
10214     build_vcl_plugins="none"
10216 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10218 dnl ===================================================================
10219 dnl check for dbus support
10220 dnl ===================================================================
10221 ENABLE_DBUS=""
10222 DBUS_CFLAGS=""
10223 DBUS_LIBS=""
10225 if test "$enable_dbus" = "no"; then
10226     test_dbus=no
10229 AC_MSG_CHECKING([whether to enable DBUS support])
10230 if test "$test_dbus" = "yes"; then
10231     ENABLE_DBUS="TRUE"
10232     AC_MSG_RESULT([yes])
10233     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10234     AC_DEFINE(ENABLE_DBUS)
10235     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10236     FilterLibs "${DBUS_LIBS}"
10237     DBUS_LIBS="${filteredlibs}"
10238 else
10239     AC_MSG_RESULT([no])
10242 AC_SUBST(ENABLE_DBUS)
10243 AC_SUBST(DBUS_CFLAGS)
10244 AC_SUBST(DBUS_LIBS)
10246 AC_MSG_CHECKING([whether to enable Impress remote control])
10247 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10248     AC_MSG_RESULT([yes])
10249     ENABLE_SDREMOTE=TRUE
10250     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10252     # If not explicitly enabled or disabled, default
10253     if test -z "$enable_sdremote_bluetooth"; then
10254         case "$OS" in
10255         LINUX|MACOSX|WNT)
10256             # Default to yes for these
10257             enable_sdremote_bluetooth=yes
10258             ;;
10259         *)
10260             # otherwise no
10261             enable_sdremote_bluetooth=no
10262             ;;
10263         esac
10264     fi
10265     # $enable_sdremote_bluetooth is guaranteed non-empty now
10267     if test "$enable_sdremote_bluetooth" != "no"; then
10268         if test "$OS" = "LINUX"; then
10269             if test "$ENABLE_DBUS" = "TRUE"; then
10270                 AC_MSG_RESULT([yes])
10271                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10272                 dnl ===================================================================
10273                 dnl Check for system bluez
10274                 dnl ===================================================================
10275                 AC_MSG_CHECKING([which Bluetooth header to use])
10276                 if test "$with_system_bluez" = "yes"; then
10277                     AC_MSG_RESULT([external])
10278                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10279                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10280                     SYSTEM_BLUEZ=TRUE
10281                 else
10282                     AC_MSG_RESULT([internal])
10283                     SYSTEM_BLUEZ=
10284                 fi
10285             else
10286                 AC_MSG_RESULT([no, dbus disabled])
10287                 ENABLE_SDREMOTE_BLUETOOTH=
10288                 SYSTEM_BLUEZ=
10289             fi
10290         else
10291             AC_MSG_RESULT([yes])
10292             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10293             SYSTEM_BLUEZ=
10294         fi
10295     else
10296         AC_MSG_RESULT([no])
10297         ENABLE_SDREMOTE_BLUETOOTH=
10298         SYSTEM_BLUEZ=
10299     fi
10300 else
10301     ENABLE_SDREMOTE=
10302     SYSTEM_BLUEZ=
10303     AC_MSG_RESULT([no])
10305 AC_SUBST(ENABLE_SDREMOTE)
10306 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10307 AC_SUBST(SYSTEM_BLUEZ)
10309 dnl ===================================================================
10310 dnl Check whether the gtk 2.0 libraries are available.
10311 dnl ===================================================================
10313 GTK_CFLAGS=""
10314 GTK_LIBS=""
10315 ENABLE_SYSTRAY_GTK=""
10316 if test  "$test_gtk" = "yes"; then
10318     if test "$ENABLE_GTK" = "TRUE"; then
10319         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]))
10320         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10321         FilterLibs "${GTK_LIBS}"
10322         GTK_LIBS="${filteredlibs}"
10323         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]))
10324         BUILD_TYPE="$BUILD_TYPE GTK"
10325         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10326         FilterLibs "${GTHREAD_LIBS}"
10327         GTHREAD_LIBS="${filteredlibs}"
10329         if test "x$enable_systray" = "xyes"; then
10330             ENABLE_SYSTRAY_GTK="TRUE"
10331         fi
10333         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10334         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10335                           [ENABLE_GTK_PRINT="TRUE"],
10336                           [ENABLE_GTK_PRINT=""])
10337         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10338         FilterLibs "${GTK_PRINT_LIBS}"
10339         GTK_PRINT_LIBS="${filteredlibs}"
10341         AC_MSG_CHECKING([whether to enable GIO support])
10342         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10343             dnl Need at least 2.26 for the dbus support.
10344             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10345                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10346             if test "$ENABLE_GIO" = "TRUE"; then
10347                 AC_DEFINE(ENABLE_GIO)
10348                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10349                 FilterLibs "${GIO_LIBS}"
10350                 GIO_LIBS="${filteredlibs}"
10351             fi
10352         else
10353             AC_MSG_RESULT([no])
10354         fi
10355     fi
10357 AC_SUBST(ENABLE_GIO)
10358 AC_SUBST(GIO_CFLAGS)
10359 AC_SUBST(GIO_LIBS)
10360 AC_SUBST(ENABLE_SYSTRAY_GTK)
10361 AC_SUBST(GTK_CFLAGS)
10362 AC_SUBST(GTK_LIBS)
10363 AC_SUBST(GTHREAD_CFLAGS)
10364 AC_SUBST(GTHREAD_LIBS)
10365 AC_SUBST([ENABLE_GTK_PRINT])
10366 AC_SUBST([GTK_PRINT_CFLAGS])
10367 AC_SUBST([GTK_PRINT_LIBS])
10370 dnl ===================================================================
10371 dnl Check whether the Telepathy libraries are available.
10372 dnl ===================================================================
10374 ENABLE_TELEPATHY=""
10375 TELEPATHY_CFLAGS=""
10376 TELEPATHY_LIBS=""
10378 AC_MSG_CHECKING([whether to enable Telepathy support])
10379 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10380     ENABLE_TELEPATHY="TRUE"
10381     AC_DEFINE(ENABLE_TELEPATHY)
10382     AC_MSG_RESULT([yes])
10383     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 )
10384     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10385     FilterLibs "${TELEPATHY_LIBS}"
10386     TELEPATHY_LIBS="${filteredlibs}"
10387 else
10388     AC_MSG_RESULT([no])
10391 AC_SUBST(ENABLE_TELEPATHY)
10392 AC_SUBST(TELEPATHY_CFLAGS)
10393 AC_SUBST(TELEPATHY_LIBS)
10396 dnl ===================================================================
10398 SPLIT_APP_MODULES=""
10399 if test "$enable_split_app_modules" = "yes"; then
10400     SPLIT_APP_MODULES="TRUE"
10402 AC_SUBST(SPLIT_APP_MODULES)
10404 SPLIT_OPT_FEATURES=""
10405 if test "$enable_split_opt_features" = "yes"; then
10406     SPLIT_OPT_FEATURES="TRUE"
10408 AC_SUBST(SPLIT_OPT_FEATURES)
10410 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10411     if test "$enable_cairo_canvas" = yes; then
10412         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10413     fi
10414     enable_cairo_canvas=no
10415 elif test -z "$enable_cairo_canvas"; then
10416     enable_cairo_canvas=yes
10419 ENABLE_CAIRO_CANVAS=""
10420 if test "$enable_cairo_canvas" = "yes"; then
10421     test_cairo=yes
10422     ENABLE_CAIRO_CANVAS="TRUE"
10423     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10425 AC_SUBST(ENABLE_CAIRO_CANVAS)
10427 dnl ===================================================================
10428 dnl Check whether the GStreamer libraries are available.
10429 dnl It's possible to build avmedia with both GStreamer backends!
10430 dnl ===================================================================
10432 ENABLE_GSTREAMER_1_0=""
10434 if test "$build_gstreamer_1_0" = "yes"; then
10436     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10437     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10438         ENABLE_GSTREAMER_1_0="TRUE"
10439         AC_MSG_RESULT([yes])
10440         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10441         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10442         FilterLibs "${GSTREAMER_1_0_LIBS}"
10443         GSTREAMER_1_0_LIBS="${filteredlibs}"
10444     else
10445         AC_MSG_RESULT([no])
10446     fi
10448 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10449 AC_SUBST(GSTREAMER_1_0_LIBS)
10450 AC_SUBST(ENABLE_GSTREAMER_1_0)
10453 ENABLE_GSTREAMER_0_10=""
10454 if test "$build_gstreamer_0_10" = "yes"; then
10456     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10457     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10458         ENABLE_GSTREAMER_0_10="TRUE"
10459         AC_MSG_RESULT([yes])
10460         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10461             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10462         ])
10463         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10464         FilterLibs "${GSTREAMER_0_10_LIBS}"
10465         GSTREAMER_0_10_LIBS="${filteredlibs}"
10466     else
10467         AC_MSG_RESULT([no])
10468     fi
10471 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10472 AC_SUBST(GSTREAMER_0_10_LIBS)
10473 AC_SUBST(ENABLE_GSTREAMER_0_10)
10475 dnl ===================================================================
10476 dnl Check whether to build the VLC avmedia backend
10477 dnl ===================================================================
10479 ENABLE_VLC=""
10481 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10482 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10483     ENABLE_VLC="TRUE"
10484     AC_MSG_RESULT([yes])
10485 else
10486     AC_MSG_RESULT([no])
10488 AC_SUBST(ENABLE_VLC)
10490 ENABLE_OPENGL_TRANSITIONS=
10491 ENABLE_OPENGL_CANVAS=
10492 if test $_os = iOS -o $_os = Android; then
10493    : # disable
10494 elif test "$_os" = "Darwin"; then
10495     # We use frameworks on Mac OS X, no need for detail checks
10496     ENABLE_OPENGL_TRANSITIONS=TRUE
10497     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10498     ENABLE_OPENGL_CANVAS=TRUE
10499 elif test $_os = WINNT; then
10500     ENABLE_OPENGL_TRANSITIONS=TRUE
10501     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10502     ENABLE_OPENGL_CANVAS=TRUE
10503 else
10504     if test "$USING_X11" = TRUE; then
10505         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10506         ENABLE_OPENGL_TRANSITIONS=TRUE
10507         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10508         ENABLE_OPENGL_CANVAS=TRUE
10509     fi
10512 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10513 AC_SUBST(ENABLE_OPENGL_CANVAS)
10515 dnl =================================================
10516 dnl Check whether to build with OpenCL support.
10517 dnl =================================================
10519 if test $_os != iOS -a $_os != Android; then
10520     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10521     # platform (optional at run-time, used through clew).
10522     BUILD_TYPE="$BUILD_TYPE OPENCL"
10523     AC_DEFINE(HAVE_FEATURE_OPENCL)
10526 dnl ===================================================================
10527 dnl Check whether to enable glTF support
10528 dnl ===================================================================
10529 AC_MSG_CHECKING([whether to enable glTF support])
10530 ENABLE_GLTF=
10531 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android -a "$ENABLE_HEADLESS" = ""; then
10532     ENABLE_GLTF=TRUE
10533     AC_MSG_RESULT([yes])
10534     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10535     if test "$with_system_libgltf" = "yes"; then
10536         SYSTEM_LIBGLTF=TRUE
10537         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10538         FilterLibs "${LIBGLTF_LIBS}"
10539         LIBGLTF_LIBS="${filteredlibs}"
10540     else
10541         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10542     fi
10543 else
10544     AC_MSG_RESULT([no])
10546 AC_SUBST(ENABLE_GLTF)
10547 AC_SUBST(SYSTEM_LIBGLTF)
10548 AC_SUBST(LIBGLTF_CFLAGS)
10549 AC_SUBST(LIBGLTF_LIBS)
10551 dnl ===================================================================
10552 dnl Check whether to enable COLLADA support
10553 dnl ===================================================================
10554 AC_MSG_CHECKING([whether to enable COLLADA support])
10555 ENABLE_COLLADA=
10556 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10557     AC_MSG_RESULT([yes])
10558     ENABLE_COLLADA=TRUE
10559     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10561     AC_MSG_CHECKING([which OPENCOLLADA to use])
10562     if test "$with_system_opencollada" = "yes"; then
10563         AC_MSG_RESULT([external])
10564         SYSTEM_OPENCOLLADA=TRUE
10565         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10566         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10567         AC_LANG_PUSH([C++])
10568         save_CXXFLAGS=$CXXFLAGS
10569         save_CPPFLAGS=$CPPFLAGS
10570         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10571         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10572         AC_CHECK_HEADERS(
10573                 COLLADABU.h \
10574                 COLLADAFW.h \
10575                 COLLADASaxFWLLoader.h \
10576                 GeneratedSaxParser.h,
10577             [],
10578             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10579             [])
10580         CXXFLAGS=$save_CXXFLAGS
10581         CPPFLAGS=$save_CPPFLAGS
10582         AC_LANG_POP([C++])
10583         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10584         FilterLibs "${OPENCOLLADA_LIBS}"
10585         OPENCOLLADA_LIBS="${filteredlibs}"
10586     else
10587         AC_MSG_RESULT([internal])
10588         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10589     fi
10591     AC_MSG_CHECKING([which collada2gltf to use])
10592     if test "$with_system_collada2gltf" = "yes"; then
10593         if test "$with_system_opencollada" = "no"; then
10594             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10595         fi
10596         AC_MSG_RESULT([external])
10597         SYSTEM_COLLADA2GLTF=TRUE
10598         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10599         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10600         AC_LANG_PUSH([C++])
10601         save_CXXFLAGS=$CXXFLAGS
10602         save_CPPFLAGS=$CPPFLAGS
10603         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10604         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10605         AC_CHECK_HEADERS(
10606                 GLTF.h \
10607                 encodingHelpers.h,
10608             [],
10609             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10610             [])
10611         CXXFLAGS=$save_CXXFLAGS
10612         CPPFLAGS=$save_CPPFLAGS
10613         AC_LANG_POP([C++])
10614         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10615         FilterLibs "${COLLADA2GLTF_LIBS}"
10616         COLLADA2GLTF_LIBS="${filteredlibs}"
10617     else
10618         AC_MSG_RESULT([internal])
10619         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10620     fi
10621 else
10622     AC_MSG_RESULT([no])
10624 AC_SUBST(ENABLE_COLLADA)
10625 AC_SUBST([OPENCOLLADA_CFLAGS])
10626 AC_SUBST([OPENCOLLADA_LIBS])
10627 AC_SUBST([SYSTEM_OPENCOLLADA])
10629 AC_SUBST([COLLADA2GLTF_CFLAGS])
10630 AC_SUBST([COLLADA2GLTF_LIBS])
10631 AC_SUBST([SYSTEM_COLLADA2GLTF])
10633 if test "$enable_dconf" != no; then
10634     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10635         if test "$enable_dconf" = yes; then
10636             AC_MSG_ERROR([dconf not found])
10637         else
10638             enable_dconf=no
10639         fi])
10641 AC_MSG_CHECKING([whether to enable dconf])
10642 if test "$enable_dconf" = no; then
10643     DCONF_CFLAGS=
10644     DCONF_LIBS=
10645     ENABLE_DCONF=
10646     AC_MSG_RESULT([no])
10647 else
10648     ENABLE_DCONF=TRUE
10649     AC_DEFINE(ENABLE_DCONF)
10650     AC_MSG_RESULT([yes])
10652 AC_SUBST([DCONF_CFLAGS])
10653 AC_SUBST([DCONF_LIBS])
10654 AC_SUBST([ENABLE_DCONF])
10656 # pdf import?
10657 AC_MSG_CHECKING([whether to build the PDF import feature])
10658 ENABLE_PDFIMPORT=
10659 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10660     AC_MSG_RESULT([yes])
10661     ENABLE_PDFIMPORT=TRUE
10662     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10664     dnl ===================================================================
10665     dnl Check for system poppler
10666     dnl ===================================================================
10667     AC_MSG_CHECKING([which PDF import backend to use])
10668     if test "$with_system_poppler" = "yes"; then
10669         AC_MSG_RESULT([external])
10670         SYSTEM_POPPLER=TRUE
10671         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10672         AC_LANG_PUSH([C++])
10673         save_CXXFLAGS=$CXXFLAGS
10674         save_CPPFLAGS=$CPPFLAGS
10675         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10676         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10677         AC_CHECK_HEADER([cpp/poppler-version.h],
10678             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10679             [])
10680         CXXFLAGS=$save_CXXFLAGS
10681         CPPFLAGS=$save_CPPFLAGS
10682         AC_LANG_POP([C++])
10683         libo_MINGW_CHECK_DLL([libpoppler])
10684         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10686         FilterLibs "${POPPLER_LIBS}"
10687         POPPLER_LIBS="${filteredlibs}"
10688     else
10689         AC_MSG_RESULT([internal])
10690         SYSTEM_POPPLER=
10691         BUILD_TYPE="$BUILD_TYPE POPPLER"
10692         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10693     fi
10694     AC_DEFINE([ENABLE_PDFIMPORT],1)
10695 else
10696     AC_MSG_RESULT([no])
10698 AC_SUBST(ENABLE_PDFIMPORT)
10699 AC_SUBST(SYSTEM_POPPLER)
10700 AC_SUBST(POPPLER_CFLAGS)
10701 AC_SUBST(POPPLER_LIBS)
10703 # pdf import?
10704 AC_MSG_CHECKING([whether to build PDFium])
10705 ENABLE_PDFIUM=
10706 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10707     AC_MSG_RESULT([yes])
10708     ENABLE_PDFIUM=TRUE
10709     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10710     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10711 else
10712     AC_MSG_RESULT([no])
10714 AC_SUBST(ENABLE_PDFIUM)
10716 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10717 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10718     AC_MSG_RESULT([yes])
10719     ENABLE_MEDIAWIKI=TRUE
10720     BUILD_TYPE="$BUILD_TYPE XSLTML"
10721     if test  "x$with_java" = "xno"; then
10722         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10723     fi
10724 else
10725     AC_MSG_RESULT([no])
10726     ENABLE_MEDIAWIKI=
10727     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10729 AC_SUBST(ENABLE_MEDIAWIKI)
10731 AC_MSG_CHECKING([whether to build the Report Builder])
10732 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10733     AC_MSG_RESULT([yes])
10734     ENABLE_REPORTBUILDER=TRUE
10735     AC_MSG_CHECKING([which jfreereport libs to use])
10736     if test "$with_system_jfreereport" = "yes"; then
10737         SYSTEM_JFREEREPORT=TRUE
10738         AC_MSG_RESULT([external])
10739         if test -z $SAC_JAR; then
10740             SAC_JAR=/usr/share/java/sac.jar
10741         fi
10742         if ! test -f $SAC_JAR; then
10743              AC_MSG_ERROR(sac.jar not found.)
10744         fi
10746         if test -z $LIBXML_JAR; then
10747             if test -f /usr/share/java/libxml-1.0.0.jar; then
10748                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10749             elif test -f /usr/share/java/libxml.jar; then
10750                 LIBXML_JAR=/usr/share/java/libxml.jar
10751             else
10752                 AC_MSG_ERROR(libxml.jar replacement not found.)
10753             fi
10754         elif ! test -f $LIBXML_JAR; then
10755             AC_MSG_ERROR(libxml.jar not found.)
10756         fi
10758         if test -z $FLUTE_JAR; then
10759             if test -f/usr/share/java/flute-1.3.0.jar; then
10760                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10761             elif test -f /usr/share/java/flute.jar; then
10762                 FLUTE_JAR=/usr/share/java/flute.jar
10763             else
10764                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10765             fi
10766         elif ! test -f $FLUTE_JAR; then
10767             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10768         fi
10770         if test -z $JFREEREPORT_JAR; then
10771             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10772                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10773             elif test -f /usr/share/java/flow-engine.jar; then
10774                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10775             else
10776                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10777             fi
10778         elif ! test -f  $JFREEREPORT_JAR; then
10779                 AC_MSG_ERROR(jfreereport.jar not found.)
10780         fi
10782         if test -z $LIBLAYOUT_JAR; then
10783             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10784                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10785             elif test -f /usr/share/java/liblayout.jar; then
10786                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10787             else
10788                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10789             fi
10790         elif ! test -f $LIBLAYOUT_JAR; then
10791                 AC_MSG_ERROR(liblayout.jar not found.)
10792         fi
10794         if test -z $LIBLOADER_JAR; then
10795             if test -f /usr/share/java/libloader-1.0.0.jar; then
10796                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10797             elif test -f /usr/share/java/libloader.jar; then
10798                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10799             else
10800                 AC_MSG_ERROR(libloader.jar replacement not found.)
10801             fi
10802         elif ! test -f  $LIBLOADER_JAR; then
10803             AC_MSG_ERROR(libloader.jar not found.)
10804         fi
10806         if test -z $LIBFORMULA_JAR; then
10807             if test -f /usr/share/java/libformula-0.2.0.jar; then
10808                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10809             elif test -f /usr/share/java/libformula.jar; then
10810                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10811             else
10812                 AC_MSG_ERROR(libformula.jar replacement not found.)
10813             fi
10814         elif ! test -f $LIBFORMULA_JAR; then
10815                 AC_MSG_ERROR(libformula.jar not found.)
10816         fi
10818         if test -z $LIBREPOSITORY_JAR; then
10819             if test -f /usr/share/java/librepository-1.0.0.jar; then
10820                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10821             elif test -f /usr/share/java/librepository.jar; then
10822                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10823             else
10824                 AC_MSG_ERROR(librepository.jar replacement not found.)
10825             fi
10826         elif ! test -f $LIBREPOSITORY_JAR; then
10827             AC_MSG_ERROR(librepository.jar not found.)
10828         fi
10830         if test -z $LIBFONTS_JAR; then
10831             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10832                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10833             elif test -f /usr/share/java/libfonts.jar; then
10834                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10835             else
10836                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10837             fi
10838         elif ! test -f $LIBFONTS_JAR; then
10839                 AC_MSG_ERROR(libfonts.jar not found.)
10840         fi
10842         if test -z $LIBSERIALIZER_JAR; then
10843             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10844                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10845             elif test -f /usr/share/java/libserializer.jar; then
10846                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10847             else
10848                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10849             fi
10850         elif ! test -f $LIBSERIALIZER_JAR; then
10851                 AC_MSG_ERROR(libserializer.jar not found.)
10852         fi
10854         if test -z $LIBBASE_JAR; then
10855             if test -f /usr/share/java/libbase-1.0.0.jar; then
10856                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10857             elif test -f /usr/share/java/libbase.jar; then
10858                 LIBBASE_JAR=/usr/share/java/libbase.jar
10859             else
10860                 AC_MSG_ERROR(libbase.jar replacement not found.)
10861             fi
10862         elif ! test -f $LIBBASE_JAR; then
10863             AC_MSG_ERROR(libbase.jar not found.)
10864         fi
10866     else
10867         AC_MSG_RESULT([internal])
10868         SYSTEM_JFREEREPORT=
10869         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10870     fi
10871 else
10872     AC_MSG_RESULT([no])
10873     ENABLE_REPORTBUILDER=
10874     SYSTEM_JFREEREPORT=
10876 AC_SUBST(ENABLE_REPORTBUILDER)
10877 AC_SUBST(SYSTEM_JFREEREPORT)
10878 AC_SUBST(SAC_JAR)
10879 AC_SUBST(LIBXML_JAR)
10880 AC_SUBST(FLUTE_JAR)
10881 AC_SUBST(JFREEREPORT_JAR)
10882 AC_SUBST(LIBBASE_JAR)
10883 AC_SUBST(LIBLAYOUT_JAR)
10884 AC_SUBST(LIBLOADER_JAR)
10885 AC_SUBST(LIBFORMULA_JAR)
10886 AC_SUBST(LIBREPOSITORY_JAR)
10887 AC_SUBST(LIBFONTS_JAR)
10888 AC_SUBST(LIBSERIALIZER_JAR)
10890 # this has to be here because both the Wiki Publisher and the SRB use
10891 # commons-logging
10892 COMMONS_LOGGING_VERSION=1.2
10893 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10894     AC_MSG_CHECKING([which Apache commons-* libs to use])
10895     if test "$with_system_apache_commons" = "yes"; then
10896         SYSTEM_APACHE_COMMONS=TRUE
10897         AC_MSG_RESULT([external])
10898         if test -z $COMMONS_LOGGING_JAR; then
10899             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10900                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10901            elif test -f /usr/share/java/commons-logging.jar; then
10902                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10903             else
10904                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10905             fi
10906         elif ! test -f $COMMONS_LOGGING_JAR; then
10907             AC_MSG_ERROR(commons-logging.jar not found.)
10908         fi
10909     else
10910         AC_MSG_RESULT([internal])
10911         SYSTEM_APACHE_COMMONS=
10912         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10913     fi
10915 AC_SUBST(SYSTEM_APACHE_COMMONS)
10916 AC_SUBST(COMMONS_LOGGING_JAR)
10917 AC_SUBST(COMMONS_LOGGING_VERSION)
10919 # scripting provider for BeanShell?
10920 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10921 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10922     AC_MSG_RESULT([yes])
10923     ENABLE_SCRIPTING_BEANSHELL=TRUE
10925     dnl ===================================================================
10926     dnl Check for system beanshell
10927     dnl ===================================================================
10928     AC_MSG_CHECKING([which beanshell to use])
10929     if test "$with_system_beanshell" = "yes"; then
10930         AC_MSG_RESULT([external])
10931         SYSTEM_BSH=TRUE
10932         if test -z $BSH_JAR; then
10933             BSH_JAR=/usr/share/java/bsh.jar
10934         fi
10935         if ! test -f $BSH_JAR; then
10936             AC_MSG_ERROR(bsh.jar not found.)
10937         fi
10938     else
10939         AC_MSG_RESULT([internal])
10940         SYSTEM_BSH=
10941         BUILD_TYPE="$BUILD_TYPE BSH"
10942     fi
10943 else
10944     AC_MSG_RESULT([no])
10945     ENABLE_SCRIPTING_BEANSHELL=
10946     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10948 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10949 AC_SUBST(SYSTEM_BSH)
10950 AC_SUBST(BSH_JAR)
10952 # scripting provider for JavaScript?
10953 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10954 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10955     AC_MSG_RESULT([yes])
10956     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10958     dnl ===================================================================
10959     dnl Check for system rhino
10960     dnl ===================================================================
10961     AC_MSG_CHECKING([which rhino to use])
10962     if test "$with_system_rhino" = "yes"; then
10963         AC_MSG_RESULT([external])
10964         SYSTEM_RHINO=TRUE
10965         if test -z $RHINO_JAR; then
10966             RHINO_JAR=/usr/share/java/js.jar
10967         fi
10968         if ! test -f $RHINO_JAR; then
10969             AC_MSG_ERROR(js.jar not found.)
10970         fi
10971     else
10972         AC_MSG_RESULT([internal])
10973         SYSTEM_RHINO=
10974         BUILD_TYPE="$BUILD_TYPE RHINO"
10975     fi
10976 else
10977     AC_MSG_RESULT([no])
10978     ENABLE_SCRIPTING_JAVASCRIPT=
10979     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10981 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10982 AC_SUBST(SYSTEM_RHINO)
10983 AC_SUBST(RHINO_JAR)
10985 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10986 # paths should be added to library search path. So lets put all 64-bit
10987 # platforms there.
10988 supports_multilib=
10989 case "$host_cpu" in
10990 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10991     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10992         supports_multilib="yes"
10993     fi
10994     ;;
10996     ;;
10997 esac
10999 dnl ===================================================================
11000 dnl Check whether the TQt and TDE libraries are available.
11001 dnl ===================================================================
11003 TDE_CFLAGS=""
11004 TDE_LIBS=""
11005 if test "$_os" != "OpenBSD"; then
11006     TDE_MOC="moc"
11008 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
11009     dnl Search paths for TQt and TDE
11010     if test -z "$supports_multilib"; then
11011         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"
11012         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"
11013     else
11014         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"
11015         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"
11016     fi
11017     if test -n "$TQTDIR"; then
11018         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
11019         if test -z "$supports_multilib"; then
11020             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
11021         else
11022             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
11023         fi
11024     fi
11025     if test -z "$supports_multilib"; then
11026         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"
11027         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"
11028     else
11029         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"
11030         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"
11031     fi
11032     if test -n "$TDEDIR"; then
11033         tde_incdirs="$TDEDIR/include $tde_incdirs"
11034         if test -z "$supports_multilib"; then
11035             tde_libdirs="$TDEDIR/lib $tde_libdirs"
11036         else
11037             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
11038         fi
11039     fi
11041     dnl What to test
11042     tqt_test_include="ntqstyle.h"
11043     tde_test_include="kapp.h"
11045     if test "$_os" != "OpenBSD"; then
11046         tqt_test_library="libtqt-mt.so"
11047         tde_test_library="libDCOP.so"
11048     else
11049         tqt_test_library="libtqt-mt.so*"
11050         tde_test_library="libDCOP.so*"
11051     fi
11053     dnl Check for TQt headers
11054     AC_MSG_CHECKING([for TQt headers])
11055     tqt_incdir="no"
11056     for tde_check in $tqt_incdirs; do
11057         if test -r "$tde_check/$tqt_test_include"; then
11058             tqt_incdir="$tde_check"
11059             break
11060         fi
11061     done
11062     AC_MSG_RESULT([$tqt_incdir])
11063     if test "x$tqt_incdir" = "xno"; then
11064         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
11065 your TQt installation by exporting TQTDIR before running "configure".])
11066     fi
11068     dnl Check for TQt libraries
11069     AC_MSG_CHECKING([for TQt libraries])
11070     tqt_libdir="no"
11071     for tqt_check in $tqt_libdirs; do
11072         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
11073             tqt_libdir="$tqt_check"
11074             break
11075         fi
11076     done
11077     AC_MSG_RESULT([$tqt_libdir])
11078     if test "x$tqt_libdir" = "xno"; then
11079         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
11080 your TQt installation by exporting TQTDIR before running "configure".])
11081     fi
11083     dnl Check for Meta Object Compiler
11084     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
11085     if test "$MOC" = "no"; then
11086         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
11087 the root of your TQt installation by exporting TQTDIR before running "configure".])
11088     fi
11090     dnl Check for TDE headers
11091     AC_MSG_CHECKING([for TDE headers])
11092     tde_incdir="no"
11093     for tde_check in $tde_incdirs; do
11094         if test -r "$tde_check/$tde_test_include"; then
11095             tde_incdir="$tde_check"
11096             break
11097         fi
11098     done
11099     AC_MSG_RESULT([$tde_incdir])
11100     if test "x$tde_incdir" = "xno"; then
11101         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
11102 your TDE installation by exporting TDEDIR before running "configure".])
11103     fi
11105     dnl Check for TDE libraries
11106     AC_MSG_CHECKING([for TDE libraries])
11107     tde_libdir="no"
11108     for tde_check in $tde_libdirs; do
11109         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
11110             tde_libdir="$tde_check"
11111             break
11112         fi
11113     done
11114     AC_MSG_RESULT([$tde_libdir])
11115     if test "x$tde_libdir" = "xno"; then
11116         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
11117 your TDE installation by exporting TDEDIR before running "configure".])
11118     fi
11120     dnl Set the variables
11121     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11122     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
11124 AC_SUBST(TDE_CFLAGS)
11125 AC_SUBST(TDE_LIBS)
11126 AC_SUBST(TDE_MOC)
11128 dnl ===================================================================
11129 dnl KDE4 Integration
11130 dnl ===================================================================
11132 KDE4_CFLAGS=""
11133 KDE4_LIBS=""
11134 QMAKE4="qmake"
11135 MOC4="moc"
11136 KDE4_GLIB_CFLAGS=""
11137 KDE4_GLIB_LIBS=""
11138 KDE4_HAVE_GLIB=""
11139 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11140     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11141     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11143     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
11144     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11146     if test -n "$supports_multilib"; then
11147         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11148         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11149     fi
11151     if test -n "$QTDIR"; then
11152         qt4_incdirs="$QTDIR/include $qt4_incdirs"
11153         if test -z "$supports_multilib"; then
11154             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
11155         else
11156             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
11157         fi
11158     fi
11159     if test -n "$QT4DIR"; then
11160         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
11161         if test -z "$supports_multilib"; then
11162             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
11163         else
11164             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
11165         fi
11166     fi
11168     if test -n "$KDEDIR"; then
11169         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
11170         if test -z "$supports_multilib"; then
11171             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
11172         else
11173             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
11174         fi
11175     fi
11176     if test -n "$KDE4DIR"; then
11177         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
11178         if test -z "$supports_multilib"; then
11179             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
11180         else
11181             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
11182         fi
11183     fi
11185     qt4_test_include="Qt/qobject.h"
11186     qt4_test_library="libQtNetwork.so"
11187     kde4_test_include="kwindowsystem.h"
11188     kde4_test_library="libsolid.so"
11190     AC_MSG_CHECKING([for Qt4 headers])
11191     qt4_header_dir="no"
11192     for inc_dir in $qt4_incdirs; do
11193         if test -r "$inc_dir/$qt4_test_include"; then
11194             qt4_header_dir="$inc_dir"
11195             break
11196         fi
11197     done
11199     AC_MSG_RESULT([$qt4_header_dir])
11200     if test "x$qt4_header_dir" = "xno"; then
11201         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11202     fi
11204     dnl Check for qmake
11205     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
11206     QMAKE4="$QMAKEQT4"
11207     if test "$QMAKE4" = "no"; then
11208         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
11209         if test "$QMAKE4" = "no"; then
11210             AC_MSG_ERROR([Qmake not found.  Please specify
11211 the root of your Qt installation by exporting QT4DIR before running "configure".])
11212         fi
11213     fi
11215     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
11216     AC_MSG_CHECKING([for Qt4 libraries])
11217     qt4_lib_dir="no"
11218     for lib_dir in $qt4_libdirs; do
11219         if test -r "$lib_dir/$qt4_test_library"; then
11220             qt4_lib_dir="$lib_dir"
11221             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11222             break
11223         fi
11224     done
11226     AC_MSG_RESULT([$qt4_lib_dir])
11228     if test "x$qt4_lib_dir" = "xno"; then
11229         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11230     fi
11232     dnl Check for Meta Object Compiler
11234     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11235     MOC4="$MOCQT4"
11236     if test "$MOC4" = "no"; then
11237         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11238         if test "$MOC4" = "no"; then
11239             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11240 the root of your Qt installation by exporting QT4DIR before running "configure".])
11241         fi
11242     fi
11244     dnl Check for KDE4 headers
11245     AC_MSG_CHECKING([for KDE4 headers])
11246     kde4_incdir="no"
11247     for kde4_check in $kde4_incdirs; do
11248         if test -r "$kde4_check/$kde4_test_include"; then
11249             kde4_incdir="$kde4_check"
11250             break
11251         fi
11252     done
11253     AC_MSG_RESULT([$kde4_incdir])
11254     if test "x$kde4_incdir" = "xno"; then
11255         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11256     fi
11257     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
11259     dnl Check for KDE4 libraries
11260     AC_MSG_CHECKING([for KDE4 libraries])
11261     kde4_libdir="no"
11262     for kde4_check in $kde4_libdirs; do
11263         if test -r "$kde4_check/$kde4_test_library"; then
11264             kde4_libdir="$kde4_check"
11265             break
11266         fi
11267     done
11269     AC_MSG_RESULT([$kde4_libdir])
11270     if test "x$kde4_libdir" = "xno"; then
11271         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11272     fi
11274     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11275     if ! test -z "$kde4_incdir"; then
11276         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11277     else
11278         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11279     fi
11281     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11282     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11283     FilterLibs "$KDE4_LIBS"
11284     KDE4_LIBS="$filteredlibs"
11286     AC_LANG_PUSH([C++])
11287     save_CXXFLAGS=$CXXFLAGS
11288     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11289     AC_MSG_CHECKING([whether KDE is >= 4.2])
11290        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11291 #include <kdeversion.h>
11293 int main(int argc, char **argv) {
11294        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11295        else return 1;
11297 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11298     CXXFLAGS=$save_CXXFLAGS
11299     AC_LANG_POP([C++])
11301     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11302     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11303     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11304         [
11305             KDE4_HAVE_GLIB=1
11306             AC_DEFINE(KDE4_HAVE_GLIB,1)
11307             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11308             FilterLibs "${KDE4_GLIB_LIBS}"
11309             KDE4_GLIB_LIBS="${filteredlibs}"
11311             qt4_fix_warning=
11313             AC_LANG_PUSH([C++])
11314             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11315             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11316             #  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
11317             #               ^~~~~~~~~~~~~~~~~~~~~~~
11318             #               vptr for 'QObjectPrivate'
11319             save_CXX=$CXX
11320             CXX=$(printf %s "$CXX" \
11321                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11322             save_CXXFLAGS=$CXXFLAGS
11323             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11324             save_LIBS=$LIBS
11325             LIBS="$LIBS $KDE4_LIBS"
11326             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11328             # Prepare meta object data
11329             TSTBASE="tst_exclude_socket_notifiers"
11330             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11331             ln -fs "${TSTMOC}.hxx"
11332             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11334             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11335 #include <cstdlib>
11336 #include "tst_exclude_socket_notifiers.moc"
11338 int main(int argc, char *argv[])
11340     QCoreApplication app(argc, argv);
11341     exit(tst_processEventsExcludeSocket());
11342     return 0;
11344             ]])],[
11345                 AC_MSG_RESULT([yes])
11346             ],[
11347                 AC_MSG_RESULT([no])
11348                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11349                 if test -z "$qt4_fix_warning"; then
11350                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11351                 fi
11352                 qt4_fix_warning=1
11353                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11354                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11356             # Remove meta object data
11357             rm -f "${TSTBASE}."*
11359             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11361             # Prepare meta object data
11362             TSTBASE="tst_exclude_posted_events"
11363             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11364             ln -fs "${TSTMOC}.hxx"
11365             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11367             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11368 #include <cstdlib>
11369 #include "tst_exclude_posted_events.moc"
11371 int main(int argc, char *argv[])
11373     QCoreApplication app(argc, argv);
11374     exit(tst_excludePostedEvents());
11375     return 0;
11377             ]])],[
11378                 AC_MSG_RESULT([yes])
11379             ],[
11380                 AC_MSG_RESULT([no])
11381                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11382                 if test -z "$qt4_fix_warning"; then
11383                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11384                 fi
11385                 qt4_fix_warning=1
11386                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11387             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11389             # Remove meta object data
11390             rm -f "${TSTBASE}."*
11392             if test -n "$qt4_fix_warning"; then
11393                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11394             fi
11396             LIBS=$save_LIBS
11397             CXXFLAGS=$save_CXXFLAGS
11398             CXX=$save_CXX
11399             AC_LANG_POP([C++])
11400         ],
11401         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11403 AC_SUBST(KDE4_CFLAGS)
11404 AC_SUBST(KDE4_LIBS)
11405 AC_SUBST(MOC4)
11406 AC_SUBST(KDE4_GLIB_CFLAGS)
11407 AC_SUBST(KDE4_GLIB_LIBS)
11408 AC_SUBST(KDE4_HAVE_GLIB)
11410 dnl ===================================================================
11411 dnl Test whether to include Evolution 2 support
11412 dnl ===================================================================
11413 AC_MSG_CHECKING([whether to enable evolution 2 support])
11414 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11415     AC_MSG_RESULT([yes])
11416     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11417     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11418     FilterLibs "${GOBJECT_LIBS}"
11419     GOBJECT_LIBS="${filteredlibs}"
11420     ENABLE_EVOAB2="TRUE"
11421 else
11422     ENABLE_EVOAB2=""
11423     AC_MSG_RESULT([no])
11425 AC_SUBST(ENABLE_EVOAB2)
11426 AC_SUBST(GOBJECT_CFLAGS)
11427 AC_SUBST(GOBJECT_LIBS)
11429 dnl ===================================================================
11430 dnl Test whether to include TDE AB support
11431 dnl ===================================================================
11432 AC_MSG_CHECKING([whether to enable TDE address book support])
11433 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11434     AC_MSG_RESULT([yes])
11435     AC_LANG_PUSH([C++])
11436     save_CXXFLAGS=$CXXFLAGS
11437     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11438     AC_MSG_CHECKING([whether TDE is at least R14.0])
11439        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11440 #include <tdeversion.h>
11442 int main(int argc, char **argv) {
11443        if (TDE_VERSION_MAJOR >= 14) return 0;
11444        else return 1;
11446        ]])],[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])],
11447        [AC_MSG_ERROR([TDE support not tested with cross compilation])])
11448     CXXFLAGS=$save_CXXFLAGS
11449     AC_LANG_POP([C++])
11450     ENABLE_TDEAB=TRUE
11451 else
11452     AC_MSG_RESULT([no])
11453     ENABLE_TDEAB=
11455 AC_SUBST(ENABLE_TDEAB)
11457 dnl ===================================================================
11458 dnl Test which themes to include
11459 dnl ===================================================================
11460 AC_MSG_CHECKING([which themes to include])
11461 # if none given use default subset of available themes
11462 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11463     with_theme="breeze breeze_dark galaxy hicontrast oxygen sifr tango"
11464     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11467 WITH_THEMES=""
11468 if test "x$with_theme" != "xno"; then
11469     for theme in $with_theme; do
11470         case $theme in
11471         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|tango|tango_testing) real_theme="$theme" ;;
11472         default) real_theme=galaxy ;;
11473         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11474         esac
11475         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11476     done
11478 AC_MSG_RESULT([$WITH_THEMES])
11479 AC_SUBST([WITH_THEMES])
11480 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11481 for theme in $with_theme; do
11482     case $theme in
11483     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11484     *) ;;
11485     esac
11486 done
11488 dnl ===================================================================
11489 dnl Test whether to integrate helppacks into the product's installer
11490 dnl ===================================================================
11491 AC_MSG_CHECKING([for helppack integration])
11492 if test "$with_helppack_integration" = "no"; then
11493     WITH_HELPPACK_INTEGRATION=
11494     AC_MSG_RESULT([no integration])
11495 else
11496     WITH_HELPPACK_INTEGRATION=TRUE
11497     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11498     AC_MSG_RESULT([integration])
11500 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11502 ###############################################################################
11503 # Extensions checking
11504 ###############################################################################
11505 AC_MSG_CHECKING([for extensions integration])
11506 if test "x$enable_extension_integration" != "xno"; then
11507     WITH_EXTENSION_INTEGRATION=TRUE
11508     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11509     AC_MSG_RESULT([yes, use integration])
11510 else
11511     WITH_EXTENSION_INTEGRATION=
11512     AC_MSG_RESULT([no, do not integrate])
11514 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11516 dnl Should any extra extensions be included?
11517 dnl There are standalone tests for each of these below.
11518 WITH_EXTRA_EXTENSIONS=
11519 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11521 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11522 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11523 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11524 if test "x$with_java" != "xno"; then
11525     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11526     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11529 TEST_FONTS_MISSING=0
11531 # $1  = font family
11532 # $2+ = accepted font mappings
11533 test_font_map()
11535     FONT="$1" ; shift
11536     AC_MSG_CHECKING([font mapping for '$FONT'])
11537     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11538     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11540     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11541     while test "$#" -ge 1 ; do
11542         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11543         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11544     done
11545     if test $TESTEXPR
11546     then
11547         AC_MSG_RESULT([ok])
11548     else
11549         AC_MSG_RESULT([unknown ($FONTFILE)])
11550         TEST_FONTS_MISSING=1
11551     fi
11554 dnl ===================================================================
11555 dnl Test whether to include fonts
11556 dnl ===================================================================
11557 AC_MSG_CHECKING([whether to include third-party fonts])
11558 if test "$with_fonts" != "no"; then
11559     AC_MSG_RESULT([yes])
11560     WITH_FONTS=TRUE
11561     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11562 else
11563     AC_MSG_RESULT([no])
11564     WITH_FONTS=
11565     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11566     if test "$test_fontconfig" = "yes"; then
11567         AC_PATH_PROG([FCMATCH], [fc-match])
11568         if test -z "$FCMATCH"; then
11569             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11570             TEST_FONTS_MISSING=1
11571         else
11572             test_font_map 'Calibri' 'Carlito'
11573             if test ${TEST_FONTS_MISSING} -eq 1
11574             then
11575                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11576             fi
11577         fi
11578     else
11579         TEST_FONTS_MISSING=0
11580     fi
11582 AC_SUBST(WITH_FONTS)
11583 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11585 dnl Test whether to include Google Noto fonts
11586 dnl ===================================================================
11587 AC_MSG_CHECKING([whether to include Google Noto fonts])
11588 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
11589     AC_MSG_RESULT([no])
11590     WITH_NOTO_FONT=
11591 else
11592     AC_MSG_RESULT([yes])
11593     WITH_NOTO_FONT=TRUE
11594     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
11595     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
11597 AC_SUBST(WITH_NOTO_FONT)
11599 dnl ===================================================================
11601 dnl ===================================================================
11602 dnl Test whether to enable online update service
11603 dnl ===================================================================
11604 AC_MSG_CHECKING([whether to enable online update])
11605 ENABLE_ONLINE_UPDATE=
11606 ENABLE_ONLINE_UPDATE_MAR=
11607 if test "$enable_online_update" = ""; then
11608     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11609         AC_MSG_RESULT([yes])
11610         ENABLE_ONLINE_UPDATE="TRUE"
11611     else
11612         AC_MSG_RESULT([no])
11613     fi
11614 else
11615     if test "$enable_online_update" = "mar"; then
11616         AC_MSG_RESULT([yes - MAR-based online update])
11617         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11618     elif test "$enable_online_update" = "yes"; then
11619         AC_MSG_RESULT([yes])
11620         ENABLE_ONLINE_UPDATE="TRUE"
11621     else
11622         AC_MSG_RESULT([no])
11623     fi
11625 AC_SUBST(ENABLE_ONLINE_UPDATE)
11626 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11628 dnl ===================================================================
11629 dnl Test whether we need bzip2
11630 dnl ===================================================================
11631 SYSTEM_BZIP2=
11632 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11633     AC_MSG_CHECKING([whether to use system bzip2])
11634     if test "$with_system_bzip2" = yes; then
11635         SYSTEM_BZIP2=TRUE
11636         AC_MSG_RESULT([yes])
11637         PKG_CHECK_MODULES(BZIP2, bzip2)
11638         FilterLibs "${BZIP2_LIBS}"
11639         BZIP2_LIBS="${filteredlibs}"
11640     else
11641         AC_MSG_RESULT([no])
11642         BUILD_TYPE="$BUILD_TYPE BZIP2"
11643     fi
11645 AC_SUBST(SYSTEM_BZIP2)
11646 AC_SUBST(BZIP2_CFLAGS)
11647 AC_SUBST(BZIP2_LIBS)
11649 dnl ===================================================================
11650 dnl Test whether to enable extension update
11651 dnl ===================================================================
11652 AC_MSG_CHECKING([whether to enable extension update])
11653 ENABLE_EXTENSION_UPDATE=
11654 if test "x$enable_extension_update" = "xno"; then
11655     AC_MSG_RESULT([no])
11656 else
11657     AC_MSG_RESULT([yes])
11658     ENABLE_EXTENSION_UPDATE="TRUE"
11659     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11660     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11662 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11665 dnl ===================================================================
11666 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11667 dnl ===================================================================
11668 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11669 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11670     AC_MSG_RESULT([no])
11671     ENABLE_SILENT_MSI=
11672 else
11673     AC_MSG_RESULT([yes])
11674     ENABLE_SILENT_MSI=TRUE
11675     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11677 AC_SUBST(ENABLE_SILENT_MSI)
11679 AC_MSG_CHECKING([whether and how to use Xinerama])
11680 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11681     if test "$x_libraries" = "default_x_libraries"; then
11682         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11683         if test "x$XINERAMALIB" = x; then
11684            XINERAMALIB="/usr/lib"
11685         fi
11686     else
11687         XINERAMALIB="$x_libraries"
11688     fi
11689     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11690         # we have both versions, let the user decide but use the dynamic one
11691         # per default
11692         USE_XINERAMA=TRUE
11693         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11694             XINERAMA_LINK=dynamic
11695         else
11696             XINERAMA_LINK=static
11697         fi
11698     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11699         # we have only the dynamic version
11700         USE_XINERAMA=TRUE
11701         XINERAMA_LINK=dynamic
11702     elif test -e "$XINERAMALIB/libXinerama.a"; then
11703         # static version
11704         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11705             USE_XINERAMA=TRUE
11706             XINERAMA_LINK=static
11707         else
11708             USE_XINERAMA=
11709             XINERAMA_LINK=none
11710         fi
11711     else
11712         # no Xinerama
11713         USE_XINERAMA=
11714         XINERAMA_LINK=none
11715     fi
11716     if test "$USE_XINERAMA" = "TRUE"; then
11717         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11718         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11719             [AC_MSG_ERROR(Xinerama header not found.)], [])
11720         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11721         if test "x$XEXTLIB" = x; then
11722            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11723         fi
11724         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11725         if test "$_os" = "FreeBSD"; then
11726             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11727         fi
11728         if test "$_os" = "Linux"; then
11729             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11730         fi
11731         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11732             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11733     else
11734         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11735     fi
11736 else
11737     USE_XINERAMA=
11738     XINERAMA_LINK=none
11739     AC_MSG_RESULT([no])
11741 AC_SUBST(USE_XINERAMA)
11742 AC_SUBST(XINERAMA_LINK)
11744 dnl ===================================================================
11745 dnl Test whether to build cairo or rely on the system version
11746 dnl ===================================================================
11748 if test "$USING_X11" = TRUE; then
11749     # Used in vcl/Library_vclplug_gen.mk
11750     test_cairo=yes
11753 if test "$test_cairo" = "yes"; then
11754     AC_MSG_CHECKING([whether to use the system cairo])
11756     : ${with_system_cairo:=$with_system_libs}
11757     if test "$with_system_cairo" = "yes"; then
11758         SYSTEM_CAIRO=TRUE
11759         AC_MSG_RESULT([yes])
11761         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11762         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11763         FilterLibs "${CAIRO_LIBS}"
11764         CAIRO_LIBS="${filteredlibs}"
11766         if test "$test_xrender" = "yes"; then
11767             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11768             AC_LANG_PUSH([C])
11769             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11770 #ifdef PictStandardA8
11771 #else
11772       return fail;
11773 #endif
11774 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11776             AC_LANG_POP([C])
11777         fi
11778         libo_MINGW_CHECK_DLL([libcairo])
11779         libo_MINGW_TRY_DLL([libfontconfig])
11780         libo_MINGW_TRY_DLL([libfreetype])
11781         libo_MINGW_TRY_DLL([libpixman])
11782         libo_MINGW_TRY_DLL([libpng15])
11783     else
11784         SYSTEM_CAIRO=
11785         AC_MSG_RESULT([no])
11787         BUILD_TYPE="$BUILD_TYPE CAIRO"
11788     fi
11791 AC_SUBST(SYSTEM_CAIRO)
11792 AC_SUBST(CAIRO_CFLAGS)
11793 AC_SUBST(CAIRO_LIBS)
11795 dnl ===================================================================
11796 dnl Test whether to use avahi
11797 dnl ===================================================================
11798 if test "$_os" = "WINNT"; then
11799     # Windows uses bundled mDNSResponder
11800     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11801 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11802     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11803                       [ENABLE_AVAHI="TRUE"])
11804     AC_DEFINE(HAVE_FEATURE_AVAHI)
11805     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11806     FilterLibs "${AVAHI_LIBS}"
11807     AVAHI_LIBS="${filteredlibs}"
11810 AC_SUBST(ENABLE_AVAHI)
11811 AC_SUBST(AVAHI_CFLAGS)
11812 AC_SUBST(AVAHI_LIBS)
11814 dnl ===================================================================
11815 dnl Test whether to use liblangtag
11816 dnl ===================================================================
11817 ENABLE_LIBLANGTAG=
11818 SYSTEM_LIBLANGTAG=
11819 AC_MSG_CHECKING([whether to use liblangtag])
11820 if test "$enable_liblangtag" = "yes" -o \
11821         \( "$enable_liblangtag" = "" -a $_os != Emscripten \); then
11822     ENABLE_LIBLANGTAG=TRUE
11823     AC_MSG_RESULT([yes])
11824     AC_MSG_CHECKING([whether to use system liblangtag])
11825     if test "$with_system_liblangtag" = yes; then
11826         SYSTEM_LIBLANGTAG=TRUE
11827         AC_MSG_RESULT([yes])
11828         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11829         dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11830         PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11831         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11832         FilterLibs "${LIBLANGTAG_LIBS}"
11833         LIBLANGTAG_LIBS="${filteredlibs}"
11834         libo_MINGW_CHECK_DLL([liblangtag])
11835     else
11836         SYSTEM_LIBLANGTAG=
11837         AC_MSG_RESULT([no])
11838         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11839         LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/langtag"
11840         if test "$COM" = "MSC"; then
11841             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11842         else
11843             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11844         fi
11845     fi
11846     AC_DEFINE(ENABLE_LIBLANGTAG)
11847 else
11848     AC_MSG_RESULT([no])
11850 AC_SUBST(ENABLE_LIBLANGTAG)
11851 AC_SUBST(SYSTEM_LIBLANGTAG)
11852 AC_SUBST(LIBLANGTAG_CFLAGS)
11853 AC_SUBST(LIBLANGTAG_LIBS)
11855 dnl ===================================================================
11856 dnl Test whether to build libpng or rely on the system version
11857 dnl ===================================================================
11859 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11861 dnl ===================================================================
11862 dnl Check for runtime JVM search path
11863 dnl ===================================================================
11864 if test "$ENABLE_JAVA" != ""; then
11865     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11866     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11867         AC_MSG_RESULT([yes])
11868         if ! test -d "$with_jvm_path"; then
11869             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11870         fi
11871         if ! test -d "$with_jvm_path"jvm; then
11872             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11873         fi
11874         JVM_ONE_PATH_CHECK="$with_jvm_path"
11875         AC_SUBST(JVM_ONE_PATH_CHECK)
11876     else
11877         AC_MSG_RESULT([no])
11878     fi
11881 dnl ===================================================================
11882 dnl Test for the presence of Ant and that it works
11883 dnl ===================================================================
11885 if test "$ENABLE_JAVA" != ""; then
11886     ANT_HOME=; export ANT_HOME
11887     WITH_ANT_HOME=; export WITH_ANT_HOME
11888     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11889         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11890             if test "$_os" = "WINNT"; then
11891                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11892             else
11893                 with_ant_home="$LODE_HOME/opt/ant"
11894             fi
11895         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11896             with_ant_home="$LODE_HOME/opt/ant"
11897         fi
11898     fi
11899     if test -z "$with_ant_home"; then
11900         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11901     else
11902         if test "$_os" = "WINNT"; then
11903             # AC_PATH_PROGS needs unix path
11904             with_ant_home=`cygpath -u "$with_ant_home"`
11905         fi
11906         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11907         WITH_ANT_HOME=$with_ant_home
11908         ANT_HOME=$with_ant_home
11909     fi
11911     if test -z "$ANT"; then
11912         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11913     else
11914         # resolve relative or absolute symlink
11915         while test -h "$ANT"; do
11916             a_cwd=`pwd`
11917             a_basename=`basename "$ANT"`
11918             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11919             cd "`dirname "$ANT"`"
11920             cd "`dirname "$a_script"`"
11921             ANT="`pwd`"/"`basename "$a_script"`"
11922             cd "$a_cwd"
11923         done
11925         AC_MSG_CHECKING([if $ANT works])
11926         cat > conftest.java << EOF
11927         public class conftest {
11928             int testmethod(int a, int b) {
11929                     return a + b;
11930             }
11931         }
11934         cat > conftest.xml << EOF
11935         <project name="conftest" default="conftest">
11936         <target name="conftest">
11937             <javac srcdir="." includes="conftest.java">
11938             </javac>
11939         </target>
11940         </project>
11943         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11944         if test $? = 0 -a -f ./conftest.class; then
11945             AC_MSG_RESULT([Ant works])
11946             if test -z "$WITH_ANT_HOME"; then
11947                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11948                 if test -z "$ANT_HOME"; then
11949                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11950                 fi
11951             else
11952                 ANT_HOME="$WITH_ANT_HOME"
11953             fi
11954         else
11955             echo "configure: Ant test failed" >&5
11956             cat conftest.java >&5
11957             cat conftest.xml >&5
11958             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11959         fi
11960         rm -f conftest* core core.* *.core
11961     fi
11962     if test -z "$ANT_HOME"; then
11963         ANT_HOME="NO_ANT_HOME"
11964     else
11965         PathFormat "$ANT_HOME"
11966         ANT_HOME="$formatted_path"
11967         PathFormat "$ANT"
11968         ANT="$formatted_path"
11969     fi
11970     AC_SUBST(ANT_HOME)
11971     AC_SUBST(ANT)
11973     dnl Checking for ant.jar
11974     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11975         AC_MSG_CHECKING([Ant lib directory])
11976         if test -f $ANT_HOME/lib/ant.jar; then
11977             ANT_LIB="$ANT_HOME/lib"
11978         else
11979             if test -f $ANT_HOME/ant.jar; then
11980                 ANT_LIB="$ANT_HOME"
11981             else
11982                 if test -f /usr/share/java/ant.jar; then
11983                     ANT_LIB=/usr/share/java
11984                 else
11985                     if test -f /usr/share/ant-core/lib/ant.jar; then
11986                         ANT_LIB=/usr/share/ant-core/lib
11987                     else
11988                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11989                             ANT_LIB="$ANT_HOME/lib/ant"
11990                         else
11991                             if test -f /usr/share/lib/ant/ant.jar; then
11992                                 ANT_LIB=/usr/share/lib/ant
11993                             else
11994                                 AC_MSG_ERROR([Ant libraries not found!])
11995                             fi
11996                         fi
11997                     fi
11998                 fi
11999             fi
12000         fi
12001         PathFormat "$ANT_LIB"
12002         ANT_LIB="$formatted_path"
12003         AC_MSG_RESULT([Ant lib directory found.])
12004     fi
12005     AC_SUBST(ANT_LIB)
12007     ant_minver=1.6.0
12008     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12010     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12011     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12012     ant_version_major=`echo $ant_version | cut -d. -f1`
12013     ant_version_minor=`echo $ant_version | cut -d. -f2`
12014     echo "configure: ant_version $ant_version " >&5
12015     echo "configure: ant_version_major $ant_version_major " >&5
12016     echo "configure: ant_version_minor $ant_version_minor " >&5
12017     if test "$ant_version_major" -ge "2"; then
12018         AC_MSG_RESULT([yes, $ant_version])
12019     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12020         AC_MSG_RESULT([yes, $ant_version])
12021     else
12022         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12023     fi
12025     rm -f conftest* core core.* *.core
12028 OOO_JUNIT_JAR=
12029 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12030     AC_MSG_CHECKING([for JUnit 4])
12031     if test "$with_junit" = "yes"; then
12032         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12033             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12034         elif test -e /usr/share/java/junit4.jar; then
12035             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12036         else
12037            if test -e /usr/share/lib/java/junit.jar; then
12038               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12039            else
12040               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12041            fi
12042         fi
12043     else
12044         OOO_JUNIT_JAR=$with_junit
12045     fi
12046     if test "$_os" = "WINNT"; then
12047         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12048     fi
12049     printf 'import org.junit.Before;' > conftest.java
12050     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12051         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12052     else
12053         AC_MSG_ERROR(
12054 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12055  specify its pathname via --with-junit=..., or disable it via --without-junit])
12056     fi
12057     rm -f conftest.class conftest.java
12058     if test $OOO_JUNIT_JAR != ""; then
12059     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12060     fi
12062 AC_SUBST(OOO_JUNIT_JAR)
12064 HAMCREST_JAR=
12065 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12066     AC_MSG_CHECKING([for included Hamcrest])
12067     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12068     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12069         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12070     else
12071         AC_MSG_RESULT([Not included])
12072         AC_MSG_CHECKING([for standalone hamcrest jar.])
12073         if test "$with_hamcrest" = "yes"; then
12074             if test -e /usr/share/lib/java/hamcrest.jar; then
12075                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12076             elif test -e /usr/share/java/hamcrest/core.jar; then
12077                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12078             else
12079                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12080             fi
12081         else
12082             HAMCREST_JAR=$with_hamcrest
12083         fi
12084         if test "$_os" = "WINNT"; then
12085             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12086         fi
12087         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12088             AC_MSG_RESULT([$HAMCREST_JAR])
12089         else
12090             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),
12091                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12092         fi
12093     fi
12094     rm -f conftest.class conftest.java
12096 AC_SUBST(HAMCREST_JAR)
12099 AC_SUBST(SCPDEFS)
12102 # check for wget and curl
12104 WGET=
12105 CURL=
12107 if test "$enable_fetch_external" != "no"; then
12109 CURL=`which curl 2>/dev/null`
12111 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12112     # wget new enough?
12113     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12114     if test $? -eq 0; then
12115         WGET=$i
12116         break
12117     fi
12118 done
12120 if test -z "$WGET" -a -z "$CURL"; then
12121     AC_MSG_ERROR([neither wget nor curl found!])
12126 AC_SUBST(WGET)
12127 AC_SUBST(CURL)
12130 # check for md5sum
12132 MD5SUM=
12134 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12135     if test "$i" = "md5"; then
12136         eval "$i -x" > /dev/null 2>&1
12137     else
12138         eval "$i --version" > /dev/null 2>&1
12139     fi
12140     ret=$?
12141     if test $ret -eq 0; then
12142         MD5SUM=$i
12143         break
12144     fi
12145 done
12147 if test "$MD5SUM" = "md5"; then
12148     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12149         MD5SUM="$MD5SUM -r"
12150     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12151         MD5SUM="$MD5SUM -n"
12152     fi
12155 if test -z "$MD5SUM"; then
12156     AC_MSG_ERROR([no md5sum found!])
12159 AC_SUBST(MD5SUM)
12161 dnl ===================================================================
12162 dnl Dealing with l10n options
12163 dnl ===================================================================
12164 AC_MSG_CHECKING([which languages to be built])
12165 # get list of all languages
12166 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12167 # the sed command does the following:
12168 #   + if a line ends with a backslash, append the next line to it
12169 #   + adds " on the beginning of the value (after =)
12170 #   + adds " at the end of the value
12171 #   + removes en-US; we want to put it on the beginning
12172 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12173 [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)]
12174 ALL_LANGS="en-US $completelangiso"
12175 # check the configured localizations
12176 WITH_LANG="$with_lang"
12177 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12178     AC_MSG_RESULT([en-US])
12179 else
12180     AC_MSG_RESULT([$WITH_LANG])
12181     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12183 # check that the list is valid
12184 for lang in $WITH_LANG; do
12185     test "$lang" = "ALL" && continue
12186     # need to check for the exact string, so add space before and after the list of all languages
12187     for vl in $ALL_LANGS; do
12188         if test "$vl" = "$lang"; then
12189            break
12190         fi
12191     done
12192     if test "$vl" != "$lang"; then
12193         # if you're reading this - you prolly quoted your languages remove the quotes ...
12194         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12195     fi
12196 done
12197 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12198     echo $WITH_LANG | grep -q en-US
12199     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12201 # list with substituted ALL
12202 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12203 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12204 test "$WITH_LANG" = "en-US" && WITH_LANG=
12205 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12206     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12207     ALL_LANGS=`echo $ALL_LANGS qtz`
12209 AC_SUBST(ALL_LANGS)
12210 AC_SUBST(WITH_LANG)
12211 AC_SUBST(WITH_LANG_LIST)
12212 AC_SUBST(GIT_NEEDED_SUBMODULES)
12214 WITH_POOR_HELP_LOCALIZATIONS=
12215 if test -d "$SRC_ROOT/translations/source"; then
12216     for l in `ls -1 $SRC_ROOT/translations/source`; do
12217         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12218             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12219         fi
12220     done
12222 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12224 if test -n "$with_locales"; then
12225     WITH_LOCALES="$with_locales"
12227     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12228     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12229     # config_host/config_locales.h.in
12230     for locale in $WITH_LOCALES; do
12231         lang=${locale%_*}
12233         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12235         case $lang in
12236         hi|mr*ne)
12237             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12238             ;;
12239         bg|ru)
12240             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12241             ;;
12242         esac
12243     done
12244 else
12245     AC_DEFINE(WITH_LOCALE_ALL)
12247 AC_SUBST(WITH_LOCALES)
12249 dnl git submodule update --reference
12250 dnl ===================================================================
12251 if test -n "${GIT_REFERENCE_SRC}"; then
12252     for repo in ${GIT_NEEDED_SUBMODULES}; do
12253         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12254             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12255         fi
12256     done
12258 AC_SUBST(GIT_REFERENCE_SRC)
12260 dnl git submodules linked dirs
12261 dnl ===================================================================
12262 if test -n "${GIT_LINK_SRC}"; then
12263     for repo in ${GIT_NEEDED_SUBMODULES}; do
12264         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12265             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12266         fi
12267     done
12269 AC_SUBST(GIT_LINK_SRC)
12271 dnl branding
12272 dnl ===================================================================
12273 AC_MSG_CHECKING([for alternative branding images directory])
12274 # initialize mapped arrays
12275 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12276 brand_files="$BRAND_INTRO_IMAGES about.svg"
12278 if test -z "$with_branding" -o "$with_branding" = "no"; then
12279     AC_MSG_RESULT([none])
12280     DEFAULT_BRAND_IMAGES="$brand_files"
12281 else
12282     if ! test -d $with_branding ; then
12283         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12284     else
12285         AC_MSG_RESULT([$with_branding])
12286         CUSTOM_BRAND_DIR="$with_branding"
12287         for lfile in $brand_files
12288         do
12289             if ! test -f $with_branding/$lfile ; then
12290                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12291                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12292             else
12293                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12294             fi
12295         done
12296         check_for_progress="yes"
12297     fi
12299 AC_SUBST([BRAND_INTRO_IMAGES])
12300 AC_SUBST([CUSTOM_BRAND_DIR])
12301 AC_SUBST([CUSTOM_BRAND_IMAGES])
12302 AC_SUBST([DEFAULT_BRAND_IMAGES])
12305 AC_MSG_CHECKING([for 'intro' progress settings])
12306 PROGRESSBARCOLOR=
12307 PROGRESSSIZE=
12308 PROGRESSPOSITION=
12309 PROGRESSFRAMECOLOR=
12310 PROGRESSTEXTCOLOR=
12311 PROGRESSTEXTBASELINE=
12313 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12314     source "$with_branding/progress.conf"
12315     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12316 else
12317     AC_MSG_RESULT([none])
12320 AC_SUBST(PROGRESSBARCOLOR)
12321 AC_SUBST(PROGRESSSIZE)
12322 AC_SUBST(PROGRESSPOSITION)
12323 AC_SUBST(PROGRESSFRAMECOLOR)
12324 AC_SUBST(PROGRESSTEXTCOLOR)
12325 AC_SUBST(PROGRESSTEXTBASELINE)
12328 AC_MSG_CHECKING([for extra build ID])
12329 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12330     EXTRA_BUILDID="$with_extra_buildid"
12332 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12333 if test -n "$EXTRA_BUILDID" ; then
12334     AC_MSG_RESULT([$EXTRA_BUILDID])
12335 else
12336     AC_MSG_RESULT([not set])
12338 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12340 OOO_VENDOR=
12341 AC_MSG_CHECKING([for vendor])
12342 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12343     OOO_VENDOR="$USERNAME"
12345     if test -z "$OOO_VENDOR"; then
12346         OOO_VENDOR="$USER"
12347     fi
12349     if test -z "$OOO_VENDOR"; then
12350         OOO_VENDOR="`id -u -n`"
12351     fi
12353     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12354 else
12355     OOO_VENDOR="$with_vendor"
12356     AC_MSG_RESULT([$OOO_VENDOR])
12358 AC_SUBST(OOO_VENDOR)
12360 if echo "$host_os" | grep -q linux-android ; then
12361     ANDROID_PACKAGE_NAME=
12362     AC_MSG_CHECKING([for Android package name])
12363     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12364         if test -n "$ENABLE_DEBUG"; then
12365             # Default to the package name that makes ndk-gdb happy.
12366             ANDROID_PACKAGE_NAME="org.libreoffice"
12367         else
12368             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12369         fi
12371         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12372     else
12373         ANDROID_PACKAGE_NAME="$with_android_package_name"
12374         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12375     fi
12376     AC_SUBST(ANDROID_PACKAGE_NAME)
12379 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12380 if test "$with_compat_oowrappers" = "yes"; then
12381     WITH_COMPAT_OOWRAPPERS=TRUE
12382     AC_MSG_RESULT(yes)
12383 else
12384     WITH_COMPAT_OOWRAPPERS=
12385     AC_MSG_RESULT(no)
12387 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12389 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12390 AC_MSG_CHECKING([for install dirname])
12391 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12392     INSTALLDIRNAME="$with_install_dirname"
12394 AC_MSG_RESULT([$INSTALLDIRNAME])
12395 AC_SUBST(INSTALLDIRNAME)
12397 AC_MSG_CHECKING([for prefix])
12398 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12399 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12400 PREFIXDIR="$prefix"
12401 AC_MSG_RESULT([$PREFIXDIR])
12402 AC_SUBST(PREFIXDIR)
12404 LIBDIR=[$(eval echo $(eval echo $libdir))]
12405 AC_SUBST(LIBDIR)
12407 DATADIR=[$(eval echo $(eval echo $datadir))]
12408 AC_SUBST(DATADIR)
12410 MANDIR=[$(eval echo $(eval echo $mandir))]
12411 AC_SUBST(MANDIR)
12413 DOCDIR=[$(eval echo $(eval echo $docdir))]
12414 AC_SUBST(DOCDIR)
12416 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12417 AC_SUBST(INSTALLDIR)
12419 TESTINSTALLDIR="${BUILDDIR}/test-install"
12420 AC_SUBST(TESTINSTALLDIR)
12423 # ===================================================================
12424 # OAuth2 id and secrets
12425 # ===================================================================
12427 AC_MSG_CHECKING([for Google Drive client id and secret])
12428 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12429 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12430 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12431     GDRIVE_CLIENT_ID="\"\""
12434 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12435     GDRIVE_CLIENT_SECRET="\"\""
12438 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12439     AC_MSG_RESULT([not set])
12440 else
12441     AC_MSG_RESULT([set])
12444 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12445 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12447 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12448 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12449 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12450 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12451     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12454 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12455     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12458 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12459     AC_MSG_RESULT([not set])
12460 else
12461     AC_MSG_RESULT([set])
12463 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12464 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12466 AC_MSG_CHECKING([for OneDrive client id and secret])
12467 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12468 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12469 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12470     ONEDRIVE_CLIENT_ID="\"\""
12473 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12474     ONEDRIVE_CLIENT_SECRET="\"\""
12477 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12478     AC_MSG_RESULT([not set])
12479 else
12480     AC_MSG_RESULT([set])
12482 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12483 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12486 dnl ===================================================================
12487 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12488 dnl --enable-dependency-tracking configure option
12489 dnl ===================================================================
12490 AC_MSG_CHECKING([whether to enable dependency tracking])
12491 if test "$enable_dependency_tracking" = "no"; then
12492     nodep=TRUE
12493     AC_MSG_RESULT([no])
12494 else
12495     AC_MSG_RESULT([yes])
12497 AC_SUBST(nodep)
12499 dnl ===================================================================
12500 dnl Number of CPUs to use during the build
12501 dnl ===================================================================
12502 AC_MSG_CHECKING([for number of processors to use])
12503 # plain --with-parallelism is just the default
12504 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12505     if test "$with_parallelism" = "no"; then
12506         PARALLELISM=0
12507     else
12508         PARALLELISM=$with_parallelism
12509     fi
12510 else
12511     if test "$enable_icecream" = "yes"; then
12512         PARALLELISM="10"
12513     else
12514         case `uname -s` in
12516         Darwin|FreeBSD|NetBSD|OpenBSD)
12517             PARALLELISM=`sysctl -n hw.ncpu`
12518             ;;
12520         Linux)
12521             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12522         ;;
12523         # what else than above does profit here *and* has /proc?
12524         *)
12525             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12526             ;;
12527         esac
12529         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12530         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12531     fi
12534 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12535     if test -z "$with_parallelism"; then
12536             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12537             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12538             PARALLELISM="1"
12539     else
12540         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."
12541     fi
12544 if test $PARALLELISM -eq 0; then
12545     AC_MSG_RESULT([explicit make -j option needed])
12546 else
12547     AC_MSG_RESULT([$PARALLELISM])
12549 AC_SUBST(PARALLELISM)
12551 IWYU_PATH="$with_iwyu"
12552 AC_SUBST(IWYU_PATH)
12553 if test ! -z "$IWYU_PATH"; then
12554     if test ! -f "$IWYU_PATH"; then
12555         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12556     fi
12560 # Set up ILIB for MSVC build
12562 ILIB1=
12563 if test "$build_os" = "cygwin"; then
12564     ILIB="."
12565     if test -n "$JAVA_HOME"; then
12566         ILIB="$ILIB;$JAVA_HOME/lib"
12567     fi
12568     ILIB1=-link
12569     if test "$BITNESS_OVERRIDE" = 64; then
12570         ILIB="$ILIB;$COMPATH/lib/amd64"
12571         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12572         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12573         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12574         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12575             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12576             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12577         fi
12578         if test $VCVER = 140; then
12579             PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12580             ucrtlibpath_formatted=$formatted_path
12581             ILIB="$ILIB;$ucrtlibpath_formatted"
12582         fi
12583     else
12584         ILIB="$ILIB;$COMPATH/lib"
12585         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12586         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12587         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12588         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12589             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12590             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12591         fi
12592         if test $VCVER = 140; then
12593             PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12594             ucrtlibpath_formatted=$formatted_path
12595             ILIB="$ILIB;$ucrtlibpath_formatted"
12596         fi
12597     fi
12598     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12599         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12600     else
12601         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12602     fi
12604     AC_SUBST(ILIB)
12607 AC_MSG_CHECKING(
12608     [whether C++11 use of const_iterator in standard containers is broken])
12609 save_CXXFLAGS=$CXXFLAGS
12610 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12611 AC_LANG_PUSH([C++])
12612 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12613     #include <list>
12614     ]],[[
12615         std::list<int> l;
12616         l.erase(l.cbegin());
12617     ]])],
12618     [broken=no], [broken=yes])
12619 AC_LANG_POP([C++])
12620 LIBS=$save_LIBS
12621 CXXFLAGS=$save_CXXFLAGS
12622 AC_MSG_RESULT([$broken])
12623 if test "$broken" = yes; then
12624     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12628 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12629 save_CXXFLAGS=$CXXFLAGS
12630 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12631 save_LIBS=$LIBS
12632 if test -n "$ILIB1"; then
12633     LIBS="$LIBS $ILIB1"
12635 AC_LANG_PUSH([C++])
12636 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12637     // Exit with failure if the static initializer_list is stored on the
12638     // stack (as done by Clang < 3.4):
12639     #include <initializer_list>
12640     struct S {};
12641     bool g(void const * p1, void const * p2) {
12642         int n;
12643         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12644     }
12645     bool f(void const * p1) {
12646         static std::initializer_list<S> s { S() };
12647         return g(p1, s.begin());
12648     }
12649     ]],[[
12650         int n;
12651         return f(&n) ? 0 : 1;
12652     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12653 AC_LANG_POP([C++])
12654 LIBS=$save_LIBS
12655 CXXFLAGS=$save_CXXFLAGS
12656 AC_MSG_RESULT([$broken])
12657 if test "$broken" = yes; then
12658     AC_DEFINE([HAVE_BROKEN_STATIC_INITIALIZER_LIST])
12662 # ===================================================================
12663 # Creating bigger shared library to link against
12664 # ===================================================================
12665 AC_MSG_CHECKING([whether to create huge library])
12666 MERGELIBS=
12668 if test $_os = iOS -o $_os = Android; then
12669     # Never any point in mergelibs for these as we build just static
12670     # libraries anyway...
12671     enable_mergelibs=no
12674 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12675     if test $_os != Linux -a $_os != WINNT; then
12676         add_warning "--enable-mergelibs is not tested for this platform"
12677     fi
12678     MERGELIBS="TRUE"
12679     AC_MSG_RESULT([yes])
12680 else
12681     AC_MSG_RESULT([no])
12683 AC_SUBST([MERGELIBS])
12685 dnl ===================================================================
12686 dnl icerun is a wrapper that stops us spawning tens of processes
12687 dnl locally - for tools that can't be executed on the compile cluster
12688 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12689 dnl ===================================================================
12690 AC_MSG_CHECKING([whether to use icerun wrapper])
12691 ICECREAM_RUN=
12692 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12693     ICECREAM_RUN=icerun
12694     AC_MSG_RESULT([yes])
12695 else
12696     AC_MSG_RESULT([no])
12698 AC_SUBST(ICECREAM_RUN)
12700 dnl ===================================================================
12701 dnl Setup the ICECC_VERSION for the build the same way it was set for
12702 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12703 dnl ===================================================================
12704 x_ICECC_VERSION=[\#]
12705 if test -n "$ICECC_VERSION" ; then
12706     x_ICECC_VERSION=
12708 AC_SUBST(x_ICECC_VERSION)
12709 AC_SUBST(ICECC_VERSION)
12711 dnl ===================================================================
12713 AC_MSG_CHECKING([MPL subset])
12714 MPL_SUBSET=
12716 if test "$enable_mpl_subset" = "yes"; then
12717     warn_report=false
12718     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12719         warn_report=true
12720     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12721         warn_report=true
12722     fi
12723     if test "$warn_report" = "true"; then
12724         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12725     fi
12726     if test "x$enable_postgresql_sdbc" != "xno"; then
12727         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12728     fi
12729     if test "$enable_lotuswordpro" = "yes"; then
12730         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12731     fi
12732     if test "$WITH_WEBDAV" = "neon"; then
12733         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12734     fi
12735     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12736         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12737     fi
12738     if test -n "$ENABLE_PDFIMPORT"; then
12739         if test "x$SYSTEM_POPPLER" = "x"; then
12740             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12741         fi
12742     fi
12743     # cf. m4/libo_check_extension.m4
12744     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12745         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12746     fi
12747     for theme in $WITH_THEMES; do
12748         case $theme in
12749         crystal|default|hicontrast|oxygen)
12750             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12751         *) : ;;
12752         esac
12753     done
12755     ENABLE_OPENGL_TRANSITIONS=
12757     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12758         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12759     fi
12761     MPL_SUBSET="TRUE"
12762     AC_DEFINE(MPL_HAVE_SUBSET)
12763     AC_MSG_RESULT([only])
12764 else
12765     AC_MSG_RESULT([no restrictions])
12767 AC_SUBST(MPL_SUBSET)
12769 dnl ===================================================================
12771 AC_MSG_CHECKING([formula logger])
12772 ENABLE_FORMULA_LOGGER=
12774 if test "x$enable_formula_logger" = "xyes"; then
12775     AC_MSG_RESULT([yes])
12776     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12777     ENABLE_FORMULA_LOGGER=TRUE
12778 else
12779     AC_MSG_RESULT([no])
12782 AC_SUBST(ENABLE_FORMULA_LOGGER)
12784 dnl ===================================================================
12785 dnl Setting up the environment.
12786 dnl ===================================================================
12787 AC_MSG_NOTICE([setting up the build environment variables...])
12789 AC_SUBST(COMPATH)
12791 if test "$build_os" = "cygwin"; then
12792     if test -d "$COMPATH/atlmfc/lib"; then
12793         ATL_LIB="$COMPATH/atlmfc/lib"
12794         ATL_INCLUDE="$COMPATH/atlmfc/include"
12795     else
12796         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12797         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12798     fi
12799     if test "$BITNESS_OVERRIDE" = 64; then
12800         ATL_LIB="$ATL_LIB/amd64"
12801     fi
12802     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12803     PathFormat "/usr/bin/find.exe"
12804     FIND="$formatted_path"
12805     PathFormat "/usr/bin/sort.exe"
12806     SORT="$formatted_path"
12807     PathFormat "/usr/bin/grep.exe"
12808     WIN_GREP="$formatted_path"
12809     PathFormat "/usr/bin/ls.exe"
12810     WIN_LS="$formatted_path"
12811     PathFormat "/usr/bin/touch.exe"
12812     WIN_TOUCH="$formatted_path"
12813 else
12814     FIND=find
12815     SORT=sort
12818 AC_SUBST(ATL_INCLUDE)
12819 AC_SUBST(ATL_LIB)
12820 AC_SUBST(FIND)
12821 AC_SUBST(SORT)
12822 AC_SUBST(WIN_GREP)
12823 AC_SUBST(WIN_LS)
12824 AC_SUBST(WIN_TOUCH)
12826 AC_SUBST(BUILD_TYPE)
12828 AC_SUBST(SOLARINC)
12830 PathFormat "$PERL"
12831 PERL="$formatted_path"
12832 AC_SUBST(PERL)
12834 if test -n "$TMPDIR"; then
12835     TEMP_DIRECTORY="$TMPDIR"
12836 else
12837     TEMP_DIRECTORY="/tmp"
12839 if test "$build_os" = "cygwin"; then
12840     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12842 AC_SUBST(TEMP_DIRECTORY)
12844 # setup the PATH for the environment
12845 if test -n "$LO_PATH_FOR_BUILD"; then
12846     LO_PATH="$LO_PATH_FOR_BUILD"
12847 else
12848     LO_PATH="$PATH"
12850     case "$host_os" in
12852     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12853         if test "$ENABLE_JAVA" != ""; then
12854             pathmunge "$JAVA_HOME/bin" "after"
12855         fi
12856         ;;
12858     cygwin*)
12859         # Win32 make needs native paths
12860         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12861             LO_PATH=`cygpath -p -m "$PATH"`
12862         fi
12863         if test "$BITNESS_OVERRIDE" = 64; then
12864             # needed for msi packaging
12865             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12866         fi
12867         # .NET 4.6 and higher don't have bin directory
12868         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12869             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12870         fi
12871         pathmunge "$ASM_HOME" "before"
12872         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12873         pathmunge "$CSC_PATH" "before"
12874         pathmunge "$MIDL_PATH" "before"
12875         pathmunge "$AL_PATH" "before"
12876         pathmunge "$MSPDB_PATH" "before"
12877         if test -n "$MSBUILD_PATH" ; then
12878             pathmunge "$MSBUILD_PATH" "before"
12879         fi
12880         if test "$BITNESS_OVERRIDE" = 64; then
12881             if test "$vcexpress" = "Express"; then
12882                 pathmunge "$COMPATH/bin/x86_amd64" "before"
12883                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12884             else
12885                 pathmunge "$COMPATH/bin/amd64" "before"
12886                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12887             fi
12888         else
12889             pathmunge "$COMPATH/bin" "before"
12890             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12891         fi
12892         if test "$ENABLE_JAVA" != ""; then
12893             if test -d "$JAVA_HOME/jre/bin/client"; then
12894                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12895             fi
12896             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12897                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12898             fi
12899             pathmunge "$JAVA_HOME/bin" "before"
12900         fi
12901         ;;
12903     solaris*)
12904         pathmunge "/usr/css/bin" "before"
12905         if test "$ENABLE_JAVA" != ""; then
12906             pathmunge "$JAVA_HOME/bin" "after"
12907         fi
12908         ;;
12909     esac
12912 AC_SUBST(LO_PATH)
12914 # Generate a configuration md5 we can use for deps
12915 if test -f config_host.mk; then
12916     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12918 if test -f config_host_lang.mk; then
12919     config_lang_md5=`$MD5SUM config_host_lang.mk | sed "s/ .*//"`
12922 AC_CONFIG_FILES([config_host.mk
12923                  config_host_lang.mk
12924                  Makefile
12925                  lo.xcent
12926                  bin/bffvalidator.sh
12927                  bin/odfvalidator.sh
12928                  bin/officeotron.sh
12929                  instsetoo_native/util/openoffice.lst
12930                  sysui/desktop/macosx/Info.plist
12931                  ios/lo.xcconfig])
12932 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12933 AC_CONFIG_HEADERS([config_host/config_clang.h])
12934 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12935 AC_CONFIG_HEADERS([config_host/config_eot.h])
12936 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12937 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12938 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12939 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12940 AC_CONFIG_HEADERS([config_host/config_features.h])
12941 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12942 AC_CONFIG_HEADERS([config_host/config_folders.h])
12943 AC_CONFIG_HEADERS([config_host/config_gio.h])
12944 AC_CONFIG_HEADERS([config_host/config_global.h])
12945 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12946 AC_CONFIG_HEADERS([config_host/config_java.h])
12947 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12948 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12949 AC_CONFIG_HEADERS([config_host/config_locales.h])
12950 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12951 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12952 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12953 AC_CONFIG_HEADERS([config_host/config_oox.h])
12954 AC_CONFIG_HEADERS([config_host/config_opengl.h])
12955 AC_CONFIG_HEADERS([config_host/config_options.h])
12956 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12957 AC_CONFIG_HEADERS([config_host/config_test.h])
12958 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12959 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12960 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12961 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12962 AC_CONFIG_HEADERS([config_host/config_version.h])
12963 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12964 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12965 AC_CONFIG_HEADERS([config_host/config_python.h])
12966 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12967 AC_OUTPUT
12969 if test "$CROSS_COMPILING" = TRUE; then
12970     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12973 # touch the config timestamp file
12974 if test ! -f config_host.mk.stamp; then
12975     echo > config_host.mk.stamp
12976 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12977     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12978 else
12979     echo > config_host.mk.stamp
12982 # touch the config lang timestamp file
12983 if test ! -f config_host_lang.mk.stamp; then
12984     echo > config_host_lang.mk.stamp
12985 elif test "$config_lang_md5" = `$MD5SUM config_host_lang.mk | sed "s/ .*//"`; then
12986     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12987 else
12988     echo > config_host_lang.mk.stamp
12992 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12994 cat << _EOS
12995 ****************************************************************************
12996 WARNING:
12997 Your make version is known to be horribly slow, and hard to debug
12998 problems with. To get a reasonably functional make please do:
13000 to install a pre-compiled binary make for Win32
13002  mkdir -p /opt/lo/bin
13003  cd /opt/lo/bin
13004  wget http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
13005  cp make-85047eb-msvc.exe make
13006  chmod +x make
13008 to install from source:
13009 place yourself in a working directory of you choice.
13011  git clone git://git.savannah.gnu.org/make.git
13013  [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"]
13014  set PATH=%PATH%;C:\Cygwin\bin
13015  [or Cygwin64, if that is what you have]
13016  cd path-to-make-repo-you-cloned-above
13017  build_w32.bat --without-guile
13019 should result in a WinRel/gnumake.exe.
13020 Copy it to the Cygwin /opt/lo/bin directory as make.exe
13022 Then re-run autogen.sh
13024 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13025 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13027 _EOS
13030 cat << _EOF
13031 ****************************************************************************
13033 To build, run:
13034 $GNUMAKE
13036 To view some help, run:
13037 $GNUMAKE help
13039 _EOF
13041 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13042     cat << _EOF
13043 After the build has finished, you can immediately run it using:
13044 _EOF
13046     if test $_os = Darwin; then
13047         echo open instdir/$PRODUCTNAME.app
13048     else
13049         echo instdir/program/soffice
13050     fi
13051     cat << _EOF
13053 If you want to run the smoketest, run:
13054 $GNUMAKE check
13056 _EOF
13059 if test -f warn; then
13060     cat warn
13061     rm warn
13064 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: