bump product version to 5.0.4.1
[LibreOffice.git] / configure.ac
blob5be7afa7e46a1c33964e5a4f3b099514fea6ab93
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argumemnt to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[5.0.4.1],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 PathFormat()
30     formatted_path="$1"
31     if test "$build_os" = "cygwin"; then
32         pf_conv_to_dos=
33         # spaces,parentheses,brackets,braces are problematic in pathname
34         # so are backslashes
35         case "$formatted_path" in
36             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
37                 pf_conv_to_dos="yes"
38             ;;
39         esac
40         if test "$pf_conv_to_dos" = "yes"; then
41             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
42                 formatted_path=`cygpath -sm "$formatted_path"`
43             else
44                 formatted_path=`cygpath -d "$formatted_path"`
45             fi
46             if test $? -ne 0;  then
47                 AC_MSG_ERROR([path conversion failed for "$1".])
48             fi
49         fi
50         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
51         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
52         if test "$fp_count_slash$fp_count_colon" != "00"; then
53             if test "$fp_count_colon" = "0"; then
54                 new_formatted_path=`realpath "$formatted_path"`
55                 if test $? -ne 0;  then
56                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
57                 else
58                     formatted_path="$new_formatted_path"
59                 fi
60             fi
61             formatted_path=`cygpath -m "$formatted_path"`
62             if test $? -ne 0;  then
63                 AC_MSG_ERROR([path conversion failed for "$1".])
64             fi
65         fi
66     fi
69 AbsolutePath()
71     # There appears to be no simple and portable method to get an absolute and
72     # canonical path, so we try creating the directory if does not exist and
73     # utilizing the shell and pwd.
74     rel="$1"
75     absolute_path=""
76     test ! -e "$rel" && mkdir -p "$rel"
77     if test -d "$rel" ; then
78         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
79         absolute_path="$(pwd)"
80         cd - > /dev/null
81     else
82         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
83     fi
86 rm -f warn
87 have_WARNINGS="no"
88 add_warning()
90     if test "$have_WARNINGS" = "no"; then
91         echo "*************************************" > warn
92         have_WARNINGS="yes"
93         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
94             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
95             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
96         else
97             COLORWARN="* WARNING :"
98         fi
99     fi
100     echo "$COLORWARN $@" >> warn
103 echo "********************************************************************"
104 echo "*"
105 echo "*   Running ${PACKAGE_NAME} build configuration."
106 echo "*"
107 echo "********************************************************************"
108 echo ""
110 dnl ===================================================================
111 dnl checks build and host OSes
112 dnl do this before argument processing to allow for platform dependent defaults
113 dnl ===================================================================
114 AC_CANONICAL_HOST
116 AC_MSG_CHECKING([for product name])
117 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
118     PRODUCTNAME=AC_PACKAGE_NAME"Dev"
119 else
120     PRODUCTNAME=AC_PACKAGE_NAME
122 AC_MSG_RESULT([$PRODUCTNAME])
123 AC_SUBST(PRODUCTNAME)
125 dnl ===================================================================
126 dnl Our version is defined by the AC_INIT() at the top of this script.
127 dnl ===================================================================
129 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
131 LIBO_VERSION_MAJOR=$1
132 LIBO_VERSION_MINOR=$2
133 LIBO_VERSION_MICRO=$3
134 LIBO_VERSION_PATCH=$4
136 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
137 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
138 # no way to encode that into an integer in general.
139 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
141 LIBO_VERSION_SUFFIX=$5
142 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
143 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
144 # they get undoubled before actually passed to sed.
145 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
146 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
147 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
148 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
150 AC_SUBST(LIBO_VERSION_MAJOR)
151 AC_SUBST(LIBO_VERSION_MINOR)
152 AC_SUBST(LIBO_VERSION_MICRO)
153 AC_SUBST(LIBO_VERSION_PATCH)
154 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
155 AC_SUBST(LIBO_VERSION_SUFFIX)
156 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
158 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
159 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
160 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
161 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
163 LIBO_THIS_YEAR=`date +%Y`
164 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
166 dnl ===================================================================
167 dnl Product version
168 dnl ===================================================================
169 AC_MSG_CHECKING([for product version])
170 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
171 AC_MSG_RESULT([$PRODUCTVERSION])
172 AC_SUBST(PRODUCTVERSION)
174 AC_PROG_EGREP
175 # AC_PROG_EGREP doesn't set GREP on all systems as well
176 AC_PATH_PROG(GREP, grep)
178 BUILDDIR=`pwd`
179 cd $srcdir
180 SRC_ROOT=`pwd`
181 cd $BUILDDIR
182 x_Cygwin=[\#]
184 dnl ===================================================================
185 dnl Search all the common names for GNU Make
186 dnl ===================================================================
187 AC_MSG_CHECKING([for GNU Make])
189 # try to use our own make if it is available and GNUMAKE was not already defined
190 if test -z "$GNUMAKE"; then
191     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
192         GNUMAKE="$LODE_HOME/opt/bin/make"
193     elif test -x "/opt/lo/bin/make"; then
194         GNUMAKE="/opt/lo/bin/make"
195     fi
198 GNUMAKE_WIN_NATIVE=
199 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
200     if test -n "$a"; then
201         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
202         if test $? -eq 0;  then
203             if test "$build_os" = "cygwin"; then
204                 if test -n "$($a -v | grep 'Built for Windows')" ; then
205                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
206                     GNUMAKE_WIN_NATIVE="TRUE"
207                 else
208                     GNUMAKE=`which $a`
209                 fi
210             else
211                 GNUMAKE=`which $a`
212             fi
213             break
214         fi
215     fi
216 done
217 AC_MSG_RESULT($GNUMAKE)
218 if test -z "$GNUMAKE"; then
219     AC_MSG_ERROR([not found. install GNU Make.])
220 else
221     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
222         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
223     fi
226 win_short_path_for_make()
228     local_short_path="$1"
229     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
230         cygpath -sm "$local_short_path"
231     else
232         cygpath -u "$(cygpath -d "$local_short_path")"
233     fi
237 if test "$build_os" = "cygwin"; then
238     PathFormat "$SRC_ROOT"
239     SRC_ROOT="$formatted_path"
240     PathFormat "$BUILDDIR"
241     BUILDDIR="$formatted_path"
242     x_Cygwin=
245 AC_SUBST(SRC_ROOT)
246 AC_SUBST(BUILDDIR)
247 AC_SUBST(x_Cygwin)
248 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
249 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
251 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
252     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
255 # need sed in os checks...
256 AC_PATH_PROGS(SED, sed)
257 if test -z "$SED"; then
258     AC_MSG_ERROR([install sed to run this script])
261 # Set the ENABLE_LTO variable
262 # ===================================================================
263 AC_MSG_CHECKING([whether to use link-time optimization])
264 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
265     ENABLE_LTO="TRUE"
266     AC_MSG_RESULT([yes])
267     AC_DEFINE(STATIC_LINKING)
268 else
269     ENABLE_LTO=""
270     AC_MSG_RESULT([no])
272 AC_SUBST(ENABLE_LTO)
274 dnl ===================================================================
275 dnl When building for Android, --with-android-ndk,
276 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
277 dnl mandatory
278 dnl ===================================================================
280 AC_ARG_WITH(android-ndk,
281     AS_HELP_STRING([--with-android-ndk],
282         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
285 AC_ARG_WITH(android-ndk-toolchain-version,
286     AS_HELP_STRING([--with-android-ndk-toolchain-version],
287         [Specify which toolchain version to use, of those present in the
288         Android NDK you are using. The default is 4.9 currently.]), ,)
290 AC_ARG_WITH(android-sdk,
291     AS_HELP_STRING([--with-android-sdk],
292         [Specify location of the Android SDK. Mandatory when building for Android,
293         or when building the Impress Remote Android app.]),
296 ANDROID_NDK_HOME=
297 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk"; then
298     with_android_ndk="$SRC_ROOT/external/android-ndk"
300 if test -n "$with_android_ndk"; then
301     ANDROID_NDK_HOME=$with_android_ndk
303     # Set up a lot of pre-canned defaults
305     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
306         AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT file in $ANDROID_NDK_HOME.])
307     fi
308     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
310     case $ANDROID_NDK_VERSION in
311     r9*|r10*)
312         ;;
313     *)
314         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r9* and r10* versions are supported])
315         ;;
316     esac
318     if test $host_cpu = arm; then
319         android_cpu=arm
320         android_platform_prefix=$android_cpu-linux-androideabi
321     elif test $host_cpu = aarch64; then
322         android_cpu=aarch64
323         android_platform_prefix=$android_cpu-linux-android
324     elif test $host_cpu = mips; then
325         android_cpu=mips
326         android_platform_prefix=$android_cpu-linux-androideabi
327     else
328         # host_cpu is something like "i386" or "i686" I guess, NDK uses
329         # "x86" in some contexts
330         android_cpu=x86
331         android_platform_prefix=$android_cpu
332     fi
334     if test -z "$with_android_ndk_toolchain_version"; then
335         # Default to gcc 4.9
336         with_android_ndk_toolchain_version=4.9
337     fi
339     case "$with_android_ndk_toolchain_version" in
340     4.6|4.7|4.8|4.9)
341         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
342         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
343         ;;
344     clang3.3|clang3.4)
345         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
346         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
347         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
348         ANDROID_USING_CLANG=true
349         ;;
350     *)
351         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
352     esac
354     if test ! -d $ANDROID_BINUTILS_DIR; then
355         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
356     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
357         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
358     fi
360     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
361     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
362     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
363     # manage to link the (app-specific) single huge .so that is built for the apps in
364     # android/experimental/* if there is debug information in a significant part of the object files.
365     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
366     # all objects have been built with debug information.)
367     toolchain_system='*'
368     case $build_os in
369     linux-gnu*)
370         ndk_build_os=linux
371         ;;
372     darwin*)
373         ndk_build_os=darwin
374         ;;
375     *)
376         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
377         ;;
378     esac
380     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
381     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
382     if test $build_cpu = x86_64; then
383         if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
384             ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
385         fi
386         if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
387             ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
388         fi
389     fi
390     ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
392     # This stays empty if there is just one version of the toolchain in the NDK
393     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
394     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
395     */bin\ */bin*)
396         # Trailing slash intentional and necessary, compare to how this is used
397         if test -n "$ANDROID_USING_CLANG"; then
398             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
399         else
400             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
401         fi
402         ;;
403     esac
405     ANDROID_API_LEVEL=15
406     if test $host_cpu = arm; then
407         android_gnu_prefix=arm-linux-androideabi
408     elif test $host_cpu = aarch64; then
409         android_gnu_prefix=aarch64-linux-android
410         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
411         ANDROID_API_LEVEL=L
412     elif test $host_cpu = mips; then
413         android_gnu_prefix=mipsel-linux-android
414     elif test $ANDROID_NDK_VERSION = r8; then
415         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
416         android_gnu_prefix=i686-android-linux
417     else
418         android_gnu_prefix=i686-linux-android
419     fi
421     ANDROID_ARCH=$android_cpu
422     if test $host_cpu = arm; then
423         ANDROID_APP_ABI=armeabi-v7a
424         if test -n "$ANDROID_USING_CLANG"; then
425             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
426             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
427             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
428         else
429             :
430         fi
431         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
432         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
433         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
434     elif test $host_cpu = aarch64; then
435         ANDROID_APP_ABI=arm64-v8a
436         ANDROID_ARCH=arm64
437     elif test $host_cpu = mips; then
438         ANDROID_APP_ABI=mips
439         ANDROIDCFLAGS=""
440     else # x86
441         ANDROID_APP_ABI=x86
442         ANDROIDCFLAGS="-march=atom"
443     fi
444     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
445     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
446     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
448     if test -n "$ANDROID_USING_CLANG"; then
449         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
450     else
451         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
452     fi
454     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
455     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
456     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
457     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
458     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
459     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
461     # When using the 4.6 or newer toolchain, use the gold linker
462     case "$with_android_ndk_toolchain_version" in
463     4.[[6789]]*|[[56789]].*|clang*)
464         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
465             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
466         fi
467         ;;
468     esac
470     if test "$ENABLE_LTO" = TRUE; then
471         # -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of
472         # $CC and $CXX when building external libraries
473         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
474     fi
476     # gdbserver can be in different locations
477     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
478         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
479     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
480         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
481     elif test $android_cpu = aarch64; then
482         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
483     else
484         AC_MSG_ERROR([Can't find gdbserver for your Android target])
485     fi
487     if test $host_cpu = arm; then
488         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"
489     elif test $host_cpu = mips; then
490         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"
491     else # x86
492         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"
493     fi
495     if test -z "$CC"; then
496         case "$with_android_ndk_toolchain_version" in
497         4.*)
498             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
499             ;;
500         clang*)
501             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
502         esac
503     fi
504     if test -z "$CXX"; then
505         case "$with_android_ndk_toolchain_version" in
506         4.*)
507             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
508             ;;
509         clang*)
510             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
511             ;;
512         esac
513     fi
515 AC_SUBST(ANDROID_NDK_GDBSERVER)
516 AC_SUBST(ANDROID_APP_ABI)
518 dnl ===================================================================
519 dnl --with-android-sdk
520 dnl ===================================================================
521 ANDROID_SDK_HOME=
522 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux"; then
523     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
525 if test -n "$with_android_sdk"; then
526     ANDROID_SDK_HOME=$with_android_sdk
527     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
529 AC_SUBST(ANDROID_SDK_HOME)
531 dnl ===================================================================
532 dnl The following is a list of supported systems.
533 dnl Sequential to keep the logic very simple
534 dnl These values may be checked and reset later.
535 dnl ===================================================================
536 #defaults unless the os test overrides this:
537 test_randr=yes
538 test_xrender=yes
539 test_cups=yes
540 test_dbus=yes
541 test_fontconfig=yes
542 test_cairo=no
544 # Default values, as such probably valid just for Linux, set
545 # differently below just for Mac OSX,but at least better than
546 # hardcoding these as we used to do. Much of this is duplicated also
547 # in solenv for old build system and for gbuild, ideally we should
548 # perhaps define stuff like this only here in configure.ac?
550 LINKFLAGSSHL="-shared"
551 PICSWITCH="-fpic"
552 DLLPOST=".so"
554 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
556 INSTROOTSUFFIX=
557 SDKDIRNAME=sdk
559 case "$host_os" in
561 solaris*)
562     test_gtk=yes
563     build_gstreamer_1_0=yes
564     build_gstreamer_0_10=yes
565     test_tde=yes
566     test_kde=yes
567     test_freetype=yes
568     _os=SunOS
570     dnl ===========================================================
571     dnl Check whether we're using Solaris 10 - SPARC or Intel.
572     dnl ===========================================================
573     AC_MSG_CHECKING([the Solaris operating system release])
574     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
575     if test "$_os_release" -lt "10"; then
576         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
577     else
578         AC_MSG_RESULT([ok ($_os_release)])
579     fi
581     dnl Check whether we're using a SPARC or i386 processor
582     AC_MSG_CHECKING([the processor type])
583     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
584         AC_MSG_RESULT([ok ($host_cpu)])
585     else
586         AC_MSG_ERROR([only SPARC and i386 processors are supported])
587     fi
588     ;;
590 linux-gnu*|k*bsd*-gnu*)
591     test_gtk=yes
592     build_gstreamer_1_0=yes
593     build_gstreamer_0_10=yes
594     test_tde=yes
595     test_kde=yes
596     test_kde4=yes
597     test_freetype=yes
598     _os=Linux
599     ;;
601 gnu)
602     test_randr=no
603     test_xrender=no
604     _os=GNU
605      ;;
607 cygwin*|interix*|mingw32*)
609     # When building on Windows normally with MSVC under Cygwin,
610     # configure thinks that the host platform (the platform the
611     # built code will run on) is Cygwin, even if it obviously is
612     # Windows, which in Autoconf terminology is called
613     # "mingw32". (Which is misleading as MinGW is the name of the
614     # tool-chain, not an operating system.)
616     # Somewhat confusing, yes. But this configure script doesn't
617     # look at $host etc that much, it mostly uses its own $_os
618     # variable, set here in this case statement.
620     # When cross-compiling to Windows from Unix, the host platform
621     # is "mingw32" (because in that case it is the MinGW
622     # tool-chain that is used).
624     test_cups=no
625     test_dbus=no
626     test_randr=no
627     test_xrender=no
628     test_freetype=no
629     test_fontconfig=no
630     _os=WINNT
632     DLLPOST=".dll"
633     LINKFLAGSNOUNDEFS=
635     # If the host OS matches "mingw32*", that means we are using the
636     # MinGW cross-compiler, because we don't see the point in building
637     # LibreOffice using MinGW on Windows. If you want to build on
638     # Windows, use MSVC. If you want to use MinGW, surely you want to
639     # cross-compile (from Linux or some other Unix).
641     case "$host_os" in
642     mingw32*)
643         WITH_MINGW=yes
644         if test -z "$CC"; then
645             CC="$host_cpu-$host_vendor-$host_os-gcc"
646         fi
647         if test -z "$CXX"; then
648             CXX="$host_cpu-$host_vendor-$host_os-g++"
649         fi
650         ;;
651     esac
652     ;;
654 darwin*) # Mac OS X or iOS
655     test_gtk=yes
656     test_randr=no
657     test_xrender=no
658     test_freetype=no
659     test_fontconfig=no
660     test_dbus=no
661     if test "$host_cpu" = "arm"; then
662         _os=iOS
663         test_gtk=no
664         test_cups=no
665     else
666         _os=Darwin
667         INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
668         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
669     fi
670     enable_systray=no
671     # See comment above the case "$host_os"
672     LINKFLAGSSHL="-dynamiclib -single_module"
674     # -fPIC is default
675     PICSWITCH=""
677     DLLPOST=".dylib"
679     # -undefined error is the default
680     LINKFLAGSNOUNDEFS=""
683 freebsd*)
684     test_gtk=yes
685     build_gstreamer_1_0=yes
686     build_gstreamer_0_10=yes
687     test_tde=yes
688     test_kde=yes
689     test_kde4=yes
690     test_freetype=yes
691     AC_MSG_CHECKING([the FreeBSD operating system release])
692     if test -n "$with_os_version"; then
693         OSVERSION="$with_os_version"
694     else
695         OSVERSION=`/sbin/sysctl -n kern.osreldate`
696     fi
697     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
698     AC_MSG_CHECKING([which thread library to use])
699     if test "$OSVERSION" -lt "500016"; then
700         PTHREAD_CFLAGS="-D_THREAD_SAFE"
701         PTHREAD_LIBS="-pthread"
702     elif test "$OSVERSION" -lt "502102"; then
703         PTHREAD_CFLAGS="-D_THREAD_SAFE"
704         PTHREAD_LIBS="-lc_r"
705     else
706         PTHREAD_CFLAGS=""
707         PTHREAD_LIBS="-pthread"
708     fi
709     AC_MSG_RESULT([$PTHREAD_LIBS])
710     _os=FreeBSD
711     ;;
713 *netbsd*)
714     test_gtk=yes
715     build_gstreamer_1_0=yes
716     build_gstreamer_0_10=yes
717     test_tde=no
718     test_kde=no
719     test_kde4=yes
720     test_freetype=yes
721     PTHREAD_LIBS="-pthread -lpthread"
722     _os=NetBSD
723     ;;
725 aix*)
726     test_randr=no
727     test_freetype=yes
728     PTHREAD_LIBS=-pthread
729     _os=AIX
730     ;;
732 openbsd*)
733     test_gtk=yes
734     test_tde=yes
735     test_kde=yes
736     test_freetype=yes
737     PTHREAD_CFLAGS="-D_THREAD_SAFE"
738     PTHREAD_LIBS="-pthread"
739     _os=OpenBSD
740     ;;
742 dragonfly*)
743     test_gtk=yes
744     build_gstreamer_1_0=yes
745     build_gstreamer_0_10=yes
746     test_tde=yes
747     test_kde=yes
748     test_kde4=yes
749     test_freetype=yes
750     PTHREAD_LIBS="-pthread"
751     _os=DragonFly
752     ;;
754 linux-android*)
755     build_gstreamer_1_0=no
756     build_gstreamer_0_10=no
757     enable_lotuswordpro=no
758     enable_mpl_subset=yes
759     enable_coinmp=yes
760     enable_lpsolve=no
761     enable_report_builder=no
762     with_theme="tango"
763     test_cups=no
764     test_dbus=no
765     test_fontconfig=no
766     test_freetype=no
767     test_gtk=no
768     test_tde=no
769     test_kde=no
770     test_kde4=no
771     test_randr=no
772     test_xrender=no
773     _os=Android
775     if test -z "$with_android_ndk"; then
776         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
777     fi
779     if test -z "$with_android_ndk_toolchain_version"; then
780         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
781     fi
783     # Verify that the NDK and SDK options are proper
784     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
785         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
786     fi
788     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
789     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
790     ;;
793     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
794     ;;
795 esac
797 if echo "$host_os" | grep -q linux-android ; then
798     if test -z "$with_android_sdk"; then
799         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
800     fi
802     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
803         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
804     fi
807 if test "$_os" = "AIX"; then
808     AC_PATH_PROG(GAWK, gawk)
809     if test -z "$GAWK"; then
810         AC_MSG_ERROR([gawk not found in \$PATH])
811     fi
814 AC_SUBST(SDKDIRNAME)
816 AC_SUBST(WITH_MINGW)
817 AC_SUBST(PTHREAD_CFLAGS)
818 AC_SUBST(PTHREAD_LIBS)
820 ###############################################################################
821 # Extensions switches --enable/--disable
822 ###############################################################################
823 # By default these should be enabled unless having extra dependencies.
824 # If there is extra dependency over configure options then the enable should
825 # be automagic based on whether the requiring feature is enabled or not.
826 # All this options change anything only with --enable-extension-integration.
828 # The name of this option and its help string makes it sound as if
829 # extensions are built anyway, just not integrated in the installer,
830 # if you use --disable-extension-integration. Is that really the
831 # case?
833 AC_ARG_ENABLE(extension-integration,
834     AS_HELP_STRING([--disable-extension-integration],
835         [Disable integration of the built extensions in the installer of the
836          product. Use this switch to disable the integration.])
839 AC_ARG_ENABLE(export,
840     AS_HELP_STRING([--disable-export],
841         [Disable (some) code for document export. Useful when building viewer-only apps that lack
842          save/export functionality, to avoid having an excessive amount of code and data used
843          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
846 AC_ARG_ENABLE(avmedia,
847     AS_HELP_STRING([--disable-avmedia],
848         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
851 AC_ARG_ENABLE(database-connectivity,
852     AS_HELP_STRING([--disable-database-connectivity],
853         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
856 # This doesn't mean not building (or "integrating") extensions
857 # (although it probably should; i.e. it should imply
858 # --disable-extension-integration I guess), it means not supporting
859 # any extension mechanism at all
860 AC_ARG_ENABLE(extensions,
861     AS_HELP_STRING([--disable-extensions],
862         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
865 AC_ARG_ENABLE(scripting,
866     AS_HELP_STRING([--disable-scripting],
867         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
870 # This is mainly for Android and iOS, but could potentially be used in some
871 # special case otherwise, too, so factored out as a separate setting
873 AC_ARG_ENABLE(dynamic-loading,
874     AS_HELP_STRING([--disable-dynamic-loading],
875         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
878 AC_ARG_ENABLE(ext-mariadb-connector,
879     AS_HELP_STRING([--enable-ext-mariadb-connector],
880         [Enable the build of the MariaDB/MySQL Connector extension.])
883 AC_ARG_ENABLE(report-builder,
884     AS_HELP_STRING([--disable-report-builder],
885         [Disable the Report Builder.])
888 AC_ARG_ENABLE(ext-wiki-publisher,
889     AS_HELP_STRING([--enable-ext-wiki-publisher],
890         [Enable the Wiki Publisher extension.])
893 AC_ARG_ENABLE(lpsolve,
894     AS_HELP_STRING([--disable-lpsolve],
895         [Disable compilation of the lp solve solver ])
897 AC_ARG_ENABLE(coinmp,
898     AS_HELP_STRING([--disable-coinmp],
899         [Disable compilation of the CoinMP solver ])
902 AC_ARG_ENABLE(pdfimport,
903     AS_HELP_STRING([--disable-pdfimport],
904         [Disable building the PDF import feature.])
907 ###############################################################################
909 dnl ---------- *** ----------
911 AC_ARG_ENABLE([hardlink-deliver],
912     AS_HELP_STRING([--enable-hardlink-deliver],
913         [Put files into deliver folder as hardlinks instead of copying them
914         over. Saves space and speeds up build.])
917 AC_ARG_ENABLE(mergelibs,
918     AS_HELP_STRING([--enable-mergelibs],
919         [Enables linking of big, merged, library. Experimental feature, tested
920         only for Linux at some stage in history, but possibly does not work even
921         for Linux any more. This will link a core set of libraries into libmerged.])
924 AC_ARG_ENABLE(graphite,
925     AS_HELP_STRING([--enable-graphite],
926         [Enables the compilation of Graphite smart font rendering.])
929 AC_ARG_ENABLE(orcus,
930     AS_HELP_STRING([--enable-orcus],
931         [Enables orcus for extra file import filters for Calc.])
934 AC_ARG_ENABLE(fetch-external,
935     AS_HELP_STRING([--disable-fetch-external],
936         [Disables fetching external tarballs from web sources.])
939 AC_ARG_ENABLE(lockdown,
940     AS_HELP_STRING([--disable-lockdown],
941         [Disables the gconf integration work in LibreOffice.]),
944 AC_ARG_ENABLE(pch,
945     AS_HELP_STRING([--enable-pch],
946         [Enables precompiled header support for C++.])
949 AC_ARG_ENABLE(win-mozab-driver,
950     AS_HELP_STRING([--enable-win-mozab-driver],
951         [LibreOffice includes a driver to connect to Mozilla
952          address books under Windows, to build with this version, use this option.])
955 AC_ARG_ENABLE(epm,
956     AS_HELP_STRING([--enable-epm],
957         [LibreOffice includes self-packaging code, that requires epm, however epm is
958          useless for large scale package building.])
961 AC_ARG_ENABLE(odk,
962     AS_HELP_STRING([--disable-odk],
963         [LibreOffice includes an ODK, office development kit which some packagers may
964          wish to build without.])
967 AC_ARG_ENABLE(mpl-subset,
968     AS_HELP_STRING([--enable-mpl-subset],
969         [Don't compile any pieces which are not MPL or more liberally licensed])
972 AC_ARG_ENABLE(evolution2,
973     AS_HELP_STRING([--enable-evolution2],
974         [Allows the built-in evolution 2 addressbook connectivity build to be
975          enabled.])
978 AC_ARG_ENABLE(directx,
979     AS_HELP_STRING([--disable-directx],
980         [Remove DirectX implementation for the new XCanvas interface.
981          The DirectX support requires more stuff installed on Windows to
982          compile. (DirectX SDK, GDI+ libs)])
985 AC_ARG_ENABLE(activex,
986     AS_HELP_STRING([--disable-activex],
987         [Disable the use of ActiveX for a Windows build.
988         This switch is mandatory when using an Express edition of Visual Studio.])
991 AC_ARG_ENABLE(atl,
992     AS_HELP_STRING([--disable-atl],
993         [Disable the use of ATL for a Windows build.])
994     [
995         This switch is mandatory when using an Express edition of Visual Studio.
996     ],
999 AC_ARG_ENABLE(avahi,
1000     AS_HELP_STRING([--enable-avahi],
1001         [Determines whether to use Avahi to advertise Impress to remote controls.]),
1004 AC_ARG_ENABLE(werror,
1005     AS_HELP_STRING([--enable-werror],
1006         [Turn warnings to errors. (Has no effect in modules where the treating
1007          of warnings as errors is disabled explicitly.)]),
1010 AC_ARG_ENABLE(assert-always-abort,
1011     AS_HELP_STRING([--enable-assert-always-abort],
1012         [make assert() abort even in release code.]),
1015 AC_ARG_ENABLE(dbgutil,
1016     AS_HELP_STRING([--enable-dbgutil],
1017         [Provide debugging support from --enable-debug and include additional debugging
1018          utilities such as object counting or more expensive checks.
1019          This is the recommended option for developers.
1020          Note that this makes the build ABI incompatible, it is not possible to mix object
1021          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1023 AC_ARG_ENABLE(debug,
1024     AS_HELP_STRING([--enable-debug],
1025         [Include debugging information, disable compiler optimization and inlining plus
1026          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1028 AC_ARG_ENABLE(sal-log,
1029     AS_HELP_STRING([--enable-sal-log],
1030         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1032 AC_ARG_ENABLE(selective-debuginfo,
1033     AS_HELP_STRING([--enable-selective-debuginfo],
1034         [If --enable-debug or --enable-dbgutil is used, build debugging information
1035          (-g compiler flag) only for the specified gbuild build targets
1036          (where all means everything, - prepended means not to enable, / appended means
1037          everything in the directory; there is no ordering, more specific overrides
1038          more general, and disabling takes precedence).
1039          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1041 AC_ARG_ENABLE(symbols,
1042     AS_HELP_STRING([--enable-symbols],
1043         [Include debugging symbols in output while preserve optimization.
1044          This enables -g compiler flag for GCC or equivalent,
1045          without changing anything else compared to productive code.]))
1047 AC_ARG_ENABLE(runtime-optimizations,
1048     AS_HELP_STRING([--disable-runtime-optimizations],
1049         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1050          JVM JIT) that are known to interact badly with certain dynamic analysis
1051          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1052          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1053          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1055 AC_ARG_ENABLE(compiler-plugins,
1056     AS_HELP_STRING([--enable-compiler-plugins],
1057         [Enable compiler plugins that will perform additional checks during
1058          building. Enabled automatically by --enable-dbgutil.]))
1060 AC_ARG_ENABLE(ooenv,
1061     AS_HELP_STRING([--disable-ooenv],
1062         [Disable ooenv for the instdir installation.]))
1064 AC_ARG_ENABLE(lto,
1065     AS_HELP_STRING([--enable-lto],
1066         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1067          longer but libraries and executables are optimized for speed. (For GCC, best to use GCC 4.6
1068          or later and 'gold' linker. Works fine (and is turned on automatically in an optimising
1069          build) for MSVC, otherwise experimental work in progress that shouldn't be used unless you
1070          are working on it.)]))
1072 AC_ARG_ENABLE(crashdump,
1073     AS_HELP_STRING([--enable-crashdump],
1074         [Enable the crashdump feature.]))
1076 AC_ARG_ENABLE(python,
1077     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1078         [Enables or disables Python support at run-time and build-time.
1079          Also specifies what Python to use. 'auto' is the default.
1080          'fully-internal' even forces the internal version for uses of Python
1081          during the build.]))
1083 AC_ARG_ENABLE(gtk,
1084     AS_HELP_STRING([--disable-gtk],
1085         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1086 ,enable_gtk=yes)
1088 AC_ARG_ENABLE(gtk3,
1089     AS_HELP_STRING([--enable-gtk3],
1090         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1091          This is experimental and may not work.]),
1092 ,enable_gtk3=no)
1094 AC_ARG_ENABLE(systray,
1095     AS_HELP_STRING([--disable-systray],
1096         [Determines whether to build the systray quickstarter.]),
1097 ,enable_systray=yes)
1099 AC_ARG_ENABLE(split-app-modules,
1100     AS_HELP_STRING([--enable-split-app-modules],
1101         [Split file lists for app modules, e.g. base, calc.
1102          Has effect only with make distro-pack-install]),
1105 AC_ARG_ENABLE(split-opt-features,
1106     AS_HELP_STRING([--enable-split-opt-features],
1107         [Split file lists for some optional features, .e.g. pyuno, testtool.
1108          Has effect only with make distro-pack-install]),
1111 AC_ARG_ENABLE(cairo-canvas,
1112 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
1113                           platforms where Cairo is available.
1116 AC_ARG_ENABLE(dbus,
1117     AS_HELP_STRING([--disable-dbus],
1118         [Determines whether to enable features that depend on dbus.
1119          e.g. Presentation mode screensaver control, bluetooth presentation control]),
1120 ,enable_dbus=yes)
1122 AC_ARG_ENABLE(packagekit,
1123     AS_HELP_STRING([--enable-packagekit],
1124         [Determines whether to enable features using packagekit.
1125          Right now that is auto font install]),
1128 AC_ARG_ENABLE(sdremote,
1129     AS_HELP_STRING([--disable-sdremote],
1130         [Determines whether to enable Impress remote control (i.e. the server component).]),
1131 ,enable_sdremote=yes)
1133 AC_ARG_ENABLE(sdremote-bluetooth,
1134     AS_HELP_STRING([--disable-sdremote-bluetooth],
1135         [Determines whether to build sdremote with bluetooth support.
1136          Requires dbus on Linux.]))
1138 AC_ARG_ENABLE(gconf,
1139     AS_HELP_STRING([--disable-gconf],
1140         [Determines whether to use the GConf support.]),
1141 ,enable_gconf=yes)
1143 AC_ARG_ENABLE(gnome-vfs,
1144     AS_HELP_STRING([--enable-gnome-vfs],
1145         [Determines whether to use the Gnome Virtual Filing System on platforms
1146          where that VFS is available.]),
1147 ,enable_gnome_vfs=no)
1149 AC_ARG_ENABLE(gio,
1150     AS_HELP_STRING([--disable-gio],
1151         [Determines whether to use the GIO support.]),
1152 ,enable_gio=yes)
1154 AC_ARG_ENABLE(telepathy,
1155     AS_HELP_STRING([--enable-telepathy],
1156         [Determines whether to enable Telepathy for collaboration.]),
1157 ,enable_telepathy=no)
1159 AC_ARG_ENABLE(tde,
1160     AS_HELP_STRING([--enable-tde],
1161         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1162          TDE are available.]),
1165 AC_ARG_ENABLE(tdeab,
1166     AS_HELP_STRING([--disable-tdeab],
1167         [Disable the TDE address book support.]),
1169     if test "$enable_tde" = "yes"; then
1170         enable_tdeab=yes
1171     fi
1174 AC_ARG_ENABLE(kde,
1175     AS_HELP_STRING([--enable-kde],
1176         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
1177          KDE3 are available.]),
1180 AC_ARG_ENABLE(kdeab,
1181     AS_HELP_STRING([--disable-kdeab],
1182         [Disable the KDE3 address book support.]),
1184     if test "$enable_kde" = "yes"; then
1185         enable_kdeab=yes
1186     fi
1189 AC_ARG_ENABLE(kde4,
1190     AS_HELP_STRING([--enable-kde4],
1191         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1192          KDE4 are available. May be used with --enable-kde if you want to support
1193          both KDE3 and KDE4.]),
1196 AC_ARG_ENABLE(randr,
1197     AS_HELP_STRING([--disable-randr],
1198         [Disable RandR support in the vcl project.]),
1199 ,enable_randr=yes)
1201 AC_ARG_ENABLE(randr-link,
1202     AS_HELP_STRING([--disable-randr-link],
1203         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1204 ,enable_randr_link=yes)
1206 AC_ARG_ENABLE(gstreamer-1-0,
1207     AS_HELP_STRING([--disable-gstreamer-1-0],
1208         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1209 ,enable_gstreamer_1_0=yes)
1211 AC_ARG_ENABLE(gstreamer-0-10,
1212     AS_HELP_STRING([--enable-gstreamer-0-10],
1213         [Enable building with the gstreamer 0.10 avmedia backend.]),
1214 ,enable_gstreamer_0_10=no)
1216 AC_ARG_ENABLE(vlc,
1217     AS_HELP_STRING([--enable-vlc],
1218         [Enable building with the (experimental) VLC avmedia backend.]),
1219 ,enable_vlc=no)
1221 AC_ARG_ENABLE(neon,
1222     AS_HELP_STRING([--disable-neon],
1223         [Disable neon and the compilation of webdav binding.]),
1226 AC_ARG_ENABLE([eot],
1227     [AS_HELP_STRING([--enable-eot],
1228         [Enable support for Embedded OpenType fonts.])],
1229 , [enable_eot=no])
1231 AC_ARG_ENABLE(cve-tests,
1232     AS_HELP_STRING([--disable-cve-tests],
1233         [Prevent CVE tests to be executed]),
1236 AC_ARG_ENABLE(chart-tests,
1237     AS_HELP_STRING([--enable-chart-tests],
1238         [Executes chart XShape tests. In a perfect world these tests would be
1239          stable and everyone could run them, in reality it is best to run them
1240          only on a few machines that are known to work and maintained by people
1241          who can judge if a test failure is a regression or not.]),
1244 AC_ARG_ENABLE(build-unowinreg,
1245     AS_HELP_STRING([--enable-build-unowinreg],
1246         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1247          compiler is needed on Linux.])
1248     [
1249                           Usage:     --enable-build-unowinreg
1250     ],
1253 AC_ARG_ENABLE(verbose,
1254     AS_HELP_STRING([--enable-verbose],
1255         [Increase build verbosity.])[
1256   --disable-verbose       Decrease build verbosity.],
1259 AC_ARG_ENABLE(dependency-tracking,
1260     AS_HELP_STRING([--enable-dependency-tracking],
1261         [Do not reject slow dependency extractors.])[
1262   --disable-dependency-tracking
1263                           Disables generation of dependency information.
1264                           Speed up one-time builds.],
1267 AC_ARG_ENABLE(icecream,
1268     AS_HELP_STRING([--enable-icecream],
1269         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1270          It defaults to /opt/icecream for the location of the icecream gcc/g++
1271          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1274 AC_ARG_ENABLE(cups,
1275     AS_HELP_STRING([--disable-cups],
1276         [Do not build cups support.])
1279 AC_ARG_ENABLE(ccache,
1280     AS_HELP_STRING([--disable-ccache],
1281         [Do not try to use ccache automatically.
1282          By default, we will try to detect if ccache is available; in that case if
1283          CC/CXX are not yet set, and --enable-icecream is not given, we
1284          attempt to use ccache. --disable-ccache disables ccache completely.
1288 AC_ARG_ENABLE(64-bit,
1289     AS_HELP_STRING([--enable-64-bit],
1290         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1291          At the moment meaningful only for iOS and Windows. On Windows this option is
1292          experimental and possibly quite broken, and you should use it only if you are
1293          hacking on 64-bitness support.]), ,)
1295 AC_ARG_ENABLE(extra-gallery,
1296     AS_HELP_STRING([--enable-extra-gallery],
1297         [Add extra gallery content.]),
1300 AC_ARG_ENABLE(extra-template,
1301     AS_HELP_STRING([--enable-extra-template],
1302         [Add extra template content.]),
1305 AC_ARG_ENABLE(extra-sample,
1306     AS_HELP_STRING([--enable-extra-sample],
1307         [Add extra sample content.]),
1310 AC_ARG_ENABLE(extra-font,
1311     AS_HELP_STRING([--enable-extra-font],
1312         [Add extra font content.]),
1315 AC_ARG_ENABLE(online-update,
1316     AS_HELP_STRING([--enable-online-update],
1317         [Enable the online update service that will check for new versions of
1318          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.]),
1321 AC_ARG_ENABLE(extension-update,
1322     AS_HELP_STRING([--disable-extension-update],
1323         [Disable possibility to update installed extensions.]),
1326 AC_ARG_ENABLE(release-build,
1327     AS_HELP_STRING([--enable-release-build],
1328         [Enable release build.
1329          See http://wiki.documentfoundation.org/DevBuild]),
1332 AC_ARG_ENABLE(windows-build-signing,
1333     AS_HELP_STRING([--enable-windows-build-signing],
1334         [Enable signing of windows binaries (*.exe, *.dll)]),
1337 AC_ARG_ENABLE(silent-msi,
1338     AS_HELP_STRING([--enable-silent-msi],
1339         [Enable MSI with LIMITUI=1 (silent install).]),
1342 AC_ARG_ENABLE(macosx-code-signing,
1343     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1344         [Sign executables, dylibs, frameworks and the app bundle. If you
1345          don't provide an identity the first suitable certificate
1346          in your keychain is used.]),
1349 AC_ARG_ENABLE(macosx-package-signing,
1350     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1351         [Create a .pkg suitable for uploading to the Mac App Store and sign
1352          it. If you don't provide an identity the first suitable certificate
1353          in your keychain is used.]),
1356 AC_ARG_ENABLE(macosx-sandbox,
1357     AS_HELP_STRING([--enable-macosx-sandbox],
1358         [Make the app bundle run in a sandbox. Requires code signing.
1359          Is required by apps distributed in the Mac App Store, and implies
1360          adherence to App Store rules.]),
1363 AC_ARG_WITH(macosx-bundle-identifier,
1364     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1365         [Define the OS X bundle identifier. Default is the somewhat weird
1366          org.libreoffice.script ("script", huh?).]),
1367 ,with_macosx_bundle_identifier=org.libreoffice.script)
1369 AC_ARG_WITH(macosx-app-name,
1370     AS_HELP_STRING([--with-macosx-app-name='My Own Office Suite'],
1371         [Define the OS X app name. Default is AC_PACKAGE_NAME.]),
1372 ,with_macosx_app_name=$PRODUCTNAME)
1374 AC_ARG_ENABLE(ios-simulator,
1375     AS_HELP_STRING([--enable-ios-simulator],
1376         [Build for the iOS Simulator, not iOS device.]),
1379 AC_ARG_ENABLE(readonly-installset,
1380     AS_HELP_STRING([--enable-readonly-installset],
1381         [Prevents any attempts by LibreOffice to write into its installation. That means
1382          at least that no "system-wide" extensions can be added. Experimental work in
1383          progress.]),
1386 AC_ARG_ENABLE(postgresql-sdbc,
1387     AS_HELP_STRING([--disable-postgresql-sdbc],
1388         [Disable the build of the PostgreSQL-SDBC driver.])
1391 AC_ARG_ENABLE(lotuswordpro,
1392     AS_HELP_STRING([--disable-lotuswordpro],
1393         [Disable the build of the Lotus Word Pro filter.]),
1394 ,enable_lotuswordpro=yes)
1396 AC_ARG_ENABLE(firebird-sdbc,
1397     AS_HELP_STRING([--disable-firebird-sdbc],
1398         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1399 ,enable_firebird_sdbc=yes)
1401 AC_ARG_ENABLE(winegcc,
1402     AS_HELP_STRING([--enable-winegcc],
1403         [Enable use of winegcc during the build, in order to create msi* tools
1404          needed for MinGW cross-compilation.]),
1407 AC_ARG_ENABLE(liblangtag,
1408     AS_HELP_STRING([--disable-liblangtag],
1409         [Disable use of liblangtag, and instead use an own simple
1410          implementation.]),
1413 AC_ARG_ENABLE(bogus-pkg-config,
1414     AS_HELP_STRING([--enable-bogus-pkg-config],
1415         [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.]),
1418 AC_ARG_ENABLE(openssl,
1419     AS_HELP_STRING([--disable-openssl],
1420         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1421          components will either use GNUTLS or NSS. Work in progress,
1422          use only if you are hacking on it.]),
1423 ,enable_openssl=yes)
1425 AC_ARG_ENABLE(library-bin-tar,
1426     AS_HELP_STRING([--enable-library-bin-tar],
1427         [Enable the building and reused of tarball of binary build for some 'external' libraries
1428         Some libraries can save their build result in a tarball
1429         stored in TARFILE_LOCATION. that binary tarball is
1430         uniquely identified by the source tarbal,
1431         the content of the config_host.mk file and the content
1432         of the top-level directory in core for that library
1433         If this option is enabled, then if such a tarfile exist, it will be untarred
1434         instead of the source tarfile, and the build step will be skipped for that
1435         library.
1436         If a proper tarfile does not exist, then the normal source-based
1437         build is done for that library and a proper binary tarfile is created
1438         for the next time.]),
1441 AC_ARG_ENABLE(gltf,
1442     AS_HELP_STRING([--disable-gltf],
1443         [Determines whether to build libraries related to glTF 3D model rendering.]))
1445 AC_ARG_ENABLE(collada,
1446     AS_HELP_STRING([--disable-collada],
1447         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1449 dnl ===================================================================
1450 dnl Optional Packages (--with/without-)
1451 dnl ===================================================================
1453 AC_ARG_WITH(gnu-patch,
1454     AS_HELP_STRING([--with-gnu-patch],
1455         [Specify location of GNU patch on Solaris or FreeBSD.]),
1458 AC_ARG_WITH(build-platform-configure-options,
1459     AS_HELP_STRING([--with-build-platform-configure-options],
1460         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1463 AC_ARG_WITH(gnu-cp,
1464     AS_HELP_STRING([--with-gnu-cp],
1465         [Specify location of GNU cp on Solaris or FreeBSD.]),
1468 AC_ARG_WITH(external-tar,
1469     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1470         [Specify an absolute path of where to find (and store) tarfiles.]),
1471     TARFILE_LOCATION=$withval ,
1474 AC_ARG_WITH(referenced-git,
1475     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1476         [Specify another checkout directory to reference. This makes use of
1477                  git submodule update --reference, and saves a lot of diskspace
1478                  when having multiple trees side-by-side.]),
1479     GIT_REFERENCE_SRC=$withval ,
1482 AC_ARG_WITH(linked-git,
1483     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1484         [Specify a directory where the repositories of submodules are located.
1485          This uses a method similar to git-new-workdir to get submodules.]),
1486     GIT_LINK_SRC=$withval ,
1489 AC_ARG_WITH(galleries,
1490     AS_HELP_STRING([--with-galleries],
1491         [Specify how galleries should be built. It is possible either to
1492          build these internally from source ("build"),
1493          or to disable them ("no")]),
1496 AC_ARG_WITH(theme,
1497     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1498         [Choose which themes to include. By default those themes with an '*' are included.
1499          Possible choices: *breeze, crystal, *galaxy, *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1502 AC_ARG_WITH(helppack-integration,
1504   --without-helppack-integration      It will not integrate the helppacks to the installer
1505                           of the product.
1506                           Please use this switch to use the online help or separate help packages.],
1509 AC_ARG_WITH(fonts,
1510     AS_HELP_STRING([--without-fonts],
1511         [LibreOffice includes some third-party fonts to provide a reliable basis for
1512          help content, templates, samples, etc. When these fonts are already
1513          known to be available on the system then you should use this option.]),
1516 AC_ARG_WITH(epm,
1517     AS_HELP_STRING([--with-epm],
1518         [Decides which epm to use. Default is to use the one from the system if
1519          one is built. When either this is not there or you say =internal epm
1520          will be built.]),
1523 AC_ARG_WITH(package-format,
1524     AS_HELP_STRING([--with-package-format],
1525         [Specify package format(s) for LibreOffice installation sets. The
1526          implicit --without-package-format leads to no installation sets being
1527          generated. Possible values: aix, archive, bsd, deb, dmg,
1528          installed, msi, pkg, and rpm.
1529          Example: --with-package-format='deb rpm']),
1532 AC_ARG_WITH(tls,
1533     AS_HELP_STRING([--with-tls],
1534         [Decides which TLS/SSL and cryptographic implementations to use for
1535          LibreOffice's code. Notice that this doesn't apply for depending
1536          libraries like "neon", for example. Default is to use OpenSSL
1537          although NSS is also possible. Notice that selecting NSS restricts
1538          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1539          restrict by now the usage of NSS in LO's code. Possible values:
1540          openssl, nss. Example: --with-tls="nss"]),
1543 AC_ARG_WITH(system-libs,
1544     AS_HELP_STRING([--with-system-libs],
1545         [Use libraries already on system -- enables all --with-system-* flags.]),
1548 AC_ARG_WITH(system-headers,
1549     AS_HELP_STRING([--with-system-headers],
1550         [Use headers already on system -- enables all --with-system-* flags for
1551          external packages whose headers are the only entities used i.e.
1552          boost/vigra/odbc/sane-header(s).]),,
1553     [with_system_headers="$with_system_libs"])
1555 AC_ARG_WITH(system-jars,
1556     AS_HELP_STRING([--without-system-jars],
1557         [When building with --with-system-libs, also the needed jars are expected
1558          on the system. Use this to disable that]),,
1559     [with_system_jars="$with_system_libs"])
1561 AC_ARG_WITH(system-cairo,
1562     AS_HELP_STRING([--with-system-cairo],
1563         [Use cairo libraries already on system.  Happens automatically for
1564          (implicit) --enable-gtk and for --enable-gtk3.]))
1566 AC_ARG_WITH(myspell-dicts,
1567     AS_HELP_STRING([--with-myspell-dicts],
1568         [Adds myspell dictionaries to the LibreOffice installation set]),
1571 AC_ARG_WITH(system-dicts,
1572     AS_HELP_STRING([--without-system-dicts],
1573         [Do not use dictionaries from system paths.]),
1576 AC_ARG_WITH(external-dict-dir,
1577     AS_HELP_STRING([--with-external-dict-dir],
1578         [Specify external dictionary dir.]),
1581 AC_ARG_WITH(external-hyph-dir,
1582     AS_HELP_STRING([--with-external-hyph-dir],
1583         [Specify external hyphenation pattern dir.]),
1586 AC_ARG_WITH(external-thes-dir,
1587     AS_HELP_STRING([--with-external-thes-dir],
1588         [Specify external thesaurus dir.]),
1591 AC_ARG_WITH(system-zlib,
1592     AS_HELP_STRING([--with-system-zlib],
1593         [Use zlib already on system.]),,
1594     [with_system_zlib=auto])
1596 AC_ARG_WITH(system-jpeg,
1597     AS_HELP_STRING([--with-system-jpeg],
1598         [Use jpeg already on system.]),,
1599     [with_system_jpeg="$with_system_libs"])
1601 AC_ARG_WITH(system-libgltf,
1602     AS_HELP_STRING([--with-system-libgltf],
1603         [Use libgltf already on system.]),,
1604     [with_system_libgltf="$with_system_libs"])
1606 AC_ARG_WITH(system-clucene,
1607     AS_HELP_STRING([--with-system-clucene],
1608         [Use clucene already on system.]),,
1609     [with_system_clucene="$with_system_libs"])
1611 AC_ARG_WITH(system-expat,
1612     AS_HELP_STRING([--with-system-expat],
1613         [Use expat already on system.]),,
1614     [with_system_expat="$with_system_libs"])
1616 AC_ARG_WITH(system-libxml,
1617     AS_HELP_STRING([--with-system-libxml],
1618         [Use libxml/libxslt already on system.]),,
1619     [with_system_libxml=auto])
1621 AC_ARG_WITH(system-icu,
1622     AS_HELP_STRING([--with-system-icu],
1623         [Use icu already on system.]),,
1624     [with_system_icu="$with_system_libs"])
1626 AC_ARG_WITH(system-ucpp,
1627     AS_HELP_STRING([--with-system-ucpp],
1628         [Use ucpp already on system.]),,
1629     [])
1631 AC_ARG_WITH(system-opencollada,
1632     AS_HELP_STRING([--with-system-opencollada],
1633         [Use openCOLLADA already on system.]),,
1634     [with_system_opencollada=no])
1636 AC_ARG_WITH(system-collada2gltf,
1637     AS_HELP_STRING([--with-system-collada2gltf],
1638         [Use collada2gltf already on system.]),,
1639     [with_system_collada2gltf=no])
1641 AC_ARG_WITH(system-openldap,
1642     AS_HELP_STRING([--with-system-openldap],
1643         [Use the OpenLDAP LDAP SDK already on system.]),,
1644     [with_system_openldap="$with_system_libs"])
1646 AC_ARG_WITH(system-poppler,
1647     AS_HELP_STRING([--with-system-poppler],
1648         [Use system poppler (only needed for PDF import).]),,
1649     [with_system_poppler="$with_system_libs"])
1651 AC_ARG_WITH(system-apache-commons,
1652     AS_HELP_STRING([--with-system-apache-commons],
1653         [Use Apache commons libraries already on system.]),,
1654     [with_system_apache_commons="$with_system_jars"])
1656 AC_ARG_WITH(system-mariadb,
1657     AS_HELP_STRING([--with-system-mariadb],
1658         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1659          extension.]),,
1660     [with_system_mariadb="$with_system_libs"])
1662 AC_ARG_ENABLE(bundle-mariadb,
1663     AS_HELP_STRING([--enable-bundle-mariadb],
1664         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1667 AC_ARG_WITH(system-mysql-cppconn,
1668     AS_HELP_STRING([--with-system-mysql-cppconn],
1669         [Use MySQL C++ Connector libraries already on system.]),,
1670     [with_system_mysql_cppconn="$with_system_libs"])
1672 AC_ARG_WITH(system-postgresql,
1673     AS_HELP_STRING([--with-system-postgresql],
1674         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1675          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1676     [with_system_postgresql="$with_system_libs"])
1678 AC_ARG_WITH(libpq-path,
1679     AS_HELP_STRING([--with-libpq-path],
1680         [Use this PostgreSQL C interface (libpq) installation for building
1681          the PostgreSQL-SDBC extension.])
1682     [
1683                           Usage:     --with-libpq-path=<absolute path to
1684                                                   your libpq installation>
1685     ],
1688 AC_ARG_WITH(system-firebird,
1689     AS_HELP_STRING([--with-system-firebird],
1690         [Use Firebird libraries already on system, for building the Firebird-SDBC
1691          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1692     [with_system_firebird="$with_system_libs"])
1694 AC_ARG_WITH(system-hsqldb,
1695     AS_HELP_STRING([--with-system-hsqldb],
1696         [Use hsqldb already on system.]))
1698 AC_ARG_WITH(hsqldb-jar,
1699     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1700         [Specify path to jarfile manually.]),
1701     HSQLDB_JAR=$withval)
1703 AC_ARG_ENABLE(scripting-beanshell,
1704     AS_HELP_STRING([--disable-scripting-beanshell],
1705         [Disable support for scripts in BeanShell.]),
1709 AC_ARG_WITH(system-beanshell,
1710     AS_HELP_STRING([--with-system-beanshell],
1711         [Use beanshell already on system.]),,
1712     [with_system_beanshell="$with_system_jars"])
1714 AC_ARG_WITH(beanshell-jar,
1715     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1716         [Specify path to jarfile manually.]),
1717     BSH_JAR=$withval)
1719 AC_ARG_ENABLE(scripting-javascript,
1720     AS_HELP_STRING([--disable-scripting-javascript],
1721         [Disable support for scripts in JavaScript.]),
1725 AC_ARG_WITH(system-rhino,
1726     AS_HELP_STRING([--with-system-rhino],
1727         [Use rhino already on system.]),,)
1728 #    [with_system_rhino="$with_system_jars"])
1729 # Above is not used as we have different debug interface
1730 # patched into internal rhino. This code needs to be fixed
1731 # before we can enable it by default.
1733 AC_ARG_WITH(rhino-jar,
1734     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1735         [Specify path to jarfile manually.]),
1736     RHINO_JAR=$withval)
1738 AC_ARG_WITH(commons-codec-jar,
1739     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1740         [Specify path to jarfile manually.]),
1741     COMMONS_CODEC_JAR=$withval)
1743 AC_ARG_WITH(commons-lang-jar,
1744     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1745         [Specify path to jarfile manually.]),
1746     COMMONS_LANG_JAR=$withval)
1748 AC_ARG_WITH(commons-httpclient-jar,
1749     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1750         [Specify path to jarfile manually.]),
1751     COMMONS_HTTPCLIENT_JAR=$withval)
1753 AC_ARG_WITH(commons-logging-jar,
1754     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1755         [Specify path to jarfile manually.]),
1756     COMMONS_LOGGING_JAR=$withval)
1758 AC_ARG_WITH(system-jfreereport,
1759     AS_HELP_STRING([--with-system-jfreereport],
1760         [Use JFreeReport already on system.]),,
1761     [with_system_jfreereport="$with_system_jars"])
1763 AC_ARG_WITH(sac-jar,
1764     AS_HELP_STRING([--with-sac-jar=JARFILE],
1765         [Specify path to jarfile manually.]),
1766     SAC_JAR=$withval)
1768 AC_ARG_WITH(libxml-jar,
1769     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1770         [Specify path to jarfile manually.]),
1771     LIBXML_JAR=$withval)
1773 AC_ARG_WITH(flute-jar,
1774     AS_HELP_STRING([--with-flute-jar=JARFILE],
1775         [Specify path to jarfile manually.]),
1776     FLUTE_JAR=$withval)
1778 AC_ARG_WITH(jfreereport-jar,
1779     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1780         [Specify path to jarfile manually.]),
1781     JFREEREPORT_JAR=$withval)
1783 AC_ARG_WITH(liblayout-jar,
1784     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1785         [Specify path to jarfile manually.]),
1786     LIBLAYOUT_JAR=$withval)
1788 AC_ARG_WITH(libloader-jar,
1789     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1790         [Specify path to jarfile manually.]),
1791     LIBLOADER_JAR=$withval)
1793 AC_ARG_WITH(libloader-jar,
1794     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1795         [Specify path to jarfile manually.]),
1796     LIBLOADER_JAR=$withval)
1798 AC_ARG_WITH(libformula-jar,
1799     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1800         [Specify path to jarfile manually.]),
1801     LIBFORMULA_JAR=$withval)
1803 AC_ARG_WITH(librepository-jar,
1804     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1805         [Specify path to jarfile manually.]),
1806     LIBREPOSITORY_JAR=$withval)
1808 AC_ARG_WITH(libfonts-jar,
1809     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1810         [Specify path to jarfile manually.]),
1811     LIBFONTS_JAR=$withval)
1813 AC_ARG_WITH(libserializer-jar,
1814     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1815         [Specify path to jarfile manually.]),
1816     LIBSERIALIZER_JAR=$withval)
1818 AC_ARG_WITH(libbase-jar,
1819     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1820         [Specify path to jarfile manually.]),
1821     LIBBASE_JAR=$withval)
1823 AC_ARG_WITH(system-odbc,
1824     AS_HELP_STRING([--with-system-odbc],
1825         [Use the odbc headers already on system.]),,
1826     [with_system_odbc="auto"])
1828 AC_ARG_WITH(system-sane,
1829     AS_HELP_STRING([--with-system-sane],
1830         [Use sane.h already on system.]),,
1831     [with_system_sane="$with_system_headers"])
1833 AC_ARG_WITH(system-bluez,
1834     AS_HELP_STRING([--with-system-bluez],
1835         [Use bluetooth.h already on system.]),,
1836     [with_system_bluez="$with_system_headers"])
1838 AC_ARG_WITH(system-mesa-headers,
1839     AS_HELP_STRING([--with-system-mesa-headers],
1840         [Use Mesa headers already on system.]),,
1841     [with_system_mesa_headers="$with_system_headers"])
1843 AC_ARG_WITH(system-curl,
1844     AS_HELP_STRING([--with-system-curl],
1845         [Use curl already on system.]),,
1846     [with_system_curl=auto])
1848 AC_ARG_WITH(system-boost,
1849     AS_HELP_STRING([--with-system-boost],
1850         [Use boost already on system.]),,
1851     [with_system_boost="$with_system_headers"])
1853 AC_ARG_WITH(system-glm,
1854     AS_HELP_STRING([--with-system-glm],
1855         [Use glm already on system.]),,
1856     [with_system_glm="$with_system_headers"])
1858 AC_ARG_WITH(system-vigra,
1859     AS_HELP_STRING([--with-system-vigra],
1860         [Use vigra already on system.]),,
1861     [with_system_vigra="$with_system_headers"])
1863 AC_ARG_WITH(system-hunspell,
1864     AS_HELP_STRING([--with-system-hunspell],
1865         [Use libhunspell already on system.]),,
1866     [with_system_hunspell="$with_system_libs"])
1868 AC_ARG_WITH(system-mythes,
1869     AS_HELP_STRING([--with-system-mythes],
1870         [Use mythes already on system.]),,
1871     [with_system_mythes="$with_system_libs"])
1873 AC_ARG_WITH(system-altlinuxhyph,
1874     AS_HELP_STRING([--with-system-altlinuxhyph],
1875         [Use ALTLinuxhyph already on system.]),,
1876     [with_system_altlinuxhyph="$with_system_libs"])
1878 AC_ARG_WITH(system-lpsolve,
1879     AS_HELP_STRING([--with-system-lpsolve],
1880         [Use lpsolve already on system.]),,
1881     [with_system_lpsolve="$with_system_libs"])
1883 AC_ARG_WITH(system-coinmp,
1884     AS_HELP_STRING([--with-system-coinmp],
1885         [Use CoinMP already on system.]),,
1886     [with_system_coinmp="$with_system_libs"])
1888 AC_ARG_WITH(system-liblangtag,
1889     AS_HELP_STRING([--with-system-liblangtag],
1890         [Use liblangtag library already on system.]),,
1891     [with_system_liblangtag="$with_system_libs"])
1893 AC_ARG_WITH(system-npapi-headers,
1894     AS_HELP_STRING([--with-system-npapi-headers],
1895         [Use NPAPI headers provided by system instead of bundled ones. Used in
1896          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1897     [with_system_npapi_headers="$with_system_headers"]
1900 AC_ARG_WITH(jpeg-turbo,
1901     AS_HELP_STRING([--with-jpeg-turbo],
1902         [Use internal libjpeg-turbo library.]),,
1903     [with_jpeg_turbo=auto])
1905 AC_ARG_WITH(webdav,
1906     AS_HELP_STRING([--with-webdav],
1907         [Specify which library to use for webdav implementation.
1908          Possible values: "neon", "serf", "no". The default value is "neon".
1909          Example: --with-webdav="serf"]),
1910     WITH_WEBDAV=$withval,
1911     WITH_WEBDAV="neon")
1913 AC_ARG_WITH(linker-hash-style,
1914     AS_HELP_STRING([--with-linker-hash-style],
1915         [Use linker with --hash-style=<style> when linking shared objects.
1916          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1917          if supported on the build system, and "sysv" otherwise.]))
1919 AC_ARG_WITH(jdk-home,
1920     AS_HELP_STRING([--with-jdk-home],
1921         [If you have installed JDK 1.3 or later on your system please supply the
1922          path here. Note that this is not the location of the java command but the
1923          location of the entire distribution.])
1924     [
1925                           Usage:     --with-jdk-home=<absolute path to JDK home>
1926     ],
1929 AC_ARG_WITH(help,
1930     AS_HELP_STRING([--with-help],
1931         [Enable the build of help. There is a special parameter "common" that
1932          can be used to bundle only the common part, .e.g help-specific icons.
1933          This is useful when you build the helpcontent separately.])
1934     [
1935                           Usage:     --with-help    build the entire local help
1936                                  --without-help     no local help (default)
1937                                  --with-help=common bundle common files for the local
1938                                                     help but do not build the whole help
1939     ],
1942 AC_ARG_WITH(java,
1943     AS_HELP_STRING([--with-java],
1944         [Specify the name of the Java interpreter command. Typically "java"
1945          which is the default.
1947          To build without support for Java components, applets, accessibility
1948          or the XML filters written in Java, use --without-java or --with-java=no.])
1949     [
1950                           Usage:     --with-java==<java command>
1951                                      --without-java
1952     ],
1953     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1954     [ with_java=java ]
1957 AC_ARG_WITH(jvm-path,
1958     AS_HELP_STRING([--with-jvm-path],
1959         [Use a specific JVM search path at runtime.])
1960     [
1961                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1963                           e. g.: --with-jvm-path=/usr/lib/
1964                                  to find JRE/JDK in /usr/lib/jvm/
1965     ],
1968 AC_ARG_WITH(ant-home,
1969     AS_HELP_STRING([--with-ant-home],
1970         [If you have installed Jakarta Ant on your system, please supply the path here.
1971          Note that this is not the location of the Ant binary but the location
1972          of the entire distribution.])
1973     [
1974                           Usage:     --with-ant-home=<absolute path to Ant home>
1975     ],
1978 AC_ARG_WITH(export-validation,
1979     AS_HELP_STRING([--with-export-validation],
1980         [If you want the exported files to be validated. Right now limited to OOXML files in calc export tests.
1981          Note: You need an executable script officeotron that takes the path to the file.])
1982     [
1983                             Usage: --with-export-validation
1984     ],
1987 AC_ARG_WITH(junit,
1988     AS_HELP_STRING([--with-junit],
1989         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1990          --without-junit disables those tests. Not relevant in the --without-java case.])
1991     [
1992                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1993     ],
1994 ,with_junit=yes)
1996 AC_ARG_WITH(hamcrest,
1997     AS_HELP_STRING([--with-hamcrest],
1998         [Specifies the hamcrest jar file to use for JUnit-based tests.
1999          --without-junit disables those tests. Not relevant in the --without-java case.])
2000     [
2001                           Usage:     --with-hamcrest=<absolute path to hamcrest jar>
2002     ],
2003 ,with_hamcrest=yes)
2005 AC_ARG_WITH(perl-home,
2006     AS_HELP_STRING([--with-perl-home],
2007         [If you have installed Perl 5 Distribution, on your system, please
2008          supply the path here. Note that this is not the location of the Perl
2009          binary but the location of the entire distribution.])
2010     [
2011                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
2012     ],
2015 AC_ARG_WITH(
2016     [doxygen],
2017     AS_HELP_STRING(
2018         [--with-doxygen],
2019         [Specifies the doxygen executable to use when generating ODK C/C++
2020          documentation. --without-doxygen disables generation of ODK C/C++
2021          documentation. Not relevant in the --disable-odk case.])
2022     [
2023                           Usage:     --with-doxygen=<absolute path to doxygen executable>
2024     ],,
2025     [with_doxygen=yes])
2027 AC_ARG_WITH(visual-studio,
2028     AS_HELP_STRING([--with-visual-studio=2013],
2029         [Specify which Visual Studio version to use in case several are
2030          installed. If not specified, the order of preference is 2013 (including
2031          Express editions). Not very useful at the moment, as currently only
2032          2013 is supported, anyway.])
2033     [
2034                           Usage:     --with-visual-studio=2013
2035     ],
2038 AC_ARG_WITH(windows-sdk,
2039     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)>],
2040         [Specify which Windows SDK, or "Windows Kit", version to use
2041          in case the one that came with the selected Visual Studio
2042          is not what you want for some reason. Note that not all compiler/SDK
2043          combinations are supported. The intent is that this option should not
2044          be needed.])
2045     [
2046                           Usage:     --with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)>
2047     ],
2050 AC_ARG_WITH(lang,
2051     AS_HELP_STRING([--with-lang],
2052         [Use this option to build LibreOffice with additional UI language support.
2053          English (US) is always included by default.
2054          Separate multiple languages with space.
2055          For all languages, use --with-lang=ALL.])
2056     [
2057                           Usage:     --with-lang="es sw tu cs sk"
2058     ],
2061 AC_ARG_WITH(locales,
2062     AS_HELP_STRING([--with-locales],
2063         [Use this option to limit the locale information built in.
2064          Separate multiple locales with space.
2065          Very experimental and might well break stuff.
2066          Just a desperate measure to shrink code and data size.
2067          By default all the locales available is included.
2068          This option is completely unrelated to --with-lang.])
2069     [
2070                           Affects also our character encoding conversion
2071                           tables for encodings mainly targeted for a
2072                           particular locale, like EUC-CN and EUC-TW for
2073                           zh, ISO-2022-JP for ja.
2075                           Affects also our add-on break iterator data for
2076                           some languages.
2078                           For the default, all locales, don't use this switch at all.
2079                           Specifying just the language part of a locale means all matching
2080                           locales will be included.
2082                           Usage:     --with-locales="en es pt fr zh kr ja"
2083     ],
2086 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2087 AC_ARG_WITH(krb5,
2088     AS_HELP_STRING([--with-krb5],
2089         [Enable MIT Kerberos 5 support in modules that support it.
2090          By default automatically enabled on platforms
2091          where a good system Kerberos 5 is available.]),
2094 AC_ARG_WITH(gssapi,
2095     AS_HELP_STRING([--with-gssapi],
2096         [Enable GSSAPI support in modules that support it.
2097          By default automatically enabled on platforms
2098          where a good system GSSAPI is available.]),
2101 AC_ARG_WITH(iwyu,
2102     AS_HELP_STRING([--with-iwyu],
2103         [Use given IWYU binary path to check unneeded includes instead of building.
2104          Use only if you are hacking on it.]),
2107 dnl ===================================================================
2108 dnl Branding
2109 dnl ===================================================================
2111 AC_ARG_WITH(branding,
2112     AS_HELP_STRING([--with-branding],
2113         [Use given path to retrieve branding images set.])
2114     [
2115                           Search for intro.png about.svg and flat_logo.svg.
2116                           If any is missing, default ones will be used instead.
2118                           Search also progress.conf for progress
2119                           settings on intro screen :
2121                           PROGRESSBARCOLOR="255,255,255" Set color of
2122                           progress bar. Comma separated RGB decimal values.
2123                           PROGRESSSIZE="407,6" Set size of progress bar.
2124                           Comma separated decimal values (width, height).
2125                           PROGRESSPOSITION="61,317" Set position of progress
2126                           bar from left,top. Comma separated decimal values.
2127                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2128                           bar frame. Comma separated RGB decimal values.
2129                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2130                           bar text. Comma separated RGB decimal values.
2131                           PROGRESSTEXTBASELINE="287" Set vertical position of
2132                           progress bar text from top. Decimal value.
2134                           Default values will be used if not found.
2136                           Usage:     --with-branding=/path/to/images
2137     ],
2141 AC_ARG_WITH(extra-buildid,
2142     AS_HELP_STRING([--with-extra-buildid],
2143         [Show addition build identification in about dialog.])
2144     [
2145                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
2146     ],
2150 AC_ARG_WITH(vendor,
2151     AS_HELP_STRING([--with-vendor],
2152         [Set vendor of the build.])
2153     [
2154                           Usage:     --with-vendor="John the Builder"
2155     ],
2158 AC_ARG_WITH(android-package-name,
2159     AS_HELP_STRING([--with-android-package-name],
2160         [Set Android package name of the build.])
2161     [
2162                           Usage:     --with-android-package-name="org.libreoffice"
2163     ],
2166 AC_ARG_WITH(compat-oowrappers,
2167     AS_HELP_STRING([--with-compat-oowrappers],
2168         [Install oo* wrappers in parallel with
2169          lo* ones to keep backward compatibility.
2170          Has effect only with make distro-pack-install]),
2173 AC_ARG_WITH(os-version,
2174     AS_HELP_STRING([--with-os-version],
2175         [For FreeBSD users, use this option option to override the detected OSVERSION.])
2176     [
2177                           Usage:     --with-os-version=<OSVERSION>
2178     ],
2181 AC_ARG_WITH(mingw-cross-compiler,
2182     AS_HELP_STRING([--with-mingw-cross-compiler],
2183         [Specify the MinGW cross-compiler to use.])
2184     [
2185                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2187                           When building on the ODK on Unix and building unowinreg.dll,
2188                           specify the MinGW C++ cross-compiler.
2189     ],
2192 AC_ARG_WITH(idlc-cpp,
2193     AS_HELP_STRING([--with-idlc-cpp],
2194         [Specify the C Preprocessor to use for idlc.])
2195     [
2196                           Usage:     --with-idlc-cpp=cpp
2198                           Default is ucpp.
2199     ]
2202 AC_ARG_WITH(build-version,
2203     AS_HELP_STRING([--with-build-version],
2204         [Allows the builder to add a custom version tag that will appear in the
2205          Help/About box for QA purposes.])
2206     [
2207                           Usage:     --with-build-version="Built by Jim"
2208     ],
2209     with_build_version=$withval ,
2212 AC_ARG_WITH(alloc,
2213     AS_HELP_STRING([--with-alloc],
2214         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2215          Note that on FreeBSD/NetBSD system==jemalloc]),
2218 AC_ARG_WITH(sun-templates,
2219     AS_HELP_STRING([--with-sun-templates],
2220         [Integrate Sun template packages.]),
2223 AC_ARG_WITH(parallelism,
2224     AS_HELP_STRING([--with-parallelism],
2225         [Number of jobs to run simultaneously during build. Parallel builds can
2226         save a lot of time on multi-cpu machines. Defaults to the number of
2227         CPUs on the machine, unless you configure --enable-icecream - then to
2228         10.]),
2231 AC_ARG_WITH(all-tarballs,
2232     AS_HELP_STRING([--with-all-tarballs],
2233         [Download all external tarballs unconditionally]))
2235 AC_ARG_WITH(gdrive-client-id,
2236     AS_HELP_STRING([--with-gdrive-client-id],
2237         [Provides the client id of the application for OAuth2 authentication
2238         on Google Drive. If either this or --with-gdrive-client-secret is
2239         empty, the feature will be disabled]),
2242 AC_ARG_WITH(gdrive-client-secret,
2243     AS_HELP_STRING([--with-gdrive-client-secret],
2244         [Provides the client secret of the application for OAuth2
2245         authentication on Google Drive. If either this or
2246         --with-gdrive-client-id is empty, the feature will be disabled]),
2249 AC_ARG_WITH(alfresco-cloud-client-id,
2250     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2251         [Provides the client id of the application for OAuth2 authentication
2252         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2253         empty, the feature will be disabled]),
2256 AC_ARG_WITH(alfresco-cloud-client-secret,
2257     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2258         [Provides the client secret of the application for OAuth2
2259         authentication on Alfresco Cloud. If either this or
2260         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2263 AC_ARG_WITH(onedrive-client-id,
2264     AS_HELP_STRING([--with-onedrive-client-id],
2265         [Provides the client id of the application for OAuth2 authentication
2266         on OneDrive. If either this or --with-onedrive-client-secret is
2267         empty, the feature will be disabled]),
2270 AC_ARG_WITH(onedrive-client-secret,
2271     AS_HELP_STRING([--with-onedrive-client-secret],
2272         [Provides the client secret of the application for OAuth2
2273         authentication on OneDrive. If either this or
2274         --with-onedrive-client-id is empty, the feature will be disabled]),
2276 dnl ===================================================================
2277 dnl Do we want to use pre-build binary tarball for recompile
2278 dnl ===================================================================
2280 if test "$enable_library_bin_tar" = "yes" ; then
2281     USE_LIBRARY_BIN_TAR=TRUE
2282 else
2283     USE_LIBRARY_BIN_TAR=
2285 AC_SUBST(USE_LIBRARY_BIN_TAR)
2287 dnl ===================================================================
2288 dnl Test whether build target is Release Build
2289 dnl ===================================================================
2290 AC_MSG_CHECKING([whether build target is Release Build])
2291 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2292     AC_MSG_RESULT([no])
2293     ENABLE_RELEASE_BUILD=
2294 else
2295     AC_MSG_RESULT([yes])
2296     ENABLE_RELEASE_BUILD=TRUE
2298 AC_SUBST(ENABLE_RELEASE_BUILD)
2300 dnl ===================================================================
2301 dnl Test whether to sign Windows Build
2302 dnl ===================================================================
2303 AC_MSG_CHECKING([whether to sign windows build])
2304 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2305     AC_MSG_RESULT([yes])
2306     WINDOWS_BUILD_SIGNING="TRUE"
2307 else
2308     AC_MSG_RESULT([no])
2309     WINDOWS_BUILD_SIGNING="FALSE"
2311 AC_SUBST(WINDOWS_BUILD_SIGNING)
2313 dnl ===================================================================
2314 dnl MacOSX build and runtime environment options
2315 dnl ===================================================================
2317 AC_ARG_WITH(macosx-sdk,
2318     AS_HELP_STRING([--with-macosx-sdk],
2319         [Use a specific SDK for building.])
2320     [
2321                           Usage:     --with-macosx-sdk=<version>
2323                           e. g.: --with-macosx-sdk=10.8
2325                           there are 3 options to control the MacOSX build:
2326                           --with-macosx-sdk (referred as 'sdk' below)
2327                           --with-macosx-version-min-required (referred as 'min' below)
2328                           --with-macosx-version-max-allowed (referred as 'max' below)
2330                           the connection between these value and the default they take is as follow:
2331                           ( ? means not specified on the command line, s means the SDK version found,
2332                           constraint: 8 <= x <= y <= z)
2334                           ==========================================
2335                            command line      || config result
2336                           ==========================================
2337                           min  | max  | sdk  || min  | max  | sdk  |
2338                           ?    | ?    | ?    || 10.8 | 10.s | 10.s |
2339                           ?    | ?    | 10.x || 10.8 | 10.x | 10.x |
2340                           ?    | 10.x | ?    || 10.8 | 10.s | 10.s |
2341                           ?    | 10.x | 10.y || 10.8 | 10.x | 10.y |
2342                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2343                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2344                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2345                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2348                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2349                           for a detailed technical explanation of these variables
2351                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2352     ],
2355 AC_ARG_WITH(macosx-version-min-required,
2356     AS_HELP_STRING([--with-macosx-version-min-required],
2357         [set the minimum OS version needed to run the built LibreOffice])
2358     [
2359                           Usage:     --with-macosx-version-min-required=<version>
2361                           e. g.: --with-macos-version-min-required=10.8
2362                           see --with-macosx-sdk for more info
2363     ],
2366 AC_ARG_WITH(macosx-version-max-allowed,
2367     AS_HELP_STRING([--with-macosx-version-max-allowed],
2368         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2369     [
2370                           Usage:     --with-macosx-version-max-allowed=<version>
2372                           e. g.: --with-macos-version-max-allowed=10.8
2373                           see --with-macosx-sdk for more info
2374     ],
2378 dnl ===================================================================
2379 dnl options for stuff used during cross-compilation build
2380 dnl Not quite superseded by --with-build-platform-configure-options.
2381 dnl TODO: check, if the "force" option is still needed anywhere.
2382 dnl ===================================================================
2384 AC_ARG_WITH(system-icu-for-build,
2385     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2386         [Use icu already on system for build tools (cross-compilation only).]))
2389 dnl ===================================================================
2390 dnl check for required programs (grep, awk, sed, bash)
2391 dnl ===================================================================
2393 pathmunge ()
2395     if test -n "$1"; then
2396         if test "$build_os" = "cygwin"; then
2397             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2398                 PathFormat "$1"
2399                 new_path=`cygpath -sm "$formatted_path"`
2400             else
2401                 PathFormat "$1"
2402                 new_path=`cygpath -u "$formatted_path"`
2403             fi
2404         else
2405             new_path="$1"
2406         fi
2407         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2408             if test "$2" = "after"; then
2409                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2410             else
2411                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2412             fi
2413         fi
2414         unset new_path
2415     fi
2418 AC_PROG_AWK
2419 AC_PATH_PROG( AWK, $AWK)
2420 if test -z "$AWK"; then
2421     AC_MSG_ERROR([install awk to run this script])
2424 AC_PATH_PROG(BASH, bash)
2425 if test -z "$BASH"; then
2426     AC_MSG_ERROR([bash not found in \$PATH])
2428 AC_SUBST(BASH)
2430 AC_MSG_CHECKING([for GNU or BSD tar])
2431 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2432     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2433     if test $? -eq 0;  then
2434         GNUTAR=$a
2435         break
2436     fi
2437 done
2438 AC_MSG_RESULT($GNUTAR)
2439 if test -z "$GNUTAR"; then
2440     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2442 AC_SUBST(GNUTAR)
2444 AC_MSG_CHECKING([for tar's option to strip components])
2445 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2446 if test $? -eq 0; then
2447     STRIP_COMPONENTS="--strip-components"
2448 else
2449     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2450     if test $? -eq 0; then
2451         STRIP_COMPONENTS="--strip-path"
2452     else
2453         STRIP_COMPONENTS="unsupported"
2454     fi
2456 AC_MSG_RESULT($STRIP_COMPONENTS)
2457 if test x$STRIP_COMPONENTS = xunsupported; then
2458     AC_MSG_ERROR([you need a tar that is able to strip components.])
2460 AC_SUBST(STRIP_COMPONENTS)
2462 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2463 dnl desktop OSes from "mobile" ones.
2465 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2466 dnl In other words, that when building for an OS that is not a
2467 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2469 dnl Note the direction of the implication; there is no assumption that
2470 dnl cross-compiling would imply a non-desktop OS.
2472 if test $_os != iOS -a $_os != Android; then
2473     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2474     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2475     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2478 DISABLE_EXPORT=''
2479 if test "$enable_export" != no; then
2480     BUILD_TYPE="$BUILD_TYPE EXPORT"
2481 else
2482     DISABLE_EXPORT='TRUE'
2483     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2485 AC_SUBST(DISABLE_EXPORT)
2487 # Whether to build "avmedia" functionality or not.
2489 if test -z "$enable_avmedia"; then
2490     enable_avmedia=yes
2493 if test "$enable_avmedia" = yes; then
2494     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2495     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2496 else
2497     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2500 # Decide whether to build database connectivity stuff (including
2501 # Base) or not. We probably don't want to on non-desktop OSes.
2503 if test -z "$enable_database_connectivity"; then
2504     # --disable-database-connectivity is unfinished work in progress
2505     # and the iOS test app doesn't link if we actually try to use it.
2506     # if test $_os != iOS -a $_os != Android; then
2507         enable_database_connectivity=yes
2508     # fi
2511 if test "$enable_database_connectivity" = yes; then
2512     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2513     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2516 if test -z "$enable_extensions"; then
2517     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2518     if test $_os != iOS -a $_os != Android; then
2519         enable_extensions=yes
2520     fi
2523 if test "$enable_extensions" = yes; then
2524     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2525     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2528 if test -z "$enable_scripting"; then
2529     # Disable scripting for iOS unless specifically overridden
2530     # with --enable-scripting.
2531     if test $_os != iOS; then
2532         enable_scripting=yes
2533     fi
2536 DISABLE_SCRIPTING=''
2537 if test "$enable_scripting" = yes; then
2538     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2539     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2540 else
2541     DISABLE_SCRIPTING='TRUE'
2542     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2545 if test $_os = iOS -o $_os = Android; then
2546     # Disable dynamic_loading always for iOS and Android
2547     enable_dynamic_loading=no
2548 elif test -z "$enable_dynamic_loading"; then
2549     # Otherwise enable it unless speficically disabled
2550     enable_dynamic_loading=yes
2553 DISABLE_DYNLOADING=''
2554 if test "$enable_dynamic_loading" = yes; then
2555     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2556 else
2557     DISABLE_DYNLOADING='TRUE'
2558     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2560 AC_SUBST(DISABLE_DYNLOADING)
2562 # remenber SYSBASE value
2563 AC_SUBST(SYSBASE)
2565 dnl ===================================================================
2566 dnl  Sort out various gallery compilation options
2567 dnl ===================================================================
2568 AC_MSG_CHECKING([how to build and package galleries])
2569 if test -n "${with_galleries}"; then
2570     if test "$with_galleries" = "build"; then
2571         WITH_GALLERY_BUILD=TRUE
2572         AC_MSG_RESULT([build from source images internally])
2573     elif test "$with_galleries" = "no"; then
2574         WITH_GALLERY_BUILD=
2575         AC_MSG_RESULT([disable non-internal gallery build])
2576     else
2577         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2578     fi
2579 else
2580     if test $_os != iOS -a $_os != Android; then
2581         WITH_GALLERY_BUILD=TRUE
2582         AC_MSG_RESULT([internal src images for desktop])
2583     else
2584         WITH_GALLERY_BUILD=
2585         AC_MSG_RESULT([disable src imgage build])
2586     fi
2588 AC_SUBST(WITH_GALLERY_BUILD)
2590 dnl ===================================================================
2591 dnl  Checks if ccache is available
2592 dnl ===================================================================
2593 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2594     case "%$CC%$CXX%" in
2595     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2596     # assume that's good then
2597     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2598         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2599         ;;
2600     *)
2601         AC_PATH_PROG([CCACHE],[ccache],[not found])
2602         if test "$CCACHE" = "not found"; then
2603             CCACHE=""
2604         else
2605             # Need to check for ccache version: otherwise prevents
2606             # caching of the results (like "-x objective-c++" for Mac)
2607             if test $_os = Darwin -o $_os = iOS; then
2608                 # Check ccache version
2609                 AC_MSG_CHECKING([whether version of ccache is suitable])
2610                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2611                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2612                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2613                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2614                 else
2615                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2616                     CCACHE=""
2617                 fi
2618             fi
2619         fi
2620         ;;
2621     esac
2622 else
2623     CCACHE=""
2626 if test "$CCACHE" != ""; then
2627     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2628     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2629     if test "$ccache_size" = ""; then
2630         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2631         if test "$ccache_size" = ""; then
2632             ccache_size=0
2633         fi
2634         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2635         if test $ccache_size -lt 1024; then
2636             CCACHE=""
2637             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2638             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2639         else
2640             # warn that ccache may be too small for debug build
2641             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2642             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2643         fi
2644     else
2645         if test $ccache_size -lt 5; then
2646             #warn that ccache may be too small for debug build
2647             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2648             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2649         fi
2650     fi
2653 dnl ===================================================================
2654 dnl  Checks for C compiler,
2655 dnl  The check for the C++ compiler is later on.
2656 dnl ===================================================================
2657 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2658     GCC_HOME_SET="true"
2659     AC_MSG_CHECKING([gcc home])
2660     if test -z "$with_gcc_home"; then
2661         if test "$enable_icecream" = "yes"; then
2662             if test -d "/usr/lib/icecc/bin"; then
2663                 GCC_HOME="/usr/lib/icecc/"
2664             else
2665                 GCC_HOME="/opt/icecream/"
2666             fi
2667         else
2668             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2669             GCC_HOME_SET="false"
2670         fi
2671     else
2672         GCC_HOME="$with_gcc_home"
2673     fi
2674     AC_MSG_RESULT($GCC_HOME)
2675     AC_SUBST(GCC_HOME)
2677     if test "$GCC_HOME_SET" = "true"; then
2678         if test -z "$CC"; then
2679             CC="$GCC_HOME/bin/gcc"
2680         fi
2681         if test -z "$CXX"; then
2682             CXX="$GCC_HOME/bin/g++"
2683         fi
2684     fi
2687 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2688 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2689     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2690     save_CFLAGS=$CFLAGS
2691     AC_PROG_CC
2692     CFLAGS=$save_CFLAGS
2695 COMPATH=`dirname "$CC"`
2696 if test "$COMPATH" = "."; then
2697     AC_PATH_PROGS(COMPATH, $CC)
2698     dnl double square bracket to get single because of M4 quote...
2699     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2701 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2703 dnl ===================================================================
2704 dnl Java support
2705 dnl ===================================================================
2706 AC_MSG_CHECKING([whether to build with Java support])
2707 if test "$with_java" != "no"; then
2708     if test "$DISABLE_SCRIPTING" = TRUE; then
2709         AC_MSG_RESULT([no, overridden by --disable-scripting])
2710         ENABLE_JAVA=""
2711         with_java=no
2712     else
2713         AC_MSG_RESULT([yes])
2714         ENABLE_JAVA="TRUE"
2715         AC_DEFINE(HAVE_FEATURE_JAVA)
2716     fi
2717 else
2718     AC_MSG_RESULT([no])
2719     ENABLE_JAVA=""
2722 AC_SUBST(ENABLE_JAVA)
2724 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2726 dnl ENABLE_JAVA="" indicate no Java support at all
2728 dnl ===================================================================
2729 dnl Export file validation
2730 dnl ===================================================================
2731 AC_MSG_CHECKING([whether to enable export file validation])
2732 if test "$with_export_validation" = yes; then
2733     AC_MSG_RESULT([yes])
2734     AC_DEFINE(HAVE_EXPORT_VALIDATION)
2736     AC_CHECK_PROGS(ODFVALIDATOR, odfvalidator)
2737     if test -z "$ODFVALIDATOR"; then
2738         AC_MSG_ERROR([odfvalidator not found, but required by --with-export-validation])
2739     fi
2740     AC_SUBST(ODFVALIDATOR)
2741     AC_CHECK_PROGS(OFFICEOTRON, officeotron)
2742     if test -z "$OFFICEOTRON"; then
2743         AC_MSG_ERROR([officeotron not found, but required by --with-export-validation])
2744     fi
2745     AC_SUBST(OFFICEOTRON)
2746 else
2747     AC_MSG_RESULT([no])
2751 dnl ===================================================================
2752 dnl Check OS X SDK and compiler
2753 dnl ===================================================================
2755 if test $_os = Darwin; then
2757     # If no --with-macosx-sdk option is given, look for one
2759     # The intent is that for "most" Mac-based developers, a suitable
2760     # SDK will be found automatically without any configure options.
2762     # For developers with a current Xcode, the lowest-numbered SDK
2763     # higher than or equal to the minimum required should be found.
2765     AC_MSG_CHECKING([what Mac OS X SDK to use])
2767     for _macosx_sdk in $with_macosx_sdk 10.8 10.9 10.10 10.11; do
2768         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2769         if test -d "$MACOSX_SDK_PATH"; then
2770             with_macosx_sdk="${_macosx_sdk}"
2771             break
2772         else
2773             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2774             if test -d "$MACOSX_SDK_PATH"; then
2775                 with_macosx_sdk="${_macosx_sdk}"
2776                 break
2777             fi
2778         fi
2779     done
2780     if test ! -d "$MACOSX_SDK_PATH"; then
2781         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2782     fi
2783     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2785     case $with_macosx_sdk in
2786     10.8)
2787         MACOSX_SDK_VERSION=1080
2788         ;;
2789     10.9)
2790         MACOSX_SDK_VERSION=1090
2791         ;;
2792     10.10)
2793         MACOSX_SDK_VERSION=101000
2794         ;;
2795     10.11)
2796         MACOSX_SDK_VERSION=101100
2797         ;;
2798     *)
2799         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.8--11])
2800         ;;
2801     esac
2803     if test "$with_macosx_version_min_required" = "" ; then
2804         with_macosx_version_min_required="10.8";
2805     fi
2807     if test "$with_macosx_version_max_allowed" = "" ; then
2808         with_macosx_version_max_allowed="$with_macosx_sdk"
2809     fi
2811     # export this so that "xcrun" invocations later return matching values
2812     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2813     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2814     export DEVELOPER_DIR
2815     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2816     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2818     case "$with_macosx_version_min_required" in
2819     10.8)
2820         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2821         ;;
2822     10.9)
2823         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2824         ;;
2825     10.10)
2826         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2827         ;;
2828     10.11)
2829         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2830         ;;
2831     *)
2832         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.8--11])
2833         ;;
2834     esac
2836     LIBTOOL=libtool
2837     INSTALL_NAME_TOOL=install_name_tool
2838     if test -z "$save_CC"; then
2839         AC_MSG_CHECKING([what compiler to use])
2840         stdlib=-stdlib=libc++
2841         if test "$ENABLE_LTO" = TRUE; then
2842             lto=-flto
2843         fi
2844         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2845         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2846         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2847         AR=`xcrun -find ar`
2848         NM=`xcrun -find nm`
2849         STRIP=`xcrun -find strip`
2850         LIBTOOL=`xcrun -find libtool`
2851         RANLIB=`xcrun -find ranlib`
2852         AC_MSG_RESULT([$CC and $CXX])
2853     fi
2855     case "$with_macosx_version_max_allowed" in
2856     10.8)
2857         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2858         ;;
2859     10.9)
2860         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2861         ;;
2862     10.10)
2863         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2864         ;;
2865     10.11)
2866         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2867         ;;
2868     *)
2869         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.8--11])
2870         ;;
2871     esac
2873     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2874     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2875         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2876     else
2877         AC_MSG_RESULT([ok])
2878     fi
2880     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2881     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2882         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2883     else
2884         AC_MSG_RESULT([ok])
2885     fi
2886     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2887     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2889     AC_MSG_CHECKING([whether to do code signing])
2891     if test "$enable_macosx_code_signing" = yes; then
2892         # By default use the first suitable certificate (?).
2894         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2895         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2896         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2897         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2898         # "Developer ID Application" one.
2900         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2901         if test -n "$identity"; then
2902             MACOSX_CODESIGNING_IDENTITY=$identity
2903             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2904             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2905         else
2906             AC_MSG_ERROR([cannot determine identity to use])
2907         fi
2908     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2909         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
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_RESULT([no])
2914     fi
2916     AC_MSG_CHECKING([whether to create a Mac App Store package])
2918     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2919         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2920     elif test "$enable_macosx_package_signing" = yes; then
2921         # By default use the first suitable certificate.
2922         # It should be a "3rd Party Mac Developer Installer" one
2924         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2925         if test -n "$identity"; then
2926             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2927             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2928             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2929         else
2930             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2931         fi
2932     elif test -n "$enable_macosx_package_signing"; then
2933         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
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_RESULT([no])
2938     fi
2940     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2941         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2942     fi
2944     AC_MSG_CHECKING([whether to sandbox the application])
2946     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2947         AC_MSG_ERROR([OS X sandboxing requires code signing])
2948     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2949         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2950     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2951         ENABLE_MACOSX_SANDBOX=TRUE
2952         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2953         AC_MSG_RESULT([yes])
2954     else
2955         AC_MSG_RESULT([no])
2956     fi
2958     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2959     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2960     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2962     AC_MSG_CHECKING([what OS X app name to use])
2963     MACOSX_APP_NAME="$with_macosx_app_name"
2964     AC_MSG_RESULT([$MACOSX_APP_NAME])
2967 AC_SUBST(MACOSX_SDK_PATH)
2968 AC_SUBST(MACOSX_SDK_VERSION)
2969 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2970 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2971 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2972 AC_SUBST(INSTALL_NAME_TOOL)
2973 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2974 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2975 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2976 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2977 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2978 AC_SUBST(MACOSX_APP_NAME)
2980 dnl ===================================================================
2981 dnl Check iOS SDK and compiler
2982 dnl ===================================================================
2984 if test $_os = iOS; then
2986     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2987         :
2988     else
2989         BITNESS_OVERRIDE=64
2990     fi
2992     AC_MSG_CHECKING([what iOS SDK to use])
2994     if test "$enable_ios_simulator" = yes; then
2995         platform=iPhoneSimulator
2996     else
2997         platform=iPhoneOS
2998     fi
3000     xcode_developer=`xcode-select -print-path`
3002     current_sdk_ver=8.3
3003     for sdkver in 8.3 8.2 8.1 8.0; do
3004         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3005         if test -d $t; then
3006             ios_sdk=$sdkver
3007             sysroot=$t
3008             break
3009         fi
3010     done
3012     if test -z "$sysroot"; then
3013         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}])
3014     fi
3016     AC_MSG_RESULT($sysroot)
3018     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
3020     if test "$enable_ios_simulator" = yes; then
3021         if test "$BITNESS_OVERRIDE" = 64; then
3022             XCODE_ARCHS=x86_64
3023             versionmin=-mios-simulator-version-min=7.0
3024         else
3025             XCODE_ARCHS=i386
3026             versionmin=-mios-simulator-version-min=7.0
3027         fi
3028     else
3029         platform=iPhoneOS
3030         if test "$BITNESS_OVERRIDE" = 64; then
3031             XCODE_ARCHS=arm64
3032         else
3033             XCODE_ARCHS=armv7
3034         fi
3035         versionmin=-miphoneos-version-min=7.0
3036     fi
3038     # LTO is not really recommended for iOS builds,
3039     # the link time will be astronomical
3040     if test "$ENABLE_LTO" = TRUE; then
3041         lto=-flto
3042     fi
3043     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3044     # get compiled with it, to avoid ld warnings when linking all that together into one
3045     # executable.
3047     XCODE_CLANG_CXX_LIBRARY=libc++
3048     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3050     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3051     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3053     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3054     AR=`xcrun -find ar`
3055     NM=`xcrun -find nm`
3056     STRIP=`xcrun -find strip`
3057     LIBTOOL=`xcrun -find libtool`
3058     RANLIB=`xcrun -find ranlib`
3061 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3062 AC_SUBST(XCODE_ARCHS)
3063 AC_SUBST(XCODEBUILD_SDK)
3065 AC_MSG_CHECKING([whether to treat the installation as read-only])
3067 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3068         "$enable_extensions" != yes; then
3069     enable_readonly_installset=yes
3071 if test "$enable_readonly_installset" = yes; then
3072     AC_MSG_RESULT([yes])
3073     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3074 else
3075     AC_MSG_RESULT([no])
3078 dnl ===================================================================
3079 dnl Structure of install set
3080 dnl ===================================================================
3082 if test $_os = Darwin; then
3083     LIBO_BIN_FOLDER=MacOS
3084     LIBO_ETC_FOLDER=Resources
3085     LIBO_LIBEXEC_FOLDER=MacOS
3086     LIBO_LIB_FOLDER=Frameworks
3087     LIBO_SHARE_FOLDER=Resources
3088     LIBO_SHARE_HELP_FOLDER=Resources/help
3089     LIBO_SHARE_JAVA_FOLDER=Resources/java
3090     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3091     LIBO_LIB_PYUNO_FOLDER=Resources
3092     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3093     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3094     LIBO_URE_BIN_FOLDER=MacOS
3095     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3096     LIBO_URE_LIB_FOLDER=Frameworks
3097     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3098     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3099 elif test $_os = WINNT; then
3100     LIBO_BIN_FOLDER=program
3101     LIBO_ETC_FOLDER=program
3102     LIBO_LIBEXEC_FOLDER=program
3103     LIBO_LIB_FOLDER=program
3104     LIBO_LIB_PYUNO_FOLDER=program
3105     LIBO_SHARE_FOLDER=share
3106     LIBO_SHARE_HELP_FOLDER=help
3107     LIBO_SHARE_JAVA_FOLDER=program/classes
3108     LIBO_SHARE_PRESETS_FOLDER=presets
3109     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3110     LIBO_SHARE_SHELL_FOLDER=program/shell
3111     LIBO_URE_BIN_FOLDER=program
3112     LIBO_URE_ETC_FOLDER=program
3113     LIBO_URE_LIB_FOLDER=program
3114     LIBO_URE_MISC_FOLDER=program
3115     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3116 else
3117     LIBO_BIN_FOLDER=program
3118     LIBO_ETC_FOLDER=program
3119     LIBO_LIBEXEC_FOLDER=program
3120     LIBO_LIB_FOLDER=program
3121     LIBO_LIB_PYUNO_FOLDER=program
3122     LIBO_SHARE_FOLDER=share
3123     LIBO_SHARE_HELP_FOLDER=help
3124     LIBO_SHARE_JAVA_FOLDER=program/classes
3125     LIBO_SHARE_PRESETS_FOLDER=presets
3126     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3127     LIBO_SHARE_SHELL_FOLDER=program/shell
3128     LIBO_URE_BIN_FOLDER=program
3129     LIBO_URE_ETC_FOLDER=program
3130     LIBO_URE_LIB_FOLDER=program
3131     LIBO_URE_MISC_FOLDER=program
3132     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3134 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3135 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3136 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3137 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3138 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3139 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3140 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3141 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3142 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3143 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3144 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3145 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3146 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3147 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3148 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3149 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3151 # Not all of them needed in config_host.mk, add more if need arises
3152 AC_SUBST(LIBO_BIN_FOLDER)
3153 AC_SUBST(LIBO_ETC_FOLDER)
3154 AC_SUBST(LIBO_LIB_FOLDER)
3155 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3156 AC_SUBST(LIBO_SHARE_FOLDER)
3157 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3158 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3159 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3160 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3161 AC_SUBST(LIBO_URE_BIN_FOLDER)
3162 AC_SUBST(LIBO_URE_ETC_FOLDER)
3163 AC_SUBST(LIBO_URE_LIB_FOLDER)
3164 AC_SUBST(LIBO_URE_MISC_FOLDER)
3165 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3167 dnl ===================================================================
3168 dnl Windows specific tests and stuff
3169 dnl ===================================================================
3171 # Get a value from the 32-bit side of the Registry
3172 reg_get_value_32()
3174     # Return value: $regvalue
3175     unset regvalue
3176     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3178     if test $? -eq 0; then
3179         regvalue=$_regvalue
3180     fi
3183 # Get a value from the 64-bit side of the Registry
3184 reg_get_value_64()
3186     # Return value: $regvalue
3187     unset regvalue
3188     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3190     if test $? -eq 0; then
3191         regvalue=$_regvalue
3192     fi
3195 if test "$_os" = "WINNT"; then
3196     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3197     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3198         AC_MSG_RESULT([no])
3199         WINDOWS_SDK_ARCH="x86"
3200     else
3201         AC_MSG_RESULT([yes])
3202         WINDOWS_SDK_ARCH="x64"
3203         BITNESS_OVERRIDE=64
3204     fi
3207 if test "$cross_compiling" = "yes"; then
3208     export CROSS_COMPILING=TRUE
3209     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3210 else
3211     CROSS_COMPILING=
3212     BUILD_TYPE="$BUILD_TYPE NATIVE"
3214 AC_SUBST(CROSS_COMPILING)
3216 dnl ===================================================================
3217 dnl  Is GCC actually Clang?
3218 dnl ===================================================================
3220 COM_GCC_IS_CLANG=
3221 if test "$GCC" = "yes"; then
3222     AC_MSG_CHECKING([whether GCC is actually Clang])
3223     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3224         #ifndef __clang__
3225         you lose
3226         #endif
3227         int foo=42;
3228         ]])],
3229         [AC_MSG_RESULT([yes])
3230          COM_GCC_IS_CLANG=TRUE],
3231         [AC_MSG_RESULT([no])])
3233     if test "$COM_GCC_IS_CLANG" = TRUE; then
3234         AC_MSG_CHECKING([the Clang version])
3235         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3236         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3237         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3238         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3239         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3240     fi
3242 AC_SUBST(COM_GCC_IS_CLANG)
3244 if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
3245     if test -z "$CCACHE_CPP2"; then
3246         AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3247         add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3248     fi
3251 dnl ===================================================================
3252 dnl  Test the gcc version
3253 dnl ===================================================================
3254 if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
3255     AC_MSG_CHECKING([the GCC version])
3256     _gcc_version=`$CC -dumpversion`
3257     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3259     AC_MSG_RESULT([gcc $_gcc_version])
3261     if test "$GCC_VERSION" -lt 0406; then
3262         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.6.0])
3263     fi
3264 else
3265     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3266     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3267     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3268     # (which reports itself as GCC 4.2.1).
3269     GCC_VERSION=
3271 AC_SUBST(GCC_VERSION)
3273 # ===================================================================
3274 # check various GCC options that Clang does not support now but maybe
3275 # will somewhen in the future, check them even for GCC, so that the
3276 # flags are set
3277 # ===================================================================
3279 HAVE_GCC_GGDB2=
3280 HAVE_GCC_FINLINE_LIMIT=
3281 HAVE_GCC_FNO_INLINE=
3282 if test "$GCC" = "yes"; then
3283     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3284     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3285         # Option just ignored and silly warning that isn't a real
3286         # warning printed
3287         :
3288     else
3289         save_CFLAGS=$CFLAGS
3290         CFLAGS="$CFLAGS -Werror -ggdb2"
3291         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3292         CFLAGS=$save_CFLAGS
3293     fi
3294     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3295         AC_MSG_RESULT([yes])
3296     else
3297         AC_MSG_RESULT([no])
3298     fi
3300     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3301     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3302         # As above
3303         :
3304     else
3305         save_CFLAGS=$CFLAGS
3306         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3307         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3308         CFLAGS=$save_CFLAGS
3309     fi
3310     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3311         AC_MSG_RESULT([yes])
3312     else
3313         AC_MSG_RESULT([no])
3314     fi
3316     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3317     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3318         # Ditto
3319         :
3320     else
3321         save_CFLAGS=$CFLAGS
3322         CFLAGS="$CFLAGS -Werror -fno-inline"
3323         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3324         CFLAGS=$save_CFLAGS
3325     fi
3326     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3327         AC_MSG_RESULT([yes])
3328     else
3329         AC_MSG_RESULT([no])
3330     fi
3332 AC_SUBST(HAVE_GCC_GGDB2)
3333 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3334 AC_SUBST(HAVE_GCC_FNO_INLINE)
3336 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3337 if test "$GCC" = "yes"; then
3338     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3339     bsymbolic_functions_ldflags_save=$LDFLAGS
3340     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3341     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3342 #include <stdio.h>
3343         ],[
3344 printf ("hello world\n");
3345         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3346     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3347         AC_MSG_RESULT( found )
3348     else
3349         AC_MSG_RESULT( not found )
3350     fi
3351     LDFLAGS=$bsymbolic_functions_ldflags_save
3353 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3355 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3356 # NOTE: must _not_ be used for bundled external libraries!
3357 ISYSTEM=
3358 if test "$GCC" = "yes"; then
3359     AC_MSG_CHECKING( for -isystem )
3360     save_CFLAGS=$CFLAGS
3361     CFLAGS="$CFLAGS -Werror"
3362     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3363     CFLAGS=$save_CFLAGS
3364     if test -n "$ISYSTEM"; then
3365         AC_MSG_RESULT(yes)
3366     else
3367         AC_MSG_RESULT(no)
3368     fi
3370 if test -z "$ISYSTEM"; then
3371     # fall back to using -I
3372     ISYSTEM=-I
3374 AC_SUBST(ISYSTEM)
3376 dnl ===================================================================
3377 dnl  Check which Visual Studio or MinGW compiler is used
3378 dnl ===================================================================
3380 map_vs_year_to_version()
3382     # Return value: $vsversion
3384     unset vsversion
3386     case $1 in
3387     2013)
3388         vsversion=12.0;;
3389     *)
3390         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3391     esac
3394 vs_versions_to_check()
3396     # Args: $1 (optional) : versions to check, in the order of preference
3397     # Return value: $vsversions
3399     unset vsversions
3401     if test -n "$1"; then
3402         map_vs_year_to_version "$1"
3403         vsversions=$vsversion
3404     else
3405         # By default we prefer 2013
3406         vsversions=12.0
3407     fi
3410 find_msvs()
3412     # Find Visual Studio 2013
3413     # Args: $1 (optional) : versions to check, in the order of preference
3414     # Return value: $vstest
3416     unset vstest
3418     vs_versions_to_check "$1"
3420     for ver in $vsversions; do
3421         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3422         if test -n "$regvalue"; then
3423             vstest=$regvalue
3424             break
3425         fi
3426         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3427         if test -n "$regvalue"; then
3428             vstest=$regvalue
3429             break
3430         fi
3431     done
3434 find_msvc()
3436     # Find Visual C++ 2013
3437     # Args: $1 (optional) : The VS version year
3438     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3440     unset vctest vcnum vcnumwithdot vcexpress
3442     vs_versions_to_check "$1"
3444     for ver in $vsversions; do
3445         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3446         if test -n "$regvalue"; then
3447             vctest=$regvalue
3448             break
3449         fi
3450         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3451         if test -n "$regvalue"; then
3452             vctest=$regvalue
3453             break
3454         fi
3455     done
3456     if test -n "$vctest"; then
3457         vcnumwithdot=$ver
3458         case "$vcnumwithdot" in
3459         12.0)
3460             vcyear=2013
3461             vcnum=120
3462             ;;
3463         esac
3464         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$vcnumwithdot/Setup/VC/ProductDir
3465         if test -n "$regvalue" -a "$regvalue" = "$vctest" ; then
3466             vcexpress=Express
3467         fi
3468     fi
3471 SHOWINCLUDES_PREFIX=
3472 MSBUILD_PATH=
3473 if test "$_os" = "WINNT"; then
3474     if test "$WITH_MINGW" != "yes"; then
3475         AC_MSG_CHECKING([Visual C++])
3477         find_msvc "$with_visual_studio"
3479         if test -z "$vctest"; then
3480             if test -n "$with_visual_studio"; then
3481                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3482             else
3483                 AC_MSG_ERROR([No Visual Studio 2013 installation found])
3484             fi
3485         fi
3487         if test "$BITNESS_OVERRIDE" = ""; then
3488             if test -f "$vctest/bin/cl.exe"; then
3489                 VC_PRODUCT_DIR=$vctest
3490             else
3491                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3492             fi
3493         else
3494             if test -f "$vctest/bin/amd64/cl.exe"; then
3495                 VC_PRODUCT_DIR=$vctest
3496             else
3497                 if test -f "$vctest/bin/x86_amd64/cl.exe" -a "$vcexpress" = "Express"; then
3498                     VC_PRODUCT_DIR=$vctest
3499                 else
3500                     AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3501                 fi
3502             fi
3503         fi
3505         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3506         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3508         AC_MSG_CHECKING([Is Visual C++ Express])
3509         if test "$vcexpress" = "Express" ; then
3510             AC_MSG_RESULT([Yes])
3511         else
3512             AC_MSG_RESULT([No])
3513         fi
3515         # Find the proper version of MSBuild.exe to use based on the VS version
3516         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3517         if test -n "$regvalue" ; then
3518             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3519         fi
3521         dnl ===========================================================
3522         dnl  Check for the corresponding mspdb*.dll
3523         dnl ===========================================================
3525         MSPDB_PATH=
3527         if test "$BITNESS_OVERRIDE" = ""; then
3528             if test "$vcnum" = "120"; then
3529                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3530             else
3531                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3532             fi
3533         else
3534             if test "$vcexpress" = "Express"; then
3535                 MSPDB_PATH="$VC_PRODUCT_DIR/bin"
3536             else
3537                 MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3538             fi
3539         fi
3541         mspdbnum=$vcnum
3543         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3544             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3545         fi
3547         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3548         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3550         dnl The path needs to be added before cl is called
3551         PATH="$MSPDB_PATH:$PATH"
3553         AC_MSG_CHECKING([cl.exe])
3555         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3556         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3557         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3558         # is not enough?
3560         if test -z "$CC"; then
3561             if test "$BITNESS_OVERRIDE" = ""; then
3562                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3563                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3564                 fi
3565             else
3566                 if test "$vcexpress" = "Express"; then
3567                    if test -f "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"; then
3568                         CC="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3569                    fi
3570                 else
3571                    if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3572                         CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3573                    fi
3574                 fi
3575             fi
3577             # This gives us a posix path with 8.3 filename restrictions
3578             CC=`win_short_path_for_make "$CC"`
3579         fi
3581         if test -n "$CC"; then
3582             # Remove /cl.exe from CC case insensitive
3583             AC_MSG_RESULT([found Visual C++ $vcyear $vcexpress ($CC)])
3584             if test "$BITNESS_OVERRIDE" = ""; then
3585                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3586             else
3587                 if test -n "$VC_PRODUCT_DIR"; then
3588                     # Huh, why not just an assignment?
3589                     COMPATH=`echo $VC_PRODUCT_DIR`
3590                 fi
3591             fi
3592             if test "$BITNESS_OVERRIDE" = ""; then
3593                 dnl since MSVC 2012, default for x86 is -arch:SSE2:
3594                 CC="$CC -arch:SSE"
3595             fi
3596             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3598             PathFormat "$COMPATH"
3599             COMPATH="$formatted_path"
3601             VCVER=$vcnum
3602             MSVSVER=$vcyear
3604             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3605             # are always "better", we list them in reverse chronological order.
3607             case $vcnum in
3608             120)
3609                 COMEX=15
3610                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0 7.1A"
3611                 ;;
3612             esac
3614             # The expectation is that --with-windows-sdk should not need to be used
3615             if test -n "$with_windows_sdk"; then
3616                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3617                 *" "$with_windows_sdk" "*)
3618                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3619                     ;;
3620                 *)
3621                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3622                     ;;
3623                 esac
3624             fi
3626             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3627             ac_objext=obj
3628             ac_exeext=exe
3630         else
3631             AC_MSG_ERROR([Visual C++ not found after all, huh])
3632         fi
3634         dnl We need to guess the prefix of the -showIncludes output, it can be
3635         dnl localized
3636         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3637         echo "#include <stdlib.h>" > conftest.c
3638         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3639             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3640         rm -f conftest.c conftest.obj
3641         if test -z "$SHOWINCLUDES_PREFIX"; then
3642             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3643         else
3644             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3645         fi
3647         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3648         # version of the Explorer extension (and maybe other small
3649         # bits, too) needed when installing a 32-bit LibreOffice on a
3650         # 64-bit OS. The 64-bit Explorer extension is a feature that
3651         # has been present since long in OOo. Don't confuse it with
3652         # building LibreOffice itself as 64-bit code, which is
3653         # unfinished work and highly experimental.
3655         BUILD_X64=
3656         CXX_X64_BINARY=
3657         LINK_X64_BINARY=
3659         if test "$BITNESS_OVERRIDE" = ""; then
3660             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3661             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3662                 # Prefer native x64 compiler to cross-compiler, in case we are running
3663                 # the build on a 64-bit OS.
3664                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3665                     BUILD_X64=TRUE
3666                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3667                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3668                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3669                     BUILD_X64=TRUE
3670                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3671                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3672                 fi
3673             fi
3674             if test "$BUILD_X64" = TRUE; then
3675                 AC_MSG_RESULT([found])
3676             else
3677                 AC_MSG_RESULT([not found])
3678                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3679             fi
3680         fi
3681         AC_SUBST(BUILD_X64)
3683         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3684         AC_SUBST(CXX_X64_BINARY)
3685         AC_SUBST(LINK_X64_BINARY)
3686     else
3687         AC_MSG_CHECKING([the compiler is MinGW])
3688         MACHINE_PREFIX=`$CC -dumpmachine`
3689         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3690             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3691             AC_MSG_RESULT([yes])
3692         else
3693             AC_MSG_ERROR([Compiler is not MinGW.])
3694         fi
3695     fi
3697 AC_SUBST(VCVER)
3698 PathFormat "$MSPDB_PATH"
3699 MSPDB_PATH="$formatted_path"
3700 AC_SUBST(SHOWINCLUDES_PREFIX)
3702 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3703     AC_MSG_CHECKING([whether to use DirectX])
3704     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3705         ENABLE_DIRECTX="TRUE"
3706         AC_MSG_RESULT([yes])
3707     else
3708         ENABLE_DIRECTX=""
3709         AC_MSG_RESULT([no])
3710     fi
3712     AC_MSG_CHECKING([whether to use ActiveX])
3713     if test "$enable_activex" = "yes" -o "$enable_activex" = "" -a "$vcexpress" != Express; then
3714         DISABLE_ACTIVEX=""
3715         AC_MSG_RESULT([yes])
3716     else
3717         DISABLE_ACTIVEX="TRUE"
3718         AC_MSG_RESULT([no])
3719     fi
3721     AC_MSG_CHECKING([whether to use ATL])
3722     if test "$enable_atl" = "yes" -o "$enable_atl" = "" -a "$vcexpress" != Express; then
3723         DISABLE_ATL=""
3724         AC_MSG_RESULT([yes])
3725     else
3726         DISABLE_ATL="TRUE"
3727         AC_MSG_RESULT([no])
3728     fi
3729 else
3730     ENABLE_DIRECTX=""
3731     DISABLE_ACTIVEX="TRUE"
3732     DISABLE_ATL="TRUE"
3735 AC_SUBST(ENABLE_DIRECTX)
3736 AC_SUBST(DISABLE_ACTIVEX)
3737 AC_SUBST(DISABLE_ATL)
3740 # dbghelp.dll
3742 if test "$_os" = "WINNT"; then
3743     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3747 # unowinreg.dll
3749 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3750 AC_SUBST(UNOWINREG_DLL)
3753 # prefix C with ccache if needed
3755 if test "$CCACHE" != ""; then
3756     AC_MSG_CHECKING([whether $CC is already ccached])
3758     AC_LANG_PUSH([C])
3759     save_CFLAGS=$CFLAGS
3760     CFLAGS="$CFLAGS --ccache-skip -O2"
3761     dnl an empty program will do, we're checking the compiler flags
3762     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3763                       [use_ccache=yes], [use_ccache=no])
3764     if test $use_ccache = yes; then
3765         AC_MSG_RESULT([yes])
3766     else
3767         CC="$CCACHE $CC"
3768         AC_MSG_RESULT([no])
3769     fi
3770     CFLAGS=$save_CFLAGS
3771     AC_LANG_POP([C])
3774 dnl Set the ENABLE_DBGUTIL variable
3775 dnl ===================================================================
3776 AC_MSG_CHECKING([whether to build with additional debug utilities])
3777 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3778     ENABLE_DBGUTIL="TRUE"
3779     # this is an extra var so it can have different default on different MSVC
3780     # versions (in case there are version specific problems with it)
3781     MSVC_USE_DEBUG_RUNTIME="TRUE"
3783     AC_MSG_RESULT([yes])
3784     # cppunit and graphite expose STL in public headers
3785     if test "$with_system_cppunit" = "yes"; then
3786         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3787     else
3788         with_system_cppunit=no
3789     fi
3790     if test "$with_system_graphite" = "yes"; then
3791         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3792     else
3793         with_system_graphite=no
3794     fi
3795     if test "$with_system_mysql_cppconn" = "yes"; then
3796         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3797     else
3798         with_system_mysql_cppconn=no
3799     fi
3800     if test "$with_system_orcus" = "yes"; then
3801         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3802     else
3803         with_system_orcus=no
3804     fi
3805     if test "$with_system_libcmis" = "yes"; then
3806         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3807     else
3808         with_system_libcmis=no
3809     fi
3810     if test "$with_system_libgltf" = "yes"; then
3811         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3812     else
3813         with_system_libgltf=no
3814     fi
3815     if test "$enable_win_mozab_driver" = "yes"; then
3816         AC_MSG_ERROR([--enable-win-mozab-driver conflicts with --enable-dbgutil])
3817     fi
3818 else
3819     ENABLE_DBGUTIL=""
3820     MSVC_USE_DEBUG_RUNTIME=""
3821     AC_MSG_RESULT([no])
3823 AC_SUBST(ENABLE_DBGUTIL)
3824 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3826 dnl Set the ENABLE_DEBUG variable.
3827 dnl ===================================================================
3828 AC_MSG_CHECKING([whether to do a debug build])
3829 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3830     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3832 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3833     AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3836 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3837     ENABLE_DEBUG="TRUE"
3838     if test -n "$ENABLE_DBGUTIL" ; then
3839         AC_MSG_RESULT([yes (dbgutil)])
3840     else
3841         AC_MSG_RESULT([yes])
3842     fi
3843 else
3844     ENABLE_DEBUG=""
3845     AC_MSG_RESULT([no])
3847 AC_SUBST(ENABLE_DEBUG)
3849 if test "$enable_sal_log" = yes; then
3850     ENABLE_SAL_LOG=TRUE
3852 AC_SUBST(ENABLE_SAL_LOG)
3854 dnl Selective debuginfo
3855 ENABLE_DEBUGINFO_FOR=
3856 if test -n "$ENABLE_DEBUG"; then
3857     AC_MSG_CHECKING([whether to use selective debuginfo])
3858     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3859         if test "$enable_selective_debuginfo" = "yes"; then
3860             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3861         fi
3862         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3863         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3864     else
3865         ENABLE_DEBUGINFO_FOR=all
3866         AC_MSG_RESULT([no, for all])
3867     fi
3869 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3871 dnl Check for enable symbols option
3872 dnl ===================================================================
3873 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3874 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3875     ENABLE_SYMBOLS="TRUE"
3876     if test -n "$ENABLE_DBGUTIL"; then
3877         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3878     elif test -n "$ENABLE_DEBUG"; then
3879         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3880     fi
3881     AC_MSG_RESULT([yes])
3882 else
3883     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3884         ENABLE_SYMBOLS="FALSE"
3885     else
3886         ENABLE_SYMBOLS=
3887     fi
3888     AC_MSG_RESULT([no])
3890 AC_SUBST(ENABLE_SYMBOLS)
3892 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3893     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3894     AC_MSG_CHECKING([whether enough memory is available for linking])
3895     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3896     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3897     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3898         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3899     else
3900         AC_MSG_RESULT([yes])
3901     fi
3904 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3905 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3906 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3907 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3908 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3909     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
3911 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
3913 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3914 # By default use the ones specified by our build system,
3915 # but explicit override is possible.
3916 AC_MSG_CHECKING(for explicit AFLAGS)
3917 if test -n "$AFLAGS"; then
3918     AC_MSG_RESULT([$AFLAGS])
3919     x_AFLAGS=
3920 else
3921     AC_MSG_RESULT(no)
3922     x_AFLAGS=[\#]
3924 AC_MSG_CHECKING(for explicit CFLAGS)
3925 if test -n "$CFLAGS"; then
3926     AC_MSG_RESULT([$CFLAGS])
3927     x_CFLAGS=
3928 else
3929     AC_MSG_RESULT(no)
3930     x_CFLAGS=[\#]
3932 AC_MSG_CHECKING(for explicit CXXFLAGS)
3933 if test -n "$CXXFLAGS"; then
3934     AC_MSG_RESULT([$CXXFLAGS])
3935     x_CXXFLAGS=
3936 else
3937     AC_MSG_RESULT(no)
3938     x_CXXFLAGS=[\#]
3940 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3941 if test -n "$OBJCFLAGS"; then
3942     AC_MSG_RESULT([$OBJCFLAGS])
3943     x_OBJCFLAGS=
3944 else
3945     AC_MSG_RESULT(no)
3946     x_OBJCFLAGS=[\#]
3948 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
3949 if test -n "$OBJCXXFLAGS"; then
3950     AC_MSG_RESULT([$OBJCXXFLAGS])
3951     x_OBJCXXFLAGS=
3952 else
3953     AC_MSG_RESULT(no)
3954     x_OBJCXXFLAGS=[\#]
3956 AC_MSG_CHECKING(for explicit LDFLAGS)
3957 if test -n "$LDFLAGS"; then
3958     AC_MSG_RESULT([$LDFLAGS])
3959     x_LDFLAGS=
3960 else
3961     AC_MSG_RESULT(no)
3962     x_LDFLAGS=[\#]
3964 AC_SUBST(AFLAGS)
3965 AC_SUBST(CFLAGS)
3966 AC_SUBST(CXXFLAGS)
3967 AC_SUBST(OBJCFLAGS)
3968 AC_SUBST(OBJCXXFLAGS)
3969 AC_SUBST(LDFLAGS)
3970 AC_SUBST(x_AFLAGS)
3971 AC_SUBST(x_CFLAGS)
3972 AC_SUBST(x_CXXFLAGS)
3973 AC_SUBST(x_OBJCFLAGS)
3974 AC_SUBST(x_OBJCXXFLAGS)
3975 AC_SUBST(x_LDFLAGS)
3978 # determine CPUNAME, GUIBASE, ...
3980 SOLARINC=
3982 case "$host_os" in
3984 aix*)
3985     COM=GCC
3986     CPUNAME=POWERPC
3987     GUIBASE=unx
3988     OS=AIX
3989     RTL_OS=AIX
3990     RTL_ARCH=PowerPC
3991     PLATFORMID=aix_powerpc
3992     P_SEP=:
3993     ;;
3995 cygwin*)
3996     COM=MSC
3997     GUIBASE=not-used
3998     OS=WNT
3999     RTL_OS=Windows
4000     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4001         P_SEP=";"
4002     else
4003         P_SEP=:
4004     fi
4005     case "$host_cpu" in
4006     i*86|x86_64)
4007         if test "$BITNESS_OVERRIDE" = 64; then
4008             CPUNAME=X86_64
4009             RTL_ARCH=X86_64
4010             PLATFORMID=windows_x86_64
4011             WINDOWS_X64=1
4012             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4013         else
4014             CPUNAME=INTEL
4015             RTL_ARCH=x86
4016             PLATFORMID=windows_x86
4017         fi
4018         ;;
4019     *)
4020         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4021         ;;
4022     esac
4023     SCPDEFS="$SCPDEFS -D_MSC_VER"
4024     ;;
4026 darwin*)
4027     COM=GCC
4028     GUIBASE=not-used
4029     OS=MACOSX
4030     RTL_OS=MacOSX
4031     P_SEP=:
4033     case "$host_cpu" in
4034     arm*)
4035         CPUNAME=ARM
4036         RTL_ARCH=ARM_EABI
4037         PLATFORMID=ios_arm
4038         OS=IOS
4039         ;;
4040     i*86)
4041         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4042         ;;
4043     x86_64)
4044         CPUNAME=X86_64
4045         RTL_ARCH=X86_64
4046         PLATFORMID=macosx_x86_64
4047         ;;
4048     *)
4049         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4050         ;;
4051     esac
4052     ;;
4054 dragonfly*)
4055     COM=GCC
4056     GUIBASE=unx
4057     OS=DRAGONFLY
4058     RTL_OS=DragonFly
4059     P_SEP=:
4061     case "$host_cpu" in
4062     i*86)
4063         CPUNAME=INTEL
4064         RTL_ARCH=x86
4065         PLATFORMID=dragonfly_x86
4066         ;;
4067     x86_64)
4068         CPUNAME=X86_64
4069         RTL_ARCH=X86_64
4070         PLATFORMID=dragonfly_x86_64
4071         ;;
4072     *)
4073         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4074         ;;
4075     esac
4076     ;;
4078 freebsd*)
4079     COM=GCC
4080     GUIBASE=unx
4081     RTL_OS=FreeBSD
4082     OS=FREEBSD
4083     P_SEP=:
4085     case "$host_cpu" in
4086     i*86)
4087         CPUNAME=INTEL
4088         RTL_ARCH=x86
4089         PLATFORMID=freebsd_x86
4090         ;;
4091     x86_64|amd64)
4092         CPUNAME=X86_64
4093         RTL_ARCH=X86_64
4094         PLATFORMID=freebsd_x86_64
4095         ;;
4096     *)
4097         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4098         ;;
4099     esac
4100     ;;
4102 kfreebsd*)
4103     COM=GCC
4104     GUIBASE=unx
4105     OS=LINUX
4106     RTL_OS=kFreeBSD
4107     P_SEP=:
4109     case "$host_cpu" in
4111     i*86)
4112         CPUNAME=INTEL
4113         RTL_ARCH=x86
4114         PLATFORMID=kfreebsd_x86
4115         ;;
4116     x86_64)
4117         CPUNAME=X86_64
4118         RTL_ARCH=X86_64
4119         PLATFORMID=kfreebsd_x86_64
4120         ;;
4121     *)
4122         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4123         ;;
4124     esac
4125     ;;
4127 linux-gnu*)
4128     COM=GCC
4129     GUIBASE=unx
4130     OS=LINUX
4131     RTL_OS=Linux
4132     P_SEP=:
4134     case "$host_cpu" in
4136     aarch64)
4137         CPUNAME=AARCH64
4138         PLATFORMID=linux_aarch64
4139         RTL_ARCH=AARCH64
4140         ;;
4141     alpha)
4142         CPUNAME=AXP
4143         RTL_ARCH=ALPHA
4144         PLATFORMID=linux_alpha
4145         ;;
4146     arm*)
4147         CPUNAME=ARM
4148         EPM_FLAGS="-a arm"
4149         RTL_ARCH=ARM_EABI
4150         PLATFORMID=linux_arm_eabi
4151         case "$host_cpu" in
4152         arm*-linux)
4153             RTL_ARCH=ARM_OABI
4154             PLATFORMID=linux_arm_oabi
4155             ;;
4156         esac
4157         ;;
4158     hppa)
4159         CPUNAME=HPPA
4160         RTL_ARCH=HPPA
4161         EPM_FLAGS="-a hppa"
4162         PLATFORMID=linux_hppa
4163         ;;
4164     i*86)
4165         CPUNAME=INTEL
4166         RTL_ARCH=x86
4167         PLATFORMID=linux_x86
4168         ;;
4169     ia64)
4170         CPUNAME=IA64
4171         RTL_ARCH=IA64
4172         PLATFORMID=linux_ia64
4173         ;;
4174     mips)
4175         CPUNAME=GODSON
4176         RTL_ARCH=MIPS_EB
4177         EPM_FLAGS="-a mips"
4178         PLATFORMID=linux_mips_eb
4179         ;;
4180     mips64)
4181         CPUNAME=GODSON
4182         RTL_ARCH=MIPS_EB
4183         EPM_FLAGS="-a mips64"
4184         PLATFORMID=linux_mips_eb
4185         ;;
4186     mips64el)
4187         CPUNAME=GODSON
4188         RTL_ARCH=MIPS_EL
4189         EPM_FLAGS="-a mips64el"
4190         PLATFORMID=linux_mips_el
4191         ;;
4192     mipsel)
4193         CPUNAME=GODSON
4194         RTL_ARCH=MIPS_EL
4195         EPM_FLAGS="-a mipsel"
4196         PLATFORMID=linux_mips_el
4197         ;;
4198     m68k)
4199         CPUNAME=M68K
4200         RTL_ARCH=M68K
4201         PLATFORMID=linux_m68k
4202         ;;
4203     powerpc)
4204         CPUNAME=POWERPC
4205         RTL_ARCH=PowerPC
4206         PLATFORMID=linux_powerpc
4207         ;;
4208     powerpc64)
4209         CPUNAME=POWERPC64
4210         RTL_ARCH=PowerPC_64
4211         PLATFORMID=linux_powerpc64
4212         ;;
4213     powerpc64le)
4214         CPUNAME=POWERPC64
4215         RTL_ARCH=PowerPC_64_LE
4216         PLATFORMID=linux_powerpc64_le
4217         ;;
4218     sparc)
4219         CPUNAME=SPARC
4220         RTL_ARCH=SPARC
4221         PLATFORMID=linux_sparc
4222         ;;
4223     s390)
4224         CPUNAME=S390
4225         RTL_ARCH=S390
4226         PLATFORMID=linux_s390
4227         ;;
4228     s390x)
4229         CPUNAME=S390X
4230         RTL_ARCH=S390x
4231         PLATFORMID=linux_s390x
4232         ;;
4233     x86_64)
4234         CPUNAME=X86_64
4235         RTL_ARCH=X86_64
4236         PLATFORMID=linux_x86_64
4237         ;;
4238     *)
4239         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4240         ;;
4241     esac
4242     ;;
4244 linux-android*)
4245     COM=GCC
4246     GUIBASE=not-used
4247     OS=ANDROID
4248     RTL_OS=Android
4249     P_SEP=:
4251     case "$host_cpu" in
4253     arm|armel)
4254         CPUNAME=ARM
4255         RTL_ARCH=ARM_EABI
4256         PLATFORMID=android_arm_eabi
4257         ;;
4258     aarch64)
4259         CPUNAME=AARCH64
4260         RTL_ARCH=AARCH64
4261         PLATFORMID=android_aarch64
4262         ;;
4263     mips|mipsel)
4264         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4265         RTL_ARCH=MIPS_EL
4266         PLATFORMID=android_mips_el
4267         ;;
4268     i*86)
4269         CPUNAME=INTEL
4270         RTL_ARCH=x86
4271         PLATFORMID=android_x86
4272         ;;
4273     *)
4274         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4275         ;;
4276     esac
4277     ;;
4279 mingw*)
4280     COM=GCC
4281     GUIBASE=not-used
4282     OS=WNT
4283     RTL_OS=Windows
4284     P_SEP=:
4286     case "$host_cpu" in
4287     i*86|x86_64)
4288         if test "$BITNESS_OVERRIDE" = 64; then
4289             CPUNAME=X86_64
4290             RTL_ARCH=X86_84
4291             PLATFORMID=windows_x86_64
4292             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4293         else
4294             CPUNAME=INTEL
4295             RTL_ARCH=x86
4296             PLATFORMID=windows_x86
4297             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4298         fi
4299         ;;
4300     *)
4301         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4302         ;;
4303     esac
4304     ;;
4306 *netbsd*)
4308     COM=GCC
4309     GUIBASE=unx
4310     OS=NETBSD
4311     RTL_OS=NetBSD
4312     P_SEP=:
4314     case "$host_cpu" in
4315     i*86)
4316         CPUNAME=INTEL
4317         RTL_ARCH=x86
4318         PLATFORMID=netbsd_x86
4319         ;;
4320     powerpc)
4321         CPUNAME=POWERPC
4322         RTL_ARCH=PowerPC
4323         PLATFORMID=netbsd_powerpc
4324         ;;
4325     sparc)
4326         CPUNAME=SPARC
4327         RTL_ARCH=SPARC
4328         PLATFORMID=netbsd_sparc
4329         ;;
4330     x86_64)
4331         CPUNAME=X86_64
4332         RTL_ARCH=X86_64
4333         PLATFORMID=netbsd_x86_64
4334         ;;
4335     *)
4336         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4337         ;;
4338     esac
4339     ;;
4341 openbsd*)
4342     COM=GCC
4343     GUIBASE=unx
4344     OS=OPENBSD
4345     RTL_OS=OpenBSD
4346     P_SEP=:
4348     case "$host_cpu" in
4349     i*86)
4350         CPUNAME=INTEL
4351         RTL_ARCH=x86
4352         PLATFORMID=openbsd_x86
4353         ;;
4354     x86_64)
4355         CPUNAME=X86_64
4356         RTL_ARCH=X86_64
4357         PLATFORMID=openbsd_x86_64
4358         ;;
4359     *)
4360         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4361         ;;
4362     esac
4363     SOLARINC="$SOLARINC -I/usr/local/include"
4364     ;;
4366 solaris*)
4368     COM=GCC
4369     GUIBASE=unx
4370     OS=SOLARIS
4371     RTL_OS=Solaris
4372     P_SEP=:
4374     case "$host_cpu" in
4375     i*86)
4376         CPUNAME=INTEL
4377         RTL_ARCH=x86
4378         PLATFORMID=solaris_x86
4379         ;;
4380     sparc)
4381         CPUNAME=SPARC
4382         RTL_ARCH=SPARC
4383         PLATFORMID=solaris_sparc
4384         ;;
4385     sparc64)
4386         CPUNAME=SPARC64
4387         RTL_ARCH=SPARC64
4388         PLATFORMID=solaris_sparc64
4389         ;;
4390     *)
4391         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4392         ;;
4393     esac
4394     SOLARINC="$SOLARINC -I/usr/local/include"
4395     ;;
4398     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4399     ;;
4400 esac
4402 if test "$with_x" = "no"; then
4403     if test "$GUIBASE" != "unx"; then
4404         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --without-x])
4405     fi
4406     GUIBASE=not-used
4409 WORKDIR="${BUILDDIR}/workdir"
4410 INSTDIR="${BUILDDIR}/instdir"
4411 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4412 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4413 AC_SUBST(COM)
4414 AC_SUBST(CPUNAME)
4415 AC_SUBST(RTL_OS)
4416 AC_SUBST(RTL_ARCH)
4417 AC_SUBST(EPM_FLAGS)
4418 AC_SUBST(GUIBASE)
4419 AC_SUBST([INSTDIR])
4420 AC_SUBST([INSTROOT])
4421 AC_SUBST(OS)
4422 AC_SUBST(P_SEP)
4423 AC_SUBST(WORKDIR)
4424 AC_SUBST(PLATFORMID)
4425 AC_SUBST(WINDOWS_X64)
4426 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4428 dnl ===================================================================
4429 dnl Test which package format to use
4430 dnl ===================================================================
4431 AC_MSG_CHECKING([which package format to use])
4432 if test -n "$with_package_format" -a "$with_package_format" != no; then
4433     for i in $with_package_format; do
4434         case "$i" in
4435         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4436             ;;
4437         *)
4438             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4439 aix - AIX software distribution
4440 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4441 deb - Debian software distribution
4442 pkg - Solaris software distribution
4443 rpm - RedHat software distribution
4445 LibreOffice additionally supports:
4446 archive - .tar.gz or .zip
4447 dmg - Mac OS X .dmg
4448 installed - installation tree
4449 msi - Windows .msi
4450         ])
4451             ;;
4452         esac
4453     done
4454     PKGFORMAT="$with_package_format"
4455     AC_MSG_RESULT([$PKGFORMAT])
4456 else
4457     PKGFORMAT=
4458     AC_MSG_RESULT([none])
4460 AC_SUBST(PKGFORMAT)
4462 dnl ===================================================================
4463 dnl Set up a different compiler to produce tools to run on the build
4464 dnl machine when doing cross-compilation
4465 dnl ===================================================================
4467 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4468 if test "$cross_compiling" = "yes"; then
4469     AC_MSG_CHECKING([for BUILD platform configuration])
4470     echo
4471     rm -rf CONF-FOR-BUILD config_build.mk
4472     mkdir CONF-FOR-BUILD
4473     # Here must be listed all files needed when running the configure script. In particular, also
4474     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4475     # keep them in the same order as there.
4476     (cd $SRC_ROOT && tar cf - \
4477         config.guess \
4478         bin/get_config_variables \
4479         solenv/bin/getcompver.awk \
4480         solenv/inc/langlist.mk \
4481         config_host.mk.in \
4482         config_host_lang.mk.in \
4483         Makefile.in \
4484         lo.xcent.in \
4485         instsetoo_native/util/openoffice.lst.in \
4486         config_host/*.in \
4487         sysui/desktop/macosx/Info.plist.in \
4488         ios/lo.xcconfig.in) \
4489     | (cd CONF-FOR-BUILD && tar xf -)
4490     cp configure CONF-FOR-BUILD
4491     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4492     (
4493     unset COM GUIBASE OS CPUNAME
4494     unset CC CXX SYSBASE CFLAGS
4495     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4496     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4497     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4498     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4499     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4500     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4501     cd CONF-FOR-BUILD
4502     sub_conf_opts=""
4503     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4504     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4505     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4506     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4507     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4508     # we need the msi build tools on mingw if we are creating the
4509     # installation set
4510     if test "$WITH_MINGW" = "yes"; then
4511         enable_winegcc_for_build=
4512         for pkgformat in $PKGFORMAT; do
4513             case "$pkgformat" in
4514             msi|native) enable_winegcc_for_build=yes ;;
4515             esac
4516         done
4517         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4518     fi
4519     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4520     # Don't bother having configure look for stuff not needed for the build platform anyway
4521     ./configure \
4522         --disable-cups \
4523         --disable-graphite \
4524         --disable-pdfimport \
4525         --disable-postgresql-sdbc \
4526         --with-parallelism="$with_parallelism" \
4527         --without-doxygen \
4528         --without-java \
4529         $sub_conf_opts \
4530         --srcdir=$srcdir \
4531         2>&1 | sed -e 's/^/    /'
4532     test -f ./config_host.mk 2>/dev/null || exit
4533     cp config_host.mk ../config_build.mk
4534     cp config_host_lang.mk ../config_build_lang.mk
4535     mv config.log ../config.Build.log
4536     mkdir -p ../config_build
4537     mv config_host/*.h ../config_build
4538     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT WORKDIR
4540     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
4541         VV='$'$V
4542         VV=`eval "echo $VV"`
4543         if test -n "$VV"; then
4544             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4545             echo "$line" >>build-config
4546         fi
4547     done
4549     for V in INSTDIR INSTROOT WORKDIR; do
4550         VV='$'$V
4551         VV=`eval "echo $VV"`
4552         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4553         if test -n "$VV"; then
4554             line="${V}_FOR_BUILD='$VV'"
4555             echo "$line" >>build-config
4556         fi
4557     done
4559     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4560     echo "$line" >>build-config
4562     )
4563     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4564     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])
4565     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4566              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4568     eval `cat CONF-FOR-BUILD/build-config`
4570     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4572     rm -rf CONF-FOR-BUILD
4573 else
4574     OS_FOR_BUILD="$OS"
4575     CC_FOR_BUILD="$CC"
4576     CXX_FOR_BUILD="$CXX"
4577     INSTDIR_FOR_BUILD="$INSTDIR"
4578     INSTROOT_FOR_BUILD="$INSTROOT"
4579     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4580     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4581     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4582     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4583     WORKDIR_FOR_BUILD="$WORKDIR"
4585 AC_SUBST(OS_FOR_BUILD)
4586 AC_SUBST(INSTDIR_FOR_BUILD)
4587 AC_SUBST(INSTROOT_FOR_BUILD)
4588 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4589 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4590 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4591 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4592 AC_SUBST(WORKDIR_FOR_BUILD)
4594 dnl ===================================================================
4595 dnl Check for syslog header
4596 dnl ===================================================================
4597 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4599 # placeholder for future crash reporter feature
4600 ENABLE_CRASHDUMP=""
4601 AC_SUBST(ENABLE_CRASHDUMP)
4603 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4604 dnl ===================================================================
4605 AC_MSG_CHECKING([whether to turn warnings to errors])
4606 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4607     ENABLE_WERROR="TRUE"
4608     AC_MSG_RESULT([yes])
4609 else
4610     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4611         ENABLE_WERROR="TRUE"
4612         AC_MSG_RESULT([yes])
4613     else
4614         AC_MSG_RESULT([no])
4615     fi
4617 AC_SUBST(ENABLE_WERROR)
4619 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4620 dnl ===================================================================
4621 AC_MSG_CHECKING([whether to have assert to abort in release code])
4622 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4623     ASSERT_ALWAYS_ABORT="TRUE"
4624     AC_MSG_RESULT([yes])
4625 else
4626     ASSERT_ALWAYS_ABORT="FALSE"
4627     AC_MSG_RESULT([no])
4629 AC_SUBST(ASSERT_ALWAYS_ABORT)
4631 # Determine whether to use ooenv for the instdir installation
4632 # ===================================================================
4633 if test $_os != "WINNT" -a $_os != "Darwin"; then
4634     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4635     if test "$enable_ooenv" = "no"; then
4636         AC_MSG_RESULT([no])
4637     else
4638         ENABLE_OOENV="TRUE"
4639         AC_MSG_RESULT([yes])
4640     fi
4642 AC_SUBST(ENABLE_OOENV)
4644 if test "$with_x" = "no"; then
4645     # be sure to do not mess with uneeded stuff
4646     test_randr=no
4647     test_xrender=no
4648     test_cups=no
4649     test_dbus=no
4650     test_fontconfig=yes
4651     test_gtk=no
4652     build_gstreamer_1_0=no
4653     build_gstreamer_0_10=no
4654     test_tde=no
4655     test_kde=no
4656     test_kde4=no
4657     enable_cairo_canvas=no
4658     enable_gnome_vfs=no
4661 dnl ===================================================================
4662 dnl check for cups support
4663 dnl ===================================================================
4664 ENABLE_CUPS=""
4666 if test "$enable_cups" = "no"; then
4667     test_cups=no
4670 AC_MSG_CHECKING([whether to enable CUPS support])
4671 if test "$test_cups" = "yes"; then
4672     ENABLE_CUPS="TRUE"
4673     AC_MSG_RESULT([yes])
4675     AC_MSG_CHECKING([whether cups support is present])
4676     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4677     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4678     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4679         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4680     fi
4681     AC_DEFINE(ENABLE_CUPS)
4682 else
4683     AC_MSG_RESULT([no])
4686 AC_SUBST(ENABLE_CUPS)
4688 # fontconfig checks
4689 if test "$test_fontconfig" = "yes"; then
4690     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4691     SYSTEM_FONTCONFIG=TRUE
4693 AC_SUBST(FONTCONFIG_CFLAGS)
4694 AC_SUBST(FONTCONFIG_LIBS)
4695 AC_SUBST([SYSTEM_FONTCONFIG])
4697 dnl whether to find & fetch external tarballs?
4698 dnl ===================================================================
4699 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4700    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4701        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4702    else
4703        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4704    fi
4706 if test -z "$TARFILE_LOCATION"; then
4707     if test -d "$SRC_ROOT/src" ; then
4708         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4709         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4710     fi
4711     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4712 else
4713     AbsolutePath "$TARFILE_LOCATION"
4714     PathFormat "${absolute_path}"
4715     TARFILE_LOCATION="${formatted_path}"
4717 AC_SUBST(TARFILE_LOCATION)
4719 AC_MSG_CHECKING([whether we want to fetch tarballs])
4720 if test "$enable_fetch_external" != "no"; then
4721     if test "$with_all_tarballs" = "yes"; then
4722         AC_MSG_RESULT(["yes, all of them"])
4723         DO_FETCH_TARBALLS="ALL"
4724     else
4725         AC_MSG_RESULT(["yes, if we use them"])
4726         DO_FETCH_TARBALLS="TRUE"
4727     fi
4728 else
4729     AC_MSG_RESULT([no])
4730     DO_FETCH_TARBALLS=
4732 AC_SUBST(DO_FETCH_TARBALLS)
4734 AC_MSG_CHECKING([whether to build help])
4735 HELP_COMMON_ONLY=FALSE
4736 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4737     BUILD_TYPE="$BUILD_TYPE HELP"
4738     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4739     if test "$with_help" = "common" ; then
4740         HELP_COMMON_ONLY=TRUE
4741         AC_MSG_RESULT([common only])
4742     else
4743         SCPDEFS="$SCPDEFS -DWITH_HELP"
4744         AC_MSG_RESULT([yes])
4745     fi
4746 else
4747     AC_MSG_RESULT([no])
4749 AC_SUBST(HELP_COMMON_ONLY)
4751 dnl Test whether to include MySpell dictionaries
4752 dnl ===================================================================
4753 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4754 if test "$with_myspell_dicts" = "yes"; then
4755     AC_MSG_RESULT([yes])
4756     WITH_MYSPELL_DICTS=TRUE
4757     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4758     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4759 else
4760     AC_MSG_RESULT([no])
4761     WITH_MYSPELL_DICTS=
4763 AC_SUBST(WITH_MYSPELL_DICTS)
4765 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4766 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4767     if test "$with_system_dicts" = yes; then
4768         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4769     fi
4770     with_system_dicts=no
4773 AC_MSG_CHECKING([whether to use dicts from external paths])
4774 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4775     AC_MSG_RESULT([yes])
4776     SYSTEM_DICTS=TRUE
4777     AC_MSG_CHECKING([for spelling dictionary directory])
4778     if test -n "$with_external_dict_dir"; then
4779         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4780     else
4781         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4782         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4783             DICT_SYSTEM_DIR=file:///usr/share/myspell
4784         fi
4785     fi
4786     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4787     AC_MSG_CHECKING([for hyphenation patterns directory])
4788     if test -n "$with_external_hyph_dir"; then
4789         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4790     else
4791         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4792     fi
4793     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4794     AC_MSG_CHECKING([for thesaurus directory])
4795     if test -n "$with_external_thes_dir"; then
4796         THES_SYSTEM_DIR=file://$with_external_thes_dir
4797     else
4798         THES_SYSTEM_DIR=file:///usr/share/mythes
4799     fi
4800     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4801 else
4802     AC_MSG_RESULT([no])
4803     SYSTEM_DICTS=
4805 AC_SUBST(SYSTEM_DICTS)
4806 AC_SUBST(DICT_SYSTEM_DIR)
4807 AC_SUBST(HYPH_SYSTEM_DIR)
4808 AC_SUBST(THES_SYSTEM_DIR)
4810 dnl ===================================================================
4811 dnl enable pch by default on windows
4812 dnl enable it explicitely otherwise
4813 AC_MSG_CHECKING([whether to enable pch feature])
4814 ENABLE_PCH=""
4815 if test "$enable_pch" != "no"; then
4816     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4817         ENABLE_PCH="TRUE"
4818         AC_MSG_RESULT([yes])
4819     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4820         ENABLE_PCH="TRUE"
4821         AC_MSG_RESULT([yes])
4822     elif test -n "$enable_pch"; then
4823         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4824     else
4825         AC_MSG_RESULT([no])
4826     fi
4827 else
4828     AC_MSG_RESULT([no])
4830 AC_SUBST(ENABLE_PCH)
4832 TAB=`printf '\t'`
4834 AC_MSG_CHECKING([the GNU Make version])
4835 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4836 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4837 if test "$_make_longver" -ge "038200"; then
4838     AC_MSG_RESULT([$GNUMAKE $_make_version])
4840 elif test "$_make_longver" -ge "038100"; then
4841     if test "$build_os" = "cygwin"; then
4842         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4843     fi
4844     AC_MSG_RESULT([$GNUMAKE $_make_version])
4846     dnl ===================================================================
4847     dnl Search all the common names for sha1sum
4848     dnl ===================================================================
4849     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4850     if test -z "$SHA1SUM"; then
4851         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4852     elif test "$SHA1SUM" = "openssl"; then
4853         SHA1SUM="openssl sha1"
4854     fi
4855     AC_MSG_CHECKING([for GNU Make bug 20033])
4856     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4857     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4858 A := \$(wildcard *.a)
4860 .PHONY: all
4861 all: \$(A:.a=.b)
4862 <TAB>@echo survived bug20033.
4864 .PHONY: setup
4865 setup:
4866 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4868 define d1
4869 @echo lala \$(1)
4870 @sleep 1
4871 endef
4873 define d2
4874 @echo tyty \$(1)
4875 @sleep 1
4876 endef
4878 %.b : %.a
4879 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4880 <TAB>\$(call d1,\$(CHECKSUM)),\
4881 <TAB>\$(call d2,\$(CHECKSUM)))
4883     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4884         no_parallelism_make="YES"
4885         AC_MSG_RESULT([yes, disable parallelism])
4886     else
4887         AC_MSG_RESULT([no, keep parallelism enabled])
4888     fi
4889     rm -rf $TESTGMAKEBUG20033
4890 else
4891     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4894 # find if gnumake support file function
4895 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4896 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4897 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4898     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4900 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4901 \$(file >test.txt,Success )
4903 .PHONY: all
4904 all:
4905 <TAB>@cat test.txt
4908 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4909 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4910     HAVE_GNUMAKE_FILE_FUNC=TRUE
4911     AC_MSG_RESULT([yes])
4912 else
4913     AC_MSG_RESULT([no])
4915 rm -rf $TESTGMAKEFILEFUNC
4916 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4917 AC_SUBST(GNUMAKE_WIN_NATIVE)
4919 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4920 STALE_MAKE=
4921 if test "$_make_ver_check" = ""; then
4922    STALE_MAKE=TRUE
4925 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4926     SHELL_BASH=$(cygpath -m $(which bash))
4927 else
4928     SHELL_BASH=`which bash`
4930 AC_SUBST(SHELL_BASH)
4932 HAVE_LD_HASH_STYLE=FALSE
4933 WITH_LINKER_HASH_STYLE=
4934 AC_MSG_CHECKING( for --hash-style gcc linker support )
4935 if test "$GCC" = "yes"; then
4936     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4937         hash_styles="gnu sysv"
4938     elif test "$with_linker_hash_style" = "no"; then
4939         hash_styles=
4940     else
4941         hash_styles="$with_linker_hash_style"
4942     fi
4944     for hash_style in $hash_styles; do
4945         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4946         hash_style_ldflags_save=$LDFLAGS
4947         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4949         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4950             [
4951 #include <stdio.h>
4952             ],[
4953 printf ("");
4954             ])],
4955             [
4956                   HAVE_LD_HASH_STYLE=TRUE
4957                   WITH_LINKER_HASH_STYLE=$hash_style
4958             ],
4959             [HAVE_LD_HASH_STYLE=FALSE],
4960             [HAVE_LD_HASH_STYLE=FALSE])
4961         LDFLAGS=$hash_style_ldflags_save
4962     done
4964     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4965         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4966     else
4967         AC_MSG_RESULT( no )
4968     fi
4969     LDFLAGS=$hash_style_ldflags_save
4970 else
4971     AC_MSG_RESULT( no )
4973 AC_SUBST(HAVE_LD_HASH_STYLE)
4974 AC_SUBST(WITH_LINKER_HASH_STYLE)
4976 dnl ===================================================================
4977 dnl Check whether there's a Perl version available.
4978 dnl ===================================================================
4979 if test -z "$with_perl_home"; then
4980     AC_PATH_PROG(PERL, perl)
4981 else
4982     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4983     _perl_path="$with_perl_home/bin/perl"
4984     if test -x "$_perl_path"; then
4985         PERL=$_perl_path
4986     else
4987         AC_MSG_ERROR([$_perl_path not found])
4988     fi
4991 dnl ===================================================================
4992 dnl Testing for Perl version 5 or greater.
4993 dnl $] is the Perl version variable, it is returned as an integer
4994 dnl ===================================================================
4995 if test "$PERL"; then
4996     AC_MSG_CHECKING([the Perl version])
4997     ${PERL} -e "exit($]);"
4998     _perl_version=$?
4999     if test "$_perl_version" -lt 5; then
5000         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5001     fi
5002     AC_MSG_RESULT([checked (perl $_perl_version)])
5003 else
5004     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5007 dnl ===================================================================
5008 dnl Testing for required Perl modules
5009 dnl ===================================================================
5011 AC_MSG_CHECKING([for required Perl modules])
5012 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5013     AC_MSG_RESULT([all modules found])
5014 else
5015     AC_MSG_RESULT([failed to find some modules])
5016     # Find out which modules are missing.
5017     missing_perl_modules=
5018     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
5019         missing_perl_modules=Archive::Zip
5020     fi
5021     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5022         missing_perl_modules="$missing_perl_modules Cwd"
5023     fi
5024     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5025         missing_perl_modules="$missing_perl_modules Digest::MD5"
5026     fi
5027        AC_MSG_ERROR([
5028     The missing Perl modules are: $missing_perl_modules
5029     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5032 dnl ===================================================================
5033 dnl Check for pkg-config
5034 dnl ===================================================================
5035 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5036     PKG_PROG_PKG_CONFIG
5039 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5041     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5042     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5043     # explicitly. Or put /path/to/compiler in PATH yourself.
5045     AC_CHECK_TOOL(AR,ar)
5046     AC_CHECK_TOOL(NM,nm)
5047     AC_CHECK_TOOL(OBJDUMP,objdump)
5048     AC_CHECK_TOOL(RANLIB,ranlib)
5049     AC_CHECK_TOOL(READELF,readelf)
5050     AC_CHECK_TOOL(STRIP,strip)
5051     if test "$_os" = "WINNT"; then
5052         AC_CHECK_TOOL(DLLTOOL,dlltool)
5053         AC_CHECK_TOOL(WINDRES,windres)
5054     fi
5056 AC_SUBST(AR)
5057 AC_SUBST(DLLTOOL)
5058 AC_SUBST(NM)
5059 AC_SUBST(OBJDUMP)
5060 AC_SUBST(PKG_CONFIG)
5061 AC_SUBST(RANLIB)
5062 AC_SUBST(READELF)
5063 AC_SUBST(STRIP)
5064 AC_SUBST(WINDRES)
5066 dnl ===================================================================
5067 dnl pkg-config checks on Mac OS X
5068 dnl ===================================================================
5070 if test $_os = Darwin; then
5071     AC_MSG_CHECKING([for bogus pkg-config])
5072     if test -n "$PKG_CONFIG"; then
5073         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5074             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5075         else
5076             if test "$enable_bogus_pkg_config" = "yes"; then
5077                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5078             else
5079                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
5080             fi
5081         fi
5082     else
5083         AC_MSG_RESULT([no, good])
5084     fi
5087 find_csc()
5089     # Return value: $csctest
5091     unset csctest
5093     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5094     if test -n "$regvalue"; then
5095         csctest=$regvalue
5096         return
5097     fi
5100 find_al()
5102     # Return value: $altest
5104     unset altest
5106     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5107         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5108         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5109             altest=$regvalue
5110             return
5111         fi
5112     done
5115 find_dotnetsdk()
5117     # Return value: $frametest (that's a silly name...)
5119     unset frametest
5121     for ver in 1.1 2.0; do
5122         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5123         if test -n "$regvalue"; then
5124             frametest=$regvalue
5125             return
5126         fi
5127     done
5130 find_winsdk_version()
5132     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5133     # Return values: $winsdktest, $winsdklibsubdir
5135     unset winsdktest winsdklibsubdir
5137     # Why we look for them in this particular order I don't know. But OTOH I
5138     case "$1" in
5139     7.*)
5140         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5141         if test -n "$regvalue"; then
5142             winsdktest=$regvalue
5143             winsdklibsubdir=.
5144             return
5145         fi
5146         ;;
5147     8.1|8.1A)
5148         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5149         if test -n "$regvalue"; then
5150             winsdktest=$regvalue
5151             winsdklibsubdir=winv6.3
5152             return
5153         fi
5154         ;;
5155     8.0|8.0A)
5156         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5157         if test -n "$regvalue"; then
5158             winsdktest=$regvalue
5159             winsdklibsubdir=win8
5160             return
5161         fi
5162         ;;
5163     esac
5166 find_winsdk()
5168     # Args: $1 (optional) : list of acceptable SDK versions
5169     # Return value: $winsdktest
5171     unset winsdktest
5173     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5174         find_winsdk_version $ver
5175         if test -n "$winsdktest"; then
5176             return
5177         fi
5178     done
5181 find_msms()
5183     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5184     AC_MSG_CHECKING([for $my_msm_file])
5185     msmdir=
5186     for ver in 12.0; do
5187         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5188         if test -n "$regvalue"; then
5189             if test -e "$regvalue/$my_msm_file"; then
5190                 msmdir=$regvalue
5191                 break
5192             fi
5193         fi
5194     done
5195     dnl Is the following fallback really necessary, or was it added in response
5196     dnl to never having started Visual Studio on a given machine, so the
5197     dnl registry keys checked above had presumably not yet been created?
5198     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5199     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5200     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5201     dnl expanding to "C:\Program Files\Common Files"), which would need
5202     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5203     dnl obtain its value from cygwin:
5204     if test -z "$msmdir"; then
5205         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules"
5206         if test -e "$my_msm_dir/$my_msm_file"; then
5207             msmdir=$my_msm_dir
5208         fi
5209     fi
5210     if test -n "$msmdir"; then
5211         msmdir=`cygpath -m "$msmdir"`
5212         AC_MSG_RESULT([$msmdir])
5213     else
5214         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5215             AC_MSG_ERROR([not found])
5216         else
5217             AC_MSG_WARN([not found])
5218         fi
5219     fi
5222 find_msvc_x64_dlls()
5224     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5225     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5226     for dll in $msvcdlls; do
5227         if ! test -f "$msvcdllpath/$dll"; then
5228             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5229         fi
5230     done
5233 if test "$build_os" = "cygwin"; then
5234     dnl Check midl.exe
5235     AC_MSG_CHECKING([for midl.exe])
5237     find_winsdk
5238     if test -f "$winsdktest/Bin/midl.exe"; then
5239         MIDL_PATH="$winsdktest/Bin"
5240     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5241         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5242     fi
5243     if test ! -f "$MIDL_PATH/midl.exe"; then
5244         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5245     else
5246         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5247     fi
5249     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5250     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5252     dnl Check csc.exe
5253     AC_MSG_CHECKING([for csc.exe])
5254     find_csc
5255     if test -f "$csctest/csc.exe"; then
5256         CSC_PATH="$csctest"
5257     fi
5258     if test ! -f "$CSC_PATH/csc.exe"; then
5259         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5260     else
5261         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5262     fi
5264     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5266     dnl Check al.exe
5267     AC_MSG_CHECKING([for al.exe])
5268     find_winsdk
5269     if test -f "$winsdktest/Bin/al.exe"; then
5270         AL_PATH="$winsdktest/Bin"
5271     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5272         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5273     fi
5275     if test -z "$AL_PATH"; then
5276         find_al
5277         if test -f "$altest/bin/al.exe"; then
5278             AL_PATH="$altest/bin"
5279         elif test -f "$altest/al.exe"; then
5280             AL_PATH="$altest"
5281         fi
5282     fi
5283     if test ! -f "$AL_PATH/al.exe"; then
5284         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5285     else
5286         AC_MSG_RESULT([$AL_PATH/al.exe])
5287     fi
5289     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5291     dnl Check mscoree.lib / .NET Framework dir
5292     AC_MSG_CHECKING(.NET Framework)
5293     find_dotnetsdk
5294     if test -f "$frametest/lib/mscoree.lib"; then
5295         DOTNET_FRAMEWORK_HOME="$frametest"
5296     else
5297         find_winsdk
5298         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5299             DOTNET_FRAMEWORK_HOME="$winsdktest"
5300         fi
5301     fi
5303     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5304         AC_MSG_ERROR([mscoree.lib not found])
5305     fi
5306     AC_MSG_RESULT(found)
5308     PathFormat "$MIDL_PATH"
5309     MIDL_PATH="$formatted_path"
5311     PathFormat "$AL_PATH"
5312     AL_PATH="$formatted_path"
5314     PathFormat "$DOTNET_FRAMEWORK_HOME"
5315     DOTNET_FRAMEWORK_HOME="$formatted_path"
5317     PathFormat "$CSC_PATH"
5318     CSC_PATH="$formatted_path"
5321 dnl ===================================================================
5322 dnl Check if stdc headers are available excluding MSVC.
5323 dnl ===================================================================
5324 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5325     AC_HEADER_STDC
5328 dnl ===================================================================
5329 dnl Testing for C++ compiler and version...
5330 dnl ===================================================================
5332 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5333     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5334     save_CXXFLAGS=$CXXFLAGS
5335     AC_PROG_CXX
5336     CXXFLAGS=$save_CXXFLAGS
5337 else
5338     if test -n "$CC" -a -z "$CXX"; then
5339         CXX="$CC"
5340     fi
5343 dnl check for GNU C++ compiler version
5344 if test "$GXX" = "yes"; then
5345     AC_MSG_CHECKING([the GNU C++ compiler version])
5347     _gpp_version=`$CXX -dumpversion`
5348     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5350     if test "$_gpp_majmin" -lt "401"; then
5351         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5352     else
5353         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5354     fi
5356     dnl see https://code.google.com/p/android/issues/detail?id=41770
5357     if test "$_gpp_majmin" -ge "401"; then
5358         glibcxx_threads=no
5359         AC_LANG_PUSH([C++])
5360         AC_REQUIRE_CPP
5361         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5362         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5363             #include <bits/c++config.h>]],[[
5364             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5365             && !defined(_GLIBCXX__PTHREADS) \
5366             && !defined(_GLIBCXX_HAS_GTHREADS)
5367             choke me
5368             #endif
5369         ]])],[AC_MSG_RESULT([yes])
5370         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5371         AC_LANG_POP([C++])
5372         if test $glibcxx_threads = yes; then
5373             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5374         fi
5375      fi
5377 AC_SUBST(BOOST_CXXFLAGS)
5380 # prefx CXX with ccache if needed
5382 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5383     if test "$CCACHE" != ""; then
5384         AC_MSG_CHECKING([whether $CXX is already ccached])
5385         AC_LANG_PUSH([C++])
5386         save_CXXFLAGS=$CXXFLAGS
5387         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5388         dnl an empty program will do, we're checking the compiler flags
5389         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5390                           [use_ccache=yes], [use_ccache=no])
5391         if test $use_ccache = yes; then
5392             AC_MSG_RESULT([yes])
5393         else
5394             CXX="$CCACHE $CXX"
5395             AC_MSG_RESULT([no])
5396         fi
5397         CXXFLAGS=$save_CXXFLAGS
5398         AC_LANG_POP([C++])
5399     fi
5402 dnl ===================================================================
5403 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5404 dnl ===================================================================
5406 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5407     AC_PROG_CXXCPP
5409     dnl Check whether there's a C pre-processor.
5410     AC_PROG_CPP
5414 dnl ===================================================================
5415 dnl Find integral type sizes and alignments
5416 dnl ===================================================================
5418 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5420     AC_CHECK_SIZEOF(long)
5421     AC_CHECK_SIZEOF(short)
5422     AC_CHECK_SIZEOF(int)
5423     AC_CHECK_SIZEOF(long long)
5424     AC_CHECK_SIZEOF(double)
5425     AC_CHECK_SIZEOF(void*)
5427     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5428     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5429     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5430     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5431     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5433     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5434     m4_pattern_allow([AC_CHECK_ALIGNOF])
5435     m4_ifdef([AC_CHECK_ALIGNOF],
5436         [
5437             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5438             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5439             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5440             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5441         ],
5442         [
5443             case "$_os-$host_cpu" in
5444             Linux-i686)
5445                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5446                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5447                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5448                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5449                 ;;
5450             Linux-x86_64)
5451                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5452                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5453                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5454                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5455                 ;;
5456             *)
5457                 if test -z "$ac_cv_alignof_short" -o \
5458                         -z "$ac_cv_alignof_int" -o \
5459                         -z "$ac_cv_alignof_long" -o \
5460                         -z "$ac_cv_alignof_double"; then
5461                    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.])
5462                 fi
5463                 ;;
5464             esac
5465         ])
5467     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5468     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5469     if test $ac_cv_sizeof_long -eq 8; then
5470         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5471     elif test $ac_cv_sizeof_double -eq 8; then
5472         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5473     else
5474         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5475     fi
5477     dnl Check for large file support
5478     AC_SYS_LARGEFILE
5479     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5480         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5481     fi
5482     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5483         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5484     fi
5485 else
5486     # Hardcode for MSVC
5487     SAL_TYPES_SIZEOFSHORT=2
5488     SAL_TYPES_SIZEOFINT=4
5489     SAL_TYPES_SIZEOFLONG=4
5490     SAL_TYPES_SIZEOFLONGLONG=8
5491     if test "$BITNESS_OVERRIDE" = ""; then
5492         SAL_TYPES_SIZEOFPOINTER=4
5493     else
5494         SAL_TYPES_SIZEOFPOINTER=8
5495     fi
5496     SAL_TYPES_ALIGNMENT2=2
5497     SAL_TYPES_ALIGNMENT4=4
5498     SAL_TYPES_ALIGNMENT8=8
5499     LFS_CFLAGS=''
5501 AC_SUBST(LFS_CFLAGS)
5503 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5504 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5505 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5506 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5507 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5508 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5509 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5510 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5512 dnl ===================================================================
5513 dnl Check whether to enable runtime optimizations
5514 dnl ===================================================================
5515 ENABLE_RUNTIME_OPTIMIZATIONS=
5516 AC_MSG_CHECKING([whether to enable runtime optimizations])
5517 if test -z "$enable_runtime_optimizations"; then
5518     for i in $CC; do
5519         case $i in
5520         -fsanitize=*)
5521             enable_runtime_optimizations=no
5522             break
5523             ;;
5524         esac
5525     done
5527 if test "$enable_runtime_optimizations" != no; then
5528     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5529     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5530     AC_MSG_RESULT([yes])
5531 else
5532     AC_MSG_RESULT([no])
5534 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5536 dnl ===================================================================
5537 dnl Check if valgrind headers are available
5538 dnl ===================================================================
5539 ENABLE_VALGRIND=
5540 if test "$cross_compiling" != yes; then
5541     prev_cppflags=$CPPFLAGS
5542     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5543     # or where does it come from?
5544     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5545     AC_CHECK_HEADER([valgrind/valgrind.h],
5546         [ENABLE_VALGRIND=TRUE])
5547     CPPFLAGS=$prev_cppflags
5549 AC_SUBST([ENABLE_VALGRIND])
5550 if test -z "$ENABLE_VALGRIND"; then
5551     VALGRIND_CFLAGS=
5553 AC_SUBST([VALGRIND_CFLAGS])
5556 dnl ===================================================================
5557 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5558 dnl ===================================================================
5560 # We need at least the sys/sdt.h include header.
5561 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5562 if test "$SDT_H_FOUND" = "TRUE"; then
5563     # Found sys/sdt.h header, now make sure the c++ compiler works.
5564     # Old g++ versions had problems with probes in constructors/destructors.
5565     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5566     AC_LANG_PUSH([C++])
5567     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5568     #include <sys/sdt.h>
5569     class ProbeClass
5570     {
5571     private:
5572       int& ref;
5573       const char *name;
5575     public:
5576       ProbeClass(int& v, const char *n) : ref(v), name(n)
5577       {
5578         DTRACE_PROBE2(_test_, cons, name, ref);
5579       }
5581       void method(int min)
5582       {
5583         DTRACE_PROBE3(_test_, meth, name, ref, min);
5584         ref -= min;
5585       }
5587       ~ProbeClass()
5588       {
5589         DTRACE_PROBE2(_test_, dest, name, ref);
5590       }
5591     };
5592     ]],[[
5593     int i = 64;
5594     DTRACE_PROBE1(_test_, call, i);
5595     ProbeClass inst = ProbeClass(i, "call");
5596     inst.method(24);
5597     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5598           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5599     AC_LANG_POP([C++])
5601 AC_CONFIG_HEADERS([config_host/config_probes.h])
5603 dnl ===================================================================
5604 dnl Set the MinGW sys-root
5605 dnl ===================================================================
5606 if test "$WITH_MINGW" = "yes"; then
5607     AC_MSG_CHECKING([for MinGW sysroot])
5608     sysroot=`$CC -print-sysroot`
5609     AS_IF([test -d "$sysroot"/mingw],
5610           [MINGW_SYSROOT="$sysroot"/mingw
5611            AC_MSG_RESULT([$MINGW_SYSROOT])],
5612           [AC_MSG_RESULT([not found])
5613            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5615 AC_SUBST([MINGW_DLLS])
5616 AC_SUBST([MINGW_SYSROOT])
5618 dnl ===================================================================
5619 dnl Set the MinGW include directories
5620 dnl ===================================================================
5621 if test "$WITH_MINGW" = "yes"; then
5622     AC_MSG_CHECKING([for MinGW include path])
5623     cat >conftest.$ac_ext <<_ACEOF
5624 #include <stddef.h>
5625 #include <bits/c++config.h>
5626 _ACEOF
5627     _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`
5628     rm conftest.$ac_ext
5629     if test -z "$_mingw_lib_include_path"; then
5630         _mingw_lib_include_path="NO_LIB_INCLUDE"
5631         AC_MSG_RESULT([no MinGW include path])
5632     else
5633         AC_MSG_RESULT([$_mingw_lib_include_path])
5634     fi
5635     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5636     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5638     AC_LANG_PUSH([C++])
5640     AC_MSG_CHECKING([for dynamic libgcc])
5641     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5642 #include <iostream>
5643 using namespace std;
5644 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5645             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5646             if test -n "$MINGW_GCCDLL"; then
5647                 MINGW_SHARED_GCCLIB=TRUE
5648                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5649             else
5650                 MINGW_SHARED_GCCLIB=
5651                 AC_MSG_RESULT([no])
5652             fi
5653        ],[ AC_MSG_RESULT([no])
5655     ])
5657     AC_MSG_CHECKING([for dynamic libstdc++])
5658     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5659 #include <iostream>
5660 using namespace std;
5661 ]], [[ cout << "Hello there." << endl; ]])],[
5662             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5663             if test -n "$MINGW_GXXDLL"; then
5664                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5665                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5666                 if test "$CROSS_COMPILING" = "TRUE"; then
5667                     dnl m4 escaping!
5668                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5669                 fi
5670                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5671                 MINGW_SHARED_GXXLIB=TRUE
5672                 AC_MSG_RESULT([$MINGW_GXXDLL])
5673             else
5674                 MINGW_SHARED_GXXLIB=
5675                 AC_MSG_RESULT([no])
5676             fi
5677        ],[ AC_MSG_RESULT([no])
5679     ])
5681     AC_LANG_POP([C++])
5683     AC_SUBST(MINGW_SHARED_GCCLIB)
5684     AC_SUBST(MINGW_SHARED_GXXLIB)
5685     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5686     AC_SUBST(MINGW_GCCDLL)
5687     AC_SUBST(MINGW_GXXDLL)
5690 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5691     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5694 if test "$WITH_MINGW" = "yes"; then
5695     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5696     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5697     [
5698     #include <usp10.h>
5699     ],
5700     [
5701     SCRIPT_CONTROL c;
5702     c.fMergeNeutralItems = 1;
5703     ])],
5704     [
5705     AC_MSG_RESULT(yes)
5706     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5707     ],
5708     [AC_MSG_RESULT(no)])
5711 dnl *************************************************************
5712 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5713 dnl *************************************************************
5714 if test "$WITH_MINGW" = "yes"; then
5715     AC_MSG_CHECKING([exception type])
5716     AC_LANG_PUSH([C++])
5717     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5719         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5721         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5722     ])
5723     AC_MSG_RESULT($exceptions_type)
5724     AC_LANG_POP([C++])
5727 EXCEPTIONS="$exceptions_type"
5728 AC_SUBST(EXCEPTIONS)
5730 dnl ===================================================================
5731 dnl thread-safe statics
5732 dnl ===================================================================
5733 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5734 unset HAVE_THREADSAFE_STATICS
5735 if test "$GCC" = "yes"; then
5736     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5737     dnl us.  However, some C++ runtimes use a single lock for all static
5738     dnl variables, which can cause deadlock in multi-threaded applications.
5739     dnl This is not easily tested here; for POSIX-based systems, if executing
5740     dnl the following C++ program does not terminate then the tool chain
5741     dnl apparently has this problem:
5742     dnl
5743     dnl   #include <pthread.h>
5744     dnl   int h() { return 0; }
5745     dnl   void * g(void * unused) {
5746     dnl     static int n = h();
5747     dnl     return &n;
5748     dnl   }
5749     dnl   int f() {
5750     dnl     pthread_t t;
5751     dnl     pthread_create(&t, 0, g, 0);
5752     dnl     pthread_join(t, 0);
5753     dnl     return 0;
5754     dnl   }
5755     dnl   int main() {
5756     dnl     static int n = f();
5757     dnl     return n;
5758     dnl   }
5759     dnl
5760     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5761     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5762     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5763     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5764     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5765     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5766     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5767     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5768     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5769     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5770     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5771     dnl "too old"):
5772     if test "$_os" = Darwin; then
5773         dnl On Mac OS X, both /usr/lib/libstdc++.6.dylib and
5774         dnl /usr/lib/libc++1.dylib delegate to /usr/lib/libc++abi.dylib for the
5775         dnl __cxa_guard_* functionality; up to 10.8, libc++abi.dylib is
5776         dnl apparently provided by a libcppabi project that has broken semantics
5777         dnl (cf. <http://www.opensource.apple.com/source/libcppabi/libcppabi-26/
5778         dnl src/cxa_guard.cxx>), while in 10.9 (verified at least on 10.9.4) it
5779         dnl is apparently provided by LLVM's libcxxabi project, which has good
5780         dnl semantics (cf. <http://llvm.org/svn/llvm-project/libcxxabi/trunk/
5781         dnl src/cxa_guard.cpp>):
5782         if test "$MAC_OS_X_VERSION_MIN_REQUIRED" -ge 1090; then
5783             HAVE_THREADSAFE_STATICS=TRUE
5784         fi
5785     elif test "$_os" != Android; then
5786         if test "$COM_GCC_IS_CLANG" = TRUE; then
5787             AC_LANG_PUSH([C++])
5788             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5789 #include <list>
5790 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5791 #error
5792 #endif
5793                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5794             AC_LANG_POP([C++])
5795         else # known to work in GCC since version 4.3
5796             HAVE_THREADSAFE_STATICS=TRUE
5797         fi
5798     fi
5799     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5800         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5801         AC_MSG_RESULT([yes])
5802     else
5803         AC_MSG_RESULT([broken (i.e., no)])
5804     fi
5805 else
5806     AC_MSG_RESULT([unknown (assuming no)])
5808 AC_SUBST(HAVE_THREADSAFE_STATICS)
5810 dnl ===================================================================
5811 dnl visibility and other gcc features
5812 dnl ===================================================================
5813 if test "$GCC" = "yes"; then
5814     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5815     save_CFLAGS=$CFLAGS
5816     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5817     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5818     CFLAGS=$save_CFLAGS
5820     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5821         AC_MSG_RESULT([yes])
5822     else
5823         AC_MSG_RESULT([no])
5824     fi
5826     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5827     save_CFLAGS=$CFLAGS
5828     CFLAGS="$CFLAGS -Werror -mno-avx"
5829     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5830     CFLAGS=$save_CFLAGS
5831     if test "$HAVE_GCC_AVX" = "TRUE"; then
5832         AC_MSG_RESULT([yes])
5833     else
5834         AC_MSG_RESULT([no])
5835     fi
5837     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5838     save_CFLAGS=$CFLAGS
5839     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5840     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5841     CFLAGS=$save_CFLAGS
5842     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5843         AC_MSG_RESULT([yes])
5844     else
5845         AC_MSG_RESULT([no])
5846     fi
5848     AC_MSG_CHECKING([whether $CC supports atomic functions])
5849     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5850     int v = 0;
5851     if (__sync_add_and_fetch(&v, 1) != 1 ||
5852         __sync_sub_and_fetch(&v, 1) != 0)
5853         return 1;
5854     __sync_synchronize();
5855     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5856         v != 1)
5857         return 1;
5858     return 0;
5859 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5860     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5861         AC_MSG_RESULT([yes])
5862         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5863     else
5864         AC_MSG_RESULT([no])
5865     fi
5867     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5868     save_CFLAGS=$CFLAGS
5869     CFLAGS="$CFLAGS -Werror"
5870     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5871             __attribute__((deprecated("test"))) void f();
5872         ])], [
5873             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5874             AC_MSG_RESULT([yes])
5875         ], [AC_MSG_RESULT([no])])
5876     CFLAGS=$save_CFLAGS
5878     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5879     AC_LANG_PUSH([C++])
5880     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5881             #include <cxxabi.h>
5882             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5883         ])], [
5884             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5885             AC_MSG_RESULT([yes])
5886         ], [AC_MSG_RESULT([no])])
5887     AC_LANG_POP([C++])
5889     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5890     AC_LANG_PUSH([C++])
5891     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5892             #include <cxxabi.h>
5893             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5894         ])], [
5895             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
5896             AC_MSG_RESULT([yes])
5897         ], [AC_MSG_RESULT([no])])
5898     AC_LANG_POP([C++])
5900     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5901     AC_LANG_PUSH([C++])
5902     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5903             #include <cxxabi.h>
5904             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5905         ])], [
5906             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
5907             AC_MSG_RESULT([yes])
5908         ], [AC_MSG_RESULT([no])])
5909     AC_LANG_POP([C++])
5911     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5912     AC_LANG_PUSH([C++])
5913     save_CXXFLAGS=$CXXFLAGS
5914     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
5915     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5916             struct __attribute__((warn_unused)) dummy {};
5917         ])], [
5918             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
5919             AC_MSG_RESULT([yes])
5920         ], [AC_MSG_RESULT([no])])
5921     CXXFLAGS=$save_CXXFLAGS
5922     AC_LANG_POP([C++])
5924     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
5925     AC_LANG_PUSH([C++])
5926     save_CXXFLAGS=$CXXFLAGS
5927     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
5928     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5929             #include <string>
5930             void f() { std::string s; }
5931         ])], [
5932             AC_MSG_RESULT([no])
5933         ], [
5934             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
5935             AC_MSG_RESULT([yes])])
5936     CXXFLAGS=$save_CXXFLAGS
5937     AC_LANG_POP([C++])
5940 AC_SUBST(HAVE_GCC_AVX)
5941 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
5942 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5944 dnl ===================================================================
5945 dnl Identify the C++ library
5946 dnl ===================================================================
5948 AC_MSG_CHECKING([What the C++ library is])
5949 AC_LANG_PUSH([C++])
5950 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5951 #include <utility>
5952 #ifndef __GLIBCXX__
5953 foo bar
5954 #endif
5955 ]])],
5956     [CPP_LIBRARY=GLIBCXX
5957      cpp_library_name="GNU libstdc++"
5958     ],
5959     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5960 #include <utility>
5961 #ifndef _LIBCPP_VERSION
5962 foo bar
5963 #endif
5964 ]])],
5965     [CPP_LIBRARY=LIBCPP
5966      cpp_library_name="LLVM libc++"
5967     ],
5968     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5969 #include <utility>
5970 #ifndef _MSC_VER
5971 foo bar
5972 #endif
5973 ]])],
5974     [CPP_LIBRARY=MSVCRT
5975      cpp_library_name="Microsoft"
5976     ],
5977     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
5978 AC_MSG_RESULT([$cpp_library_name])
5979 AC_LANG_POP([C++])
5980 AC_SUBST(CPP_LIBRARY)
5982 dnl ===================================================================
5983 dnl C++11
5984 dnl ===================================================================
5986 CXXFLAGS_CXX11=
5987 if test "$COM" = MSC; then
5988     AC_MSG_CHECKING([whether $CXX supports C++11])
5989     AC_MSG_RESULT(yes)
5990     # MSVC supports (a subset of) CXX11 without any switch
5991     CXXFLAGS_CXX11=
5992 elif test "$GCC" = "yes"; then
5993     HAVE_CXX11=
5994     CXXFLAGS_CXX11=
5995     AC_MSG_CHECKING([whether $CXX supports C++11])
5996     for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
5997         save_CXXFLAGS=$CXXFLAGS
5998         CXXFLAGS="$CXXFLAGS $flag -Werror"
5999         AC_LANG_PUSH([C++])
6000         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void f() {}]])],[CXXFLAGS_CXX11=$flag])
6001         AC_LANG_POP([C++])
6002         CXXFLAGS=$save_CXXFLAGS
6003         if test -n "$CXXFLAGS_CXX11"; then
6004             HAVE_CXX11=TRUE
6005             break
6006         fi
6007     done
6008     if test "$HAVE_CXX11" = TRUE; then
6009         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6010     else
6011         AC_MSG_ERROR(no)
6012     fi
6015 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6016 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6017 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6018 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6019 dnl again towards 4.7.2:
6020 if test $CPP_LIBRARY = GLIBCXX; then
6021     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6022     AC_LANG_PUSH([C++])
6023     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6024 #include <list>
6025 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6026     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6027     //   GCC 4.7.0: 20120322
6028     //   GCC 4.7.1: 20120614
6029     // and using a range check is not possible as the mapping between
6030     // __GLIBCXX__ values and GCC versions is not monotonic
6031 /* ok */
6032 #else
6033 abi broken
6034 #endif
6035         ]])], [AC_MSG_RESULT(no, ok)],
6036         [AC_MSG_ERROR(yes)])
6037     AC_LANG_POP([C++])
6040 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6041 save_CXXFLAGS=$CXXFLAGS
6042 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6043 AC_LANG_PUSH([C++])
6045 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6046 #include <stddef.h>
6048 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6050 namespace
6052         struct b
6053         {
6054                 int i;
6055                 int j;
6056         };
6058 ]], [[
6059 struct a
6061         int i;
6062         int j;
6064 a thinga[]={{0,0}, {1,1}};
6065 b thingb[]={{0,0}, {1,1}};
6066 size_t i = sizeof(sal_n_array_size(thinga));
6067 size_t j = sizeof(sal_n_array_size(thingb));
6068 return !(i != 0 && j != 0);
6070     ], [ AC_MSG_RESULT(yes) ],
6071     [ AC_MSG_ERROR(no)])
6072 AC_LANG_POP([C++])
6073 CXXFLAGS=$save_CXXFLAGS
6075 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6076 save_CXXFLAGS=$CXXFLAGS
6077 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6078 AC_LANG_PUSH([C++])
6080 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6081 #include <vector>
6082     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6083     // (__float128)
6085     ],[ AC_MSG_RESULT(yes) ],
6086     [
6087         AC_MSG_RESULT(no)
6088         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6089         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6090         # __float128 is available during its build, but it's usually built using GCC,
6091         # and so c++config.h hardcodes __float128 being supported). As the only place
6092         # where __float128 is actually used is in a template specialization,
6093         # -D__float128=void will avoid the problem there while still causing a problem
6094         # if somebody actually uses the type.
6095         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6096         CXXFLAGS="$CXXFLAGS -D__float128=void"
6097         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6098 #include <vector>
6099     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6100     // (__float128)
6102     ],
6103     [
6104      AC_MSG_RESULT(yes)
6105      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6106     ],
6107     [
6108      AC_MSG_ERROR(no)
6109     ])
6112 AC_LANG_POP([C++])
6113 CXXFLAGS=$save_CXXFLAGS
6115 AC_SUBST(CXXFLAGS_CXX11)
6117 dnl ==================================
6118 dnl Check for C++11 "= delete" support
6119 dnl ==================================
6121 AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
6122 save_CXXFLAGS=$CXXFLAGS
6123 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6124 AC_LANG_PUSH([C++])
6125 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6126 struct A
6127     {
6128     void test() = delete;
6129     };
6130 ]])],[HAVE_CXX11_DELETE=TRUE],[])
6132 AC_LANG_POP([C++])
6133 CXXFLAGS=$save_CXXFLAGS
6134 if test "$HAVE_CXX11_DELETE" = "TRUE"; then
6135     AC_MSG_RESULT([yes])
6136     AC_DEFINE([HAVE_CXX11_DELETE])
6137 else
6138     AC_MSG_RESULT([no])
6141 dnl ==================================
6142 dnl Check for C++11 "override" support
6143 dnl ==================================
6145 AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
6146 save_CXXFLAGS=$CXXFLAGS
6147 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6148 AC_LANG_PUSH([C++])
6149 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6150 struct A
6152         virtual void test();
6155 struct B : A
6157         virtual void test() override;
6159 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
6161 AC_LANG_POP([C++])
6162 CXXFLAGS=$save_CXXFLAGS
6163 if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
6164     AC_MSG_RESULT([yes])
6165     AC_DEFINE([HAVE_CXX11_OVERRIDE])
6166 else
6167     AC_MSG_RESULT([no])
6170 dnl ==================================
6171 dnl Check for C++11 "final" support
6172 dnl ==================================
6174 AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
6175 save_CXXFLAGS=$CXXFLAGS
6176 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6177 AC_LANG_PUSH([C++])
6178 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6179 // First check that this correct program that uses "final" compiles
6180 struct A final
6184 struct B
6186         virtual void test();
6189 struct C : B
6191         void test() final;
6193 ]])],[have_final=yes],[])
6195 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6196 // Then check that the "final" works as expected,
6197 // that this program fails to compile
6198 struct A final
6202 struct B : A
6205 ]])],[],[final_class_works=yes])
6207 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6208 // Also this should fail to compile
6209 struct B
6211         virtual void test();
6214 struct C : B
6216         void test() final;
6219 struct D : C
6221         void test();
6223 ]])],[],[final_method_works=yes])
6224 AC_LANG_POP([C++])
6226 CXXFLAGS=$save_CXXFLAGS
6228 if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
6229     AC_MSG_RESULT([yes])
6230     AC_DEFINE([HAVE_CXX11_FINAL])
6231 else
6232     AC_MSG_RESULT([no])
6235 dnl ===================================================================
6236 dnl Check for C++11 perfect forwarding support
6237 dnl ===================================================================
6238 AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
6239 save_CXXFLAGS=$CXXFLAGS
6240 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6241 AC_LANG_PUSH([C++])
6242 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6243     #include <utility>
6244     template<typename T, typename... Args> T * f(Args &&... v) {
6245         return new T(std::forward<Args>(v)...);
6246     }
6247     ]], [[
6248     f<int>(0);
6249     ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
6250 AC_LANG_POP([C++])
6251 CXXFLAGS=$save_CXXFLAGS
6252 AC_MSG_RESULT([$perfect_forwarding])
6253 if test "$perfect_forwarding" = yes; then
6254     AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
6257 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6258 save_CXXFLAGS=$CXXFLAGS
6259 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6260 AC_LANG_PUSH([C++])
6261 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6262     struct S {
6263         int n_;
6264         constexpr S(int n): n_(n) {}
6265     };
6266     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6267 AC_LANG_POP([C++])
6268 CXXFLAGS=$save_CXXFLAGS
6269 AC_MSG_RESULT([$cxx11_constexpr])
6270 if test "$cxx11_constexpr" = yes; then
6271     AC_DEFINE([HAVE_CXX11_CONSTEXPR])
6274 HAVE_GCC_PRAGMA_OPERATOR=
6275 dnl _Pragma support (may require C++11)
6276 if test "$GCC" = "yes"; then
6277     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6278     AC_LANG_PUSH([C++])
6279     save_CXXFLAGS=$CXXFLAGS
6280     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6281     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6282             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6283         ])], [
6284             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6285             HAVE_GCC_PRAGMA_OPERATOR=1
6286             AC_MSG_RESULT([yes])
6287         ], [AC_MSG_RESULT([no])])
6288     AC_LANG_POP([C++])
6289     CXXFLAGS=$save_CXXFLAGS
6291 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6293 dnl ===================================================================
6294 dnl system stl sanity tests
6295 dnl ===================================================================
6296 HAVE_GCC_VISIBILITY_BROKEN=
6297 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6299     AC_LANG_PUSH([C++])
6301     save_CPPFLAGS="$CPPFLAGS"
6302     if test -n "$MACOSX_SDK_PATH"; then
6303         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6304     fi
6306     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6307     # only.
6308     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6309         dnl gcc#19664, gcc#22482, rhbz#162935
6310         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6311         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6312         AC_MSG_RESULT([$stlvisok])
6313         if test "$stlvisok" = "no"; then
6314             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6315             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6316             unset HAVE_GCC_VISIBILITY_FEATURE
6317         fi
6318     fi
6320     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6321         sharedlink_ldflags_save=$LDFLAGS
6322         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6324         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6325         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6326 #include <sstream>
6327 using namespace std;
6328             ]], [[
6329 istringstream strm( "test" ); return 0;
6330             ]])],
6331             # Ugh, surely bad to assume an error message will contain
6332             # the word "unresolvable", a problem with
6333             # -fvisibility-inlines-hidden and STL headers might cause
6334             # some more obscure message on some platform, and anway,
6335             # the error message could be localised.
6336             [$EGREP -q unresolvable conftest.err;
6337             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6338         ])
6339         AC_MSG_RESULT([$gccvisok])
6340         if test "$gccvisok" = "no"; then
6341             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6342             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6343             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6344         fi
6346         LDFLAGS=$sharedlink_ldflags_save
6347     fi
6349     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6350     # when we don't make any dynamic libraries?
6351     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6352         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6353         cat > conftestlib1.cc <<_ACEOF
6354 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6355 struct S2: S1<int> { virtual ~S2(); };
6356 S2::~S2() {}
6357 _ACEOF
6358         cat > conftestlib2.cc <<_ACEOF
6359 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6360 struct S2: S1<int> { virtual ~S2(); };
6361 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6362 _ACEOF
6363         gccvisinlineshiddenok=yes
6364         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6365             gccvisinlineshiddenok=no
6366         else
6367             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6368             dnl known to not work with -z defs (unsetting which makes the test
6369             dnl moot, though):
6370             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6371             if test "$COM_GCC_IS_CLANG" = TRUE; then
6372                 for i in $CXX; do
6373                     case $i in
6374                     -fsanitize=*)
6375                         my_linkflagsnoundefs=
6376                         break
6377                         ;;
6378                     esac
6379                 done
6380             fi
6381             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6382                 gccvisinlineshiddenok=no
6383             fi
6384         fi
6386         rm -fr libconftest*
6387         AC_MSG_RESULT([$gccvisinlineshiddenok])
6388         if test "$gccvisinlineshiddenok" = "no"; then
6389             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6390             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6391             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6392         fi
6393     fi
6395     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6396         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6397         cat >visibility.cxx <<_ACEOF
6398 #pragma GCC visibility push(hidden)
6399 struct __attribute__ ((visibility ("default"))) TestStruct {
6400   static void Init();
6402 __attribute__ ((visibility ("default"))) void TestFunc() {
6403   TestStruct::Init();
6405 _ACEOF
6406         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6407             gccvisbroken=yes
6408         else
6409             case "$host_cpu" in
6410             i?86|x86_64)
6411                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6412                     gccvisbroken=no
6413                 else
6414                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6415                         gccvisbroken=no
6416                     else
6417                         gccvisbroken=yes
6418                     fi
6419                 fi
6420                 ;;
6421             *)
6422                 gccvisbroken=no
6423                 ;;
6424             esac
6425         fi
6426         rm -f visibility.s visibility.cxx
6428         AC_MSG_RESULT([$gccvisbroken])
6429         if test "$gccvisbroken" = "yes"; then
6430             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6431             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6432             unset HAVE_GCC_VISIBILITY_FEATURE
6433         fi
6434     fi
6436     CPPFLAGS="$save_CPPFLAGS"
6438     AC_LANG_POP([C++])
6441 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6442 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6444 dnl ===================================================================
6445 dnl  Clang++ tests
6446 dnl ===================================================================
6448 HAVE_GCC_FNO_DEFAULT_INLINE=
6449 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6450 if test "$GCC" = "yes"; then
6451     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6452     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6453         # Option just ignored and silly warning that isn't a real
6454         # warning printed
6455         :
6456     else
6457         AC_LANG_PUSH([C++])
6458         save_CXXFLAGS=$CXXFLAGS
6459         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6460         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6461         CXXFLAGS=$save_CXXFLAGS
6462         AC_LANG_POP([C++])
6463     fi
6464     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6465         AC_MSG_RESULT([yes])
6466     else
6467         AC_MSG_RESULT([no])
6468     fi
6470     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6471     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6472         # As above
6473         :
6474     else
6475         AC_LANG_PUSH([C++])
6476         save_CXXFLAGS=$CXXFLAGS
6477         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6478         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6479         CXXFLAGS=$save_CXXFLAGS
6480         AC_LANG_POP([C++])
6481     fi
6482     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6483         AC_MSG_RESULT([yes])
6484     else
6485         AC_MSG_RESULT([no])
6486     fi
6488 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6489 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6491 dnl ===================================================================
6492 dnl Compiler plugins
6493 dnl ===================================================================
6495 COMPILER_PLUGINS=
6496 # currently only Clang
6497 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
6498     if test -n "$enable_compiler_plugins"; then
6499         compiler_plugins="$enable_compiler_plugins"
6500     elif test -n "$ENABLE_DBGUTIL"; then
6501         compiler_plugins=test
6502     else
6503         compiler_plugins=no
6504     fi
6505     if test "$compiler_plugins" != "no"; then
6506         dnl The prefix where Clang resides, override to where Clang resides if
6507         dnl using a source build:
6508         if test -z "$CLANGDIR"; then
6509             CLANGDIR=/usr
6510         fi
6511         AC_LANG_PUSH([C++])
6512         save_CPPFLAGS=$CPPFLAGS
6513         save_CXX=$CXX
6514         # compiler plugins must be built with "native" bitness of clang
6515         # because they link against clang libraries
6516         CXX=`echo $CXX | sed -e s/-m64// -e s/-m32//`
6517         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6518         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6519             [COMPILER_PLUGINS=TRUE],
6520             [
6521             if test "$compiler_plugins" = "yes"; then
6522                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6523             else
6524                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6525                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6526             fi
6527             ])
6528         CXX=$save_CXX
6529         CPPFLAGS=$save_CPPFLAGS
6530         AC_LANG_POP([C++])
6531     fi
6532 else
6533     if test "$enable_compiler_plugins" = "yes"; then
6534         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6535     fi
6537 AC_SUBST(COMPILER_PLUGINS)
6538 AC_SUBST(CLANGDIR)
6540 # Plugin to help linker.
6541 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6542 # This makes --enable-lto build with clang work.
6543 AC_SUBST(LD_PLUGIN)
6545 dnl ===================================================================
6546 dnl allocator
6547 dnl ===================================================================
6548 AC_MSG_CHECKING([which memory allocator to use])
6549 if test "$with_alloc" = "system"; then
6550     AC_MSG_RESULT([system])
6551     ALLOC="SYS_ALLOC"
6553 if test "$with_alloc" = "tcmalloc"; then
6554     AC_MSG_RESULT(tcmalloc)
6555     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6556         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6557     fi
6558     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6559         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6560     ALLOC="TCMALLOC"
6562 if test "$with_alloc" = "jemalloc"; then
6563     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6564         AC_MSG_RESULT(jemalloc)
6565         save_CFLAGS=$CFLAGS
6566         CFLAGS="$CFLAGS -pthread"
6567         AC_CHECK_LIB([jemalloc], [malloc], [:],
6568             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6569         ALLOC="JEMALLOC"
6570         CFLAGS=$save_CFLAGS
6571     else
6572         AC_MSG_RESULT([system])
6573         ALLOC="SYS_ALLOC"
6574     fi
6576 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6577     AC_MSG_RESULT([internal])
6579 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6580 AC_SUBST(HAVE_POSIX_FALLOCATE)
6581 AC_SUBST(ALLOC)
6583 dnl ===================================================================
6584 dnl Custom build version
6585 dnl ===================================================================
6587 AC_MSG_CHECKING([whether to add custom build version])
6588 if test "$with_build_version" != ""; then
6589     BUILD_VER_STRING=$with_build_version
6590     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6591 else
6592     BUILD_VER_STRING=
6593     AC_MSG_RESULT([no])
6595 AC_SUBST(BUILD_VER_STRING)
6597 JITC_PROCESSOR_TYPE=""
6598 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6599     # IBMs JDK needs this...
6600     JITC_PROCESSOR_TYPE=6
6601     export JITC_PROCESSOR_TYPE
6603 AC_SUBST([JITC_PROCESSOR_TYPE])
6605 # Misc Windows Stuff
6606 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6607     find_msvc_x64_dlls
6608     find_msms
6609     MSVC_DLL_PATH="$msvcdllpath"
6610     MSVC_DLLS="$msvcdlls"
6611     MSM_PATH="$msmdir"
6612     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6615 AC_SUBST(MSVC_DLL_PATH)
6616 AC_SUBST(MSVC_DLLS)
6617 AC_SUBST(MSM_PATH)
6619 dnl ===================================================================
6620 dnl Checks for Java
6621 dnl ===================================================================
6622 if test "$ENABLE_JAVA" != ""; then
6624     # Windows-specific tests
6625     if test "$build_os" = "cygwin"; then
6626         if test "$BITNESS_OVERRIDE" = 64; then
6627             bitness=64
6628         else
6629             bitness=32
6630         fi
6632         if test -z "$with_jdk_home"; then
6633             for ver in 1.8 1.7 1.6; do
6634                 reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6635                 if test -n "$regvalue"; then
6636                     _jdk_home=$regvalue
6637                     break
6638                 fi
6639             done
6640             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6641                 with_jdk_home="$_jdk_home"
6642                 howfound="found automatically"
6643             else
6644                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6645             fi
6646         else
6647             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6648             howfound="you passed"
6649         fi
6650     fi
6652     # 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.
6653     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6654     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6655         with_jdk_home=`/usr/libexec/java_home`
6656     fi
6658     JAVA_HOME=; export JAVA_HOME
6659     if test -z "$with_jdk_home"; then
6660         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6661     else
6662         _java_path="$with_jdk_home/bin/$with_java"
6663         dnl Check if there is a Java interpreter at all.
6664         if test -x "$_java_path"; then
6665             JAVAINTERPRETER=$_java_path
6666         else
6667             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6668         fi
6669     fi
6671     if test "$build_os" = "cygwin"; then
6672         # Check that the JDK found is correct architecture
6673         # Why is this necessary, we don't link with any library from the JDK I think,
6675         shortjdkhome=`cygpath -d "$with_jdk_home"`
6676         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
6677             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6678             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6679         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
6680             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6681             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6682         fi
6684         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6685             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6686         fi
6687         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6688     elif test "$cross_compiling" != "yes"; then
6689         # at least 2 reasons to check: officebean needs to link -ljawt,
6690         # and libjpipe.so needs to be loaded by java to run JunitTests.
6691         case $CPUNAME in
6692             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64)
6693                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6694                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6695                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6696                 fi
6697                 ;;
6698             *) # assumption: everything else 32-bit
6699                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6700                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6701                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6702                 fi
6703                 ;;
6704         esac
6705     fi
6708 HAVE_JAVA6=
6709 HAVE_JAVA9=
6710 dnl ===================================================================
6711 dnl Checks for JDK.
6712 dnl ===================================================================
6714 # Note that JAVA_HOME as for now always means the *build* platform's
6715 # JAVA_HOME. Whether all the complexity here actually is needed any
6716 # more or not, no idea.
6718 if test "$ENABLE_JAVA" != ""; then
6719     _gij_longver=0
6720     AC_MSG_CHECKING([the installed JDK])
6721     if test -n "$JAVAINTERPRETER"; then
6722         dnl java -version sends output to stderr!
6723         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6724             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6725         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6726             JDK=gcj
6727             AC_MSG_RESULT([checked (gcj)])
6728             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6729             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6731         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6732             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6733         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6734             JDK=ibm
6736             dnl IBM JDK specific tests
6737             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6738             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6740             if test "$_jdk_ver" -lt 10500; then
6741                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6742             fi
6743             if test "$_jdk_ver" -ge 10600; then
6744                 HAVE_JAVA6=TRUE
6745             fi
6747             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6749             if test "$with_jdk_home" = ""; then
6750                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6751 you must use the "--with-jdk-home" configure option explicitly])
6752             fi
6754             JAVA_HOME=$with_jdk_home
6755         else
6756             JDK=sun
6758             dnl Sun JDK specific tests
6759             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6760             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6762             if test "$_jdk_ver" -lt 10500; then
6763                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6764             fi
6765             if test "$_jdk_ver" -gt 10600; then
6766                 JAVA_CLASSPATH_NOT_SET="1"
6767             fi
6768             if test "$_jdk_ver" -ge 10600; then
6769                 HAVE_JAVA6=TRUE
6770             fi
6771             if test "$_jdk_ver" -ge 10900; then
6772                 HAVE_JAVA9=TRUE
6773             fi
6775             AC_MSG_RESULT([checked (JDK $_jdk)])
6776             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6777             if test "$_os" = "WINNT"; then
6778                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6779             fi
6781             # set to limit VM usage for JunitTests
6782             JAVAIFLAGS=-Xmx64M
6783             # set to limit VM usage for javac
6784             JAVAFLAGS=-J-Xmx128M
6785         fi
6786     else
6787         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6788     fi
6789 else
6790     dnl Java disabled
6791     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6793 AC_SUBST([HAVE_JAVA6])
6794 AC_SUBST([HAVE_JAVA9])
6796 dnl ===================================================================
6797 dnl Set target Java bytecode version
6798 dnl ===================================================================
6799 if test "$ENABLE_JAVA" != ""; then
6800     if test "$HAVE_JAVA9" == "TRUE"; then
6801         _java_target_ver="1.6"
6802     else
6803         _java_target_ver="1.5"
6804     fi
6805     JAVA_SOURCE_VER="$_java_target_ver"
6806     JAVA_TARGET_VER="$_java_target_ver"
6809 dnl ===================================================================
6810 dnl Checks for javac
6811 dnl ===================================================================
6812 if test "$ENABLE_JAVA" != ""; then
6813     if test "$JDK" = "gcj"; then
6814         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6815     else
6816         javacompiler="javac"
6817     fi
6818     if test -z "$with_jdk_home"; then
6819         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6820     else
6821         _javac_path="$with_jdk_home/bin/$javacompiler"
6822         dnl Check if there is a Java compiler at all.
6823         if test -x "$_javac_path"; then
6824             JAVACOMPILER=$_javac_path
6825         fi
6826     fi
6827     if test -z "$JAVACOMPILER"; then
6828         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6829     fi
6830     if test "$build_os" = "cygwin"; then
6831         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6832             JAVACOMPILER="${JAVACOMPILER}.exe"
6833         fi
6834         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6835     fi
6837     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6838         AC_MSG_CHECKING([re-checking JDK])
6839         JDK=gcj
6840         AC_MSG_RESULT([checked (ecj)])
6841         _gij_longver="40200"
6842     fi
6845 JAVACISGCJ=""
6846 dnl ===================================================================
6847 dnl Checks that javac is gcj
6848 dnl ===================================================================
6849 if test "$ENABLE_JAVA" != ""; then
6850     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6851         JAVACISGCJ="yes"
6852     fi
6854 AC_SUBST(JAVACISGCJ)
6856 dnl ===================================================================
6857 dnl Checks for javadoc
6858 dnl ===================================================================
6859 if test "$ENABLE_JAVA" != ""; then
6860     if test -z "$with_jdk_home"; then
6861         AC_PATH_PROG(JAVADOC, javadoc)
6862     else
6863         _javadoc_path="$with_jdk_home/bin/javadoc"
6864         dnl Check if there is a javadoc at all.
6865         if test -x "$_javadoc_path"; then
6866             JAVADOC=$_javadoc_path
6867         else
6868             AC_PATH_PROG(JAVADOC, javadoc)
6869         fi
6870     fi
6871     if test -z "$JAVADOC"; then
6872         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6873     fi
6874     if test "$build_os" = "cygwin"; then
6875         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6876             JAVADOC="${JAVADOC}.exe"
6877         fi
6878         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6879     fi
6881     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6882     JAVADOCISGJDOC="yes"
6883     fi
6885 AC_SUBST(JAVADOCISGJDOC)
6887 if test "$ENABLE_JAVA" != ""; then
6888     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6889     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6890         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6891            # try to recover first by looking whether we have a alternatives
6892            # system as in Debian or newer SuSEs where following /usr/bin/javac
6893            # over /etc/alternatives/javac leads to the right bindir where we
6894            # just need to strip a bit away to get a valid JAVA_HOME
6895            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6896         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6897             # maybe only one level of symlink (e.g. on Mac)
6898             JAVA_HOME=$(readlink $JAVACOMPILER)
6899             if test "$(dirname $JAVA_HOME)" = "."; then
6900                 # we've got no path to trim back
6901                 JAVA_HOME=""
6902             fi
6903         else
6904             # else warn
6905             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6906             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6907             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6908             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6909         fi
6910         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
6911         if test "$JAVA_HOME" != "/usr"; then
6912             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6913                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6914                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6915                 dnl Tiger already returns a JDK path..
6916                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6917             else
6918                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6919             fi
6920         fi
6921     fi
6922     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6924     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6925     if test -z "$JAVA_HOME"; then
6926         if test "x$with_jdk_home" = "x"; then
6927             cat > findhome.java <<_ACEOF
6928 [import java.io.File;
6930 class findhome
6932     public static void main(String args[])
6933     {
6934         String jrelocation = System.getProperty("java.home");
6935         File jre = new File(jrelocation);
6936         System.out.println(jre.getParent());
6937     }
6939 _ACEOF
6940             AC_MSG_CHECKING([if javac works])
6941             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6942             AC_TRY_EVAL(javac_cmd)
6943             if test $? = 0 -a -f ./findhome.class; then
6944                 AC_MSG_RESULT([javac works])
6945             else
6946                 echo "configure: javac test failed" >&5
6947                 cat findhome.java >&5
6948                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6949             fi
6950             AC_MSG_CHECKING([if gij knows its java.home])
6951             JAVA_HOME=`$JAVAINTERPRETER findhome`
6952             if test $? = 0 -a "$JAVA_HOME" != ""; then
6953                 AC_MSG_RESULT([$JAVA_HOME])
6954             else
6955                 echo "configure: java test failed" >&5
6956                 cat findhome.java >&5
6957                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6958             fi
6959             # clean-up after ourselves
6960             rm -f ./findhome.java ./findhome.class
6961         else
6962             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6963         fi
6964     fi
6966     dnl second sanity check JAVA_HOME if possible
6967     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
6968         # now check if $JAVA_HOME is really valid
6969         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6970             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6971                 JAVA_HOME_OK="NO"
6972             fi
6973         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6974             JAVA_HOME_OK="NO"
6975         fi
6976         if test "$JAVA_HOME_OK" = "NO"; then
6977             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6978             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6979             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6980             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6981             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6982             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6983         fi
6984     fi
6985     PathFormat "$JAVA_HOME"
6986     JAVA_HOME="$formatted_path"
6989 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
6990     "$_os" != Darwin
6991 then
6992     AC_MSG_CHECKING([for JAWT lib])
6993     if test "$_os" = WINNT; then
6994         if test "$WITH_MINGW" = yes; then
6995             # The path is taken care of in gb_LinkTarget__use_jawt
6996             # in RepositoryExternal.mk:
6997             JAWTLIB=-ljawt
6998         else
6999             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7000             JAWTLIB=jawt.lib
7001         fi
7002     else
7003         case "$host_cpu" in
7004         arm*)
7005             my_java_arch=arm
7006             ;;
7007         i*86)
7008             my_java_arch=i386
7009             ;;
7010         m68k)
7011             my_java_arch=mk68
7012             ;;
7013         powerpc)
7014             my_java_arch=ppc
7015             ;;
7016         powerpc64)
7017             my_java_arch=ppc64
7018             ;;
7019         powerpc64le)
7020             AS_IF([test -d "$JAVA_HOME/jre/lib/ppc64le"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7021             JAVA_ARCH=$my_java_arch
7022             ;;
7023         x86_64)
7024             my_java_arch=amd64
7025             ;;
7026         *)
7027             my_java_arch=$host_cpu
7028             ;;
7029         esac
7030         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7031         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7032     fi
7033     AC_MSG_RESULT([$JAWTLIB])
7035 AC_SUBST(JAWTLIB)
7037 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7038     case "$host_os" in
7040     aix*)
7041         JAVAINC="-I$JAVA_HOME/include"
7042         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7043         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7044         ;;
7046     cygwin*)
7047         JAVAINC="-I$JAVA_HOME/include/win32"
7048         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7049         ;;
7051     darwin*)
7052         if test -d "$JAVA_HOME/include/darwin"; then
7053             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7054         else
7055             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7056         fi
7057         ;;
7059     dragonfly*)
7060         JAVAINC="-I$JAVA_HOME/include"
7061         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7062         ;;
7064     freebsd*)
7065         JAVAINC="-I$JAVA_HOME/include"
7066         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7067         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7068         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7069         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7070         ;;
7072     k*bsd*-gnu*)
7073         JAVAINC="-I$JAVA_HOME/include"
7074         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7075         ;;
7077     linux-gnu*)
7078         JAVAINC="-I$JAVA_HOME/include"
7079         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7080         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7081         ;;
7083     mingw*)
7084         JAVAINC="-I$JAVA_HOME/include"
7085         ;;
7087     *netbsd*)
7088         JAVAINC="-I$JAVA_HOME/include"
7089         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7090         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7091        ;;
7093     openbsd*)
7094         JAVAINC="-I$JAVA_HOME/include"
7095         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7096         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7097         ;;
7099     solaris*)
7100         JAVAINC="-I$JAVA_HOME/include"
7101         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7102         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7103         ;;
7104     esac
7106 SOLARINC="$SOLARINC $JAVAINC"
7108 AC_SUBST(JAVACOMPILER)
7109 AC_SUBST(JAVADOC)
7110 AC_SUBST(JAVAINTERPRETER)
7111 AC_SUBST(JAVAIFLAGS)
7112 AC_SUBST(JAVAFLAGS)
7113 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7114 AC_SUBST(JAVA_HOME)
7115 AC_SUBST(JAVA_SOURCE_VER)
7116 AC_SUBST(JAVA_TARGET_VER)
7117 AC_SUBST(JDK)
7119 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7120 if test -n "$with_idlc_cpp"; then
7121     AC_MSG_RESULT([$with_idlc_cpp])
7122     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7123 else
7124     AC_MSG_RESULT([ucpp])
7125     AC_MSG_CHECKING([which ucpp tp use])
7126     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7127         AC_MSG_RESULT([external])
7128         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7129     else
7130         AC_MSG_RESULT([internal])
7131         BUILD_TYPE="$BUILD_TYPE UCPP"
7132     fi
7134 AC_SUBST(SYSTEM_UCPP)
7136 dnl ===================================================================
7137 dnl Check for epm (not needed for Windows)
7138 dnl ===================================================================
7139 AC_MSG_CHECKING([whether to enable EPM for packing])
7140 if test "$enable_epm" = "yes"; then
7141     AC_MSG_RESULT([yes])
7142     if test "$_os" != "WINNT"; then
7143         if test $_os = Darwin; then
7144             EPM=internal
7145         elif test -n "$with_epm"; then
7146             EPM=$with_epm
7147         else
7148             AC_PATH_PROG(EPM, epm, no)
7149         fi
7150         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7151             echo "EPM will be built."
7152             BUILD_TYPE="$BUILD_TYPE EPM"
7153             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7154         else
7155             # Gentoo has some epm which is something different...
7156             AC_MSG_CHECKING([whether the found epm is the right epm])
7157             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7158                 AC_MSG_RESULT([yes])
7159             else
7160                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7161             fi
7162             AC_MSG_CHECKING([epm version])
7163             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7164             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7165                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7166                 AC_MSG_RESULT([OK, >= 3.7])
7167             else
7168                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7169                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7170             fi
7171         fi
7172     fi
7174     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7175         AC_MSG_CHECKING([for rpm])
7176         for a in "$RPM" rpmbuild rpm; do
7177             $a --usage >/dev/null 2> /dev/null
7178             if test $? -eq 0; then
7179                 RPM=$a
7180                 break
7181             else
7182                 $a --version >/dev/null 2> /dev/null
7183                 if test $? -eq 0; then
7184                     RPM=$a
7185                     break
7186                 fi
7187             fi
7188         done
7189         if test -z "$RPM"; then
7190             AC_MSG_ERROR([not found])
7191         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7192             RPM_PATH=`which $RPM`
7193             AC_MSG_RESULT([$RPM_PATH])
7194             SCPDEFS="$SCPDEFS -DWITH_RPM"
7195         else
7196             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7197         fi
7198     fi
7199     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7200         AC_PATH_PROG(DPKG, dpkg, no)
7201         if test "$DPKG" = "no"; then
7202             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7203         fi
7204     fi
7205     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7206        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7207         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7208             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7209                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7210                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7211                     AC_MSG_RESULT([yes])
7212                 else
7213                     AC_MSG_RESULT([no])
7214                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7215                         _pt="rpm"
7216                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7217                         add_warning "the rpms will need to be installed with --nodeps"
7218                     else
7219                         _pt="pkg"
7220                     fi
7221                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7222                     add_warning "the ${_pt}s will not be relocateable"
7223                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7224                                  relocation will work, you need to patch your epm with the
7225                                  patch in epm/epm-3.7.patch or build with
7226                                  --with-epm=internal which will build a suitable epm])
7227                 fi
7228             fi
7229         fi
7230     fi
7231     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7232         AC_PATH_PROG(PKGMK, pkgmk, no)
7233         if test "$PKGMK" = "no"; then
7234             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7235         fi
7236     fi
7237     AC_SUBST(RPM)
7238     AC_SUBST(DPKG)
7239     AC_SUBST(PKGMK)
7240 else
7241     for i in $PKGFORMAT; do
7242         case "$i" in
7243         aix | bsd | deb | pkg | rpm | native | portable)
7244             AC_MSG_ERROR(
7245                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7246             ;;
7247         esac
7248     done
7249     AC_MSG_RESULT([no])
7250     EPM=NO
7252 AC_SUBST(EPM)
7254 dnl ===================================================================
7255 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7256 dnl ===================================================================
7257 WINEGCC=
7258 if test "$enable_winegcc" = "yes"; then
7259     AC_PATH_PROG(WINEGCC, winegcc)
7260     if test "$WINEGCC" = ""; then
7261         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7262     fi
7263     CC_save="$CC"
7264     ac_exeext_save="$ac_exeext"
7265     CC="$WINEGCC -m32"
7266     ac_exeext=".exe"
7267     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7268 #include <stdio.h>
7269         ],[
7270 printf ("hello world\n");
7271         ])],,
7272         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7273     )
7274     CC="$CC_save"
7275     ac_exeext="$ac_exeext_save"
7277 AC_SUBST(WINEGCC)
7279 if test $_os = iOS; then
7280     enable_mpl_subset=yes
7281     enable_lotuswordpro=no
7282     enable_coinmp=yes
7283     enable_lpsolve=no
7284     enable_postgresql_sdbc=no
7285     enable_extension_integration=no
7286     enable_report_builder=no
7287     with_theme="tango"
7288     with_ppds=no
7291 ENABLE_LWP=
7292 if test "$enable_lotuswordpro" = "yes"; then
7293     ENABLE_LWP="TRUE"
7294     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7296 AC_SUBST(ENABLE_LWP)
7298 dnl ===================================================================
7299 dnl Check for gperf
7300 dnl ===================================================================
7301 AC_PATH_PROG(GPERF, gperf)
7302 if test -z "$GPERF"; then
7303     AC_MSG_ERROR([gperf not found but needed. Install it.])
7305 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7306     GPERF=`cygpath -m $GPERF`
7308 AC_MSG_CHECKING([gperf version])
7309 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7310     AC_MSG_RESULT([OK])
7311 else
7312     AC_MSG_ERROR([too old, you need at least 3.0.0])
7314 AC_SUBST(GPERF)
7316 dnl ===================================================================
7317 dnl Check for building ODK
7318 dnl ===================================================================
7319 if test "$enable_odk" = no; then
7320     unset DOXYGEN
7321 else
7322     if test "$with_doxygen" = no; then
7323         AC_MSG_CHECKING([for doxygen])
7324         unset DOXYGEN
7325         AC_MSG_RESULT([no])
7326     else
7327         if test "$with_doxygen" = yes; then
7328             AC_PATH_PROG([DOXYGEN], [doxygen])
7329             if test -z "$DOXYGEN"; then
7330                 if test "$enable_odk" = "" ; then
7331                     enable_odk="no"
7332                 else
7333                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7334                 fi
7335             fi
7336         else
7337             AC_MSG_CHECKING([for doxygen])
7338             DOXYGEN=$with_doxygen
7339             AC_MSG_RESULT([$DOXYGEN])
7340         fi
7341         if test -n "$DOXYGEN"; then
7342             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7343             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7344             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7345                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7346             fi
7347         fi
7348     fi
7350 AC_SUBST([DOXYGEN])
7352 AC_MSG_CHECKING([whether to build the ODK])
7353 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7354     AC_MSG_RESULT([yes])
7356     if test "$with_java" != "no"; then
7357         AC_MSG_CHECKING([whether to build unowinreg.dll])
7358         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7359             # build on Win by default
7360             enable_build_unowinreg=yes
7361         fi
7362         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7363             AC_MSG_RESULT([no])
7364             BUILD_UNOWINREG=
7365         else
7366             AC_MSG_RESULT([yes])
7367             BUILD_UNOWINREG=TRUE
7368         fi
7369         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7370             if test -z "$with_mingw_cross_compiler"; then
7371                 dnl Guess...
7372                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7373             elif test -x "$with_mingw_cross_compiler"; then
7374                  MINGWCXX="$with_mingw_cross_compiler"
7375             else
7376                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7377             fi
7379             if test "$MINGWCXX" = "false"; then
7380                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7381             fi
7383             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7384             if test -x "$mingwstrip_test"; then
7385                 MINGWSTRIP="$mingwstrip_test"
7386             else
7387                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7388             fi
7390             if test "$MINGWSTRIP" = "false"; then
7391                 AC_MSG_ERROR(MinGW32 binutils not found.)
7392             fi
7393         fi
7394     fi
7395     BUILD_TYPE="$BUILD_TYPE ODK"
7396 else
7397     AC_MSG_RESULT([no])
7398     BUILD_UNOWINREG=
7400 AC_SUBST(BUILD_UNOWINREG)
7401 AC_SUBST(MINGWCXX)
7402 AC_SUBST(MINGWSTRIP)
7404 dnl ===================================================================
7405 dnl Check for system zlib
7406 dnl ===================================================================
7407 if test "$with_system_zlib" = "auto"; then
7408     case "$_os" in
7409     WINNT)
7410         with_system_zlib="$with_system_libs"
7411         ;;
7412     *)
7413         with_system_zlib=yes
7414         ;;
7415     esac
7418 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7419 dnl and has no pkg-config for it at least on some tinderboxes,
7420 dnl so leaving that out for now
7421 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7422 AC_MSG_CHECKING([which zlib to use])
7423 if test "$with_system_zlib" = "yes"; then
7424     AC_MSG_RESULT([external])
7425     SYSTEM_ZLIB=TRUE
7426     AC_CHECK_HEADER(zlib.h, [],
7427         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7428     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7429         [AC_MSG_ERROR(zlib not found or functional)], [])
7430 else
7431     AC_MSG_RESULT([internal])
7432     SYSTEM_ZLIB=
7433     BUILD_TYPE="$BUILD_TYPE ZLIB"
7434     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7435     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7437 AC_SUBST(ZLIB_CFLAGS)
7438 AC_SUBST(ZLIB_LIBS)
7439 AC_SUBST(SYSTEM_ZLIB)
7441 dnl ===================================================================
7442 dnl Check for system jpeg
7443 dnl ===================================================================
7444 if test "$with_jpeg_turbo" = "auto"; then
7445     # TODO use jpeg-turbo on Darwin too
7446     case "$_os" in
7447     WINNT)
7448         with_jpeg_turbo=yes
7449         ;;
7450     *)
7451         with_jpeg_turbo=no
7452         ;;
7453     esac
7456 if test "$with_system_jpeg" = "yes"; then
7457     AC_MSG_RESULT([external])
7458     SYSTEM_JPEG=TRUE
7459     AC_CHECK_HEADER(jpeglib.h, [],
7460         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7461     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7462     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7463     libo_MINGW_CHECK_DLL([libjpeg])
7464 else
7465     SYSTEM_JPEG=
7466     if test "$with_jpeg_turbo" = "yes"; then
7467         AC_MSG_RESULT([internal, jpeg-turbo])
7468         BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7469         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7471         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7472             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7473                 NASM="$LODE_HOME/opt/bin/nasm"
7474             elif test -x "/opt/lo/bin/nasm"; then
7475                 NASM="/opt/lo/bin/nasm"
7476             fi
7477         fi
7478         if test -z "$NASM"; then
7479 cat << _EOS
7480 ****************************************************************************
7481 You need nasm (Netwide Assembler) to build internal jpeg library.
7482 To get one please do:
7484 _EOS
7485         if test "$build_os" = "cygwin"; then
7486 cat << _EOS
7487 install a pre-compiled binary for Win32
7489  mkdir -p /opt/lo/bin
7490  cd /opt/lo/bin
7491  wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7492  chmod +x nasm
7493 _EOS
7494             else
7495 cat << _EOS
7496 consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
7497 _EOS
7498             fi
7499 cat << _EOS
7501 or get and install one from http://www.nasm.us/
7503 Then re-run autogen.sh
7505 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7506 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7508 _EOS
7509         AC_MSG_ERROR([no nasm (Netwide Assembler) found])
7510         fi
7511     else
7512         AC_MSG_RESULT([internal, jpeg])
7513         BUILD_TYPE="$BUILD_TYPE JPEG"
7514     fi
7516 AC_SUBST(NASM)
7517 AC_SUBST(SYSTEM_JPEG)
7519 dnl ===================================================================
7520 dnl Check for system clucene
7521 dnl ===================================================================
7522 dnl we should rather be using
7523 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7524 dnl but the contribs-lib check seems tricky
7525 AC_MSG_CHECKING([which clucene to use])
7526 if test "$with_system_clucene" = "yes"; then
7527     AC_MSG_RESULT([external])
7528     SYSTEM_CLUCENE=TRUE
7529     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7530     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7531     AC_LANG_PUSH([C++])
7532     save_CXXFLAGS=$CXXFLAGS
7533     save_CPPFLAGS=$CPPFLAGS
7534     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7535     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7536     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7537     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7538     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7539                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7540     CXXFLAGS=$save_CXXFLAGS
7541     CPPFLAGS=$save_CPPFLAGS
7542     AC_LANG_POP([C++])
7544     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7545 else
7546     AC_MSG_RESULT([internal])
7547     SYSTEM_CLUCENE=
7548     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7550 AC_SUBST(SYSTEM_CLUCENE)
7551 AC_SUBST(CLUCENE_CFLAGS)
7552 AC_SUBST(CLUCENE_LIBS)
7554 dnl ===================================================================
7555 dnl Check for system expat
7556 dnl ===================================================================
7557 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7558 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7559 AC_MSG_CHECKING([which expat to use])
7560 if test "$with_system_expat" = "yes"; then
7561     AC_MSG_RESULT([external])
7562     SYSTEM_EXPAT=TRUE
7563     AC_CHECK_HEADER(expat.h, [],
7564         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7565     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7566         [AC_MSG_RESULT(expat library not found or functional.)], [])
7567     libo_MINGW_CHECK_DLL([libexpat])
7568 else
7569     AC_MSG_RESULT([internal])
7570     SYSTEM_EXPAT=
7571     BUILD_TYPE="$BUILD_TYPE EXPAT"
7573 AC_SUBST(SYSTEM_EXPAT)
7575 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7576 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7577     ENABLE_EOT="TRUE"
7578     AC_DEFINE([ENABLE_EOT])
7579     AC_MSG_RESULT([yes])
7581     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7582 else
7583     ENABLE_EOT=
7584     AC_MSG_RESULT([no])
7586 AC_SUBST([ENABLE_EOT])
7588 dnl ===================================================================
7589 dnl Check for system librevenge
7590 dnl ===================================================================
7591 AS_IF([test "$COM" = "MSC"],
7592       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7593       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7595 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7597 dnl ===================================================================
7598 dnl Check for system libe-book
7599 dnl ===================================================================
7600 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1 >= 0.1.1])
7602 dnl ===================================================================
7603 dnl Check for system libetonyek
7604 dnl ===================================================================
7605 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1 >= 0.1.2])
7607 dnl ===================================================================
7608 dnl Check for system libfreehand
7609 dnl ===================================================================
7610 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7612 dnl ===================================================================
7613 dnl Check for system libodfgen
7614 dnl ===================================================================
7615 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7617 dnl ===================================================================
7618 dnl Check for system libcdr
7619 dnl ===================================================================
7620 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7622 dnl ===================================================================
7623 dnl Check for system libmspub
7624 dnl ===================================================================
7625 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7627 dnl ===================================================================
7628 dnl Check for system libmwaw
7629 dnl ===================================================================
7630 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.5])
7632 dnl ===================================================================
7633 dnl Check for system libpagemaker
7634 dnl ===================================================================
7635 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7637 dnl ===================================================================
7638 dnl Check for system libvisio
7639 dnl ===================================================================
7640 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7642 dnl ===================================================================
7643 dnl Check for system libcmis
7644 dnl ===================================================================
7645 # libcmis requires curl and we can't build curl for iOS
7646 if test $_os != iOS; then
7647     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7648     ENABLE_CMIS=TRUE
7649 else
7650     ENABLE_CMIS=
7652 AC_SUBST(ENABLE_CMIS)
7654 dnl ===================================================================
7655 dnl Check for system libwpd
7656 dnl ===================================================================
7657 AS_IF([test "$COM" = "MSC"],
7658       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7659       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7661 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7663 dnl ===================================================================
7664 dnl Check for system lcms2
7665 dnl ===================================================================
7666 if test "$with_system_lcms2" = "yes"; then
7667     libo_MINGW_CHECK_DLL([liblcms2])
7668 else
7669     SYSTEM_LCMS2=
7671 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7672 if test "$GCC" = "yes"; then
7673     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7675 if test "$COM" = "MSC"; then # override the above
7676     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7679 dnl ===================================================================
7680 dnl Check for system cppunit
7681 dnl ===================================================================
7682 if test "$cross_compiling" != "yes"; then
7683     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7686 dnl ===================================================================
7687 dnl Check whether freetype is available
7688 dnl ===================================================================
7689 if test  "$test_freetype" = "yes"; then
7690     AC_MSG_CHECKING([whether freetype is available])
7691     # FreeType has 3 different kinds of versions
7692     # * release, like 2.4.10
7693     # * libtool, like 13.0.7 (this what pkg-config returns)
7694     # * soname
7695     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7696     #
7697     # 9.9.3 is 2.2.0
7698     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7699     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7700     SYSTEM_FREETYPE=TRUE
7701     _save_libs="$LIBS"
7702     _save_cflags="$CFLAGS"
7703     LIBS="$LIBS $FREETYPE_LIBS"
7704     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7705     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7706     LIBS="$_save_libs"
7707     CFLAGS="$_save_cflags"
7709 AC_SUBST(FREETYPE_CFLAGS)
7710 AC_SUBST(FREETYPE_LIBS)
7711 AC_SUBST([SYSTEM_FREETYPE])
7713 dnl ===================================================================
7714 dnl Check for system libabw
7715 dnl ===================================================================
7716 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7718 dnl ===================================================================
7719 dnl Check for system libwps
7720 dnl ===================================================================
7721 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7723 dnl ===================================================================
7724 dnl Check for system libwpg
7725 dnl ===================================================================
7726 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7728 # ===================================================================
7729 # Check for system libxslt
7730 # to prevent incompatibilities between internal libxml2 and external libxslt,
7731 # or vice versa, use with_system_libxml here
7732 # ===================================================================
7733 if test "$with_system_libxml" = "auto"; then
7734     case "$_os" in
7735     WINNT|iOS|Android)
7736         with_system_libxml="$with_system_libs"
7737         ;;
7738     *)
7739         with_system_libxml=yes
7740         ;;
7741     esac
7744 AC_MSG_CHECKING([which libxslt to use])
7745 if test "$with_system_libxml" = "yes"; then
7746     AC_MSG_RESULT([external])
7747     SYSTEM_LIBXSLT=TRUE
7748     if test "$_os" = "Darwin"; then
7749         dnl make sure to use SDK path
7750         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7751         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7752         dnl omit -L/usr/lib
7753         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7754         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7755     else
7756         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7757         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7758         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7759         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7760     fi
7762     dnl Check for xsltproc
7763     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7764     if test "$XSLTPROC" = "no"; then
7765         AC_MSG_ERROR([xsltproc is required])
7766     fi
7768     libo_MINGW_CHECK_DLL([libxslt])
7769     libo_MINGW_CHECK_DLL([libexslt])
7770     libo_MINGW_TRY_DLL([iconv])
7771 else
7772     AC_MSG_RESULT([internal])
7773     SYSTEM_LIBXSLT=
7774     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7776     if test "$cross_compiling" = "yes"; then
7777         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7778         if test "$XSLTPROC" = "no"; then
7779             AC_MSG_ERROR([xsltproc is required])
7780         fi
7781     fi
7783 AC_SUBST(SYSTEM_LIBXSLT)
7784 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7785     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7787 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7789 AC_SUBST(LIBEXSLT_CFLAGS)
7790 AC_SUBST(LIBEXSLT_LIBS)
7791 AC_SUBST(LIBXSLT_CFLAGS)
7792 AC_SUBST(LIBXSLT_LIBS)
7793 AC_SUBST(XSLTPROC)
7795 # ===================================================================
7796 # Check for system libxml
7797 # ===================================================================
7798 AC_MSG_CHECKING([which libxml to use])
7799 if test "$with_system_libxml" = "yes"; then
7800     AC_MSG_RESULT([external])
7801     SYSTEM_LIBXML=TRUE
7802     if test "$_os" = "Darwin"; then
7803         dnl make sure to use SDK path
7804         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7805         dnl omit -L/usr/lib
7806         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7807     elif test $_os = iOS; then
7808         dnl make sure to use SDK path
7809         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7810         LIBXML_CFLAGS="-I$usr/include/libxml2"
7811         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7812     else
7813         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7814         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7815     fi
7817     dnl Check for xmllint
7818     AC_PATH_PROG(XMLLINT, xmllint, no)
7819     if test "$XMLLINT" = "no"; then
7820         AC_MSG_ERROR([xmllint is required])
7821     fi
7823     libo_MINGW_CHECK_DLL([libxml2])
7824     libo_MINGW_TRY_DLL([zlib1])
7825 else
7826     AC_MSG_RESULT([internal])
7827     SYSTEM_LIBXML=
7828     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
7829     if test "$COM" = "MSC"; then
7830         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7831     fi
7832     if test "$COM" = "MSC"; then
7833         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
7834     else
7835         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
7836     fi
7837     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7839 AC_SUBST(SYSTEM_LIBXML)
7840 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7841     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7843 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7844 AC_SUBST(LIBXML_CFLAGS)
7845 AC_SUBST(LIBXML_LIBS)
7846 AC_SUBST(XMLLINT)
7848 # =====================================================================
7849 # Checking for a Python interpreter with version >= 2.6.
7850 # Build and runtime requires Python 3 compatible version (>= 2.6).
7851 # Optionally user can pass an option to configure, i. e.
7852 # ./configure PYTHON=/usr/bin/python
7853 # =====================================================================
7854 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7855     # This allows a lack of system python with no error, we use internal one in that case.
7856     AM_PATH_PYTHON([2.6],, [:])
7857     # Clean PYTHON_VERSION checked below if cross-compiling
7858     PYTHON_VERSION=""
7859     if test "$PYTHON" != ":"; then
7860         PYTHON_FOR_BUILD=$PYTHON
7861     fi
7863 AC_SUBST(PYTHON_FOR_BUILD)
7865 # Checks for Python to use for Pyuno
7866 AC_MSG_CHECKING([which Python to use for Pyuno])
7867 case "$enable_python" in
7868 no|disable)
7869     if test -z $PYTHON_FOR_BUILD; then
7870         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7871         # requirement from the choice whether to include Python stuff in the installer, but why
7872         # bother?
7873         AC_MSG_ERROR([Python is required at build time.])
7874     fi
7875     enable_python=no
7876     AC_MSG_RESULT([none])
7877     ;;
7878 ""|yes|auto)
7879     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7880         AC_MSG_RESULT([no, overridden by --disable-scripting])
7881         enable_python=no
7882     elif test $build_os = cygwin; then
7883         dnl When building on Windows we don't attempt to use any installed
7884         dnl "system"  Python.
7885         dnl
7886         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7887         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7888         dnl MinGW cross-compilation setups.)
7889         AC_MSG_RESULT([fully internal])
7890         enable_python=internal
7891     elif test "$cross_compiling" = yes; then
7892         AC_MSG_RESULT([system])
7893         enable_python=system
7894     else
7895         # Unset variables set by the above AM_PATH_PYTHON so that
7896         # we actually do check anew.
7897         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
7898         AM_PATH_PYTHON([3.3],, [:])
7899         if test "$PYTHON" = ":"; then
7900             if test -z "$PYTHON_FOR_BUILD"; then
7901                 AC_MSG_RESULT([fully internal])
7902             else
7903                 AC_MSG_RESULT([internal])
7904             fi
7905             enable_python=internal
7906         else
7907             AC_MSG_RESULT([system])
7908             enable_python=system
7909         fi
7910     fi
7911     ;;
7912 internal)
7913     AC_MSG_RESULT([internal])
7914     ;;
7915 fully-internal)
7916     AC_MSG_RESULT([fully internal])
7917     enable_python=internal
7918     ;;
7919 system)
7920     AC_MSG_RESULT([system])
7921     ;;
7923     AC_MSG_ERROR([Incorrect --enable-python option])
7924     ;;
7925 esac
7927 if test $enable_python != no; then
7928     BUILD_TYPE="$BUILD_TYPE PYUNO"
7931 if test $enable_python = system; then
7932     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7933         python_version=2.7
7934         PYTHON=python$python_version
7935         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
7936             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
7937             PYTHON_LIBS="-framework Python"
7938         else
7939             PYTHON_CFLAGS="`$PYTHON-config --includes`"
7940             PYTHON_LIBS="`$PYTHON-config --libs`"
7941         fi
7942     fi
7943     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
7944         # Fallback: Accept these in the environment, or as set above
7945         # for MacOSX.
7946         :
7947     elif test "$cross_compiling" != yes; then
7948         # Unset variables set by the above AM_PATH_PYTHON so that
7949         # we actually do check anew.
7950         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
7951         # This causes an error if no python command is found
7952         AM_PATH_PYTHON([3.3])
7953         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
7954         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
7955         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
7956         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
7957         if test -z "$PKG_CONFIG"; then
7958             PYTHON_CFLAGS="-I$python_include"
7959             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7960         elif $PKG_CONFIG --exists python-$python_version; then
7961             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
7962             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
7963         else
7964             PYTHON_CFLAGS="-I$python_include"
7965             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7966         fi
7967     else
7968         dnl How to find out the cross-compilation Python installation path?
7969         dnl Let's hardocode what we know for different distributions for now...
7970         for python_version in 2.6; do
7971             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
7972                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
7973                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
7974                 AC_MSG_CHECKING([for python.exe])
7975                 libo_MINGW_CHECK_DLL([libpython$python_version])
7976                 libo_MINGW_CHECK_DLL([libreadline6])
7977                 libo_MINGW_CHECK_DLL([libtermcap])
7978                 # could we somehow extract the really mingw python version from
7979                 # actual distro package?
7980                 # 2.6.2 currently on OpenSUSE 12.1?
7981                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
7982                 PYTHON_VERSION=$python_version.2
7983                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
7984                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
7985                 break
7986             fi
7987         done
7988         AC_MSG_CHECKING([for python version])
7989         AS_IF([test -n "$PYTHON_VERSION"],
7990               [AC_MSG_RESULT([$PYTHON_VERSION])],
7991               [AC_MSG_RESULT([not found])
7992                AC_MSG_ERROR([no usable python found])])
7993         test -n "$PYTHON_CFLAGS" && break
7994     fi
7995     # let the PYTHON_FOR_BUILD match the same python installation that
7996     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
7997     # better for PythonTests.
7998     PYTHON_FOR_BUILD=$PYTHON
8001 dnl By now enable_python should be "system", "internal" or "no"
8002 case $enable_python in
8003 system)
8004     SYSTEM_PYTHON=TRUE
8006     if test "$CROSS_COMPILING" != TRUE; then
8007         dnl Check if the headers really work
8008         save_CPPFLAGS="$CPPFLAGS"
8009         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8010         AC_CHECK_HEADER(Python.h, [],
8011            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8012            [])
8013         CPPFLAGS="$save_CPPFLAGS"
8015         AC_LANG_PUSH(C)
8016         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8017         AC_MSG_CHECKING([for correct python library version])
8018            AC_RUN_IFELSE([AC_LANG_SOURCE([[
8019 #include <Python.h>
8021 int main(int argc, char **argv) {
8022        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8023            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8024        else return 1;
8026            ]])],[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])],[])
8027         CFLAGS=$save_CFLAGS
8028         AC_LANG_POP(C)
8030         dnl FIXME Check if the Python library can be linked with, too?
8031     fi
8032     ;;
8034 internal)
8035     SYSTEM_PYTHON=
8036     PYTHON_VERSION_MAJOR=3
8037     PYTHON_VERSION_MINOR=3
8038     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
8039     BUILD_TYPE="$BUILD_TYPE PYTHON"
8040     # Embedded Python dies without Home set
8041     if test "$HOME" = ""; then
8042         export HOME=""
8043     fi
8044     # bz2 tarball and bzip2 is not standard
8045     if test -z "$BZIP2"; then
8046         AC_PATH_PROG( BZIP2, bzip2)
8047         if test -z "$BZIP2"; then
8048             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8049         fi
8050     fi
8051     ;;
8053     DISABLE_PYTHON=TRUE
8054     SYSTEM_PYTHON=
8055     ;;
8057     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8058     ;;
8059 esac
8061 AC_SUBST(DISABLE_PYTHON)
8062 AC_SUBST(SYSTEM_PYTHON)
8063 AC_SUBST(PYTHON_CFLAGS)
8064 AC_SUBST(PYTHON_LIBS)
8065 AC_SUBST(PYTHON_VERSION)
8066 AC_SUBST(PYTHON_VERSION_MAJOR)
8067 AC_SUBST(PYTHON_VERSION_MINOR)
8069 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8070 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8071     AC_MSG_RESULT([yes])
8072     ENABLE_MARIADBC=TRUE
8073     MARIADBC_MAJOR=1
8074     MARIADBC_MINOR=0
8075     MARIADBC_MICRO=2
8076     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8077 else
8078     AC_MSG_RESULT([no])
8079     ENABLE_MARIADBC=
8081 AC_SUBST(ENABLE_MARIADBC)
8082 AC_SUBST(MARIADBC_MAJOR)
8083 AC_SUBST(MARIADBC_MINOR)
8084 AC_SUBST(MARIADBC_MICRO)
8086 if test "$ENABLE_MARIADBC" = "TRUE"; then
8088     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8090     dnl ===================================================================
8091     dnl Check for system MariaDB
8092     dnl ===================================================================
8093     AC_MSG_CHECKING([which MariaDB to use])
8094     if test "$with_system_mariadb" = "yes"; then
8095         AC_MSG_RESULT([external])
8096         SYSTEM_MARIADB=TRUE
8097         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8098         if test -z "$MARIADBCONFIG"; then
8099             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8100             if test -z "$MARIADBCONFIG"; then
8101                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8102                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8103             fi
8104         fi
8105         AC_MSG_CHECKING([MariaDB version])
8106         MARIADB_VERSION=`$MARIADBCONFIG --version`
8107         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8108         if test "$MARIADB_MAJOR" -ge "5"; then
8109             AC_MSG_RESULT([OK])
8110         else
8111             AC_MSG_ERROR([too old, use 5.0.x or later])
8112         fi
8113         AC_MSG_CHECKING([for MariaDB Client library])
8114         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8115         if test "$COM_GCC_IS_CLANG" = TRUE; then
8116             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8117         fi
8118         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8119         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8120         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8121         dnl linux32:
8122         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8123             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8124             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8125                 | sed -e 's|/lib64/|/lib/|')
8126         fi
8127         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8128         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8129         if test "$enable_bundle_mariadb" = "yes"; then
8130             AC_MSG_RESULT([yes])
8131             BUNDLE_MARIADB=TRUE
8132             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8134 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8136 /g' | grep -E '(mysqlclient|mariadb)')
8137             if test "$_os" = "Darwin"; then
8138                 LIBMARIADB=${LIBMARIADB}.dylib
8139             elif test "$_os" = "WINNT"; then
8140                 LIBMARIADB=${LIBMARIADB}.dll
8141             else
8142                 LIBMARIADB=${LIBMARIADB}.so
8143             fi
8144             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8145             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8146             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8147                 AC_MSG_RESULT([found.])
8148                 PathFormat "$LIBMARIADB_PATH"
8149                 LIBMARIADB_PATH="$formatted_path"
8150             else
8151                 AC_MSG_ERROR([not found.])
8152             fi
8153         else
8154             AC_MSG_RESULT([no])
8155             BUNDLE_MARIADB=
8156         fi
8157     else
8158         AC_MSG_RESULT([internal])
8159         SYSTEM_MARIADB=
8160         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8161         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8162         BUILD_TYPE="$BUILD_TYPE MARIADB"
8163     fi
8165     AC_SUBST(SYSTEM_MARIADB)
8166     AC_SUBST(MARIADB_CFLAGS)
8167     AC_SUBST(MARIADB_LIBS)
8168     AC_SUBST(LIBMARIADB)
8169     AC_SUBST(LIBMARIADB_PATH)
8170     AC_SUBST(BUNDLE_MARIADB)
8172     AC_LANG_PUSH([C++])
8173     dnl ===================================================================
8174     dnl Check for system MySQL C++ Connector
8175     dnl ===================================================================
8176     # FIXME!
8177     # who thought this too-generic cppconn dir was a good idea?
8178     AC_MSG_CHECKING([MySQL Connector/C++])
8179     if test "$with_system_mysql_cppconn" = "yes"; then
8180         AC_MSG_RESULT([external])
8181         SYSTEM_MYSQL_CPPCONN=TRUE
8182         AC_LANG_PUSH([C++])
8183         AC_CHECK_HEADER(mysql_driver.h, [],
8184                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8185         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8186                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8187         save_LIBS=$LIBS
8188         LIBS="$LIBS -lmysqlcppconn"
8189         AC_MSG_CHECKING([version])
8190         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8191 #include <mysql_driver.h>
8193 int main(int argc, char **argv) {
8194     sql::Driver *driver;
8195     driver = get_driver_instance();
8196     if (driver->getMajorVersion() > 1 || \
8197        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8198        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8199         return 0;
8200       else
8201         return 1;
8203       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8205         AC_LANG_POP([C++])
8206         LIBS=$save_LIBS
8207     else
8208         AC_MSG_RESULT([internal])
8209         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8210         SYSTEM_MYSQL_CPPCONN=
8211     fi
8212     AC_LANG_POP([C++])
8214 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8216 dnl ===================================================================
8217 dnl Check for system hsqldb
8218 dnl ===================================================================
8219 if test "$with_java" != "no"; then
8220     HSQLDB_USE_JDBC_4_1=
8221     AC_MSG_CHECKING([which hsqldb to use])
8222     if test "$with_system_hsqldb" = "yes"; then
8223         AC_MSG_RESULT([external])
8224         SYSTEM_HSQLDB=TRUE
8225         if test -z $HSQLDB_JAR; then
8226             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8227         fi
8228         AC_CHECK_FILE($HSQLDB_JAR, [],
8229                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8230         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8231         export HSQLDB_JAR
8232         if $PERL -e \
8233            'use Archive::Zip;
8234             my $file = "$ENV{'HSQLDB_JAR'}";
8235             my $zip = Archive::Zip->new( $file );
8236             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8237             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8238             {
8239                 push @l, split(/\n/, $mf);
8240                 foreach my $line (@l)
8241                 {
8242                     if ($line =~ m/Specification-Version:/)
8243                     {
8244                         ($t, $version) = split (/:/,$line);
8245                         $version =~ s/^\s//;
8246                         ($a, $b, $c, $d) = split (/\./,$version);
8247                         if ($c == "0" && $d > "8")
8248                         {
8249                             exit 0;
8250                         }
8251                         else
8252                         {
8253                             exit 1;
8254                         }
8255                     }
8256                 }
8257             }
8258             else
8259             {
8260                 exit 1;
8261             }'; then
8262             AC_MSG_RESULT([yes])
8263         else
8264             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8265         fi
8266     else
8267         AC_MSG_RESULT([internal])
8268         SYSTEM_HSQLDB=
8269         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8270         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8271         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8272         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8273             AC_MSG_RESULT([yes])
8274             HSQLDB_USE_JDBC_4_1=TRUE
8275         else
8276             AC_MSG_RESULT([no])
8277         fi
8278     fi
8279     AC_SUBST(SYSTEM_HSQLDB)
8280     AC_SUBST(HSQLDB_JAR)
8281     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8284 dnl ===================================================================
8285 dnl Check for PostgreSQL stuff
8286 dnl ===================================================================
8287 if test "x$enable_postgresql_sdbc" != "xno"; then
8288     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8290     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8291         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8292     fi
8293     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8294         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8295     fi
8297     AC_MSG_CHECKING([PostgreSQL C interface])
8298     if test "$with_system_postgresql" = "yes"; then
8299         AC_MSG_RESULT([external PostgreSQL])
8300         SYSTEM_POSTGRESQL=TRUE
8301         if test "$_os" = Darwin; then
8302             supp_path=''
8303             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8304                 pg_supp_path="$P_SEP$d$pg_supp_path"
8305             done
8306         fi
8307         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8308         if test -z "$PGCONFIG"; then
8309             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8310         fi
8311         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8312         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8313     else
8314         # if/when anything else than PostgreSQL uses Kerberos,
8315         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8316         WITH_KRB5=
8317         WITH_GSSAPI=
8318         case "$_os" in
8319         Darwin)
8320             # MacOS X has system MIT Kerberos 5 since 10.4
8321             if test "$with_krb5" != "no"; then
8322                 WITH_KRB5=TRUE
8323                 save_LIBS=$LIBS
8324                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8325                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8326                 KRB5_LIBS=$LIBS
8327                 LIBS=$save_LIBS
8328                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8329                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8330                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8331                 LIBS=$save_LIBS
8332             fi
8333             if test "$with_gssapi" != "no"; then
8334                 WITH_GSSAPI=TRUE
8335                 save_LIBS=$LIBS
8336                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8337                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8338                 GSSAPI_LIBS=$LIBS
8339                 LIBS=$save_LIBS
8340             fi
8341             ;;
8342         WINNT)
8343             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8344                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8345             fi
8346             ;;
8347         Linux|GNU|*BSD|DragonFly)
8348             if test "$with_krb5" != "no"; then
8349                 WITH_KRB5=TRUE
8350                 save_LIBS=$LIBS
8351                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8352                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8353                 KRB5_LIBS=$LIBS
8354                 LIBS=$save_LIBS
8355                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8356                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8357                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8358                 LIBS=$save_LIBS
8359             fi
8360             if test "$with_gssapi" != "no"; then
8361                 WITH_GSSAPI=TRUE
8362                 save_LIBS=$LIBS
8363                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8364                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8365                 GSSAPI_LIBS=$LIBS
8366                 LIBS=$save_LIBS
8367             fi
8368             ;;
8369         *)
8370             if test "$with_krb5" = "yes"; then
8371                 WITH_KRB5=TRUE
8372                 save_LIBS=$LIBS
8373                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8374                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8375                 KRB5_LIBS=$LIBS
8376                 LIBS=$save_LIBS
8377                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8378                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8379                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8380                 LIBS=$save_LIBS
8381             fi
8382             if test "$with_gssapi" = "yes"; then
8383                 WITH_GSSAPI=TRUE
8384                 save_LIBS=$LIBS
8385                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8386                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8387                 LIBS=$save_LIBS
8388                 GSSAPI_LIBS=$LIBS
8389             fi
8390         esac
8392         if test -n "$with_libpq_path"; then
8393             SYSTEM_POSTGRESQL=TRUE
8394             AC_MSG_RESULT([external libpq])
8395             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8396             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8397         else
8398             SYSTEM_POSTGRESQL=
8399             AC_MSG_RESULT([internal])
8400             POSTGRESQL_LIB=""
8401             POSTGRESQL_INC="%OVERRIDE_ME%"
8402             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8403         fi
8404     fi
8405     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8406         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8407         save_CFLAGS=$CFLAGS
8408         save_CPPFLAGS=$CPPFLAGS
8409         save_LIBS=$LIBS
8410         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8411         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8412         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8413         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8414             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8415         CFLAGS=$save_CFLAGS
8416         CPPFLAGS=$save_CPPFLAGS
8417         LIBS=$save_LIBS
8418     fi
8419     BUILD_POSTGRESQL_SDBC=TRUE
8421 AC_SUBST(WITH_KRB5)
8422 AC_SUBST(WITH_GSSAPI)
8423 AC_SUBST(GSSAPI_LIBS)
8424 AC_SUBST(KRB5_LIBS)
8425 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8426 AC_SUBST(SYSTEM_POSTGRESQL)
8427 AC_SUBST(POSTGRESQL_INC)
8428 AC_SUBST(POSTGRESQL_LIB)
8430 dnl ===================================================================
8431 dnl Check for Firebird stuff
8432 dnl ===================================================================
8433 ENABLE_FIREBIRD_SDBC=""
8434 if test "x$enable_firebird_sdbc" = "xyes"; then
8435     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8437     dnl ===================================================================
8438     dnl Check for system Firebird
8439     dnl ===================================================================
8440     AC_MSG_CHECKING([which Firebird to use])
8441     if test "$with_system_firebird" = "yes"; then
8442         AC_MSG_RESULT([external])
8443         SYSTEM_FIREBIRD=TRUE
8444         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8445         if test -z "$FIREBIRDCONFIG"; then
8446             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8447             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8448             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8449         else
8450             AC_MSG_NOTICE([fb_config found])
8451             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8452             AC_MSG_CHECKING([for Firebird Client library])
8453             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8454             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8455         fi
8456         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8457         AC_MSG_CHECKING([Firebird version])
8458         if test -n "${FIREBIRD_VERSION}"; then
8459             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8460             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8461             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8462                 AC_MSG_RESULT([OK])
8463             else
8464                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8465             fi
8466         else
8467             __save_CFLAGS="${CFLAGS}"
8468             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8469             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8470 #if defined(FB_API_VER) && FB_API_VER == 25
8471 #else
8472 #error "Wrong Firebird API version"
8473 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8474             CFLAGS="${__save_CFLAGS}"
8475         fi
8476         ENABLE_FIREBIRD_SDBC="TRUE"
8477     elif test "$enable_database_connectivity" != yes; then
8478         AC_MSG_RESULT([none])
8479     elif test "$cross_compiling" = "yes"; then
8480         AC_MSG_RESULT([none])
8481     else
8482         dnl We need libatomic-ops for any non X86/X64 system
8483         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8484             dnl ===================================================================
8485             dnl Check for system libatomic-ops
8486             dnl ===================================================================
8487             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8488             if test "$with_system_libatomic_ops" = "yes"; then
8489                 SYSTEM_LIBATOMIC_OPS=TRUE
8490                 AC_CHECK_HEADERS(atomic_ops.h, [],
8491                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8492             else
8493                 SYSTEM_LIBATOMIC_OPS=
8494                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8495                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8496                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8497             fi
8498         fi
8500         AC_MSG_RESULT([internal])
8501         SYSTEM_FIREBIRD=
8502         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8503         FIREBIRD_LIBS="-lfbembed"
8505         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8506         ENABLE_FIREBIRD_SDBC="TRUE"
8507     fi
8509 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8510 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8511 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8512 AC_SUBST(LIBATOMIC_OPS_LIBS)
8513 AC_SUBST(SYSTEM_FIREBIRD)
8514 AC_SUBST(FIREBIRD_CFLAGS)
8515 AC_SUBST(FIREBIRD_LIBS)
8516 dnl AC_SUBST([TOMMATH_CFLAGS])
8517 dnl AC_SUBST([TOMMATH_LIBS])
8519 dnl ===================================================================
8520 dnl Check for system curl
8521 dnl ===================================================================
8522 AC_MSG_CHECKING([which libcurl to use])
8523 if test "$with_system_curl" = "auto"; then
8524     with_system_curl="$with_system_libs"
8527 if test "$with_system_curl" = "yes"; then
8528     AC_MSG_RESULT([external])
8529     SYSTEM_CURL=TRUE
8531     AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8533     # First try PKGCONFIG and then fall back
8534     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8536     if test -n "$CURL_PKG_ERRORS"; then
8537         AC_PATH_PROG(CURLCONFIG, curl-config)
8538         if test -z "$CURLCONFIG"; then
8539             AC_MSG_ERROR([curl development files not found])
8540         fi
8541         CURL_LIBS=`$CURLCONFIG --libs`
8542         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8543         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8545         case $curl_version in
8546         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8547         dnl so they need to be doubled to end up in the configure script
8548         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8549             ;;
8550         *)
8551             AC_MSG_ERROR([no, you have $curl_version])
8552             ;;
8553         esac
8554     fi
8555     AC_MSG_RESULT([yes])
8557     libo_MINGW_CHECK_DLL([libcurl])
8558     libo_MINGW_TRY_DLL([libintl])
8559     libo_MINGW_TRY_DLL([libidn])
8560     libo_MINGW_TRY_DLL([libnspr4])
8561     libo_MINGW_TRY_DLL([nssutil3])
8562     libo_MINGW_TRY_DLL([libplc4])
8563     libo_MINGW_TRY_DLL([libplds4])
8564     libo_MINGW_TRY_DLL([nss3])
8565     libo_MINGW_TRY_DLL([ssl3])
8566     libo_MINGW_TRY_DLL([libgpg-error])
8567     libo_MINGW_TRY_DLL([libgcrypt])
8568     libo_MINGW_TRY_DLL([libssh2])
8569     ENABLE_CURL=TRUE
8570 elif test $_os = iOS; then
8571     # Let's see if we need curl, I think not?
8572     AC_MSG_RESULT([none])
8573     ENABLE_CURL=
8574 else
8575     AC_MSG_RESULT([internal])
8576     SYSTEM_CURL=
8577     BUILD_TYPE="$BUILD_TYPE CURL"
8578     ENABLE_CURL=TRUE
8580 AC_SUBST(SYSTEM_CURL)
8581 AC_SUBST(CURL_CFLAGS)
8582 AC_SUBST(CURL_LIBS)
8583 AC_SUBST(ENABLE_CURL)
8585 dnl ===================================================================
8586 dnl Check for system boost
8587 dnl ===================================================================
8588 AC_MSG_CHECKING([which boost to use])
8589 if test "$with_system_boost" = "yes"; then
8590     AC_MSG_RESULT([external])
8591     SYSTEM_BOOST=TRUE
8592     AX_BOOST_BASE(1.47)
8593     AX_BOOST_DATE_TIME
8594     AX_BOOST_IOSTREAMS
8595     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8596     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8597     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8598         # if not found, try again with 'lib' prefix
8599         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8600     fi
8601     AC_LANG_PUSH([C++])
8602     save_CXXFLAGS=$CXXFLAGS
8603     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8604     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8605        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8606     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8607        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8608     AC_CHECK_HEADER(boost/function.hpp, [],
8609        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8610     AC_MSG_CHECKING([whether boost signals2 works])
8611     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/signals2/signal.hpp>]],
8612         [[ boost::signals2::signal<void()> s; s(); ]])],
8613         [AC_MSG_RESULT([yes])],
8614         [AC_MSG_ERROR([no, install boost >= 1.55 or use --without-system-boost])])
8615     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8616     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8617     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8618 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8619     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8620         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8621     else
8622         AC_MSG_RESULT([yes])
8623     fi
8624     CXXFLAGS=$save_CXXFLAGS
8625     AC_LANG_POP([C++])
8626 else
8627     AC_MSG_RESULT([internal])
8628     BUILD_TYPE="$BUILD_TYPE BOOST"
8629     SYSTEM_BOOST=
8631 AC_SUBST(SYSTEM_BOOST)
8633 dnl ===================================================================
8634 dnl Check for system mdds
8635 dnl ===================================================================
8636 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.12.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8638 dnl ===================================================================
8639 dnl Check for system glm
8640 dnl ===================================================================
8641 AC_MSG_CHECKING([which glm to use])
8642 if test "$with_system_glm" = "yes"; then
8643     AC_MSG_RESULT([external])
8644     SYSTEM_GLM=TRUE
8645     AC_LANG_PUSH([C++])
8646     AC_CHECK_HEADER([glm/glm.hpp], [],
8647        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8648     AC_LANG_POP([C++])
8649 else
8650     AC_MSG_RESULT([internal])
8651     BUILD_TYPE="$BUILD_TYPE GLM"
8652     SYSTEM_GLM=
8653     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8655 AC_SUBST([GLM_CFLAGS])
8656 AC_SUBST([SYSTEM_GLM])
8658 dnl ===================================================================
8659 dnl Check for system glew
8660 dnl ===================================================================
8661 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8663 dnl ===================================================================
8664 dnl Check for system vigra
8665 dnl ===================================================================
8666 AC_MSG_CHECKING([which vigra to use])
8667 if test "$with_system_vigra" = "yes"; then
8668     AC_MSG_RESULT([external])
8669     SYSTEM_VIGRA=TRUE
8670     AC_LANG_PUSH([C++])
8671     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8672        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8673     AC_LANG_POP([C++])
8674 else
8675     AC_MSG_RESULT([internal])
8676     BUILD_TYPE="$BUILD_TYPE VIGRA"
8677     SYSTEM_VIGRA=
8679 AC_SUBST(SYSTEM_VIGRA)
8681 dnl ===================================================================
8682 dnl Check for system odbc
8683 dnl ===================================================================
8684 AC_MSG_CHECKING([which odbc headers to use])
8685 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
8686     AC_MSG_RESULT([external])
8687     SYSTEM_ODBC_HEADERS=TRUE
8689     if test "$build_os" = "cygwin"; then
8690         save_CPPFLAGS=$CPPFLAGS
8691         find_winsdk
8692         PathFormat "$winsdktest"
8693         CPPFLAGS="$CPPFLAGS -I$formatted_path/include/um -I$formatted_path/include -I$formatted_path/include/shared"
8694         AC_CHECK_HEADER(sqlext.h, [],
8695             [AC_MSG_ERROR(odbc not found. install odbc)],
8696             [#include <windows.h>])
8697         CPPFLAGS=$save_CPPFLAGS
8698     else
8699         AC_CHECK_HEADER(sqlext.h, [],
8700             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8701     fi
8702 elif test "$enable_database_connectivity" != yes; then
8703     AC_MSG_RESULT([none])
8704 else
8705     AC_MSG_RESULT([internal])
8706     SYSTEM_ODBC_HEADERS=
8708 AC_SUBST(SYSTEM_ODBC_HEADERS)
8711 dnl ===================================================================
8712 dnl Check for system openldap
8713 dnl ===================================================================
8715 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8716 AC_MSG_CHECKING([which openldap library to use])
8717 if test "$with_system_openldap" = "yes"; then
8718     AC_MSG_RESULT([external])
8719     SYSTEM_OPENLDAP=TRUE
8720     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8721     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8722     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8723 else
8724     AC_MSG_RESULT([internal])
8725     SYSTEM_OPENLDAP=
8726     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8729 AC_SUBST(SYSTEM_OPENLDAP)
8731 dnl ===================================================================
8732 dnl Check for mozilla ab connectivity for windows
8733 dnl ===================================================================
8735 if test "$_os" = "WINNT"; then
8736     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8737     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8738         if test "$BITNESS_OVERRIDE" = 64; then
8739            AC_MSG_ERROR([--with-win-mozab-driver and --enable-64-bit options are mutually exclusive])
8740         fi
8741         WITH_MOZAB4WIN=TRUE
8742         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8743         BUILD_TYPE="$BUILD_TYPE MOZ"
8744         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8745         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8746         for dll in $MSVC80_DLLS; do
8747             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8748                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8749             fi
8750         done
8751     else
8752         AC_MSG_RESULT([no])
8753         WITH_MOZAB4WIN=
8754     fi
8756 AC_SUBST(WITH_MOZAB4WIN)
8757 AC_SUBST(MSVC80_DLLS)
8758 AC_SUBST(MSVC80_DLL_PATH)
8760 dnl ===================================================================
8761 dnl Check for TLS/SSL and cryptographic implementation to use
8762 dnl ===================================================================
8763 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8764 if test -n "$with_tls"; then
8765     case $with_tls in
8766     openssl)
8767         AC_DEFINE(USE_TLS_OPENSSL)
8768         TLS=OPENSSL
8770         if test "$enable_openssl" != "yes"; then
8771             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8772         fi
8774         # warn that OpenSSL has been selected but not all TLS code has this option
8775         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8776         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8777         ;;
8778     nss)
8779         AC_DEFINE(USE_TLS_NSS)
8780         TLS=NSS
8781         ;;
8782     *)
8783         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8784 openssl - OpenSSL
8785 nss - Mozilla's Network Security Services (NSS)
8786     ])
8787         ;;
8788     esac
8789 elif test $_os = iOS -o $_os = Android; then
8790     # We don't build NSS for iOS and Android
8791     AC_DEFINE(USE_TLS_OPENSSL)
8792     TLS=OPENSSL
8793 else
8794     # default to using NSS, it results in smaller oox lib
8795     AC_DEFINE(USE_TLS_NSS)
8796     TLS=NSS
8798 AC_MSG_RESULT([$TLS])
8799 AC_SUBST(TLS)
8801 dnl ===================================================================
8802 dnl Check for system NSS
8803 dnl ===================================================================
8804 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8805 if test "$with_system_nss" = "yes"; then
8806     libo_MINGW_CHECK_DLL([libnspr4])
8807     libo_MINGW_CHECK_DLL([libplc4])
8808     libo_MINGW_CHECK_DLL([libplds4])
8809     libo_MINGW_CHECK_DLL([nss3])
8810     libo_MINGW_CHECK_DLL([nssutil3])
8811     libo_MINGW_CHECK_DLL([smime3])
8812     libo_MINGW_CHECK_DLL([ssl3])
8815 dnl ===================================================================
8816 dnl Check for system mozilla headers
8817 dnl ===================================================================
8818 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8819 AC_MSG_CHECKING([which NPAPI headers to use])
8821 if test "$with_system_npapi_headers" = "yes"; then
8822     AC_MSG_RESULT([external])
8823     SYSTEM_NPAPI_HEADERS=TRUE
8824     # First try npapi-sdk:
8825     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8826     # Then go with libxul:
8827     if test "x$LOCATED" != "xyes"; then
8828         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8829     fi
8830     if test "x$LOCATED" != "xyes"; then
8831         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8832     fi
8833     # if still not found bail out
8834     if test "x$LOCATED" != "xyes"; then
8835         AC_MSG_ERROR([npapi.h header file not found])
8836     fi
8838     AC_LANG_PUSH([C])
8839     save_CFLAGS=$CFLAGS
8840     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8841     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8842     AC_COMPILE_IFELSE(
8843         [AC_LANG_SOURCE([[
8844             #define XP_UNIX
8845             #include <npapi.h>
8846             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8847             ]])],
8848         [AC_MSG_RESULT([const char*])],
8849         [
8850         AC_MSG_RESULT([char*])
8851         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8852         ])
8853     CFLAGS=$save_CFLAGS
8854     AC_LANG_POP([C])
8855     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8856 else
8857     AC_MSG_RESULT([internal])
8858         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER
8859     SYSTEM_NPAPI_HEADERS=
8861 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8862 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8863 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8865 dnl ===================================================================
8866 dnl Check for system sane
8867 dnl ===================================================================
8868 AC_MSG_CHECKING([which sane header to use])
8869 if test "$with_system_sane" = "yes"; then
8870     AC_MSG_RESULT([external])
8871     AC_CHECK_HEADER(sane/sane.h, [],
8872       [AC_MSG_ERROR(sane not found. install sane)], [])
8873 else
8874     AC_MSG_RESULT([internal])
8875     BUILD_TYPE="$BUILD_TYPE SANE"
8878 dnl ===================================================================
8879 dnl Check for system icu
8880 dnl ===================================================================
8881 SYSTEM_GENBRK=
8882 SYSTEM_GENCCODE=
8883 SYSTEM_GENCMN=
8885 ICU_MAJOR=54
8886 ICU_MINOR=1
8887 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
8888 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8889 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8890 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8891 AC_MSG_CHECKING([which icu to use])
8892 if test "$with_system_icu" = "yes"; then
8893     AC_MSG_RESULT([external])
8894     SYSTEM_ICU=TRUE
8895     AC_LANG_PUSH([C++])
8896     AC_MSG_CHECKING([for unicode/rbbi.h])
8897     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8898     AC_LANG_POP([C++])
8900     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8901         ICUPATH="$PATH"
8902         if test "$WITH_MINGW" = "yes"; then
8903             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8904         fi
8905         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8907         AC_MSG_CHECKING([ICU version])
8908         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8909         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8910         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8912         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8913             AC_MSG_RESULT([OK, $ICU_VERSION])
8914         else
8915             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8916         fi
8917     fi
8919     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8920         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8921         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8922         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8923         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8924         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8925         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8926             AC_MSG_RESULT([yes])
8927         else
8928             AC_MSG_RESULT([no])
8929             if test "$with_system_icu_for_build" != "force"; then
8930                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8931 You can use --with-system-icu-for-build=force to use it anyway.])
8932             fi
8933         fi
8934     fi
8936     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8937         # using the system icu tools can lead to version confusion, use the
8938         # ones from the build environment when cross-compiling
8939         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8940         if test -z "$SYSTEM_GENBRK"; then
8941             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8942         fi
8943         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8944         if test -z "$SYSTEM_GENCCODE"; then
8945             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8946         fi
8947         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8948         if test -z "$SYSTEM_GENCMN"; then
8949             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8950         fi
8951         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
8952             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
8953         else
8954             ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
8955         fi
8956         if test "$ICU_MAJOR" -ge "49"; then
8957             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8958             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8959             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8960         else
8961             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
8962             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
8963             ICU_RECLASSIFIED_HEBREW_LETTER=
8964         fi
8965     fi
8967     if test "$cross_compiling" = "yes"; then
8968         if test "$ICU_MAJOR" -ge "50"; then
8969             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8970             ICU_MINOR=""
8971         fi
8972     fi
8974     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
8975     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
8976     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
8977 else
8978     AC_MSG_RESULT([internal])
8979     SYSTEM_ICU=
8980     BUILD_TYPE="$BUILD_TYPE ICU"
8981     # surprisingly set these only for "internal" (to be used by various other
8982     # external libs): the system icu-config is quite unhelpful and spits out
8983     # dozens of weird flags and also default path -I/usr/include
8984     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8985     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
8987 AC_SUBST(SYSTEM_ICU)
8988 AC_SUBST(SYSTEM_GENBRK)
8989 AC_SUBST(SYSTEM_GENCCODE)
8990 AC_SUBST(SYSTEM_GENCMN)
8991 AC_SUBST(ICU_MAJOR)
8992 AC_SUBST(ICU_MINOR)
8993 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
8994 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8995 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8996 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8997 AC_SUBST(ICU_CFLAGS)
8998 AC_SUBST(ICU_LIBS)
9000 dnl ===================================================================
9001 dnl Graphite
9002 dnl ===================================================================
9004 AC_MSG_CHECKING([whether to enable graphite support])
9005 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9006     AC_MSG_RESULT([yes])
9007     ENABLE_GRAPHITE="TRUE"
9008     AC_DEFINE(ENABLE_GRAPHITE)
9009     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9010     if test "$with_system_graphite" = "yes"; then
9011         libo_MINGW_CHECK_DLL([libgraphite2])
9012     fi
9013 else
9014     AC_MSG_RESULT([no])
9016 AC_SUBST(ENABLE_GRAPHITE)
9018 dnl ===================================================================
9019 dnl Orcus
9020 dnl ===================================================================
9022 AC_MSG_CHECKING([whether to enable orcus])
9023 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9024     AC_MSG_RESULT([yes])
9025     ENABLE_ORCUS="TRUE"
9026     AC_DEFINE(ENABLE_ORCUS)
9028     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.8 >= 0.7.0])
9029     if test "$with_system_orcus" != "yes"; then
9030         if test "$SYSTEM_BOOST" = "TRUE"; then
9031             # ===========================================================
9032             # Determine if we are going to need to link with Boost.System
9033             # ===========================================================
9034             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9035             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9036             dnl in documentation has no effect.
9037             AC_MSG_CHECKING([if we need to link with Boost.System])
9038             AC_LANG_PUSH([C++])
9039             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9040                     @%:@include <boost/version.hpp>
9041                 ]],[[
9042                     #if BOOST_VERSION >= 105000
9043                     #   error yes, we need to link with Boost.System
9044                     #endif
9045                 ]])],[
9046                     AC_MSG_RESULT([no])
9047                 ],[
9048                     AC_MSG_RESULT([yes])
9049                     AX_BOOST_SYSTEM
9050             ])
9051             AC_LANG_POP([C++])
9052         fi
9053     fi
9054     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9055     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9056     AC_SUBST([BOOST_SYSTEM_LIB])
9057     AC_SUBST(SYSTEM_LIBORCUS)
9059 else
9060     AC_MSG_RESULT([no])
9062 AC_SUBST(ENABLE_ORCUS)
9064 dnl ===================================================================
9065 dnl HarfBuzz
9066 dnl ===================================================================
9067 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9068 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9069     AC_MSG_RESULT([yes])
9070     ENABLE_HARFBUZZ="TRUE"
9071     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9072         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.18],["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9073     else
9074         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9075     fi
9076 else
9077     AC_MSG_RESULT([no])
9079 AC_SUBST(ENABLE_HARFBUZZ)
9081 dnl ===================================================================
9082 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9083 dnl ===================================================================
9084 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9085 # Obviously no such thing on iOS or Android. Also not possible when building
9086 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9087 if test "$_os" != Android -a "$_os" != iOS -a $_os != Darwin -a \
9088         "$with_x" != "no" -a "$enable_mpl_subset" != yes
9089 then
9090     AC_MSG_RESULT([yes])
9091     ENABLE_NPAPI_FROM_BROWSER=TRUE
9092 else
9093     AC_MSG_RESULT([no])
9094     ENABLE_NPAPI_FROM_BROWSER=
9096 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9098 AC_MSG_CHECKING([whether to use X11])
9099 dnl ***************************************
9100 dnl testing for X libraries and includes...
9101 dnl ***************************************
9102 WANT_X11="no"
9103 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$with_x" != "no"; then
9104     WANT_X11="yes"
9105     AC_DEFINE(HAVE_FEATURE_X11)
9107 AC_MSG_RESULT([$WANT_X11])
9109 if test "$WANT_X11" = "yes"; then
9110     AC_PATH_X
9111     AC_PATH_XTRA
9112     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9114     if test -z "$x_includes"; then
9115         x_includes="default_x_includes"
9116     fi
9117     if test -z "$x_libraries"; then
9118         x_libraries="default_x_libraries"
9119     fi
9120     CFLAGS="$CFLAGS $X_CFLAGS"
9121     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9122     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9123 else
9124     x_includes="no_x_includes"
9125     x_libraries="no_x_libraries"
9128 if test "$WANT_X11" = "yes"; then
9129     dnl ===================================================================
9130     dnl Check for Composite.h for Mozilla plugin
9131     dnl ===================================================================
9132     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9133      [#include <X11/Intrinsic.h>])
9135     # ENABLE_NPAPI_FROM_BROWSER requires Xt library
9136     AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:],
9137         [AC_MSG_ERROR(Xt library not found)])
9139     dnl ===================================================================
9140     dnl Check for extension headers
9141     dnl ===================================================================
9142     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9143      [#include <X11/extensions/shape.h>])
9145     # vcl needs ICE and SM
9146     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9147     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9148         [AC_MSG_ERROR(ICE library not found)])
9149     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9150     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9151         [AC_MSG_ERROR(SM library not found)])
9154 dnl ===================================================================
9155 dnl Check for system Xrender
9156 dnl ===================================================================
9157 AC_MSG_CHECKING([whether to use Xrender])
9158 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9159     AC_MSG_RESULT([yes])
9160     PKG_CHECK_MODULES(XRENDER, xrender)
9161     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9162     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9163       [AC_MSG_ERROR(libXrender not found or functional)], [])
9164     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9165       [AC_MSG_ERROR(Xrender not found. install X)], [])
9166 else
9167     AC_MSG_RESULT([no])
9169 AC_SUBST(XRENDER_CFLAGS)
9170 AC_SUBST(XRENDER_LIBS)
9172 dnl ===================================================================
9173 dnl Check for XRandr
9174 dnl ===================================================================
9175 AC_MSG_CHECKING([whether to enable RandR support])
9176 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9177     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9178         XRANDR_DLOPEN="TRUE"
9179         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9180     else
9181         AC_MSG_RESULT([yes])
9182         XRANDR_DLOPEN="FALSE"
9183         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9184         if test "$ENABLE_RANDR" != "TRUE"; then
9185             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9186                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9187             XRANDR_CFLAGS=" "
9188             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9189               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9190             XRANDR_LIBS="-lXrandr "
9191             ENABLE_RANDR="TRUE"
9192         fi
9193         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9194     fi
9195 else
9196     ENABLE_RANDR=""
9197     AC_MSG_RESULT([no])
9199 AC_SUBST(XRANDR_DLOPEN)
9200 AC_SUBST(XRANDR_CFLAGS)
9201 AC_SUBST(XRANDR_LIBS)
9202 AC_SUBST(ENABLE_RANDR)
9204 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9205     WITH_WEBDAV="serf"
9207 if test $_os = iOS -o $_os = Android; then
9208     WITH_WEBDAV="no"
9210 AC_MSG_CHECKING([for webdav library])
9211 case "$WITH_WEBDAV" in
9212 serf)
9213     AC_MSG_RESULT([serf])
9214     # Check for system apr-util
9215     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9216                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9217                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9218     if test "$COM" = "MSC"; then
9219         APR_LIB_DIR="LibR"
9220         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9221         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9222     fi
9224     # Check for system serf
9225     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9226                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9227     if test "$COM" = "MSC"; then
9228         SERF_LIB_DIR="Release"
9229         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9230         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9231     fi
9232     ;;
9233 neon)
9234     AC_MSG_RESULT([neon])
9235     # Check for system neon
9236     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9237     if test "$with_system_neon" = "yes"; then
9238         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9239         libo_MINGW_CHECK_DLL([libneon])
9240         libo_MINGW_TRY_DLL([libtasn1])
9241         libo_MINGW_TRY_DLL([libgnutls])
9242     else
9243         NEON_VERSION=0295
9244     fi
9245     AC_SUBST(NEON_VERSION)
9246     ;;
9248     AC_MSG_RESULT([none, disabled])
9249     WITH_WEBDAV=""
9250     ;;
9251 esac
9252 AC_SUBST(WITH_WEBDAV)
9254 dnl ===================================================================
9255 dnl Check for disabling cve_tests
9256 dnl ===================================================================
9257 AC_MSG_CHECKING([whether to execute CVE tests])
9258 # If not explicitly enabled or disabled, default
9259 if test -z "$enable_cve_tests"; then
9260     case "$OS" in
9261     WNT)
9262         # Default cves off for windows with its wild and wonderful
9263         # varienty of AV software kicking in and panicing
9264         enable_cve_tests=no
9265         ;;
9266     *)
9267         # otherwise yes
9268         enable_cve_tests=yes
9269         ;;
9270     esac
9272 if test "$enable_cve_tests" = "no"; then
9273     AC_MSG_RESULT([no])
9274     DISABLE_CVE_TESTS=TRUE
9275     AC_SUBST(DISABLE_CVE_TESTS)
9276 else
9277     AC_MSG_RESULT([yes])
9280 dnl ===================================================================
9281 dnl Check for enabling chart XShape tests
9282 dnl ===================================================================
9283 AC_MSG_CHECKING([whether to execute chart XShape tests])
9284 if test "$enable_chart_tests" = "yes"; then
9285     AC_MSG_RESULT([yes])
9286     ENABLE_CHART_TESTS=TRUE
9287     AC_SUBST(ENABLE_CHART_TESTS)
9288 else
9289     AC_MSG_RESULT([no])
9292 dnl ===================================================================
9293 dnl Check for system openssl
9294 dnl ===================================================================
9295 DISABLE_OPENSSL=
9296 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9297 if test "$enable_openssl" = "yes"; then
9298     AC_MSG_RESULT([no])
9299     if test "$_os" = Darwin ; then
9300         # OpenSSL is deprecated when building for 10.7 or later.
9301         #
9302         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9303         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9305         with_system_openssl=no
9306         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9307     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9308             && test "$with_system_openssl" != "no"; then
9309         with_system_openssl=yes
9310         SYSTEM_OPENSSL=TRUE
9311         OPENSSL_CFLAGS=
9312         OPENSSL_LIBS="-lssl -lcrypto"
9313     else
9314         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9315     fi
9316     if test "$with_system_openssl" = "yes"; then
9317         libo_MINGW_CHECK_DLL([libssl])
9318         libo_MINGW_CHECK_DLL([libcrypto])
9319         AC_MSG_CHECKING([whether openssl supports SHA512])
9320         AC_LANG_PUSH([C])
9321         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9322             SHA512_CTX context;
9323 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9324         AC_LANG_POP(C)
9325     fi
9326 else
9327     AC_MSG_RESULT([yes])
9328     DISABLE_OPENSSL=TRUE
9330     # warn that although OpenSSL is disabled, system libraries may be depending on it
9331     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9332     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9335 AC_SUBST([DISABLE_OPENSSL])
9337 dnl ===================================================================
9338 dnl Check for building gnutls
9339 dnl ===================================================================
9340 AC_MSG_CHECKING([whether to use gnutls])
9341 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9342     AC_MSG_RESULT([yes])
9343     AM_PATH_LIBGCRYPT()
9344     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9345         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9346                       available in the system to use as replacement.]]))
9347 else
9348     AC_MSG_RESULT([no])
9351 AC_SUBST([LIBGCRYPT_CFLAGS])
9352 AC_SUBST([LIBGCRYPT_LIBS])
9354 dnl ===================================================================
9355 dnl Check for system redland
9356 dnl ===================================================================
9357 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9358 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9359 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9360 if test "$with_system_redland" = "yes"; then
9361     libo_MINGW_CHECK_DLL([librdf])
9362     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9363             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9364     libo_MINGW_TRY_DLL([libraptor])
9365     libo_MINGW_TRY_DLL([librasqal])
9366     libo_MINGW_TRY_DLL([libsqlite3])
9367 else
9368     RAPTOR_MAJOR="0"
9369     RASQAL_MAJOR="3"
9370     REDLAND_MAJOR="0"
9372 AC_SUBST(RAPTOR_MAJOR)
9373 AC_SUBST(RASQAL_MAJOR)
9374 AC_SUBST(REDLAND_MAJOR)
9376 dnl ===================================================================
9377 dnl Check for system hunspell
9378 dnl ===================================================================
9379 AC_MSG_CHECKING([which libhunspell to use])
9380 if test "$with_system_hunspell" = "yes"; then
9381     AC_MSG_RESULT([external])
9382     SYSTEM_HUNSPELL=TRUE
9383     AC_LANG_PUSH([C++])
9384     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9385     if test "$HUNSPELL_PC" != "TRUE"; then
9386         AC_CHECK_HEADER(hunspell.hxx, [],
9387             [
9388             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9389             [AC_MSG_ERROR(hunspell headers not found.)], [])
9390             ], [])
9391         AC_CHECK_LIB([hunspell], [main], [:],
9392            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9393         HUNSPELL_LIBS=-lhunspell
9394     fi
9395     AC_LANG_POP([C++])
9396     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9397     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9398 else
9399     AC_MSG_RESULT([internal])
9400     SYSTEM_HUNSPELL=
9401     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9402     if test "$COM" = "MSC"; then
9403         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9404     else
9405         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9406     fi
9407     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9409 AC_SUBST(SYSTEM_HUNSPELL)
9410 AC_SUBST(HUNSPELL_CFLAGS)
9411 AC_SUBST(HUNSPELL_LIBS)
9413 dnl ===================================================================
9414 dnl Checking for altlinuxhyph
9415 dnl ===================================================================
9416 AC_MSG_CHECKING([which altlinuxhyph to use])
9417 if test "$with_system_altlinuxhyph" = "yes"; then
9418     AC_MSG_RESULT([external])
9419     SYSTEM_HYPH=TRUE
9420     AC_CHECK_HEADER(hyphen.h, [],
9421        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9422     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9423        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9424        [#include <hyphen.h>])
9425     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9426         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9427     if test -z "$HYPHEN_LIB"; then
9428         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9429            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9430     fi
9431     if test -z "$HYPHEN_LIB"; then
9432         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9433            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9434     fi
9435     libo_MINGW_CHECK_DLL([libhyphen])
9436 else
9437     AC_MSG_RESULT([internal])
9438     SYSTEM_HYPH=
9439     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9440     if test "$COM" = "MSC"; then
9441         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9442     else
9443         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9444     fi
9446 AC_SUBST(SYSTEM_HYPH)
9447 AC_SUBST(HYPHEN_LIB)
9449 dnl ===================================================================
9450 dnl Checking for mythes
9451 dnl ===================================================================
9452 AC_MSG_CHECKING([which mythes to use])
9453 if test "$with_system_mythes" = "yes"; then
9454     AC_MSG_RESULT([external])
9455     SYSTEM_MYTHES=TRUE
9456     AC_LANG_PUSH([C++])
9457     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9458     if test "$MYTHES_PKGCONFIG" = "no"; then
9459         AC_CHECK_HEADER(mythes.hxx, [],
9460             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9461         AC_CHECK_LIB([mythes-1.2], [main], [:],
9462             [ MYTHES_FOUND=no], [])
9463     if test "$MYTHES_FOUND" = "no"; then
9464         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9465                 [ MYTHES_FOUND=no], [])
9466     fi
9467     if test "$MYTHES_FOUND" = "no"; then
9468         AC_MSG_ERROR([mythes library not found!.])
9469     fi
9470     fi
9471     AC_LANG_POP([C++])
9472     libo_MINGW_CHECK_DLL([libmythes-1.2])
9473     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9474 else
9475     AC_MSG_RESULT([internal])
9476     SYSTEM_MYTHES=
9477     BUILD_TYPE="$BUILD_TYPE MYTHES"
9478     if test "$COM" = "MSC"; then
9479         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9480     else
9481         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9482     fi
9484 AC_SUBST(SYSTEM_MYTHES)
9485 AC_SUBST(MYTHES_CFLAGS)
9486 AC_SUBST(MYTHES_LIBS)
9488 dnl ===================================================================
9489 dnl How should we build the linear programming solver ?
9490 dnl ===================================================================
9492 ENABLE_COINMP=
9493 AC_MSG_CHECKING([whether to build with CoinMP])
9494 if test "$enable_coinmp" != "no"; then
9495     ENABLE_COINMP=TRUE
9496     AC_MSG_RESULT([yes])
9497     if test "$with_system_coinmp" = "yes"; then
9498     SYSTEM_COINMP=TRUE
9499     PKG_CHECK_MODULES( COINMP, coinmp )
9500     else
9501         BUILD_TYPE="$BUILD_TYPE COINMP"
9502     fi
9503 else
9504     AC_MSG_RESULT([no])
9506 AC_SUBST(ENABLE_COINMP)
9507 AC_SUBST(SYSTEM_COINMP)
9508 AC_SUBST(COINMP_CFLAGS)
9509 AC_SUBST(COINMP_LIBS)
9511 ENABLE_LPSOLVE=
9512 AC_MSG_CHECKING([whether to build with lpsolve])
9513 if test "$enable_lpsolve" != "no"; then
9514     ENABLE_LPSOLVE=TRUE
9515     AC_MSG_RESULT([yes])
9516 else
9517     AC_MSG_RESULT([no])
9519 AC_SUBST(ENABLE_LPSOLVE)
9521 if test "$ENABLE_LPSOLVE" = TRUE; then
9522     AC_MSG_CHECKING([which lpsolve to use])
9523     if test "$with_system_lpsolve" = "yes"; then
9524         AC_MSG_RESULT([external])
9525         SYSTEM_LPSOLVE=TRUE
9526         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9527            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9528         save_LIBS=$LIBS
9529         # some systems need this. Like Ubuntu....
9530         AC_CHECK_LIB(m, floor)
9531         AC_CHECK_LIB(dl, dlopen)
9532         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9533             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9534         LIBS=$save_LIBS
9535         libo_MINGW_CHECK_DLL([lpsolve55])
9536     else
9537         AC_MSG_RESULT([internal])
9538         SYSTEM_LPSOLVE=
9539         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9540     fi
9542 AC_SUBST(SYSTEM_LPSOLVE)
9544 dnl ===================================================================
9545 dnl Checking for libexttextcat
9546 dnl ===================================================================
9547 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9548 if test "$with_system_libexttextcat" = "yes"; then
9549     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9551 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9553 dnl ***************************************
9554 dnl testing libc version for Linux...
9555 dnl ***************************************
9556 if test "$_os" = "Linux"; then
9557     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9558     exec 6>/dev/null # no output
9559     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9560     exec 6>&1 # output on again
9561     if test "$HAVE_LIBC"; then
9562         AC_MSG_RESULT([yes])
9563     else
9564         AC_MSG_ERROR([no, upgrade libc])
9565     fi
9568 dnl =========================================
9569 dnl Check for the Windows  SDK.
9570 dnl =========================================
9571 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9572 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9573 if test "$_os" = "WINNT"; then
9574     AC_MSG_CHECKING([for Windows SDK])
9575     if test "$build_os" = "cygwin"; then
9576         find_winsdk
9577         WINDOWS_SDK_HOME=$winsdktest
9579         # normalize if found
9580         if test -n "$WINDOWS_SDK_HOME"; then
9581             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9582             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9583         fi
9585         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
9586     fi
9588     if test -n "$WINDOWS_SDK_HOME"; then
9589         # Remove a possible trailing backslash
9590         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9592         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9593              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9594              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9595             have_windows_sdk_headers=yes
9596         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9597              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9598              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9599             have_windows_sdk_headers=yes
9600         else
9601             have_windows_sdk_headers=no
9602         fi
9604         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9605             have_windows_sdk_libs=yes
9606         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9607             have_windows_sdk_libs=yes
9608         else
9609             have_windows_sdk_libs=no
9610         fi
9612         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9613             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9614 the  Windows SDK are installed.])
9615         fi
9617         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9618              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9619              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9620              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9621         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9622              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9623              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9624              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9625         else
9626             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9627         fi
9628     fi
9630     if test -z "$WINDOWS_SDK_HOME"; then
9631         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9632     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
9633         WINDOWS_SDK_VERSION=70
9634         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9635     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9636         WINDOWS_SDK_VERSION=80
9637         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9638         dnl compatibility warning if not explicitly choosing the 80 SDK:
9639         if test -z "$with_windows_sdk"; then
9640             AC_MSG_WARN([If a build should run on Windows XP,])
9641             AC_MSG_WARN([use --with-windows-sdk=7.1A])
9642             add_warning "If a build should run on Windows XP,"
9643             add_warning "use --with-windows-sdk=7.1A"
9644         fi
9645     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
9646         WINDOWS_SDK_VERSION=81
9647         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
9648     else
9649         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9650     fi
9651     PathFormat "$WINDOWS_SDK_HOME"
9652     WINDOWS_SDK_HOME="$formatted_path"
9653     if test "$build_os" = "cygwin"; then
9654         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9655         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9656             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9657         fi
9658     fi
9660     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9661     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9662     dnl but not in v8.0), so allow this to be overridden with a
9663     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9664     dnl and configuration error if no WiLangId.vbs is found would arguably be
9665     dnl better, but I do not know under which conditions exactly it is needed by
9666     dnl msiglobal.pm:
9667     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9668         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9669         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9670             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9671         fi
9672         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9673             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9674         fi
9675         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9676             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9677             add_warning "WiLangId.vbs not found - building translated packages will fail"
9678         fi
9679     fi
9681 AC_SUBST(WINDOWS_SDK_HOME)
9682 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
9683 AC_SUBST(WINDOWS_SDK_VERSION)
9684 AC_SUBST(WINDOWS_SDK_WILANGID)
9686 dnl =========================================
9687 dnl Check for uuidgen
9688 dnl =========================================
9689 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9690     if test "$WITH_MINGW" = "yes"; then
9691         AC_PATH_PROG([UUIDGEN], [uuid])
9692         if test -z "$UUIDGEN"; then
9693             AC_MSG_WARN([uuid is needed for building installation sets])
9694         fi
9695     else
9696         # presence is already tested above in the WINDOWS_SDK_HOME check
9697         UUIDGEN=uuidgen.exe
9698         AC_SUBST(UUIDGEN)
9699     fi
9700 else
9701     AC_PATH_PROG([UUIDGEN], [uuidgen])
9702     if test -z "$UUIDGEN"; then
9703         AC_MSG_WARN([uuid is needed for building installation sets])
9704     fi
9707 dnl ***************************************
9708 dnl Checking for bison and flex
9709 dnl ***************************************
9710 AC_PATH_PROG(BISON, bison)
9711 if test -z "$BISON"; then
9712     AC_MSG_ERROR([no bison found in \$PATH, install it])
9713 else
9714     AC_MSG_CHECKING([the bison version])
9715     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9716     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9717     # Accept newer than 2.0
9718     if test "$_bison_longver" -lt 2000; then
9719         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9720     fi
9723 AC_PATH_PROG(FLEX, flex)
9724 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9725     FLEX=`cygpath -m $FLEX`
9727 if test -z "$FLEX"; then
9728     AC_MSG_ERROR([no flex found in \$PATH, install it])
9729 else
9730     AC_MSG_CHECKING([the flex version])
9731     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9732     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9733         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9734     fi
9736 AC_SUBST([FLEX])
9737 dnl ***************************************
9738 dnl Checking for patch
9739 dnl ***************************************
9740 AC_PATH_PROG(PATCH, patch)
9741 if test -z "$PATCH"; then
9742     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9745 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9746 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9747     if test -z "$with_gnu_patch"; then
9748         GNUPATCH=$PATCH
9749     else
9750         if test -x "$with_gnu_patch"; then
9751             GNUPATCH=$with_gnu_patch
9752         else
9753             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9754         fi
9755     fi
9757     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9758     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9759         AC_MSG_RESULT([yes])
9760     else
9761         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9762     fi
9763 else
9764     GNUPATCH=$PATCH
9767 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9768     GNUPATCH=`cygpath -m $GNUPATCH`
9771 dnl We also need to check for --with-gnu-cp
9773 if test -z "$with_gnu_cp"; then
9774     # check the place where the good stuff is hidden on Solaris...
9775     if test -x /usr/gnu/bin/cp; then
9776         GNUCP=/usr/gnu/bin/cp
9777     else
9778         AC_PATH_PROGS(GNUCP, gnucp cp)
9779     fi
9780     if test -z $GNUCP; then
9781         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9782     fi
9783 else
9784     if test -x "$with_gnu_cp"; then
9785         GNUCP=$with_gnu_cp
9786     else
9787         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9788     fi
9791 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9792     GNUCP=`cygpath -m $GNUCP`
9795 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9796 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9797     AC_MSG_RESULT([yes])
9798 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9799     AC_MSG_RESULT([yes])
9800 else
9801     case "$build_os" in
9802     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9803         x_GNUCP=[\#]
9804         GNUCP=''
9805         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9806         ;;
9807     *)
9808         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9809         ;;
9810     esac
9813 AC_SUBST(GNUPATCH)
9814 AC_SUBST(GNUCP)
9815 AC_SUBST(x_GNUCP)
9817 dnl ***************************************
9818 dnl testing assembler path
9819 dnl ***************************************
9820 ML_EXE=""
9821 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9822     if test "$BITNESS_OVERRIDE" = ""; then
9823         assembler=ml.exe
9824         assembler_bin=bin
9825     else
9826         if test "$vcexpress" = "Express"; then
9827             assembler=ml64.exe
9828             assembler_bin=bin/x86_amd64
9829         else
9830             assembler=ml64.exe
9831             assembler_bin=bin/amd64
9832         fi
9833     fi
9835     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9836     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9837         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9838         AC_MSG_RESULT([found])
9839         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9840     else
9841         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9842     fi
9844     PathFormat "$ASM_HOME"
9845     ASM_HOME="$formatted_path"
9846 else
9847     ASM_HOME=""
9850 AC_SUBST(ML_EXE)
9852 dnl ===================================================================
9853 dnl We need zip and unzip
9854 dnl ===================================================================
9855 AC_PATH_PROG(ZIP, zip)
9856 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9857 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9858     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],,)
9861 AC_PATH_PROG(UNZIP, unzip)
9862 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9864 dnl ===================================================================
9865 dnl Zip must be a specific type for different build types.
9866 dnl ===================================================================
9867 if test $build_os = cygwin; then
9868     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9869         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9870     fi
9873 dnl ===================================================================
9874 dnl We need touch with -h option support.
9875 dnl ===================================================================
9876 AC_PATH_PROG(TOUCH, touch)
9877 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9878 touch warn
9879 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9880     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],,)
9883 dnl ===================================================================
9884 dnl Set vcl option: coordinate device in double or sal_Int32
9885 dnl ===================================================================
9887 AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9888 if test "$_os" = "Darwin" -o  $_os = iOS ; then
9889     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9890     AC_MSG_RESULT([double])
9891 else
9892     AC_MSG_RESULT([sal_Int32])
9895 dnl ===================================================================
9896 dnl Test which vclplugs have to be built.
9897 dnl ===================================================================
9898 R=""
9899 GTK3_CFLAGS=""
9900 GTK3_LIBS=""
9901 ENABLE_GTK3=""
9902 if test "x$enable_gtk3" = "xyes"; then
9903     if test "$with_system_cairo" = no; then
9904         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9905     fi
9906     : ${with_system_cairo:=yes}
9907     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.8 gtk+-unix-print-3.0 gmodule-no-export-2.0 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
9908     if test "x$ENABLE_GTK3" = "xTRUE"; then
9909         R="gtk3"
9910     else
9911         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9912     fi
9913     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9915 AC_SUBST(GTK3_LIBS)
9916 AC_SUBST(GTK3_CFLAGS)
9917 AC_SUBST(ENABLE_GTK3)
9919 AC_MSG_CHECKING([which VCLplugs shall be built])
9920 if test "$GUIBASE" != "unx" -o "$with_x" = "no"; then
9921     enable_gtk=no
9923 ENABLE_GTK=""
9924 if test "x$enable_gtk" = "xyes"; then
9925     if test "$with_system_cairo" = no; then
9926         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9927     fi
9928     : ${with_system_cairo:=yes}
9929     ENABLE_GTK="TRUE"
9930     AC_DEFINE(ENABLE_GTK)
9931     R="gtk $R"
9933 AC_SUBST(ENABLE_GTK)
9935 ENABLE_TDE=""
9936 if test "x$enable_tde" = "xyes"; then
9937     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
9938     # are built from the same sources. So we only allow one of them.
9939     if test "x$enable_kde" = "xyes"; then
9940         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
9941     fi
9942     ENABLE_TDE="TRUE"
9943     AC_DEFINE(ENABLE_TDE)
9944     R="$R tde"
9946 AC_SUBST(ENABLE_TDE)
9948 ENABLE_KDE=""
9949 if test "x$enable_kde" = "xyes"; then
9950     ENABLE_KDE="TRUE"
9951     AC_DEFINE(ENABLE_KDE)
9952     R="$R kde"
9954 AC_SUBST(ENABLE_KDE)
9956 ENABLE_KDE4=""
9957 if test "x$enable_kde4" = "xyes"; then
9958     ENABLE_KDE4="TRUE"
9959     AC_DEFINE(ENABLE_KDE4)
9960     R="$R kde4"
9962 AC_SUBST(ENABLE_KDE4)
9964 ENABLE_HEADLESS=""
9965 if test "x$with_x" = "xno"; then
9966     ENABLE_HEADLESS="TRUE"
9967     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
9968     R="headless"
9970 AC_SUBST(ENABLE_HEADLESS)
9972 if test -z "$R"; then
9973     AC_MSG_RESULT([none])
9974 else
9975     AC_MSG_RESULT([$R])
9978 dnl ===================================================================
9979 dnl GCONF check
9980 dnl ===================================================================
9982 ENABLE_GCONF=
9983 AC_MSG_CHECKING([whether to enable GConf support])
9984 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
9985     ENABLE_GCONF="TRUE"
9986     AC_MSG_RESULT([yes])
9987     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
9988     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9989 else
9990     AC_MSG_RESULT([no])
9992 AC_SUBST(GCONF_LIBS)
9993 AC_SUBST(GCONF_CFLAGS)
9994 AC_SUBST(ENABLE_GCONF)
9996 dnl ===================================================================
9997 dnl Gnome VFS check
9998 dnl ===================================================================
10000 ENABLE_GNOMEVFS=""
10001 AC_MSG_CHECKING([whether to enable GNOME VFS support])
10002 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
10003     ENABLE_GNOMEVFS="TRUE"
10004     AC_MSG_RESULT([yes])
10005     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
10006     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10007     AC_DEFINE(ENABLE_GNOME_VFS)
10008 else
10009     AC_MSG_RESULT([no])
10011 AC_SUBST(GNOMEVFS_LIBS)
10012 AC_SUBST(GNOMEVFS_CFLAGS)
10013 AC_SUBST(ENABLE_GNOMEVFS)
10015 dnl ===================================================================
10016 dnl check for dbus support
10017 dnl ===================================================================
10018 ENABLE_DBUS=""
10019 DBUS_CFLAGS=""
10020 DBUS_LIBS=""
10022 if test "$enable_dbus" = "no"; then
10023     test_dbus=no
10026 AC_MSG_CHECKING([whether to enable DBUS support])
10027 if test "$test_dbus" = "yes"; then
10028     ENABLE_DBUS="TRUE"
10029     AC_MSG_RESULT([yes])
10030     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10031     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10032 else
10033     AC_MSG_RESULT([no])
10036 AC_SUBST(ENABLE_DBUS)
10037 AC_SUBST(DBUS_CFLAGS)
10038 AC_SUBST(DBUS_LIBS)
10040 AC_MSG_CHECKING([whether to enable font install via packagekit])
10041 if test "$ENABLE_DBUS" = "TRUE"; then
10042     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10043         ENABLE_PACKAGEKIT=TRUE
10044         AC_MSG_RESULT([yes])
10045     else
10046         ENABLE_PACKAGEKIT=
10047         AC_MSG_RESULT([no])
10048     fi
10049 else
10050     AC_MSG_RESULT([no, dbus disabled.])
10052 AC_SUBST(ENABLE_PACKAGEKIT)
10054 AC_MSG_CHECKING([whether to enable Impress remote control])
10055 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10056     AC_MSG_RESULT([yes])
10057     ENABLE_SDREMOTE=TRUE
10058     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10060     # If not explicitly enabled or disabled, default
10061     if test -z "$enable_sdremote_bluetooth"; then
10062         case "$OS" in
10063         LINUX|MACOSX|WNT)
10064             # Default to yes for these
10065             enable_sdremote_bluetooth=yes
10066             ;;
10067         *)
10068             # otherwise no
10069             enable_sdremote_bluetooth=no
10070             ;;
10071         esac
10072     fi
10073     # $enable_sdremote_bluetooth is guaranteed non-empty now
10075     if test "$enable_sdremote_bluetooth" != "no"; then
10076         if test "$OS" = "LINUX"; then
10077             if test "$ENABLE_DBUS" = "TRUE"; then
10078                 AC_MSG_RESULT([yes])
10079                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10080                 dnl ===================================================================
10081                 dnl Check for system bluez
10082                 dnl ===================================================================
10083                 AC_MSG_CHECKING([which Bluetooth header to use])
10084                 if test "$with_system_bluez" = "yes"; then
10085                     AC_MSG_RESULT([external])
10086                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10087                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10088                     SYSTEM_BLUEZ=TRUE
10089                 else
10090                     AC_MSG_RESULT([internal])
10091                     SYSTEM_BLUEZ=
10092                 fi
10093             else
10094                 AC_MSG_RESULT([no, dbus disabled])
10095                 ENABLE_SDREMOTE_BLUETOOTH=
10096                 SYSTEM_BLUEZ=
10097             fi
10098         else
10099             AC_MSG_RESULT([yes])
10100             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10101             SYSTEM_BLUEZ=
10102         fi
10103     else
10104         AC_MSG_RESULT([no])
10105         ENABLE_SDREMOTE_BLUETOOTH=
10106         SYSTEM_BLUEZ=
10107     fi
10108 else
10109     ENABLE_SDREMOTE=
10110     SYSTEM_BLUEZ=
10111     AC_MSG_RESULT([no])
10113 AC_SUBST(ENABLE_SDREMOTE)
10114 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10115 AC_SUBST(SYSTEM_BLUEZ)
10117 dnl ===================================================================
10118 dnl Check whether the gtk 2.0 libraries are available.
10119 dnl ===================================================================
10121 GTK_CFLAGS=""
10122 GTK_LIBS=""
10123 ENABLE_SYSTRAY_GTK=""
10124 if test  "$test_gtk" = "yes"; then
10126     if test "$ENABLE_GTK" = "TRUE"; then
10127         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.10.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]))
10128         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10129         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]))
10130         BUILD_TYPE="$BUILD_TYPE GTK"
10131         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10133         if test "x$enable_systray" = "xyes"; then
10134             ENABLE_SYSTRAY_GTK="TRUE"
10135         fi
10137         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10138         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10139                           [ENABLE_GTK_PRINT="TRUE"],
10140                           [ENABLE_GTK_PRINT=""])
10141         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10143         AC_MSG_CHECKING([whether to enable GIO support])
10144         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10145             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10146                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10147             fi
10148             dnl Need at least 2.26 for the dbus support.
10149             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10150                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10151             if test "$ENABLE_GIO" = "TRUE"; then
10152                 AC_DEFINE(ENABLE_GIO)
10153                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10154             fi
10155         else
10156             AC_MSG_RESULT([no])
10157         fi
10158     fi
10160 AC_SUBST(ENABLE_GIO)
10161 AC_SUBST(GIO_CFLAGS)
10162 AC_SUBST(GIO_LIBS)
10163 AC_SUBST(ENABLE_SYSTRAY_GTK)
10164 AC_SUBST(GTK_CFLAGS)
10165 AC_SUBST(GTK_LIBS)
10166 AC_SUBST(GTHREAD_CFLAGS)
10167 AC_SUBST(GTHREAD_LIBS)
10168 AC_SUBST([ENABLE_GTK_PRINT])
10169 AC_SUBST([GTK_PRINT_CFLAGS])
10170 AC_SUBST([GTK_PRINT_LIBS])
10173 dnl ===================================================================
10174 dnl Check whether the Telepathy libraries are available.
10175 dnl ===================================================================
10177 ENABLE_TELEPATHY=""
10178 TELEPATHY_CFLAGS=""
10179 TELEPATHY_LIBS=""
10181 AC_MSG_CHECKING([whether to enable Telepathy support])
10182 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10183     ENABLE_TELEPATHY="TRUE"
10184     AC_DEFINE(ENABLE_TELEPATHY)
10185     AC_MSG_RESULT([yes])
10186     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.10 )
10187     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10188 else
10189     AC_MSG_RESULT([no])
10192 AC_SUBST(ENABLE_TELEPATHY)
10193 AC_SUBST(TELEPATHY_CFLAGS)
10194 AC_SUBST(TELEPATHY_LIBS)
10197 dnl ===================================================================
10199 SPLIT_APP_MODULES=""
10200 if test "$enable_split_app_modules" = "yes"; then
10201     SPLIT_APP_MODULES="TRUE"
10203 AC_SUBST(SPLIT_APP_MODULES)
10205 SPLIT_OPT_FEATURES=""
10206 if test "$enable_split_opt_features" = "yes"; then
10207     SPLIT_OPT_FEATURES="TRUE"
10209 AC_SUBST(SPLIT_OPT_FEATURES)
10211 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10212     if test "$enable_cairo_canvas" = yes; then
10213         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10214     fi
10215     enable_cairo_canvas=no
10216 elif test -z "$enable_cairo_canvas"; then
10217     enable_cairo_canvas=yes
10220 ENABLE_CAIRO_CANVAS=""
10221 if test "$enable_cairo_canvas" = "yes"; then
10222     test_cairo=yes
10223     ENABLE_CAIRO_CANVAS="TRUE"
10224     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10226 AC_SUBST(ENABLE_CAIRO_CANVAS)
10228 dnl ===================================================================
10229 dnl Check whether the GStreamer libraries are available.
10230 dnl It's possible to build avmedia with both GStreamer backends!
10231 dnl ===================================================================
10233 ENABLE_GSTREAMER_1_0=""
10235 if test "$build_gstreamer_1_0" = "yes"; then
10237     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10238     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10239         ENABLE_GSTREAMER_1_0="TRUE"
10240         AC_MSG_RESULT([yes])
10241         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10242         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10243     else
10244         AC_MSG_RESULT([no])
10245     fi
10247 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10248 AC_SUBST(GSTREAMER_1_0_LIBS)
10249 AC_SUBST(ENABLE_GSTREAMER_1_0)
10252 ENABLE_GSTREAMER_0_10=""
10253 if test "$build_gstreamer_0_10" = "yes"; then
10255     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10256     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10257         ENABLE_GSTREAMER_0_10="TRUE"
10258         AC_MSG_RESULT([yes])
10259         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10260             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10261         ])
10262         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10263     else
10264         AC_MSG_RESULT([no])
10265     fi
10268 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10269 AC_SUBST(GSTREAMER_0_10_LIBS)
10270 AC_SUBST(ENABLE_GSTREAMER_0_10)
10272 dnl ===================================================================
10273 dnl Check whether to build the VLC avmedia backend
10274 dnl ===================================================================
10276 ENABLE_VLC=""
10278 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10279 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10280     ENABLE_VLC="TRUE"
10281     AC_MSG_RESULT([yes])
10282 else
10283     AC_MSG_RESULT([no])
10285 AC_SUBST(ENABLE_VLC)
10287 # this is for opengl transitions in impress slideshow
10288 ENABLE_OPENGL=
10289 if test $_os = iOS -o $_os = Android; then
10290    : # disable
10291 elif test "$_os" = "Darwin"; then
10292     # We use frameworks on Mac OS X, no need for detail checks
10293     ENABLE_OPENGL=TRUE
10294     ENABLE_OPENGL_CANVAS=TRUE
10295     SYSTEM_MESA_HEADERS=TRUE
10296 elif test $_os = WINNT; then
10297     # Experimental: try to use OpenGL on Windows
10298     ENABLE_OPENGL=TRUE
10299     ENABLE_OPENGL_CANVAS=TRUE
10300     # We need the internal "Mesa" headers.
10301     SYSTEM_MESA_HEADERS=
10302     BUILD_TYPE="$BUILD_TYPE MESA"
10303 else
10304     if test "$with_x" != "no"; then
10305         ENABLE_OPENGL=TRUE
10306     fi
10307     ENABLE_OPENGL_CANVAS=TRUE
10309     dnl ===================================================================
10310     dnl Check for system Mesa
10311     dnl ===================================================================
10312     AC_MSG_CHECKING([which Mesa headers to use])
10313     if test "$with_system_mesa_headers" = "yes"; then
10314         AC_MSG_RESULT([external])
10315         SYSTEM_MESA_HEADERS=TRUE
10316         AC_LANG_PUSH(C)
10317         AC_CHECK_HEADER(GL/glxext.h, [],
10318            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10319         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10320         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10321         AC_LANG_POP(C)
10322     else
10323         AC_MSG_RESULT([internal])
10324         SYSTEM_MESA_HEADERS=
10325         BUILD_TYPE="$BUILD_TYPE MESA"
10326     fi
10329 AC_SUBST(SYSTEM_MESA_HEADERS)
10330 AC_SUBST(ENABLE_OPENGL)
10331 AC_SUBST(ENABLE_OPENGL_CANVAS)
10333 dnl =================================================
10334 dnl Check whether to build with OpenCL support.
10335 dnl =================================================
10337 if test $_os != iOS -a $_os != Android; then
10338     # OPENCL in BUILD_TYPE tells that OpenCL is potentially available on the platform (optional at run-time,
10339     # used through clew).
10340     BUILD_TYPE="$BUILD_TYPE OPENCL"
10341     AC_DEFINE(HAVE_FEATURE_OPENCL)
10344 dnl ===================================================================
10345 dnl Check whether to enable glTF support
10346 dnl ===================================================================
10347 AC_MSG_CHECKING([whether to enable glTF support])
10348 ENABLE_GLTF=
10349 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android; then
10350     ENABLE_GLTF=TRUE
10351     AC_MSG_RESULT([yes])
10352     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10353     if test "$with_system_libgltf" = "yes"; then
10354         SYSTEM_LIBGLTF=TRUE
10355         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10356     else
10357         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10358     fi
10359 else
10360     AC_MSG_RESULT([no])
10362 AC_SUBST(ENABLE_GLTF)
10363 AC_SUBST(SYSTEM_LIBGLTF)
10364 AC_SUBST(LIBGLTF_CFLAGS)
10365 AC_SUBST(LIBGLTF_LIBS)
10367 dnl ===================================================================
10368 dnl Check whether to enable COLLADA support
10369 dnl ===================================================================
10370 AC_MSG_CHECKING([whether to enable COLLADA support])
10371 ENABLE_COLLADA=
10372 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10373     AC_MSG_RESULT([yes])
10374     ENABLE_COLLADA=TRUE
10375     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10377     AC_MSG_CHECKING([which OPENCOLLADA to use])
10378     if test "$with_system_opencollada" = "yes"; then
10379         AC_MSG_RESULT([external])
10380         SYSTEM_OPENCOLLADA=TRUE
10381         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10382         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10383         AC_LANG_PUSH([C++])
10384         save_CXXFLAGS=$CXXFLAGS
10385         save_CPPFLAGS=$CPPFLAGS
10386         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10387         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10388         AC_CHECK_HEADERS(
10389                 COLLADABU.h \
10390                 COLLADAFW.h \
10391                 COLLADASaxFWLLoader.h \
10392                 GeneratedSaxParser.h,
10393             [],
10394             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10395             [])
10396         CXXFLAGS=$save_CXXFLAGS
10397         CPPFLAGS=$save_CPPFLAGS
10398         AC_LANG_POP([C++])
10399         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10400     else
10401         AC_MSG_RESULT([internal])
10402         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10403     fi
10405     AC_MSG_CHECKING([which collada2gltf to use])
10406     if test "$with_system_collada2gltf" = "yes"; then
10407         if test "$with_system_opencollada" = "no"; then
10408             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10409         fi
10410         AC_MSG_RESULT([external])
10411         SYSTEM_COLLADA2GLTF=TRUE
10412         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10413         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10414         AC_LANG_PUSH([C++])
10415         save_CXXFLAGS=$CXXFLAGS
10416         save_CPPFLAGS=$CPPFLAGS
10417         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10418         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10419         AC_CHECK_HEADERS(
10420                 GLTF.h \
10421                 encodingHelpers.h,
10422             [],
10423             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10424             [])
10425         CXXFLAGS=$save_CXXFLAGS
10426         CPPFLAGS=$save_CPPFLAGS
10427         AC_LANG_POP([C++])
10428         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10429     else
10430         AC_MSG_RESULT([internal])
10431         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10432     fi
10433 else
10434     AC_MSG_RESULT([no])
10436 AC_SUBST(ENABLE_COLLADA)
10437 AC_SUBST([OPENCOLLADA_CFLAGS])
10438 AC_SUBST([OPENCOLLADA_LIBS])
10439 AC_SUBST([SYSTEM_OPENCOLLADA])
10441 AC_SUBST([COLLADA2GLTF_CFLAGS])
10442 AC_SUBST([COLLADA2GLTF_LIBS])
10443 AC_SUBST([SYSTEM_COLLADA2GLTF])
10445 # pdf import?
10446 AC_MSG_CHECKING([whether to build the PDF import feature])
10447 ENABLE_PDFIMPORT=
10448 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10449     AC_MSG_RESULT([yes])
10450     ENABLE_PDFIMPORT=TRUE
10452     dnl ===================================================================
10453     dnl Check for system poppler
10454     dnl ===================================================================
10455     AC_MSG_CHECKING([which PDF import backend to use])
10456     if test "$with_system_poppler" = "yes"; then
10457         AC_MSG_RESULT([external])
10458         SYSTEM_POPPLER=TRUE
10459         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10460         AC_LANG_PUSH([C++])
10461         save_CXXFLAGS=$CXXFLAGS
10462         save_CPPFLAGS=$CPPFLAGS
10463         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10464         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10465         AC_CHECK_HEADER([cpp/poppler-version.h],
10466             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10467             [])
10468         CXXFLAGS=$save_CXXFLAGS
10469         CPPFLAGS=$save_CPPFLAGS
10470         AC_LANG_POP([C++])
10471         libo_MINGW_CHECK_DLL([libpoppler])
10472         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10473     else
10474         AC_MSG_RESULT([internal])
10475         SYSTEM_POPPLER=
10476         BUILD_TYPE="$BUILD_TYPE POPPLER"
10477         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10478     fi
10479     AC_DEFINE([ENABLE_PDFIMPORT],1)
10480 else
10481     AC_MSG_RESULT([no])
10483 AC_SUBST(ENABLE_PDFIMPORT)
10484 AC_SUBST(SYSTEM_POPPLER)
10485 AC_SUBST(POPPLER_CFLAGS)
10486 AC_SUBST(POPPLER_LIBS)
10488 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10489 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10490     AC_MSG_RESULT([yes])
10491     ENABLE_MEDIAWIKI=TRUE
10492     BUILD_TYPE="$BUILD_TYPE XSLTML"
10493     if test  "x$with_java" = "xno"; then
10494         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10495     fi
10496 else
10497     AC_MSG_RESULT([no])
10498     ENABLE_MEDIAWIKI=
10499     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10501 AC_SUBST(ENABLE_MEDIAWIKI)
10503 AC_MSG_CHECKING([whether to build the Report Builder])
10504 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10505     AC_MSG_RESULT([yes])
10506     ENABLE_REPORTBUILDER=TRUE
10507     AC_MSG_CHECKING([which jfreereport libs to use])
10508     if test "$with_system_jfreereport" = "yes"; then
10509         SYSTEM_JFREEREPORT=TRUE
10510         AC_MSG_RESULT([external])
10511         if test -z $SAC_JAR; then
10512             SAC_JAR=/usr/share/java/sac.jar
10513         fi
10514         AC_CHECK_FILE($SAC_JAR, [],
10515              [AC_MSG_ERROR(sac.jar not found.)], [])
10517         if test -z $LIBXML_JAR; then
10518             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10519                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10520                 [
10521                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10522                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10523                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10524                     )
10525                 ]
10526             )
10527         else
10528             AC_CHECK_FILE($LIBXML_JAR, [],
10529                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10530         fi
10532         if test -z $FLUTE_JAR; then
10533             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10534                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10535                 [
10536                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10537                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10538                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10539                     )
10540                 ]
10541             )
10542         else
10543             AC_CHECK_FILE($FLUTE_JAR, [],
10544                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10545         fi
10547         if test -z $JFREEREPORT_JAR; then
10548             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10549                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10550                 [
10551                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10552                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10553                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10554                     )
10555                 ]
10556             )
10557         else
10558             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10559                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10560         fi
10562         if test -z $LIBLAYOUT_JAR; then
10563             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10564                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10565                 [
10566                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10567                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10568                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10569                     )
10570                 ]
10571             )
10572         else
10573             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10574                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10575         fi
10577         if test -z $LIBLOADER_JAR; then
10578             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10579                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10580                 [
10581                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10582                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10583                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10584                     )
10585                 ]
10586             )
10587         else
10588             AC_CHECK_FILE($LIBLOADER_JAR, [],
10589                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10590         fi
10592         if test -z $LIBFORMULA_JAR; then
10593             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10594                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10595                  [
10596                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10597                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10598                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10599                      )
10600                  ]
10601             )
10602         else
10603             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10604                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10605         fi
10607         if test -z $LIBREPOSITORY_JAR; then
10608             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10609                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10610                 [
10611                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10612                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10613                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10614                     )
10615                 ]
10616             )
10617         else
10618             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10619                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10620         fi
10622         if test -z $LIBFONTS_JAR; then
10623             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10624                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10625                 [
10626                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10627                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10628                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10629                     )
10630                 ]
10631             )
10632         else
10633             AC_CHECK_FILE($LIBFONTS_JAR, [],
10634                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10635         fi
10637         if test -z $LIBSERIALIZER_JAR; then
10638             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10639                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10640                 [
10641                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10642                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10643                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10644                     )
10645                 ]
10646             )
10647         else
10648             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10649                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10650         fi
10652         if test -z $LIBBASE_JAR; then
10653             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10654                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10655                 [
10656                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10657                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10658                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10659                     )
10660                 ]
10661             )
10662         else
10663             AC_CHECK_FILE($LIBBASE_JAR, [],
10664                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10665         fi
10667     else
10668         AC_MSG_RESULT([internal])
10669         SYSTEM_JFREEREPORT=
10670         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10671     fi
10672 else
10673     AC_MSG_RESULT([no])
10674     ENABLE_REPORTBUILDER=
10675     SYSTEM_JFREEREPORT=
10677 AC_SUBST(ENABLE_REPORTBUILDER)
10678 AC_SUBST(SYSTEM_JFREEREPORT)
10679 AC_SUBST(SAC_JAR)
10680 AC_SUBST(LIBXML_JAR)
10681 AC_SUBST(FLUTE_JAR)
10682 AC_SUBST(JFREEREPORT_JAR)
10683 AC_SUBST(LIBBASE_JAR)
10684 AC_SUBST(LIBLAYOUT_JAR)
10685 AC_SUBST(LIBLOADER_JAR)
10686 AC_SUBST(LIBFORMULA_JAR)
10687 AC_SUBST(LIBREPOSITORY_JAR)
10688 AC_SUBST(LIBFONTS_JAR)
10689 AC_SUBST(LIBSERIALIZER_JAR)
10691 # this has to be here because both the Wiki Publisher and the SRB use
10692 # commons-logging
10693 COMMONS_LOGGING_VERSION=1.2
10694 if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10695     AC_MSG_CHECKING([which Apache commons-* libs to use])
10696     if test "$with_system_apache_commons" = "yes"; then
10697         SYSTEM_APACHE_COMMONS=TRUE
10698         AC_MSG_RESULT([external])
10699         if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
10700             if test -z $COMMONS_CODEC_JAR; then
10701                 _commons_codec_path=""
10702                 if test "$HAVE_JAVA6" = "TRUE"; then
10703                     _commons_codec_path="/usr/share/java/commons-codec-1.9.jar"
10704                 else
10705                     _commons_codec_path="/usr/share/java/commons-codec-1.6.jar"
10706                 fi
10707                 AC_CHECK_FILE($_commons_codec_path,
10708                     [ COMMONS_CODEC_JAR=$_commons_codec_path ],
10709                     [
10710                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
10711                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
10712                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
10713                         )
10714                     ]
10715                 )
10716             else
10717                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
10718                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10719             fi
10721             if test -z $COMMONS_LANG_JAR; then
10722                 _commons_lang_path=""
10723                 if test "$HAVE_JAVA6" = "TRUE"; then
10724                     _commons_lang_path="/usr/share/java/commons-lang3-3.3.1-src.tar.gz"
10725                 else
10726                     _commons_lang_path="/usr/share/java/commons-lang-2.4.jar"
10727                 fi
10728                 AC_CHECK_FILE($_commons_lang_path,
10729                     [ COMMONS_LANG_JAR=$commons_lang_path ],
10730                     [
10731                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10732                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10733                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10734                             )
10735                     ]
10736                 )
10737             else
10738                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10739                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10740             fi
10742             if test -z $COMMONS_HTTPCLIENT_JAR; then
10743                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10744                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10745                     [
10746                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10747                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10748                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10749                         )
10750                     ]
10751                 )
10752             else
10753                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10754                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10755             fi
10756         fi
10757         if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10758             if test -z $COMMONS_LOGGING_JAR; then
10759                 AC_CHECK_FILE(/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar,
10760                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar ],
10761                    [
10762                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10763                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10764                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10765                         )
10766                     ]
10767                 )
10768             else
10769                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10770                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10771             fi
10772         fi
10773     else
10774         AC_MSG_RESULT([internal])
10775         SYSTEM_APACHE_COMMONS=
10776         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10777     fi
10779 AC_SUBST(SYSTEM_APACHE_COMMONS)
10780 AC_SUBST(COMMONS_CODEC_JAR)
10781 AC_SUBST(COMMONS_LANG_JAR)
10782 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10783 AC_SUBST(COMMONS_LOGGING_JAR)
10784 AC_SUBST(COMMONS_LOGGING_VERSION)
10786 # scripting provider for BeanShell?
10787 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10788 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10789     AC_MSG_RESULT([yes])
10790     ENABLE_SCRIPTING_BEANSHELL=TRUE
10792     dnl ===================================================================
10793     dnl Check for system beanshell
10794     dnl ===================================================================
10795     AC_MSG_CHECKING([which beanshell to use])
10796     if test "$with_system_beanshell" = "yes"; then
10797         AC_MSG_RESULT([external])
10798         SYSTEM_BSH=TRUE
10799         if test -z $BSH_JAR; then
10800             BSH_JAR=/usr/share/java/bsh.jar
10801         fi
10802         AC_CHECK_FILE($BSH_JAR, [],
10803                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10804     else
10805         AC_MSG_RESULT([internal])
10806         SYSTEM_BSH=
10807         BUILD_TYPE="$BUILD_TYPE BSH"
10808     fi
10809 else
10810     AC_MSG_RESULT([no])
10811     ENABLE_SCRIPTING_BEANSHELL=
10812     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10814 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10815 AC_SUBST(SYSTEM_BSH)
10816 AC_SUBST(BSH_JAR)
10818 # scripting provider for JavaScript?
10819 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10820 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10821     AC_MSG_RESULT([yes])
10822     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10824     dnl ===================================================================
10825     dnl Check for system rhino
10826     dnl ===================================================================
10827     AC_MSG_CHECKING([which rhino to use])
10828     if test "$with_system_rhino" = "yes"; then
10829         AC_MSG_RESULT([external])
10830         SYSTEM_RHINO=TRUE
10831         if test -z $RHINO_JAR; then
10832             RHINO_JAR=/usr/share/java/js.jar
10833         fi
10834         AC_CHECK_FILE($RHINO_JAR, [],
10835                    [AC_MSG_ERROR(js.jar not found.)], [])
10836     else
10837         AC_MSG_RESULT([internal])
10838         SYSTEM_RHINO=
10839         BUILD_TYPE="$BUILD_TYPE RHINO"
10840     fi
10841 else
10842     AC_MSG_RESULT([no])
10843     ENABLE_SCRIPTING_JAVASCRIPT=
10844     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10846 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10847 AC_SUBST(SYSTEM_RHINO)
10848 AC_SUBST(RHINO_JAR)
10850 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10851 # paths should be added to library search path. So lets put all 64-bit
10852 # platforms there.
10853 supports_multilib=
10854 case "$host_cpu" in
10855 x86_64 | powerpc64 | powerpc64le | s390x | aarch64)
10856     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10857         supports_multilib="yes"
10858     fi
10859     ;;
10861     ;;
10862 esac
10864 dnl ===================================================================
10865 dnl Check whether the TQt and TDE libraries are available.
10866 dnl ===================================================================
10868 TDE_CFLAGS=""
10869 TDE_LIBS=""
10870 if test "$_os" != "OpenBSD"; then
10871     MOC="moc"
10873 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10874     dnl Search paths for TQt and TDE
10875     if test -z "$supports_multilib"; then
10876         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"
10877         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"
10878     else
10879         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"
10880         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"
10881     fi
10882     if test -n "$TQTDIR"; then
10883         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10884         if test -z "$supports_multilib"; then
10885             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10886         else
10887             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10888         fi
10889     fi
10890     if test -z "$supports_multilib"; then
10891         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"
10892         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"
10893     else
10894         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"
10895         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"
10896     fi
10897     if test -n "$TDEDIR"; then
10898         tde_incdirs="$TDEDIR/include $tde_incdirs"
10899         if test -z "$supports_multilib"; then
10900             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10901         else
10902             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10903         fi
10904     fi
10906     dnl What to test
10907     tqt_test_include="ntqstyle.h"
10908     tde_test_include="kapp.h"
10910     if test "$_os" != "OpenBSD"; then
10911         tqt_test_library="libtqt-mt.so"
10912         tde_test_library="libDCOP.so"
10913     else
10914         tqt_test_library="libtqt-mt.so*"
10915         tde_test_library="libDCOP.so*"
10916     fi
10918     dnl Check for TQt headers
10919     AC_MSG_CHECKING([for TQt headers])
10920     tqt_incdir="no"
10921     for tde_check in $tqt_incdirs; do
10922         if test -r "$tde_check/$tqt_test_include"; then
10923             tqt_incdir="$tde_check"
10924             break
10925         fi
10926     done
10927     AC_MSG_RESULT([$tqt_incdir])
10928     if test "x$tqt_incdir" = "xno"; then
10929         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10930 your TQt installation by exporting TQTDIR before running "configure".])
10931     fi
10933     dnl Check for TQt libraries
10934     AC_MSG_CHECKING([for TQt libraries])
10935     tqt_libdir="no"
10936     for tqt_check in $tqt_libdirs; do
10937         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10938             tqt_libdir="$tqt_check"
10939             break
10940         fi
10941     done
10942     AC_MSG_RESULT([$tqt_libdir])
10943     if test "x$tqt_libdir" = "xno"; then
10944         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10945 your TQt installation by exporting TQTDIR before running "configure".])
10946     fi
10948     dnl Check for Meta Object Compiler
10949     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10950     if test "$MOC" = "no"; then
10951         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10952 the root of your TQt installation by exporting TQTDIR before running "configure".])
10953     fi
10955     dnl Check for TDE headers
10956     AC_MSG_CHECKING([for TDE headers])
10957     tde_incdir="no"
10958     for tde_check in $tde_incdirs; do
10959         if test -r "$tde_check/$tde_test_include"; then
10960             tde_incdir="$tde_check"
10961             break
10962         fi
10963     done
10964     AC_MSG_RESULT([$tde_incdir])
10965     if test "x$tde_incdir" = "xno"; then
10966         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10967 your TDE installation by exporting TDEDIR before running "configure".])
10968     fi
10970     dnl Check for TDE libraries
10971     AC_MSG_CHECKING([for TDE libraries])
10972     tde_libdir="no"
10973     for tde_check in $tde_libdirs; do
10974         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10975             tde_libdir="$tde_check"
10976             break
10977         fi
10978     done
10979     AC_MSG_RESULT([$tde_libdir])
10980     if test "x$tde_libdir" = "xno"; then
10981         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10982 your TDE installation by exporting TDEDIR before running "configure".])
10983     fi
10985     dnl Set the variables
10986     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10987     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10989 AC_SUBST(TDE_CFLAGS)
10990 AC_SUBST(TDE_LIBS)
10991 AC_SUBST(MOC)
10993 dnl ===================================================================
10994 dnl Check whether the Qt3 and KDE3 libraries are available.
10995 dnl ===================================================================
10997 KDE_CFLAGS=""
10998 KDE_LIBS=""
10999 if test "$_os" != "OpenBSD"; then
11000     MOC="moc"
11002 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
11003     dnl Search paths for Qt3 and KDE3
11004     if test -z "$supports_multilib"; then
11005         qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib/qt3/include /usr/lib/qt/include /usr/share/qt3/include /usr/local/include/X11/qt3 $x_includes"
11006         qt_libdirs="$QTLIB /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib /usr/local/lib/qt3 $x_libraries"
11007     else
11008         qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib64/qt3/include /usr/lib64/qt/include /usr/share/qt3/include /usr/lib/qt3/include /usr/lib/qt/include /usr/local/include/X11/qt3 $x_includes"
11009         qt_libdirs="$QTLIB /usr/local/qt/lib64 /usr/lib64/qt /usr/lib64 /usr/X11R6/lib64/X11/qt /usr/X11R6/lib64/qt /usr/lib64/qt3/lib64 /usr/lib64/qt/lib64 /usr/share/qt3/lib64 /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib /usr/local/lib/qt3 $x_libraries"
11010     fi
11011     if test -n "$QTDIR"; then
11012         qt_incdirs="$QTDIR/include $qt_incdirs"
11013         if test -z "$supports_multilib"; then
11014             qt_libdirs="$QTDIR/lib $qt_libdirs"
11015         else
11016             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11017         fi
11018     fi
11019     if test -z "$supports_multilib"; then
11020         kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /opt/kde3/include /opt/kde/include $x_includes"
11021         kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib /usr/lib $x_libraries"
11022     else
11023         kde_incdirs="/usr/lib64/kde/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /opt/kde3/include /opt/kde/include $x_includes"
11024         kde_libdirs="/usr/lib64/kde/lib64 /usr/local/kde/lib64 /usr/kde/lib64 /usr/lib64/kde /usr/lib64/kde3 /usr/X11R6/lib64 /usr/local/lib64 /opt/kde3/lib64 /opt/kde/lib64 /usr/X11R6/kde/lib64 /usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib /usr/lib64 $x_libraries"
11025     fi
11026     if test -n "$KDEDIR"; then
11027         kde_incdirs="$KDEDIR/include $kde_incdirs"
11028         if test -z "$supports_multilib"; then
11029             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11030         else
11031             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11032         fi
11033     fi
11035     dnl What to test
11036     qt_test_include="qstyle.h"
11037     kde_test_include="kapp.h"
11039     if test "$_os" != "OpenBSD"; then
11040         qt_test_library="libqt-mt.so"
11041         kde_test_library="libDCOP.so"
11042     else
11043         qt_test_library="libqt-mt.so*"
11044         kde_test_library="libDCOP.so*"
11045     fi
11047     dnl Check for Qt3 headers
11048     AC_MSG_CHECKING([for Qt3 headers])
11049     qt_incdir="no"
11050     for kde_check in $qt_incdirs; do
11051         if test -r "$kde_check/$qt_test_include"; then
11052             qt_incdir="$kde_check"
11053             break
11054         fi
11055     done
11056     AC_MSG_RESULT([$qt_incdir])
11057     if test "x$qt_incdir" = "xno"; then
11058         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
11059 your Qt3 installation by exporting QTDIR before running "configure".])
11060     fi
11062     dnl Check for Qt3 libraries
11063     AC_MSG_CHECKING([for Qt3 libraries])
11064     qt_libdir="no"
11065     for qt_check in $qt_libdirs; do
11066         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
11067             qt_libdir="$qt_check"
11068             break
11069         fi
11070     done
11071     AC_MSG_RESULT([$qt_libdir])
11072     if test "x$qt_libdir" = "xno"; then
11073         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
11074 your Qt3 installation by exporting QTDIR before running "configure".])
11075     fi
11077     dnl Check for Meta Object Compiler
11078     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
11079     if test "$MOC" = "no"; then
11080         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
11081 the root of your Qt3 installation by exporting QTDIR before running "configure".])
11082     fi
11084     dnl Check for KDE3 headers
11085     AC_MSG_CHECKING([for KDE3 headers])
11086     kde_incdir="no"
11087     for kde_check in $kde_incdirs; do
11088         if test -r "$kde_check/$kde_test_include"; then
11089             kde_incdir="$kde_check"
11090             break
11091         fi
11092     done
11093     AC_MSG_RESULT([$kde_incdir])
11094     if test "x$kde_incdir" = "xno"; then
11095         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
11096 your KDE3 installation by exporting KDEDIR before running "configure".])
11097     fi
11099     dnl Check for KDE3 libraries
11100     AC_MSG_CHECKING([for KDE3 libraries])
11101     kde_libdir="no"
11102     for kde_check in $kde_libdirs; do
11103         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11104             kde_libdir="$kde_check"
11105             break
11106         fi
11107     done
11108     AC_MSG_RESULT([$kde_libdir])
11109     if test "x$kde_libdir" = "xno"; then
11110         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11111 your KDE3 installation by exporting KDEDIR before running "configure".])
11112     fi
11114     dnl Set the variables
11115     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11116     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11117     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11119 AC_SUBST(KDE_CFLAGS)
11120 AC_SUBST(KDE_LIBS)
11121 AC_SUBST(MOC)
11123 dnl ===================================================================
11124 dnl KDE4 Integration
11125 dnl ===================================================================
11127 KDE4_CFLAGS=""
11128 KDE4_LIBS=""
11129 QMAKE4="qmake"
11130 MOC4="moc"
11131 KDE_GLIB_CFLAGS=""
11132 KDE_GLIB_LIBS=""
11133 KDE_HAVE_GLIB=""
11134 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11135     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11136     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11138     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11139     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11141     if test -n "$supports_multilib"; then
11142         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11143         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11144     fi
11146     if test -n "$QTDIR"; then
11147         qt_incdirs="$QTDIR/include $qt_incdirs"
11148         if test -z "$supports_multilib"; then
11149             qt_libdirs="$QTDIR/lib $qt_libdirs"
11150         else
11151             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11152         fi
11153     fi
11154     if test -n "$QT4DIR"; then
11155         qt_incdirs="$QT4DIR/include $qt_incdirs"
11156         if test -z "$supports_multilib"; then
11157             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11158         else
11159             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11160         fi
11161     fi
11163     if test -n "$KDEDIR"; then
11164         kde_incdirs="$KDEDIR/include $kde_incdirs"
11165         if test -z "$supports_multilib"; then
11166             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11167         else
11168             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11169         fi
11170     fi
11171     if test -n "$KDE4DIR"; then
11172         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11173         if test -z "$supports_multilib"; then
11174             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11175         else
11176             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11177         fi
11178     fi
11180     qt_test_include="Qt/qobject.h"
11181     qt_test_library="libQtNetwork.so"
11182     kde_test_include="kwindowsystem.h"
11183     kde_test_library="libsolid.so"
11185     AC_MSG_CHECKING([for Qt4 headers])
11186     qt_header_dir="no"
11187     for inc_dir in $qt_incdirs; do
11188         if test -r "$inc_dir/$qt_test_include"; then
11189             qt_header_dir="$inc_dir"
11190             break
11191         fi
11192     done
11194     AC_MSG_RESULT([$qt_header_dir])
11195     if test "x$qt_header_dir" = "xno"; then
11196         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11197     fi
11199     dnl Check for qmake
11200     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11201     QMAKE4="$QMAKEQT4"
11202     if test "$QMAKE4" = "no"; then
11203         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11204         if test "$QMAKE4" = "no"; then
11205             AC_MSG_ERROR([Qmake not found.  Please specify
11206 the root of your Qt installation by exporting QT4DIR before running "configure".])
11207         fi
11208     fi
11210     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11211     AC_MSG_CHECKING([for Qt4 libraries])
11212     qt_lib_dir="no"
11213     for lib_dir in $qt_libdirs; do
11214         if test -r "$lib_dir/$qt_test_library"; then
11215             qt_lib_dir="$lib_dir"
11216             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11217             break
11218         fi
11219     done
11221     AC_MSG_RESULT([$qt_lib_dir])
11223     if test "x$qt_lib_dir" = "xno"; then
11224         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11225     fi
11227     dnl Check for Meta Object Compiler
11229     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11230     MOC4="$MOCQT4"
11231     if test "$MOC4" = "no"; then
11232         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11233         if test "$MOC4" = "no"; then
11234             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11235 the root of your Qt installation by exporting QT4DIR before running "configure".])
11236         fi
11237     fi
11239     dnl Check for KDE4 headers
11240     AC_MSG_CHECKING([for KDE4 headers])
11241     kde_incdir="no"
11242     for kde_check in $kde_incdirs; do
11243         if test -r "$kde_check/$kde_test_include"; then
11244             kde_incdir="$kde_check"
11245             break
11246         fi
11247     done
11248     AC_MSG_RESULT([$kde_incdir])
11249     if test "x$kde_incdir" = "xno"; then
11250         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11251     fi
11253     dnl Check for KDE4 libraries
11254     AC_MSG_CHECKING([for KDE4 libraries])
11255     kde_libdir="no"
11256     for kde_check in $kde_libdirs; do
11257         if test -r "$kde_check/$kde_test_library"; then
11258             kde_libdir="$kde_check"
11259             break
11260         fi
11261     done
11263     AC_MSG_RESULT([$kde_libdir])
11264     if test "x$kde_libdir" = "xno"; then
11265         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11266     fi
11268     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11269     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11270     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11271     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11273     AC_LANG_PUSH([C++])
11274     save_CXXFLAGS=$CXXFLAGS
11275     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11276     AC_MSG_CHECKING([whether KDE is >= 4.2])
11277        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11278 #include <kdeversion.h>
11280 int main(int argc, char **argv) {
11281        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11282        else return 1;
11284        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11285     CXXFLAGS=$save_CXXFLAGS
11286     AC_LANG_POP([C++])
11288     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11289     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11290     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11291         [
11292             KDE_HAVE_GLIB=1
11293             AC_DEFINE(KDE_HAVE_GLIB,1)
11294             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11296             qt4_fix_warning=
11298             AC_LANG_PUSH([C++])
11299             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11300             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11301             #  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
11302             #               ^~~~~~~~~~~~~~~~~~~~~~~
11303             #               vptr for 'QObjectPrivate'
11304             save_CXX=$CXX
11305             CXX=$(printf %s "$CXX" \
11306                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11307             save_CXXFLAGS=$CXXFLAGS
11308             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11309             save_LIBS=$LIBS
11310             LIBS="$LIBS $KDE4_LIBS"
11311             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11313             # Prepare meta object data
11314             TSTBASE="tst_exclude_socket_notifiers"
11315             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11316             ln -fs "${TSTMOC}.hxx"
11317             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11319             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11320 #define SAL_OVERRIDE
11321 #include <cstdlib>
11322 #include "tst_exclude_socket_notifiers.moc"
11324 int main(int argc, char *argv[])
11326     QCoreApplication app(argc, argv);
11327     exit(tst_processEventsExcludeSocket());
11328     return 0;
11330             ]])],[
11331                 AC_MSG_RESULT([yes])
11332             ],[
11333                 AC_MSG_RESULT([no])
11334                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11335                 if test -z "$qt4_fix_warning"; then
11336                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11337                 fi
11338                 qt4_fix_warning=1
11339                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11340             ])
11342             # Remove meta object data
11343             rm -f "${TSTBASE}."*
11345             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11347             # Prepare meta object data
11348             TSTBASE="tst_exclude_posted_events"
11349             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11350             ln -fs "${TSTMOC}.hxx"
11351             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11353             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11354 #define SAL_OVERRIDE
11355 #include <cstdlib>
11356 #include "tst_exclude_posted_events.moc"
11358 int main(int argc, char *argv[])
11360     QCoreApplication app(argc, argv);
11361     exit(tst_excludePostedEvents());
11362     return 0;
11364             ]])],[
11365                 AC_MSG_RESULT([yes])
11366             ],[
11367                 AC_MSG_RESULT([no])
11368                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11369                 if test -z "$qt4_fix_warning"; then
11370                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11371                 fi
11372                 qt4_fix_warning=1
11373                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11374             ])
11376             # Remove meta object data
11377             rm -f "${TSTBASE}."*
11379             if test -n "$qt4_fix_warning"; then
11380                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11381             fi
11383             LIBS=$save_LIBS
11384             CXXFLAGS=$save_CXXFLAGS
11385             CXX=$save_CXX
11386             AC_LANG_POP([C++])
11387         ],
11388         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11390 AC_SUBST(KDE4_CFLAGS)
11391 AC_SUBST(KDE4_LIBS)
11392 AC_SUBST(MOC4)
11393 AC_SUBST(KDE_GLIB_CFLAGS)
11394 AC_SUBST(KDE_GLIB_LIBS)
11395 AC_SUBST(KDE_HAVE_GLIB)
11397 dnl ===================================================================
11398 dnl Test for the enabling the lockdown pieces
11399 dnl ===================================================================
11400 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11401 ENABLE_LOCKDOWN=
11402 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11403     ENABLE_LOCKDOWN=TRUE
11404     AC_MSG_RESULT([yes])
11405 else
11406     AC_MSG_RESULT([no])
11408 AC_SUBST(ENABLE_LOCKDOWN)
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     ENABLE_EVOAB2="TRUE"
11419 else
11420     ENABLE_EVOAB2=""
11421     AC_MSG_RESULT([no])
11423 AC_SUBST(ENABLE_EVOAB2)
11424 AC_SUBST(GOBJECT_CFLAGS)
11425 AC_SUBST(GOBJECT_LIBS)
11427 dnl ===================================================================
11428 dnl Test whether to include TDE AB support
11429 dnl ===================================================================
11430 AC_MSG_CHECKING([whether to enable TDE address book support])
11431 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11432     AC_MSG_RESULT([yes])
11433     AC_LANG_PUSH([C++])
11434     save_CXXFLAGS=$CXXFLAGS
11435     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11436     AC_MSG_CHECKING([whether TDE is at least R14.0])
11437        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11438 #include <tdeversion.h>
11440 int main(int argc, char **argv) {
11441        if (TDE_VERSION_MAJOR >= 14) return 0;
11442        else return 1;
11444        ]])],[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])],[])
11445     CXXFLAGS=$save_CXXFLAGS
11446     AC_LANG_POP([C++])
11447     ENABLE_TDEAB=TRUE
11448 else
11449     AC_MSG_RESULT([no])
11450     ENABLE_TDEAB=
11452 AC_SUBST(ENABLE_TDEAB)
11454 dnl ===================================================================
11455 dnl Test whether to include KDE AB support
11456 dnl ===================================================================
11457 AC_MSG_CHECKING([whether to enable KDE address book support])
11458 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11459     AC_MSG_RESULT([yes])
11460     AC_LANG_PUSH([C++])
11461     save_CXXFLAGS=$CXXFLAGS
11462     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11463     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11464        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11465 #include <kdeversion.h>
11467 int main(int argc, char **argv) {
11468        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11469        else return 1;
11471        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old or too recent, please use another version of KDE or disable KDE address book support])],[])
11472     CXXFLAGS=$save_CXXFLAGS
11473     AC_LANG_POP([C++])
11474     ENABLE_KAB=TRUE
11475 else
11476     AC_MSG_RESULT([no])
11477     ENABLE_KAB=
11479 AC_SUBST(ENABLE_KAB)
11481 dnl ===================================================================
11482 dnl Test which themes to include
11483 dnl ===================================================================
11484 AC_MSG_CHECKING([which themes to include])
11485 # if none given use default subset of available themes
11486 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11487     with_theme="breeze galaxy hicontrast oxygen sifr tango"
11488     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11491 WITH_THEMES=""
11492 if test "x$with_theme" != "xno"; then
11493     for theme in $with_theme; do
11494         case $theme in
11495         breeze|crystal|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) real_theme="$theme" ;;
11496         default) real_theme=galaxy ;;
11497         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11498         esac
11499         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11500     done
11502 AC_MSG_RESULT([$WITH_THEMES])
11503 AC_SUBST([WITH_THEMES])
11504 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11505 for theme in $with_theme; do
11506     case $theme in
11507     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11508     *) ;;
11509     esac
11510 done
11512 dnl ===================================================================
11513 dnl Test whether to integrate helppacks into the product's installer
11514 dnl ===================================================================
11515 AC_MSG_CHECKING([for helppack integration])
11516 if test "$with_helppack_integration" = "no"; then
11517     WITH_HELPPACK_INTEGRATION=
11518     AC_MSG_RESULT([no integration])
11519 else
11520     WITH_HELPPACK_INTEGRATION=TRUE
11521     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11522     AC_MSG_RESULT([integration])
11524 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11526 ###############################################################################
11527 # Extensions checking
11528 ###############################################################################
11529 AC_MSG_CHECKING([for extensions integration])
11530 if test "x$enable_extension_integration" != "xno"; then
11531     WITH_EXTENSION_INTEGRATION=TRUE
11532     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11533     AC_MSG_RESULT([yes, use integration])
11534 else
11535     WITH_EXTENSION_INTEGRATION=
11536     AC_MSG_RESULT([no, do not integrate])
11538 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11540 dnl Should any extra extensions be included?
11541 dnl There are standalone tests for each of these below.
11542 WITH_EXTRA_EXTENSIONS=
11543 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11545 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11546 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11547 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11548 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11549 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11550 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11551 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11552 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11553 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11554 if test "x$with_java" != "xno"; then
11555     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11556     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11559 dnl ===================================================================
11560 dnl Test whether to include Sun Professional Template Pack
11561 dnl ===================================================================
11562 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11563 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11564     AC_MSG_RESULT([no integration])
11565 else
11566     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11567     sun_supported_langs="en-US de it fr es hu"
11568     if test "$with_sun_templates" = "yes"; then
11569         wanted_sun_templates="$sun_supported_langs"
11570     else
11571         # check whether the langs are supported by Sun
11572         wanted_sun_templates=
11573         for lang in $with_sun_templates; do
11574             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11575                 wanted_sun_templates="$wanted_sun_templates $lang"
11576             fi
11577         done
11578     fi
11579     SUNTEMPLATES_LANG=
11580     SUNTEMPLATES_DE_PACK=
11581     SUNTEMPLATES_EN_US_PACK=
11582     SUNTEMPLATES_ES_PACK=
11583     SUNTEMPLATES_FR_PACK=
11584     SUNTEMPLATES_HU_PACK=
11585     SUNTEMPLATES_IT_PACK=
11586     # check whether the langs are requested at all
11587     for lang in $wanted_sun_templates; do
11588     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11589         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11590         case $lang in
11591         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11592         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11593         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11594         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11595         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11596         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11597         esac
11598     fi
11599     done
11600     WITH_EXTRA_EXTENSIONS=TRUE
11601     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11603 AC_SUBST(SUNTEMPLATES_DE_PACK)
11604 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11605 AC_SUBST(SUNTEMPLATES_ES_PACK)
11606 AC_SUBST(SUNTEMPLATES_FR_PACK)
11607 AC_SUBST(SUNTEMPLATES_HU_PACK)
11608 AC_SUBST(SUNTEMPLATES_IT_PACK)
11610 TEST_FONTS_MISSING=0
11612 # $1  = font family
11613 # $2+ = accepted font mappings
11614 test_font_map()
11616     FONT="$1" ; shift
11617     AC_MSG_CHECKING([font mapping for '$FONT'])
11618     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11619     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11621     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11622     while test "$#" -ge 1 ; do
11623         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11624         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11625     done
11626     if test $TESTEXPR
11627     then
11628         AC_MSG_RESULT([ok])
11629     else
11630         AC_MSG_RESULT([unknown ($FONTFILE)])
11631         TEST_FONTS_MISSING=1
11632     fi
11635 dnl ===================================================================
11636 dnl Test whether to include fonts
11637 dnl ===================================================================
11638 AC_MSG_CHECKING([whether to include third-party fonts])
11639 if test "$with_fonts" != "no"; then
11640     AC_MSG_RESULT([yes])
11641     WITH_FONTS=TRUE
11642     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11643 else
11644     AC_MSG_RESULT([no])
11645     WITH_FONTS=
11646     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11647     if test "$test_fontconfig" = "yes"; then
11648         AC_PATH_PROG([FCMATCH], [fc-match])
11649         if test -z "$FCMATCH"; then
11650             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11651             TEST_FONTS_MISSING=1
11652         else
11653             test_font_map 'Calibri' 'Carlito'
11654             if test ${TEST_FONTS_MISSING} -eq 1
11655             then
11656                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11657             fi
11658         fi
11659     else
11660         TEST_FONTS_MISSING=0
11661     fi
11663 AC_SUBST(WITH_FONTS)
11664 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11666 dnl ===================================================================
11667 dnl Test whether to include extra galleries
11668 dnl ===================================================================
11669 AC_MSG_CHECKING([whether to include extra galleries])
11670 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11671     AC_MSG_RESULT([no])
11672     WITH_EXTRA_GALLERY=
11673     OOOP_GALLERY_PACK=""
11674 else
11675     AC_MSG_RESULT([yes])
11676     WITH_EXTRA_GALLERY=TRUE
11677     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11678     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11679     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11681 AC_SUBST(WITH_EXTRA_GALLERY)
11682 AC_SUBST(OOOP_GALLERY_PACK)
11684 dnl ===================================================================
11685 dnl Test whether to include extra templates
11686 dnl ===================================================================
11687 AC_MSG_CHECKING([whether to include extra templates])
11688 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11689     AC_MSG_RESULT([no])
11690     WITH_EXTRA_TEMPLATE=
11691     OOOP_TEMPLATES_PACK=""
11692 else
11693     AC_MSG_RESULT([yes])
11694     WITH_EXTRA_TEMPLATE=TRUE
11695     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11696     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11697     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11699 AC_SUBST(WITH_EXTRA_TEMPLATE)
11700 AC_SUBST(OOOP_TEMPLATES_PACK)
11702 dnl ===================================================================
11703 dnl Test whether to include extra samples
11704 dnl ===================================================================
11705 AC_MSG_CHECKING([whether to include extra samples])
11706 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11707     AC_MSG_RESULT([no])
11708     WITH_EXTRA_SAMPLE=
11709     OOOP_SAMPLES_PACK=""
11710 else
11711     AC_MSG_RESULT([yes])
11712     WITH_EXTRA_SAMPLE=TRUE
11713     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11714     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11715     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11717 AC_SUBST(WITH_EXTRA_SAMPLE)
11718 AC_SUBST(OOOP_SAMPLES_PACK)
11720 dnl ===================================================================
11721 dnl Test whether to include extra fonts
11722 dnl ===================================================================
11723 AC_MSG_CHECKING([whether to include extra fonts])
11724 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11725     AC_MSG_RESULT([no])
11726     WITH_EXTRA_FONT=
11727     OOOP_FONTS_PACK=""
11728 else
11729     AC_MSG_RESULT([yes])
11730     WITH_EXTRA_FONT=TRUE
11731     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11732     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11733     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11735 AC_SUBST(WITH_EXTRA_FONT)
11736 AC_SUBST(OOOP_FONTS_PACK)
11738 dnl ===================================================================
11739 dnl Test whether to enable online update service
11740 dnl ===================================================================
11741 AC_MSG_CHECKING([whether to enable online update])
11742 ENABLE_ONLINE_UPDATE=
11743 if test "$enable_online_update" = ""; then
11744     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11745         AC_MSG_RESULT([yes])
11746         ENABLE_ONLINE_UPDATE="TRUE"
11747     else
11748         AC_MSG_RESULT([no])
11749     fi
11750 else
11751     if test "$enable_online_update" = "yes"; then
11752         AC_MSG_RESULT([yes])
11753         ENABLE_ONLINE_UPDATE="TRUE"
11754     else
11755         AC_MSG_RESULT([no])
11756     fi
11758 AC_SUBST(ENABLE_ONLINE_UPDATE)
11760 dnl ===================================================================
11761 dnl Test whether to enable extension update
11762 dnl ===================================================================
11763 AC_MSG_CHECKING([whether to enable extension update])
11764 ENABLE_EXTENSION_UPDATE=
11765 if test "x$enable_extension_update" = "xno"; then
11766     AC_MSG_RESULT([no])
11767 else
11768     AC_MSG_RESULT([yes])
11769     ENABLE_EXTENSION_UPDATE="TRUE"
11770     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11771     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11773 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11776 dnl ===================================================================
11777 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11778 dnl ===================================================================
11779 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11780 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11781     AC_MSG_RESULT([no])
11782     ENABLE_SILENT_MSI=
11783 else
11784     AC_MSG_RESULT([yes])
11785     ENABLE_SILENT_MSI=TRUE
11786     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11788 AC_SUBST(ENABLE_SILENT_MSI)
11790 AC_MSG_CHECKING([whether and how to use Xinerama])
11791 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11792     if test "$x_libraries" = "default_x_libraries"; then
11793         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11794         if test "x$XINERAMALIB" = x; then
11795            XINERAMALIB="/usr/lib"
11796         fi
11797     else
11798         XINERAMALIB="$x_libraries"
11799     fi
11800     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11801         # we have both versions, let the user decide but use the dynamic one
11802         # per default
11803         USE_XINERAMA=TRUE
11804         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11805             XINERAMA_LINK=dynamic
11806         else
11807             XINERAMA_LINK=static
11808         fi
11809     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11810         # we have only the dynamic version
11811         USE_XINERAMA=TRUE
11812         XINERAMA_LINK=dynamic
11813     elif test -e "$XINERAMALIB/libXinerama.a"; then
11814         # static version
11815         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11816             USE_XINERAMA=TRUE
11817             XINERAMA_LINK=static
11818         else
11819             USE_XINERAMA=
11820             XINERAMA_LINK=none
11821         fi
11822     else
11823         # no Xinerama
11824         USE_XINERAMA=
11825         XINERAMA_LINK=none
11826     fi
11827     if test "$USE_XINERAMA" = "TRUE"; then
11828         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11829         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11830             [AC_MSG_ERROR(Xinerama header not found.)], [])
11831         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11832         if test "x$XEXTLIB" = x; then
11833            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11834         fi
11835         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11836         if test "$_os" = "FreeBSD"; then
11837             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11838         fi
11839         if test "$_os" = "Linux"; then
11840             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11841         fi
11842         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11843             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11844     else
11845         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11846     fi
11847 else
11848     USE_XINERAMA=
11849     XINERAMA_LINK=none
11850     AC_MSG_RESULT([no])
11852 AC_SUBST(USE_XINERAMA)
11853 AC_SUBST(XINERAMA_LINK)
11855 dnl ===================================================================
11856 dnl Test whether to build cairo or rely on the system version
11857 dnl ===================================================================
11859 if test "$GUIBASE" = "unx"; then
11860     # Used in vcl/Library_vclplug_gen.mk
11861     test_cairo=yes
11864 if test "$test_cairo" = "yes"; then
11865     AC_MSG_CHECKING([whether to use the system cairo])
11867     : ${with_system_cairo:=$with_system_libs}
11868     if test "$with_system_cairo" = "yes"; then
11869         SYSTEM_CAIRO=TRUE
11870         AC_MSG_RESULT([yes])
11872         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11873         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11875         if test "$test_xrender" = "yes"; then
11876             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11877             AC_LANG_PUSH([C])
11878             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11879 #ifdef PictStandardA8
11880 #else
11881       return fail;
11882 #endif
11883 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11885             AC_LANG_POP([C])
11886         fi
11887         libo_MINGW_CHECK_DLL([libcairo])
11888         libo_MINGW_TRY_DLL([libfontconfig])
11889         libo_MINGW_TRY_DLL([libfreetype])
11890         libo_MINGW_TRY_DLL([libpixman])
11891         libo_MINGW_TRY_DLL([libpng15])
11892     else
11893         SYSTEM_CAIRO=
11894         AC_MSG_RESULT([no])
11896         BUILD_TYPE="$BUILD_TYPE CAIRO"
11897         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11898     fi
11901 AC_SUBST(SYSTEM_CAIRO)
11902 AC_SUBST(CAIRO_CFLAGS)
11903 AC_SUBST(CAIRO_LIBS)
11905 dnl ===================================================================
11906 dnl Test whether to use avahi
11907 dnl ===================================================================
11908 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11909     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11910                       [ENABLE_AVAHI="TRUE"])
11911     AC_DEFINE(HAVE_FEATURE_AVAHI)
11912     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11915 AC_SUBST(ENABLE_AVAHI)
11916 AC_SUBST(AVAHI_CFLAGS)
11917 AC_SUBST(AVAHI_LIBS)
11919 dnl ===================================================================
11920 dnl Test whether to use liblangtag
11921 dnl ===================================================================
11922 ENABLE_LIBLANGTAG=
11923 SYSTEM_LIBLANGTAG=
11924 AC_MSG_CHECKING([whether to use liblangtag])
11925 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11926     ENABLE_LIBLANGTAG=TRUE
11927     AC_MSG_RESULT([yes])
11928     AC_MSG_CHECKING([whether to use system liblangtag])
11929     if test "$with_system_liblangtag" = yes; then
11930         SYSTEM_LIBLANGTAG=TRUE
11931         AC_MSG_RESULT([yes])
11932         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11933         dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11934         PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11935         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11936         libo_MINGW_CHECK_DLL([liblangtag])
11937     else
11938         SYSTEM_LIBLANGTAG=
11939         AC_MSG_RESULT([no])
11940         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11941         dnl TODO: remove when liblangtag is updated to 0.5.5
11942         AC_DEFINE([LIBLANGTAG_INLINE_FIX])
11943         if test "$COM" = "MSC"; then
11944             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11945         else
11946             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11947         fi
11948     fi
11949 else
11950     AC_MSG_RESULT([no])
11952 AC_SUBST(ENABLE_LIBLANGTAG)
11953 AC_SUBST(SYSTEM_LIBLANGTAG)
11954 AC_SUBST(LIBLANGTAG_CFLAGS)
11955 AC_SUBST(LIBLANGTAG_LIBS)
11957 dnl ===================================================================
11958 dnl Test whether to build libpng or rely on the system version
11959 dnl ===================================================================
11961 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11963 dnl ===================================================================
11964 dnl Check for runtime JVM search path
11965 dnl ===================================================================
11966 if test "$ENABLE_JAVA" != ""; then
11967     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11968     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11969         AC_MSG_RESULT([yes])
11970         if ! test -d "$with_jvm_path"; then
11971             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11972         fi
11973         if ! test -d "$with_jvm_path"jvm; then
11974             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11975         fi
11976         JVM_ONE_PATH_CHECK="$with_jvm_path"
11977         AC_SUBST(JVM_ONE_PATH_CHECK)
11978     else
11979         AC_MSG_RESULT([no])
11980     fi
11983 dnl ===================================================================
11984 dnl Test for the presence of Ant and that it works
11985 dnl ===================================================================
11987 if test "$ENABLE_JAVA" != ""; then
11988     ANT_HOME=; export ANT_HOME
11989     WITH_ANT_HOME=; export WITH_ANT_HOME
11990     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11991         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11992             if test "$_os" = "WINNT"; then
11993                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11994             else
11995                 with_ant_home="$LODE_HOME/opt/ant"
11996             fi
11997         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11998             with_ant_home="$LODE_HOME/opt/ant"
11999         fi
12000     fi
12001     if test -z "$with_ant_home"; then
12002         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
12003     else
12004         if test "$_os" = "WINNT"; then
12005             # AC_PATH_PROGS needs unix path
12006             with_ant_home=`cygpath -u "$with_ant_home"`
12007         fi
12008         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
12009         WITH_ANT_HOME=$with_ant_home
12010         ANT_HOME=$with_ant_home
12011     fi
12013     if test -z "$ANT"; then
12014         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
12015     else
12016         # resolve relative or absolute symlink
12017         while test -h "$ANT"; do
12018             a_cwd=`pwd`
12019             a_basename=`basename "$ANT"`
12020             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
12021             cd "`dirname "$ANT"`"
12022             cd "`dirname "$a_script"`"
12023             ANT="`pwd`"/"`basename "$a_script"`"
12024             cd "$a_cwd"
12025         done
12027         AC_MSG_CHECKING([if $ANT works])
12028         cat > conftest.java << EOF
12029         public class conftest {
12030             int testmethod(int a, int b) {
12031                     return a + b;
12032             }
12033         }
12036         cat > conftest.xml << EOF
12037         <project name="conftest" default="conftest">
12038         <target name="conftest">
12039             <javac srcdir="." includes="conftest.java">
12040             </javac>
12041         </target>
12042         </project>
12045         oldJAVA_HOME=$JAVA_HOME
12046         if test "$JAVACISGCJ" = "yes"; then
12047             JAVA_HOME=; export JAVA_HOME
12048             ant_gcj="-Dbuild.compiler=gcj"
12049         fi
12050         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12051         if test $? = 0 -a -f ./conftest.class; then
12052             AC_MSG_RESULT([Ant works])
12053             if test -z "$WITH_ANT_HOME"; then
12054                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12055                 if test -z "$ANT_HOME"; then
12056                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12057                 fi
12058             else
12059                 ANT_HOME="$WITH_ANT_HOME"
12060             fi
12061         else
12062             echo "configure: Ant test failed" >&5
12063             cat conftest.java >&5
12064             cat conftest.xml >&5
12065             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
12066             ANT_HOME=""
12067             add_warning "Ant does not work - Some Java projects will not build!"
12068         fi
12069         JAVA_HOME=$oldJAVA_HOME
12070         rm -f conftest* core core.* *.core
12071     fi
12072     if test -z "$ANT_HOME"; then
12073         ANT_HOME="NO_ANT_HOME"
12074     else
12075         PathFormat "$ANT_HOME"
12076         ANT_HOME="$formatted_path"
12077         PathFormat "$ANT"
12078         ANT="$formatted_path"
12079     fi
12080     AC_SUBST(ANT_HOME)
12081     AC_SUBST(ANT)
12083     dnl Checking for ant.jar
12084     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12085         AC_MSG_CHECKING([Ant lib directory])
12086         if test -f $ANT_HOME/lib/ant.jar; then
12087             ANT_LIB="$ANT_HOME/lib"
12088         else
12089             if test -f $ANT_HOME/ant.jar; then
12090                 ANT_LIB="$ANT_HOME"
12091             else
12092                 if test -f /usr/share/java/ant.jar; then
12093                     ANT_LIB=/usr/share/java
12094                 else
12095                     if test -f /usr/share/ant-core/lib/ant.jar; then
12096                         ANT_LIB=/usr/share/ant-core/lib
12097                     else
12098                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12099                             ANT_LIB="$ANT_HOME/lib/ant"
12100                         else
12101                             if test -f /usr/share/lib/ant/ant.jar; then
12102                                 ANT_LIB=/usr/share/lib/ant
12103                             else
12104                                 AC_MSG_ERROR([Ant libraries not found!])
12105                             fi
12106                         fi
12107                     fi
12108                 fi
12109             fi
12110         fi
12111         PathFormat "$ANT_LIB"
12112         ANT_LIB="$formatted_path"
12113         AC_MSG_RESULT([Ant lib directory found.])
12114     fi
12115     AC_SUBST(ANT_LIB)
12117     ant_minver=1.6.0
12118     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12120     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12121     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12122     ant_version_major=`echo $ant_version | cut -d. -f1`
12123     ant_version_minor=`echo $ant_version | cut -d. -f2`
12124     echo "configure: ant_version $ant_version " >&5
12125     echo "configure: ant_version_major $ant_version_major " >&5
12126     echo "configure: ant_version_minor $ant_version_minor " >&5
12127     if test "$ant_version_major" -ge "2"; then
12128         AC_MSG_RESULT([yes, $ant_version])
12129     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12130         AC_MSG_RESULT([yes, $ant_version])
12131     else
12132         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12133     fi
12135     rm -f conftest* core core.* *.core
12138 OOO_JUNIT_JAR=
12139 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12140     AC_MSG_CHECKING([for JUnit 4])
12141     if test "$with_junit" = "yes"; then
12142         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12143             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12144         elif test -e /usr/share/java/junit4.jar; then
12145             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12146         else
12147            if test -e /usr/share/lib/java/junit.jar; then
12148               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12149            else
12150               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12151            fi
12152         fi
12153     else
12154         OOO_JUNIT_JAR=$with_junit
12155     fi
12156     if test "$_os" = "WINNT"; then
12157         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12158     fi
12159     printf 'import org.junit.Before;' > conftest.java
12160     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12161         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12162     else
12163         AC_MSG_ERROR(
12164 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12165  specify its pathname via --with-junit=..., or disable it via --without-junit])
12166     fi
12167     rm -f conftest.class conftest.java
12168     if test $OOO_JUNIT_JAR != ""; then
12169     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12170     fi
12172 AC_SUBST(OOO_JUNIT_JAR)
12174 HAMCREST_JAR=
12175 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12176     AC_MSG_CHECKING([for included Hamcrest])
12177     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12178     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12179         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12180     else
12181         AC_MSG_RESULT([Not included])
12182         AC_MSG_CHECKING([for standalone hamcrest jar.])
12183         if test "$with_hamcrest" = "yes"; then
12184             if test -e /usr/share/lib/java/hamcrest.jar; then
12185                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12186             elif test -e /usr/share/java/hamcrest/core.jar; then
12187                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12188             else
12189                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12190             fi
12191         else
12192             HAMCREST_JAR=$with_hamcrest
12193         fi
12194         if test "$_os" = "WINNT"; then
12195             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12196         fi
12197         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12198             AC_MSG_RESULT([$HAMCREST_JAR])
12199         else
12200             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),
12201                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12202         fi
12203     fi
12204     rm -f conftest.class conftest.java
12206 AC_SUBST(HAMCREST_JAR)
12209 AC_SUBST(SCPDEFS)
12212 # check for wget and curl
12214 WGET=
12215 CURL=
12217 if test "$enable_fetch_external" != "no"; then
12219 CURL=`which curl 2>/dev/null`
12221 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12222     eval "$i --version" > /dev/null 2>&1
12223     ret=$?
12224     if test $ret -eq 0; then
12225         WGET=$i
12226         break
12227     fi
12228 done
12230 if test -z "$WGET" -a -z "$CURL"; then
12231     AC_MSG_ERROR([neither wget nor curl found!])
12236 AC_SUBST(WGET)
12237 AC_SUBST(CURL)
12240 # check for md5sum
12242 MD5SUM=
12244 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12245     if test "$i" = "md5"; then
12246         eval "$i -x" > /dev/null 2>&1
12247     else
12248         eval "$i --version" > /dev/null 2>&1
12249     fi
12250     ret=$?
12251     if test $ret -eq 0; then
12252         MD5SUM=$i
12253         break
12254     fi
12255 done
12257 if test "$MD5SUM" = "md5"; then
12258     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12259         MD5SUM="$MD5SUM -r"
12260     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12261         MD5SUM="$MD5SUM -n"
12262     fi
12265 if test -z "$MD5SUM"; then
12266     AC_MSG_ERROR([no md5sum found!])
12269 AC_SUBST(MD5SUM)
12271 dnl ===================================================================
12272 dnl Dealing with l10n options
12273 dnl ===================================================================
12274 AC_MSG_CHECKING([which languages to be built])
12275 # get list of all languages
12276 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12277 # the sed command does the following:
12278 #   + if a line ends with a backslash, append the next line to it
12279 #   + adds " on the beginning of the value (after =)
12280 #   + adds " at the end of the value
12281 #   + removes en-US; we want to put it on the beginning
12282 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12283 [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)]
12284 ALL_LANGS="en-US $completelangiso"
12285 # check the configured localizations
12286 WITH_LANG="$with_lang"
12287 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12288     AC_MSG_RESULT([en-US])
12289 else
12290     AC_MSG_RESULT([$WITH_LANG])
12291     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12293 # check that the list is valid
12294 for lang in $WITH_LANG; do
12295     test "$lang" = "ALL" && continue
12296     # need to check for the exact string, so add space before and after the list of all languages
12297     for vl in $ALL_LANGS; do
12298         if test "$vl" = "$lang"; then
12299            break
12300         fi
12301     done
12302     if test "$vl" != "$lang"; then
12303         # if you're reading this - you prolly quoted your languages remove the quotes ...
12304         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12305     fi
12306 done
12307 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12308     echo $WITH_LANG | grep -q en-US
12309     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12311 # list with substituted ALL
12312 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12313 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12314 test "$WITH_LANG" = "en-US" && WITH_LANG=
12315 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12316     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12317     ALL_LANGS=`echo $ALL_LANGS qtz`
12319 AC_SUBST(ALL_LANGS)
12320 AC_SUBST(WITH_LANG)
12321 AC_SUBST(WITH_LANG_LIST)
12322 AC_SUBST(GIT_NEEDED_SUBMODULES)
12324 WITH_POOR_HELP_LOCALIZATIONS=
12325 if test -d "$SRC_ROOT/translations/source"; then
12326     for l in `ls -1 $SRC_ROOT/translations/source`; do
12327         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12328             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12329         fi
12330     done
12332 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12334 if test -n "$with_locales"; then
12335     WITH_LOCALES="$with_locales"
12337     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12338     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12339     # config_host/config_locales.h.in
12340     for locale in $WITH_LOCALES; do
12341         lang=${locale%_*}
12343         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12345         case $lang in
12346         hi|mr*ne)
12347             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12348             ;;
12349         bg|ru)
12350             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12351             ;;
12352         esac
12353     done
12354 else
12355     AC_DEFINE(WITH_LOCALE_ALL)
12357 AC_SUBST(WITH_LOCALES)
12359 dnl git submodule update --reference
12360 dnl ===================================================================
12361 if test -n "${GIT_REFERENCE_SRC}"; then
12362     for repo in ${GIT_NEEDED_SUBMODULES}; do
12363         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12364             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12365         fi
12366     done
12368 AC_SUBST(GIT_REFERENCE_SRC)
12370 dnl git submodules linked dirs
12371 dnl ===================================================================
12372 if test -n "${GIT_LINK_SRC}"; then
12373     for repo in ${GIT_NEEDED_SUBMODULES}; do
12374         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12375             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12376         fi
12377     done
12379 AC_SUBST(GIT_LINK_SRC)
12381 dnl branding
12382 dnl ===================================================================
12383 AC_MSG_CHECKING([for alternative branding images directory])
12384 # initialize mapped arrays
12385 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12386 brand_files="$BRAND_INTRO_IMAGES about.svg"
12388 if test -z "$with_branding" -o "$with_branding" = "no"; then
12389     AC_MSG_RESULT([none])
12390     DEFAULT_BRAND_IMAGES="$brand_files"
12391 else
12392     if ! test -d $with_branding ; then
12393         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12394     else
12395         AC_MSG_RESULT([$with_branding])
12396         CUSTOM_BRAND_DIR="$with_branding"
12397         for lfile in $brand_files
12398         do
12399             if ! test -f $with_branding/$lfile ; then
12400                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12401                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12402             else
12403                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12404             fi
12405         done
12406         check_for_progress="yes"
12407     fi
12409 AC_SUBST([BRAND_INTRO_IMAGES])
12410 AC_SUBST([CUSTOM_BRAND_DIR])
12411 AC_SUBST([CUSTOM_BRAND_IMAGES])
12412 AC_SUBST([DEFAULT_BRAND_IMAGES])
12415 AC_MSG_CHECKING([for 'intro' progress settings])
12416 PROGRESSBARCOLOR=
12417 PROGRESSSIZE=
12418 PROGRESSPOSITION=
12419 PROGRESSFRAMECOLOR=
12420 PROGRESSTEXTCOLOR=
12421 PROGRESSTEXTBASELINE=
12423 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12424     source "$with_branding/progress.conf"
12425     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12426 else
12427     AC_MSG_RESULT([none])
12430 AC_SUBST(PROGRESSBARCOLOR)
12431 AC_SUBST(PROGRESSSIZE)
12432 AC_SUBST(PROGRESSPOSITION)
12433 AC_SUBST(PROGRESSFRAMECOLOR)
12434 AC_SUBST(PROGRESSTEXTCOLOR)
12435 AC_SUBST(PROGRESSTEXTBASELINE)
12438 AC_MSG_CHECKING([for extra build ID])
12439 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12440     EXTRA_BUILDID="$with_extra_buildid"
12442 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12443 if test -n "$EXTRA_BUILDID" ; then
12444     AC_MSG_RESULT([$EXTRA_BUILDID])
12445 else
12446     AC_MSG_RESULT([not set])
12448 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12450 OOO_VENDOR=
12451 AC_MSG_CHECKING([for vendor])
12452 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12453     OOO_VENDOR="$USERNAME"
12455     if test -z "$OOO_VENDOR"; then
12456         OOO_VENDOR="$USER"
12457     fi
12459     if test -z "$OOO_VENDOR"; then
12460         OOO_VENDOR="`id -u -n`"
12461     fi
12463     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12464 else
12465     OOO_VENDOR="$with_vendor"
12466     AC_MSG_RESULT([$OOO_VENDOR])
12468 AC_SUBST(OOO_VENDOR)
12470 if echo "$host_os" | grep -q linux-android ; then
12471     ANDROID_PACKAGE_NAME=
12472     AC_MSG_CHECKING([for Android package name])
12473     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12474         if test -n "$ENABLE_DEBUG"; then
12475             # Default to the package name that makes ndk-gdb happy.
12476             ANDROID_PACKAGE_NAME="org.libreoffice"
12477         else
12478             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12479         fi
12481         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12482     else
12483         if test -n "$ENABLE_DEBUG" -a "$with_android_package_name" != "org.libreoffice" ; then
12484             AC_MSG_ERROR([The package name must be set
12485 to org.libreoffice when debugging, please avoid --with-android-package-name.])
12486         fi
12487         ANDROID_PACKAGE_NAME="$with_android_package_name"
12488         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12489     fi
12490     AC_SUBST(ANDROID_PACKAGE_NAME)
12493 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12494 if test "$with_compat_oowrappers" = "yes"; then
12495     WITH_COMPAT_OOWRAPPERS=TRUE
12496     AC_MSG_RESULT(yes)
12497 else
12498     WITH_COMPAT_OOWRAPPERS=
12499     AC_MSG_RESULT(no)
12501 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12503 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12504 AC_MSG_CHECKING([for install dirname])
12505 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12506     INSTALLDIRNAME="$with_install_dirname"
12508 AC_MSG_RESULT([$INSTALLDIRNAME])
12509 AC_SUBST(INSTALLDIRNAME)
12511 AC_MSG_CHECKING([for prefix])
12512 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12513 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12514 PREFIXDIR="$prefix"
12515 AC_MSG_RESULT([$PREFIXDIR])
12516 AC_SUBST(PREFIXDIR)
12518 LIBDIR=[$(eval echo $(eval echo $libdir))]
12519 AC_SUBST(LIBDIR)
12521 DATADIR=[$(eval echo $(eval echo $datadir))]
12522 AC_SUBST(DATADIR)
12524 MANDIR=[$(eval echo $(eval echo $mandir))]
12525 AC_SUBST(MANDIR)
12527 DOCDIR=[$(eval echo $(eval echo $docdir))]
12528 AC_SUBST(DOCDIR)
12530 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12531 AC_SUBST(INSTALLDIR)
12533 TESTINSTALLDIR="${BUILDDIR}/test-install"
12534 AC_SUBST(TESTINSTALLDIR)
12537 # ===================================================================
12538 # OAuth2 id and secrets
12539 # ===================================================================
12541 AC_MSG_CHECKING([for Google Drive client id and secret])
12542 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12543 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12544 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12545     GDRIVE_CLIENT_ID="\"\""
12548 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12549     GDRIVE_CLIENT_SECRET="\"\""
12552 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12553     AC_MSG_RESULT([not set])
12554 else
12555     AC_MSG_RESULT([set])
12558 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12559 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12561 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12562 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12563 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12564 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12565     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12568 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12569     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12572 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12573     AC_MSG_RESULT([not set])
12574 else
12575     AC_MSG_RESULT([set])
12577 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12578 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12580 AC_MSG_CHECKING([for OneDrive client id and secret])
12581 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12582 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12583 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12584     ONEDRIVE_CLIENT_ID="\"\""
12587 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12588     ONEDRIVE_CLIENT_SECRET="\"\""
12591 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12592     AC_MSG_RESULT([not set])
12593 else
12594     AC_MSG_RESULT([set])
12596 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12597 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12600 # ===================================================================
12601 # De- or increase default verbosity of build process
12602 # ===================================================================
12603 AC_MSG_CHECKING([build verbosity])
12604 if test -n "$enable_verbose"; then
12605     if test "$enable_verbose" = "yes"; then
12606         VERBOSE="TRUE"
12607         AC_MSG_RESULT([high])
12608     fi
12609     if test "$enable_verbose" = "no"; then
12610         VERBOSE="FALSE"
12611         AC_MSG_RESULT([low])
12612     fi
12613 else
12614     AC_MSG_RESULT([not set])
12616 AC_SUBST(VERBOSE)
12618 dnl ===================================================================
12619 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12620 dnl --enable-dependency-tracking configure option
12621 dnl ===================================================================
12622 AC_MSG_CHECKING([whether to enable dependency tracking])
12623 if test "$enable_dependency_tracking" = "no"; then
12624     nodep=TRUE
12625     AC_MSG_RESULT([no])
12626 else
12627     AC_MSG_RESULT([yes])
12629 AC_SUBST(nodep)
12631 dnl ===================================================================
12632 dnl Number of CPUs to use during the build
12633 dnl ===================================================================
12634 AC_MSG_CHECKING([for number of processors to use])
12635 # plain --with-parallelism is just the default
12636 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12637     if test "$with_parallelism" = "no"; then
12638         PARALLELISM=0
12639     else
12640         PARALLELISM=$with_parallelism
12641     fi
12642 else
12643     if test "$enable_icecream" = "yes"; then
12644         PARALLELISM="10"
12645     else
12646         case `uname -s` in
12648         Darwin|FreeBSD|NetBSD|OpenBSD)
12649             PARALLELISM=`sysctl -n hw.ncpu`
12650             ;;
12652         Linux)
12653             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12654         ;;
12655         # what else than above does profit here *and* has /proc?
12656         *)
12657             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12658             ;;
12659         esac
12661         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12662         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12663     fi
12666 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12667     if test -z "$with_parallelism"; then
12668             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12669             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12670             PARALLELISM="1"
12671     else
12672         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."
12673     fi
12676 if test $PARALLELISM -eq 0; then
12677     AC_MSG_RESULT([explicit make -j option needed])
12678 else
12679     AC_MSG_RESULT([$PARALLELISM])
12681 AC_SUBST(PARALLELISM)
12683 IWYU_PATH="$with_iwyu"
12684 AC_SUBST(IWYU_PATH)
12685 if test ! -z "$IWYU_PATH"; then
12686     if test ! -f "$IWYU_PATH"; then
12687         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12688     fi
12692 # Set up ILIB for MSVC build
12694 ILIB1=
12695 if test "$build_os" = "cygwin"; then
12696     ILIB="."
12697     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12698         ILIB="$ILIB;$JAVA_HOME/lib"
12699     fi
12700     ILIB1=-link
12701     if test "$BITNESS_OVERRIDE" = 64; then
12702         ILIB="$ILIB;$COMPATH/lib/amd64"
12703         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12704         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12705         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12706         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81; then
12707             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12708             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12709         fi
12710     else
12711         ILIB="$ILIB;$COMPATH/lib"
12712         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12713         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12714         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12715         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81; then
12716             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12717             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12718         fi
12719     fi
12720     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12722     AC_SUBST(ILIB)
12725 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12726 if test "$CROSS_COMPILING" = "TRUE"; then
12727     broken='assuming not (cross-compiling)'
12728 else
12729     save_CXXFLAGS=$CXXFLAGS
12730     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12731     save_LIBS=$LIBS
12732     if test -n "$ILIB1"; then
12733         LIBS="$LIBS $ILIB1"
12734     fi
12735     AC_LANG_PUSH([C++])
12736     AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12737         // Exit with failure if the static initializer_list is stored on the
12738         // stack (as done by Clang < 3.4):
12739         #include <initializer_list>
12740         struct S {};
12741         bool g(void const * p1, void const * p2) {
12742             int n;
12743             return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12744         }
12745         bool f(void const * p1) {
12746             static std::initializer_list<S> s { S() };
12747             return g(p1, s.begin());
12748         }
12749         ]],[[
12750             int n;
12751             return f(&n) ? 0 : 1;
12752         ]])], [broken=no], [broken=yes])
12753     AC_LANG_POP([C++])
12754     LIBS=$save_LIBS
12755     CXXFLAGS=$save_CXXFLAGS
12757 AC_MSG_RESULT([$broken])
12758 if test "$broken" = yes; then
12759     AC_DEFINE([HAVE_BROKEN_STATIC_INITILIZER_LIST])
12763 # ===================================================================
12764 # Creating bigger shared library to link against
12765 # ===================================================================
12766 AC_MSG_CHECKING([whether to create huge library])
12767 MERGELIBS=
12769 if test $_os = iOS -o $_os = Android; then
12770     # Never any point in mergelibs for these as we build just static
12771     # libraries anyway...
12772     enable_mergelibs=no
12775 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12776     if test $_os != Linux -a $_os != WINNT; then
12777         add_warning "--enable-mergelibs is not tested for this platform"
12778     fi
12779     MERGELIBS="TRUE"
12780     AC_MSG_RESULT([yes])
12781 else
12782     AC_MSG_RESULT([no])
12784 AC_SUBST([MERGELIBS])
12786 # ===================================================================
12787 # Create hardlinks on deliver instead of copying for smaller size and speed up
12788 # ===================================================================
12789 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12790 HARDLINKDELIVER=
12791 if test "$enable_hardlink_deliver" = "yes"; then
12792     HARDLINKDELIVER="TRUE"
12793     AC_MSG_RESULT([yes])
12794 else
12795     AC_MSG_RESULT([no])
12797 AC_SUBST(HARDLINKDELIVER)
12799 dnl ===================================================================
12800 dnl icerun is a wrapper that stops us spawning tens of processes
12801 dnl locally - for tools that can't be executed on the compile cluster
12802 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12803 dnl ===================================================================
12804 AC_MSG_CHECKING([whether to use icerun wrapper])
12805 ICECREAM_RUN=
12806 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12807     ICECREAM_RUN=icerun
12808     AC_MSG_RESULT([yes])
12809 else
12810     AC_MSG_RESULT([no])
12812 AC_SUBST(ICECREAM_RUN)
12814 dnl ===================================================================
12815 dnl Setup the ICECC_VERSION for the build the same way it was set for
12816 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12817 dnl ===================================================================
12818 x_ICECC_VERSION=[\#]
12819 if test -n "$ICECC_VERSION" ; then
12820     x_ICECC_VERSION=
12822 AC_SUBST(x_ICECC_VERSION)
12823 AC_SUBST(ICECC_VERSION)
12825 dnl ===================================================================
12827 AC_MSG_CHECKING([MPL subset])
12828 MPL_SUBSET=
12830 if test "$enable_mpl_subset" = "yes"; then
12831     warn_report=false
12832     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12833         warn_report=true
12834     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12835         warn_report=true
12836     fi
12837     if test "$warn_report" = "true"; then
12838         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12839     fi
12840     if test "x$enable_postgresql_sdbc" != "xno"; then
12841         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12842     fi
12843     if test "$enable_lotuswordpro" = "yes"; then
12844         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12845     fi
12846     if test "$WITH_WEBDAV" = "neon"; then
12847         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12848     fi
12849     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12850         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12851     fi
12852     if test -n "$ENABLE_PDFIMPORT"; then
12853         if test "x$SYSTEM_POPPLER" != "x"; then
12854             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12855         fi
12856     fi
12857     # cf. m4/libo_check_extension.m4
12858     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12859         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12860     fi
12861     for theme in $WITH_THEMES; do
12862         case $theme in
12863         breeze|crystal|default|hicontrast|human|oxygen|sifr)
12864             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12865         *) : ;;
12866         esac
12867     done
12869     ENABLE_OPENGL=
12871     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12872         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12873     fi
12875     MPL_SUBSET="TRUE"
12876     AC_DEFINE(MPL_HAVE_SUBSET)
12877     AC_MSG_RESULT([only])
12878 else
12879     AC_MSG_RESULT([no restrictions])
12881 AC_SUBST(MPL_SUBSET)
12884 dnl ===================================================================
12885 dnl Setting up the environment.
12886 dnl ===================================================================
12887 echo "setting up the build environment variables..."
12889 AC_SUBST(COMPATH)
12891 if test "$build_os" = "cygwin"; then
12892     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12893         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12894         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12895     else
12896         ATL_LIB="$COMPATH/atlmfc/lib"
12897         ATL_INCLUDE="$COMPATH/atlmfc/include"
12898     fi
12899     if test "$BITNESS_OVERRIDE" = 64; then
12900         ATL_LIB="$ATL_LIB/amd64"
12901     fi
12902     PathFormat "/usr/bin/grep.exe"
12903     WIN_GREP="$formatted_path"
12904     PathFormat "/usr/bin/find.exe"
12905     WIN_FIND="$formatted_path"
12906     PathFormat "/usr/bin/ls.exe"
12907     WIN_LS="$formatted_path"
12908     PathFormat "/usr/bin/touch.exe"
12909     WIN_TOUCH="$formatted_path"
12912 AC_SUBST(ATL_INCLUDE)
12913 AC_SUBST(ATL_LIB)
12914 AC_SUBST(WIN_FIND)
12915 AC_SUBST(WIN_GREP)
12916 AC_SUBST(WIN_LS)
12917 AC_SUBST(WIN_TOUCH)
12919 AC_SUBST(BUILD_TYPE)
12921 AC_SUBST(SOLARINC)
12923 PathFormat "$PERL"
12924 PERL="$formatted_path"
12925 AC_SUBST(PERL)
12927 if test -n "$TMPDIR"; then
12928     TEMP_DIRECTORY="$TMPDIR"
12929 else
12930     TEMP_DIRECTORY="/tmp"
12932 if test "$build_os" = "cygwin"; then
12933     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12935 AC_SUBST(TEMP_DIRECTORY)
12937 # setup the PATH for the environment
12938 if test -n "$LO_PATH_FOR_BUILD"; then
12939     LO_PATH="$LO_PATH_FOR_BUILD"
12940 else
12941     LO_PATH="$PATH"
12943     case "$host_os" in
12945     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12946         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12947             pathmunge "$JAVA_HOME/bin" "after"
12948         fi
12949         ;;
12951     cygwin*)
12952         # Win32 make needs native paths
12953         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12954             LO_PATH=`cygpath -p -m "$PATH"`
12955         fi
12956         if test "$BITNESS_OVERRIDE" = 64; then
12957             # needed for msi packaging
12958             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12959         fi
12960         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12961         pathmunge "$ASM_HOME" "before"
12962         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12963         pathmunge "$CSC_PATH" "before"
12964         pathmunge "$MIDL_PATH" "before"
12965         pathmunge "$AL_PATH" "before"
12966         pathmunge "$MSPDB_PATH" "before"
12967         if test -n "$MSBUILD_PATH" ; then
12968             pathmunge "$MSBUILD_PATH" "before"
12969         fi
12970         if test "$BITNESS_OVERRIDE" = 64; then
12971             if test "$vcexpress" = "Express"; then
12972                 pathmunge "$COMPATH/bin/x86_amd64" "before"
12973                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12974             else
12975                 pathmunge "$COMPATH/bin/amd64" "before"
12976                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12977             fi
12978         else
12979             pathmunge "$COMPATH/bin" "before"
12980             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12981         fi
12982         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12983             if test -d "$JAVA_HOME/jre/bin/client"; then
12984                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12985             fi
12986             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12987                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12988             fi
12989             pathmunge "$JAVA_HOME/bin" "before"
12990         fi
12991         ;;
12993     solaris*)
12994         pathmunge "/usr/css/bin" "before"
12995         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12996             pathmunge "$JAVA_HOME/bin" "after"
12997         fi
12998         ;;
12999     esac
13002 AC_SUBST(LO_PATH)
13004 # Generate a configuration md5 we can use for deps
13005 if test -f config_host.mk; then
13006     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
13008 if test -f config_host_lang.mk; then
13009     config_lang_md5=`$MD5SUM config_host_lang.mk | sed "s/ .*//"`
13012 AC_CONFIG_FILES([config_host.mk
13013                  config_host_lang.mk
13014                  Makefile
13015                  lo.xcent
13016                  instsetoo_native/util/openoffice.lst
13017                  sysui/desktop/macosx/Info.plist
13018                  ios/lo.xcconfig])
13019 AC_CONFIG_HEADERS([config_host/config_buildid.h])
13020 AC_CONFIG_HEADERS([config_host/config_clang.h])
13021 AC_CONFIG_HEADERS([config_host/config_eot.h])
13022 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
13023 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
13024 AC_CONFIG_HEADERS([config_host/config_cups.h])
13025 AC_CONFIG_HEADERS([config_host/config_features.h])
13026 AC_CONFIG_HEADERS([config_host/config_folders.h])
13027 AC_CONFIG_HEADERS([config_host/config_gcc.h])
13028 AC_CONFIG_HEADERS([config_host/config_global.h])
13029 AC_CONFIG_HEADERS([config_host/config_graphite.h])
13030 AC_CONFIG_HEADERS([config_host/config_java.h])
13031 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
13032 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
13033 AC_CONFIG_HEADERS([config_host/config_locales.h])
13034 AC_CONFIG_HEADERS([config_host/config_mpl.h])
13035 AC_CONFIG_HEADERS([config_host/config_orcus.h])
13036 AC_CONFIG_HEADERS([config_host/config_kde4.h])
13037 AC_CONFIG_HEADERS([config_host/config_mingw.h])
13038 AC_CONFIG_HEADERS([config_host/config_oox.h])
13039 AC_CONFIG_HEADERS([config_host/config_options.h])
13040 AC_CONFIG_HEADERS([config_host/config_test.h])
13041 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
13042 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
13043 AC_CONFIG_HEADERS([config_host/config_vcl.h])
13044 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
13045 AC_CONFIG_HEADERS([config_host/config_version.h])
13046 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13047 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13048 AC_OUTPUT
13050 if test "$CROSS_COMPILING" = TRUE; then
13051     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13054 # touch the config timestamp file
13055 if test ! -f config_host.mk.stamp; then
13056     echo > config_host.mk.stamp
13057 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
13058     echo "Configuration unchanged - avoiding scp2 stamp update"
13059 else
13060     echo > config_host.mk.stamp
13063 # touch the config lang timestamp file
13064 if test ! -f config_host_lang.mk.stamp; then
13065     echo > config_host_lang.mk.stamp
13066 elif test "$config_lang_md5" = `$MD5SUM config_host_lang.mk | sed "s/ .*//"`; then
13067     echo "Configuration unchanged - avoiding scp2 stamp update"
13068 else
13069     echo > config_host_lang.mk.stamp
13073 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
13075 cat << _EOS
13076 ****************************************************************************
13077 WARNING:
13078 Your make version is known to be horribly slow, and hard to debug
13079 problems with. To get a reasonably functional make please do:
13081 to install a pre-compiled binary make for Win32
13083  mkdir -p /opt/lo/bin
13084  cd /opt/lo/bin
13085  wget http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
13086  cp make-85047eb-msvc.exe make
13087  chmod +x make
13089 to install from source:
13090 place yourself in a working directory of you choice.
13092  git clone git://git.savannah.gnu.org/make.git
13094  [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"]
13095  set PATH=%PATH%;C:\Cygwin\bin
13096  [or Cygwin64, if that is what you have]
13097  cd path-to-make-repo-you-cloned-above
13098  build_w32.bat --without-guile
13100 should result in a WinRel/gnumake.exe.
13101 Copy it to to the Cygwin /opt/lo/bin directory as make.exe
13103 Then re-run autogen.sh
13105 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13106 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13108 _EOS
13111 cat << _EOF
13112 ****************************************************************************
13114 To build, issue:
13115 $GNUMAKE
13117 For details, run:
13118 $GNUMAKE help
13120 _EOF
13122 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13123     cat << _EOF
13124 After the build has finished, you can immediately run it using:
13125 instdir/program/soffice
13127 If you want to run the smoketest, issue:
13128 $GNUMAKE check
13130 _EOF
13133 if test -f warn; then
13134     cat warn
13135     rm warn
13138 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: