Bump version to 5.0-14
[LibreOffice.git] / configure.ac
blob3ebc512b4a031f8c298f6262db532fe21416e72c
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argumemnt to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([Collabora Office],[5.0.10.14],[],[],[https://CollaboraOffice.com/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 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 PRODUCTNAME="AC_PACKAGE_NAME"
118 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
119     PRODUCTNAME="${PRODUCTNAME}Dev"
121 AC_MSG_RESULT([$PRODUCTNAME])
122 AC_SUBST(PRODUCTNAME)
124 dnl ===================================================================
125 dnl Our version is defined by the AC_INIT() at the top of this script.
126 dnl ===================================================================
128 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
130 LIBO_VERSION_MAJOR=$1
131 LIBO_VERSION_MINOR=$2
132 LIBO_VERSION_MICRO=$3
133 LIBO_VERSION_PATCH=$4
135 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
136 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
137 # no way to encode that into an integer in general.
138 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
140 LIBO_VERSION_SUFFIX=$5
141 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
142 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
143 # they get undoubled before actually passed to sed.
144 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
145 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
146 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
147 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
149 AC_SUBST(LIBO_VERSION_MAJOR)
150 AC_SUBST(LIBO_VERSION_MINOR)
151 AC_SUBST(LIBO_VERSION_MICRO)
152 AC_SUBST(LIBO_VERSION_PATCH)
153 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
154 AC_SUBST(LIBO_VERSION_SUFFIX)
155 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
157 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
158 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
159 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
160 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
162 LIBO_THIS_YEAR=`date +%Y`
163 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
165 dnl ===================================================================
166 dnl Product version
167 dnl ===================================================================
168 AC_MSG_CHECKING([for product version])
169 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
170 AC_MSG_RESULT([$PRODUCTVERSION])
171 AC_SUBST(PRODUCTVERSION)
173 AC_PROG_EGREP
174 # AC_PROG_EGREP doesn't set GREP on all systems as well
175 AC_PATH_PROG(GREP, grep)
177 BUILDDIR=`pwd`
178 cd $srcdir
179 SRC_ROOT=`pwd`
180 cd $BUILDDIR
181 x_Cygwin=[\#]
183 dnl ===================================================================
184 dnl Search all the common names for GNU Make
185 dnl ===================================================================
186 AC_MSG_CHECKING([for GNU Make])
188 # try to use our own make if it is available and GNUMAKE was not already defined
189 if test -z "$GNUMAKE"; then
190     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
191         GNUMAKE="$LODE_HOME/opt/bin/make"
192     elif test -x "/opt/lo/bin/make"; then
193         GNUMAKE="/opt/lo/bin/make"
194     fi
197 GNUMAKE_WIN_NATIVE=
198 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
199     if test -n "$a"; then
200         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
201         if test $? -eq 0;  then
202             if test "$build_os" = "cygwin"; then
203                 if test -n "$($a -v | grep 'Built for Windows')" ; then
204                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
205                     GNUMAKE_WIN_NATIVE="TRUE"
206                 else
207                     GNUMAKE=`which $a`
208                 fi
209             else
210                 GNUMAKE=`which $a`
211             fi
212             break
213         fi
214     fi
215 done
216 AC_MSG_RESULT($GNUMAKE)
217 if test -z "$GNUMAKE"; then
218     AC_MSG_ERROR([not found. install GNU Make.])
219 else
220     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
221         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
222     fi
225 win_short_path_for_make()
227     local_short_path="$1"
228     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
229         cygpath -sm "$local_short_path"
230     else
231         cygpath -u "$(cygpath -d "$local_short_path")"
232     fi
236 if test "$build_os" = "cygwin"; then
237     PathFormat "$SRC_ROOT"
238     SRC_ROOT="$formatted_path"
239     PathFormat "$BUILDDIR"
240     BUILDDIR="$formatted_path"
241     x_Cygwin=
244 AC_SUBST(SRC_ROOT)
245 AC_SUBST(BUILDDIR)
246 AC_SUBST(x_Cygwin)
247 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
248 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
250 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
251     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
254 # need sed in os checks...
255 AC_PATH_PROGS(SED, sed)
256 if test -z "$SED"; then
257     AC_MSG_ERROR([install sed to run this script])
260 # Set the ENABLE_LTO variable
261 # ===================================================================
262 AC_MSG_CHECKING([whether to use link-time optimization])
263 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
264     ENABLE_LTO="TRUE"
265     AC_MSG_RESULT([yes])
266     AC_DEFINE(STATIC_LINKING)
267 else
268     ENABLE_LTO=""
269     AC_MSG_RESULT([no])
271 AC_SUBST(ENABLE_LTO)
273 dnl ===================================================================
274 dnl When building for Android, --with-android-ndk,
275 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
276 dnl mandatory
277 dnl ===================================================================
279 AC_ARG_WITH(android-ndk,
280     AS_HELP_STRING([--with-android-ndk],
281         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
284 AC_ARG_WITH(android-ndk-toolchain-version,
285     AS_HELP_STRING([--with-android-ndk-toolchain-version],
286         [Specify which toolchain version to use, of those present in the
287         Android NDK you are using. The default is 4.9 currently.]), ,)
289 AC_ARG_WITH(android-sdk,
290     AS_HELP_STRING([--with-android-sdk],
291         [Specify location of the Android SDK. Mandatory when building for Android,
292         or when building the Impress Remote Android app.]),
295 ANDROID_NDK_HOME=
296 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk"; then
297     with_android_ndk="$SRC_ROOT/external/android-ndk"
299 if test -n "$with_android_ndk"; then
300     ANDROID_NDK_HOME=$with_android_ndk
302     # Set up a lot of pre-canned defaults
304     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
305         AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT file in $ANDROID_NDK_HOME.])
306     fi
307     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
309     case $ANDROID_NDK_VERSION in
310     r9*|r10*)
311         ;;
312     *)
313         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r9* and r10* versions are supported])
314         ;;
315     esac
317     if test $host_cpu = arm; then
318         android_cpu=arm
319         android_platform_prefix=$android_cpu-linux-androideabi
320     elif test $host_cpu = aarch64; then
321         android_cpu=aarch64
322         android_platform_prefix=$android_cpu-linux-android
323     elif test $host_cpu = mips; then
324         android_cpu=mips
325         android_platform_prefix=$android_cpu-linux-androideabi
326     else
327         # host_cpu is something like "i386" or "i686" I guess, NDK uses
328         # "x86" in some contexts
329         android_cpu=x86
330         android_platform_prefix=$android_cpu
331     fi
333     if test -z "$with_android_ndk_toolchain_version"; then
334         # Default to gcc 4.9
335         with_android_ndk_toolchain_version=4.9
336     fi
338     case "$with_android_ndk_toolchain_version" in
339     4.6|4.7|4.8|4.9)
340         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
341         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
342         ;;
343     clang3.3|clang3.4)
344         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
345         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
346         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
347         ANDROID_USING_CLANG=true
348         ;;
349     *)
350         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
351     esac
353     if test ! -d $ANDROID_BINUTILS_DIR; then
354         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
355     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
356         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
357     fi
359     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
360     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
361     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
362     # manage to link the (app-specific) single huge .so that is built for the app in
363     # android/source/ if there is debug information in a significant part of the object files.
364     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
365     # all objects have been built with debug information.)
366     toolchain_system='*'
367     case $build_os in
368     linux-gnu*)
369         ndk_build_os=linux
370         ;;
371     darwin*)
372         ndk_build_os=darwin
373         ;;
374     *)
375         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
376         ;;
377     esac
379     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
380     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
381     if test $build_cpu = x86_64; then
382         if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
383             ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
384         fi
385         if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
386             ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
387         fi
388     fi
389     ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
391     # This stays empty if there is just one version of the toolchain in the NDK
392     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
393     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
394     */bin\ */bin*)
395         # Trailing slash intentional and necessary, compare to how this is used
396         if test -n "$ANDROID_USING_CLANG"; then
397             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
398         else
399             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
400         fi
401         ;;
402     esac
404     ANDROID_API_LEVEL=15
405     if test $host_cpu = arm; then
406         android_gnu_prefix=arm-linux-androideabi
407     elif test $host_cpu = aarch64; then
408         android_gnu_prefix=aarch64-linux-android
409         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
410         ANDROID_API_LEVEL=L
411     elif test $host_cpu = mips; then
412         android_gnu_prefix=mipsel-linux-android
413     elif test $ANDROID_NDK_VERSION = r8; then
414         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
415         android_gnu_prefix=i686-android-linux
416     else
417         android_gnu_prefix=i686-linux-android
418     fi
420     ANDROID_ARCH=$android_cpu
421     if test $host_cpu = arm; then
422         ANDROID_APP_ABI=armeabi-v7a
423         if test -n "$ANDROID_USING_CLANG"; then
424             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
425             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
426             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
427         else
428             :
429         fi
430         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
431         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
432         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
433     elif test $host_cpu = aarch64; then
434         ANDROID_APP_ABI=arm64-v8a
435         ANDROID_ARCH=arm64
436     elif test $host_cpu = mips; then
437         ANDROID_APP_ABI=mips
438         ANDROIDCFLAGS=""
439     else # x86
440         ANDROID_APP_ABI=x86
441         ANDROIDCFLAGS="-march=atom"
442     fi
443     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
444     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
445     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
447     if test -n "$ANDROID_USING_CLANG"; then
448         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
449     else
450         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
451     fi
453     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
454     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
455     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
456     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
457     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
458     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
460     # When using the 4.6 or newer toolchain, use the gold linker
461     case "$with_android_ndk_toolchain_version" in
462     4.[[6789]]*|[[56789]].*|clang*)
463         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
464             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
465         fi
466         ;;
467     esac
469     if test "$ENABLE_LTO" = TRUE; then
470         # -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of
471         # $CC and $CXX when building external libraries
472         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
473     fi
475     # gdbserver can be in different locations
476     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
477         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
478     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
479         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
480     elif test $android_cpu = aarch64; then
481         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
482     else
483         AC_MSG_ERROR([Can't find gdbserver for your Android target])
484     fi
486     if test $host_cpu = arm; then
487         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"
488     elif test $host_cpu = mips; then
489         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"
490     else # x86
491         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"
492     fi
494     if test -z "$CC"; then
495         case "$with_android_ndk_toolchain_version" in
496         4.*)
497             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
498             ;;
499         clang*)
500             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
501         esac
502     fi
503     if test -z "$CXX"; then
504         case "$with_android_ndk_toolchain_version" in
505         4.*)
506             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
507             ;;
508         clang*)
509             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
510             ;;
511         esac
512     fi
514     # remember to download the ownCloud Android library later
515     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
517 AC_SUBST(ANDROID_NDK_GDBSERVER)
518 AC_SUBST(ANDROID_APP_ABI)
520 dnl ===================================================================
521 dnl --with-android-sdk
522 dnl ===================================================================
523 ANDROID_SDK_HOME=
524 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux"; then
525     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
527 if test -n "$with_android_sdk"; then
528     ANDROID_SDK_HOME=$with_android_sdk
529     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
531 AC_SUBST(ANDROID_SDK_HOME)
533 dnl ===================================================================
534 dnl The following is a list of supported systems.
535 dnl Sequential to keep the logic very simple
536 dnl These values may be checked and reset later.
537 dnl ===================================================================
538 #defaults unless the os test overrides this:
539 test_randr=yes
540 test_xrender=yes
541 test_cups=yes
542 test_dbus=yes
543 test_fontconfig=yes
544 test_cairo=no
546 # Default values, as such probably valid just for Linux, set
547 # differently below just for Mac OSX,but at least better than
548 # hardcoding these as we used to do. Much of this is duplicated also
549 # in solenv for old build system and for gbuild, ideally we should
550 # perhaps define stuff like this only here in configure.ac?
552 LINKFLAGSSHL="-shared"
553 PICSWITCH="-fpic"
554 DLLPOST=".so"
556 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
558 INSTROOTSUFFIX=
559 SDKDIRNAME=sdk
561 case "$host_os" in
563 solaris*)
564     test_gtk=yes
565     build_gstreamer_1_0=yes
566     build_gstreamer_0_10=yes
567     test_tde=yes
568     test_kde=yes
569     test_freetype=yes
570     _os=SunOS
572     dnl ===========================================================
573     dnl Check whether we're using Solaris 10 - SPARC or Intel.
574     dnl ===========================================================
575     AC_MSG_CHECKING([the Solaris operating system release])
576     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
577     if test "$_os_release" -lt "10"; then
578         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
579     else
580         AC_MSG_RESULT([ok ($_os_release)])
581     fi
583     dnl Check whether we're using a SPARC or i386 processor
584     AC_MSG_CHECKING([the processor type])
585     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
586         AC_MSG_RESULT([ok ($host_cpu)])
587     else
588         AC_MSG_ERROR([only SPARC and i386 processors are supported])
589     fi
590     ;;
592 linux-gnu*|k*bsd*-gnu*)
593     test_gtk=yes
594     build_gstreamer_1_0=yes
595     build_gstreamer_0_10=yes
596     test_tde=yes
597     test_kde=yes
598     test_kde4=yes
599     test_freetype=yes
600     _os=Linux
601     ;;
603 gnu)
604     test_randr=no
605     test_xrender=no
606     _os=GNU
607      ;;
609 cygwin*|interix*|mingw32*)
611     # When building on Windows normally with MSVC under Cygwin,
612     # configure thinks that the host platform (the platform the
613     # built code will run on) is Cygwin, even if it obviously is
614     # Windows, which in Autoconf terminology is called
615     # "mingw32". (Which is misleading as MinGW is the name of the
616     # tool-chain, not an operating system.)
618     # Somewhat confusing, yes. But this configure script doesn't
619     # look at $host etc that much, it mostly uses its own $_os
620     # variable, set here in this case statement.
622     # When cross-compiling to Windows from Unix, the host platform
623     # is "mingw32" (because in that case it is the MinGW
624     # tool-chain that is used).
626     test_cups=no
627     test_dbus=no
628     test_randr=no
629     test_xrender=no
630     test_freetype=no
631     test_fontconfig=no
632     _os=WINNT
634     DLLPOST=".dll"
635     LINKFLAGSNOUNDEFS=
637     # If the host OS matches "mingw32*", that means we are using the
638     # MinGW cross-compiler, because we don't see the point in building
639     # LibreOffice using MinGW on Windows. If you want to build on
640     # Windows, use MSVC. If you want to use MinGW, surely you want to
641     # cross-compile (from Linux or some other Unix).
643     case "$host_os" in
644     mingw32*)
645         WITH_MINGW=yes
646         if test -z "$CC"; then
647             CC="$host_cpu-$host_vendor-$host_os-gcc"
648         fi
649         if test -z "$CXX"; then
650             CXX="$host_cpu-$host_vendor-$host_os-g++"
651         fi
652         ;;
653     esac
654     ;;
656 darwin*) # Mac OS X or iOS
657     test_gtk=yes
658     test_randr=no
659     test_xrender=no
660     test_freetype=no
661     test_fontconfig=no
662     test_dbus=no
663     if test "$host_cpu" = "arm"; then
664         _os=iOS
665         test_gtk=no
666         test_cups=no
667     else
668         _os=Darwin
669         ONEWORDPRODUCTNAME=`echo "${PRODUCTNAME// /}"`
670         INSTROOTSUFFIX=/$ONEWORDPRODUCTNAME.app/Contents
671         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
672     fi
673     enable_systray=no
674     # See comment above the case "$host_os"
675     LINKFLAGSSHL="-dynamiclib -single_module"
677     # -fPIC is default
678     PICSWITCH=""
680     DLLPOST=".dylib"
682     # -undefined error is the default
683     LINKFLAGSNOUNDEFS=""
686 freebsd*)
687     test_gtk=yes
688     build_gstreamer_1_0=yes
689     build_gstreamer_0_10=yes
690     test_tde=yes
691     test_kde=yes
692     test_kde4=yes
693     test_freetype=yes
694     AC_MSG_CHECKING([the FreeBSD operating system release])
695     if test -n "$with_os_version"; then
696         OSVERSION="$with_os_version"
697     else
698         OSVERSION=`/sbin/sysctl -n kern.osreldate`
699     fi
700     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
701     AC_MSG_CHECKING([which thread library to use])
702     if test "$OSVERSION" -lt "500016"; then
703         PTHREAD_CFLAGS="-D_THREAD_SAFE"
704         PTHREAD_LIBS="-pthread"
705     elif test "$OSVERSION" -lt "502102"; then
706         PTHREAD_CFLAGS="-D_THREAD_SAFE"
707         PTHREAD_LIBS="-lc_r"
708     else
709         PTHREAD_CFLAGS=""
710         PTHREAD_LIBS="-pthread"
711     fi
712     AC_MSG_RESULT([$PTHREAD_LIBS])
713     _os=FreeBSD
714     ;;
716 *netbsd*)
717     test_gtk=yes
718     build_gstreamer_1_0=yes
719     build_gstreamer_0_10=yes
720     test_tde=no
721     test_kde=no
722     test_kde4=yes
723     test_freetype=yes
724     PTHREAD_LIBS="-pthread -lpthread"
725     _os=NetBSD
726     ;;
728 aix*)
729     test_randr=no
730     test_freetype=yes
731     PTHREAD_LIBS=-pthread
732     _os=AIX
733     ;;
735 openbsd*)
736     test_gtk=yes
737     test_tde=yes
738     test_kde=yes
739     test_freetype=yes
740     PTHREAD_CFLAGS="-D_THREAD_SAFE"
741     PTHREAD_LIBS="-pthread"
742     _os=OpenBSD
743     ;;
745 dragonfly*)
746     test_gtk=yes
747     build_gstreamer_1_0=yes
748     build_gstreamer_0_10=yes
749     test_tde=yes
750     test_kde=yes
751     test_kde4=yes
752     test_freetype=yes
753     PTHREAD_LIBS="-pthread"
754     _os=DragonFly
755     ;;
757 linux-android*)
758     build_gstreamer_1_0=no
759     build_gstreamer_0_10=no
760     enable_lotuswordpro=no
761     enable_mpl_subset=yes
762     enable_coinmp=yes
763     enable_lpsolve=no
764     enable_report_builder=no
765     with_theme="tango"
766     test_cups=no
767     test_dbus=no
768     test_fontconfig=no
769     test_freetype=no
770     test_gtk=no
771     test_tde=no
772     test_kde=no
773     test_kde4=no
774     test_randr=no
775     test_xrender=no
776     _os=Android
778     if test -z "$with_android_ndk"; then
779         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
780     fi
782     if test -z "$with_android_ndk_toolchain_version"; then
783         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
784     fi
786     # Verify that the NDK and SDK options are proper
787     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
788         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
789     fi
791     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
792     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
793     ;;
796     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
797     ;;
798 esac
800 if echo "$host_os" | grep -q linux-android ; then
801     if test -z "$with_android_sdk"; then
802         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
803     fi
805     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
806         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
807     fi
809     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
810     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
811         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
812                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
813                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
814         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
815         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
816         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
817     fi
818     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
819         AC_MSG_WARN([android support repository not found - install with
820                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
821                      to allow the build to download the specified version of the android support libraries])
822         add_warning "android support repository not found - install with"
823         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
824         add_warning "to allow the build to download the specified version of the android support libraries"
825     fi
828 if test "$_os" = "AIX"; then
829     AC_PATH_PROG(GAWK, gawk)
830     if test -z "$GAWK"; then
831         AC_MSG_ERROR([gawk not found in \$PATH])
832     fi
835 AC_SUBST(SDKDIRNAME)
837 AC_SUBST(WITH_MINGW)
838 AC_SUBST(PTHREAD_CFLAGS)
839 AC_SUBST(PTHREAD_LIBS)
841 ###############################################################################
842 # Extensions switches --enable/--disable
843 ###############################################################################
844 # By default these should be enabled unless having extra dependencies.
845 # If there is extra dependency over configure options then the enable should
846 # be automagic based on whether the requiring feature is enabled or not.
847 # All this options change anything only with --enable-extension-integration.
849 # The name of this option and its help string makes it sound as if
850 # extensions are built anyway, just not integrated in the installer,
851 # if you use --disable-extension-integration. Is that really the
852 # case?
854 AC_ARG_ENABLE(extension-integration,
855     AS_HELP_STRING([--disable-extension-integration],
856         [Disable integration of the built extensions in the installer of the
857          product. Use this switch to disable the integration.])
860 AC_ARG_ENABLE(export,
861     AS_HELP_STRING([--disable-export],
862         [Disable (some) code for document export. Useful when building viewer-only apps that lack
863          save/export functionality, to avoid having an excessive amount of code and data used
864          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
867 AC_ARG_ENABLE(avmedia,
868     AS_HELP_STRING([--disable-avmedia],
869         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
872 AC_ARG_ENABLE(database-connectivity,
873     AS_HELP_STRING([--disable-database-connectivity],
874         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
877 # This doesn't mean not building (or "integrating") extensions
878 # (although it probably should; i.e. it should imply
879 # --disable-extension-integration I guess), it means not supporting
880 # any extension mechanism at all
881 AC_ARG_ENABLE(extensions,
882     AS_HELP_STRING([--disable-extensions],
883         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
886 AC_ARG_ENABLE(scripting,
887     AS_HELP_STRING([--disable-scripting],
888         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
891 # This is mainly for Android and iOS, but could potentially be used in some
892 # special case otherwise, too, so factored out as a separate setting
894 AC_ARG_ENABLE(dynamic-loading,
895     AS_HELP_STRING([--disable-dynamic-loading],
896         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
899 AC_ARG_ENABLE(ext-mariadb-connector,
900     AS_HELP_STRING([--enable-ext-mariadb-connector],
901         [Enable the build of the MariaDB/MySQL Connector extension.])
904 AC_ARG_ENABLE(report-builder,
905     AS_HELP_STRING([--disable-report-builder],
906         [Disable the Report Builder.])
909 AC_ARG_ENABLE(ext-wiki-publisher,
910     AS_HELP_STRING([--enable-ext-wiki-publisher],
911         [Enable the Wiki Publisher extension.])
914 AC_ARG_ENABLE(lpsolve,
915     AS_HELP_STRING([--disable-lpsolve],
916         [Disable compilation of the lp solve solver ])
918 AC_ARG_ENABLE(coinmp,
919     AS_HELP_STRING([--disable-coinmp],
920         [Disable compilation of the CoinMP solver ])
923 AC_ARG_ENABLE(pdfimport,
924     AS_HELP_STRING([--disable-pdfimport],
925         [Disable building the PDF import feature.])
928 ###############################################################################
930 dnl ---------- *** ----------
932 AC_ARG_ENABLE([hardlink-deliver],
933     AS_HELP_STRING([--enable-hardlink-deliver],
934         [Put files into deliver folder as hardlinks instead of copying them
935         over. Saves space and speeds up build.])
938 AC_ARG_ENABLE(mergelibs,
939     AS_HELP_STRING([--enable-mergelibs],
940         [Enables linking of big, merged, library. Experimental feature, tested
941         only for Linux at some stage in history, but possibly does not work even
942         for Linux any more. This will link a core set of libraries into libmerged.])
945 AC_ARG_ENABLE(graphite,
946     AS_HELP_STRING([--enable-graphite],
947         [Enables the compilation of Graphite smart font rendering.])
950 AC_ARG_ENABLE(orcus,
951     AS_HELP_STRING([--enable-orcus],
952         [Enables orcus for extra file import filters for Calc.])
955 AC_ARG_ENABLE(fetch-external,
956     AS_HELP_STRING([--disable-fetch-external],
957         [Disables fetching external tarballs from web sources.])
960 AC_ARG_ENABLE(lockdown,
961     AS_HELP_STRING([--disable-lockdown],
962         [Disables the gconf integration work in LibreOffice.]),
965 AC_ARG_ENABLE(pch,
966     AS_HELP_STRING([--enable-pch],
967         [Enables precompiled header support for C++.])
970 AC_ARG_ENABLE(win-mozab-driver,
971     AS_HELP_STRING([--enable-win-mozab-driver],
972         [LibreOffice includes a driver to connect to Mozilla
973          address books under Windows, to build with this version, use this option.])
976 AC_ARG_ENABLE(epm,
977     AS_HELP_STRING([--enable-epm],
978         [LibreOffice includes self-packaging code, that requires epm, however epm is
979          useless for large scale package building.])
982 AC_ARG_ENABLE(odk,
983     AS_HELP_STRING([--disable-odk],
984         [LibreOffice includes an ODK, office development kit which some packagers may
985          wish to build without.])
988 AC_ARG_ENABLE(mpl-subset,
989     AS_HELP_STRING([--enable-mpl-subset],
990         [Don't compile any pieces which are not MPL or more liberally licensed])
993 AC_ARG_ENABLE(evolution2,
994     AS_HELP_STRING([--enable-evolution2],
995         [Allows the built-in evolution 2 addressbook connectivity build to be
996          enabled.])
999 AC_ARG_ENABLE(directx,
1000     AS_HELP_STRING([--disable-directx],
1001         [Remove DirectX implementation for the new XCanvas interface.
1002          The DirectX support requires more stuff installed on Windows to
1003          compile. (DirectX SDK, GDI+ libs)])
1006 AC_ARG_ENABLE(activex,
1007     AS_HELP_STRING([--disable-activex],
1008         [Disable the use of ActiveX for a Windows build.
1009         This switch is mandatory when using an Express edition of Visual Studio.])
1012 AC_ARG_ENABLE(atl,
1013     AS_HELP_STRING([--disable-atl],
1014         [Disable the use of ATL for a Windows build.])
1015     [
1016         This switch is mandatory when using an Express edition of Visual Studio.
1017     ],
1020 AC_ARG_ENABLE(avahi,
1021     AS_HELP_STRING([--enable-avahi],
1022         [Determines whether to use Avahi to advertise Impress to remote controls.]),
1025 AC_ARG_ENABLE(werror,
1026     AS_HELP_STRING([--enable-werror],
1027         [Turn warnings to errors. (Has no effect in modules where the treating
1028          of warnings as errors is disabled explicitly.)]),
1031 AC_ARG_ENABLE(assert-always-abort,
1032     AS_HELP_STRING([--enable-assert-always-abort],
1033         [make assert() abort even in release code.]),
1036 AC_ARG_ENABLE(dbgutil,
1037     AS_HELP_STRING([--enable-dbgutil],
1038         [Provide debugging support from --enable-debug and include additional debugging
1039          utilities such as object counting or more expensive checks.
1040          This is the recommended option for developers.
1041          Note that this makes the build ABI incompatible, it is not possible to mix object
1042          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1044 AC_ARG_ENABLE(debug,
1045     AS_HELP_STRING([--enable-debug],
1046         [Include debugging information, disable compiler optimization and inlining plus
1047          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1049 AC_ARG_ENABLE(sal-log,
1050     AS_HELP_STRING([--enable-sal-log],
1051         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1053 AC_ARG_ENABLE(selective-debuginfo,
1054     AS_HELP_STRING([--enable-selective-debuginfo],
1055         [If --enable-debug or --enable-dbgutil is used, build debugging information
1056          (-g compiler flag) only for the specified gbuild build targets
1057          (where all means everything, - prepended means not to enable, / appended means
1058          everything in the directory; there is no ordering, more specific overrides
1059          more general, and disabling takes precedence).
1060          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1062 AC_ARG_ENABLE(symbols,
1063     AS_HELP_STRING([--enable-symbols],
1064         [Include debugging symbols in output while preserve optimization.
1065          This enables -g compiler flag for GCC or equivalent,
1066          without changing anything else compared to productive code.]))
1068 AC_ARG_ENABLE(runtime-optimizations,
1069     AS_HELP_STRING([--disable-runtime-optimizations],
1070         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1071          JVM JIT) that are known to interact badly with certain dynamic analysis
1072          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1073          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1074          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1076 AC_ARG_ENABLE(compiler-plugins,
1077     AS_HELP_STRING([--enable-compiler-plugins],
1078         [Enable compiler plugins that will perform additional checks during
1079          building. Enabled automatically by --enable-dbgutil.]))
1081 AC_ARG_ENABLE(ooenv,
1082     AS_HELP_STRING([--disable-ooenv],
1083         [Disable ooenv for the instdir installation.]))
1085 AC_ARG_ENABLE(lto,
1086     AS_HELP_STRING([--enable-lto],
1087         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1088          longer but libraries and executables are optimized for speed. (For GCC, best to use GCC 4.6
1089          or later and 'gold' linker. Works fine (and is turned on automatically in an optimising
1090          build) for MSVC, otherwise experimental work in progress that shouldn't be used unless you
1091          are working on it.)]))
1093 AC_ARG_ENABLE(crashdump,
1094     AS_HELP_STRING([--enable-crashdump],
1095         [Enable the crashdump feature.]))
1097 AC_ARG_ENABLE(python,
1098     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1099         [Enables or disables Python support at run-time and build-time.
1100          Also specifies what Python to use. 'auto' is the default.
1101          'fully-internal' even forces the internal version for uses of Python
1102          during the build.]))
1104 AC_ARG_ENABLE(gtk,
1105     AS_HELP_STRING([--disable-gtk],
1106         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1107 ,enable_gtk=yes)
1109 AC_ARG_ENABLE(gtk3,
1110     AS_HELP_STRING([--enable-gtk3],
1111         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1112          This is experimental and may not work.]),
1113 ,enable_gtk3=no)
1115 AC_ARG_ENABLE(systray,
1116     AS_HELP_STRING([--disable-systray],
1117         [Determines whether to build the systray quickstarter.]),
1118 ,enable_systray=yes)
1120 AC_ARG_ENABLE(split-app-modules,
1121     AS_HELP_STRING([--enable-split-app-modules],
1122         [Split file lists for app modules, e.g. base, calc.
1123          Has effect only with make distro-pack-install]),
1126 AC_ARG_ENABLE(split-opt-features,
1127     AS_HELP_STRING([--enable-split-opt-features],
1128         [Split file lists for some optional features, .e.g. pyuno, testtool.
1129          Has effect only with make distro-pack-install]),
1132 AC_ARG_ENABLE(cairo-canvas,
1133 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
1134                           platforms where Cairo is available.
1137 AC_ARG_ENABLE(dbus,
1138     AS_HELP_STRING([--disable-dbus],
1139         [Determines whether to enable features that depend on dbus.
1140          e.g. Presentation mode screensaver control, bluetooth presentation control]),
1141 ,enable_dbus=yes)
1143 AC_ARG_ENABLE(packagekit,
1144     AS_HELP_STRING([--enable-packagekit],
1145         [Determines whether to enable features using packagekit.
1146          Right now that is auto font install]),
1149 AC_ARG_ENABLE(sdremote,
1150     AS_HELP_STRING([--disable-sdremote],
1151         [Determines whether to enable Impress remote control (i.e. the server component).]),
1152 ,enable_sdremote=yes)
1154 AC_ARG_ENABLE(sdremote-bluetooth,
1155     AS_HELP_STRING([--disable-sdremote-bluetooth],
1156         [Determines whether to build sdremote with bluetooth support.
1157          Requires dbus on Linux.]))
1159 AC_ARG_ENABLE(gconf,
1160     AS_HELP_STRING([--disable-gconf],
1161         [Determines whether to use the GConf support.]),
1162 ,enable_gconf=yes)
1164 AC_ARG_ENABLE(gnome-vfs,
1165     AS_HELP_STRING([--enable-gnome-vfs],
1166         [Determines whether to use the Gnome Virtual Filing System on platforms
1167          where that VFS is available.]),
1168 ,enable_gnome_vfs=no)
1170 AC_ARG_ENABLE(gio,
1171     AS_HELP_STRING([--disable-gio],
1172         [Determines whether to use the GIO support.]),
1173 ,enable_gio=yes)
1175 AC_ARG_ENABLE(telepathy,
1176     AS_HELP_STRING([--enable-telepathy],
1177         [Determines whether to enable Telepathy for collaboration.]),
1178 ,enable_telepathy=no)
1180 AC_ARG_ENABLE(tde,
1181     AS_HELP_STRING([--enable-tde],
1182         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1183          TDE are available.]),
1186 AC_ARG_ENABLE(tdeab,
1187     AS_HELP_STRING([--disable-tdeab],
1188         [Disable the TDE address book support.]),
1190     if test "$enable_tde" = "yes"; then
1191         enable_tdeab=yes
1192     fi
1195 AC_ARG_ENABLE(kde,
1196     AS_HELP_STRING([--enable-kde],
1197         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
1198          KDE3 are available.]),
1201 AC_ARG_ENABLE(kdeab,
1202     AS_HELP_STRING([--disable-kdeab],
1203         [Disable the KDE3 address book support.]),
1205     if test "$enable_kde" = "yes"; then
1206         enable_kdeab=yes
1207     fi
1210 AC_ARG_ENABLE(kde4,
1211     AS_HELP_STRING([--enable-kde4],
1212         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1213          KDE4 are available. May be used with --enable-kde if you want to support
1214          both KDE3 and KDE4.]),
1217 AC_ARG_ENABLE(randr,
1218     AS_HELP_STRING([--disable-randr],
1219         [Disable RandR support in the vcl project.]),
1220 ,enable_randr=yes)
1222 AC_ARG_ENABLE(randr-link,
1223     AS_HELP_STRING([--disable-randr-link],
1224         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1225 ,enable_randr_link=yes)
1227 AC_ARG_ENABLE(gstreamer-1-0,
1228     AS_HELP_STRING([--disable-gstreamer-1-0],
1229         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1230 ,enable_gstreamer_1_0=yes)
1232 AC_ARG_ENABLE(gstreamer-0-10,
1233     AS_HELP_STRING([--enable-gstreamer-0-10],
1234         [Enable building with the gstreamer 0.10 avmedia backend.]),
1235 ,enable_gstreamer_0_10=no)
1237 AC_ARG_ENABLE(vlc,
1238     AS_HELP_STRING([--enable-vlc],
1239         [Enable building with the (experimental) VLC avmedia backend.]),
1240 ,enable_vlc=no)
1242 AC_ARG_ENABLE(neon,
1243     AS_HELP_STRING([--disable-neon],
1244         [Disable neon and the compilation of webdav binding.]),
1247 AC_ARG_ENABLE([eot],
1248     [AS_HELP_STRING([--enable-eot],
1249         [Enable support for Embedded OpenType fonts.])],
1250 , [enable_eot=no])
1252 AC_ARG_ENABLE(cve-tests,
1253     AS_HELP_STRING([--disable-cve-tests],
1254         [Prevent CVE tests to be executed]),
1257 AC_ARG_ENABLE(chart-tests,
1258     AS_HELP_STRING([--enable-chart-tests],
1259         [Executes chart XShape tests. In a perfect world these tests would be
1260          stable and everyone could run them, in reality it is best to run them
1261          only on a few machines that are known to work and maintained by people
1262          who can judge if a test failure is a regression or not.]),
1265 AC_ARG_ENABLE(build-unowinreg,
1266     AS_HELP_STRING([--enable-build-unowinreg],
1267         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1268          compiler is needed on Linux.])
1269     [
1270                           Usage:     --enable-build-unowinreg
1271     ],
1274 AC_ARG_ENABLE(verbose,
1275     AS_HELP_STRING([--enable-verbose],
1276         [Increase build verbosity.])[
1277   --disable-verbose       Decrease build verbosity.],
1280 AC_ARG_ENABLE(dependency-tracking,
1281     AS_HELP_STRING([--enable-dependency-tracking],
1282         [Do not reject slow dependency extractors.])[
1283   --disable-dependency-tracking
1284                           Disables generation of dependency information.
1285                           Speed up one-time builds.],
1288 AC_ARG_ENABLE(icecream,
1289     AS_HELP_STRING([--enable-icecream],
1290         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1291          It defaults to /opt/icecream for the location of the icecream gcc/g++
1292          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1295 AC_ARG_ENABLE(cups,
1296     AS_HELP_STRING([--disable-cups],
1297         [Do not build cups support.])
1300 AC_ARG_ENABLE(ccache,
1301     AS_HELP_STRING([--disable-ccache],
1302         [Do not try to use ccache automatically.
1303          By default, we will try to detect if ccache is available; in that case if
1304          CC/CXX are not yet set, and --enable-icecream is not given, we
1305          attempt to use ccache. --disable-ccache disables ccache completely.
1309 AC_ARG_ENABLE(64-bit,
1310     AS_HELP_STRING([--enable-64-bit],
1311         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1312          At the moment meaningful only for iOS and Windows. On Windows this option is
1313          experimental and possibly quite broken, and you should use it only if you are
1314          hacking on 64-bitness support.]), ,)
1316 AC_ARG_ENABLE(extra-gallery,
1317     AS_HELP_STRING([--enable-extra-gallery],
1318         [Add extra gallery content.]),
1321 AC_ARG_ENABLE(extra-template,
1322     AS_HELP_STRING([--enable-extra-template],
1323         [Add extra template content.]),
1326 AC_ARG_ENABLE(extra-sample,
1327     AS_HELP_STRING([--enable-extra-sample],
1328         [Add extra sample content.]),
1331 AC_ARG_ENABLE(extra-font,
1332     AS_HELP_STRING([--enable-extra-font],
1333         [Add extra font content.]),
1336 AC_ARG_ENABLE(online-update,
1337     AS_HELP_STRING([--enable-online-update],
1338         [Enable the online update service that will check for new versions of
1339          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.]),
1342 AC_ARG_ENABLE(extension-update,
1343     AS_HELP_STRING([--disable-extension-update],
1344         [Disable possibility to update installed extensions.]),
1347 AC_ARG_ENABLE(release-build,
1348     AS_HELP_STRING([--enable-release-build],
1349         [Enable release build.
1350          See http://wiki.documentfoundation.org/DevBuild]),
1353 AC_ARG_ENABLE(windows-build-signing,
1354     AS_HELP_STRING([--enable-windows-build-signing],
1355         [Enable signing of windows binaries (*.exe, *.dll)]),
1358 AC_ARG_ENABLE(silent-msi,
1359     AS_HELP_STRING([--enable-silent-msi],
1360         [Enable MSI with LIMITUI=1 (silent install).]),
1363 AC_ARG_ENABLE(macosx-code-signing,
1364     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1365         [Sign executables, dylibs, frameworks and the app bundle. If you
1366          don't provide an identity the first suitable certificate
1367          in your keychain is used.]),
1370 AC_ARG_ENABLE(macosx-package-signing,
1371     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1372         [Create a .pkg suitable for uploading to the Mac App Store and sign
1373          it. If you don't provide an identity the first suitable certificate
1374          in your keychain is used.]),
1377 AC_ARG_ENABLE(macosx-sandbox,
1378     AS_HELP_STRING([--enable-macosx-sandbox],
1379         [Make the app bundle run in a sandbox. Requires code signing.
1380          Is required by apps distributed in the Mac App Store, and implies
1381          adherence to App Store rules.]),
1384 AC_ARG_WITH(macosx-bundle-identifier,
1385     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1386         [Define the OS X bundle identifier. Default is the somewhat weird
1387          org.libreoffice.script ("script", huh?).]),
1388 ,with_macosx_bundle_identifier=org.libreoffice.script)
1390 AC_ARG_WITH(macosx-app-name,
1391     AS_HELP_STRING([--with-macosx-app-name='My Own Office Suite'],
1392         [Define the OS X app name. Default is AC_PACKAGE_NAME.]),
1393 ,with_macosx_app_name=$PRODUCTNAME)
1395 AC_ARG_ENABLE(ios-simulator,
1396     AS_HELP_STRING([--enable-ios-simulator],
1397         [Build for the iOS Simulator, not iOS device.]),
1400 AC_ARG_ENABLE(readonly-installset,
1401     AS_HELP_STRING([--enable-readonly-installset],
1402         [Prevents any attempts by LibreOffice to write into its installation. That means
1403          at least that no "system-wide" extensions can be added. Experimental work in
1404          progress.]),
1407 AC_ARG_ENABLE(postgresql-sdbc,
1408     AS_HELP_STRING([--disable-postgresql-sdbc],
1409         [Disable the build of the PostgreSQL-SDBC driver.])
1412 AC_ARG_ENABLE(lotuswordpro,
1413     AS_HELP_STRING([--disable-lotuswordpro],
1414         [Disable the build of the Lotus Word Pro filter.]),
1415 ,enable_lotuswordpro=yes)
1417 AC_ARG_ENABLE(firebird-sdbc,
1418     AS_HELP_STRING([--disable-firebird-sdbc],
1419         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1420 ,enable_firebird_sdbc=yes)
1422 AC_ARG_ENABLE(winegcc,
1423     AS_HELP_STRING([--enable-winegcc],
1424         [Enable use of winegcc during the build, in order to create msi* tools
1425          needed for MinGW cross-compilation.]),
1428 AC_ARG_ENABLE(liblangtag,
1429     AS_HELP_STRING([--disable-liblangtag],
1430         [Disable use of liblangtag, and instead use an own simple
1431          implementation.]),
1434 AC_ARG_ENABLE(bogus-pkg-config,
1435     AS_HELP_STRING([--enable-bogus-pkg-config],
1436         [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.]),
1439 AC_ARG_ENABLE(openssl,
1440     AS_HELP_STRING([--disable-openssl],
1441         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1442          components will either use GNUTLS or NSS. Work in progress,
1443          use only if you are hacking on it.]),
1444 ,enable_openssl=yes)
1446 AC_ARG_ENABLE(library-bin-tar,
1447     AS_HELP_STRING([--enable-library-bin-tar],
1448         [Enable the building and reused of tarball of binary build for some 'external' libraries
1449         Some libraries can save their build result in a tarball
1450         stored in TARFILE_LOCATION. that binary tarball is
1451         uniquely identified by the source tarbal,
1452         the content of the config_host.mk file and the content
1453         of the top-level directory in core for that library
1454         If this option is enabled, then if such a tarfile exist, it will be untarred
1455         instead of the source tarfile, and the build step will be skipped for that
1456         library.
1457         If a proper tarfile does not exist, then the normal source-based
1458         build is done for that library and a proper binary tarfile is created
1459         for the next time.]),
1462 AC_ARG_ENABLE(gltf,
1463     AS_HELP_STRING([--disable-gltf],
1464         [Determines whether to build libraries related to glTF 3D model rendering.]))
1466 AC_ARG_ENABLE(collada,
1467     AS_HELP_STRING([--disable-collada],
1468         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1470 dnl ===================================================================
1471 dnl Optional Packages (--with/without-)
1472 dnl ===================================================================
1474 AC_ARG_WITH(gnu-patch,
1475     AS_HELP_STRING([--with-gnu-patch],
1476         [Specify location of GNU patch on Solaris or FreeBSD.]),
1479 AC_ARG_WITH(build-platform-configure-options,
1480     AS_HELP_STRING([--with-build-platform-configure-options],
1481         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1484 AC_ARG_WITH(gnu-cp,
1485     AS_HELP_STRING([--with-gnu-cp],
1486         [Specify location of GNU cp on Solaris or FreeBSD.]),
1489 AC_ARG_WITH(external-tar,
1490     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1491         [Specify an absolute path of where to find (and store) tarfiles.]),
1492     TARFILE_LOCATION=$withval ,
1495 AC_ARG_WITH(referenced-git,
1496     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1497         [Specify another checkout directory to reference. This makes use of
1498                  git submodule update --reference, and saves a lot of diskspace
1499                  when having multiple trees side-by-side.]),
1500     GIT_REFERENCE_SRC=$withval ,
1503 AC_ARG_WITH(linked-git,
1504     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1505         [Specify a directory where the repositories of submodules are located.
1506          This uses a method similar to git-new-workdir to get submodules.]),
1507     GIT_LINK_SRC=$withval ,
1510 AC_ARG_WITH(galleries,
1511     AS_HELP_STRING([--with-galleries],
1512         [Specify how galleries should be built. It is possible either to
1513          build these internally from source ("build"),
1514          or to disable them ("no")]),
1517 AC_ARG_WITH(theme,
1518     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1519         [Choose which themes to include. By default those themes with an '*' are included.
1520          Possible choices: *breeze, crystal, *galaxy, *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1523 AC_ARG_WITH(helppack-integration,
1525   --without-helppack-integration      It will not integrate the helppacks to the installer
1526                           of the product.
1527                           Please use this switch to use the online help or separate help packages.],
1530 AC_ARG_WITH(fonts,
1531     AS_HELP_STRING([--without-fonts],
1532         [LibreOffice includes some third-party fonts to provide a reliable basis for
1533          help content, templates, samples, etc. When these fonts are already
1534          known to be available on the system then you should use this option.]),
1537 AC_ARG_WITH(epm,
1538     AS_HELP_STRING([--with-epm],
1539         [Decides which epm to use. Default is to use the one from the system if
1540          one is built. When either this is not there or you say =internal epm
1541          will be built.]),
1544 AC_ARG_WITH(package-format,
1545     AS_HELP_STRING([--with-package-format],
1546         [Specify package format(s) for LibreOffice installation sets. The
1547          implicit --without-package-format leads to no installation sets being
1548          generated. Possible values: aix, archive, bsd, deb, dmg,
1549          installed, msi, pkg, and rpm.
1550          Example: --with-package-format='deb rpm']),
1553 AC_ARG_WITH(tls,
1554     AS_HELP_STRING([--with-tls],
1555         [Decides which TLS/SSL and cryptographic implementations to use for
1556          LibreOffice's code. Notice that this doesn't apply for depending
1557          libraries like "neon", for example. Default is to use OpenSSL
1558          although NSS is also possible. Notice that selecting NSS restricts
1559          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1560          restrict by now the usage of NSS in LO's code. Possible values:
1561          openssl, nss. Example: --with-tls="nss"]),
1564 AC_ARG_WITH(system-libs,
1565     AS_HELP_STRING([--with-system-libs],
1566         [Use libraries already on system -- enables all --with-system-* flags.]),
1569 AC_ARG_WITH(system-headers,
1570     AS_HELP_STRING([--with-system-headers],
1571         [Use headers already on system -- enables all --with-system-* flags for
1572          external packages whose headers are the only entities used i.e.
1573          boost/vigra/odbc/sane-header(s).]),,
1574     [with_system_headers="$with_system_libs"])
1576 AC_ARG_WITH(system-jars,
1577     AS_HELP_STRING([--without-system-jars],
1578         [When building with --with-system-libs, also the needed jars are expected
1579          on the system. Use this to disable that]),,
1580     [with_system_jars="$with_system_libs"])
1582 AC_ARG_WITH(system-cairo,
1583     AS_HELP_STRING([--with-system-cairo],
1584         [Use cairo libraries already on system.  Happens automatically for
1585          (implicit) --enable-gtk and for --enable-gtk3.]))
1587 AC_ARG_WITH(myspell-dicts,
1588     AS_HELP_STRING([--with-myspell-dicts],
1589         [Adds myspell dictionaries to the LibreOffice installation set]),
1592 AC_ARG_WITH(system-dicts,
1593     AS_HELP_STRING([--without-system-dicts],
1594         [Do not use dictionaries from system paths.]),
1597 AC_ARG_WITH(external-dict-dir,
1598     AS_HELP_STRING([--with-external-dict-dir],
1599         [Specify external dictionary dir.]),
1602 AC_ARG_WITH(external-hyph-dir,
1603     AS_HELP_STRING([--with-external-hyph-dir],
1604         [Specify external hyphenation pattern dir.]),
1607 AC_ARG_WITH(external-thes-dir,
1608     AS_HELP_STRING([--with-external-thes-dir],
1609         [Specify external thesaurus dir.]),
1612 AC_ARG_WITH(system-zlib,
1613     AS_HELP_STRING([--with-system-zlib],
1614         [Use zlib already on system.]),,
1615     [with_system_zlib=auto])
1617 AC_ARG_WITH(system-jpeg,
1618     AS_HELP_STRING([--with-system-jpeg],
1619         [Use jpeg already on system.]),,
1620     [with_system_jpeg="$with_system_libs"])
1622 AC_ARG_WITH(system-libgltf,
1623     AS_HELP_STRING([--with-system-libgltf],
1624         [Use libgltf already on system.]),,
1625     [with_system_libgltf="$with_system_libs"])
1627 AC_ARG_WITH(system-clucene,
1628     AS_HELP_STRING([--with-system-clucene],
1629         [Use clucene already on system.]),,
1630     [with_system_clucene="$with_system_libs"])
1632 AC_ARG_WITH(system-expat,
1633     AS_HELP_STRING([--with-system-expat],
1634         [Use expat already on system.]),,
1635     [with_system_expat="$with_system_libs"])
1637 AC_ARG_WITH(system-libxml,
1638     AS_HELP_STRING([--with-system-libxml],
1639         [Use libxml/libxslt already on system.]),,
1640     [with_system_libxml=auto])
1642 AC_ARG_WITH(system-icu,
1643     AS_HELP_STRING([--with-system-icu],
1644         [Use icu already on system.]),,
1645     [with_system_icu="$with_system_libs"])
1647 AC_ARG_WITH(system-ucpp,
1648     AS_HELP_STRING([--with-system-ucpp],
1649         [Use ucpp already on system.]),,
1650     [])
1652 AC_ARG_WITH(system-opencollada,
1653     AS_HELP_STRING([--with-system-opencollada],
1654         [Use openCOLLADA already on system.]),,
1655     [with_system_opencollada=no])
1657 AC_ARG_WITH(system-collada2gltf,
1658     AS_HELP_STRING([--with-system-collada2gltf],
1659         [Use collada2gltf already on system.]),,
1660     [with_system_collada2gltf=no])
1662 AC_ARG_WITH(system-openldap,
1663     AS_HELP_STRING([--with-system-openldap],
1664         [Use the OpenLDAP LDAP SDK already on system.]),,
1665     [with_system_openldap="$with_system_libs"])
1667 AC_ARG_WITH(system-poppler,
1668     AS_HELP_STRING([--with-system-poppler],
1669         [Use system poppler (only needed for PDF import).]),,
1670     [with_system_poppler="$with_system_libs"])
1672 AC_ARG_WITH(system-apache-commons,
1673     AS_HELP_STRING([--with-system-apache-commons],
1674         [Use Apache commons libraries already on system.]),,
1675     [with_system_apache_commons="$with_system_jars"])
1677 AC_ARG_WITH(system-mariadb,
1678     AS_HELP_STRING([--with-system-mariadb],
1679         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1680          extension.]),,
1681     [with_system_mariadb="$with_system_libs"])
1683 AC_ARG_ENABLE(bundle-mariadb,
1684     AS_HELP_STRING([--enable-bundle-mariadb],
1685         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1688 AC_ARG_WITH(system-mysql-cppconn,
1689     AS_HELP_STRING([--with-system-mysql-cppconn],
1690         [Use MySQL C++ Connector libraries already on system.]),,
1691     [with_system_mysql_cppconn="$with_system_libs"])
1693 AC_ARG_WITH(system-postgresql,
1694     AS_HELP_STRING([--with-system-postgresql],
1695         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1696          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1697     [with_system_postgresql="$with_system_libs"])
1699 AC_ARG_WITH(libpq-path,
1700     AS_HELP_STRING([--with-libpq-path],
1701         [Use this PostgreSQL C interface (libpq) installation for building
1702          the PostgreSQL-SDBC extension.])
1703     [
1704                           Usage:     --with-libpq-path=<absolute path to
1705                                                   your libpq installation>
1706     ],
1709 AC_ARG_WITH(system-firebird,
1710     AS_HELP_STRING([--with-system-firebird],
1711         [Use Firebird libraries already on system, for building the Firebird-SDBC
1712          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1713     [with_system_firebird="$with_system_libs"])
1715 AC_ARG_WITH(system-hsqldb,
1716     AS_HELP_STRING([--with-system-hsqldb],
1717         [Use hsqldb already on system.]))
1719 AC_ARG_WITH(hsqldb-jar,
1720     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1721         [Specify path to jarfile manually.]),
1722     HSQLDB_JAR=$withval)
1724 AC_ARG_ENABLE(scripting-beanshell,
1725     AS_HELP_STRING([--disable-scripting-beanshell],
1726         [Disable support for scripts in BeanShell.]),
1730 AC_ARG_WITH(system-beanshell,
1731     AS_HELP_STRING([--with-system-beanshell],
1732         [Use beanshell already on system.]),,
1733     [with_system_beanshell="$with_system_jars"])
1735 AC_ARG_WITH(beanshell-jar,
1736     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1737         [Specify path to jarfile manually.]),
1738     BSH_JAR=$withval)
1740 AC_ARG_ENABLE(scripting-javascript,
1741     AS_HELP_STRING([--disable-scripting-javascript],
1742         [Disable support for scripts in JavaScript.]),
1746 AC_ARG_WITH(system-rhino,
1747     AS_HELP_STRING([--with-system-rhino],
1748         [Use rhino already on system.]),,)
1749 #    [with_system_rhino="$with_system_jars"])
1750 # Above is not used as we have different debug interface
1751 # patched into internal rhino. This code needs to be fixed
1752 # before we can enable it by default.
1754 AC_ARG_WITH(rhino-jar,
1755     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1756         [Specify path to jarfile manually.]),
1757     RHINO_JAR=$withval)
1759 AC_ARG_WITH(commons-codec-jar,
1760     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1761         [Specify path to jarfile manually.]),
1762     COMMONS_CODEC_JAR=$withval)
1764 AC_ARG_WITH(commons-lang-jar,
1765     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1766         [Specify path to jarfile manually.]),
1767     COMMONS_LANG_JAR=$withval)
1769 AC_ARG_WITH(commons-httpclient-jar,
1770     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1771         [Specify path to jarfile manually.]),
1772     COMMONS_HTTPCLIENT_JAR=$withval)
1774 AC_ARG_WITH(commons-logging-jar,
1775     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1776         [Specify path to jarfile manually.]),
1777     COMMONS_LOGGING_JAR=$withval)
1779 AC_ARG_WITH(system-jfreereport,
1780     AS_HELP_STRING([--with-system-jfreereport],
1781         [Use JFreeReport already on system.]),,
1782     [with_system_jfreereport="$with_system_jars"])
1784 AC_ARG_WITH(sac-jar,
1785     AS_HELP_STRING([--with-sac-jar=JARFILE],
1786         [Specify path to jarfile manually.]),
1787     SAC_JAR=$withval)
1789 AC_ARG_WITH(libxml-jar,
1790     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1791         [Specify path to jarfile manually.]),
1792     LIBXML_JAR=$withval)
1794 AC_ARG_WITH(flute-jar,
1795     AS_HELP_STRING([--with-flute-jar=JARFILE],
1796         [Specify path to jarfile manually.]),
1797     FLUTE_JAR=$withval)
1799 AC_ARG_WITH(jfreereport-jar,
1800     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1801         [Specify path to jarfile manually.]),
1802     JFREEREPORT_JAR=$withval)
1804 AC_ARG_WITH(liblayout-jar,
1805     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1806         [Specify path to jarfile manually.]),
1807     LIBLAYOUT_JAR=$withval)
1809 AC_ARG_WITH(libloader-jar,
1810     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1811         [Specify path to jarfile manually.]),
1812     LIBLOADER_JAR=$withval)
1814 AC_ARG_WITH(libloader-jar,
1815     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1816         [Specify path to jarfile manually.]),
1817     LIBLOADER_JAR=$withval)
1819 AC_ARG_WITH(libformula-jar,
1820     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1821         [Specify path to jarfile manually.]),
1822     LIBFORMULA_JAR=$withval)
1824 AC_ARG_WITH(librepository-jar,
1825     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1826         [Specify path to jarfile manually.]),
1827     LIBREPOSITORY_JAR=$withval)
1829 AC_ARG_WITH(libfonts-jar,
1830     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1831         [Specify path to jarfile manually.]),
1832     LIBFONTS_JAR=$withval)
1834 AC_ARG_WITH(libserializer-jar,
1835     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1836         [Specify path to jarfile manually.]),
1837     LIBSERIALIZER_JAR=$withval)
1839 AC_ARG_WITH(libbase-jar,
1840     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1841         [Specify path to jarfile manually.]),
1842     LIBBASE_JAR=$withval)
1844 AC_ARG_WITH(system-odbc,
1845     AS_HELP_STRING([--with-system-odbc],
1846         [Use the odbc headers already on system.]),,
1847     [with_system_odbc="auto"])
1849 AC_ARG_WITH(system-sane,
1850     AS_HELP_STRING([--with-system-sane],
1851         [Use sane.h already on system.]),,
1852     [with_system_sane="$with_system_headers"])
1854 AC_ARG_WITH(system-bluez,
1855     AS_HELP_STRING([--with-system-bluez],
1856         [Use bluetooth.h already on system.]),,
1857     [with_system_bluez="$with_system_headers"])
1859 AC_ARG_WITH(system-mesa-headers,
1860     AS_HELP_STRING([--with-system-mesa-headers],
1861         [Use Mesa headers already on system.]),,
1862     [with_system_mesa_headers="$with_system_headers"])
1864 AC_ARG_WITH(system-curl,
1865     AS_HELP_STRING([--with-system-curl],
1866         [Use curl already on system.]),,
1867     [with_system_curl=auto])
1869 AC_ARG_WITH(system-boost,
1870     AS_HELP_STRING([--with-system-boost],
1871         [Use boost already on system.]),,
1872     [with_system_boost="$with_system_headers"])
1874 AC_ARG_WITH(system-glm,
1875     AS_HELP_STRING([--with-system-glm],
1876         [Use glm already on system.]),,
1877     [with_system_glm="$with_system_headers"])
1879 AC_ARG_WITH(system-vigra,
1880     AS_HELP_STRING([--with-system-vigra],
1881         [Use vigra already on system.]),,
1882     [with_system_vigra="$with_system_headers"])
1884 AC_ARG_WITH(system-hunspell,
1885     AS_HELP_STRING([--with-system-hunspell],
1886         [Use libhunspell already on system.]),,
1887     [with_system_hunspell="$with_system_libs"])
1889 AC_ARG_WITH(system-mythes,
1890     AS_HELP_STRING([--with-system-mythes],
1891         [Use mythes already on system.]),,
1892     [with_system_mythes="$with_system_libs"])
1894 AC_ARG_WITH(system-altlinuxhyph,
1895     AS_HELP_STRING([--with-system-altlinuxhyph],
1896         [Use ALTLinuxhyph already on system.]),,
1897     [with_system_altlinuxhyph="$with_system_libs"])
1899 AC_ARG_WITH(system-lpsolve,
1900     AS_HELP_STRING([--with-system-lpsolve],
1901         [Use lpsolve already on system.]),,
1902     [with_system_lpsolve="$with_system_libs"])
1904 AC_ARG_WITH(system-coinmp,
1905     AS_HELP_STRING([--with-system-coinmp],
1906         [Use CoinMP already on system.]),,
1907     [with_system_coinmp="$with_system_libs"])
1909 AC_ARG_WITH(system-liblangtag,
1910     AS_HELP_STRING([--with-system-liblangtag],
1911         [Use liblangtag library already on system.]),,
1912     [with_system_liblangtag="$with_system_libs"])
1914 AC_ARG_WITH(system-npapi-headers,
1915     AS_HELP_STRING([--with-system-npapi-headers],
1916         [Use NPAPI headers provided by system instead of bundled ones. Used in
1917          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1918     [with_system_npapi_headers="$with_system_headers"]
1921 AC_ARG_WITH(jpeg-turbo,
1922     AS_HELP_STRING([--with-jpeg-turbo],
1923         [Use internal libjpeg-turbo library.]),,
1924     [with_jpeg_turbo=auto])
1926 AC_ARG_WITH(webdav,
1927     AS_HELP_STRING([--with-webdav],
1928         [Specify which library to use for webdav implementation.
1929          Possible values: "neon", "serf", "no". The default value is "neon".
1930          Example: --with-webdav="serf"]),
1931     WITH_WEBDAV=$withval,
1932     WITH_WEBDAV="neon")
1934 AC_ARG_WITH(linker-hash-style,
1935     AS_HELP_STRING([--with-linker-hash-style],
1936         [Use linker with --hash-style=<style> when linking shared objects.
1937          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1938          if supported on the build system, and "sysv" otherwise.]))
1940 AC_ARG_WITH(jdk-home,
1941     AS_HELP_STRING([--with-jdk-home],
1942         [If you have installed JDK 1.3 or later on your system please supply the
1943          path here. Note that this is not the location of the java command but the
1944          location of the entire distribution.])
1945     [
1946                           Usage:     --with-jdk-home=<absolute path to JDK home>
1947     ],
1950 AC_ARG_WITH(help,
1951     AS_HELP_STRING([--with-help],
1952         [Enable the build of help. There is a special parameter "common" that
1953          can be used to bundle only the common part, .e.g help-specific icons.
1954          This is useful when you build the helpcontent separately.])
1955     [
1956                           Usage:     --with-help    build the entire local help
1957                                  --without-help     no local help (default)
1958                                  --with-help=common bundle common files for the local
1959                                                     help but do not build the whole help
1960     ],
1963 AC_ARG_WITH(java,
1964     AS_HELP_STRING([--with-java],
1965         [Specify the name of the Java interpreter command. Typically "java"
1966          which is the default.
1968          To build without support for Java components, applets, accessibility
1969          or the XML filters written in Java, use --without-java or --with-java=no.])
1970     [
1971                           Usage:     --with-java==<java command>
1972                                      --without-java
1973     ],
1974     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1975     [ with_java=java ]
1978 AC_ARG_WITH(jvm-path,
1979     AS_HELP_STRING([--with-jvm-path],
1980         [Use a specific JVM search path at runtime.])
1981     [
1982                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1984                           e. g.: --with-jvm-path=/usr/lib/
1985                                  to find JRE/JDK in /usr/lib/jvm/
1986     ],
1989 AC_ARG_WITH(ant-home,
1990     AS_HELP_STRING([--with-ant-home],
1991         [If you have installed Jakarta Ant on your system, please supply the path here.
1992          Note that this is not the location of the Ant binary but the location
1993          of the entire distribution.])
1994     [
1995                           Usage:     --with-ant-home=<absolute path to Ant home>
1996     ],
1999 AC_ARG_WITH(export-validation,
2000     AS_HELP_STRING([--with-export-validation],
2001         [If you want the exported files to be validated. Right now limited to OOXML files in calc export tests.
2002          Note: You need an executable script officeotron that takes the path to the file.])
2003     [
2004                             Usage: --with-export-validation
2005     ],
2008 AC_ARG_WITH(junit,
2009     AS_HELP_STRING([--with-junit],
2010         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2011          --without-junit disables those tests. Not relevant in the --without-java case.])
2012     [
2013                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
2014     ],
2015 ,with_junit=yes)
2017 AC_ARG_WITH(hamcrest,
2018     AS_HELP_STRING([--with-hamcrest],
2019         [Specifies the hamcrest jar file to use for JUnit-based tests.
2020          --without-junit disables those tests. Not relevant in the --without-java case.])
2021     [
2022                           Usage:     --with-hamcrest=<absolute path to hamcrest jar>
2023     ],
2024 ,with_hamcrest=yes)
2026 AC_ARG_WITH(perl-home,
2027     AS_HELP_STRING([--with-perl-home],
2028         [If you have installed Perl 5 Distribution, on your system, please
2029          supply the path here. Note that this is not the location of the Perl
2030          binary but the location of the entire distribution.])
2031     [
2032                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
2033     ],
2036 AC_ARG_WITH(
2037     [doxygen],
2038     AS_HELP_STRING(
2039         [--with-doxygen],
2040         [Specifies the doxygen executable to use when generating ODK C/C++
2041          documentation. --without-doxygen disables generation of ODK C/C++
2042          documentation. Not relevant in the --disable-odk case.])
2043     [
2044                           Usage:     --with-doxygen=<absolute path to doxygen executable>
2045     ],,
2046     [with_doxygen=yes])
2048 AC_ARG_WITH(visual-studio,
2049     AS_HELP_STRING([--with-visual-studio=2013],
2050         [Specify which Visual Studio version to use in case several are
2051          installed. If not specified, the order of preference is 2013 (including
2052          Express editions). Not very useful at the moment, as currently only
2053          2013 is supported, anyway.])
2054     [
2055                           Usage:     --with-visual-studio=2013
2056     ],
2059 AC_ARG_WITH(windows-sdk,
2060     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)>],
2061         [Specify which Windows SDK, or "Windows Kit", version to use
2062          in case the one that came with the selected Visual Studio
2063          is not what you want for some reason. Note that not all compiler/SDK
2064          combinations are supported. The intent is that this option should not
2065          be needed.])
2066     [
2067                           Usage:     --with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)>
2068     ],
2071 AC_ARG_WITH(lang,
2072     AS_HELP_STRING([--with-lang],
2073         [Use this option to build LibreOffice with additional UI language support.
2074          English (US) is always included by default.
2075          Separate multiple languages with space.
2076          For all languages, use --with-lang=ALL.])
2077     [
2078                           Usage:     --with-lang="es sw tu cs sk"
2079     ],
2082 AC_ARG_WITH(locales,
2083     AS_HELP_STRING([--with-locales],
2084         [Use this option to limit the locale information built in.
2085          Separate multiple locales with space.
2086          Very experimental and might well break stuff.
2087          Just a desperate measure to shrink code and data size.
2088          By default all the locales available is included.
2089          This option is completely unrelated to --with-lang.])
2090     [
2091                           Affects also our character encoding conversion
2092                           tables for encodings mainly targeted for a
2093                           particular locale, like EUC-CN and EUC-TW for
2094                           zh, ISO-2022-JP for ja.
2096                           Affects also our add-on break iterator data for
2097                           some languages.
2099                           For the default, all locales, don't use this switch at all.
2100                           Specifying just the language part of a locale means all matching
2101                           locales will be included.
2103                           Usage:     --with-locales="en es pt fr zh kr ja"
2104     ],
2107 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2108 AC_ARG_WITH(krb5,
2109     AS_HELP_STRING([--with-krb5],
2110         [Enable MIT Kerberos 5 support in modules that support it.
2111          By default automatically enabled on platforms
2112          where a good system Kerberos 5 is available.]),
2115 AC_ARG_WITH(gssapi,
2116     AS_HELP_STRING([--with-gssapi],
2117         [Enable GSSAPI support in modules that support it.
2118          By default automatically enabled on platforms
2119          where a good system GSSAPI is available.]),
2122 AC_ARG_WITH(iwyu,
2123     AS_HELP_STRING([--with-iwyu],
2124         [Use given IWYU binary path to check unneeded includes instead of building.
2125          Use only if you are hacking on it.]),
2128 dnl ===================================================================
2129 dnl Branding
2130 dnl ===================================================================
2132 AC_ARG_WITH(branding,
2133     AS_HELP_STRING([--with-branding],
2134         [Use given path to retrieve branding images set.])
2135     [
2136                           Search for intro.png about.svg and flat_logo.svg.
2137                           If any is missing, default ones will be used instead.
2139                           Search also progress.conf for progress
2140                           settings on intro screen :
2142                           PROGRESSBARCOLOR="255,255,255" Set color of
2143                           progress bar. Comma separated RGB decimal values.
2144                           PROGRESSSIZE="407,6" Set size of progress bar.
2145                           Comma separated decimal values (width, height).
2146                           PROGRESSPOSITION="61,317" Set position of progress
2147                           bar from left,top. Comma separated decimal values.
2148                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2149                           bar frame. Comma separated RGB decimal values.
2150                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2151                           bar text. Comma separated RGB decimal values.
2152                           PROGRESSTEXTBASELINE="287" Set vertical position of
2153                           progress bar text from top. Decimal value.
2155                           Default values will be used if not found.
2157                           Usage:     --with-branding=/path/to/images
2158     ],
2162 AC_ARG_WITH(extra-buildid,
2163     AS_HELP_STRING([--with-extra-buildid],
2164         [Show addition build identification in about dialog.])
2165     [
2166                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
2167     ],
2171 AC_ARG_WITH(vendor,
2172     AS_HELP_STRING([--with-vendor],
2173         [Set vendor of the build.])
2174     [
2175                           Usage:     --with-vendor="John the Builder"
2176     ],
2179 AC_ARG_WITH(android-package-name,
2180     AS_HELP_STRING([--with-android-package-name],
2181         [Set Android package name of the build.])
2182     [
2183                           Usage:     --with-android-package-name="org.libreoffice"
2184     ],
2187 AC_ARG_WITH(compat-oowrappers,
2188     AS_HELP_STRING([--with-compat-oowrappers],
2189         [Install oo* wrappers in parallel with
2190          lo* ones to keep backward compatibility.
2191          Has effect only with make distro-pack-install]),
2194 AC_ARG_WITH(os-version,
2195     AS_HELP_STRING([--with-os-version],
2196         [For FreeBSD users, use this option option to override the detected OSVERSION.])
2197     [
2198                           Usage:     --with-os-version=<OSVERSION>
2199     ],
2202 AC_ARG_WITH(mingw-cross-compiler,
2203     AS_HELP_STRING([--with-mingw-cross-compiler],
2204         [Specify the MinGW cross-compiler to use.])
2205     [
2206                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2208                           When building on the ODK on Unix and building unowinreg.dll,
2209                           specify the MinGW C++ cross-compiler.
2210     ],
2213 AC_ARG_WITH(idlc-cpp,
2214     AS_HELP_STRING([--with-idlc-cpp],
2215         [Specify the C Preprocessor to use for idlc.])
2216     [
2217                           Usage:     --with-idlc-cpp=cpp
2219                           Default is ucpp.
2220     ]
2223 AC_ARG_WITH(build-version,
2224     AS_HELP_STRING([--with-build-version],
2225         [Allows the builder to add a custom version tag that will appear in the
2226          Help/About box for QA purposes.])
2227     [
2228                           Usage:     --with-build-version="Built by Jim"
2229     ],
2230     with_build_version=$withval ,
2233 AC_ARG_WITH(alloc,
2234     AS_HELP_STRING([--with-alloc],
2235         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2236          Note that on FreeBSD/NetBSD system==jemalloc]),
2239 AC_ARG_WITH(sun-templates,
2240     AS_HELP_STRING([--with-sun-templates],
2241         [Integrate Sun template packages.]),
2244 AC_ARG_WITH(parallelism,
2245     AS_HELP_STRING([--with-parallelism],
2246         [Number of jobs to run simultaneously during build. Parallel builds can
2247         save a lot of time on multi-cpu machines. Defaults to the number of
2248         CPUs on the machine, unless you configure --enable-icecream - then to
2249         10.]),
2252 AC_ARG_WITH(all-tarballs,
2253     AS_HELP_STRING([--with-all-tarballs],
2254         [Download all external tarballs unconditionally]))
2256 AC_ARG_WITH(gdrive-client-id,
2257     AS_HELP_STRING([--with-gdrive-client-id],
2258         [Provides the client id of the application for OAuth2 authentication
2259         on Google Drive. If either this or --with-gdrive-client-secret is
2260         empty, the feature will be disabled]),
2263 AC_ARG_WITH(gdrive-client-secret,
2264     AS_HELP_STRING([--with-gdrive-client-secret],
2265         [Provides the client secret of the application for OAuth2
2266         authentication on Google Drive. If either this or
2267         --with-gdrive-client-id is empty, the feature will be disabled]),
2270 AC_ARG_WITH(alfresco-cloud-client-id,
2271     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2272         [Provides the client id of the application for OAuth2 authentication
2273         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2274         empty, the feature will be disabled]),
2277 AC_ARG_WITH(alfresco-cloud-client-secret,
2278     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2279         [Provides the client secret of the application for OAuth2
2280         authentication on Alfresco Cloud. If either this or
2281         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2284 AC_ARG_WITH(onedrive-client-id,
2285     AS_HELP_STRING([--with-onedrive-client-id],
2286         [Provides the client id of the application for OAuth2 authentication
2287         on OneDrive. If either this or --with-onedrive-client-secret is
2288         empty, the feature will be disabled]),
2291 AC_ARG_WITH(onedrive-client-secret,
2292     AS_HELP_STRING([--with-onedrive-client-secret],
2293         [Provides the client secret of the application for OAuth2
2294         authentication on OneDrive. If either this or
2295         --with-onedrive-client-id is empty, the feature will be disabled]),
2297 dnl ===================================================================
2298 dnl Do we want to use pre-build binary tarball for recompile
2299 dnl ===================================================================
2301 if test "$enable_library_bin_tar" = "yes" ; then
2302     USE_LIBRARY_BIN_TAR=TRUE
2303 else
2304     USE_LIBRARY_BIN_TAR=
2306 AC_SUBST(USE_LIBRARY_BIN_TAR)
2308 dnl ===================================================================
2309 dnl Test whether build target is Release Build
2310 dnl ===================================================================
2311 AC_MSG_CHECKING([whether build target is Release Build])
2312 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2313     AC_MSG_RESULT([no])
2314     ENABLE_RELEASE_BUILD=
2315 else
2316     AC_MSG_RESULT([yes])
2317     ENABLE_RELEASE_BUILD=TRUE
2319 AC_SUBST(ENABLE_RELEASE_BUILD)
2321 dnl ===================================================================
2322 dnl Test whether to sign Windows Build
2323 dnl ===================================================================
2324 AC_MSG_CHECKING([whether to sign windows build])
2325 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2326     AC_MSG_RESULT([yes])
2327     WINDOWS_BUILD_SIGNING="TRUE"
2328 else
2329     AC_MSG_RESULT([no])
2330     WINDOWS_BUILD_SIGNING="FALSE"
2332 AC_SUBST(WINDOWS_BUILD_SIGNING)
2334 dnl ===================================================================
2335 dnl MacOSX build and runtime environment options
2336 dnl ===================================================================
2338 AC_ARG_WITH(macosx-sdk,
2339     AS_HELP_STRING([--with-macosx-sdk],
2340         [Use a specific SDK for building.])
2341     [
2342                           Usage:     --with-macosx-sdk=<version>
2344                           e. g.: --with-macosx-sdk=10.8
2346                           there are 3 options to control the MacOSX build:
2347                           --with-macosx-sdk (referred as 'sdk' below)
2348                           --with-macosx-version-min-required (referred as 'min' below)
2349                           --with-macosx-version-max-allowed (referred as 'max' below)
2351                           the connection between these value and the default they take is as follow:
2352                           ( ? means not specified on the command line, s means the SDK version found,
2353                           constraint: 8 <= x <= y <= z)
2355                           ==========================================
2356                            command line      || config result
2357                           ==========================================
2358                           min  | max  | sdk  || min  | max  | sdk  |
2359                           ?    | ?    | ?    || 10.8 | 10.s | 10.s |
2360                           ?    | ?    | 10.x || 10.8 | 10.x | 10.x |
2361                           ?    | 10.x | ?    || 10.8 | 10.s | 10.s |
2362                           ?    | 10.x | 10.y || 10.8 | 10.x | 10.y |
2363                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2364                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2365                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2366                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2369                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2370                           for a detailed technical explanation of these variables
2372                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2373     ],
2376 AC_ARG_WITH(macosx-version-min-required,
2377     AS_HELP_STRING([--with-macosx-version-min-required],
2378         [set the minimum OS version needed to run the built LibreOffice])
2379     [
2380                           Usage:     --with-macosx-version-min-required=<version>
2382                           e. g.: --with-macos-version-min-required=10.8
2383                           see --with-macosx-sdk for more info
2384     ],
2387 AC_ARG_WITH(macosx-version-max-allowed,
2388     AS_HELP_STRING([--with-macosx-version-max-allowed],
2389         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2390     [
2391                           Usage:     --with-macosx-version-max-allowed=<version>
2393                           e. g.: --with-macos-version-max-allowed=10.8
2394                           see --with-macosx-sdk for more info
2395     ],
2399 dnl ===================================================================
2400 dnl options for stuff used during cross-compilation build
2401 dnl Not quite superseded by --with-build-platform-configure-options.
2402 dnl TODO: check, if the "force" option is still needed anywhere.
2403 dnl ===================================================================
2405 AC_ARG_WITH(system-icu-for-build,
2406     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2407         [Use icu already on system for build tools (cross-compilation only).]))
2410 dnl ===================================================================
2411 dnl check for required programs (grep, awk, sed, bash)
2412 dnl ===================================================================
2414 pathmunge ()
2416     if test -n "$1"; then
2417         if test "$build_os" = "cygwin"; then
2418             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2419                 PathFormat "$1"
2420                 new_path=`cygpath -sm "$formatted_path"`
2421             else
2422                 PathFormat "$1"
2423                 new_path=`cygpath -u "$formatted_path"`
2424             fi
2425         else
2426             new_path="$1"
2427         fi
2428         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2429             if test "$2" = "after"; then
2430                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2431             else
2432                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2433             fi
2434         fi
2435         unset new_path
2436     fi
2439 AC_PROG_AWK
2440 AC_PATH_PROG( AWK, $AWK)
2441 if test -z "$AWK"; then
2442     AC_MSG_ERROR([install awk to run this script])
2445 AC_PATH_PROG(BASH, bash)
2446 if test -z "$BASH"; then
2447     AC_MSG_ERROR([bash not found in \$PATH])
2449 AC_SUBST(BASH)
2451 AC_MSG_CHECKING([for GNU or BSD tar])
2452 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2453     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2454     if test $? -eq 0;  then
2455         GNUTAR=$a
2456         break
2457     fi
2458 done
2459 AC_MSG_RESULT($GNUTAR)
2460 if test -z "$GNUTAR"; then
2461     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2463 AC_SUBST(GNUTAR)
2465 AC_MSG_CHECKING([for tar's option to strip components])
2466 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2467 if test $? -eq 0; then
2468     STRIP_COMPONENTS="--strip-components"
2469 else
2470     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2471     if test $? -eq 0; then
2472         STRIP_COMPONENTS="--strip-path"
2473     else
2474         STRIP_COMPONENTS="unsupported"
2475     fi
2477 AC_MSG_RESULT($STRIP_COMPONENTS)
2478 if test x$STRIP_COMPONENTS = xunsupported; then
2479     AC_MSG_ERROR([you need a tar that is able to strip components.])
2481 AC_SUBST(STRIP_COMPONENTS)
2483 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2484 dnl desktop OSes from "mobile" ones.
2486 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2487 dnl In other words, that when building for an OS that is not a
2488 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2490 dnl Note the direction of the implication; there is no assumption that
2491 dnl cross-compiling would imply a non-desktop OS.
2493 if test $_os != iOS -a $_os != Android; then
2494     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2495     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2496     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2499 DISABLE_EXPORT=''
2500 if test "$enable_export" != no; then
2501     BUILD_TYPE="$BUILD_TYPE EXPORT"
2502 else
2503     DISABLE_EXPORT='TRUE'
2504     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2506 AC_SUBST(DISABLE_EXPORT)
2508 # Whether to build "avmedia" functionality or not.
2510 if test -z "$enable_avmedia"; then
2511     enable_avmedia=yes
2514 if test "$enable_avmedia" = yes; then
2515     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2516     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2517 else
2518     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2521 # Decide whether to build database connectivity stuff (including
2522 # Base) or not. We probably don't want to on non-desktop OSes.
2524 if test -z "$enable_database_connectivity"; then
2525     # --disable-database-connectivity is unfinished work in progress
2526     # and the iOS test app doesn't link if we actually try to use it.
2527     # if test $_os != iOS -a $_os != Android; then
2528         enable_database_connectivity=yes
2529     # fi
2532 if test "$enable_database_connectivity" = yes; then
2533     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2534     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2537 if test -z "$enable_extensions"; then
2538     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2539     if test $_os != iOS -a $_os != Android; then
2540         enable_extensions=yes
2541     fi
2544 if test "$enable_extensions" = yes; then
2545     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2546     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2549 if test -z "$enable_scripting"; then
2550     # Disable scripting for iOS unless specifically overridden
2551     # with --enable-scripting.
2552     if test $_os != iOS; then
2553         enable_scripting=yes
2554     fi
2557 DISABLE_SCRIPTING=''
2558 if test "$enable_scripting" = yes; then
2559     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2560     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2561 else
2562     DISABLE_SCRIPTING='TRUE'
2563     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2566 if test $_os = iOS -o $_os = Android; then
2567     # Disable dynamic_loading always for iOS and Android
2568     enable_dynamic_loading=no
2569 elif test -z "$enable_dynamic_loading"; then
2570     # Otherwise enable it unless speficically disabled
2571     enable_dynamic_loading=yes
2574 DISABLE_DYNLOADING=''
2575 if test "$enable_dynamic_loading" = yes; then
2576     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2577 else
2578     DISABLE_DYNLOADING='TRUE'
2579     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2581 AC_SUBST(DISABLE_DYNLOADING)
2583 # remenber SYSBASE value
2584 AC_SUBST(SYSBASE)
2586 dnl ===================================================================
2587 dnl  Sort out various gallery compilation options
2588 dnl ===================================================================
2589 AC_MSG_CHECKING([how to build and package galleries])
2590 if test -n "${with_galleries}"; then
2591     if test "$with_galleries" = "build"; then
2592         WITH_GALLERY_BUILD=TRUE
2593         AC_MSG_RESULT([build from source images internally])
2594     elif test "$with_galleries" = "no"; then
2595         WITH_GALLERY_BUILD=
2596         AC_MSG_RESULT([disable non-internal gallery build])
2597     else
2598         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2599     fi
2600 else
2601     if test $_os != iOS -a $_os != Android; then
2602         WITH_GALLERY_BUILD=TRUE
2603         AC_MSG_RESULT([internal src images for desktop])
2604     else
2605         WITH_GALLERY_BUILD=
2606         AC_MSG_RESULT([disable src imgage build])
2607     fi
2609 AC_SUBST(WITH_GALLERY_BUILD)
2611 dnl ===================================================================
2612 dnl  Checks if ccache is available
2613 dnl ===================================================================
2614 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2615     case "%$CC%$CXX%" in
2616     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2617     # assume that's good then
2618     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2619         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2620         ;;
2621     *)
2622         AC_PATH_PROG([CCACHE],[ccache],[not found])
2623         if test "$CCACHE" = "not found"; then
2624             CCACHE=""
2625         else
2626             # Need to check for ccache version: otherwise prevents
2627             # caching of the results (like "-x objective-c++" for Mac)
2628             if test $_os = Darwin -o $_os = iOS; then
2629                 # Check ccache version
2630                 AC_MSG_CHECKING([whether version of ccache is suitable])
2631                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2632                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2633                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2634                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2635                 else
2636                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2637                     CCACHE=""
2638                 fi
2639             fi
2640         fi
2641         ;;
2642     esac
2643 else
2644     CCACHE=""
2647 if test "$CCACHE" != ""; then
2648     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2649     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2650     if test "$ccache_size" = ""; then
2651         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2652         if test "$ccache_size" = ""; then
2653             ccache_size=0
2654         fi
2655         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2656         if test $ccache_size -lt 1024; then
2657             CCACHE=""
2658             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2659             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2660         else
2661             # warn that ccache may be too small for debug build
2662             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2663             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2664         fi
2665     else
2666         if test $ccache_size -lt 5; then
2667             #warn that ccache may be too small for debug build
2668             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2669             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2670         fi
2671     fi
2674 dnl ===================================================================
2675 dnl  Checks for C compiler,
2676 dnl  The check for the C++ compiler is later on.
2677 dnl ===================================================================
2678 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2679     GCC_HOME_SET="true"
2680     AC_MSG_CHECKING([gcc home])
2681     if test -z "$with_gcc_home"; then
2682         if test "$enable_icecream" = "yes"; then
2683             if test -d "/usr/lib/icecc/bin"; then
2684                 GCC_HOME="/usr/lib/icecc/"
2685             else
2686                 GCC_HOME="/opt/icecream/"
2687             fi
2688         else
2689             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2690             GCC_HOME_SET="false"
2691         fi
2692     else
2693         GCC_HOME="$with_gcc_home"
2694     fi
2695     AC_MSG_RESULT($GCC_HOME)
2696     AC_SUBST(GCC_HOME)
2698     if test "$GCC_HOME_SET" = "true"; then
2699         if test -z "$CC"; then
2700             CC="$GCC_HOME/bin/gcc"
2701         fi
2702         if test -z "$CXX"; then
2703             CXX="$GCC_HOME/bin/g++"
2704         fi
2705     fi
2708 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2709 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2710     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2711     save_CFLAGS=$CFLAGS
2712     AC_PROG_CC
2713     CFLAGS=$save_CFLAGS
2716 COMPATH=`dirname "$CC"`
2717 if test "$COMPATH" = "."; then
2718     AC_PATH_PROGS(COMPATH, $CC)
2719     dnl double square bracket to get single because of M4 quote...
2720     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2722 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2724 dnl ===================================================================
2725 dnl Java support
2726 dnl ===================================================================
2727 AC_MSG_CHECKING([whether to build with Java support])
2728 if test "$with_java" != "no"; then
2729     if test "$DISABLE_SCRIPTING" = TRUE; then
2730         AC_MSG_RESULT([no, overridden by --disable-scripting])
2731         ENABLE_JAVA=""
2732         with_java=no
2733     else
2734         AC_MSG_RESULT([yes])
2735         ENABLE_JAVA="TRUE"
2736         AC_DEFINE(HAVE_FEATURE_JAVA)
2737     fi
2738 else
2739     AC_MSG_RESULT([no])
2740     ENABLE_JAVA=""
2743 AC_SUBST(ENABLE_JAVA)
2745 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2747 dnl ENABLE_JAVA="" indicate no Java support at all
2749 dnl ===================================================================
2750 dnl Export file validation
2751 dnl ===================================================================
2752 AC_MSG_CHECKING([whether to enable export file validation])
2753 if test "$with_export_validation" = yes; then
2754     AC_MSG_RESULT([yes])
2755     AC_DEFINE(HAVE_EXPORT_VALIDATION)
2757     AC_CHECK_PROGS(ODFVALIDATOR, odfvalidator)
2758     if test -z "$ODFVALIDATOR"; then
2759         AC_MSG_ERROR([odfvalidator not found, but required by --with-export-validation])
2760     fi
2761     AC_SUBST(ODFVALIDATOR)
2762     AC_CHECK_PROGS(OFFICEOTRON, officeotron)
2763     if test -z "$OFFICEOTRON"; then
2764         AC_MSG_ERROR([officeotron not found, but required by --with-export-validation])
2765     fi
2766     AC_SUBST(OFFICEOTRON)
2767 else
2768     AC_MSG_RESULT([no])
2772 dnl ===================================================================
2773 dnl Check OS X SDK and compiler
2774 dnl ===================================================================
2776 if test $_os = Darwin; then
2778     # If no --with-macosx-sdk option is given, look for one
2780     # The intent is that for "most" Mac-based developers, a suitable
2781     # SDK will be found automatically without any configure options.
2783     # For developers with a current Xcode, the lowest-numbered SDK
2784     # higher than or equal to the minimum required should be found.
2786     AC_MSG_CHECKING([what Mac OS X SDK to use])
2788     for _macosx_sdk in $with_macosx_sdk 10.8 10.9 10.10 10.11; do
2789         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2790         if test -d "$MACOSX_SDK_PATH"; then
2791             with_macosx_sdk="${_macosx_sdk}"
2792             break
2793         else
2794             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2795             if test -d "$MACOSX_SDK_PATH"; then
2796                 with_macosx_sdk="${_macosx_sdk}"
2797                 break
2798             fi
2799         fi
2800     done
2801     if test ! -d "$MACOSX_SDK_PATH"; then
2802         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2803     fi
2804     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2806     case $with_macosx_sdk in
2807     10.8)
2808         MACOSX_SDK_VERSION=1080
2809         ;;
2810     10.9)
2811         MACOSX_SDK_VERSION=1090
2812         ;;
2813     10.10)
2814         MACOSX_SDK_VERSION=101000
2815         ;;
2816     10.11)
2817         MACOSX_SDK_VERSION=101100
2818         ;;
2819     *)
2820         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.8--11])
2821         ;;
2822     esac
2824     if test "$with_macosx_version_min_required" = "" ; then
2825         with_macosx_version_min_required="10.8";
2826     fi
2828     if test "$with_macosx_version_max_allowed" = "" ; then
2829         with_macosx_version_max_allowed="$with_macosx_sdk"
2830     fi
2832     # export this so that "xcrun" invocations later return matching values
2833     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2834     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2835     export DEVELOPER_DIR
2836     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2837     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2839     case "$with_macosx_version_min_required" in
2840     10.8)
2841         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2842         ;;
2843     10.9)
2844         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2845         ;;
2846     10.10)
2847         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2848         ;;
2849     10.11)
2850         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2851         ;;
2852     *)
2853         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.8--11])
2854         ;;
2855     esac
2857     LIBTOOL=libtool
2858     INSTALL_NAME_TOOL=install_name_tool
2859     if test -z "$save_CC"; then
2860         AC_MSG_CHECKING([what compiler to use])
2861         stdlib=-stdlib=libc++
2862         if test "$ENABLE_LTO" = TRUE; then
2863             lto=-flto
2864         fi
2865         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2866         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2867         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2868         AR=`xcrun -find ar`
2869         NM=`xcrun -find nm`
2870         STRIP=`xcrun -find strip`
2871         LIBTOOL=`xcrun -find libtool`
2872         RANLIB=`xcrun -find ranlib`
2873         AC_MSG_RESULT([$CC and $CXX])
2874     fi
2876     case "$with_macosx_version_max_allowed" in
2877     10.8)
2878         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2879         ;;
2880     10.9)
2881         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2882         ;;
2883     10.10)
2884         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2885         ;;
2886     10.11)
2887         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2888         ;;
2889     *)
2890         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.8--11])
2891         ;;
2892     esac
2894     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2895     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2896         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2897     else
2898         AC_MSG_RESULT([ok])
2899     fi
2901     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2902     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2903         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2904     else
2905         AC_MSG_RESULT([ok])
2906     fi
2907     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2908     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2910     AC_MSG_CHECKING([whether to do code signing])
2912     if test "$enable_macosx_code_signing" = yes; then
2913         # By default use the first suitable certificate (?).
2915         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2916         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2917         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2918         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2919         # "Developer ID Application" one.
2921         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2922         if test -n "$identity"; then
2923             MACOSX_CODESIGNING_IDENTITY=$identity
2924             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2925             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2926         else
2927             AC_MSG_ERROR([cannot determine identity to use])
2928         fi
2929     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2930         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2931         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2932         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2933     else
2934         AC_MSG_RESULT([no])
2935     fi
2937     AC_MSG_CHECKING([whether to create a Mac App Store package])
2939     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2940         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2941     elif test "$enable_macosx_package_signing" = yes; then
2942         # By default use the first suitable certificate.
2943         # It should be a "3rd Party Mac Developer Installer" one
2945         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2946         if test -n "$identity"; then
2947             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2948             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2949             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2950         else
2951             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2952         fi
2953     elif test -n "$enable_macosx_package_signing"; then
2954         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2955         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2956         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2957     else
2958         AC_MSG_RESULT([no])
2959     fi
2961     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2962         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2963     fi
2965     AC_MSG_CHECKING([whether to sandbox the application])
2967     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2968         AC_MSG_ERROR([OS X sandboxing requires code signing])
2969     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2970         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2971     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2972         ENABLE_MACOSX_SANDBOX=TRUE
2973         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2974         AC_MSG_RESULT([yes])
2975     else
2976         AC_MSG_RESULT([no])
2977     fi
2979     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2980     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2981     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2983     AC_MSG_CHECKING([what OS X app name to use])
2984     MACOSX_APP_NAME="$with_macosx_app_name"
2985     AC_MSG_RESULT([$MACOSX_APP_NAME])
2988 AC_SUBST(MACOSX_SDK_PATH)
2989 AC_SUBST(MACOSX_SDK_VERSION)
2990 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2991 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2992 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2993 AC_SUBST(INSTALL_NAME_TOOL)
2994 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2995 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2996 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2997 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2998 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2999 AC_SUBST(MACOSX_APP_NAME)
3001 dnl ===================================================================
3002 dnl Check iOS SDK and compiler
3003 dnl ===================================================================
3005 if test $_os = iOS; then
3007     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3008         :
3009     else
3010         BITNESS_OVERRIDE=64
3011     fi
3013     AC_MSG_CHECKING([what iOS SDK to use])
3015     if test "$enable_ios_simulator" = yes; then
3016         platform=iPhoneSimulator
3017     else
3018         platform=iPhoneOS
3019     fi
3021     xcode_developer=`xcode-select -print-path`
3023     current_sdk_ver=8.3
3024     for sdkver in 8.3 8.2 8.1 8.0; do
3025         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3026         if test -d $t; then
3027             ios_sdk=$sdkver
3028             sysroot=$t
3029             break
3030         fi
3031     done
3033     if test -z "$sysroot"; then
3034         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}])
3035     fi
3037     AC_MSG_RESULT($sysroot)
3039     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
3041     if test "$enable_ios_simulator" = yes; then
3042         if test "$BITNESS_OVERRIDE" = 64; then
3043             XCODE_ARCHS=x86_64
3044             versionmin=-mios-simulator-version-min=7.0
3045         else
3046             XCODE_ARCHS=i386
3047             versionmin=-mios-simulator-version-min=7.0
3048         fi
3049     else
3050         platform=iPhoneOS
3051         if test "$BITNESS_OVERRIDE" = 64; then
3052             XCODE_ARCHS=arm64
3053         else
3054             XCODE_ARCHS=armv7
3055         fi
3056         versionmin=-miphoneos-version-min=7.0
3057     fi
3059     # LTO is not really recommended for iOS builds,
3060     # the link time will be astronomical
3061     if test "$ENABLE_LTO" = TRUE; then
3062         lto=-flto
3063     fi
3064     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3065     # get compiled with it, to avoid ld warnings when linking all that together into one
3066     # executable.
3068     XCODE_CLANG_CXX_LIBRARY=libc++
3069     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3071     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3072     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3074     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3075     AR=`xcrun -find ar`
3076     NM=`xcrun -find nm`
3077     STRIP=`xcrun -find strip`
3078     LIBTOOL=`xcrun -find libtool`
3079     RANLIB=`xcrun -find ranlib`
3082 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3083 AC_SUBST(XCODE_ARCHS)
3084 AC_SUBST(XCODEBUILD_SDK)
3086 AC_MSG_CHECKING([whether to treat the installation as read-only])
3088 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3089         "$enable_extensions" != yes; then
3090     enable_readonly_installset=yes
3092 if test "$enable_readonly_installset" = yes; then
3093     AC_MSG_RESULT([yes])
3094     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3095 else
3096     AC_MSG_RESULT([no])
3099 dnl ===================================================================
3100 dnl Structure of install set
3101 dnl ===================================================================
3103 if test $_os = Darwin; then
3104     LIBO_BIN_FOLDER=MacOS
3105     LIBO_ETC_FOLDER=Resources
3106     LIBO_LIBEXEC_FOLDER=MacOS
3107     LIBO_LIB_FOLDER=Frameworks
3108     LIBO_SHARE_FOLDER=Resources
3109     LIBO_SHARE_HELP_FOLDER=Resources/help
3110     LIBO_SHARE_JAVA_FOLDER=Resources/java
3111     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3112     LIBO_LIB_PYUNO_FOLDER=Resources
3113     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3114     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3115     LIBO_URE_BIN_FOLDER=MacOS
3116     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3117     LIBO_URE_LIB_FOLDER=Frameworks
3118     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3119     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3120 elif test $_os = WINNT; then
3121     LIBO_BIN_FOLDER=program
3122     LIBO_ETC_FOLDER=program
3123     LIBO_LIBEXEC_FOLDER=program
3124     LIBO_LIB_FOLDER=program
3125     LIBO_LIB_PYUNO_FOLDER=program
3126     LIBO_SHARE_FOLDER=share
3127     LIBO_SHARE_HELP_FOLDER=help
3128     LIBO_SHARE_JAVA_FOLDER=program/classes
3129     LIBO_SHARE_PRESETS_FOLDER=presets
3130     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3131     LIBO_SHARE_SHELL_FOLDER=program/shell
3132     LIBO_URE_BIN_FOLDER=program
3133     LIBO_URE_ETC_FOLDER=program
3134     LIBO_URE_LIB_FOLDER=program
3135     LIBO_URE_MISC_FOLDER=program
3136     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3137 else
3138     LIBO_BIN_FOLDER=program
3139     LIBO_ETC_FOLDER=program
3140     LIBO_LIBEXEC_FOLDER=program
3141     LIBO_LIB_FOLDER=program
3142     LIBO_LIB_PYUNO_FOLDER=program
3143     LIBO_SHARE_FOLDER=share
3144     LIBO_SHARE_HELP_FOLDER=help
3145     LIBO_SHARE_JAVA_FOLDER=program/classes
3146     LIBO_SHARE_PRESETS_FOLDER=presets
3147     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3148     LIBO_SHARE_SHELL_FOLDER=program/shell
3149     LIBO_URE_BIN_FOLDER=program
3150     LIBO_URE_ETC_FOLDER=program
3151     LIBO_URE_LIB_FOLDER=program
3152     LIBO_URE_MISC_FOLDER=program
3153     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3155 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3156 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3157 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3158 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3159 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3160 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3161 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3162 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3163 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3164 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3165 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3166 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3167 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3168 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3169 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3170 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3172 # Not all of them needed in config_host.mk, add more if need arises
3173 AC_SUBST(LIBO_BIN_FOLDER)
3174 AC_SUBST(LIBO_ETC_FOLDER)
3175 AC_SUBST(LIBO_LIB_FOLDER)
3176 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3177 AC_SUBST(LIBO_SHARE_FOLDER)
3178 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3179 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3180 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3181 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3182 AC_SUBST(LIBO_URE_BIN_FOLDER)
3183 AC_SUBST(LIBO_URE_ETC_FOLDER)
3184 AC_SUBST(LIBO_URE_LIB_FOLDER)
3185 AC_SUBST(LIBO_URE_MISC_FOLDER)
3186 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3188 dnl ===================================================================
3189 dnl Windows specific tests and stuff
3190 dnl ===================================================================
3192 # Get a value from the 32-bit side of the Registry
3193 reg_get_value_32()
3195     # Return value: $regvalue
3196     unset regvalue
3197     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3199     if test $? -eq 0; then
3200         regvalue=$_regvalue
3201     fi
3204 # Get a value from the 64-bit side of the Registry
3205 reg_get_value_64()
3207     # Return value: $regvalue
3208     unset regvalue
3209     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3211     if test $? -eq 0; then
3212         regvalue=$_regvalue
3213     fi
3216 if test "$_os" = "WINNT"; then
3217     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3218     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3219         AC_MSG_RESULT([no])
3220         WINDOWS_SDK_ARCH="x86"
3221     else
3222         AC_MSG_RESULT([yes])
3223         WINDOWS_SDK_ARCH="x64"
3224         BITNESS_OVERRIDE=64
3225     fi
3228 if test "$cross_compiling" = "yes"; then
3229     export CROSS_COMPILING=TRUE
3230     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3231 else
3232     CROSS_COMPILING=
3233     BUILD_TYPE="$BUILD_TYPE NATIVE"
3235 AC_SUBST(CROSS_COMPILING)
3237 dnl ===================================================================
3238 dnl  Is GCC actually Clang?
3239 dnl ===================================================================
3241 COM_GCC_IS_CLANG=
3242 if test "$GCC" = "yes"; then
3243     AC_MSG_CHECKING([whether GCC is actually Clang])
3244     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3245         #ifndef __clang__
3246         you lose
3247         #endif
3248         int foo=42;
3249         ]])],
3250         [AC_MSG_RESULT([yes])
3251          COM_GCC_IS_CLANG=TRUE],
3252         [AC_MSG_RESULT([no])])
3254     if test "$COM_GCC_IS_CLANG" = TRUE; then
3255         AC_MSG_CHECKING([the Clang version])
3256         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3257         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3258         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3259         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3260         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3261     fi
3263 AC_SUBST(COM_GCC_IS_CLANG)
3265 if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
3266     if test -z "$CCACHE_CPP2"; then
3267         AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3268         add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3269     fi
3272 dnl ===================================================================
3273 dnl  Test the gcc version
3274 dnl ===================================================================
3275 if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
3276     AC_MSG_CHECKING([the GCC version])
3277     _gcc_version=`$CC -dumpversion`
3278     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3280     AC_MSG_RESULT([gcc $_gcc_version])
3282     if test "$GCC_VERSION" -lt 0406; then
3283         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.6.0])
3284     fi
3285 else
3286     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3287     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3288     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3289     # (which reports itself as GCC 4.2.1).
3290     GCC_VERSION=
3292 AC_SUBST(GCC_VERSION)
3294 # ===================================================================
3295 # check various GCC options that Clang does not support now but maybe
3296 # will somewhen in the future, check them even for GCC, so that the
3297 # flags are set
3298 # ===================================================================
3300 HAVE_GCC_GGDB2=
3301 HAVE_GCC_FINLINE_LIMIT=
3302 HAVE_GCC_FNO_INLINE=
3303 if test "$GCC" = "yes"; then
3304     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3305     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3306         # Option just ignored and silly warning that isn't a real
3307         # warning printed
3308         :
3309     else
3310         save_CFLAGS=$CFLAGS
3311         CFLAGS="$CFLAGS -Werror -ggdb2"
3312         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3313         CFLAGS=$save_CFLAGS
3314     fi
3315     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3316         AC_MSG_RESULT([yes])
3317     else
3318         AC_MSG_RESULT([no])
3319     fi
3321     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3322     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3323         # As above
3324         :
3325     else
3326         save_CFLAGS=$CFLAGS
3327         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3328         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3329         CFLAGS=$save_CFLAGS
3330     fi
3331     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3332         AC_MSG_RESULT([yes])
3333     else
3334         AC_MSG_RESULT([no])
3335     fi
3337     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3338     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3339         # Ditto
3340         :
3341     else
3342         save_CFLAGS=$CFLAGS
3343         CFLAGS="$CFLAGS -Werror -fno-inline"
3344         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3345         CFLAGS=$save_CFLAGS
3346     fi
3347     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3348         AC_MSG_RESULT([yes])
3349     else
3350         AC_MSG_RESULT([no])
3351     fi
3353 AC_SUBST(HAVE_GCC_GGDB2)
3354 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3355 AC_SUBST(HAVE_GCC_FNO_INLINE)
3357 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3358 if test "$GCC" = "yes"; then
3359     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3360     bsymbolic_functions_ldflags_save=$LDFLAGS
3361     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3362     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3363 #include <stdio.h>
3364         ],[
3365 printf ("hello world\n");
3366         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3367     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3368         AC_MSG_RESULT( found )
3369     else
3370         AC_MSG_RESULT( not found )
3371     fi
3372     LDFLAGS=$bsymbolic_functions_ldflags_save
3374 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3376 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3377 # NOTE: must _not_ be used for bundled external libraries!
3378 ISYSTEM=
3379 if test "$GCC" = "yes"; then
3380     AC_MSG_CHECKING( for -isystem )
3381     save_CFLAGS=$CFLAGS
3382     CFLAGS="$CFLAGS -Werror"
3383     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3384     CFLAGS=$save_CFLAGS
3385     if test -n "$ISYSTEM"; then
3386         AC_MSG_RESULT(yes)
3387     else
3388         AC_MSG_RESULT(no)
3389     fi
3391 if test -z "$ISYSTEM"; then
3392     # fall back to using -I
3393     ISYSTEM=-I
3395 AC_SUBST(ISYSTEM)
3397 dnl ===================================================================
3398 dnl  Check which Visual Studio or MinGW compiler is used
3399 dnl ===================================================================
3401 map_vs_year_to_version()
3403     # Return value: $vsversion
3405     unset vsversion
3407     case $1 in
3408     2013)
3409         vsversion=12.0;;
3410     *)
3411         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3412     esac
3415 vs_versions_to_check()
3417     # Args: $1 (optional) : versions to check, in the order of preference
3418     # Return value: $vsversions
3420     unset vsversions
3422     if test -n "$1"; then
3423         map_vs_year_to_version "$1"
3424         vsversions=$vsversion
3425     else
3426         # By default we prefer 2013
3427         vsversions=12.0
3428     fi
3431 find_msvs()
3433     # Find Visual Studio 2013
3434     # Args: $1 (optional) : versions to check, in the order of preference
3435     # Return value: $vstest
3437     unset vstest
3439     vs_versions_to_check "$1"
3441     for ver in $vsversions; do
3442         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3443         if test -n "$regvalue"; then
3444             vstest=$regvalue
3445             break
3446         fi
3447         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3448         if test -n "$regvalue"; then
3449             vstest=$regvalue
3450             break
3451         fi
3452     done
3455 find_msvc()
3457     # Find Visual C++ 2013
3458     # Args: $1 (optional) : The VS version year
3459     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3461     unset vctest vcnum vcnumwithdot vcexpress
3463     vs_versions_to_check "$1"
3465     for ver in $vsversions; do
3466         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3467         if test -n "$regvalue"; then
3468             vctest=$regvalue
3469             break
3470         fi
3471         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3472         if test -n "$regvalue"; then
3473             vctest=$regvalue
3474             break
3475         fi
3476     done
3477     if test -n "$vctest"; then
3478         vcnumwithdot=$ver
3479         case "$vcnumwithdot" in
3480         12.0)
3481             vcyear=2013
3482             vcnum=120
3483             ;;
3484         esac
3485         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$vcnumwithdot/Setup/VC/ProductDir
3486         if test -n "$regvalue" -a "$regvalue" = "$vctest" ; then
3487             vcexpress=Express
3488         fi
3489     fi
3492 SHOWINCLUDES_PREFIX=
3493 MSBUILD_PATH=
3494 if test "$_os" = "WINNT"; then
3495     if test "$WITH_MINGW" != "yes"; then
3496         AC_MSG_CHECKING([Visual C++])
3498         find_msvc "$with_visual_studio"
3500         if test -z "$vctest"; then
3501             if test -n "$with_visual_studio"; then
3502                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3503             else
3504                 AC_MSG_ERROR([No Visual Studio 2013 installation found])
3505             fi
3506         fi
3508         if test "$BITNESS_OVERRIDE" = ""; then
3509             if test -f "$vctest/bin/cl.exe"; then
3510                 VC_PRODUCT_DIR=$vctest
3511             else
3512                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3513             fi
3514         else
3515             if test -f "$vctest/bin/amd64/cl.exe"; then
3516                 VC_PRODUCT_DIR=$vctest
3517             else
3518                 if test -f "$vctest/bin/x86_amd64/cl.exe" -a "$vcexpress" = "Express"; then
3519                     VC_PRODUCT_DIR=$vctest
3520                 else
3521                     AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3522                 fi
3523             fi
3524         fi
3526         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3527         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3529         AC_MSG_CHECKING([Is Visual C++ Express])
3530         if test "$vcexpress" = "Express" ; then
3531             AC_MSG_RESULT([Yes])
3532         else
3533             AC_MSG_RESULT([No])
3534         fi
3536         # Find the proper version of MSBuild.exe to use based on the VS version
3537         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3538         if test -n "$regvalue" ; then
3539             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3540         fi
3542         dnl ===========================================================
3543         dnl  Check for the corresponding mspdb*.dll
3544         dnl ===========================================================
3546         MSPDB_PATH=
3548         if test "$BITNESS_OVERRIDE" = ""; then
3549             if test "$vcnum" = "120"; then
3550                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3551             else
3552                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3553             fi
3554         else
3555             if test "$vcexpress" = "Express"; then
3556                 MSPDB_PATH="$VC_PRODUCT_DIR/bin"
3557             else
3558                 MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3559             fi
3560         fi
3562         mspdbnum=$vcnum
3564         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3565             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3566         fi
3568         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3569         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3571         dnl The path needs to be added before cl is called
3572         PATH="$MSPDB_PATH:$PATH"
3574         AC_MSG_CHECKING([cl.exe])
3576         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3577         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3578         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3579         # is not enough?
3581         if test -z "$CC"; then
3582             if test "$BITNESS_OVERRIDE" = ""; then
3583                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3584                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3585                 fi
3586             else
3587                 if test "$vcexpress" = "Express"; then
3588                    if test -f "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"; then
3589                         CC="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3590                    fi
3591                 else
3592                    if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3593                         CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3594                    fi
3595                 fi
3596             fi
3598             # This gives us a posix path with 8.3 filename restrictions
3599             CC=`win_short_path_for_make "$CC"`
3600         fi
3602         if test -n "$CC"; then
3603             # Remove /cl.exe from CC case insensitive
3604             AC_MSG_RESULT([found Visual C++ $vcyear $vcexpress ($CC)])
3605             if test "$BITNESS_OVERRIDE" = ""; then
3606                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3607             else
3608                 if test -n "$VC_PRODUCT_DIR"; then
3609                     # Huh, why not just an assignment?
3610                     COMPATH=`echo $VC_PRODUCT_DIR`
3611                 fi
3612             fi
3613             if test "$BITNESS_OVERRIDE" = ""; then
3614                 dnl since MSVC 2012, default for x86 is -arch:SSE2:
3615                 CC="$CC -arch:SSE"
3616             fi
3617             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3619             PathFormat "$COMPATH"
3620             COMPATH="$formatted_path"
3622             VCVER=$vcnum
3623             MSVSVER=$vcyear
3625             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3626             # are always "better", we list them in reverse chronological order.
3628             case $vcnum in
3629             120)
3630                 COMEX=15
3631                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0 7.1A"
3632                 ;;
3633             esac
3635             # The expectation is that --with-windows-sdk should not need to be used
3636             if test -n "$with_windows_sdk"; then
3637                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3638                 *" "$with_windows_sdk" "*)
3639                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3640                     ;;
3641                 *)
3642                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3643                     ;;
3644                 esac
3645             fi
3647             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3648             ac_objext=obj
3649             ac_exeext=exe
3651         else
3652             AC_MSG_ERROR([Visual C++ not found after all, huh])
3653         fi
3655         dnl We need to guess the prefix of the -showIncludes output, it can be
3656         dnl localized
3657         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3658         echo "#include <stdlib.h>" > conftest.c
3659         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3660             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3661         rm -f conftest.c conftest.obj
3662         if test -z "$SHOWINCLUDES_PREFIX"; then
3663             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3664         else
3665             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3666         fi
3668         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3669         # version of the Explorer extension (and maybe other small
3670         # bits, too) needed when installing a 32-bit LibreOffice on a
3671         # 64-bit OS. The 64-bit Explorer extension is a feature that
3672         # has been present since long in OOo. Don't confuse it with
3673         # building LibreOffice itself as 64-bit code, which is
3674         # unfinished work and highly experimental.
3676         BUILD_X64=
3677         CXX_X64_BINARY=
3678         LINK_X64_BINARY=
3680         if test "$BITNESS_OVERRIDE" = ""; then
3681             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3682             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3683                 # Prefer native x64 compiler to cross-compiler, in case we are running
3684                 # the build on a 64-bit OS.
3685                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3686                     BUILD_X64=TRUE
3687                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3688                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3689                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3690                     BUILD_X64=TRUE
3691                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3692                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3693                 fi
3694             fi
3695             if test "$BUILD_X64" = TRUE; then
3696                 AC_MSG_RESULT([found])
3697             else
3698                 AC_MSG_RESULT([not found])
3699                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3700             fi
3701         fi
3702         AC_SUBST(BUILD_X64)
3704         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3705         AC_SUBST(CXX_X64_BINARY)
3706         AC_SUBST(LINK_X64_BINARY)
3707     else
3708         AC_MSG_CHECKING([the compiler is MinGW])
3709         MACHINE_PREFIX=`$CC -dumpmachine`
3710         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3711             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3712             AC_MSG_RESULT([yes])
3713         else
3714             AC_MSG_ERROR([Compiler is not MinGW.])
3715         fi
3716     fi
3718 AC_SUBST(VCVER)
3719 PathFormat "$MSPDB_PATH"
3720 MSPDB_PATH="$formatted_path"
3721 AC_SUBST(SHOWINCLUDES_PREFIX)
3723 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3724     AC_MSG_CHECKING([whether to use DirectX])
3725     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3726         ENABLE_DIRECTX="TRUE"
3727         AC_MSG_RESULT([yes])
3728     else
3729         ENABLE_DIRECTX=""
3730         AC_MSG_RESULT([no])
3731     fi
3733     AC_MSG_CHECKING([whether to use ActiveX])
3734     if test "$enable_activex" = "yes" -o "$enable_activex" = "" -a "$vcexpress" != Express; then
3735         DISABLE_ACTIVEX=""
3736         AC_MSG_RESULT([yes])
3737     else
3738         DISABLE_ACTIVEX="TRUE"
3739         AC_MSG_RESULT([no])
3740     fi
3742     AC_MSG_CHECKING([whether to use ATL])
3743     if test "$enable_atl" = "yes" -o "$enable_atl" = "" -a "$vcexpress" != Express; then
3744         DISABLE_ATL=""
3745         AC_MSG_RESULT([yes])
3746     else
3747         DISABLE_ATL="TRUE"
3748         AC_MSG_RESULT([no])
3749     fi
3750 else
3751     ENABLE_DIRECTX=""
3752     DISABLE_ACTIVEX="TRUE"
3753     DISABLE_ATL="TRUE"
3756 AC_SUBST(ENABLE_DIRECTX)
3757 AC_SUBST(DISABLE_ACTIVEX)
3758 AC_SUBST(DISABLE_ATL)
3761 # dbghelp.dll
3763 if test "$_os" = "WINNT"; then
3764     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3768 # unowinreg.dll
3770 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3771 AC_SUBST(UNOWINREG_DLL)
3774 # prefix C with ccache if needed
3776 if test "$CCACHE" != ""; then
3777     AC_MSG_CHECKING([whether $CC is already ccached])
3779     AC_LANG_PUSH([C])
3780     save_CFLAGS=$CFLAGS
3781     CFLAGS="$CFLAGS --ccache-skip -O2"
3782     dnl an empty program will do, we're checking the compiler flags
3783     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3784                       [use_ccache=yes], [use_ccache=no])
3785     if test $use_ccache = yes; then
3786         AC_MSG_RESULT([yes])
3787     else
3788         CC="$CCACHE $CC"
3789         AC_MSG_RESULT([no])
3790     fi
3791     CFLAGS=$save_CFLAGS
3792     AC_LANG_POP([C])
3795 dnl Set the ENABLE_DBGUTIL variable
3796 dnl ===================================================================
3797 AC_MSG_CHECKING([whether to build with additional debug utilities])
3798 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3799     ENABLE_DBGUTIL="TRUE"
3800     # this is an extra var so it can have different default on different MSVC
3801     # versions (in case there are version specific problems with it)
3802     MSVC_USE_DEBUG_RUNTIME="TRUE"
3804     AC_MSG_RESULT([yes])
3805     # cppunit and graphite expose STL in public headers
3806     if test "$with_system_cppunit" = "yes"; then
3807         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3808     else
3809         with_system_cppunit=no
3810     fi
3811     if test "$with_system_graphite" = "yes"; then
3812         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3813     else
3814         with_system_graphite=no
3815     fi
3816     if test "$with_system_mysql_cppconn" = "yes"; then
3817         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3818     else
3819         with_system_mysql_cppconn=no
3820     fi
3821     if test "$with_system_orcus" = "yes"; then
3822         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3823     else
3824         with_system_orcus=no
3825     fi
3826     if test "$with_system_libcmis" = "yes"; then
3827         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3828     else
3829         with_system_libcmis=no
3830     fi
3831     if test "$with_system_libgltf" = "yes"; then
3832         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3833     else
3834         with_system_libgltf=no
3835     fi
3836     if test "$enable_win_mozab_driver" = "yes"; then
3837         AC_MSG_ERROR([--enable-win-mozab-driver conflicts with --enable-dbgutil])
3838     fi
3839 else
3840     ENABLE_DBGUTIL=""
3841     MSVC_USE_DEBUG_RUNTIME=""
3842     AC_MSG_RESULT([no])
3844 AC_SUBST(ENABLE_DBGUTIL)
3845 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3847 dnl Set the ENABLE_DEBUG variable.
3848 dnl ===================================================================
3849 AC_MSG_CHECKING([whether to do a debug build])
3850 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3851     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3853 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3854     AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3857 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3858     ENABLE_DEBUG="TRUE"
3859     if test -n "$ENABLE_DBGUTIL" ; then
3860         AC_MSG_RESULT([yes (dbgutil)])
3861     else
3862         AC_MSG_RESULT([yes])
3863     fi
3864 else
3865     ENABLE_DEBUG=""
3866     AC_MSG_RESULT([no])
3868 AC_SUBST(ENABLE_DEBUG)
3870 if test "$enable_sal_log" = yes; then
3871     ENABLE_SAL_LOG=TRUE
3873 AC_SUBST(ENABLE_SAL_LOG)
3875 dnl Selective debuginfo
3876 ENABLE_DEBUGINFO_FOR=
3877 if test -n "$ENABLE_DEBUG"; then
3878     AC_MSG_CHECKING([whether to use selective debuginfo])
3879     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3880         if test "$enable_selective_debuginfo" = "yes"; then
3881             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3882         fi
3883         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3884         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3885     else
3886         ENABLE_DEBUGINFO_FOR=all
3887         AC_MSG_RESULT([no, for all])
3888     fi
3890 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3892 dnl Check for enable symbols option
3893 dnl ===================================================================
3894 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3895 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3896     ENABLE_SYMBOLS="TRUE"
3897     if test -n "$ENABLE_DBGUTIL"; then
3898         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3899     elif test -n "$ENABLE_DEBUG"; then
3900         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3901     fi
3902     AC_MSG_RESULT([yes])
3903 else
3904     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3905         ENABLE_SYMBOLS="FALSE"
3906     else
3907         ENABLE_SYMBOLS=
3908     fi
3909     AC_MSG_RESULT([no])
3911 AC_SUBST(ENABLE_SYMBOLS)
3913 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3914     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3915     AC_MSG_CHECKING([whether enough memory is available for linking])
3916     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3917     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3918     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3919         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3920     else
3921         AC_MSG_RESULT([yes])
3922     fi
3925 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3926 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3927 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3928 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3929 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3930     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
3932 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
3934 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3935 # By default use the ones specified by our build system,
3936 # but explicit override is possible.
3937 AC_MSG_CHECKING(for explicit AFLAGS)
3938 if test -n "$AFLAGS"; then
3939     AC_MSG_RESULT([$AFLAGS])
3940     x_AFLAGS=
3941 else
3942     AC_MSG_RESULT(no)
3943     x_AFLAGS=[\#]
3945 AC_MSG_CHECKING(for explicit CFLAGS)
3946 if test -n "$CFLAGS"; then
3947     AC_MSG_RESULT([$CFLAGS])
3948     x_CFLAGS=
3949 else
3950     AC_MSG_RESULT(no)
3951     x_CFLAGS=[\#]
3953 AC_MSG_CHECKING(for explicit CXXFLAGS)
3954 if test -n "$CXXFLAGS"; then
3955     AC_MSG_RESULT([$CXXFLAGS])
3956     x_CXXFLAGS=
3957 else
3958     AC_MSG_RESULT(no)
3959     x_CXXFLAGS=[\#]
3961 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3962 if test -n "$OBJCFLAGS"; then
3963     AC_MSG_RESULT([$OBJCFLAGS])
3964     x_OBJCFLAGS=
3965 else
3966     AC_MSG_RESULT(no)
3967     x_OBJCFLAGS=[\#]
3969 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
3970 if test -n "$OBJCXXFLAGS"; then
3971     AC_MSG_RESULT([$OBJCXXFLAGS])
3972     x_OBJCXXFLAGS=
3973 else
3974     AC_MSG_RESULT(no)
3975     x_OBJCXXFLAGS=[\#]
3977 AC_MSG_CHECKING(for explicit LDFLAGS)
3978 if test -n "$LDFLAGS"; then
3979     AC_MSG_RESULT([$LDFLAGS])
3980     x_LDFLAGS=
3981 else
3982     AC_MSG_RESULT(no)
3983     x_LDFLAGS=[\#]
3985 AC_SUBST(AFLAGS)
3986 AC_SUBST(CFLAGS)
3987 AC_SUBST(CXXFLAGS)
3988 AC_SUBST(OBJCFLAGS)
3989 AC_SUBST(OBJCXXFLAGS)
3990 AC_SUBST(LDFLAGS)
3991 AC_SUBST(x_AFLAGS)
3992 AC_SUBST(x_CFLAGS)
3993 AC_SUBST(x_CXXFLAGS)
3994 AC_SUBST(x_OBJCFLAGS)
3995 AC_SUBST(x_OBJCXXFLAGS)
3996 AC_SUBST(x_LDFLAGS)
3999 # determine CPUNAME, GUIBASE, ...
4001 SOLARINC=
4003 case "$host_os" in
4005 aix*)
4006     COM=GCC
4007     CPUNAME=POWERPC
4008     GUIBASE=unx
4009     OS=AIX
4010     RTL_OS=AIX
4011     RTL_ARCH=PowerPC
4012     PLATFORMID=aix_powerpc
4013     P_SEP=:
4014     ;;
4016 cygwin*)
4017     COM=MSC
4018     GUIBASE=not-used
4019     OS=WNT
4020     RTL_OS=Windows
4021     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4022         P_SEP=";"
4023     else
4024         P_SEP=:
4025     fi
4026     case "$host_cpu" in
4027     i*86|x86_64)
4028         if test "$BITNESS_OVERRIDE" = 64; then
4029             CPUNAME=X86_64
4030             RTL_ARCH=X86_64
4031             PLATFORMID=windows_x86_64
4032             WINDOWS_X64=1
4033             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4034         else
4035             CPUNAME=INTEL
4036             RTL_ARCH=x86
4037             PLATFORMID=windows_x86
4038         fi
4039         ;;
4040     *)
4041         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4042         ;;
4043     esac
4044     SCPDEFS="$SCPDEFS -D_MSC_VER"
4045     ;;
4047 darwin*)
4048     COM=GCC
4049     GUIBASE=not-used
4050     OS=MACOSX
4051     RTL_OS=MacOSX
4052     P_SEP=:
4054     case "$host_cpu" in
4055     arm*)
4056         CPUNAME=ARM
4057         RTL_ARCH=ARM_EABI
4058         PLATFORMID=ios_arm
4059         OS=IOS
4060         ;;
4061     i*86)
4062         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4063         ;;
4064     x86_64)
4065         CPUNAME=X86_64
4066         RTL_ARCH=X86_64
4067         PLATFORMID=macosx_x86_64
4068         ;;
4069     *)
4070         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4071         ;;
4072     esac
4073     ;;
4075 dragonfly*)
4076     COM=GCC
4077     GUIBASE=unx
4078     OS=DRAGONFLY
4079     RTL_OS=DragonFly
4080     P_SEP=:
4082     case "$host_cpu" in
4083     i*86)
4084         CPUNAME=INTEL
4085         RTL_ARCH=x86
4086         PLATFORMID=dragonfly_x86
4087         ;;
4088     x86_64)
4089         CPUNAME=X86_64
4090         RTL_ARCH=X86_64
4091         PLATFORMID=dragonfly_x86_64
4092         ;;
4093     *)
4094         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4095         ;;
4096     esac
4097     ;;
4099 freebsd*)
4100     COM=GCC
4101     GUIBASE=unx
4102     RTL_OS=FreeBSD
4103     OS=FREEBSD
4104     P_SEP=:
4106     case "$host_cpu" in
4107     i*86)
4108         CPUNAME=INTEL
4109         RTL_ARCH=x86
4110         PLATFORMID=freebsd_x86
4111         ;;
4112     x86_64|amd64)
4113         CPUNAME=X86_64
4114         RTL_ARCH=X86_64
4115         PLATFORMID=freebsd_x86_64
4116         ;;
4117     *)
4118         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4119         ;;
4120     esac
4121     ;;
4123 kfreebsd*)
4124     COM=GCC
4125     GUIBASE=unx
4126     OS=LINUX
4127     RTL_OS=kFreeBSD
4128     P_SEP=:
4130     case "$host_cpu" in
4132     i*86)
4133         CPUNAME=INTEL
4134         RTL_ARCH=x86
4135         PLATFORMID=kfreebsd_x86
4136         ;;
4137     x86_64)
4138         CPUNAME=X86_64
4139         RTL_ARCH=X86_64
4140         PLATFORMID=kfreebsd_x86_64
4141         ;;
4142     *)
4143         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4144         ;;
4145     esac
4146     ;;
4148 linux-gnu*)
4149     COM=GCC
4150     GUIBASE=unx
4151     OS=LINUX
4152     RTL_OS=Linux
4153     P_SEP=:
4155     case "$host_cpu" in
4157     aarch64)
4158         CPUNAME=AARCH64
4159         PLATFORMID=linux_aarch64
4160         RTL_ARCH=AARCH64
4161         ;;
4162     alpha)
4163         CPUNAME=AXP
4164         RTL_ARCH=ALPHA
4165         PLATFORMID=linux_alpha
4166         ;;
4167     arm*)
4168         CPUNAME=ARM
4169         EPM_FLAGS="-a arm"
4170         RTL_ARCH=ARM_EABI
4171         PLATFORMID=linux_arm_eabi
4172         case "$host_cpu" in
4173         arm*-linux)
4174             RTL_ARCH=ARM_OABI
4175             PLATFORMID=linux_arm_oabi
4176             ;;
4177         esac
4178         ;;
4179     hppa)
4180         CPUNAME=HPPA
4181         RTL_ARCH=HPPA
4182         EPM_FLAGS="-a hppa"
4183         PLATFORMID=linux_hppa
4184         ;;
4185     i*86)
4186         CPUNAME=INTEL
4187         RTL_ARCH=x86
4188         PLATFORMID=linux_x86
4189         ;;
4190     ia64)
4191         CPUNAME=IA64
4192         RTL_ARCH=IA64
4193         PLATFORMID=linux_ia64
4194         ;;
4195     mips)
4196         CPUNAME=GODSON
4197         RTL_ARCH=MIPS_EB
4198         EPM_FLAGS="-a mips"
4199         PLATFORMID=linux_mips_eb
4200         ;;
4201     mips64)
4202         CPUNAME=GODSON
4203         RTL_ARCH=MIPS_EB
4204         EPM_FLAGS="-a mips64"
4205         PLATFORMID=linux_mips_eb
4206         ;;
4207     mips64el)
4208         CPUNAME=GODSON
4209         RTL_ARCH=MIPS_EL
4210         EPM_FLAGS="-a mips64el"
4211         PLATFORMID=linux_mips_el
4212         ;;
4213     mipsel)
4214         CPUNAME=GODSON
4215         RTL_ARCH=MIPS_EL
4216         EPM_FLAGS="-a mipsel"
4217         PLATFORMID=linux_mips_el
4218         ;;
4219     m68k)
4220         CPUNAME=M68K
4221         RTL_ARCH=M68K
4222         PLATFORMID=linux_m68k
4223         ;;
4224     powerpc)
4225         CPUNAME=POWERPC
4226         RTL_ARCH=PowerPC
4227         PLATFORMID=linux_powerpc
4228         ;;
4229     powerpc64)
4230         CPUNAME=POWERPC64
4231         RTL_ARCH=PowerPC_64
4232         PLATFORMID=linux_powerpc64
4233         ;;
4234     powerpc64le)
4235         CPUNAME=POWERPC64
4236         RTL_ARCH=PowerPC_64_LE
4237         PLATFORMID=linux_powerpc64_le
4238         ;;
4239     sparc)
4240         CPUNAME=SPARC
4241         RTL_ARCH=SPARC
4242         PLATFORMID=linux_sparc
4243         ;;
4244     s390)
4245         CPUNAME=S390
4246         RTL_ARCH=S390
4247         PLATFORMID=linux_s390
4248         ;;
4249     s390x)
4250         CPUNAME=S390X
4251         RTL_ARCH=S390x
4252         PLATFORMID=linux_s390x
4253         ;;
4254     x86_64)
4255         CPUNAME=X86_64
4256         RTL_ARCH=X86_64
4257         PLATFORMID=linux_x86_64
4258         ;;
4259     *)
4260         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4261         ;;
4262     esac
4263     ;;
4265 linux-android*)
4266     COM=GCC
4267     GUIBASE=not-used
4268     OS=ANDROID
4269     RTL_OS=Android
4270     P_SEP=:
4272     case "$host_cpu" in
4274     arm|armel)
4275         CPUNAME=ARM
4276         RTL_ARCH=ARM_EABI
4277         PLATFORMID=android_arm_eabi
4278         ;;
4279     aarch64)
4280         CPUNAME=AARCH64
4281         RTL_ARCH=AARCH64
4282         PLATFORMID=android_aarch64
4283         ;;
4284     mips|mipsel)
4285         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4286         RTL_ARCH=MIPS_EL
4287         PLATFORMID=android_mips_el
4288         ;;
4289     i*86)
4290         CPUNAME=INTEL
4291         RTL_ARCH=x86
4292         PLATFORMID=android_x86
4293         ;;
4294     *)
4295         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4296         ;;
4297     esac
4298     ;;
4300 mingw*)
4301     COM=GCC
4302     GUIBASE=not-used
4303     OS=WNT
4304     RTL_OS=Windows
4305     P_SEP=:
4307     case "$host_cpu" in
4308     i*86|x86_64)
4309         if test "$BITNESS_OVERRIDE" = 64; then
4310             CPUNAME=X86_64
4311             RTL_ARCH=X86_84
4312             PLATFORMID=windows_x86_64
4313             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4314         else
4315             CPUNAME=INTEL
4316             RTL_ARCH=x86
4317             PLATFORMID=windows_x86
4318             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4319         fi
4320         ;;
4321     *)
4322         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4323         ;;
4324     esac
4325     ;;
4327 *netbsd*)
4329     COM=GCC
4330     GUIBASE=unx
4331     OS=NETBSD
4332     RTL_OS=NetBSD
4333     P_SEP=:
4335     case "$host_cpu" in
4336     i*86)
4337         CPUNAME=INTEL
4338         RTL_ARCH=x86
4339         PLATFORMID=netbsd_x86
4340         ;;
4341     powerpc)
4342         CPUNAME=POWERPC
4343         RTL_ARCH=PowerPC
4344         PLATFORMID=netbsd_powerpc
4345         ;;
4346     sparc)
4347         CPUNAME=SPARC
4348         RTL_ARCH=SPARC
4349         PLATFORMID=netbsd_sparc
4350         ;;
4351     x86_64)
4352         CPUNAME=X86_64
4353         RTL_ARCH=X86_64
4354         PLATFORMID=netbsd_x86_64
4355         ;;
4356     *)
4357         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4358         ;;
4359     esac
4360     ;;
4362 openbsd*)
4363     COM=GCC
4364     GUIBASE=unx
4365     OS=OPENBSD
4366     RTL_OS=OpenBSD
4367     P_SEP=:
4369     case "$host_cpu" in
4370     i*86)
4371         CPUNAME=INTEL
4372         RTL_ARCH=x86
4373         PLATFORMID=openbsd_x86
4374         ;;
4375     x86_64)
4376         CPUNAME=X86_64
4377         RTL_ARCH=X86_64
4378         PLATFORMID=openbsd_x86_64
4379         ;;
4380     *)
4381         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4382         ;;
4383     esac
4384     SOLARINC="$SOLARINC -I/usr/local/include"
4385     ;;
4387 solaris*)
4389     COM=GCC
4390     GUIBASE=unx
4391     OS=SOLARIS
4392     RTL_OS=Solaris
4393     P_SEP=:
4395     case "$host_cpu" in
4396     i*86)
4397         CPUNAME=INTEL
4398         RTL_ARCH=x86
4399         PLATFORMID=solaris_x86
4400         ;;
4401     sparc)
4402         CPUNAME=SPARC
4403         RTL_ARCH=SPARC
4404         PLATFORMID=solaris_sparc
4405         ;;
4406     sparc64)
4407         CPUNAME=SPARC64
4408         RTL_ARCH=SPARC64
4409         PLATFORMID=solaris_sparc64
4410         ;;
4411     *)
4412         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4413         ;;
4414     esac
4415     SOLARINC="$SOLARINC -I/usr/local/include"
4416     ;;
4419     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4420     ;;
4421 esac
4423 if test "$with_x" = "no"; then
4424     if test "$GUIBASE" != "unx"; then
4425         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --without-x])
4426     fi
4427     GUIBASE=not-used
4430 WORKDIR="${BUILDDIR}/workdir"
4431 INSTDIR="${BUILDDIR}/instdir"
4432 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4433 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4434 AC_SUBST(COM)
4435 AC_SUBST(CPUNAME)
4436 AC_SUBST(RTL_OS)
4437 AC_SUBST(RTL_ARCH)
4438 AC_SUBST(EPM_FLAGS)
4439 AC_SUBST(GUIBASE)
4440 AC_SUBST([INSTDIR])
4441 AC_SUBST([INSTROOT])
4442 AC_SUBST(OS)
4443 AC_SUBST(P_SEP)
4444 AC_SUBST(WORKDIR)
4445 AC_SUBST(PLATFORMID)
4446 AC_SUBST(WINDOWS_X64)
4447 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4449 dnl ===================================================================
4450 dnl Test which package format to use
4451 dnl ===================================================================
4452 AC_MSG_CHECKING([which package format to use])
4453 if test -n "$with_package_format" -a "$with_package_format" != no; then
4454     for i in $with_package_format; do
4455         case "$i" in
4456         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4457             ;;
4458         *)
4459             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4460 aix - AIX software distribution
4461 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4462 deb - Debian software distribution
4463 pkg - Solaris software distribution
4464 rpm - RedHat software distribution
4466 LibreOffice additionally supports:
4467 archive - .tar.gz or .zip
4468 dmg - Mac OS X .dmg
4469 installed - installation tree
4470 msi - Windows .msi
4471         ])
4472             ;;
4473         esac
4474     done
4475     PKGFORMAT="$with_package_format"
4476     AC_MSG_RESULT([$PKGFORMAT])
4477 else
4478     PKGFORMAT=
4479     AC_MSG_RESULT([none])
4481 AC_SUBST(PKGFORMAT)
4483 dnl ===================================================================
4484 dnl Set up a different compiler to produce tools to run on the build
4485 dnl machine when doing cross-compilation
4486 dnl ===================================================================
4488 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4489 if test "$cross_compiling" = "yes"; then
4490     AC_MSG_CHECKING([for BUILD platform configuration])
4491     echo
4492     rm -rf CONF-FOR-BUILD config_build.mk
4493     mkdir CONF-FOR-BUILD
4494     # Here must be listed all files needed when running the configure script. In particular, also
4495     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4496     # keep them in the same order as there.
4497     (cd $SRC_ROOT && tar cf - \
4498         config.guess \
4499         bin/get_config_variables \
4500         solenv/bin/getcompver.awk \
4501         solenv/inc/langlist.mk \
4502         config_host.mk.in \
4503         config_host_lang.mk.in \
4504         Makefile.in \
4505         lo.xcent.in \
4506         instsetoo_native/util/openoffice.lst.in \
4507         config_host/*.in \
4508         sysui/desktop/macosx/Info.plist.in \
4509         ios/lo.xcconfig.in) \
4510     | (cd CONF-FOR-BUILD && tar xf -)
4511     cp configure CONF-FOR-BUILD
4512     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4513     (
4514     unset COM GUIBASE OS CPUNAME
4515     unset CC CXX SYSBASE CFLAGS
4516     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4517     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4518     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4519     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4520     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4521     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4522     cd CONF-FOR-BUILD
4523     sub_conf_opts=""
4524     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4525     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4526     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4527     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4528     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4529     # we need the msi build tools on mingw if we are creating the
4530     # installation set
4531     if test "$WITH_MINGW" = "yes"; then
4532         enable_winegcc_for_build=
4533         for pkgformat in $PKGFORMAT; do
4534             case "$pkgformat" in
4535             msi|native) enable_winegcc_for_build=yes ;;
4536             esac
4537         done
4538         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4539     fi
4540     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4541     # Don't bother having configure look for stuff not needed for the build platform anyway
4542     ./configure \
4543         --disable-cups \
4544         --disable-graphite \
4545         --disable-pdfimport \
4546         --disable-postgresql-sdbc \
4547         --with-parallelism="$with_parallelism" \
4548         --without-doxygen \
4549         --without-java \
4550         $sub_conf_opts \
4551         --srcdir=$srcdir \
4552         2>&1 | sed -e 's/^/    /'
4553     test -f ./config_host.mk 2>/dev/null || exit
4554     cp config_host.mk ../config_build.mk
4555     cp config_host_lang.mk ../config_build_lang.mk
4556     mv config.log ../config.Build.log
4557     mkdir -p ../config_build
4558     mv config_host/*.h ../config_build
4559     . ./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
4561     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
4562         VV='$'$V
4563         VV=`eval "echo $VV"`
4564         if test -n "$VV"; then
4565             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4566             echo "$line" >>build-config
4567         fi
4568     done
4570     for V in INSTDIR INSTROOT WORKDIR; do
4571         VV='$'$V
4572         VV=`eval "echo $VV"`
4573         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4574         if test -n "$VV"; then
4575             line="${V}_FOR_BUILD='$VV'"
4576             echo "$line" >>build-config
4577         fi
4578     done
4580     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4581     echo "$line" >>build-config
4583     )
4584     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4585     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])
4586     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4587              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4589     eval `cat CONF-FOR-BUILD/build-config`
4591     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4593     rm -rf CONF-FOR-BUILD
4594 else
4595     OS_FOR_BUILD="$OS"
4596     CC_FOR_BUILD="$CC"
4597     CXX_FOR_BUILD="$CXX"
4598     INSTDIR_FOR_BUILD="$INSTDIR"
4599     INSTROOT_FOR_BUILD="$INSTROOT"
4600     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4601     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4602     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4603     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4604     WORKDIR_FOR_BUILD="$WORKDIR"
4606 AC_SUBST(OS_FOR_BUILD)
4607 AC_SUBST(INSTDIR_FOR_BUILD)
4608 AC_SUBST(INSTROOT_FOR_BUILD)
4609 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4610 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4611 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4612 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4613 AC_SUBST(WORKDIR_FOR_BUILD)
4615 dnl ===================================================================
4616 dnl Check for syslog header
4617 dnl ===================================================================
4618 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4620 # placeholder for future crash reporter feature
4621 ENABLE_CRASHDUMP=""
4622 AC_SUBST(ENABLE_CRASHDUMP)
4624 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4625 dnl ===================================================================
4626 AC_MSG_CHECKING([whether to turn warnings to errors])
4627 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4628     ENABLE_WERROR="TRUE"
4629     AC_MSG_RESULT([yes])
4630 else
4631     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4632         ENABLE_WERROR="TRUE"
4633         AC_MSG_RESULT([yes])
4634     else
4635         AC_MSG_RESULT([no])
4636     fi
4638 AC_SUBST(ENABLE_WERROR)
4640 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4641 dnl ===================================================================
4642 AC_MSG_CHECKING([whether to have assert to abort in release code])
4643 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4644     ASSERT_ALWAYS_ABORT="TRUE"
4645     AC_MSG_RESULT([yes])
4646 else
4647     ASSERT_ALWAYS_ABORT="FALSE"
4648     AC_MSG_RESULT([no])
4650 AC_SUBST(ASSERT_ALWAYS_ABORT)
4652 # Determine whether to use ooenv for the instdir installation
4653 # ===================================================================
4654 if test $_os != "WINNT" -a $_os != "Darwin"; then
4655     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4656     if test "$enable_ooenv" = "no"; then
4657         AC_MSG_RESULT([no])
4658     else
4659         ENABLE_OOENV="TRUE"
4660         AC_MSG_RESULT([yes])
4661     fi
4663 AC_SUBST(ENABLE_OOENV)
4665 if test "$with_x" = "no"; then
4666     # be sure to do not mess with uneeded stuff
4667     test_randr=no
4668     test_xrender=no
4669     test_cups=no
4670     test_dbus=no
4671     test_fontconfig=yes
4672     test_gtk=no
4673     build_gstreamer_1_0=no
4674     build_gstreamer_0_10=no
4675     test_tde=no
4676     test_kde=no
4677     test_kde4=no
4678     enable_cairo_canvas=no
4679     enable_gnome_vfs=no
4682 dnl ===================================================================
4683 dnl check for cups support
4684 dnl ===================================================================
4685 ENABLE_CUPS=""
4687 if test "$enable_cups" = "no"; then
4688     test_cups=no
4691 AC_MSG_CHECKING([whether to enable CUPS support])
4692 if test "$test_cups" = "yes"; then
4693     ENABLE_CUPS="TRUE"
4694     AC_MSG_RESULT([yes])
4696     AC_MSG_CHECKING([whether cups support is present])
4697     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4698     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4699     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4700         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4701     fi
4702     AC_DEFINE(ENABLE_CUPS)
4703 else
4704     AC_MSG_RESULT([no])
4707 AC_SUBST(ENABLE_CUPS)
4709 # fontconfig checks
4710 if test "$test_fontconfig" = "yes"; then
4711     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4712     SYSTEM_FONTCONFIG=TRUE
4714 AC_SUBST(FONTCONFIG_CFLAGS)
4715 AC_SUBST(FONTCONFIG_LIBS)
4716 AC_SUBST([SYSTEM_FONTCONFIG])
4718 dnl whether to find & fetch external tarballs?
4719 dnl ===================================================================
4720 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4721    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4722        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4723    else
4724        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4725    fi
4727 if test -z "$TARFILE_LOCATION"; then
4728     if test -d "$SRC_ROOT/src" ; then
4729         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4730         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4731     fi
4732     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4733 else
4734     AbsolutePath "$TARFILE_LOCATION"
4735     PathFormat "${absolute_path}"
4736     TARFILE_LOCATION="${formatted_path}"
4738 AC_SUBST(TARFILE_LOCATION)
4740 AC_MSG_CHECKING([whether we want to fetch tarballs])
4741 if test "$enable_fetch_external" != "no"; then
4742     if test "$with_all_tarballs" = "yes"; then
4743         AC_MSG_RESULT(["yes, all of them"])
4744         DO_FETCH_TARBALLS="ALL"
4745     else
4746         AC_MSG_RESULT(["yes, if we use them"])
4747         DO_FETCH_TARBALLS="TRUE"
4748     fi
4749 else
4750     AC_MSG_RESULT([no])
4751     DO_FETCH_TARBALLS=
4753 AC_SUBST(DO_FETCH_TARBALLS)
4755 AC_MSG_CHECKING([whether to build help])
4756 HELP_COMMON_ONLY=FALSE
4757 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4758     BUILD_TYPE="$BUILD_TYPE HELP"
4759     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4760     if test "$with_help" = "common" ; then
4761         HELP_COMMON_ONLY=TRUE
4762         AC_MSG_RESULT([common only])
4763     else
4764         SCPDEFS="$SCPDEFS -DWITH_HELP"
4765         AC_MSG_RESULT([yes])
4766     fi
4767 else
4768     AC_MSG_RESULT([no])
4770 AC_SUBST(HELP_COMMON_ONLY)
4772 dnl Test whether to include MySpell dictionaries
4773 dnl ===================================================================
4774 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4775 if test "$with_myspell_dicts" = "yes"; then
4776     AC_MSG_RESULT([yes])
4777     WITH_MYSPELL_DICTS=TRUE
4778     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4779     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4780 else
4781     AC_MSG_RESULT([no])
4782     WITH_MYSPELL_DICTS=
4784 AC_SUBST(WITH_MYSPELL_DICTS)
4786 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4787 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4788     if test "$with_system_dicts" = yes; then
4789         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4790     fi
4791     with_system_dicts=no
4794 AC_MSG_CHECKING([whether to use dicts from external paths])
4795 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4796     AC_MSG_RESULT([yes])
4797     SYSTEM_DICTS=TRUE
4798     AC_MSG_CHECKING([for spelling dictionary directory])
4799     if test -n "$with_external_dict_dir"; then
4800         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4801     else
4802         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4803         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4804             DICT_SYSTEM_DIR=file:///usr/share/myspell
4805         fi
4806     fi
4807     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4808     AC_MSG_CHECKING([for hyphenation patterns directory])
4809     if test -n "$with_external_hyph_dir"; then
4810         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4811     else
4812         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4813     fi
4814     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4815     AC_MSG_CHECKING([for thesaurus directory])
4816     if test -n "$with_external_thes_dir"; then
4817         THES_SYSTEM_DIR=file://$with_external_thes_dir
4818     else
4819         THES_SYSTEM_DIR=file:///usr/share/mythes
4820     fi
4821     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4822 else
4823     AC_MSG_RESULT([no])
4824     SYSTEM_DICTS=
4826 AC_SUBST(SYSTEM_DICTS)
4827 AC_SUBST(DICT_SYSTEM_DIR)
4828 AC_SUBST(HYPH_SYSTEM_DIR)
4829 AC_SUBST(THES_SYSTEM_DIR)
4831 dnl ===================================================================
4832 dnl enable pch by default on windows
4833 dnl enable it explicitely otherwise
4834 AC_MSG_CHECKING([whether to enable pch feature])
4835 ENABLE_PCH=""
4836 if test "$enable_pch" != "no"; then
4837     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4838         ENABLE_PCH="TRUE"
4839         AC_MSG_RESULT([yes])
4840     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4841         ENABLE_PCH="TRUE"
4842         AC_MSG_RESULT([yes])
4843     elif test -n "$enable_pch"; then
4844         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4845     else
4846         AC_MSG_RESULT([no])
4847     fi
4848 else
4849     AC_MSG_RESULT([no])
4851 AC_SUBST(ENABLE_PCH)
4853 TAB=`printf '\t'`
4855 AC_MSG_CHECKING([the GNU Make version])
4856 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4857 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4858 if test "$_make_longver" -ge "038200"; then
4859     AC_MSG_RESULT([$GNUMAKE $_make_version])
4861 elif test "$_make_longver" -ge "038100"; then
4862     if test "$build_os" = "cygwin"; then
4863         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4864     fi
4865     AC_MSG_RESULT([$GNUMAKE $_make_version])
4867     dnl ===================================================================
4868     dnl Search all the common names for sha1sum
4869     dnl ===================================================================
4870     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4871     if test -z "$SHA1SUM"; then
4872         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4873     elif test "$SHA1SUM" = "openssl"; then
4874         SHA1SUM="openssl sha1"
4875     fi
4876     AC_MSG_CHECKING([for GNU Make bug 20033])
4877     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4878     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4879 A := \$(wildcard *.a)
4881 .PHONY: all
4882 all: \$(A:.a=.b)
4883 <TAB>@echo survived bug20033.
4885 .PHONY: setup
4886 setup:
4887 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4889 define d1
4890 @echo lala \$(1)
4891 @sleep 1
4892 endef
4894 define d2
4895 @echo tyty \$(1)
4896 @sleep 1
4897 endef
4899 %.b : %.a
4900 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4901 <TAB>\$(call d1,\$(CHECKSUM)),\
4902 <TAB>\$(call d2,\$(CHECKSUM)))
4904     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4905         no_parallelism_make="YES"
4906         AC_MSG_RESULT([yes, disable parallelism])
4907     else
4908         AC_MSG_RESULT([no, keep parallelism enabled])
4909     fi
4910     rm -rf $TESTGMAKEBUG20033
4911 else
4912     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4915 # find if gnumake support file function
4916 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4917 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4918 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4919     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4921 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4922 \$(file >test.txt,Success )
4924 .PHONY: all
4925 all:
4926 <TAB>@cat test.txt
4929 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4930 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4931     HAVE_GNUMAKE_FILE_FUNC=TRUE
4932     AC_MSG_RESULT([yes])
4933 else
4934     AC_MSG_RESULT([no])
4936 rm -rf $TESTGMAKEFILEFUNC
4937 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4938 AC_SUBST(GNUMAKE_WIN_NATIVE)
4940 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4941 STALE_MAKE=
4942 if test "$_make_ver_check" = ""; then
4943    STALE_MAKE=TRUE
4946 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4947     SHELL_BASH=$(cygpath -m $(which bash))
4948 else
4949     SHELL_BASH=`which bash`
4951 AC_SUBST(SHELL_BASH)
4953 HAVE_LD_HASH_STYLE=FALSE
4954 WITH_LINKER_HASH_STYLE=
4955 AC_MSG_CHECKING( for --hash-style gcc linker support )
4956 if test "$GCC" = "yes"; then
4957     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4958         hash_styles="gnu sysv"
4959     elif test "$with_linker_hash_style" = "no"; then
4960         hash_styles=
4961     else
4962         hash_styles="$with_linker_hash_style"
4963     fi
4965     for hash_style in $hash_styles; do
4966         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4967         hash_style_ldflags_save=$LDFLAGS
4968         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4970         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4971             [
4972 #include <stdio.h>
4973             ],[
4974 printf ("");
4975             ])],
4976             [
4977                   HAVE_LD_HASH_STYLE=TRUE
4978                   WITH_LINKER_HASH_STYLE=$hash_style
4979             ],
4980             [HAVE_LD_HASH_STYLE=FALSE],
4981             [HAVE_LD_HASH_STYLE=FALSE])
4982         LDFLAGS=$hash_style_ldflags_save
4983     done
4985     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4986         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4987     else
4988         AC_MSG_RESULT( no )
4989     fi
4990     LDFLAGS=$hash_style_ldflags_save
4991 else
4992     AC_MSG_RESULT( no )
4994 AC_SUBST(HAVE_LD_HASH_STYLE)
4995 AC_SUBST(WITH_LINKER_HASH_STYLE)
4997 dnl ===================================================================
4998 dnl Check whether there's a Perl version available.
4999 dnl ===================================================================
5000 if test -z "$with_perl_home"; then
5001     AC_PATH_PROG(PERL, perl)
5002 else
5003     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5004     _perl_path="$with_perl_home/bin/perl"
5005     if test -x "$_perl_path"; then
5006         PERL=$_perl_path
5007     else
5008         AC_MSG_ERROR([$_perl_path not found])
5009     fi
5012 dnl ===================================================================
5013 dnl Testing for Perl version 5 or greater.
5014 dnl $] is the Perl version variable, it is returned as an integer
5015 dnl ===================================================================
5016 if test "$PERL"; then
5017     AC_MSG_CHECKING([the Perl version])
5018     ${PERL} -e "exit($]);"
5019     _perl_version=$?
5020     if test "$_perl_version" -lt 5; then
5021         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5022     fi
5023     AC_MSG_RESULT([checked (perl $_perl_version)])
5024 else
5025     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5028 dnl ===================================================================
5029 dnl Testing for required Perl modules
5030 dnl ===================================================================
5032 AC_MSG_CHECKING([for required Perl modules])
5033 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5034     AC_MSG_RESULT([all modules found])
5035 else
5036     AC_MSG_RESULT([failed to find some modules])
5037     # Find out which modules are missing.
5038     missing_perl_modules=
5039     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
5040         missing_perl_modules=Archive::Zip
5041     fi
5042     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5043         missing_perl_modules="$missing_perl_modules Cwd"
5044     fi
5045     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5046         missing_perl_modules="$missing_perl_modules Digest::MD5"
5047     fi
5048        AC_MSG_ERROR([
5049     The missing Perl modules are: $missing_perl_modules
5050     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5053 dnl ===================================================================
5054 dnl Check for pkg-config
5055 dnl ===================================================================
5056 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5057     PKG_PROG_PKG_CONFIG
5060 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5062     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5063     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5064     # explicitly. Or put /path/to/compiler in PATH yourself.
5066     AC_CHECK_TOOL(AR,ar)
5067     AC_CHECK_TOOL(NM,nm)
5068     AC_CHECK_TOOL(OBJDUMP,objdump)
5069     AC_CHECK_TOOL(RANLIB,ranlib)
5070     AC_CHECK_TOOL(READELF,readelf)
5071     AC_CHECK_TOOL(STRIP,strip)
5072     if test "$_os" = "WINNT"; then
5073         AC_CHECK_TOOL(DLLTOOL,dlltool)
5074         AC_CHECK_TOOL(WINDRES,windres)
5075     fi
5077 AC_SUBST(AR)
5078 AC_SUBST(DLLTOOL)
5079 AC_SUBST(NM)
5080 AC_SUBST(OBJDUMP)
5081 AC_SUBST(PKG_CONFIG)
5082 AC_SUBST(RANLIB)
5083 AC_SUBST(READELF)
5084 AC_SUBST(STRIP)
5085 AC_SUBST(WINDRES)
5087 dnl ===================================================================
5088 dnl pkg-config checks on Mac OS X
5089 dnl ===================================================================
5091 if test $_os = Darwin; then
5092     AC_MSG_CHECKING([for bogus pkg-config])
5093     if test -n "$PKG_CONFIG"; then
5094         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5095             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5096         else
5097             if test "$enable_bogus_pkg_config" = "yes"; then
5098                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5099             else
5100                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
5101             fi
5102         fi
5103     else
5104         AC_MSG_RESULT([no, good])
5105     fi
5108 find_csc()
5110     # Return value: $csctest
5112     unset csctest
5114     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5115     if test -n "$regvalue"; then
5116         csctest=$regvalue
5117         return
5118     fi
5121 find_al()
5123     # Return value: $altest
5125     unset altest
5127     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5128         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5129         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5130             altest=$regvalue
5131             return
5132         fi
5133     done
5136 find_dotnetsdk()
5138     # Return value: $frametest (that's a silly name...)
5140     unset frametest
5142     for ver in 1.1 2.0; do
5143         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5144         if test -n "$regvalue"; then
5145             frametest=$regvalue
5146             return
5147         fi
5148     done
5151 find_winsdk_version()
5153     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5154     # Return values: $winsdktest, $winsdklibsubdir
5156     unset winsdktest winsdklibsubdir
5158     # Why we look for them in this particular order I don't know. But OTOH I
5159     case "$1" in
5160     7.*)
5161         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5162         if test -n "$regvalue"; then
5163             winsdktest=$regvalue
5164             winsdklibsubdir=.
5165             return
5166         fi
5167         ;;
5168     8.1|8.1A)
5169         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5170         if test -n "$regvalue"; then
5171             winsdktest=$regvalue
5172             winsdklibsubdir=winv6.3
5173             return
5174         fi
5175         ;;
5176     8.0|8.0A)
5177         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5178         if test -n "$regvalue"; then
5179             winsdktest=$regvalue
5180             winsdklibsubdir=win8
5181             return
5182         fi
5183         ;;
5184     esac
5187 find_winsdk()
5189     # Args: $1 (optional) : list of acceptable SDK versions
5190     # Return value: $winsdktest
5192     unset winsdktest
5194     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5195         find_winsdk_version $ver
5196         if test -n "$winsdktest"; then
5197             return
5198         fi
5199     done
5202 find_msms()
5204     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5205     AC_MSG_CHECKING([for $my_msm_file])
5206     msmdir=
5207     for ver in 12.0; do
5208         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5209         if test -n "$regvalue"; then
5210             if test -e "$regvalue/$my_msm_file"; then
5211                 msmdir=$regvalue
5212                 break
5213             fi
5214         fi
5215     done
5216     dnl Is the following fallback really necessary, or was it added in response
5217     dnl to never having started Visual Studio on a given machine, so the
5218     dnl registry keys checked above had presumably not yet been created?
5219     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5220     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5221     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5222     dnl expanding to "C:\Program Files\Common Files"), which would need
5223     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5224     dnl obtain its value from cygwin:
5225     if test -z "$msmdir"; then
5226         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules"
5227         if test -e "$my_msm_dir/$my_msm_file"; then
5228             msmdir=$my_msm_dir
5229         fi
5230     fi
5231     if test -n "$msmdir"; then
5232         msmdir=`cygpath -m "$msmdir"`
5233         AC_MSG_RESULT([$msmdir])
5234     else
5235         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5236             AC_MSG_ERROR([not found])
5237         else
5238             AC_MSG_WARN([not found])
5239         fi
5240     fi
5243 find_msvc_x64_dlls()
5245     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5246     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5247     for dll in $msvcdlls; do
5248         if ! test -f "$msvcdllpath/$dll"; then
5249             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5250         fi
5251     done
5254 if test "$build_os" = "cygwin"; then
5255     dnl Check midl.exe
5256     AC_MSG_CHECKING([for midl.exe])
5258     find_winsdk
5259     if test -f "$winsdktest/Bin/midl.exe"; then
5260         MIDL_PATH="$winsdktest/Bin"
5261     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5262         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5263     fi
5264     if test ! -f "$MIDL_PATH/midl.exe"; then
5265         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5266     else
5267         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5268     fi
5270     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5271     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5273     dnl Check csc.exe
5274     AC_MSG_CHECKING([for csc.exe])
5275     find_csc
5276     if test -f "$csctest/csc.exe"; then
5277         CSC_PATH="$csctest"
5278     fi
5279     if test ! -f "$CSC_PATH/csc.exe"; then
5280         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5281     else
5282         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5283     fi
5285     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5287     dnl Check al.exe
5288     AC_MSG_CHECKING([for al.exe])
5289     find_winsdk
5290     if test -f "$winsdktest/Bin/al.exe"; then
5291         AL_PATH="$winsdktest/Bin"
5292     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5293         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5294     fi
5296     if test -z "$AL_PATH"; then
5297         find_al
5298         if test -f "$altest/bin/al.exe"; then
5299             AL_PATH="$altest/bin"
5300         elif test -f "$altest/al.exe"; then
5301             AL_PATH="$altest"
5302         fi
5303     fi
5304     if test ! -f "$AL_PATH/al.exe"; then
5305         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5306     else
5307         AC_MSG_RESULT([$AL_PATH/al.exe])
5308     fi
5310     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5312     dnl Check mscoree.lib / .NET Framework dir
5313     AC_MSG_CHECKING(.NET Framework)
5314     find_dotnetsdk
5315     if test -f "$frametest/lib/mscoree.lib"; then
5316         DOTNET_FRAMEWORK_HOME="$frametest"
5317     else
5318         find_winsdk
5319         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5320             DOTNET_FRAMEWORK_HOME="$winsdktest"
5321         fi
5322     fi
5324     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5325         AC_MSG_ERROR([mscoree.lib not found])
5326     fi
5327     AC_MSG_RESULT(found)
5329     PathFormat "$MIDL_PATH"
5330     MIDL_PATH="$formatted_path"
5332     PathFormat "$AL_PATH"
5333     AL_PATH="$formatted_path"
5335     PathFormat "$DOTNET_FRAMEWORK_HOME"
5336     DOTNET_FRAMEWORK_HOME="$formatted_path"
5338     PathFormat "$CSC_PATH"
5339     CSC_PATH="$formatted_path"
5342 dnl ===================================================================
5343 dnl Check if stdc headers are available excluding MSVC.
5344 dnl ===================================================================
5345 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5346     AC_HEADER_STDC
5349 dnl ===================================================================
5350 dnl Testing for C++ compiler and version...
5351 dnl ===================================================================
5353 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5354     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5355     save_CXXFLAGS=$CXXFLAGS
5356     AC_PROG_CXX
5357     CXXFLAGS=$save_CXXFLAGS
5358 else
5359     if test -n "$CC" -a -z "$CXX"; then
5360         CXX="$CC"
5361     fi
5364 dnl check for GNU C++ compiler version
5365 if test "$GXX" = "yes"; then
5366     AC_MSG_CHECKING([the GNU C++ compiler version])
5368     _gpp_version=`$CXX -dumpversion`
5369     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5371     if test "$_gpp_majmin" -lt "401"; then
5372         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5373     else
5374         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5375     fi
5377     dnl see https://code.google.com/p/android/issues/detail?id=41770
5378     if test "$_gpp_majmin" -ge "401"; then
5379         glibcxx_threads=no
5380         AC_LANG_PUSH([C++])
5381         AC_REQUIRE_CPP
5382         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5383         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5384             #include <bits/c++config.h>]],[[
5385             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5386             && !defined(_GLIBCXX__PTHREADS) \
5387             && !defined(_GLIBCXX_HAS_GTHREADS)
5388             choke me
5389             #endif
5390         ]])],[AC_MSG_RESULT([yes])
5391         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5392         AC_LANG_POP([C++])
5393         if test $glibcxx_threads = yes; then
5394             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5395         fi
5396      fi
5398 AC_SUBST(BOOST_CXXFLAGS)
5401 # prefx CXX with ccache if needed
5403 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5404     if test "$CCACHE" != ""; then
5405         AC_MSG_CHECKING([whether $CXX is already ccached])
5406         AC_LANG_PUSH([C++])
5407         save_CXXFLAGS=$CXXFLAGS
5408         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5409         dnl an empty program will do, we're checking the compiler flags
5410         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5411                           [use_ccache=yes], [use_ccache=no])
5412         if test $use_ccache = yes; then
5413             AC_MSG_RESULT([yes])
5414         else
5415             CXX="$CCACHE $CXX"
5416             AC_MSG_RESULT([no])
5417         fi
5418         CXXFLAGS=$save_CXXFLAGS
5419         AC_LANG_POP([C++])
5420     fi
5423 dnl ===================================================================
5424 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5425 dnl ===================================================================
5427 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5428     AC_PROG_CXXCPP
5430     dnl Check whether there's a C pre-processor.
5431     AC_PROG_CPP
5435 dnl ===================================================================
5436 dnl Find integral type sizes and alignments
5437 dnl ===================================================================
5439 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5441     AC_CHECK_SIZEOF(long)
5442     AC_CHECK_SIZEOF(short)
5443     AC_CHECK_SIZEOF(int)
5444     AC_CHECK_SIZEOF(long long)
5445     AC_CHECK_SIZEOF(double)
5446     AC_CHECK_SIZEOF(void*)
5448     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5449     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5450     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5451     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5452     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5454     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5455     m4_pattern_allow([AC_CHECK_ALIGNOF])
5456     m4_ifdef([AC_CHECK_ALIGNOF],
5457         [
5458             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5459             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5460             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5461             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5462         ],
5463         [
5464             case "$_os-$host_cpu" in
5465             Linux-i686)
5466                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5467                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5468                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5469                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5470                 ;;
5471             Linux-x86_64)
5472                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5473                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5474                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5475                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5476                 ;;
5477             *)
5478                 if test -z "$ac_cv_alignof_short" -o \
5479                         -z "$ac_cv_alignof_int" -o \
5480                         -z "$ac_cv_alignof_long" -o \
5481                         -z "$ac_cv_alignof_double"; then
5482                    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.])
5483                 fi
5484                 ;;
5485             esac
5486         ])
5488     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5489     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5490     if test $ac_cv_sizeof_long -eq 8; then
5491         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5492     elif test $ac_cv_sizeof_double -eq 8; then
5493         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5494     else
5495         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5496     fi
5498     dnl Check for large file support
5499     AC_SYS_LARGEFILE
5500     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5501         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5502     fi
5503     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5504         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5505     fi
5506 else
5507     # Hardcode for MSVC
5508     SAL_TYPES_SIZEOFSHORT=2
5509     SAL_TYPES_SIZEOFINT=4
5510     SAL_TYPES_SIZEOFLONG=4
5511     SAL_TYPES_SIZEOFLONGLONG=8
5512     if test "$BITNESS_OVERRIDE" = ""; then
5513         SAL_TYPES_SIZEOFPOINTER=4
5514     else
5515         SAL_TYPES_SIZEOFPOINTER=8
5516     fi
5517     SAL_TYPES_ALIGNMENT2=2
5518     SAL_TYPES_ALIGNMENT4=4
5519     SAL_TYPES_ALIGNMENT8=8
5520     LFS_CFLAGS=''
5522 AC_SUBST(LFS_CFLAGS)
5524 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5525 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5526 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5527 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5528 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5529 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5530 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5531 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5533 dnl ===================================================================
5534 dnl Check whether to enable runtime optimizations
5535 dnl ===================================================================
5536 ENABLE_RUNTIME_OPTIMIZATIONS=
5537 AC_MSG_CHECKING([whether to enable runtime optimizations])
5538 if test -z "$enable_runtime_optimizations"; then
5539     for i in $CC; do
5540         case $i in
5541         -fsanitize=*)
5542             enable_runtime_optimizations=no
5543             break
5544             ;;
5545         esac
5546     done
5548 if test "$enable_runtime_optimizations" != no; then
5549     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5550     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5551     AC_MSG_RESULT([yes])
5552 else
5553     AC_MSG_RESULT([no])
5555 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5557 dnl ===================================================================
5558 dnl Check if valgrind headers are available
5559 dnl ===================================================================
5560 ENABLE_VALGRIND=
5561 if test "$cross_compiling" != yes; then
5562     prev_cppflags=$CPPFLAGS
5563     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5564     # or where does it come from?
5565     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5566     AC_CHECK_HEADER([valgrind/valgrind.h],
5567         [ENABLE_VALGRIND=TRUE])
5568     CPPFLAGS=$prev_cppflags
5570 AC_SUBST([ENABLE_VALGRIND])
5571 if test -z "$ENABLE_VALGRIND"; then
5572     VALGRIND_CFLAGS=
5574 AC_SUBST([VALGRIND_CFLAGS])
5577 dnl ===================================================================
5578 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5579 dnl ===================================================================
5581 # We need at least the sys/sdt.h include header.
5582 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5583 if test "$SDT_H_FOUND" = "TRUE"; then
5584     # Found sys/sdt.h header, now make sure the c++ compiler works.
5585     # Old g++ versions had problems with probes in constructors/destructors.
5586     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5587     AC_LANG_PUSH([C++])
5588     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5589     #include <sys/sdt.h>
5590     class ProbeClass
5591     {
5592     private:
5593       int& ref;
5594       const char *name;
5596     public:
5597       ProbeClass(int& v, const char *n) : ref(v), name(n)
5598       {
5599         DTRACE_PROBE2(_test_, cons, name, ref);
5600       }
5602       void method(int min)
5603       {
5604         DTRACE_PROBE3(_test_, meth, name, ref, min);
5605         ref -= min;
5606       }
5608       ~ProbeClass()
5609       {
5610         DTRACE_PROBE2(_test_, dest, name, ref);
5611       }
5612     };
5613     ]],[[
5614     int i = 64;
5615     DTRACE_PROBE1(_test_, call, i);
5616     ProbeClass inst = ProbeClass(i, "call");
5617     inst.method(24);
5618     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5619           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5620     AC_LANG_POP([C++])
5622 AC_CONFIG_HEADERS([config_host/config_probes.h])
5624 dnl ===================================================================
5625 dnl Set the MinGW sys-root
5626 dnl ===================================================================
5627 if test "$WITH_MINGW" = "yes"; then
5628     AC_MSG_CHECKING([for MinGW sysroot])
5629     sysroot=`$CC -print-sysroot`
5630     AS_IF([test -d "$sysroot"/mingw],
5631           [MINGW_SYSROOT="$sysroot"/mingw
5632            AC_MSG_RESULT([$MINGW_SYSROOT])],
5633           [AC_MSG_RESULT([not found])
5634            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5636 AC_SUBST([MINGW_DLLS])
5637 AC_SUBST([MINGW_SYSROOT])
5639 dnl ===================================================================
5640 dnl Set the MinGW include directories
5641 dnl ===================================================================
5642 if test "$WITH_MINGW" = "yes"; then
5643     AC_MSG_CHECKING([for MinGW include path])
5644     cat >conftest.$ac_ext <<_ACEOF
5645 #include <stddef.h>
5646 #include <bits/c++config.h>
5647 _ACEOF
5648     _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`
5649     rm conftest.$ac_ext
5650     if test -z "$_mingw_lib_include_path"; then
5651         _mingw_lib_include_path="NO_LIB_INCLUDE"
5652         AC_MSG_RESULT([no MinGW include path])
5653     else
5654         AC_MSG_RESULT([$_mingw_lib_include_path])
5655     fi
5656     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5657     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5659     AC_LANG_PUSH([C++])
5661     AC_MSG_CHECKING([for dynamic libgcc])
5662     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5663 #include <iostream>
5664 using namespace std;
5665 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5666             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5667             if test -n "$MINGW_GCCDLL"; then
5668                 MINGW_SHARED_GCCLIB=TRUE
5669                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5670             else
5671                 MINGW_SHARED_GCCLIB=
5672                 AC_MSG_RESULT([no])
5673             fi
5674        ],[ AC_MSG_RESULT([no])
5676     ])
5678     AC_MSG_CHECKING([for dynamic libstdc++])
5679     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5680 #include <iostream>
5681 using namespace std;
5682 ]], [[ cout << "Hello there." << endl; ]])],[
5683             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5684             if test -n "$MINGW_GXXDLL"; then
5685                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5686                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5687                 if test "$CROSS_COMPILING" = "TRUE"; then
5688                     dnl m4 escaping!
5689                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5690                 fi
5691                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5692                 MINGW_SHARED_GXXLIB=TRUE
5693                 AC_MSG_RESULT([$MINGW_GXXDLL])
5694             else
5695                 MINGW_SHARED_GXXLIB=
5696                 AC_MSG_RESULT([no])
5697             fi
5698        ],[ AC_MSG_RESULT([no])
5700     ])
5702     AC_LANG_POP([C++])
5704     AC_SUBST(MINGW_SHARED_GCCLIB)
5705     AC_SUBST(MINGW_SHARED_GXXLIB)
5706     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5707     AC_SUBST(MINGW_GCCDLL)
5708     AC_SUBST(MINGW_GXXDLL)
5711 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5712     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5715 if test "$WITH_MINGW" = "yes"; then
5716     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5717     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5718     [
5719     #include <usp10.h>
5720     ],
5721     [
5722     SCRIPT_CONTROL c;
5723     c.fMergeNeutralItems = 1;
5724     ])],
5725     [
5726     AC_MSG_RESULT(yes)
5727     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5728     ],
5729     [AC_MSG_RESULT(no)])
5732 dnl *************************************************************
5733 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5734 dnl *************************************************************
5735 if test "$WITH_MINGW" = "yes"; then
5736     AC_MSG_CHECKING([exception type])
5737     AC_LANG_PUSH([C++])
5738     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5740         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5742         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5743     ])
5744     AC_MSG_RESULT($exceptions_type)
5745     AC_LANG_POP([C++])
5748 EXCEPTIONS="$exceptions_type"
5749 AC_SUBST(EXCEPTIONS)
5751 dnl ===================================================================
5752 dnl thread-safe statics
5753 dnl ===================================================================
5754 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5755 unset HAVE_THREADSAFE_STATICS
5756 if test "$GCC" = "yes"; then
5757     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5758     dnl us.  However, some C++ runtimes use a single lock for all static
5759     dnl variables, which can cause deadlock in multi-threaded applications.
5760     dnl This is not easily tested here; for POSIX-based systems, if executing
5761     dnl the following C++ program does not terminate then the tool chain
5762     dnl apparently has this problem:
5763     dnl
5764     dnl   #include <pthread.h>
5765     dnl   int h() { return 0; }
5766     dnl   void * g(void * unused) {
5767     dnl     static int n = h();
5768     dnl     return &n;
5769     dnl   }
5770     dnl   int f() {
5771     dnl     pthread_t t;
5772     dnl     pthread_create(&t, 0, g, 0);
5773     dnl     pthread_join(t, 0);
5774     dnl     return 0;
5775     dnl   }
5776     dnl   int main() {
5777     dnl     static int n = f();
5778     dnl     return n;
5779     dnl   }
5780     dnl
5781     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5782     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5783     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5784     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5785     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5786     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5787     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5788     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5789     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5790     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5791     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5792     dnl "too old"):
5793     if test "$_os" = Darwin; then
5794         dnl On Mac OS X, both /usr/lib/libstdc++.6.dylib and
5795         dnl /usr/lib/libc++1.dylib delegate to /usr/lib/libc++abi.dylib for the
5796         dnl __cxa_guard_* functionality; up to 10.8, libc++abi.dylib is
5797         dnl apparently provided by a libcppabi project that has broken semantics
5798         dnl (cf. <http://www.opensource.apple.com/source/libcppabi/libcppabi-26/
5799         dnl src/cxa_guard.cxx>), while in 10.9 (verified at least on 10.9.4) it
5800         dnl is apparently provided by LLVM's libcxxabi project, which has good
5801         dnl semantics (cf. <http://llvm.org/svn/llvm-project/libcxxabi/trunk/
5802         dnl src/cxa_guard.cpp>):
5803         if test "$MAC_OS_X_VERSION_MIN_REQUIRED" -ge 1090; then
5804             HAVE_THREADSAFE_STATICS=TRUE
5805         fi
5806     elif test "$_os" != Android; then
5807         if test "$COM_GCC_IS_CLANG" = TRUE; then
5808             AC_LANG_PUSH([C++])
5809             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5810 #include <list>
5811 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5812 #error
5813 #endif
5814                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5815             AC_LANG_POP([C++])
5816         else # known to work in GCC since version 4.3
5817             HAVE_THREADSAFE_STATICS=TRUE
5818         fi
5819     fi
5820     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5821         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5822         AC_MSG_RESULT([yes])
5823     else
5824         AC_MSG_RESULT([broken (i.e., no)])
5825     fi
5826 else
5827     AC_MSG_RESULT([unknown (assuming no)])
5829 AC_SUBST(HAVE_THREADSAFE_STATICS)
5831 dnl ===================================================================
5832 dnl visibility and other gcc features
5833 dnl ===================================================================
5834 if test "$GCC" = "yes"; then
5835     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5836     save_CFLAGS=$CFLAGS
5837     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5838     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5839     CFLAGS=$save_CFLAGS
5841     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5842         AC_MSG_RESULT([yes])
5843     else
5844         AC_MSG_RESULT([no])
5845     fi
5847     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5848     save_CFLAGS=$CFLAGS
5849     CFLAGS="$CFLAGS -Werror -mno-avx"
5850     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5851     CFLAGS=$save_CFLAGS
5852     if test "$HAVE_GCC_AVX" = "TRUE"; then
5853         AC_MSG_RESULT([yes])
5854     else
5855         AC_MSG_RESULT([no])
5856     fi
5858     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5859     save_CFLAGS=$CFLAGS
5860     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5861     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5862     CFLAGS=$save_CFLAGS
5863     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5864         AC_MSG_RESULT([yes])
5865     else
5866         AC_MSG_RESULT([no])
5867     fi
5869     AC_MSG_CHECKING([whether $CC supports atomic functions])
5870     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5871     int v = 0;
5872     if (__sync_add_and_fetch(&v, 1) != 1 ||
5873         __sync_sub_and_fetch(&v, 1) != 0)
5874         return 1;
5875     __sync_synchronize();
5876     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5877         v != 1)
5878         return 1;
5879     return 0;
5880 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5881     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5882         AC_MSG_RESULT([yes])
5883         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5884     else
5885         AC_MSG_RESULT([no])
5886     fi
5888     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5889     save_CFLAGS=$CFLAGS
5890     CFLAGS="$CFLAGS -Werror"
5891     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5892             __attribute__((deprecated("test"))) void f();
5893         ])], [
5894             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5895             AC_MSG_RESULT([yes])
5896         ], [AC_MSG_RESULT([no])])
5897     CFLAGS=$save_CFLAGS
5899     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5900     AC_LANG_PUSH([C++])
5901     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5902             #include <cxxabi.h>
5903             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5904         ])], [
5905             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5906             AC_MSG_RESULT([yes])
5907         ], [AC_MSG_RESULT([no])])
5908     AC_LANG_POP([C++])
5910     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5911     AC_LANG_PUSH([C++])
5912     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5913             #include <cxxabi.h>
5914             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5915         ])], [
5916             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
5917             AC_MSG_RESULT([yes])
5918         ], [AC_MSG_RESULT([no])])
5919     AC_LANG_POP([C++])
5921     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5922     AC_LANG_PUSH([C++])
5923     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5924             #include <cxxabi.h>
5925             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5926         ])], [
5927             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
5928             AC_MSG_RESULT([yes])
5929         ], [AC_MSG_RESULT([no])])
5930     AC_LANG_POP([C++])
5932     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5933     AC_LANG_PUSH([C++])
5934     save_CXXFLAGS=$CXXFLAGS
5935     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
5936     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5937             struct __attribute__((warn_unused)) dummy {};
5938         ])], [
5939             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
5940             AC_MSG_RESULT([yes])
5941         ], [AC_MSG_RESULT([no])])
5942     CXXFLAGS=$save_CXXFLAGS
5943     AC_LANG_POP([C++])
5945     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
5946     AC_LANG_PUSH([C++])
5947     save_CXXFLAGS=$CXXFLAGS
5948     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
5949     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5950             #include <string>
5951             void f() { std::string s; }
5952         ])], [
5953             AC_MSG_RESULT([no])
5954         ], [
5955             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
5956             AC_MSG_RESULT([yes])])
5957     CXXFLAGS=$save_CXXFLAGS
5958     AC_LANG_POP([C++])
5961 AC_SUBST(HAVE_GCC_AVX)
5962 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
5963 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5965 dnl ===================================================================
5966 dnl Identify the C++ library
5967 dnl ===================================================================
5969 AC_MSG_CHECKING([What the C++ library is])
5970 AC_LANG_PUSH([C++])
5971 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5972 #include <utility>
5973 #ifndef __GLIBCXX__
5974 foo bar
5975 #endif
5976 ]])],
5977     [CPP_LIBRARY=GLIBCXX
5978      cpp_library_name="GNU libstdc++"
5979     ],
5980     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5981 #include <utility>
5982 #ifndef _LIBCPP_VERSION
5983 foo bar
5984 #endif
5985 ]])],
5986     [CPP_LIBRARY=LIBCPP
5987      cpp_library_name="LLVM libc++"
5988     ],
5989     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5990 #include <utility>
5991 #ifndef _MSC_VER
5992 foo bar
5993 #endif
5994 ]])],
5995     [CPP_LIBRARY=MSVCRT
5996      cpp_library_name="Microsoft"
5997     ],
5998     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
5999 AC_MSG_RESULT([$cpp_library_name])
6000 AC_LANG_POP([C++])
6001 AC_SUBST(CPP_LIBRARY)
6003 dnl ===================================================================
6004 dnl C++11
6005 dnl ===================================================================
6007 CXXFLAGS_CXX11=
6008 if test "$COM" = MSC; then
6009     AC_MSG_CHECKING([whether $CXX supports C++11])
6010     AC_MSG_RESULT(yes)
6011     # MSVC supports (a subset of) CXX11 without any switch
6012     CXXFLAGS_CXX11=
6013 elif test "$GCC" = "yes"; then
6014     HAVE_CXX11=
6015     CXXFLAGS_CXX11=
6016     AC_MSG_CHECKING([whether $CXX supports C++11])
6017     for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
6018         save_CXXFLAGS=$CXXFLAGS
6019         CXXFLAGS="$CXXFLAGS $flag -Werror"
6020         AC_LANG_PUSH([C++])
6021         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void f() {}]])],[CXXFLAGS_CXX11=$flag])
6022         AC_LANG_POP([C++])
6023         CXXFLAGS=$save_CXXFLAGS
6024         if test -n "$CXXFLAGS_CXX11"; then
6025             HAVE_CXX11=TRUE
6026             break
6027         fi
6028     done
6029     if test "$HAVE_CXX11" = TRUE; then
6030         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6031     else
6032         AC_MSG_ERROR(no)
6033     fi
6036 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6037 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6038 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6039 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6040 dnl again towards 4.7.2:
6041 if test $CPP_LIBRARY = GLIBCXX; then
6042     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6043     AC_LANG_PUSH([C++])
6044     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6045 #include <list>
6046 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6047     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6048     //   GCC 4.7.0: 20120322
6049     //   GCC 4.7.1: 20120614
6050     // and using a range check is not possible as the mapping between
6051     // __GLIBCXX__ values and GCC versions is not monotonic
6052 /* ok */
6053 #else
6054 abi broken
6055 #endif
6056         ]])], [AC_MSG_RESULT(no, ok)],
6057         [AC_MSG_ERROR(yes)])
6058     AC_LANG_POP([C++])
6061 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6062 save_CXXFLAGS=$CXXFLAGS
6063 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6064 AC_LANG_PUSH([C++])
6066 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6067 #include <stddef.h>
6069 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6071 namespace
6073         struct b
6074         {
6075                 int i;
6076                 int j;
6077         };
6079 ]], [[
6080 struct a
6082         int i;
6083         int j;
6085 a thinga[]={{0,0}, {1,1}};
6086 b thingb[]={{0,0}, {1,1}};
6087 size_t i = sizeof(sal_n_array_size(thinga));
6088 size_t j = sizeof(sal_n_array_size(thingb));
6089 return !(i != 0 && j != 0);
6091     ], [ AC_MSG_RESULT(yes) ],
6092     [ AC_MSG_ERROR(no)])
6093 AC_LANG_POP([C++])
6094 CXXFLAGS=$save_CXXFLAGS
6096 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6097 save_CXXFLAGS=$CXXFLAGS
6098 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6099 AC_LANG_PUSH([C++])
6101 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6102 #include <vector>
6103     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6104     // (__float128)
6106     ],[ AC_MSG_RESULT(yes) ],
6107     [
6108         AC_MSG_RESULT(no)
6109         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6110         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6111         # __float128 is available during its build, but it's usually built using GCC,
6112         # and so c++config.h hardcodes __float128 being supported). As the only place
6113         # where __float128 is actually used is in a template specialization,
6114         # -D__float128=void will avoid the problem there while still causing a problem
6115         # if somebody actually uses the type.
6116         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6117         CXXFLAGS="$CXXFLAGS -D__float128=void"
6118         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6119 #include <vector>
6120     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6121     // (__float128)
6123     ],
6124     [
6125      AC_MSG_RESULT(yes)
6126      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6127     ],
6128     [
6129      AC_MSG_ERROR(no)
6130     ])
6133 AC_LANG_POP([C++])
6134 CXXFLAGS=$save_CXXFLAGS
6136 AC_SUBST(CXXFLAGS_CXX11)
6138 dnl ==================================
6139 dnl Check for C++11 "= delete" support
6140 dnl ==================================
6142 AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
6143 save_CXXFLAGS=$CXXFLAGS
6144 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6145 AC_LANG_PUSH([C++])
6146 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6147 struct A
6148     {
6149     void test() = delete;
6150     };
6151 ]])],[HAVE_CXX11_DELETE=TRUE],[])
6153 AC_LANG_POP([C++])
6154 CXXFLAGS=$save_CXXFLAGS
6155 if test "$HAVE_CXX11_DELETE" = "TRUE"; then
6156     AC_MSG_RESULT([yes])
6157     AC_DEFINE([HAVE_CXX11_DELETE])
6158 else
6159     AC_MSG_RESULT([no])
6162 dnl ==================================
6163 dnl Check for C++11 "override" support
6164 dnl ==================================
6166 AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
6167 save_CXXFLAGS=$CXXFLAGS
6168 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6169 AC_LANG_PUSH([C++])
6170 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6171 struct A
6173         virtual void test();
6176 struct B : A
6178         virtual void test() override;
6180 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
6182 AC_LANG_POP([C++])
6183 CXXFLAGS=$save_CXXFLAGS
6184 if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
6185     AC_MSG_RESULT([yes])
6186     AC_DEFINE([HAVE_CXX11_OVERRIDE])
6187 else
6188     AC_MSG_RESULT([no])
6191 dnl ==================================
6192 dnl Check for C++11 "final" support
6193 dnl ==================================
6195 AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
6196 save_CXXFLAGS=$CXXFLAGS
6197 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6198 AC_LANG_PUSH([C++])
6199 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6200 // First check that this correct program that uses "final" compiles
6201 struct A final
6205 struct B
6207         virtual void test();
6210 struct C : B
6212         void test() final;
6214 ]])],[have_final=yes],[])
6216 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6217 // Then check that the "final" works as expected,
6218 // that this program fails to compile
6219 struct A final
6223 struct B : A
6226 ]])],[],[final_class_works=yes])
6228 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6229 // Also this should fail to compile
6230 struct B
6232         virtual void test();
6235 struct C : B
6237         void test() final;
6240 struct D : C
6242         void test();
6244 ]])],[],[final_method_works=yes])
6245 AC_LANG_POP([C++])
6247 CXXFLAGS=$save_CXXFLAGS
6249 if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
6250     AC_MSG_RESULT([yes])
6251     AC_DEFINE([HAVE_CXX11_FINAL])
6252 else
6253     AC_MSG_RESULT([no])
6256 dnl ===================================================================
6257 dnl Check for C++11 perfect forwarding support
6258 dnl ===================================================================
6259 AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
6260 save_CXXFLAGS=$CXXFLAGS
6261 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6262 AC_LANG_PUSH([C++])
6263 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6264     #include <utility>
6265     template<typename T, typename... Args> T * f(Args &&... v) {
6266         return new T(std::forward<Args>(v)...);
6267     }
6268     ]], [[
6269     f<int>(0);
6270     ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
6271 AC_LANG_POP([C++])
6272 CXXFLAGS=$save_CXXFLAGS
6273 AC_MSG_RESULT([$perfect_forwarding])
6274 if test "$perfect_forwarding" = yes; then
6275     AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
6278 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6279 save_CXXFLAGS=$CXXFLAGS
6280 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6281 AC_LANG_PUSH([C++])
6282 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6283     struct S {
6284         int n_;
6285         constexpr S(int n): n_(n) {}
6286     };
6287     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6288 AC_LANG_POP([C++])
6289 CXXFLAGS=$save_CXXFLAGS
6290 AC_MSG_RESULT([$cxx11_constexpr])
6291 if test "$cxx11_constexpr" = yes; then
6292     AC_DEFINE([HAVE_CXX11_CONSTEXPR])
6295 HAVE_GCC_PRAGMA_OPERATOR=
6296 dnl _Pragma support (may require C++11)
6297 if test "$GCC" = "yes"; then
6298     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6299     AC_LANG_PUSH([C++])
6300     save_CXXFLAGS=$CXXFLAGS
6301     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6302     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6303             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6304         ])], [
6305             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6306             HAVE_GCC_PRAGMA_OPERATOR=1
6307             AC_MSG_RESULT([yes])
6308         ], [AC_MSG_RESULT([no])])
6309     AC_LANG_POP([C++])
6310     CXXFLAGS=$save_CXXFLAGS
6312 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6314 dnl ===================================================================
6315 dnl system stl sanity tests
6316 dnl ===================================================================
6317 HAVE_GCC_VISIBILITY_BROKEN=
6318 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6320     AC_LANG_PUSH([C++])
6322     save_CPPFLAGS="$CPPFLAGS"
6323     if test -n "$MACOSX_SDK_PATH"; then
6324         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6325     fi
6327     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6328     # only.
6329     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6330         dnl gcc#19664, gcc#22482, rhbz#162935
6331         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6332         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6333         AC_MSG_RESULT([$stlvisok])
6334         if test "$stlvisok" = "no"; then
6335             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6336             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6337             unset HAVE_GCC_VISIBILITY_FEATURE
6338         fi
6339     fi
6341     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6342         sharedlink_ldflags_save=$LDFLAGS
6343         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6345         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6346         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6347 #include <sstream>
6348 using namespace std;
6349             ]], [[
6350 istringstream strm( "test" ); return 0;
6351             ]])],
6352             # Ugh, surely bad to assume an error message will contain
6353             # the word "unresolvable", a problem with
6354             # -fvisibility-inlines-hidden and STL headers might cause
6355             # some more obscure message on some platform, and anway,
6356             # the error message could be localised.
6357             [$EGREP -q unresolvable conftest.err;
6358             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6359         ])
6360         AC_MSG_RESULT([$gccvisok])
6361         if test "$gccvisok" = "no"; then
6362             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6363             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6364             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6365         fi
6367         LDFLAGS=$sharedlink_ldflags_save
6368     fi
6370     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6371     # when we don't make any dynamic libraries?
6372     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6373         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6374         cat > conftestlib1.cc <<_ACEOF
6375 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6376 struct S2: S1<int> { virtual ~S2(); };
6377 S2::~S2() {}
6378 _ACEOF
6379         cat > conftestlib2.cc <<_ACEOF
6380 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6381 struct S2: S1<int> { virtual ~S2(); };
6382 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6383 _ACEOF
6384         gccvisinlineshiddenok=yes
6385         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6386             gccvisinlineshiddenok=no
6387         else
6388             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6389             dnl known to not work with -z defs (unsetting which makes the test
6390             dnl moot, though):
6391             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6392             if test "$COM_GCC_IS_CLANG" = TRUE; then
6393                 for i in $CXX; do
6394                     case $i in
6395                     -fsanitize=*)
6396                         my_linkflagsnoundefs=
6397                         break
6398                         ;;
6399                     esac
6400                 done
6401             fi
6402             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6403                 gccvisinlineshiddenok=no
6404             fi
6405         fi
6407         rm -fr libconftest*
6408         AC_MSG_RESULT([$gccvisinlineshiddenok])
6409         if test "$gccvisinlineshiddenok" = "no"; then
6410             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6411             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6412             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6413         fi
6414     fi
6416     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6417         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6418         cat >visibility.cxx <<_ACEOF
6419 #pragma GCC visibility push(hidden)
6420 struct __attribute__ ((visibility ("default"))) TestStruct {
6421   static void Init();
6423 __attribute__ ((visibility ("default"))) void TestFunc() {
6424   TestStruct::Init();
6426 _ACEOF
6427         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6428             gccvisbroken=yes
6429         else
6430             case "$host_cpu" in
6431             i?86|x86_64)
6432                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6433                     gccvisbroken=no
6434                 else
6435                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6436                         gccvisbroken=no
6437                     else
6438                         gccvisbroken=yes
6439                     fi
6440                 fi
6441                 ;;
6442             *)
6443                 gccvisbroken=no
6444                 ;;
6445             esac
6446         fi
6447         rm -f visibility.s visibility.cxx
6449         AC_MSG_RESULT([$gccvisbroken])
6450         if test "$gccvisbroken" = "yes"; then
6451             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6452             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6453             unset HAVE_GCC_VISIBILITY_FEATURE
6454         fi
6455     fi
6457     CPPFLAGS="$save_CPPFLAGS"
6459     AC_LANG_POP([C++])
6462 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6463 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6465 dnl ===================================================================
6466 dnl  Clang++ tests
6467 dnl ===================================================================
6469 HAVE_GCC_FNO_DEFAULT_INLINE=
6470 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6471 if test "$GCC" = "yes"; then
6472     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6473     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6474         # Option just ignored and silly warning that isn't a real
6475         # warning printed
6476         :
6477     else
6478         AC_LANG_PUSH([C++])
6479         save_CXXFLAGS=$CXXFLAGS
6480         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6481         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6482         CXXFLAGS=$save_CXXFLAGS
6483         AC_LANG_POP([C++])
6484     fi
6485     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6486         AC_MSG_RESULT([yes])
6487     else
6488         AC_MSG_RESULT([no])
6489     fi
6491     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6492     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6493         # As above
6494         :
6495     else
6496         AC_LANG_PUSH([C++])
6497         save_CXXFLAGS=$CXXFLAGS
6498         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6499         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6500         CXXFLAGS=$save_CXXFLAGS
6501         AC_LANG_POP([C++])
6502     fi
6503     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6504         AC_MSG_RESULT([yes])
6505     else
6506         AC_MSG_RESULT([no])
6507     fi
6509 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6510 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6512 dnl ===================================================================
6513 dnl Compiler plugins
6514 dnl ===================================================================
6516 COMPILER_PLUGINS=
6517 # currently only Clang
6518 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
6519     if test -n "$enable_compiler_plugins"; then
6520         compiler_plugins="$enable_compiler_plugins"
6521     elif test -n "$ENABLE_DBGUTIL"; then
6522         compiler_plugins=test
6523     else
6524         compiler_plugins=no
6525     fi
6526     if test "$compiler_plugins" != "no"; then
6527         dnl The prefix where Clang resides, override to where Clang resides if
6528         dnl using a source build:
6529         if test -z "$CLANGDIR"; then
6530             CLANGDIR=/usr
6531         fi
6532         AC_LANG_PUSH([C++])
6533         save_CPPFLAGS=$CPPFLAGS
6534         save_CXX=$CXX
6535         # compiler plugins must be built with "native" bitness of clang
6536         # because they link against clang libraries
6537         CXX=`echo $CXX | sed -e s/-m64// -e s/-m32//`
6538         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6539         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6540             [COMPILER_PLUGINS=TRUE],
6541             [
6542             if test "$compiler_plugins" = "yes"; then
6543                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6544             else
6545                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6546                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6547             fi
6548             ])
6549         CXX=$save_CXX
6550         CPPFLAGS=$save_CPPFLAGS
6551         AC_LANG_POP([C++])
6552     fi
6553 else
6554     if test "$enable_compiler_plugins" = "yes"; then
6555         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6556     fi
6558 AC_SUBST(COMPILER_PLUGINS)
6559 AC_SUBST(CLANGDIR)
6561 # Plugin to help linker.
6562 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6563 # This makes --enable-lto build with clang work.
6564 AC_SUBST(LD_PLUGIN)
6566 dnl ===================================================================
6567 dnl allocator
6568 dnl ===================================================================
6569 AC_MSG_CHECKING([which memory allocator to use])
6570 if test "$with_alloc" = "system"; then
6571     AC_MSG_RESULT([system])
6572     ALLOC="SYS_ALLOC"
6574 if test "$with_alloc" = "tcmalloc"; then
6575     AC_MSG_RESULT(tcmalloc)
6576     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6577         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6578     fi
6579     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6580         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6581     ALLOC="TCMALLOC"
6583 if test "$with_alloc" = "jemalloc"; then
6584     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6585         AC_MSG_RESULT(jemalloc)
6586         save_CFLAGS=$CFLAGS
6587         CFLAGS="$CFLAGS -pthread"
6588         AC_CHECK_LIB([jemalloc], [malloc], [:],
6589             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6590         ALLOC="JEMALLOC"
6591         CFLAGS=$save_CFLAGS
6592     else
6593         AC_MSG_RESULT([system])
6594         ALLOC="SYS_ALLOC"
6595     fi
6597 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6598     AC_MSG_RESULT([internal])
6600 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6601 AC_SUBST(HAVE_POSIX_FALLOCATE)
6602 AC_SUBST(ALLOC)
6604 dnl ===================================================================
6605 dnl Custom build version
6606 dnl ===================================================================
6608 AC_MSG_CHECKING([whether to add custom build version])
6609 if test "$with_build_version" != ""; then
6610     BUILD_VER_STRING=$with_build_version
6611     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6612 else
6613     BUILD_VER_STRING=
6614     AC_MSG_RESULT([no])
6616 AC_SUBST(BUILD_VER_STRING)
6618 JITC_PROCESSOR_TYPE=""
6619 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6620     # IBMs JDK needs this...
6621     JITC_PROCESSOR_TYPE=6
6622     export JITC_PROCESSOR_TYPE
6624 AC_SUBST([JITC_PROCESSOR_TYPE])
6626 # Misc Windows Stuff
6627 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6628     find_msvc_x64_dlls
6629     find_msms
6630     MSVC_DLL_PATH="$msvcdllpath"
6631     MSVC_DLLS="$msvcdlls"
6632     MSM_PATH="$msmdir"
6633     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6636 AC_SUBST(MSVC_DLL_PATH)
6637 AC_SUBST(MSVC_DLLS)
6638 AC_SUBST(MSM_PATH)
6640 dnl ===================================================================
6641 dnl Checks for Java
6642 dnl ===================================================================
6643 if test "$ENABLE_JAVA" != ""; then
6645     # Windows-specific tests
6646     if test "$build_os" = "cygwin"; then
6647         if test "$BITNESS_OVERRIDE" = 64; then
6648             bitness=64
6649         else
6650             bitness=32
6651         fi
6653         if test -z "$with_jdk_home"; then
6654             for ver in 1.8 1.7 1.6; do
6655                 reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6656                 if test -n "$regvalue"; then
6657                     _jdk_home=$regvalue
6658                     break
6659                 fi
6660             done
6661             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6662                 with_jdk_home="$_jdk_home"
6663                 howfound="found automatically"
6664             else
6665                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6666             fi
6667         else
6668             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6669             howfound="you passed"
6670         fi
6671     fi
6673     # 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.
6674     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6675     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6676         with_jdk_home=`/usr/libexec/java_home`
6677     fi
6679     JAVA_HOME=; export JAVA_HOME
6680     if test -z "$with_jdk_home"; then
6681         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6682     else
6683         _java_path="$with_jdk_home/bin/$with_java"
6684         dnl Check if there is a Java interpreter at all.
6685         if test -x "$_java_path"; then
6686             JAVAINTERPRETER=$_java_path
6687         else
6688             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6689         fi
6690     fi
6692     if test "$build_os" = "cygwin"; then
6693         # Check that the JDK found is correct architecture
6694         # Why is this necessary, we don't link with any library from the JDK I think,
6696         shortjdkhome=`cygpath -d "$with_jdk_home"`
6697         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
6698             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6699             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6700         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
6701             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6702             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6703         fi
6705         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6706             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6707         fi
6708         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6709     elif test "$cross_compiling" != "yes"; then
6710         # at least 2 reasons to check: officebean needs to link -ljawt,
6711         # and libjpipe.so needs to be loaded by java to run JunitTests.
6712         case $CPUNAME in
6713             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64)
6714                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6715                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6716                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6717                 fi
6718                 ;;
6719             *) # assumption: everything else 32-bit
6720                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6721                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6722                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6723                 fi
6724                 ;;
6725         esac
6726     fi
6729 HAVE_JAVA6=
6730 HAVE_JAVA9=
6731 dnl ===================================================================
6732 dnl Checks for JDK.
6733 dnl ===================================================================
6735 # Note that JAVA_HOME as for now always means the *build* platform's
6736 # JAVA_HOME. Whether all the complexity here actually is needed any
6737 # more or not, no idea.
6739 if test "$ENABLE_JAVA" != ""; then
6740     _gij_longver=0
6741     AC_MSG_CHECKING([the installed JDK])
6742     if test -n "$JAVAINTERPRETER"; then
6743         dnl java -version sends output to stderr!
6744         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6745             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6746         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6747             JDK=gcj
6748             AC_MSG_RESULT([checked (gcj)])
6749             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6750             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6752         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6753             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6754         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6755             JDK=ibm
6757             dnl IBM JDK specific tests
6758             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6759             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6761             if test "$_jdk_ver" -lt 10500; then
6762                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6763             fi
6764             if test "$_jdk_ver" -ge 10600; then
6765                 HAVE_JAVA6=TRUE
6766             fi
6768             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6770             if test "$with_jdk_home" = ""; then
6771                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6772 you must use the "--with-jdk-home" configure option explicitly])
6773             fi
6775             JAVA_HOME=$with_jdk_home
6776         else
6777             JDK=sun
6779             dnl Sun JDK specific tests
6780             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6781             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6783             if test "$_jdk_ver" -lt 10500; then
6784                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6785             fi
6786             if test "$_jdk_ver" -gt 10600; then
6787                 JAVA_CLASSPATH_NOT_SET="1"
6788             fi
6789             if test "$_jdk_ver" -ge 10600; then
6790                 HAVE_JAVA6=TRUE
6791             fi
6792             if test "$_jdk_ver" -ge 10900; then
6793                 HAVE_JAVA9=TRUE
6794             fi
6796             AC_MSG_RESULT([checked (JDK $_jdk)])
6797             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6798             if test "$_os" = "WINNT"; then
6799                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6800             fi
6802             # set to limit VM usage for JunitTests
6803             JAVAIFLAGS=-Xmx64M
6804             # set to limit VM usage for javac
6805             JAVAFLAGS=-J-Xmx128M
6806         fi
6807     else
6808         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6809     fi
6810 else
6811     dnl Java disabled
6812     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6814 AC_SUBST([HAVE_JAVA6])
6815 AC_SUBST([HAVE_JAVA9])
6817 dnl ===================================================================
6818 dnl Set target Java bytecode version
6819 dnl ===================================================================
6820 if test "$ENABLE_JAVA" != ""; then
6821     if test "$HAVE_JAVA9" == "TRUE"; then
6822         _java_target_ver="1.6"
6823     else
6824         _java_target_ver="1.5"
6825     fi
6826     JAVA_SOURCE_VER="$_java_target_ver"
6827     JAVA_TARGET_VER="$_java_target_ver"
6830 dnl ===================================================================
6831 dnl Checks for javac
6832 dnl ===================================================================
6833 if test "$ENABLE_JAVA" != ""; then
6834     if test "$JDK" = "gcj"; then
6835         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6836     else
6837         javacompiler="javac"
6838     fi
6839     if test -z "$with_jdk_home"; then
6840         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6841     else
6842         _javac_path="$with_jdk_home/bin/$javacompiler"
6843         dnl Check if there is a Java compiler at all.
6844         if test -x "$_javac_path"; then
6845             JAVACOMPILER=$_javac_path
6846         fi
6847     fi
6848     if test -z "$JAVACOMPILER"; then
6849         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6850     fi
6851     if test "$build_os" = "cygwin"; then
6852         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6853             JAVACOMPILER="${JAVACOMPILER}.exe"
6854         fi
6855         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6856     fi
6858     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6859         AC_MSG_CHECKING([re-checking JDK])
6860         JDK=gcj
6861         AC_MSG_RESULT([checked (ecj)])
6862         _gij_longver="40200"
6863     fi
6866 JAVACISGCJ=""
6867 dnl ===================================================================
6868 dnl Checks that javac is gcj
6869 dnl ===================================================================
6870 if test "$ENABLE_JAVA" != ""; then
6871     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6872         JAVACISGCJ="yes"
6873     fi
6875 AC_SUBST(JAVACISGCJ)
6877 dnl ===================================================================
6878 dnl Checks for javadoc
6879 dnl ===================================================================
6880 if test "$ENABLE_JAVA" != ""; then
6881     if test -z "$with_jdk_home"; then
6882         AC_PATH_PROG(JAVADOC, javadoc)
6883     else
6884         _javadoc_path="$with_jdk_home/bin/javadoc"
6885         dnl Check if there is a javadoc at all.
6886         if test -x "$_javadoc_path"; then
6887             JAVADOC=$_javadoc_path
6888         else
6889             AC_PATH_PROG(JAVADOC, javadoc)
6890         fi
6891     fi
6892     if test -z "$JAVADOC"; then
6893         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6894     fi
6895     if test "$build_os" = "cygwin"; then
6896         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6897             JAVADOC="${JAVADOC}.exe"
6898         fi
6899         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6900     fi
6902     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6903     JAVADOCISGJDOC="yes"
6904     fi
6906 AC_SUBST(JAVADOCISGJDOC)
6908 if test "$ENABLE_JAVA" != ""; then
6909     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6910     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6911         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6912            # try to recover first by looking whether we have a alternatives
6913            # system as in Debian or newer SuSEs where following /usr/bin/javac
6914            # over /etc/alternatives/javac leads to the right bindir where we
6915            # just need to strip a bit away to get a valid JAVA_HOME
6916            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6917         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6918             # maybe only one level of symlink (e.g. on Mac)
6919             JAVA_HOME=$(readlink $JAVACOMPILER)
6920             if test "$(dirname $JAVA_HOME)" = "."; then
6921                 # we've got no path to trim back
6922                 JAVA_HOME=""
6923             fi
6924         else
6925             # else warn
6926             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6927             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6928             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6929             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6930         fi
6931         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
6932         if test "$JAVA_HOME" != "/usr"; then
6933             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6934                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6935                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6936                 dnl Tiger already returns a JDK path..
6937                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6938             else
6939                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6940             fi
6941         fi
6942     fi
6943     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6945     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6946     if test -z "$JAVA_HOME"; then
6947         if test "x$with_jdk_home" = "x"; then
6948             cat > findhome.java <<_ACEOF
6949 [import java.io.File;
6951 class findhome
6953     public static void main(String args[])
6954     {
6955         String jrelocation = System.getProperty("java.home");
6956         File jre = new File(jrelocation);
6957         System.out.println(jre.getParent());
6958     }
6960 _ACEOF
6961             AC_MSG_CHECKING([if javac works])
6962             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6963             AC_TRY_EVAL(javac_cmd)
6964             if test $? = 0 -a -f ./findhome.class; then
6965                 AC_MSG_RESULT([javac works])
6966             else
6967                 echo "configure: javac test failed" >&5
6968                 cat findhome.java >&5
6969                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6970             fi
6971             AC_MSG_CHECKING([if gij knows its java.home])
6972             JAVA_HOME=`$JAVAINTERPRETER findhome`
6973             if test $? = 0 -a "$JAVA_HOME" != ""; then
6974                 AC_MSG_RESULT([$JAVA_HOME])
6975             else
6976                 echo "configure: java test failed" >&5
6977                 cat findhome.java >&5
6978                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6979             fi
6980             # clean-up after ourselves
6981             rm -f ./findhome.java ./findhome.class
6982         else
6983             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6984         fi
6985     fi
6987     dnl second sanity check JAVA_HOME if possible
6988     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
6989         # now check if $JAVA_HOME is really valid
6990         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6991             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6992                 JAVA_HOME_OK="NO"
6993             fi
6994         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6995             JAVA_HOME_OK="NO"
6996         fi
6997         if test "$JAVA_HOME_OK" = "NO"; then
6998             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6999             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7000             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7001             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7002             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7003             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7004         fi
7005     fi
7006     PathFormat "$JAVA_HOME"
7007     JAVA_HOME="$formatted_path"
7010 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7011     "$_os" != Darwin
7012 then
7013     AC_MSG_CHECKING([for JAWT lib])
7014     if test "$_os" = WINNT; then
7015         if test "$WITH_MINGW" = yes; then
7016             # The path is taken care of in gb_LinkTarget__use_jawt
7017             # in RepositoryExternal.mk:
7018             JAWTLIB=-ljawt
7019         else
7020             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7021             JAWTLIB=jawt.lib
7022         fi
7023     else
7024         case "$host_cpu" in
7025         arm*)
7026             my_java_arch=arm
7027             ;;
7028         i*86)
7029             my_java_arch=i386
7030             ;;
7031         m68k)
7032             my_java_arch=mk68
7033             ;;
7034         powerpc)
7035             my_java_arch=ppc
7036             ;;
7037         powerpc64)
7038             my_java_arch=ppc64
7039             ;;
7040         powerpc64le)
7041             AS_IF([test -d "$JAVA_HOME/jre/lib/ppc64le"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7042             JAVA_ARCH=$my_java_arch
7043             ;;
7044         x86_64)
7045             my_java_arch=amd64
7046             ;;
7047         *)
7048             my_java_arch=$host_cpu
7049             ;;
7050         esac
7051         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7052         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7053     fi
7054     AC_MSG_RESULT([$JAWTLIB])
7056 AC_SUBST(JAWTLIB)
7058 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7059     case "$host_os" in
7061     aix*)
7062         JAVAINC="-I$JAVA_HOME/include"
7063         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7064         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7065         ;;
7067     cygwin*)
7068         JAVAINC="-I$JAVA_HOME/include/win32"
7069         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7070         ;;
7072     darwin*)
7073         if test -d "$JAVA_HOME/include/darwin"; then
7074             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7075         else
7076             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7077         fi
7078         ;;
7080     dragonfly*)
7081         JAVAINC="-I$JAVA_HOME/include"
7082         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7083         ;;
7085     freebsd*)
7086         JAVAINC="-I$JAVA_HOME/include"
7087         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7088         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7089         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7090         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7091         ;;
7093     k*bsd*-gnu*)
7094         JAVAINC="-I$JAVA_HOME/include"
7095         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7096         ;;
7098     linux-gnu*)
7099         JAVAINC="-I$JAVA_HOME/include"
7100         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7101         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7102         ;;
7104     mingw*)
7105         JAVAINC="-I$JAVA_HOME/include"
7106         ;;
7108     *netbsd*)
7109         JAVAINC="-I$JAVA_HOME/include"
7110         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7111         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7112        ;;
7114     openbsd*)
7115         JAVAINC="-I$JAVA_HOME/include"
7116         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7117         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7118         ;;
7120     solaris*)
7121         JAVAINC="-I$JAVA_HOME/include"
7122         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7123         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7124         ;;
7125     esac
7127 SOLARINC="$SOLARINC $JAVAINC"
7129 AC_SUBST(JAVACOMPILER)
7130 AC_SUBST(JAVADOC)
7131 AC_SUBST(JAVAINTERPRETER)
7132 AC_SUBST(JAVAIFLAGS)
7133 AC_SUBST(JAVAFLAGS)
7134 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7135 AC_SUBST(JAVA_HOME)
7136 AC_SUBST(JAVA_SOURCE_VER)
7137 AC_SUBST(JAVA_TARGET_VER)
7138 AC_SUBST(JDK)
7140 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7141 if test -n "$with_idlc_cpp"; then
7142     AC_MSG_RESULT([$with_idlc_cpp])
7143     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7144 else
7145     AC_MSG_RESULT([ucpp])
7146     AC_MSG_CHECKING([which ucpp tp use])
7147     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7148         AC_MSG_RESULT([external])
7149         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7150     else
7151         AC_MSG_RESULT([internal])
7152         BUILD_TYPE="$BUILD_TYPE UCPP"
7153     fi
7155 AC_SUBST(SYSTEM_UCPP)
7157 dnl ===================================================================
7158 dnl Check for epm (not needed for Windows)
7159 dnl ===================================================================
7160 AC_MSG_CHECKING([whether to enable EPM for packing])
7161 if test "$enable_epm" = "yes"; then
7162     AC_MSG_RESULT([yes])
7163     if test "$_os" != "WINNT"; then
7164         if test $_os = Darwin; then
7165             EPM=internal
7166         elif test -n "$with_epm"; then
7167             EPM=$with_epm
7168         else
7169             AC_PATH_PROG(EPM, epm, no)
7170         fi
7171         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7172             echo "EPM will be built."
7173             BUILD_TYPE="$BUILD_TYPE EPM"
7174             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7175         else
7176             # Gentoo has some epm which is something different...
7177             AC_MSG_CHECKING([whether the found epm is the right epm])
7178             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7179                 AC_MSG_RESULT([yes])
7180             else
7181                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7182             fi
7183             AC_MSG_CHECKING([epm version])
7184             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7185             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7186                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7187                 AC_MSG_RESULT([OK, >= 3.7])
7188             else
7189                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7190                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7191             fi
7192         fi
7193     fi
7195     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7196         AC_MSG_CHECKING([for rpm])
7197         for a in "$RPM" rpmbuild rpm; do
7198             $a --usage >/dev/null 2> /dev/null
7199             if test $? -eq 0; then
7200                 RPM=$a
7201                 break
7202             else
7203                 $a --version >/dev/null 2> /dev/null
7204                 if test $? -eq 0; then
7205                     RPM=$a
7206                     break
7207                 fi
7208             fi
7209         done
7210         if test -z "$RPM"; then
7211             AC_MSG_ERROR([not found])
7212         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7213             RPM_PATH=`which $RPM`
7214             AC_MSG_RESULT([$RPM_PATH])
7215             SCPDEFS="$SCPDEFS -DWITH_RPM"
7216         else
7217             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7218         fi
7219     fi
7220     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7221         AC_PATH_PROG(DPKG, dpkg, no)
7222         if test "$DPKG" = "no"; then
7223             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7224         fi
7225     fi
7226     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7227        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7228         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7229             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7230                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7231                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7232                     AC_MSG_RESULT([yes])
7233                 else
7234                     AC_MSG_RESULT([no])
7235                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7236                         _pt="rpm"
7237                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7238                         add_warning "the rpms will need to be installed with --nodeps"
7239                     else
7240                         _pt="pkg"
7241                     fi
7242                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7243                     add_warning "the ${_pt}s will not be relocateable"
7244                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7245                                  relocation will work, you need to patch your epm with the
7246                                  patch in epm/epm-3.7.patch or build with
7247                                  --with-epm=internal which will build a suitable epm])
7248                 fi
7249             fi
7250         fi
7251     fi
7252     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7253         AC_PATH_PROG(PKGMK, pkgmk, no)
7254         if test "$PKGMK" = "no"; then
7255             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7256         fi
7257     fi
7258     AC_SUBST(RPM)
7259     AC_SUBST(DPKG)
7260     AC_SUBST(PKGMK)
7261 else
7262     for i in $PKGFORMAT; do
7263         case "$i" in
7264         aix | bsd | deb | pkg | rpm | native | portable)
7265             AC_MSG_ERROR(
7266                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7267             ;;
7268         esac
7269     done
7270     AC_MSG_RESULT([no])
7271     EPM=NO
7273 AC_SUBST(EPM)
7275 dnl ===================================================================
7276 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7277 dnl ===================================================================
7278 WINEGCC=
7279 if test "$enable_winegcc" = "yes"; then
7280     AC_PATH_PROG(WINEGCC, winegcc)
7281     if test "$WINEGCC" = ""; then
7282         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7283     fi
7284     CC_save="$CC"
7285     ac_exeext_save="$ac_exeext"
7286     CC="$WINEGCC -m32"
7287     ac_exeext=".exe"
7288     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7289 #include <stdio.h>
7290         ],[
7291 printf ("hello world\n");
7292         ])],,
7293         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7294     )
7295     CC="$CC_save"
7296     ac_exeext="$ac_exeext_save"
7298 AC_SUBST(WINEGCC)
7300 if test $_os = iOS; then
7301     enable_mpl_subset=yes
7302     enable_lotuswordpro=no
7303     enable_coinmp=yes
7304     enable_lpsolve=no
7305     enable_postgresql_sdbc=no
7306     enable_extension_integration=no
7307     enable_report_builder=no
7308     with_theme="tango"
7309     with_ppds=no
7312 ENABLE_LWP=
7313 if test "$enable_lotuswordpro" = "yes"; then
7314     ENABLE_LWP="TRUE"
7315     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7317 AC_SUBST(ENABLE_LWP)
7319 dnl ===================================================================
7320 dnl Check for gperf
7321 dnl ===================================================================
7322 AC_PATH_PROG(GPERF, gperf)
7323 if test -z "$GPERF"; then
7324     AC_MSG_ERROR([gperf not found but needed. Install it.])
7326 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7327     GPERF=`cygpath -m $GPERF`
7329 AC_MSG_CHECKING([gperf version])
7330 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7331     AC_MSG_RESULT([OK])
7332 else
7333     AC_MSG_ERROR([too old, you need at least 3.0.0])
7335 AC_SUBST(GPERF)
7337 dnl ===================================================================
7338 dnl Check for building ODK
7339 dnl ===================================================================
7340 if test "$enable_odk" = no; then
7341     unset DOXYGEN
7342 else
7343     if test "$with_doxygen" = no; then
7344         AC_MSG_CHECKING([for doxygen])
7345         unset DOXYGEN
7346         AC_MSG_RESULT([no])
7347     else
7348         if test "$with_doxygen" = yes; then
7349             AC_PATH_PROG([DOXYGEN], [doxygen])
7350             if test -z "$DOXYGEN"; then
7351                 if test "$enable_odk" = "" ; then
7352                     enable_odk="no"
7353                 else
7354                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7355                 fi
7356             fi
7357         else
7358             AC_MSG_CHECKING([for doxygen])
7359             DOXYGEN=$with_doxygen
7360             AC_MSG_RESULT([$DOXYGEN])
7361         fi
7362         if test -n "$DOXYGEN"; then
7363             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7364             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7365             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7366                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7367             fi
7368         fi
7369     fi
7371 AC_SUBST([DOXYGEN])
7373 AC_MSG_CHECKING([whether to build the ODK])
7374 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7375     AC_MSG_RESULT([yes])
7377     if test "$with_java" != "no"; then
7378         AC_MSG_CHECKING([whether to build unowinreg.dll])
7379         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7380             # build on Win by default
7381             enable_build_unowinreg=yes
7382         fi
7383         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7384             AC_MSG_RESULT([no])
7385             BUILD_UNOWINREG=
7386         else
7387             AC_MSG_RESULT([yes])
7388             BUILD_UNOWINREG=TRUE
7389         fi
7390         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7391             if test -z "$with_mingw_cross_compiler"; then
7392                 dnl Guess...
7393                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7394             elif test -x "$with_mingw_cross_compiler"; then
7395                  MINGWCXX="$with_mingw_cross_compiler"
7396             else
7397                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7398             fi
7400             if test "$MINGWCXX" = "false"; then
7401                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7402             fi
7404             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7405             if test -x "$mingwstrip_test"; then
7406                 MINGWSTRIP="$mingwstrip_test"
7407             else
7408                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7409             fi
7411             if test "$MINGWSTRIP" = "false"; then
7412                 AC_MSG_ERROR(MinGW32 binutils not found.)
7413             fi
7414         fi
7415     fi
7416     BUILD_TYPE="$BUILD_TYPE ODK"
7417 else
7418     AC_MSG_RESULT([no])
7419     BUILD_UNOWINREG=
7421 AC_SUBST(BUILD_UNOWINREG)
7422 AC_SUBST(MINGWCXX)
7423 AC_SUBST(MINGWSTRIP)
7425 dnl ===================================================================
7426 dnl Check for system zlib
7427 dnl ===================================================================
7428 if test "$with_system_zlib" = "auto"; then
7429     case "$_os" in
7430     WINNT)
7431         with_system_zlib="$with_system_libs"
7432         ;;
7433     *)
7434         with_system_zlib=yes
7435         ;;
7436     esac
7439 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7440 dnl and has no pkg-config for it at least on some tinderboxes,
7441 dnl so leaving that out for now
7442 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7443 AC_MSG_CHECKING([which zlib to use])
7444 if test "$with_system_zlib" = "yes"; then
7445     AC_MSG_RESULT([external])
7446     SYSTEM_ZLIB=TRUE
7447     AC_CHECK_HEADER(zlib.h, [],
7448         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7449     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7450         [AC_MSG_ERROR(zlib not found or functional)], [])
7451 else
7452     AC_MSG_RESULT([internal])
7453     SYSTEM_ZLIB=
7454     BUILD_TYPE="$BUILD_TYPE ZLIB"
7455     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7456     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7458 AC_SUBST(ZLIB_CFLAGS)
7459 AC_SUBST(ZLIB_LIBS)
7460 AC_SUBST(SYSTEM_ZLIB)
7462 dnl ===================================================================
7463 dnl Check for system jpeg
7464 dnl ===================================================================
7465 if test "$with_jpeg_turbo" = "auto"; then
7466     # TODO use jpeg-turbo on Darwin too
7467     case "$_os" in
7468     WINNT)
7469         with_jpeg_turbo=yes
7470         ;;
7471     *)
7472         with_jpeg_turbo=no
7473         ;;
7474     esac
7477 if test "$with_system_jpeg" = "yes"; then
7478     AC_MSG_RESULT([external])
7479     SYSTEM_JPEG=TRUE
7480     AC_CHECK_HEADER(jpeglib.h, [],
7481         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7482     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7483     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7484     libo_MINGW_CHECK_DLL([libjpeg])
7485 else
7486     SYSTEM_JPEG=
7487     if test "$with_jpeg_turbo" = "yes"; then
7488         AC_MSG_RESULT([internal, jpeg-turbo])
7489         BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7490         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7492         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7493             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7494                 NASM="$LODE_HOME/opt/bin/nasm"
7495             elif test -x "/opt/lo/bin/nasm"; then
7496                 NASM="/opt/lo/bin/nasm"
7497             fi
7498         fi
7499         if test -z "$NASM"; then
7500 cat << _EOS
7501 ****************************************************************************
7502 You need nasm (Netwide Assembler) to build internal jpeg library.
7503 To get one please do:
7505 _EOS
7506         if test "$build_os" = "cygwin"; then
7507 cat << _EOS
7508 install a pre-compiled binary for Win32
7510  mkdir -p /opt/lo/bin
7511  cd /opt/lo/bin
7512  wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7513  chmod +x nasm
7514 _EOS
7515             else
7516 cat << _EOS
7517 consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
7518 _EOS
7519             fi
7520 cat << _EOS
7522 or get and install one from http://www.nasm.us/
7524 Then re-run autogen.sh
7526 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7527 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7529 _EOS
7530         AC_MSG_ERROR([no nasm (Netwide Assembler) found])
7531         fi
7532     else
7533         AC_MSG_RESULT([internal, jpeg])
7534         BUILD_TYPE="$BUILD_TYPE JPEG"
7535     fi
7537 AC_SUBST(NASM)
7538 AC_SUBST(SYSTEM_JPEG)
7540 dnl ===================================================================
7541 dnl Check for system clucene
7542 dnl ===================================================================
7543 dnl we should rather be using
7544 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7545 dnl but the contribs-lib check seems tricky
7546 AC_MSG_CHECKING([which clucene to use])
7547 if test "$with_system_clucene" = "yes"; then
7548     AC_MSG_RESULT([external])
7549     SYSTEM_CLUCENE=TRUE
7550     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7551     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7552     AC_LANG_PUSH([C++])
7553     save_CXXFLAGS=$CXXFLAGS
7554     save_CPPFLAGS=$CPPFLAGS
7555     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7556     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7557     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7558     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7559     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7560                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7561     CXXFLAGS=$save_CXXFLAGS
7562     CPPFLAGS=$save_CPPFLAGS
7563     AC_LANG_POP([C++])
7565     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7566 else
7567     AC_MSG_RESULT([internal])
7568     SYSTEM_CLUCENE=
7569     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7571 AC_SUBST(SYSTEM_CLUCENE)
7572 AC_SUBST(CLUCENE_CFLAGS)
7573 AC_SUBST(CLUCENE_LIBS)
7575 dnl ===================================================================
7576 dnl Check for system expat
7577 dnl ===================================================================
7578 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7579 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7580 AC_MSG_CHECKING([which expat to use])
7581 if test "$with_system_expat" = "yes"; then
7582     AC_MSG_RESULT([external])
7583     SYSTEM_EXPAT=TRUE
7584     AC_CHECK_HEADER(expat.h, [],
7585         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7586     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7587         [AC_MSG_RESULT(expat library not found or functional.)], [])
7588     libo_MINGW_CHECK_DLL([libexpat])
7589 else
7590     AC_MSG_RESULT([internal])
7591     SYSTEM_EXPAT=
7592     BUILD_TYPE="$BUILD_TYPE EXPAT"
7594 AC_SUBST(SYSTEM_EXPAT)
7596 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7597 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7598     ENABLE_EOT="TRUE"
7599     AC_DEFINE([ENABLE_EOT])
7600     AC_MSG_RESULT([yes])
7602     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7603 else
7604     ENABLE_EOT=
7605     AC_MSG_RESULT([no])
7607 AC_SUBST([ENABLE_EOT])
7609 dnl ===================================================================
7610 dnl Check for system librevenge
7611 dnl ===================================================================
7612 AS_IF([test "$COM" = "MSC"],
7613       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7614       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7616 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7618 dnl ===================================================================
7619 dnl Check for system libe-book
7620 dnl ===================================================================
7621 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1 >= 0.1.1])
7623 dnl ===================================================================
7624 dnl Check for system libetonyek
7625 dnl ===================================================================
7626 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1 >= 0.1.2])
7628 dnl ===================================================================
7629 dnl Check for system libfreehand
7630 dnl ===================================================================
7631 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7633 dnl ===================================================================
7634 dnl Check for system libodfgen
7635 dnl ===================================================================
7636 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7638 dnl ===================================================================
7639 dnl Check for system libcdr
7640 dnl ===================================================================
7641 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7643 dnl ===================================================================
7644 dnl Check for system libmspub
7645 dnl ===================================================================
7646 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7648 dnl ===================================================================
7649 dnl Check for system libmwaw
7650 dnl ===================================================================
7651 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.5])
7653 dnl ===================================================================
7654 dnl Check for system libpagemaker
7655 dnl ===================================================================
7656 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7658 dnl ===================================================================
7659 dnl Check for system libvisio
7660 dnl ===================================================================
7661 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7663 dnl ===================================================================
7664 dnl Check for system libcmis
7665 dnl ===================================================================
7666 # libcmis requires curl and we can't build curl for iOS
7667 if test $_os != iOS; then
7668     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7669     ENABLE_CMIS=TRUE
7670 else
7671     ENABLE_CMIS=
7673 AC_SUBST(ENABLE_CMIS)
7675 dnl ===================================================================
7676 dnl Check for system libwpd
7677 dnl ===================================================================
7678 AS_IF([test "$COM" = "MSC"],
7679       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7680       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7682 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7684 dnl ===================================================================
7685 dnl Check for system lcms2
7686 dnl ===================================================================
7687 if test "$with_system_lcms2" = "yes"; then
7688     libo_MINGW_CHECK_DLL([liblcms2])
7689 else
7690     SYSTEM_LCMS2=
7692 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7693 if test "$GCC" = "yes"; then
7694     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7696 if test "$COM" = "MSC"; then # override the above
7697     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7700 dnl ===================================================================
7701 dnl Check for system cppunit
7702 dnl ===================================================================
7703 if test "$cross_compiling" != "yes"; then
7704     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7707 dnl ===================================================================
7708 dnl Check whether freetype is available
7709 dnl ===================================================================
7710 if test  "$test_freetype" = "yes"; then
7711     AC_MSG_CHECKING([whether freetype is available])
7712     # FreeType has 3 different kinds of versions
7713     # * release, like 2.4.10
7714     # * libtool, like 13.0.7 (this what pkg-config returns)
7715     # * soname
7716     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7717     #
7718     # 9.9.3 is 2.2.0
7719     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7720     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7721     SYSTEM_FREETYPE=TRUE
7722     _save_libs="$LIBS"
7723     _save_cflags="$CFLAGS"
7724     LIBS="$LIBS $FREETYPE_LIBS"
7725     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7726     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7727     LIBS="$_save_libs"
7728     CFLAGS="$_save_cflags"
7730 AC_SUBST(FREETYPE_CFLAGS)
7731 AC_SUBST(FREETYPE_LIBS)
7732 AC_SUBST([SYSTEM_FREETYPE])
7734 dnl ===================================================================
7735 dnl Check for system libabw
7736 dnl ===================================================================
7737 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7739 dnl ===================================================================
7740 dnl Check for system libwps
7741 dnl ===================================================================
7742 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7744 dnl ===================================================================
7745 dnl Check for system libwpg
7746 dnl ===================================================================
7747 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7749 # ===================================================================
7750 # Check for system libxslt
7751 # to prevent incompatibilities between internal libxml2 and external libxslt,
7752 # or vice versa, use with_system_libxml here
7753 # ===================================================================
7754 if test "$with_system_libxml" = "auto"; then
7755     case "$_os" in
7756     WINNT|iOS|Android)
7757         with_system_libxml="$with_system_libs"
7758         ;;
7759     *)
7760         with_system_libxml=yes
7761         ;;
7762     esac
7765 AC_MSG_CHECKING([which libxslt to use])
7766 if test "$with_system_libxml" = "yes"; then
7767     AC_MSG_RESULT([external])
7768     SYSTEM_LIBXSLT=TRUE
7769     if test "$_os" = "Darwin"; then
7770         dnl make sure to use SDK path
7771         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7772         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7773         dnl omit -L/usr/lib
7774         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7775         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7776     else
7777         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7778         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7779         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7780         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7781     fi
7783     dnl Check for xsltproc
7784     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7785     if test "$XSLTPROC" = "no"; then
7786         AC_MSG_ERROR([xsltproc is required])
7787     fi
7789     libo_MINGW_CHECK_DLL([libxslt])
7790     libo_MINGW_CHECK_DLL([libexslt])
7791     libo_MINGW_TRY_DLL([iconv])
7792 else
7793     AC_MSG_RESULT([internal])
7794     SYSTEM_LIBXSLT=
7795     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7797     if test "$cross_compiling" = "yes"; then
7798         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7799         if test "$XSLTPROC" = "no"; then
7800             AC_MSG_ERROR([xsltproc is required])
7801         fi
7802     fi
7804 AC_SUBST(SYSTEM_LIBXSLT)
7805 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7806     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7808 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7810 AC_SUBST(LIBEXSLT_CFLAGS)
7811 AC_SUBST(LIBEXSLT_LIBS)
7812 AC_SUBST(LIBXSLT_CFLAGS)
7813 AC_SUBST(LIBXSLT_LIBS)
7814 AC_SUBST(XSLTPROC)
7816 # ===================================================================
7817 # Check for system libxml
7818 # ===================================================================
7819 AC_MSG_CHECKING([which libxml to use])
7820 if test "$with_system_libxml" = "yes"; then
7821     AC_MSG_RESULT([external])
7822     SYSTEM_LIBXML=TRUE
7823     if test "$_os" = "Darwin"; then
7824         dnl make sure to use SDK path
7825         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7826         dnl omit -L/usr/lib
7827         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7828     elif test $_os = iOS; then
7829         dnl make sure to use SDK path
7830         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7831         LIBXML_CFLAGS="-I$usr/include/libxml2"
7832         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7833     else
7834         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7835         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7836     fi
7838     dnl Check for xmllint
7839     AC_PATH_PROG(XMLLINT, xmllint, no)
7840     if test "$XMLLINT" = "no"; then
7841         AC_MSG_ERROR([xmllint is required])
7842     fi
7844     libo_MINGW_CHECK_DLL([libxml2])
7845     libo_MINGW_TRY_DLL([zlib1])
7846 else
7847     AC_MSG_RESULT([internal])
7848     SYSTEM_LIBXML=
7849     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
7850     if test "$COM" = "MSC"; then
7851         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7852     fi
7853     if test "$COM" = "MSC"; then
7854         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
7855     else
7856         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
7857     fi
7858     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7860 AC_SUBST(SYSTEM_LIBXML)
7861 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7862     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7864 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7865 AC_SUBST(LIBXML_CFLAGS)
7866 AC_SUBST(LIBXML_LIBS)
7867 AC_SUBST(XMLLINT)
7869 # =====================================================================
7870 # Checking for a Python interpreter with version >= 2.6.
7871 # Build and runtime requires Python 3 compatible version (>= 2.6).
7872 # Optionally user can pass an option to configure, i. e.
7873 # ./configure PYTHON=/usr/bin/python
7874 # =====================================================================
7875 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7876     # This allows a lack of system python with no error, we use internal one in that case.
7877     AM_PATH_PYTHON([2.6],, [:])
7878     # Clean PYTHON_VERSION checked below if cross-compiling
7879     PYTHON_VERSION=""
7880     if test "$PYTHON" != ":"; then
7881         PYTHON_FOR_BUILD=$PYTHON
7882     fi
7884 AC_SUBST(PYTHON_FOR_BUILD)
7886 # Checks for Python to use for Pyuno
7887 AC_MSG_CHECKING([which Python to use for Pyuno])
7888 case "$enable_python" in
7889 no|disable)
7890     if test -z $PYTHON_FOR_BUILD; then
7891         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7892         # requirement from the choice whether to include Python stuff in the installer, but why
7893         # bother?
7894         AC_MSG_ERROR([Python is required at build time.])
7895     fi
7896     enable_python=no
7897     AC_MSG_RESULT([none])
7898     ;;
7899 ""|yes|auto)
7900     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7901         AC_MSG_RESULT([no, overridden by --disable-scripting])
7902         enable_python=no
7903     elif test $build_os = cygwin; then
7904         dnl When building on Windows we don't attempt to use any installed
7905         dnl "system"  Python.
7906         dnl
7907         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7908         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7909         dnl MinGW cross-compilation setups.)
7910         AC_MSG_RESULT([fully internal])
7911         enable_python=internal
7912     elif test "$cross_compiling" = yes; then
7913         AC_MSG_RESULT([system])
7914         enable_python=system
7915     else
7916         # Unset variables set by the above AM_PATH_PYTHON so that
7917         # we actually do check anew.
7918         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
7919         AM_PATH_PYTHON([3.3],, [:])
7920         if test "$PYTHON" = ":"; then
7921             if test -z "$PYTHON_FOR_BUILD"; then
7922                 AC_MSG_RESULT([fully internal])
7923             else
7924                 AC_MSG_RESULT([internal])
7925             fi
7926             enable_python=internal
7927         else
7928             AC_MSG_RESULT([system])
7929             enable_python=system
7930         fi
7931     fi
7932     ;;
7933 internal)
7934     AC_MSG_RESULT([internal])
7935     ;;
7936 fully-internal)
7937     AC_MSG_RESULT([fully internal])
7938     enable_python=internal
7939     ;;
7940 system)
7941     AC_MSG_RESULT([system])
7942     ;;
7944     AC_MSG_ERROR([Incorrect --enable-python option])
7945     ;;
7946 esac
7948 if test $enable_python != no; then
7949     BUILD_TYPE="$BUILD_TYPE PYUNO"
7952 if test $enable_python = system; then
7953     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7954         python_version=2.7
7955         PYTHON=python$python_version
7956         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
7957             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
7958             PYTHON_LIBS="-framework Python"
7959         else
7960             PYTHON_CFLAGS="`$PYTHON-config --includes`"
7961             PYTHON_LIBS="`$PYTHON-config --libs`"
7962         fi
7963     fi
7964     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
7965         # Fallback: Accept these in the environment, or as set above
7966         # for MacOSX.
7967         :
7968     elif test "$cross_compiling" != yes; then
7969         # Unset variables set by the above AM_PATH_PYTHON so that
7970         # we actually do check anew.
7971         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
7972         # This causes an error if no python command is found
7973         AM_PATH_PYTHON([3.3])
7974         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
7975         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
7976         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
7977         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
7978         if test -z "$PKG_CONFIG"; then
7979             PYTHON_CFLAGS="-I$python_include"
7980             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7981         elif $PKG_CONFIG --exists python-$python_version; then
7982             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
7983             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
7984         else
7985             PYTHON_CFLAGS="-I$python_include"
7986             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7987         fi
7988     else
7989         dnl How to find out the cross-compilation Python installation path?
7990         dnl Let's hardocode what we know for different distributions for now...
7991         for python_version in 2.6; do
7992             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
7993                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
7994                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
7995                 AC_MSG_CHECKING([for python.exe])
7996                 libo_MINGW_CHECK_DLL([libpython$python_version])
7997                 libo_MINGW_CHECK_DLL([libreadline6])
7998                 libo_MINGW_CHECK_DLL([libtermcap])
7999                 # could we somehow extract the really mingw python version from
8000                 # actual distro package?
8001                 # 2.6.2 currently on OpenSUSE 12.1?
8002                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8003                 PYTHON_VERSION=$python_version.2
8004                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8005                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8006                 break
8007             fi
8008         done
8009         AC_MSG_CHECKING([for python version])
8010         AS_IF([test -n "$PYTHON_VERSION"],
8011               [AC_MSG_RESULT([$PYTHON_VERSION])],
8012               [AC_MSG_RESULT([not found])
8013                AC_MSG_ERROR([no usable python found])])
8014         test -n "$PYTHON_CFLAGS" && break
8015     fi
8016     # let the PYTHON_FOR_BUILD match the same python installation that
8017     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8018     # better for PythonTests.
8019     PYTHON_FOR_BUILD=$PYTHON
8022 dnl By now enable_python should be "system", "internal" or "no"
8023 case $enable_python in
8024 system)
8025     SYSTEM_PYTHON=TRUE
8027     if test "$CROSS_COMPILING" != TRUE; then
8028         dnl Check if the headers really work
8029         save_CPPFLAGS="$CPPFLAGS"
8030         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8031         AC_CHECK_HEADER(Python.h, [],
8032            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8033            [])
8034         CPPFLAGS="$save_CPPFLAGS"
8036         AC_LANG_PUSH(C)
8037         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8038         AC_MSG_CHECKING([for correct python library version])
8039            AC_RUN_IFELSE([AC_LANG_SOURCE([[
8040 #include <Python.h>
8042 int main(int argc, char **argv) {
8043        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8044            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8045        else return 1;
8047            ]])],[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])],[])
8048         CFLAGS=$save_CFLAGS
8049         AC_LANG_POP(C)
8051         dnl FIXME Check if the Python library can be linked with, too?
8052     fi
8053     ;;
8055 internal)
8056     SYSTEM_PYTHON=
8057     PYTHON_VERSION_MAJOR=3
8058     PYTHON_VERSION_MINOR=3
8059     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
8060     BUILD_TYPE="$BUILD_TYPE PYTHON"
8061     # Embedded Python dies without Home set
8062     if test "$HOME" = ""; then
8063         export HOME=""
8064     fi
8065     # bz2 tarball and bzip2 is not standard
8066     if test -z "$BZIP2"; then
8067         AC_PATH_PROG( BZIP2, bzip2)
8068         if test -z "$BZIP2"; then
8069             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8070         fi
8071     fi
8072     ;;
8074     DISABLE_PYTHON=TRUE
8075     SYSTEM_PYTHON=
8076     ;;
8078     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8079     ;;
8080 esac
8082 AC_SUBST(DISABLE_PYTHON)
8083 AC_SUBST(SYSTEM_PYTHON)
8084 AC_SUBST(PYTHON_CFLAGS)
8085 AC_SUBST(PYTHON_LIBS)
8086 AC_SUBST(PYTHON_VERSION)
8087 AC_SUBST(PYTHON_VERSION_MAJOR)
8088 AC_SUBST(PYTHON_VERSION_MINOR)
8090 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8091 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8092     AC_MSG_RESULT([yes])
8093     ENABLE_MARIADBC=TRUE
8094     MARIADBC_MAJOR=1
8095     MARIADBC_MINOR=0
8096     MARIADBC_MICRO=2
8097     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8098 else
8099     AC_MSG_RESULT([no])
8100     ENABLE_MARIADBC=
8102 AC_SUBST(ENABLE_MARIADBC)
8103 AC_SUBST(MARIADBC_MAJOR)
8104 AC_SUBST(MARIADBC_MINOR)
8105 AC_SUBST(MARIADBC_MICRO)
8107 if test "$ENABLE_MARIADBC" = "TRUE"; then
8109     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8111     dnl ===================================================================
8112     dnl Check for system MariaDB
8113     dnl ===================================================================
8114     AC_MSG_CHECKING([which MariaDB to use])
8115     if test "$with_system_mariadb" = "yes"; then
8116         AC_MSG_RESULT([external])
8117         SYSTEM_MARIADB=TRUE
8118         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8119         if test -z "$MARIADBCONFIG"; then
8120             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8121             if test -z "$MARIADBCONFIG"; then
8122                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8123                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8124             fi
8125         fi
8126         AC_MSG_CHECKING([MariaDB version])
8127         MARIADB_VERSION=`$MARIADBCONFIG --version`
8128         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8129         if test "$MARIADB_MAJOR" -ge "5"; then
8130             AC_MSG_RESULT([OK])
8131         else
8132             AC_MSG_ERROR([too old, use 5.0.x or later])
8133         fi
8134         AC_MSG_CHECKING([for MariaDB Client library])
8135         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8136         if test "$COM_GCC_IS_CLANG" = TRUE; then
8137             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8138         fi
8139         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8140         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8141         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8142         dnl linux32:
8143         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8144             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8145             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8146                 | sed -e 's|/lib64/|/lib/|')
8147         fi
8148         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8149         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8150         if test "$enable_bundle_mariadb" = "yes"; then
8151             AC_MSG_RESULT([yes])
8152             BUNDLE_MARIADB=TRUE
8153             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8155 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8157 /g' | grep -E '(mysqlclient|mariadb)')
8158             if test "$_os" = "Darwin"; then
8159                 LIBMARIADB=${LIBMARIADB}.dylib
8160             elif test "$_os" = "WINNT"; then
8161                 LIBMARIADB=${LIBMARIADB}.dll
8162             else
8163                 LIBMARIADB=${LIBMARIADB}.so
8164             fi
8165             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8166             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8167             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8168                 AC_MSG_RESULT([found.])
8169                 PathFormat "$LIBMARIADB_PATH"
8170                 LIBMARIADB_PATH="$formatted_path"
8171             else
8172                 AC_MSG_ERROR([not found.])
8173             fi
8174         else
8175             AC_MSG_RESULT([no])
8176             BUNDLE_MARIADB=
8177         fi
8178     else
8179         AC_MSG_RESULT([internal])
8180         SYSTEM_MARIADB=
8181         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8182         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8183         BUILD_TYPE="$BUILD_TYPE MARIADB"
8184     fi
8186     AC_SUBST(SYSTEM_MARIADB)
8187     AC_SUBST(MARIADB_CFLAGS)
8188     AC_SUBST(MARIADB_LIBS)
8189     AC_SUBST(LIBMARIADB)
8190     AC_SUBST(LIBMARIADB_PATH)
8191     AC_SUBST(BUNDLE_MARIADB)
8193     AC_LANG_PUSH([C++])
8194     dnl ===================================================================
8195     dnl Check for system MySQL C++ Connector
8196     dnl ===================================================================
8197     # FIXME!
8198     # who thought this too-generic cppconn dir was a good idea?
8199     AC_MSG_CHECKING([MySQL Connector/C++])
8200     if test "$with_system_mysql_cppconn" = "yes"; then
8201         AC_MSG_RESULT([external])
8202         SYSTEM_MYSQL_CPPCONN=TRUE
8203         AC_LANG_PUSH([C++])
8204         AC_CHECK_HEADER(mysql_driver.h, [],
8205                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8206         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8207                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8208         save_LIBS=$LIBS
8209         LIBS="$LIBS -lmysqlcppconn"
8210         AC_MSG_CHECKING([version])
8211         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8212 #include <mysql_driver.h>
8214 int main(int argc, char **argv) {
8215     sql::Driver *driver;
8216     driver = get_driver_instance();
8217     if (driver->getMajorVersion() > 1 || \
8218        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8219        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8220         return 0;
8221       else
8222         return 1;
8224       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8226         AC_LANG_POP([C++])
8227         LIBS=$save_LIBS
8228     else
8229         AC_MSG_RESULT([internal])
8230         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8231         SYSTEM_MYSQL_CPPCONN=
8232     fi
8233     AC_LANG_POP([C++])
8235 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8237 dnl ===================================================================
8238 dnl Check for system hsqldb
8239 dnl ===================================================================
8240 if test "$with_java" != "no"; then
8241     HSQLDB_USE_JDBC_4_1=
8242     AC_MSG_CHECKING([which hsqldb to use])
8243     if test "$with_system_hsqldb" = "yes"; then
8244         AC_MSG_RESULT([external])
8245         SYSTEM_HSQLDB=TRUE
8246         if test -z $HSQLDB_JAR; then
8247             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8248         fi
8249         AC_CHECK_FILE($HSQLDB_JAR, [],
8250                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8251         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8252         export HSQLDB_JAR
8253         if $PERL -e \
8254            'use Archive::Zip;
8255             my $file = "$ENV{'HSQLDB_JAR'}";
8256             my $zip = Archive::Zip->new( $file );
8257             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8258             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8259             {
8260                 push @l, split(/\n/, $mf);
8261                 foreach my $line (@l)
8262                 {
8263                     if ($line =~ m/Specification-Version:/)
8264                     {
8265                         ($t, $version) = split (/:/,$line);
8266                         $version =~ s/^\s//;
8267                         ($a, $b, $c, $d) = split (/\./,$version);
8268                         if ($c == "0" && $d > "8")
8269                         {
8270                             exit 0;
8271                         }
8272                         else
8273                         {
8274                             exit 1;
8275                         }
8276                     }
8277                 }
8278             }
8279             else
8280             {
8281                 exit 1;
8282             }'; then
8283             AC_MSG_RESULT([yes])
8284         else
8285             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8286         fi
8287     else
8288         AC_MSG_RESULT([internal])
8289         SYSTEM_HSQLDB=
8290         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8291         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8292         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8293         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8294             AC_MSG_RESULT([yes])
8295             HSQLDB_USE_JDBC_4_1=TRUE
8296         else
8297             AC_MSG_RESULT([no])
8298         fi
8299     fi
8300     AC_SUBST(SYSTEM_HSQLDB)
8301     AC_SUBST(HSQLDB_JAR)
8302     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8305 dnl ===================================================================
8306 dnl Check for PostgreSQL stuff
8307 dnl ===================================================================
8308 if test "x$enable_postgresql_sdbc" != "xno"; then
8309     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8311     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8312         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8313     fi
8314     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8315         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8316     fi
8318     AC_MSG_CHECKING([PostgreSQL C interface])
8319     if test "$with_system_postgresql" = "yes"; then
8320         AC_MSG_RESULT([external PostgreSQL])
8321         SYSTEM_POSTGRESQL=TRUE
8322         if test "$_os" = Darwin; then
8323             supp_path=''
8324             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8325                 pg_supp_path="$P_SEP$d$pg_supp_path"
8326             done
8327         fi
8328         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8329         if test -z "$PGCONFIG"; then
8330             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8331         fi
8332         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8333         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8334     else
8335         # if/when anything else than PostgreSQL uses Kerberos,
8336         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8337         WITH_KRB5=
8338         WITH_GSSAPI=
8339         case "$_os" in
8340         Darwin)
8341             # MacOS X has system MIT Kerberos 5 since 10.4
8342             if test "$with_krb5" != "no"; then
8343                 WITH_KRB5=TRUE
8344                 save_LIBS=$LIBS
8345                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8346                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8347                 KRB5_LIBS=$LIBS
8348                 LIBS=$save_LIBS
8349                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8350                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8351                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8352                 LIBS=$save_LIBS
8353             fi
8354             if test "$with_gssapi" != "no"; then
8355                 WITH_GSSAPI=TRUE
8356                 save_LIBS=$LIBS
8357                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8358                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8359                 GSSAPI_LIBS=$LIBS
8360                 LIBS=$save_LIBS
8361             fi
8362             ;;
8363         WINNT)
8364             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8365                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8366             fi
8367             ;;
8368         Linux|GNU|*BSD|DragonFly)
8369             if test "$with_krb5" != "no"; then
8370                 WITH_KRB5=TRUE
8371                 save_LIBS=$LIBS
8372                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8373                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8374                 KRB5_LIBS=$LIBS
8375                 LIBS=$save_LIBS
8376                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8377                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8378                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8379                 LIBS=$save_LIBS
8380             fi
8381             if test "$with_gssapi" != "no"; then
8382                 WITH_GSSAPI=TRUE
8383                 save_LIBS=$LIBS
8384                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8385                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8386                 GSSAPI_LIBS=$LIBS
8387                 LIBS=$save_LIBS
8388             fi
8389             ;;
8390         *)
8391             if test "$with_krb5" = "yes"; then
8392                 WITH_KRB5=TRUE
8393                 save_LIBS=$LIBS
8394                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8395                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8396                 KRB5_LIBS=$LIBS
8397                 LIBS=$save_LIBS
8398                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8399                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8400                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8401                 LIBS=$save_LIBS
8402             fi
8403             if test "$with_gssapi" = "yes"; then
8404                 WITH_GSSAPI=TRUE
8405                 save_LIBS=$LIBS
8406                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8407                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8408                 LIBS=$save_LIBS
8409                 GSSAPI_LIBS=$LIBS
8410             fi
8411         esac
8413         if test -n "$with_libpq_path"; then
8414             SYSTEM_POSTGRESQL=TRUE
8415             AC_MSG_RESULT([external libpq])
8416             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8417             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8418         else
8419             SYSTEM_POSTGRESQL=
8420             AC_MSG_RESULT([internal])
8421             POSTGRESQL_LIB=""
8422             POSTGRESQL_INC="%OVERRIDE_ME%"
8423             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8424         fi
8425     fi
8426     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8427         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8428         save_CFLAGS=$CFLAGS
8429         save_CPPFLAGS=$CPPFLAGS
8430         save_LIBS=$LIBS
8431         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8432         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8433         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8434         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8435             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8436         CFLAGS=$save_CFLAGS
8437         CPPFLAGS=$save_CPPFLAGS
8438         LIBS=$save_LIBS
8439     fi
8440     BUILD_POSTGRESQL_SDBC=TRUE
8442 AC_SUBST(WITH_KRB5)
8443 AC_SUBST(WITH_GSSAPI)
8444 AC_SUBST(GSSAPI_LIBS)
8445 AC_SUBST(KRB5_LIBS)
8446 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8447 AC_SUBST(SYSTEM_POSTGRESQL)
8448 AC_SUBST(POSTGRESQL_INC)
8449 AC_SUBST(POSTGRESQL_LIB)
8451 dnl ===================================================================
8452 dnl Check for Firebird stuff
8453 dnl ===================================================================
8454 ENABLE_FIREBIRD_SDBC=""
8455 if test "x$enable_firebird_sdbc" = "xyes"; then
8456     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8458     dnl ===================================================================
8459     dnl Check for system Firebird
8460     dnl ===================================================================
8461     AC_MSG_CHECKING([which Firebird to use])
8462     if test "$with_system_firebird" = "yes"; then
8463         AC_MSG_RESULT([external])
8464         SYSTEM_FIREBIRD=TRUE
8465         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8466         if test -z "$FIREBIRDCONFIG"; then
8467             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8468             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8469             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8470         else
8471             AC_MSG_NOTICE([fb_config found])
8472             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8473             AC_MSG_CHECKING([for Firebird Client library])
8474             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8475             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8476         fi
8477         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8478         AC_MSG_CHECKING([Firebird version])
8479         if test -n "${FIREBIRD_VERSION}"; then
8480             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8481             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8482             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8483                 AC_MSG_RESULT([OK])
8484             else
8485                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8486             fi
8487         else
8488             __save_CFLAGS="${CFLAGS}"
8489             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8490             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8491 #if defined(FB_API_VER) && FB_API_VER == 25
8492 #else
8493 #error "Wrong Firebird API version"
8494 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8495             CFLAGS="${__save_CFLAGS}"
8496         fi
8497         ENABLE_FIREBIRD_SDBC="TRUE"
8498     elif test "$enable_database_connectivity" != yes; then
8499         AC_MSG_RESULT([none])
8500     elif test "$cross_compiling" = "yes"; then
8501         AC_MSG_RESULT([none])
8502     else
8503         dnl We need libatomic-ops for any non X86/X64 system
8504         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8505             dnl ===================================================================
8506             dnl Check for system libatomic-ops
8507             dnl ===================================================================
8508             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8509             if test "$with_system_libatomic_ops" = "yes"; then
8510                 SYSTEM_LIBATOMIC_OPS=TRUE
8511                 AC_CHECK_HEADERS(atomic_ops.h, [],
8512                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8513             else
8514                 SYSTEM_LIBATOMIC_OPS=
8515                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8516                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8517                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8518             fi
8519         fi
8521         AC_MSG_RESULT([internal])
8522         SYSTEM_FIREBIRD=
8523         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8524         FIREBIRD_LIBS="-lfbembed"
8526         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8527         ENABLE_FIREBIRD_SDBC="TRUE"
8528     fi
8530 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8531 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8532 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8533 AC_SUBST(LIBATOMIC_OPS_LIBS)
8534 AC_SUBST(SYSTEM_FIREBIRD)
8535 AC_SUBST(FIREBIRD_CFLAGS)
8536 AC_SUBST(FIREBIRD_LIBS)
8537 dnl AC_SUBST([TOMMATH_CFLAGS])
8538 dnl AC_SUBST([TOMMATH_LIBS])
8540 dnl ===================================================================
8541 dnl Check for system curl
8542 dnl ===================================================================
8543 AC_MSG_CHECKING([which libcurl to use])
8544 if test "$with_system_curl" = "auto"; then
8545     with_system_curl="$with_system_libs"
8548 if test "$with_system_curl" = "yes"; then
8549     AC_MSG_RESULT([external])
8550     SYSTEM_CURL=TRUE
8552     AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8554     # First try PKGCONFIG and then fall back
8555     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8557     if test -n "$CURL_PKG_ERRORS"; then
8558         AC_PATH_PROG(CURLCONFIG, curl-config)
8559         if test -z "$CURLCONFIG"; then
8560             AC_MSG_ERROR([curl development files not found])
8561         fi
8562         CURL_LIBS=`$CURLCONFIG --libs`
8563         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8564         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8566         case $curl_version in
8567         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8568         dnl so they need to be doubled to end up in the configure script
8569         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8570             ;;
8571         *)
8572             AC_MSG_ERROR([no, you have $curl_version])
8573             ;;
8574         esac
8575     fi
8576     AC_MSG_RESULT([yes])
8578     libo_MINGW_CHECK_DLL([libcurl])
8579     libo_MINGW_TRY_DLL([libintl])
8580     libo_MINGW_TRY_DLL([libidn])
8581     libo_MINGW_TRY_DLL([libnspr4])
8582     libo_MINGW_TRY_DLL([nssutil3])
8583     libo_MINGW_TRY_DLL([libplc4])
8584     libo_MINGW_TRY_DLL([libplds4])
8585     libo_MINGW_TRY_DLL([nss3])
8586     libo_MINGW_TRY_DLL([ssl3])
8587     libo_MINGW_TRY_DLL([libgpg-error])
8588     libo_MINGW_TRY_DLL([libgcrypt])
8589     libo_MINGW_TRY_DLL([libssh2])
8590     ENABLE_CURL=TRUE
8591 elif test $_os = iOS; then
8592     # Let's see if we need curl, I think not?
8593     AC_MSG_RESULT([none])
8594     ENABLE_CURL=
8595 else
8596     AC_MSG_RESULT([internal])
8597     SYSTEM_CURL=
8598     BUILD_TYPE="$BUILD_TYPE CURL"
8599     ENABLE_CURL=TRUE
8601 AC_SUBST(SYSTEM_CURL)
8602 AC_SUBST(CURL_CFLAGS)
8603 AC_SUBST(CURL_LIBS)
8604 AC_SUBST(ENABLE_CURL)
8606 dnl ===================================================================
8607 dnl Check for system boost
8608 dnl ===================================================================
8609 AC_MSG_CHECKING([which boost to use])
8610 if test "$with_system_boost" = "yes"; then
8611     AC_MSG_RESULT([external])
8612     SYSTEM_BOOST=TRUE
8613     AX_BOOST_BASE(1.47)
8614     AX_BOOST_DATE_TIME
8615     AX_BOOST_IOSTREAMS
8616     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8617     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8618     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8619         # if not found, try again with 'lib' prefix
8620         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8621     fi
8622     AC_LANG_PUSH([C++])
8623     save_CXXFLAGS=$CXXFLAGS
8624     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8625     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8626        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8627     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8628        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8629     AC_CHECK_HEADER(boost/function.hpp, [],
8630        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8631     AC_MSG_CHECKING([whether boost signals2 works])
8632     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/signals2/signal.hpp>]],
8633         [[ boost::signals2::signal<void()> s; s(); ]])],
8634         [AC_MSG_RESULT([yes])],
8635         [AC_MSG_ERROR([no, install boost >= 1.55 or use --without-system-boost])])
8636     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8637     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8638     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8639 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8640     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8641         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8642     else
8643         AC_MSG_RESULT([yes])
8644     fi
8645     CXXFLAGS=$save_CXXFLAGS
8646     AC_LANG_POP([C++])
8647 else
8648     AC_MSG_RESULT([internal])
8649     BUILD_TYPE="$BUILD_TYPE BOOST"
8650     SYSTEM_BOOST=
8652 AC_SUBST(SYSTEM_BOOST)
8654 dnl ===================================================================
8655 dnl Check for system mdds
8656 dnl ===================================================================
8657 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.12.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8659 dnl ===================================================================
8660 dnl Check for system glm
8661 dnl ===================================================================
8662 AC_MSG_CHECKING([which glm to use])
8663 if test "$with_system_glm" = "yes"; then
8664     AC_MSG_RESULT([external])
8665     SYSTEM_GLM=TRUE
8666     AC_LANG_PUSH([C++])
8667     AC_CHECK_HEADER([glm/glm.hpp], [],
8668        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8669     AC_LANG_POP([C++])
8670 else
8671     AC_MSG_RESULT([internal])
8672     BUILD_TYPE="$BUILD_TYPE GLM"
8673     SYSTEM_GLM=
8674     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8676 AC_SUBST([GLM_CFLAGS])
8677 AC_SUBST([SYSTEM_GLM])
8679 dnl ===================================================================
8680 dnl Check for system glew
8681 dnl ===================================================================
8682 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8684 dnl ===================================================================
8685 dnl Check for system vigra
8686 dnl ===================================================================
8687 AC_MSG_CHECKING([which vigra to use])
8688 if test "$with_system_vigra" = "yes"; then
8689     AC_MSG_RESULT([external])
8690     SYSTEM_VIGRA=TRUE
8691     AC_LANG_PUSH([C++])
8692     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8693        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8694     AC_LANG_POP([C++])
8695 else
8696     AC_MSG_RESULT([internal])
8697     BUILD_TYPE="$BUILD_TYPE VIGRA"
8698     SYSTEM_VIGRA=
8700 AC_SUBST(SYSTEM_VIGRA)
8702 dnl ===================================================================
8703 dnl Check for system odbc
8704 dnl ===================================================================
8705 AC_MSG_CHECKING([which odbc headers to use])
8706 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
8707     AC_MSG_RESULT([external])
8708     SYSTEM_ODBC_HEADERS=TRUE
8710     if test "$build_os" = "cygwin"; then
8711         save_CPPFLAGS=$CPPFLAGS
8712         find_winsdk
8713         PathFormat "$winsdktest"
8714         CPPFLAGS="$CPPFLAGS -I$formatted_path/include/um -I$formatted_path/include -I$formatted_path/include/shared"
8715         AC_CHECK_HEADER(sqlext.h, [],
8716             [AC_MSG_ERROR(odbc not found. install odbc)],
8717             [#include <windows.h>])
8718         CPPFLAGS=$save_CPPFLAGS
8719     else
8720         AC_CHECK_HEADER(sqlext.h, [],
8721             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8722     fi
8723 elif test "$enable_database_connectivity" != yes; then
8724     AC_MSG_RESULT([none])
8725 else
8726     AC_MSG_RESULT([internal])
8727     SYSTEM_ODBC_HEADERS=
8729 AC_SUBST(SYSTEM_ODBC_HEADERS)
8732 dnl ===================================================================
8733 dnl Check for system openldap
8734 dnl ===================================================================
8736 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8737 AC_MSG_CHECKING([which openldap library to use])
8738 if test "$with_system_openldap" = "yes"; then
8739     AC_MSG_RESULT([external])
8740     SYSTEM_OPENLDAP=TRUE
8741     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8742     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8743     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8744 else
8745     AC_MSG_RESULT([internal])
8746     SYSTEM_OPENLDAP=
8747     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8750 AC_SUBST(SYSTEM_OPENLDAP)
8752 dnl ===================================================================
8753 dnl Check for mozilla ab connectivity for windows
8754 dnl ===================================================================
8756 if test "$_os" = "WINNT"; then
8757     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8758     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8759         if test "$BITNESS_OVERRIDE" = 64; then
8760            AC_MSG_ERROR([--with-win-mozab-driver and --enable-64-bit options are mutually exclusive])
8761         fi
8762         WITH_MOZAB4WIN=TRUE
8763         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8764         BUILD_TYPE="$BUILD_TYPE MOZ"
8765         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8766         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8767         for dll in $MSVC80_DLLS; do
8768             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8769                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8770             fi
8771         done
8772     else
8773         AC_MSG_RESULT([no])
8774         WITH_MOZAB4WIN=
8775     fi
8777 AC_SUBST(WITH_MOZAB4WIN)
8778 AC_SUBST(MSVC80_DLLS)
8779 AC_SUBST(MSVC80_DLL_PATH)
8781 dnl ===================================================================
8782 dnl Check for TLS/SSL and cryptographic implementation to use
8783 dnl ===================================================================
8784 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8785 if test -n "$with_tls"; then
8786     case $with_tls in
8787     openssl)
8788         AC_DEFINE(USE_TLS_OPENSSL)
8789         TLS=OPENSSL
8791         if test "$enable_openssl" != "yes"; then
8792             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8793         fi
8795         # warn that OpenSSL has been selected but not all TLS code has this option
8796         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8797         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8798         ;;
8799     nss)
8800         AC_DEFINE(USE_TLS_NSS)
8801         TLS=NSS
8802         ;;
8803     *)
8804         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8805 openssl - OpenSSL
8806 nss - Mozilla's Network Security Services (NSS)
8807     ])
8808         ;;
8809     esac
8810 elif test $_os = iOS -o $_os = Android; then
8811     # We don't build NSS for iOS and Android
8812     AC_DEFINE(USE_TLS_OPENSSL)
8813     TLS=OPENSSL
8814 else
8815     # default to using NSS, it results in smaller oox lib
8816     AC_DEFINE(USE_TLS_NSS)
8817     TLS=NSS
8819 AC_MSG_RESULT([$TLS])
8820 AC_SUBST(TLS)
8822 dnl ===================================================================
8823 dnl Check for system NSS
8824 dnl ===================================================================
8825 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8826 if test "$with_system_nss" = "yes"; then
8827     libo_MINGW_CHECK_DLL([libnspr4])
8828     libo_MINGW_CHECK_DLL([libplc4])
8829     libo_MINGW_CHECK_DLL([libplds4])
8830     libo_MINGW_CHECK_DLL([nss3])
8831     libo_MINGW_CHECK_DLL([nssutil3])
8832     libo_MINGW_CHECK_DLL([smime3])
8833     libo_MINGW_CHECK_DLL([ssl3])
8836 dnl ===================================================================
8837 dnl Check for system mozilla headers
8838 dnl ===================================================================
8839 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8840 AC_MSG_CHECKING([which NPAPI headers to use])
8842 if test "$with_system_npapi_headers" = "yes"; then
8843     AC_MSG_RESULT([external])
8844     SYSTEM_NPAPI_HEADERS=TRUE
8845     # First try npapi-sdk:
8846     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8847     # Then go with libxul:
8848     if test "x$LOCATED" != "xyes"; then
8849         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8850     fi
8851     if test "x$LOCATED" != "xyes"; then
8852         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8853     fi
8854     # if still not found bail out
8855     if test "x$LOCATED" != "xyes"; then
8856         AC_MSG_ERROR([npapi.h header file not found])
8857     fi
8859     AC_LANG_PUSH([C])
8860     save_CFLAGS=$CFLAGS
8861     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8862     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8863     AC_COMPILE_IFELSE(
8864         [AC_LANG_SOURCE([[
8865             #define XP_UNIX
8866             #include <npapi.h>
8867             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8868             ]])],
8869         [AC_MSG_RESULT([const char*])],
8870         [
8871         AC_MSG_RESULT([char*])
8872         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8873         ])
8874     CFLAGS=$save_CFLAGS
8875     AC_LANG_POP([C])
8876     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8877 else
8878     AC_MSG_RESULT([internal])
8879         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER
8880     SYSTEM_NPAPI_HEADERS=
8882 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8883 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8884 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8886 dnl ===================================================================
8887 dnl Check for system sane
8888 dnl ===================================================================
8889 AC_MSG_CHECKING([which sane header to use])
8890 if test "$with_system_sane" = "yes"; then
8891     AC_MSG_RESULT([external])
8892     AC_CHECK_HEADER(sane/sane.h, [],
8893       [AC_MSG_ERROR(sane not found. install sane)], [])
8894 else
8895     AC_MSG_RESULT([internal])
8896     BUILD_TYPE="$BUILD_TYPE SANE"
8899 dnl ===================================================================
8900 dnl Check for system icu
8901 dnl ===================================================================
8902 SYSTEM_GENBRK=
8903 SYSTEM_GENCCODE=
8904 SYSTEM_GENCMN=
8906 ICU_MAJOR=54
8907 ICU_MINOR=1
8908 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
8909 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8910 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8911 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8912 AC_MSG_CHECKING([which icu to use])
8913 if test "$with_system_icu" = "yes"; then
8914     AC_MSG_RESULT([external])
8915     SYSTEM_ICU=TRUE
8916     AC_LANG_PUSH([C++])
8917     AC_MSG_CHECKING([for unicode/rbbi.h])
8918     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8919     AC_LANG_POP([C++])
8921     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8922         ICUPATH="$PATH"
8923         if test "$WITH_MINGW" = "yes"; then
8924             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8925         fi
8926         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8928         AC_MSG_CHECKING([ICU version])
8929         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8930         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8931         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8933         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8934             AC_MSG_RESULT([OK, $ICU_VERSION])
8935         else
8936             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8937         fi
8938     fi
8940     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8941         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8942         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8943         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8944         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8945         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8946         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8947             AC_MSG_RESULT([yes])
8948         else
8949             AC_MSG_RESULT([no])
8950             if test "$with_system_icu_for_build" != "force"; then
8951                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8952 You can use --with-system-icu-for-build=force to use it anyway.])
8953             fi
8954         fi
8955     fi
8957     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8958         # using the system icu tools can lead to version confusion, use the
8959         # ones from the build environment when cross-compiling
8960         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8961         if test -z "$SYSTEM_GENBRK"; then
8962             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8963         fi
8964         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8965         if test -z "$SYSTEM_GENCCODE"; then
8966             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8967         fi
8968         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8969         if test -z "$SYSTEM_GENCMN"; then
8970             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8971         fi
8972         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
8973             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
8974         else
8975             ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
8976         fi
8977         if test "$ICU_MAJOR" -ge "49"; then
8978             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8979             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8980             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8981         else
8982             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
8983             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
8984             ICU_RECLASSIFIED_HEBREW_LETTER=
8985         fi
8986     fi
8988     if test "$cross_compiling" = "yes"; then
8989         if test "$ICU_MAJOR" -ge "50"; then
8990             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8991             ICU_MINOR=""
8992         fi
8993     fi
8995     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
8996     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
8997     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
8998 else
8999     AC_MSG_RESULT([internal])
9000     SYSTEM_ICU=
9001     BUILD_TYPE="$BUILD_TYPE ICU"
9002     # surprisingly set these only for "internal" (to be used by various other
9003     # external libs): the system icu-config is quite unhelpful and spits out
9004     # dozens of weird flags and also default path -I/usr/include
9005     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9006     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9008 AC_SUBST(SYSTEM_ICU)
9009 AC_SUBST(SYSTEM_GENBRK)
9010 AC_SUBST(SYSTEM_GENCCODE)
9011 AC_SUBST(SYSTEM_GENCMN)
9012 AC_SUBST(ICU_MAJOR)
9013 AC_SUBST(ICU_MINOR)
9014 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
9015 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9016 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9017 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9018 AC_SUBST(ICU_CFLAGS)
9019 AC_SUBST(ICU_LIBS)
9021 dnl ===================================================================
9022 dnl Graphite
9023 dnl ===================================================================
9025 AC_MSG_CHECKING([whether to enable graphite support])
9026 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9027     AC_MSG_RESULT([yes])
9028     ENABLE_GRAPHITE="TRUE"
9029     AC_DEFINE(ENABLE_GRAPHITE)
9030     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9031     if test "$with_system_graphite" = "yes"; then
9032         libo_MINGW_CHECK_DLL([libgraphite2])
9033     fi
9034 else
9035     AC_MSG_RESULT([no])
9037 AC_SUBST(ENABLE_GRAPHITE)
9039 dnl ===================================================================
9040 dnl Orcus
9041 dnl ===================================================================
9043 AC_MSG_CHECKING([whether to enable orcus])
9044 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9045     AC_MSG_RESULT([yes])
9046     ENABLE_ORCUS="TRUE"
9047     AC_DEFINE(ENABLE_ORCUS)
9049     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.8 >= 0.7.0])
9050     if test "$with_system_orcus" != "yes"; then
9051         if test "$SYSTEM_BOOST" = "TRUE"; then
9052             # ===========================================================
9053             # Determine if we are going to need to link with Boost.System
9054             # ===========================================================
9055             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9056             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9057             dnl in documentation has no effect.
9058             AC_MSG_CHECKING([if we need to link with Boost.System])
9059             AC_LANG_PUSH([C++])
9060             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9061                     @%:@include <boost/version.hpp>
9062                 ]],[[
9063                     #if BOOST_VERSION >= 105000
9064                     #   error yes, we need to link with Boost.System
9065                     #endif
9066                 ]])],[
9067                     AC_MSG_RESULT([no])
9068                 ],[
9069                     AC_MSG_RESULT([yes])
9070                     AX_BOOST_SYSTEM
9071             ])
9072             AC_LANG_POP([C++])
9073         fi
9074     fi
9075     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9076     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9077     AC_SUBST([BOOST_SYSTEM_LIB])
9078     AC_SUBST(SYSTEM_LIBORCUS)
9080 else
9081     AC_MSG_RESULT([no])
9083 AC_SUBST(ENABLE_ORCUS)
9085 dnl ===================================================================
9086 dnl HarfBuzz
9087 dnl ===================================================================
9088 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9089 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9090     AC_MSG_RESULT([yes])
9091     ENABLE_HARFBUZZ="TRUE"
9092     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9093         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"])
9094     else
9095         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9096     fi
9097 else
9098     AC_MSG_RESULT([no])
9100 AC_SUBST(ENABLE_HARFBUZZ)
9102 dnl ===================================================================
9103 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9104 dnl ===================================================================
9105 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9106 # Obviously no such thing on iOS or Android. Also not possible when building
9107 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9108 if test "$_os" != Android -a "$_os" != iOS -a $_os != Darwin -a \
9109         "$with_x" != "no" -a "$enable_mpl_subset" != yes
9110 then
9111     AC_MSG_RESULT([yes])
9112     ENABLE_NPAPI_FROM_BROWSER=TRUE
9113 else
9114     AC_MSG_RESULT([no])
9115     ENABLE_NPAPI_FROM_BROWSER=
9117 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9119 AC_MSG_CHECKING([whether to use X11])
9120 dnl ***************************************
9121 dnl testing for X libraries and includes...
9122 dnl ***************************************
9123 WANT_X11="no"
9124 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$with_x" != "no"; then
9125     WANT_X11="yes"
9126     AC_DEFINE(HAVE_FEATURE_X11)
9128 AC_MSG_RESULT([$WANT_X11])
9130 if test "$WANT_X11" = "yes"; then
9131     AC_PATH_X
9132     AC_PATH_XTRA
9133     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9135     if test -z "$x_includes"; then
9136         x_includes="default_x_includes"
9137     fi
9138     if test -z "$x_libraries"; then
9139         x_libraries="default_x_libraries"
9140     fi
9141     CFLAGS="$CFLAGS $X_CFLAGS"
9142     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9143     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9144 else
9145     x_includes="no_x_includes"
9146     x_libraries="no_x_libraries"
9149 if test "$WANT_X11" = "yes"; then
9150     dnl ===================================================================
9151     dnl Check for Composite.h for Mozilla plugin
9152     dnl ===================================================================
9153     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9154      [#include <X11/Intrinsic.h>])
9156     # ENABLE_NPAPI_FROM_BROWSER requires Xt library
9157     AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:],
9158         [AC_MSG_ERROR(Xt library not found)])
9160     dnl ===================================================================
9161     dnl Check for extension headers
9162     dnl ===================================================================
9163     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9164      [#include <X11/extensions/shape.h>])
9166     # vcl needs ICE and SM
9167     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9168     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9169         [AC_MSG_ERROR(ICE library not found)])
9170     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9171     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9172         [AC_MSG_ERROR(SM library not found)])
9175 dnl ===================================================================
9176 dnl Check for system Xrender
9177 dnl ===================================================================
9178 AC_MSG_CHECKING([whether to use Xrender])
9179 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9180     AC_MSG_RESULT([yes])
9181     PKG_CHECK_MODULES(XRENDER, xrender)
9182     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9183     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9184       [AC_MSG_ERROR(libXrender not found or functional)], [])
9185     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9186       [AC_MSG_ERROR(Xrender not found. install X)], [])
9187 else
9188     AC_MSG_RESULT([no])
9190 AC_SUBST(XRENDER_CFLAGS)
9191 AC_SUBST(XRENDER_LIBS)
9193 dnl ===================================================================
9194 dnl Check for XRandr
9195 dnl ===================================================================
9196 AC_MSG_CHECKING([whether to enable RandR support])
9197 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9198     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9199         XRANDR_DLOPEN="TRUE"
9200         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9201     else
9202         AC_MSG_RESULT([yes])
9203         XRANDR_DLOPEN="FALSE"
9204         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9205         if test "$ENABLE_RANDR" != "TRUE"; then
9206             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9207                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9208             XRANDR_CFLAGS=" "
9209             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9210               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9211             XRANDR_LIBS="-lXrandr "
9212             ENABLE_RANDR="TRUE"
9213         fi
9214         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9215     fi
9216 else
9217     ENABLE_RANDR=""
9218     AC_MSG_RESULT([no])
9220 AC_SUBST(XRANDR_DLOPEN)
9221 AC_SUBST(XRANDR_CFLAGS)
9222 AC_SUBST(XRANDR_LIBS)
9223 AC_SUBST(ENABLE_RANDR)
9225 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9226     WITH_WEBDAV="serf"
9228 if test $_os = iOS -o $_os = Android; then
9229     WITH_WEBDAV="no"
9231 AC_MSG_CHECKING([for webdav library])
9232 case "$WITH_WEBDAV" in
9233 serf)
9234     AC_MSG_RESULT([serf])
9235     # Check for system apr-util
9236     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9237                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9238                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9239     if test "$COM" = "MSC"; then
9240         APR_LIB_DIR="LibR"
9241         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9242         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9243     fi
9245     # Check for system serf
9246     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9247                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9248     if test "$COM" = "MSC"; then
9249         SERF_LIB_DIR="Release"
9250         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9251         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9252     fi
9253     ;;
9254 neon)
9255     AC_MSG_RESULT([neon])
9256     # Check for system neon
9257     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9258     if test "$with_system_neon" = "yes"; then
9259         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9260         libo_MINGW_CHECK_DLL([libneon])
9261         libo_MINGW_TRY_DLL([libtasn1])
9262         libo_MINGW_TRY_DLL([libgnutls])
9263     else
9264         NEON_VERSION=0295
9265     fi
9266     AC_SUBST(NEON_VERSION)
9267     ;;
9269     AC_MSG_RESULT([none, disabled])
9270     WITH_WEBDAV=""
9271     ;;
9272 esac
9273 AC_SUBST(WITH_WEBDAV)
9275 dnl ===================================================================
9276 dnl Check for disabling cve_tests
9277 dnl ===================================================================
9278 AC_MSG_CHECKING([whether to execute CVE tests])
9279 # If not explicitly enabled or disabled, default
9280 if test -z "$enable_cve_tests"; then
9281     case "$OS" in
9282     WNT)
9283         # Default cves off for windows with its wild and wonderful
9284         # varienty of AV software kicking in and panicing
9285         enable_cve_tests=no
9286         ;;
9287     *)
9288         # otherwise yes
9289         enable_cve_tests=yes
9290         ;;
9291     esac
9293 if test "$enable_cve_tests" = "no"; then
9294     AC_MSG_RESULT([no])
9295     DISABLE_CVE_TESTS=TRUE
9296     AC_SUBST(DISABLE_CVE_TESTS)
9297 else
9298     AC_MSG_RESULT([yes])
9301 dnl ===================================================================
9302 dnl Check for enabling chart XShape tests
9303 dnl ===================================================================
9304 AC_MSG_CHECKING([whether to execute chart XShape tests])
9305 if test "$enable_chart_tests" = "yes"; then
9306     AC_MSG_RESULT([yes])
9307     ENABLE_CHART_TESTS=TRUE
9308     AC_SUBST(ENABLE_CHART_TESTS)
9309 else
9310     AC_MSG_RESULT([no])
9313 dnl ===================================================================
9314 dnl Check for system openssl
9315 dnl ===================================================================
9316 DISABLE_OPENSSL=
9317 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9318 if test "$enable_openssl" = "yes"; then
9319     AC_MSG_RESULT([no])
9320     if test "$_os" = Darwin ; then
9321         # OpenSSL is deprecated when building for 10.7 or later.
9322         #
9323         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9324         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9326         with_system_openssl=no
9327         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9328     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9329             && test "$with_system_openssl" != "no"; then
9330         with_system_openssl=yes
9331         SYSTEM_OPENSSL=TRUE
9332         OPENSSL_CFLAGS=
9333         OPENSSL_LIBS="-lssl -lcrypto"
9334     else
9335         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9336     fi
9337     if test "$with_system_openssl" = "yes"; then
9338         libo_MINGW_CHECK_DLL([libssl])
9339         libo_MINGW_CHECK_DLL([libcrypto])
9340         AC_MSG_CHECKING([whether openssl supports SHA512])
9341         AC_LANG_PUSH([C])
9342         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9343             SHA512_CTX context;
9344 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9345         AC_LANG_POP(C)
9346     fi
9347 else
9348     AC_MSG_RESULT([yes])
9349     DISABLE_OPENSSL=TRUE
9351     # warn that although OpenSSL is disabled, system libraries may be depending on it
9352     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9353     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9356 AC_SUBST([DISABLE_OPENSSL])
9358 dnl ===================================================================
9359 dnl Check for building gnutls
9360 dnl ===================================================================
9361 AC_MSG_CHECKING([whether to use gnutls])
9362 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9363     AC_MSG_RESULT([yes])
9364     AM_PATH_LIBGCRYPT()
9365     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9366         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9367                       available in the system to use as replacement.]]))
9368 else
9369     AC_MSG_RESULT([no])
9372 AC_SUBST([LIBGCRYPT_CFLAGS])
9373 AC_SUBST([LIBGCRYPT_LIBS])
9375 dnl ===================================================================
9376 dnl Check for system redland
9377 dnl ===================================================================
9378 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9379 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9380 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9381 if test "$with_system_redland" = "yes"; then
9382     libo_MINGW_CHECK_DLL([librdf])
9383     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9384             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9385     libo_MINGW_TRY_DLL([libraptor])
9386     libo_MINGW_TRY_DLL([librasqal])
9387     libo_MINGW_TRY_DLL([libsqlite3])
9388 else
9389     RAPTOR_MAJOR="0"
9390     RASQAL_MAJOR="3"
9391     REDLAND_MAJOR="0"
9393 AC_SUBST(RAPTOR_MAJOR)
9394 AC_SUBST(RASQAL_MAJOR)
9395 AC_SUBST(REDLAND_MAJOR)
9397 dnl ===================================================================
9398 dnl Check for system hunspell
9399 dnl ===================================================================
9400 AC_MSG_CHECKING([which libhunspell to use])
9401 if test "$with_system_hunspell" = "yes"; then
9402     AC_MSG_RESULT([external])
9403     SYSTEM_HUNSPELL=TRUE
9404     AC_LANG_PUSH([C++])
9405     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9406     if test "$HUNSPELL_PC" != "TRUE"; then
9407         AC_CHECK_HEADER(hunspell.hxx, [],
9408             [
9409             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9410             [AC_MSG_ERROR(hunspell headers not found.)], [])
9411             ], [])
9412         AC_CHECK_LIB([hunspell], [main], [:],
9413            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9414         HUNSPELL_LIBS=-lhunspell
9415     fi
9416     AC_LANG_POP([C++])
9417     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9418     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9419 else
9420     AC_MSG_RESULT([internal])
9421     SYSTEM_HUNSPELL=
9422     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9423     if test "$COM" = "MSC"; then
9424         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9425     else
9426         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9427     fi
9428     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9430 AC_SUBST(SYSTEM_HUNSPELL)
9431 AC_SUBST(HUNSPELL_CFLAGS)
9432 AC_SUBST(HUNSPELL_LIBS)
9434 dnl ===================================================================
9435 dnl Checking for altlinuxhyph
9436 dnl ===================================================================
9437 AC_MSG_CHECKING([which altlinuxhyph to use])
9438 if test "$with_system_altlinuxhyph" = "yes"; then
9439     AC_MSG_RESULT([external])
9440     SYSTEM_HYPH=TRUE
9441     AC_CHECK_HEADER(hyphen.h, [],
9442        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9443     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9444        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9445        [#include <hyphen.h>])
9446     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9447         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9448     if test -z "$HYPHEN_LIB"; then
9449         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9450            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9451     fi
9452     if test -z "$HYPHEN_LIB"; then
9453         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9454            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9455     fi
9456     libo_MINGW_CHECK_DLL([libhyphen])
9457 else
9458     AC_MSG_RESULT([internal])
9459     SYSTEM_HYPH=
9460     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9461     if test "$COM" = "MSC"; then
9462         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9463     else
9464         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9465     fi
9467 AC_SUBST(SYSTEM_HYPH)
9468 AC_SUBST(HYPHEN_LIB)
9470 dnl ===================================================================
9471 dnl Checking for mythes
9472 dnl ===================================================================
9473 AC_MSG_CHECKING([which mythes to use])
9474 if test "$with_system_mythes" = "yes"; then
9475     AC_MSG_RESULT([external])
9476     SYSTEM_MYTHES=TRUE
9477     AC_LANG_PUSH([C++])
9478     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9479     if test "$MYTHES_PKGCONFIG" = "no"; then
9480         AC_CHECK_HEADER(mythes.hxx, [],
9481             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9482         AC_CHECK_LIB([mythes-1.2], [main], [:],
9483             [ MYTHES_FOUND=no], [])
9484     if test "$MYTHES_FOUND" = "no"; then
9485         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9486                 [ MYTHES_FOUND=no], [])
9487     fi
9488     if test "$MYTHES_FOUND" = "no"; then
9489         AC_MSG_ERROR([mythes library not found!.])
9490     fi
9491     fi
9492     AC_LANG_POP([C++])
9493     libo_MINGW_CHECK_DLL([libmythes-1.2])
9494     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9495 else
9496     AC_MSG_RESULT([internal])
9497     SYSTEM_MYTHES=
9498     BUILD_TYPE="$BUILD_TYPE MYTHES"
9499     if test "$COM" = "MSC"; then
9500         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9501     else
9502         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9503     fi
9505 AC_SUBST(SYSTEM_MYTHES)
9506 AC_SUBST(MYTHES_CFLAGS)
9507 AC_SUBST(MYTHES_LIBS)
9509 dnl ===================================================================
9510 dnl How should we build the linear programming solver ?
9511 dnl ===================================================================
9513 ENABLE_COINMP=
9514 AC_MSG_CHECKING([whether to build with CoinMP])
9515 if test "$enable_coinmp" != "no"; then
9516     ENABLE_COINMP=TRUE
9517     AC_MSG_RESULT([yes])
9518     if test "$with_system_coinmp" = "yes"; then
9519     SYSTEM_COINMP=TRUE
9520     PKG_CHECK_MODULES( COINMP, coinmp )
9521     else
9522         BUILD_TYPE="$BUILD_TYPE COINMP"
9523     fi
9524 else
9525     AC_MSG_RESULT([no])
9527 AC_SUBST(ENABLE_COINMP)
9528 AC_SUBST(SYSTEM_COINMP)
9529 AC_SUBST(COINMP_CFLAGS)
9530 AC_SUBST(COINMP_LIBS)
9532 ENABLE_LPSOLVE=
9533 AC_MSG_CHECKING([whether to build with lpsolve])
9534 if test "$enable_lpsolve" != "no"; then
9535     ENABLE_LPSOLVE=TRUE
9536     AC_MSG_RESULT([yes])
9537 else
9538     AC_MSG_RESULT([no])
9540 AC_SUBST(ENABLE_LPSOLVE)
9542 if test "$ENABLE_LPSOLVE" = TRUE; then
9543     AC_MSG_CHECKING([which lpsolve to use])
9544     if test "$with_system_lpsolve" = "yes"; then
9545         AC_MSG_RESULT([external])
9546         SYSTEM_LPSOLVE=TRUE
9547         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9548            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9549         save_LIBS=$LIBS
9550         # some systems need this. Like Ubuntu....
9551         AC_CHECK_LIB(m, floor)
9552         AC_CHECK_LIB(dl, dlopen)
9553         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9554             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9555         LIBS=$save_LIBS
9556         libo_MINGW_CHECK_DLL([lpsolve55])
9557     else
9558         AC_MSG_RESULT([internal])
9559         SYSTEM_LPSOLVE=
9560         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9561     fi
9563 AC_SUBST(SYSTEM_LPSOLVE)
9565 dnl ===================================================================
9566 dnl Checking for libexttextcat
9567 dnl ===================================================================
9568 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9569 if test "$with_system_libexttextcat" = "yes"; then
9570     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9572 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9574 dnl ***************************************
9575 dnl testing libc version for Linux...
9576 dnl ***************************************
9577 if test "$_os" = "Linux"; then
9578     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9579     exec 6>/dev/null # no output
9580     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9581     exec 6>&1 # output on again
9582     if test "$HAVE_LIBC"; then
9583         AC_MSG_RESULT([yes])
9584     else
9585         AC_MSG_ERROR([no, upgrade libc])
9586     fi
9589 dnl =========================================
9590 dnl Check for the Windows  SDK.
9591 dnl =========================================
9592 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9593 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9594 if test "$_os" = "WINNT"; then
9595     AC_MSG_CHECKING([for Windows SDK])
9596     if test "$build_os" = "cygwin"; then
9597         find_winsdk
9598         WINDOWS_SDK_HOME=$winsdktest
9600         # normalize if found
9601         if test -n "$WINDOWS_SDK_HOME"; then
9602             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9603             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9604         fi
9606         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
9607     fi
9609     if test -n "$WINDOWS_SDK_HOME"; then
9610         # Remove a possible trailing backslash
9611         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9613         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9614              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9615              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9616             have_windows_sdk_headers=yes
9617         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9618              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9619              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9620             have_windows_sdk_headers=yes
9621         else
9622             have_windows_sdk_headers=no
9623         fi
9625         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9626             have_windows_sdk_libs=yes
9627         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9628             have_windows_sdk_libs=yes
9629         else
9630             have_windows_sdk_libs=no
9631         fi
9633         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9634             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9635 the  Windows SDK are installed.])
9636         fi
9638         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9639              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9640              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9641              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9642         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9643              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9644              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9645              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9646         else
9647             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9648         fi
9649     fi
9651     if test -z "$WINDOWS_SDK_HOME"; then
9652         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9653     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
9654         WINDOWS_SDK_VERSION=70
9655         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9656     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9657         WINDOWS_SDK_VERSION=80
9658         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9659         dnl compatibility warning if not explicitly choosing the 80 SDK:
9660         if test -z "$with_windows_sdk"; then
9661             AC_MSG_WARN([If a build should run on Windows XP,])
9662             AC_MSG_WARN([use --with-windows-sdk=7.1A])
9663             add_warning "If a build should run on Windows XP,"
9664             add_warning "use --with-windows-sdk=7.1A"
9665         fi
9666     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
9667         WINDOWS_SDK_VERSION=81
9668         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
9669     else
9670         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9671     fi
9672     PathFormat "$WINDOWS_SDK_HOME"
9673     WINDOWS_SDK_HOME="$formatted_path"
9674     if test "$build_os" = "cygwin"; then
9675         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9676         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9677             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9678         fi
9679     fi
9681     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9682     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9683     dnl but not in v8.0), so allow this to be overridden with a
9684     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9685     dnl and configuration error if no WiLangId.vbs is found would arguably be
9686     dnl better, but I do not know under which conditions exactly it is needed by
9687     dnl msiglobal.pm:
9688     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9689         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9690         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9691             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9692         fi
9693         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9694             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9695         fi
9696         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9697             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9698             add_warning "WiLangId.vbs not found - building translated packages will fail"
9699         fi
9700     fi
9702 AC_SUBST(WINDOWS_SDK_HOME)
9703 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
9704 AC_SUBST(WINDOWS_SDK_VERSION)
9705 AC_SUBST(WINDOWS_SDK_WILANGID)
9707 dnl =========================================
9708 dnl Check for uuidgen
9709 dnl =========================================
9710 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9711     if test "$WITH_MINGW" = "yes"; then
9712         AC_PATH_PROG([UUIDGEN], [uuid])
9713         if test -z "$UUIDGEN"; then
9714             AC_MSG_WARN([uuid is needed for building installation sets])
9715         fi
9716     else
9717         # presence is already tested above in the WINDOWS_SDK_HOME check
9718         UUIDGEN=uuidgen.exe
9719         AC_SUBST(UUIDGEN)
9720     fi
9721 else
9722     AC_PATH_PROG([UUIDGEN], [uuidgen])
9723     if test -z "$UUIDGEN"; then
9724         AC_MSG_WARN([uuid is needed for building installation sets])
9725     fi
9728 dnl ***************************************
9729 dnl Checking for bison and flex
9730 dnl ***************************************
9731 AC_PATH_PROG(BISON, bison)
9732 if test -z "$BISON"; then
9733     AC_MSG_ERROR([no bison found in \$PATH, install it])
9734 else
9735     AC_MSG_CHECKING([the bison version])
9736     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9737     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9738     # Accept newer than 2.0
9739     if test "$_bison_longver" -lt 2000; then
9740         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9741     fi
9744 AC_PATH_PROG(FLEX, flex)
9745 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9746     FLEX=`cygpath -m $FLEX`
9748 if test -z "$FLEX"; then
9749     AC_MSG_ERROR([no flex found in \$PATH, install it])
9750 else
9751     AC_MSG_CHECKING([the flex version])
9752     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9753     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9754         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9755     fi
9757 AC_SUBST([FLEX])
9758 dnl ***************************************
9759 dnl Checking for patch
9760 dnl ***************************************
9761 AC_PATH_PROG(PATCH, patch)
9762 if test -z "$PATCH"; then
9763     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9766 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9767 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9768     if test -z "$with_gnu_patch"; then
9769         GNUPATCH=$PATCH
9770     else
9771         if test -x "$with_gnu_patch"; then
9772             GNUPATCH=$with_gnu_patch
9773         else
9774             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9775         fi
9776     fi
9778     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9779     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9780         AC_MSG_RESULT([yes])
9781     else
9782         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9783     fi
9784 else
9785     GNUPATCH=$PATCH
9788 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9789     GNUPATCH=`cygpath -m $GNUPATCH`
9792 dnl We also need to check for --with-gnu-cp
9794 if test -z "$with_gnu_cp"; then
9795     # check the place where the good stuff is hidden on Solaris...
9796     if test -x /usr/gnu/bin/cp; then
9797         GNUCP=/usr/gnu/bin/cp
9798     else
9799         AC_PATH_PROGS(GNUCP, gnucp cp)
9800     fi
9801     if test -z $GNUCP; then
9802         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9803     fi
9804 else
9805     if test -x "$with_gnu_cp"; then
9806         GNUCP=$with_gnu_cp
9807     else
9808         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9809     fi
9812 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9813     GNUCP=`cygpath -m $GNUCP`
9816 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9817 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9818     AC_MSG_RESULT([yes])
9819 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9820     AC_MSG_RESULT([yes])
9821 else
9822     case "$build_os" in
9823     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9824         x_GNUCP=[\#]
9825         GNUCP=''
9826         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9827         ;;
9828     *)
9829         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9830         ;;
9831     esac
9834 AC_SUBST(GNUPATCH)
9835 AC_SUBST(GNUCP)
9836 AC_SUBST(x_GNUCP)
9838 dnl ***************************************
9839 dnl testing assembler path
9840 dnl ***************************************
9841 ML_EXE=""
9842 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9843     if test "$BITNESS_OVERRIDE" = ""; then
9844         assembler=ml.exe
9845         assembler_bin=bin
9846     else
9847         if test "$vcexpress" = "Express"; then
9848             assembler=ml64.exe
9849             assembler_bin=bin/x86_amd64
9850         else
9851             assembler=ml64.exe
9852             assembler_bin=bin/amd64
9853         fi
9854     fi
9856     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9857     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9858         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9859         AC_MSG_RESULT([found])
9860         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9861     else
9862         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9863     fi
9865     PathFormat "$ASM_HOME"
9866     ASM_HOME="$formatted_path"
9867 else
9868     ASM_HOME=""
9871 AC_SUBST(ML_EXE)
9873 dnl ===================================================================
9874 dnl We need zip and unzip
9875 dnl ===================================================================
9876 AC_PATH_PROG(ZIP, zip)
9877 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9878 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9879     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],,)
9882 AC_PATH_PROG(UNZIP, unzip)
9883 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9885 dnl ===================================================================
9886 dnl Zip must be a specific type for different build types.
9887 dnl ===================================================================
9888 if test $build_os = cygwin; then
9889     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9890         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9891     fi
9894 dnl ===================================================================
9895 dnl We need touch with -h option support.
9896 dnl ===================================================================
9897 AC_PATH_PROG(TOUCH, touch)
9898 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9899 touch warn
9900 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9901     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],,)
9904 dnl ===================================================================
9905 dnl Set vcl option: coordinate device in double or sal_Int32
9906 dnl ===================================================================
9908 AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9909 if test "$_os" = "Darwin" -o  $_os = iOS ; then
9910     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9911     AC_MSG_RESULT([double])
9912 else
9913     AC_MSG_RESULT([sal_Int32])
9916 dnl ===================================================================
9917 dnl Test which vclplugs have to be built.
9918 dnl ===================================================================
9919 R=""
9920 GTK3_CFLAGS=""
9921 GTK3_LIBS=""
9922 ENABLE_GTK3=""
9923 if test "x$enable_gtk3" = "xyes"; then
9924     if test "$with_system_cairo" = no; then
9925         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9926     fi
9927     : ${with_system_cairo:=yes}
9928     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="")
9929     if test "x$ENABLE_GTK3" = "xTRUE"; then
9930         R="gtk3"
9931     else
9932         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9933     fi
9934     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9936 AC_SUBST(GTK3_LIBS)
9937 AC_SUBST(GTK3_CFLAGS)
9938 AC_SUBST(ENABLE_GTK3)
9940 AC_MSG_CHECKING([which VCLplugs shall be built])
9941 if test "$GUIBASE" != "unx" -o "$with_x" = "no"; then
9942     enable_gtk=no
9944 ENABLE_GTK=""
9945 if test "x$enable_gtk" = "xyes"; then
9946     if test "$with_system_cairo" = no; then
9947         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9948     fi
9949     : ${with_system_cairo:=yes}
9950     ENABLE_GTK="TRUE"
9951     AC_DEFINE(ENABLE_GTK)
9952     R="gtk $R"
9954 AC_SUBST(ENABLE_GTK)
9956 ENABLE_TDE=""
9957 if test "x$enable_tde" = "xyes"; then
9958     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
9959     # are built from the same sources. So we only allow one of them.
9960     if test "x$enable_kde" = "xyes"; then
9961         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
9962     fi
9963     ENABLE_TDE="TRUE"
9964     AC_DEFINE(ENABLE_TDE)
9965     R="$R tde"
9967 AC_SUBST(ENABLE_TDE)
9969 ENABLE_KDE=""
9970 if test "x$enable_kde" = "xyes"; then
9971     ENABLE_KDE="TRUE"
9972     AC_DEFINE(ENABLE_KDE)
9973     R="$R kde"
9975 AC_SUBST(ENABLE_KDE)
9977 ENABLE_KDE4=""
9978 if test "x$enable_kde4" = "xyes"; then
9979     ENABLE_KDE4="TRUE"
9980     AC_DEFINE(ENABLE_KDE4)
9981     R="$R kde4"
9983 AC_SUBST(ENABLE_KDE4)
9985 ENABLE_HEADLESS=""
9986 if test "x$with_x" = "xno"; then
9987     ENABLE_HEADLESS="TRUE"
9988     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
9989     R="headless"
9991 AC_SUBST(ENABLE_HEADLESS)
9993 if test -z "$R"; then
9994     AC_MSG_RESULT([none])
9995 else
9996     AC_MSG_RESULT([$R])
9999 dnl ===================================================================
10000 dnl GCONF check
10001 dnl ===================================================================
10003 ENABLE_GCONF=
10004 AC_MSG_CHECKING([whether to enable GConf support])
10005 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
10006     ENABLE_GCONF="TRUE"
10007     AC_MSG_RESULT([yes])
10008     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
10009     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10010 else
10011     AC_MSG_RESULT([no])
10013 AC_SUBST(GCONF_LIBS)
10014 AC_SUBST(GCONF_CFLAGS)
10015 AC_SUBST(ENABLE_GCONF)
10017 dnl ===================================================================
10018 dnl Gnome VFS check
10019 dnl ===================================================================
10021 ENABLE_GNOMEVFS=""
10022 AC_MSG_CHECKING([whether to enable GNOME VFS support])
10023 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
10024     ENABLE_GNOMEVFS="TRUE"
10025     AC_MSG_RESULT([yes])
10026     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
10027     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10028     AC_DEFINE(ENABLE_GNOME_VFS)
10029 else
10030     AC_MSG_RESULT([no])
10032 AC_SUBST(GNOMEVFS_LIBS)
10033 AC_SUBST(GNOMEVFS_CFLAGS)
10034 AC_SUBST(ENABLE_GNOMEVFS)
10036 dnl ===================================================================
10037 dnl check for dbus support
10038 dnl ===================================================================
10039 ENABLE_DBUS=""
10040 DBUS_CFLAGS=""
10041 DBUS_LIBS=""
10043 if test "$enable_dbus" = "no"; then
10044     test_dbus=no
10047 AC_MSG_CHECKING([whether to enable DBUS support])
10048 if test "$test_dbus" = "yes"; then
10049     ENABLE_DBUS="TRUE"
10050     AC_MSG_RESULT([yes])
10051     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10052     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10053 else
10054     AC_MSG_RESULT([no])
10057 AC_SUBST(ENABLE_DBUS)
10058 AC_SUBST(DBUS_CFLAGS)
10059 AC_SUBST(DBUS_LIBS)
10061 AC_MSG_CHECKING([whether to enable font install via packagekit])
10062 if test "$ENABLE_DBUS" = "TRUE"; then
10063     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10064         ENABLE_PACKAGEKIT=TRUE
10065         AC_MSG_RESULT([yes])
10066     else
10067         ENABLE_PACKAGEKIT=
10068         AC_MSG_RESULT([no])
10069     fi
10070 else
10071     AC_MSG_RESULT([no, dbus disabled.])
10073 AC_SUBST(ENABLE_PACKAGEKIT)
10075 AC_MSG_CHECKING([whether to enable Impress remote control])
10076 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10077     AC_MSG_RESULT([yes])
10078     ENABLE_SDREMOTE=TRUE
10079     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10081     # If not explicitly enabled or disabled, default
10082     if test -z "$enable_sdremote_bluetooth"; then
10083         case "$OS" in
10084         LINUX|MACOSX|WNT)
10085             # Default to yes for these
10086             enable_sdremote_bluetooth=yes
10087             ;;
10088         *)
10089             # otherwise no
10090             enable_sdremote_bluetooth=no
10091             ;;
10092         esac
10093     fi
10094     # $enable_sdremote_bluetooth is guaranteed non-empty now
10096     if test "$enable_sdremote_bluetooth" != "no"; then
10097         if test "$OS" = "LINUX"; then
10098             if test "$ENABLE_DBUS" = "TRUE"; then
10099                 AC_MSG_RESULT([yes])
10100                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10101                 dnl ===================================================================
10102                 dnl Check for system bluez
10103                 dnl ===================================================================
10104                 AC_MSG_CHECKING([which Bluetooth header to use])
10105                 if test "$with_system_bluez" = "yes"; then
10106                     AC_MSG_RESULT([external])
10107                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10108                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10109                     SYSTEM_BLUEZ=TRUE
10110                 else
10111                     AC_MSG_RESULT([internal])
10112                     SYSTEM_BLUEZ=
10113                 fi
10114             else
10115                 AC_MSG_RESULT([no, dbus disabled])
10116                 ENABLE_SDREMOTE_BLUETOOTH=
10117                 SYSTEM_BLUEZ=
10118             fi
10119         else
10120             AC_MSG_RESULT([yes])
10121             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10122             SYSTEM_BLUEZ=
10123         fi
10124     else
10125         AC_MSG_RESULT([no])
10126         ENABLE_SDREMOTE_BLUETOOTH=
10127         SYSTEM_BLUEZ=
10128     fi
10129 else
10130     ENABLE_SDREMOTE=
10131     SYSTEM_BLUEZ=
10132     AC_MSG_RESULT([no])
10134 AC_SUBST(ENABLE_SDREMOTE)
10135 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10136 AC_SUBST(SYSTEM_BLUEZ)
10138 dnl ===================================================================
10139 dnl Check whether the gtk 2.0 libraries are available.
10140 dnl ===================================================================
10142 GTK_CFLAGS=""
10143 GTK_LIBS=""
10144 ENABLE_SYSTRAY_GTK=""
10145 if test  "$test_gtk" = "yes"; then
10147     if test "$ENABLE_GTK" = "TRUE"; then
10148         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]))
10149         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10150         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]))
10151         BUILD_TYPE="$BUILD_TYPE GTK"
10152         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10154         if test "x$enable_systray" = "xyes"; then
10155             ENABLE_SYSTRAY_GTK="TRUE"
10156         fi
10158         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10159         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10160                           [ENABLE_GTK_PRINT="TRUE"],
10161                           [ENABLE_GTK_PRINT=""])
10162         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10164         AC_MSG_CHECKING([whether to enable GIO support])
10165         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10166             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10167                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10168             fi
10169             dnl Need at least 2.26 for the dbus support.
10170             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10171                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10172             if test "$ENABLE_GIO" = "TRUE"; then
10173                 AC_DEFINE(ENABLE_GIO)
10174                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10175             fi
10176         else
10177             AC_MSG_RESULT([no])
10178         fi
10179     fi
10181 AC_SUBST(ENABLE_GIO)
10182 AC_SUBST(GIO_CFLAGS)
10183 AC_SUBST(GIO_LIBS)
10184 AC_SUBST(ENABLE_SYSTRAY_GTK)
10185 AC_SUBST(GTK_CFLAGS)
10186 AC_SUBST(GTK_LIBS)
10187 AC_SUBST(GTHREAD_CFLAGS)
10188 AC_SUBST(GTHREAD_LIBS)
10189 AC_SUBST([ENABLE_GTK_PRINT])
10190 AC_SUBST([GTK_PRINT_CFLAGS])
10191 AC_SUBST([GTK_PRINT_LIBS])
10194 dnl ===================================================================
10195 dnl Check whether the Telepathy libraries are available.
10196 dnl ===================================================================
10198 ENABLE_TELEPATHY=""
10199 TELEPATHY_CFLAGS=""
10200 TELEPATHY_LIBS=""
10202 AC_MSG_CHECKING([whether to enable Telepathy support])
10203 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10204     ENABLE_TELEPATHY="TRUE"
10205     AC_DEFINE(ENABLE_TELEPATHY)
10206     AC_MSG_RESULT([yes])
10207     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 )
10208     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10209 else
10210     AC_MSG_RESULT([no])
10213 AC_SUBST(ENABLE_TELEPATHY)
10214 AC_SUBST(TELEPATHY_CFLAGS)
10215 AC_SUBST(TELEPATHY_LIBS)
10218 dnl ===================================================================
10220 SPLIT_APP_MODULES=""
10221 if test "$enable_split_app_modules" = "yes"; then
10222     SPLIT_APP_MODULES="TRUE"
10224 AC_SUBST(SPLIT_APP_MODULES)
10226 SPLIT_OPT_FEATURES=""
10227 if test "$enable_split_opt_features" = "yes"; then
10228     SPLIT_OPT_FEATURES="TRUE"
10230 AC_SUBST(SPLIT_OPT_FEATURES)
10232 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10233     if test "$enable_cairo_canvas" = yes; then
10234         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10235     fi
10236     enable_cairo_canvas=no
10237 elif test -z "$enable_cairo_canvas"; then
10238     enable_cairo_canvas=yes
10241 ENABLE_CAIRO_CANVAS=""
10242 if test "$enable_cairo_canvas" = "yes"; then
10243     test_cairo=yes
10244     ENABLE_CAIRO_CANVAS="TRUE"
10245     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10247 AC_SUBST(ENABLE_CAIRO_CANVAS)
10249 dnl ===================================================================
10250 dnl Check whether the GStreamer libraries are available.
10251 dnl It's possible to build avmedia with both GStreamer backends!
10252 dnl ===================================================================
10254 ENABLE_GSTREAMER_1_0=""
10256 if test "$build_gstreamer_1_0" = "yes"; then
10258     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10259     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10260         ENABLE_GSTREAMER_1_0="TRUE"
10261         AC_MSG_RESULT([yes])
10262         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10263         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10264     else
10265         AC_MSG_RESULT([no])
10266     fi
10268 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10269 AC_SUBST(GSTREAMER_1_0_LIBS)
10270 AC_SUBST(ENABLE_GSTREAMER_1_0)
10273 ENABLE_GSTREAMER_0_10=""
10274 if test "$build_gstreamer_0_10" = "yes"; then
10276     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10277     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10278         ENABLE_GSTREAMER_0_10="TRUE"
10279         AC_MSG_RESULT([yes])
10280         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10281             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10282         ])
10283         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10284     else
10285         AC_MSG_RESULT([no])
10286     fi
10289 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10290 AC_SUBST(GSTREAMER_0_10_LIBS)
10291 AC_SUBST(ENABLE_GSTREAMER_0_10)
10293 dnl ===================================================================
10294 dnl Check whether to build the VLC avmedia backend
10295 dnl ===================================================================
10297 ENABLE_VLC=""
10299 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10300 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10301     ENABLE_VLC="TRUE"
10302     AC_MSG_RESULT([yes])
10303 else
10304     AC_MSG_RESULT([no])
10306 AC_SUBST(ENABLE_VLC)
10308 # this is for opengl transitions in impress slideshow
10309 ENABLE_OPENGL=
10310 if test $_os = iOS -o $_os = Android; then
10311    : # disable
10312 elif test "$_os" = "Darwin"; then
10313     # We use frameworks on Mac OS X, no need for detail checks
10314     ENABLE_OPENGL=TRUE
10315     ENABLE_OPENGL_CANVAS=TRUE
10316     SYSTEM_MESA_HEADERS=TRUE
10317 elif test $_os = WINNT; then
10318     # Experimental: try to use OpenGL on Windows
10319     ENABLE_OPENGL=TRUE
10320     ENABLE_OPENGL_CANVAS=TRUE
10321     # We need the internal "Mesa" headers.
10322     SYSTEM_MESA_HEADERS=
10323     BUILD_TYPE="$BUILD_TYPE MESA"
10324 else
10325     if test "$with_x" != "no"; then
10326         ENABLE_OPENGL=TRUE
10327     fi
10328     ENABLE_OPENGL_CANVAS=TRUE
10330     dnl ===================================================================
10331     dnl Check for system Mesa
10332     dnl ===================================================================
10333     AC_MSG_CHECKING([which Mesa headers to use])
10334     if test "$with_system_mesa_headers" = "yes"; then
10335         AC_MSG_RESULT([external])
10336         SYSTEM_MESA_HEADERS=TRUE
10337         AC_LANG_PUSH(C)
10338         AC_CHECK_HEADER(GL/glxext.h, [],
10339            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10340         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10341         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10342         AC_LANG_POP(C)
10343     else
10344         AC_MSG_RESULT([internal])
10345         SYSTEM_MESA_HEADERS=
10346         BUILD_TYPE="$BUILD_TYPE MESA"
10347     fi
10350 AC_SUBST(SYSTEM_MESA_HEADERS)
10351 AC_SUBST(ENABLE_OPENGL)
10352 AC_SUBST(ENABLE_OPENGL_CANVAS)
10354 dnl =================================================
10355 dnl Check whether to build with OpenCL support.
10356 dnl =================================================
10358 if test $_os != iOS -a $_os != Android; then
10359     # OPENCL in BUILD_TYPE tells that OpenCL is potentially available on the platform (optional at run-time,
10360     # used through clew).
10361     BUILD_TYPE="$BUILD_TYPE OPENCL"
10362     AC_DEFINE(HAVE_FEATURE_OPENCL)
10365 dnl ===================================================================
10366 dnl Check whether to enable glTF support
10367 dnl ===================================================================
10368 AC_MSG_CHECKING([whether to enable glTF support])
10369 ENABLE_GLTF=
10370 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android; then
10371     ENABLE_GLTF=TRUE
10372     AC_MSG_RESULT([yes])
10373     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10374     if test "$with_system_libgltf" = "yes"; then
10375         SYSTEM_LIBGLTF=TRUE
10376         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10377     else
10378         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10379     fi
10380 else
10381     AC_MSG_RESULT([no])
10383 AC_SUBST(ENABLE_GLTF)
10384 AC_SUBST(SYSTEM_LIBGLTF)
10385 AC_SUBST(LIBGLTF_CFLAGS)
10386 AC_SUBST(LIBGLTF_LIBS)
10388 dnl ===================================================================
10389 dnl Check whether to enable COLLADA support
10390 dnl ===================================================================
10391 AC_MSG_CHECKING([whether to enable COLLADA support])
10392 ENABLE_COLLADA=
10393 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10394     AC_MSG_RESULT([yes])
10395     ENABLE_COLLADA=TRUE
10396     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10398     AC_MSG_CHECKING([which OPENCOLLADA to use])
10399     if test "$with_system_opencollada" = "yes"; then
10400         AC_MSG_RESULT([external])
10401         SYSTEM_OPENCOLLADA=TRUE
10402         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10403         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10404         AC_LANG_PUSH([C++])
10405         save_CXXFLAGS=$CXXFLAGS
10406         save_CPPFLAGS=$CPPFLAGS
10407         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10408         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10409         AC_CHECK_HEADERS(
10410                 COLLADABU.h \
10411                 COLLADAFW.h \
10412                 COLLADASaxFWLLoader.h \
10413                 GeneratedSaxParser.h,
10414             [],
10415             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10416             [])
10417         CXXFLAGS=$save_CXXFLAGS
10418         CPPFLAGS=$save_CPPFLAGS
10419         AC_LANG_POP([C++])
10420         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10421     else
10422         AC_MSG_RESULT([internal])
10423         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10424     fi
10426     AC_MSG_CHECKING([which collada2gltf to use])
10427     if test "$with_system_collada2gltf" = "yes"; then
10428         if test "$with_system_opencollada" = "no"; then
10429             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10430         fi
10431         AC_MSG_RESULT([external])
10432         SYSTEM_COLLADA2GLTF=TRUE
10433         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10434         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10435         AC_LANG_PUSH([C++])
10436         save_CXXFLAGS=$CXXFLAGS
10437         save_CPPFLAGS=$CPPFLAGS
10438         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10439         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10440         AC_CHECK_HEADERS(
10441                 GLTF.h \
10442                 encodingHelpers.h,
10443             [],
10444             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10445             [])
10446         CXXFLAGS=$save_CXXFLAGS
10447         CPPFLAGS=$save_CPPFLAGS
10448         AC_LANG_POP([C++])
10449         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10450     else
10451         AC_MSG_RESULT([internal])
10452         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10453     fi
10454 else
10455     AC_MSG_RESULT([no])
10457 AC_SUBST(ENABLE_COLLADA)
10458 AC_SUBST([OPENCOLLADA_CFLAGS])
10459 AC_SUBST([OPENCOLLADA_LIBS])
10460 AC_SUBST([SYSTEM_OPENCOLLADA])
10462 AC_SUBST([COLLADA2GLTF_CFLAGS])
10463 AC_SUBST([COLLADA2GLTF_LIBS])
10464 AC_SUBST([SYSTEM_COLLADA2GLTF])
10466 # pdf import?
10467 AC_MSG_CHECKING([whether to build the PDF import feature])
10468 ENABLE_PDFIMPORT=
10469 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10470     AC_MSG_RESULT([yes])
10471     ENABLE_PDFIMPORT=TRUE
10473     dnl ===================================================================
10474     dnl Check for system poppler
10475     dnl ===================================================================
10476     AC_MSG_CHECKING([which PDF import backend to use])
10477     if test "$with_system_poppler" = "yes"; then
10478         AC_MSG_RESULT([external])
10479         SYSTEM_POPPLER=TRUE
10480         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10481         AC_LANG_PUSH([C++])
10482         save_CXXFLAGS=$CXXFLAGS
10483         save_CPPFLAGS=$CPPFLAGS
10484         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10485         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10486         AC_CHECK_HEADER([cpp/poppler-version.h],
10487             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10488             [])
10489         CXXFLAGS=$save_CXXFLAGS
10490         CPPFLAGS=$save_CPPFLAGS
10491         AC_LANG_POP([C++])
10492         libo_MINGW_CHECK_DLL([libpoppler])
10493         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10494     else
10495         AC_MSG_RESULT([internal])
10496         SYSTEM_POPPLER=
10497         BUILD_TYPE="$BUILD_TYPE POPPLER"
10498         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10499     fi
10500     AC_DEFINE([ENABLE_PDFIMPORT],1)
10501 else
10502     AC_MSG_RESULT([no])
10504 AC_SUBST(ENABLE_PDFIMPORT)
10505 AC_SUBST(SYSTEM_POPPLER)
10506 AC_SUBST(POPPLER_CFLAGS)
10507 AC_SUBST(POPPLER_LIBS)
10509 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10510 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10511     AC_MSG_RESULT([yes])
10512     ENABLE_MEDIAWIKI=TRUE
10513     BUILD_TYPE="$BUILD_TYPE XSLTML"
10514     if test  "x$with_java" = "xno"; then
10515         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10516     fi
10517 else
10518     AC_MSG_RESULT([no])
10519     ENABLE_MEDIAWIKI=
10520     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10522 AC_SUBST(ENABLE_MEDIAWIKI)
10524 AC_MSG_CHECKING([whether to build the Report Builder])
10525 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10526     AC_MSG_RESULT([yes])
10527     ENABLE_REPORTBUILDER=TRUE
10528     AC_MSG_CHECKING([which jfreereport libs to use])
10529     if test "$with_system_jfreereport" = "yes"; then
10530         SYSTEM_JFREEREPORT=TRUE
10531         AC_MSG_RESULT([external])
10532         if test -z $SAC_JAR; then
10533             SAC_JAR=/usr/share/java/sac.jar
10534         fi
10535         AC_CHECK_FILE($SAC_JAR, [],
10536              [AC_MSG_ERROR(sac.jar not found.)], [])
10538         if test -z $LIBXML_JAR; then
10539             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10540                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10541                 [
10542                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10543                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10544                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10545                     )
10546                 ]
10547             )
10548         else
10549             AC_CHECK_FILE($LIBXML_JAR, [],
10550                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10551         fi
10553         if test -z $FLUTE_JAR; then
10554             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10555                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10556                 [
10557                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10558                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10559                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10560                     )
10561                 ]
10562             )
10563         else
10564             AC_CHECK_FILE($FLUTE_JAR, [],
10565                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10566         fi
10568         if test -z $JFREEREPORT_JAR; then
10569             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10570                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10571                 [
10572                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10573                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10574                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10575                     )
10576                 ]
10577             )
10578         else
10579             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10580                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10581         fi
10583         if test -z $LIBLAYOUT_JAR; then
10584             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10585                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10586                 [
10587                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10588                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10589                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10590                     )
10591                 ]
10592             )
10593         else
10594             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10595                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10596         fi
10598         if test -z $LIBLOADER_JAR; then
10599             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10600                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10601                 [
10602                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10603                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10604                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10605                     )
10606                 ]
10607             )
10608         else
10609             AC_CHECK_FILE($LIBLOADER_JAR, [],
10610                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10611         fi
10613         if test -z $LIBFORMULA_JAR; then
10614             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10615                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10616                  [
10617                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10618                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10619                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10620                      )
10621                  ]
10622             )
10623         else
10624             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10625                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10626         fi
10628         if test -z $LIBREPOSITORY_JAR; then
10629             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10630                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10631                 [
10632                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10633                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10634                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10635                     )
10636                 ]
10637             )
10638         else
10639             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10640                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10641         fi
10643         if test -z $LIBFONTS_JAR; then
10644             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10645                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10646                 [
10647                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10648                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10649                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10650                     )
10651                 ]
10652             )
10653         else
10654             AC_CHECK_FILE($LIBFONTS_JAR, [],
10655                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10656         fi
10658         if test -z $LIBSERIALIZER_JAR; then
10659             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10660                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10661                 [
10662                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10663                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10664                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10665                     )
10666                 ]
10667             )
10668         else
10669             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10670                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10671         fi
10673         if test -z $LIBBASE_JAR; then
10674             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10675                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10676                 [
10677                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10678                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10679                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10680                     )
10681                 ]
10682             )
10683         else
10684             AC_CHECK_FILE($LIBBASE_JAR, [],
10685                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10686         fi
10688     else
10689         AC_MSG_RESULT([internal])
10690         SYSTEM_JFREEREPORT=
10691         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10692     fi
10693 else
10694     AC_MSG_RESULT([no])
10695     ENABLE_REPORTBUILDER=
10696     SYSTEM_JFREEREPORT=
10698 AC_SUBST(ENABLE_REPORTBUILDER)
10699 AC_SUBST(SYSTEM_JFREEREPORT)
10700 AC_SUBST(SAC_JAR)
10701 AC_SUBST(LIBXML_JAR)
10702 AC_SUBST(FLUTE_JAR)
10703 AC_SUBST(JFREEREPORT_JAR)
10704 AC_SUBST(LIBBASE_JAR)
10705 AC_SUBST(LIBLAYOUT_JAR)
10706 AC_SUBST(LIBLOADER_JAR)
10707 AC_SUBST(LIBFORMULA_JAR)
10708 AC_SUBST(LIBREPOSITORY_JAR)
10709 AC_SUBST(LIBFONTS_JAR)
10710 AC_SUBST(LIBSERIALIZER_JAR)
10712 # this has to be here because both the Wiki Publisher and the SRB use
10713 # commons-logging
10714 COMMONS_LOGGING_VERSION=1.2
10715 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10716     AC_MSG_CHECKING([which Apache commons-* libs to use])
10717     if test "$with_system_apache_commons" = "yes"; then
10718         SYSTEM_APACHE_COMMONS=TRUE
10719         AC_MSG_RESULT([external])
10720         if test -z $COMMONS_LOGGING_JAR; then
10721             AC_CHECK_FILE(/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar,
10722                [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar ],
10723                [
10724                     AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10725                         [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10726                         [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10727                     )
10728                 ]
10729             )
10730         else
10731             AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10732                 [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10733         fi
10734     else
10735         AC_MSG_RESULT([internal])
10736         SYSTEM_APACHE_COMMONS=
10737         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10738     fi
10740 AC_SUBST(SYSTEM_APACHE_COMMONS)
10741 AC_SUBST(COMMONS_LOGGING_JAR)
10742 AC_SUBST(COMMONS_LOGGING_VERSION)
10744 # scripting provider for BeanShell?
10745 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10746 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10747     AC_MSG_RESULT([yes])
10748     ENABLE_SCRIPTING_BEANSHELL=TRUE
10750     dnl ===================================================================
10751     dnl Check for system beanshell
10752     dnl ===================================================================
10753     AC_MSG_CHECKING([which beanshell to use])
10754     if test "$with_system_beanshell" = "yes"; then
10755         AC_MSG_RESULT([external])
10756         SYSTEM_BSH=TRUE
10757         if test -z $BSH_JAR; then
10758             BSH_JAR=/usr/share/java/bsh.jar
10759         fi
10760         AC_CHECK_FILE($BSH_JAR, [],
10761                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10762     else
10763         AC_MSG_RESULT([internal])
10764         SYSTEM_BSH=
10765         BUILD_TYPE="$BUILD_TYPE BSH"
10766     fi
10767 else
10768     AC_MSG_RESULT([no])
10769     ENABLE_SCRIPTING_BEANSHELL=
10770     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10772 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10773 AC_SUBST(SYSTEM_BSH)
10774 AC_SUBST(BSH_JAR)
10776 # scripting provider for JavaScript?
10777 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10778 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10779     AC_MSG_RESULT([yes])
10780     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10782     dnl ===================================================================
10783     dnl Check for system rhino
10784     dnl ===================================================================
10785     AC_MSG_CHECKING([which rhino to use])
10786     if test "$with_system_rhino" = "yes"; then
10787         AC_MSG_RESULT([external])
10788         SYSTEM_RHINO=TRUE
10789         if test -z $RHINO_JAR; then
10790             RHINO_JAR=/usr/share/java/js.jar
10791         fi
10792         AC_CHECK_FILE($RHINO_JAR, [],
10793                    [AC_MSG_ERROR(js.jar not found.)], [])
10794     else
10795         AC_MSG_RESULT([internal])
10796         SYSTEM_RHINO=
10797         BUILD_TYPE="$BUILD_TYPE RHINO"
10798     fi
10799 else
10800     AC_MSG_RESULT([no])
10801     ENABLE_SCRIPTING_JAVASCRIPT=
10802     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10804 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10805 AC_SUBST(SYSTEM_RHINO)
10806 AC_SUBST(RHINO_JAR)
10808 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10809 # paths should be added to library search path. So lets put all 64-bit
10810 # platforms there.
10811 supports_multilib=
10812 case "$host_cpu" in
10813 x86_64 | powerpc64 | powerpc64le | s390x | aarch64)
10814     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10815         supports_multilib="yes"
10816     fi
10817     ;;
10819     ;;
10820 esac
10822 dnl ===================================================================
10823 dnl Check whether the TQt and TDE libraries are available.
10824 dnl ===================================================================
10826 TDE_CFLAGS=""
10827 TDE_LIBS=""
10828 if test "$_os" != "OpenBSD"; then
10829     MOC="moc"
10831 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10832     dnl Search paths for TQt and TDE
10833     if test -z "$supports_multilib"; then
10834         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"
10835         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"
10836     else
10837         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"
10838         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"
10839     fi
10840     if test -n "$TQTDIR"; then
10841         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10842         if test -z "$supports_multilib"; then
10843             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10844         else
10845             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10846         fi
10847     fi
10848     if test -z "$supports_multilib"; then
10849         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"
10850         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"
10851     else
10852         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"
10853         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"
10854     fi
10855     if test -n "$TDEDIR"; then
10856         tde_incdirs="$TDEDIR/include $tde_incdirs"
10857         if test -z "$supports_multilib"; then
10858             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10859         else
10860             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10861         fi
10862     fi
10864     dnl What to test
10865     tqt_test_include="ntqstyle.h"
10866     tde_test_include="kapp.h"
10868     if test "$_os" != "OpenBSD"; then
10869         tqt_test_library="libtqt-mt.so"
10870         tde_test_library="libDCOP.so"
10871     else
10872         tqt_test_library="libtqt-mt.so*"
10873         tde_test_library="libDCOP.so*"
10874     fi
10876     dnl Check for TQt headers
10877     AC_MSG_CHECKING([for TQt headers])
10878     tqt_incdir="no"
10879     for tde_check in $tqt_incdirs; do
10880         if test -r "$tde_check/$tqt_test_include"; then
10881             tqt_incdir="$tde_check"
10882             break
10883         fi
10884     done
10885     AC_MSG_RESULT([$tqt_incdir])
10886     if test "x$tqt_incdir" = "xno"; then
10887         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10888 your TQt installation by exporting TQTDIR before running "configure".])
10889     fi
10891     dnl Check for TQt libraries
10892     AC_MSG_CHECKING([for TQt libraries])
10893     tqt_libdir="no"
10894     for tqt_check in $tqt_libdirs; do
10895         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10896             tqt_libdir="$tqt_check"
10897             break
10898         fi
10899     done
10900     AC_MSG_RESULT([$tqt_libdir])
10901     if test "x$tqt_libdir" = "xno"; then
10902         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10903 your TQt installation by exporting TQTDIR before running "configure".])
10904     fi
10906     dnl Check for Meta Object Compiler
10907     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10908     if test "$MOC" = "no"; then
10909         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10910 the root of your TQt installation by exporting TQTDIR before running "configure".])
10911     fi
10913     dnl Check for TDE headers
10914     AC_MSG_CHECKING([for TDE headers])
10915     tde_incdir="no"
10916     for tde_check in $tde_incdirs; do
10917         if test -r "$tde_check/$tde_test_include"; then
10918             tde_incdir="$tde_check"
10919             break
10920         fi
10921     done
10922     AC_MSG_RESULT([$tde_incdir])
10923     if test "x$tde_incdir" = "xno"; then
10924         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10925 your TDE installation by exporting TDEDIR before running "configure".])
10926     fi
10928     dnl Check for TDE libraries
10929     AC_MSG_CHECKING([for TDE libraries])
10930     tde_libdir="no"
10931     for tde_check in $tde_libdirs; do
10932         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10933             tde_libdir="$tde_check"
10934             break
10935         fi
10936     done
10937     AC_MSG_RESULT([$tde_libdir])
10938     if test "x$tde_libdir" = "xno"; then
10939         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10940 your TDE installation by exporting TDEDIR before running "configure".])
10941     fi
10943     dnl Set the variables
10944     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10945     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10947 AC_SUBST(TDE_CFLAGS)
10948 AC_SUBST(TDE_LIBS)
10949 AC_SUBST(MOC)
10951 dnl ===================================================================
10952 dnl Check whether the Qt3 and KDE3 libraries are available.
10953 dnl ===================================================================
10955 KDE_CFLAGS=""
10956 KDE_LIBS=""
10957 if test "$_os" != "OpenBSD"; then
10958     MOC="moc"
10960 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
10961     dnl Search paths for Qt3 and KDE3
10962     if test -z "$supports_multilib"; then
10963         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"
10964         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"
10965     else
10966         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"
10967         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"
10968     fi
10969     if test -n "$QTDIR"; then
10970         qt_incdirs="$QTDIR/include $qt_incdirs"
10971         if test -z "$supports_multilib"; then
10972             qt_libdirs="$QTDIR/lib $qt_libdirs"
10973         else
10974             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10975         fi
10976     fi
10977     if test -z "$supports_multilib"; then
10978         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"
10979         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"
10980     else
10981         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"
10982         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"
10983     fi
10984     if test -n "$KDEDIR"; then
10985         kde_incdirs="$KDEDIR/include $kde_incdirs"
10986         if test -z "$supports_multilib"; then
10987             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10988         else
10989             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10990         fi
10991     fi
10993     dnl What to test
10994     qt_test_include="qstyle.h"
10995     kde_test_include="kapp.h"
10997     if test "$_os" != "OpenBSD"; then
10998         qt_test_library="libqt-mt.so"
10999         kde_test_library="libDCOP.so"
11000     else
11001         qt_test_library="libqt-mt.so*"
11002         kde_test_library="libDCOP.so*"
11003     fi
11005     dnl Check for Qt3 headers
11006     AC_MSG_CHECKING([for Qt3 headers])
11007     qt_incdir="no"
11008     for kde_check in $qt_incdirs; do
11009         if test -r "$kde_check/$qt_test_include"; then
11010             qt_incdir="$kde_check"
11011             break
11012         fi
11013     done
11014     AC_MSG_RESULT([$qt_incdir])
11015     if test "x$qt_incdir" = "xno"; then
11016         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
11017 your Qt3 installation by exporting QTDIR before running "configure".])
11018     fi
11020     dnl Check for Qt3 libraries
11021     AC_MSG_CHECKING([for Qt3 libraries])
11022     qt_libdir="no"
11023     for qt_check in $qt_libdirs; do
11024         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
11025             qt_libdir="$qt_check"
11026             break
11027         fi
11028     done
11029     AC_MSG_RESULT([$qt_libdir])
11030     if test "x$qt_libdir" = "xno"; then
11031         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
11032 your Qt3 installation by exporting QTDIR before running "configure".])
11033     fi
11035     dnl Check for Meta Object Compiler
11036     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
11037     if test "$MOC" = "no"; then
11038         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
11039 the root of your Qt3 installation by exporting QTDIR before running "configure".])
11040     fi
11042     dnl Check for KDE3 headers
11043     AC_MSG_CHECKING([for KDE3 headers])
11044     kde_incdir="no"
11045     for kde_check in $kde_incdirs; do
11046         if test -r "$kde_check/$kde_test_include"; then
11047             kde_incdir="$kde_check"
11048             break
11049         fi
11050     done
11051     AC_MSG_RESULT([$kde_incdir])
11052     if test "x$kde_incdir" = "xno"; then
11053         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
11054 your KDE3 installation by exporting KDEDIR before running "configure".])
11055     fi
11057     dnl Check for KDE3 libraries
11058     AC_MSG_CHECKING([for KDE3 libraries])
11059     kde_libdir="no"
11060     for kde_check in $kde_libdirs; do
11061         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11062             kde_libdir="$kde_check"
11063             break
11064         fi
11065     done
11066     AC_MSG_RESULT([$kde_libdir])
11067     if test "x$kde_libdir" = "xno"; then
11068         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11069 your KDE3 installation by exporting KDEDIR before running "configure".])
11070     fi
11072     dnl Set the variables
11073     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11074     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11075     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11077 AC_SUBST(KDE_CFLAGS)
11078 AC_SUBST(KDE_LIBS)
11079 AC_SUBST(MOC)
11081 dnl ===================================================================
11082 dnl KDE4 Integration
11083 dnl ===================================================================
11085 KDE4_CFLAGS=""
11086 KDE4_LIBS=""
11087 QMAKE4="qmake"
11088 MOC4="moc"
11089 KDE_GLIB_CFLAGS=""
11090 KDE_GLIB_LIBS=""
11091 KDE_HAVE_GLIB=""
11092 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11093     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11094     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11096     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11097     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11099     if test -n "$supports_multilib"; then
11100         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11101         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11102     fi
11104     if test -n "$QTDIR"; then
11105         qt_incdirs="$QTDIR/include $qt_incdirs"
11106         if test -z "$supports_multilib"; then
11107             qt_libdirs="$QTDIR/lib $qt_libdirs"
11108         else
11109             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11110         fi
11111     fi
11112     if test -n "$QT4DIR"; then
11113         qt_incdirs="$QT4DIR/include $qt_incdirs"
11114         if test -z "$supports_multilib"; then
11115             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11116         else
11117             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11118         fi
11119     fi
11121     if test -n "$KDEDIR"; then
11122         kde_incdirs="$KDEDIR/include $kde_incdirs"
11123         if test -z "$supports_multilib"; then
11124             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11125         else
11126             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11127         fi
11128     fi
11129     if test -n "$KDE4DIR"; then
11130         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11131         if test -z "$supports_multilib"; then
11132             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11133         else
11134             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11135         fi
11136     fi
11138     qt_test_include="Qt/qobject.h"
11139     qt_test_library="libQtNetwork.so"
11140     kde_test_include="kwindowsystem.h"
11141     kde_test_library="libsolid.so"
11143     AC_MSG_CHECKING([for Qt4 headers])
11144     qt_header_dir="no"
11145     for inc_dir in $qt_incdirs; do
11146         if test -r "$inc_dir/$qt_test_include"; then
11147             qt_header_dir="$inc_dir"
11148             break
11149         fi
11150     done
11152     AC_MSG_RESULT([$qt_header_dir])
11153     if test "x$qt_header_dir" = "xno"; then
11154         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11155     fi
11157     dnl Check for qmake
11158     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11159     QMAKE4="$QMAKEQT4"
11160     if test "$QMAKE4" = "no"; then
11161         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11162         if test "$QMAKE4" = "no"; then
11163             AC_MSG_ERROR([Qmake not found.  Please specify
11164 the root of your Qt installation by exporting QT4DIR before running "configure".])
11165         fi
11166     fi
11168     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11169     AC_MSG_CHECKING([for Qt4 libraries])
11170     qt_lib_dir="no"
11171     for lib_dir in $qt_libdirs; do
11172         if test -r "$lib_dir/$qt_test_library"; then
11173             qt_lib_dir="$lib_dir"
11174             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11175             break
11176         fi
11177     done
11179     AC_MSG_RESULT([$qt_lib_dir])
11181     if test "x$qt_lib_dir" = "xno"; then
11182         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11183     fi
11185     dnl Check for Meta Object Compiler
11187     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11188     MOC4="$MOCQT4"
11189     if test "$MOC4" = "no"; then
11190         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11191         if test "$MOC4" = "no"; then
11192             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11193 the root of your Qt installation by exporting QT4DIR before running "configure".])
11194         fi
11195     fi
11197     dnl Check for KDE4 headers
11198     AC_MSG_CHECKING([for KDE4 headers])
11199     kde_incdir="no"
11200     for kde_check in $kde_incdirs; do
11201         if test -r "$kde_check/$kde_test_include"; then
11202             kde_incdir="$kde_check"
11203             break
11204         fi
11205     done
11206     AC_MSG_RESULT([$kde_incdir])
11207     if test "x$kde_incdir" = "xno"; then
11208         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11209     fi
11211     dnl Check for KDE4 libraries
11212     AC_MSG_CHECKING([for KDE4 libraries])
11213     kde_libdir="no"
11214     for kde_check in $kde_libdirs; do
11215         if test -r "$kde_check/$kde_test_library"; then
11216             kde_libdir="$kde_check"
11217             break
11218         fi
11219     done
11221     AC_MSG_RESULT([$kde_libdir])
11222     if test "x$kde_libdir" = "xno"; then
11223         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11224     fi
11226     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11227     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11228     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11229     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11231     AC_LANG_PUSH([C++])
11232     save_CXXFLAGS=$CXXFLAGS
11233     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11234     AC_MSG_CHECKING([whether KDE is >= 4.2])
11235        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11236 #include <kdeversion.h>
11238 int main(int argc, char **argv) {
11239        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11240        else return 1;
11242        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11243     CXXFLAGS=$save_CXXFLAGS
11244     AC_LANG_POP([C++])
11246     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11247     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11248     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11249         [
11250             KDE_HAVE_GLIB=1
11251             AC_DEFINE(KDE_HAVE_GLIB,1)
11252             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11254             qt4_fix_warning=
11256             AC_LANG_PUSH([C++])
11257             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11258             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11259             #  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
11260             #               ^~~~~~~~~~~~~~~~~~~~~~~
11261             #               vptr for 'QObjectPrivate'
11262             save_CXX=$CXX
11263             CXX=$(printf %s "$CXX" \
11264                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11265             save_CXXFLAGS=$CXXFLAGS
11266             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11267             save_LIBS=$LIBS
11268             LIBS="$LIBS $KDE4_LIBS"
11269             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11271             # Prepare meta object data
11272             TSTBASE="tst_exclude_socket_notifiers"
11273             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11274             ln -fs "${TSTMOC}.hxx"
11275             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11277             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11278 #define SAL_OVERRIDE
11279 #include <cstdlib>
11280 #include "tst_exclude_socket_notifiers.moc"
11282 int main(int argc, char *argv[])
11284     QCoreApplication app(argc, argv);
11285     exit(tst_processEventsExcludeSocket());
11286     return 0;
11288             ]])],[
11289                 AC_MSG_RESULT([yes])
11290             ],[
11291                 AC_MSG_RESULT([no])
11292                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11293                 if test -z "$qt4_fix_warning"; then
11294                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11295                 fi
11296                 qt4_fix_warning=1
11297                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11298             ])
11300             # Remove meta object data
11301             rm -f "${TSTBASE}."*
11303             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11305             # Prepare meta object data
11306             TSTBASE="tst_exclude_posted_events"
11307             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11308             ln -fs "${TSTMOC}.hxx"
11309             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11311             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11312 #define SAL_OVERRIDE
11313 #include <cstdlib>
11314 #include "tst_exclude_posted_events.moc"
11316 int main(int argc, char *argv[])
11318     QCoreApplication app(argc, argv);
11319     exit(tst_excludePostedEvents());
11320     return 0;
11322             ]])],[
11323                 AC_MSG_RESULT([yes])
11324             ],[
11325                 AC_MSG_RESULT([no])
11326                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11327                 if test -z "$qt4_fix_warning"; then
11328                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11329                 fi
11330                 qt4_fix_warning=1
11331                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11332             ])
11334             # Remove meta object data
11335             rm -f "${TSTBASE}."*
11337             if test -n "$qt4_fix_warning"; then
11338                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11339             fi
11341             LIBS=$save_LIBS
11342             CXXFLAGS=$save_CXXFLAGS
11343             CXX=$save_CXX
11344             AC_LANG_POP([C++])
11345         ],
11346         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11348 AC_SUBST(KDE4_CFLAGS)
11349 AC_SUBST(KDE4_LIBS)
11350 AC_SUBST(MOC4)
11351 AC_SUBST(KDE_GLIB_CFLAGS)
11352 AC_SUBST(KDE_GLIB_LIBS)
11353 AC_SUBST(KDE_HAVE_GLIB)
11355 dnl ===================================================================
11356 dnl Test for the enabling the lockdown pieces
11357 dnl ===================================================================
11358 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11359 ENABLE_LOCKDOWN=
11360 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11361     ENABLE_LOCKDOWN=TRUE
11362     AC_MSG_RESULT([yes])
11363 else
11364     AC_MSG_RESULT([no])
11366 AC_SUBST(ENABLE_LOCKDOWN)
11368 dnl ===================================================================
11369 dnl Test whether to include Evolution 2 support
11370 dnl ===================================================================
11371 AC_MSG_CHECKING([whether to enable evolution 2 support])
11372 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11373     AC_MSG_RESULT([yes])
11374     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11375     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11376     ENABLE_EVOAB2="TRUE"
11377 else
11378     ENABLE_EVOAB2=""
11379     AC_MSG_RESULT([no])
11381 AC_SUBST(ENABLE_EVOAB2)
11382 AC_SUBST(GOBJECT_CFLAGS)
11383 AC_SUBST(GOBJECT_LIBS)
11385 dnl ===================================================================
11386 dnl Test whether to include TDE AB support
11387 dnl ===================================================================
11388 AC_MSG_CHECKING([whether to enable TDE address book support])
11389 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11390     AC_MSG_RESULT([yes])
11391     AC_LANG_PUSH([C++])
11392     save_CXXFLAGS=$CXXFLAGS
11393     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11394     AC_MSG_CHECKING([whether TDE is at least R14.0])
11395        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11396 #include <tdeversion.h>
11398 int main(int argc, char **argv) {
11399        if (TDE_VERSION_MAJOR >= 14) return 0;
11400        else return 1;
11402        ]])],[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])],[])
11403     CXXFLAGS=$save_CXXFLAGS
11404     AC_LANG_POP([C++])
11405     ENABLE_TDEAB=TRUE
11406 else
11407     AC_MSG_RESULT([no])
11408     ENABLE_TDEAB=
11410 AC_SUBST(ENABLE_TDEAB)
11412 dnl ===================================================================
11413 dnl Test whether to include KDE AB support
11414 dnl ===================================================================
11415 AC_MSG_CHECKING([whether to enable KDE address book support])
11416 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11417     AC_MSG_RESULT([yes])
11418     AC_LANG_PUSH([C++])
11419     save_CXXFLAGS=$CXXFLAGS
11420     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11421     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11422        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11423 #include <kdeversion.h>
11425 int main(int argc, char **argv) {
11426        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11427        else return 1;
11429        ]])],[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])],[])
11430     CXXFLAGS=$save_CXXFLAGS
11431     AC_LANG_POP([C++])
11432     ENABLE_KAB=TRUE
11433 else
11434     AC_MSG_RESULT([no])
11435     ENABLE_KAB=
11437 AC_SUBST(ENABLE_KAB)
11439 dnl ===================================================================
11440 dnl Test which themes to include
11441 dnl ===================================================================
11442 AC_MSG_CHECKING([which themes to include])
11443 # if none given use default subset of available themes
11444 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11445     with_theme="breeze galaxy hicontrast oxygen sifr tango"
11446     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11449 WITH_THEMES=""
11450 if test "x$with_theme" != "xno"; then
11451     for theme in $with_theme; do
11452         case $theme in
11453         breeze|crystal|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) real_theme="$theme" ;;
11454         default) real_theme=galaxy ;;
11455         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11456         esac
11457         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11458     done
11460 AC_MSG_RESULT([$WITH_THEMES])
11461 AC_SUBST([WITH_THEMES])
11462 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11463 for theme in $with_theme; do
11464     case $theme in
11465     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11466     *) ;;
11467     esac
11468 done
11470 dnl ===================================================================
11471 dnl Test whether to integrate helppacks into the product's installer
11472 dnl ===================================================================
11473 AC_MSG_CHECKING([for helppack integration])
11474 if test "$with_helppack_integration" = "no"; then
11475     WITH_HELPPACK_INTEGRATION=
11476     AC_MSG_RESULT([no integration])
11477 else
11478     WITH_HELPPACK_INTEGRATION=TRUE
11479     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11480     AC_MSG_RESULT([integration])
11482 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11484 ###############################################################################
11485 # Extensions checking
11486 ###############################################################################
11487 AC_MSG_CHECKING([for extensions integration])
11488 if test "x$enable_extension_integration" != "xno"; then
11489     WITH_EXTENSION_INTEGRATION=TRUE
11490     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11491     AC_MSG_RESULT([yes, use integration])
11492 else
11493     WITH_EXTENSION_INTEGRATION=
11494     AC_MSG_RESULT([no, do not integrate])
11496 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11498 dnl Should any extra extensions be included?
11499 dnl There are standalone tests for each of these below.
11500 WITH_EXTRA_EXTENSIONS=
11501 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11503 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11504 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11505 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11506 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11507 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11508 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11509 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11510 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11511 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11512 if test "x$with_java" != "xno"; then
11513     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11514     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11517 dnl ===================================================================
11518 dnl Test whether to include Sun Professional Template Pack
11519 dnl ===================================================================
11520 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11521 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11522     AC_MSG_RESULT([no integration])
11523 else
11524     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11525     sun_supported_langs="en-US de it fr es hu"
11526     if test "$with_sun_templates" = "yes"; then
11527         wanted_sun_templates="$sun_supported_langs"
11528     else
11529         # check whether the langs are supported by Sun
11530         wanted_sun_templates=
11531         for lang in $with_sun_templates; do
11532             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11533                 wanted_sun_templates="$wanted_sun_templates $lang"
11534             fi
11535         done
11536     fi
11537     SUNTEMPLATES_LANG=
11538     SUNTEMPLATES_DE_PACK=
11539     SUNTEMPLATES_EN_US_PACK=
11540     SUNTEMPLATES_ES_PACK=
11541     SUNTEMPLATES_FR_PACK=
11542     SUNTEMPLATES_HU_PACK=
11543     SUNTEMPLATES_IT_PACK=
11544     # check whether the langs are requested at all
11545     for lang in $wanted_sun_templates; do
11546     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11547         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11548         case $lang in
11549         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11550         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11551         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11552         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11553         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11554         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11555         esac
11556     fi
11557     done
11558     WITH_EXTRA_EXTENSIONS=TRUE
11559     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11561 AC_SUBST(SUNTEMPLATES_DE_PACK)
11562 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11563 AC_SUBST(SUNTEMPLATES_ES_PACK)
11564 AC_SUBST(SUNTEMPLATES_FR_PACK)
11565 AC_SUBST(SUNTEMPLATES_HU_PACK)
11566 AC_SUBST(SUNTEMPLATES_IT_PACK)
11568 TEST_FONTS_MISSING=0
11570 # $1  = font family
11571 # $2+ = accepted font mappings
11572 test_font_map()
11574     FONT="$1" ; shift
11575     AC_MSG_CHECKING([font mapping for '$FONT'])
11576     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11577     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11579     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11580     while test "$#" -ge 1 ; do
11581         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11582         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11583     done
11584     if test $TESTEXPR
11585     then
11586         AC_MSG_RESULT([ok])
11587     else
11588         AC_MSG_RESULT([unknown ($FONTFILE)])
11589         TEST_FONTS_MISSING=1
11590     fi
11593 dnl ===================================================================
11594 dnl Test whether to include fonts
11595 dnl ===================================================================
11596 AC_MSG_CHECKING([whether to include third-party fonts])
11597 if test "$with_fonts" != "no"; then
11598     AC_MSG_RESULT([yes])
11599     WITH_FONTS=TRUE
11600     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11601 else
11602     AC_MSG_RESULT([no])
11603     WITH_FONTS=
11604     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11605     if test "$test_fontconfig" = "yes"; then
11606         AC_PATH_PROG([FCMATCH], [fc-match])
11607         if test -z "$FCMATCH"; then
11608             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11609             TEST_FONTS_MISSING=1
11610         else
11611             test_font_map 'Calibri' 'Carlito'
11612             if test ${TEST_FONTS_MISSING} -eq 1
11613             then
11614                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11615             fi
11616         fi
11617     else
11618         TEST_FONTS_MISSING=0
11619     fi
11621 AC_SUBST(WITH_FONTS)
11622 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11624 dnl ===================================================================
11625 dnl Test whether to include extra galleries
11626 dnl ===================================================================
11627 AC_MSG_CHECKING([whether to include extra galleries])
11628 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11629     AC_MSG_RESULT([no])
11630     WITH_EXTRA_GALLERY=
11631     OOOP_GALLERY_PACK=""
11632 else
11633     AC_MSG_RESULT([yes])
11634     WITH_EXTRA_GALLERY=TRUE
11635     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11636     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11637     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11639 AC_SUBST(WITH_EXTRA_GALLERY)
11640 AC_SUBST(OOOP_GALLERY_PACK)
11642 dnl ===================================================================
11643 dnl Test whether to include extra templates
11644 dnl ===================================================================
11645 AC_MSG_CHECKING([whether to include extra templates])
11646 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11647     AC_MSG_RESULT([no])
11648     WITH_EXTRA_TEMPLATE=
11649     OOOP_TEMPLATES_PACK=""
11650 else
11651     AC_MSG_RESULT([yes])
11652     WITH_EXTRA_TEMPLATE=TRUE
11653     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11654     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11655     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11657 AC_SUBST(WITH_EXTRA_TEMPLATE)
11658 AC_SUBST(OOOP_TEMPLATES_PACK)
11660 dnl ===================================================================
11661 dnl Test whether to include extra samples
11662 dnl ===================================================================
11663 AC_MSG_CHECKING([whether to include extra samples])
11664 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11665     AC_MSG_RESULT([no])
11666     WITH_EXTRA_SAMPLE=
11667     OOOP_SAMPLES_PACK=""
11668 else
11669     AC_MSG_RESULT([yes])
11670     WITH_EXTRA_SAMPLE=TRUE
11671     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11672     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11673     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11675 AC_SUBST(WITH_EXTRA_SAMPLE)
11676 AC_SUBST(OOOP_SAMPLES_PACK)
11678 dnl ===================================================================
11679 dnl Test whether to include extra fonts
11680 dnl ===================================================================
11681 AC_MSG_CHECKING([whether to include extra fonts])
11682 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11683     AC_MSG_RESULT([no])
11684     WITH_EXTRA_FONT=
11685     OOOP_FONTS_PACK=""
11686 else
11687     AC_MSG_RESULT([yes])
11688     WITH_EXTRA_FONT=TRUE
11689     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11690     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11691     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11693 AC_SUBST(WITH_EXTRA_FONT)
11694 AC_SUBST(OOOP_FONTS_PACK)
11696 dnl ===================================================================
11697 dnl Test whether to enable online update service
11698 dnl ===================================================================
11699 AC_MSG_CHECKING([whether to enable online update])
11700 ENABLE_ONLINE_UPDATE=
11701 if test "$enable_online_update" = ""; then
11702     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11703         AC_MSG_RESULT([yes])
11704         ENABLE_ONLINE_UPDATE="TRUE"
11705     else
11706         AC_MSG_RESULT([no])
11707     fi
11708 else
11709     if test "$enable_online_update" = "yes"; then
11710         AC_MSG_RESULT([yes])
11711         ENABLE_ONLINE_UPDATE="TRUE"
11712     else
11713         AC_MSG_RESULT([no])
11714     fi
11716 AC_SUBST(ENABLE_ONLINE_UPDATE)
11718 dnl ===================================================================
11719 dnl Test whether to enable extension update
11720 dnl ===================================================================
11721 AC_MSG_CHECKING([whether to enable extension update])
11722 ENABLE_EXTENSION_UPDATE=
11723 if test "x$enable_extension_update" = "xno"; then
11724     AC_MSG_RESULT([no])
11725 else
11726     AC_MSG_RESULT([yes])
11727     ENABLE_EXTENSION_UPDATE="TRUE"
11728     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11729     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11731 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11734 dnl ===================================================================
11735 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11736 dnl ===================================================================
11737 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11738 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11739     AC_MSG_RESULT([no])
11740     ENABLE_SILENT_MSI=
11741 else
11742     AC_MSG_RESULT([yes])
11743     ENABLE_SILENT_MSI=TRUE
11744     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11746 AC_SUBST(ENABLE_SILENT_MSI)
11748 AC_MSG_CHECKING([whether and how to use Xinerama])
11749 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11750     if test "$x_libraries" = "default_x_libraries"; then
11751         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11752         if test "x$XINERAMALIB" = x; then
11753            XINERAMALIB="/usr/lib"
11754         fi
11755     else
11756         XINERAMALIB="$x_libraries"
11757     fi
11758     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11759         # we have both versions, let the user decide but use the dynamic one
11760         # per default
11761         USE_XINERAMA=TRUE
11762         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11763             XINERAMA_LINK=dynamic
11764         else
11765             XINERAMA_LINK=static
11766         fi
11767     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11768         # we have only the dynamic version
11769         USE_XINERAMA=TRUE
11770         XINERAMA_LINK=dynamic
11771     elif test -e "$XINERAMALIB/libXinerama.a"; then
11772         # static version
11773         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11774             USE_XINERAMA=TRUE
11775             XINERAMA_LINK=static
11776         else
11777             USE_XINERAMA=
11778             XINERAMA_LINK=none
11779         fi
11780     else
11781         # no Xinerama
11782         USE_XINERAMA=
11783         XINERAMA_LINK=none
11784     fi
11785     if test "$USE_XINERAMA" = "TRUE"; then
11786         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11787         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11788             [AC_MSG_ERROR(Xinerama header not found.)], [])
11789         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11790         if test "x$XEXTLIB" = x; then
11791            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11792         fi
11793         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11794         if test "$_os" = "FreeBSD"; then
11795             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11796         fi
11797         if test "$_os" = "Linux"; then
11798             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11799         fi
11800         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11801             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11802     else
11803         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11804     fi
11805 else
11806     USE_XINERAMA=
11807     XINERAMA_LINK=none
11808     AC_MSG_RESULT([no])
11810 AC_SUBST(USE_XINERAMA)
11811 AC_SUBST(XINERAMA_LINK)
11813 dnl ===================================================================
11814 dnl Test whether to build cairo or rely on the system version
11815 dnl ===================================================================
11817 if test "$GUIBASE" = "unx"; then
11818     # Used in vcl/Library_vclplug_gen.mk
11819     test_cairo=yes
11822 if test "$test_cairo" = "yes"; then
11823     AC_MSG_CHECKING([whether to use the system cairo])
11825     : ${with_system_cairo:=$with_system_libs}
11826     if test "$with_system_cairo" = "yes"; then
11827         SYSTEM_CAIRO=TRUE
11828         AC_MSG_RESULT([yes])
11830         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11831         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11833         if test "$test_xrender" = "yes"; then
11834             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11835             AC_LANG_PUSH([C])
11836             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11837 #ifdef PictStandardA8
11838 #else
11839       return fail;
11840 #endif
11841 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11843             AC_LANG_POP([C])
11844         fi
11845         libo_MINGW_CHECK_DLL([libcairo])
11846         libo_MINGW_TRY_DLL([libfontconfig])
11847         libo_MINGW_TRY_DLL([libfreetype])
11848         libo_MINGW_TRY_DLL([libpixman])
11849         libo_MINGW_TRY_DLL([libpng15])
11850     else
11851         SYSTEM_CAIRO=
11852         AC_MSG_RESULT([no])
11854         BUILD_TYPE="$BUILD_TYPE CAIRO"
11855         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11856     fi
11859 AC_SUBST(SYSTEM_CAIRO)
11860 AC_SUBST(CAIRO_CFLAGS)
11861 AC_SUBST(CAIRO_LIBS)
11863 dnl ===================================================================
11864 dnl Test whether to use avahi
11865 dnl ===================================================================
11866 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11867     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11868                       [ENABLE_AVAHI="TRUE"])
11869     AC_DEFINE(HAVE_FEATURE_AVAHI)
11870     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11873 AC_SUBST(ENABLE_AVAHI)
11874 AC_SUBST(AVAHI_CFLAGS)
11875 AC_SUBST(AVAHI_LIBS)
11877 dnl ===================================================================
11878 dnl Test whether to use liblangtag
11879 dnl ===================================================================
11880 ENABLE_LIBLANGTAG=
11881 SYSTEM_LIBLANGTAG=
11882 AC_MSG_CHECKING([whether to use liblangtag])
11883 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11884     ENABLE_LIBLANGTAG=TRUE
11885     AC_MSG_RESULT([yes])
11886     AC_MSG_CHECKING([whether to use system liblangtag])
11887     if test "$with_system_liblangtag" = yes; then
11888         SYSTEM_LIBLANGTAG=TRUE
11889         AC_MSG_RESULT([yes])
11890         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11891         dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11892         PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11893         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11894         libo_MINGW_CHECK_DLL([liblangtag])
11895     else
11896         SYSTEM_LIBLANGTAG=
11897         AC_MSG_RESULT([no])
11898         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11899         dnl TODO: remove when liblangtag is updated to 0.5.5
11900         AC_DEFINE([LIBLANGTAG_INLINE_FIX])
11901         if test "$COM" = "MSC"; then
11902             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11903         else
11904             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11905         fi
11906     fi
11907 else
11908     AC_MSG_RESULT([no])
11910 AC_SUBST(ENABLE_LIBLANGTAG)
11911 AC_SUBST(SYSTEM_LIBLANGTAG)
11912 AC_SUBST(LIBLANGTAG_CFLAGS)
11913 AC_SUBST(LIBLANGTAG_LIBS)
11915 dnl ===================================================================
11916 dnl Test whether to build libpng or rely on the system version
11917 dnl ===================================================================
11919 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11921 dnl ===================================================================
11922 dnl Check for runtime JVM search path
11923 dnl ===================================================================
11924 if test "$ENABLE_JAVA" != ""; then
11925     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11926     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11927         AC_MSG_RESULT([yes])
11928         if ! test -d "$with_jvm_path"; then
11929             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11930         fi
11931         if ! test -d "$with_jvm_path"jvm; then
11932             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11933         fi
11934         JVM_ONE_PATH_CHECK="$with_jvm_path"
11935         AC_SUBST(JVM_ONE_PATH_CHECK)
11936     else
11937         AC_MSG_RESULT([no])
11938     fi
11941 dnl ===================================================================
11942 dnl Test for the presence of Ant and that it works
11943 dnl ===================================================================
11945 if test "$ENABLE_JAVA" != ""; then
11946     ANT_HOME=; export ANT_HOME
11947     WITH_ANT_HOME=; export WITH_ANT_HOME
11948     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11949         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11950             if test "$_os" = "WINNT"; then
11951                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11952             else
11953                 with_ant_home="$LODE_HOME/opt/ant"
11954             fi
11955         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11956             with_ant_home="$LODE_HOME/opt/ant"
11957         fi
11958     fi
11959     if test -z "$with_ant_home"; then
11960         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11961     else
11962         if test "$_os" = "WINNT"; then
11963             # AC_PATH_PROGS needs unix path
11964             with_ant_home=`cygpath -u "$with_ant_home"`
11965         fi
11966         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11967         WITH_ANT_HOME=$with_ant_home
11968         ANT_HOME=$with_ant_home
11969     fi
11971     if test -z "$ANT"; then
11972         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11973     else
11974         # resolve relative or absolute symlink
11975         while test -h "$ANT"; do
11976             a_cwd=`pwd`
11977             a_basename=`basename "$ANT"`
11978             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11979             cd "`dirname "$ANT"`"
11980             cd "`dirname "$a_script"`"
11981             ANT="`pwd`"/"`basename "$a_script"`"
11982             cd "$a_cwd"
11983         done
11985         AC_MSG_CHECKING([if $ANT works])
11986         cat > conftest.java << EOF
11987         public class conftest {
11988             int testmethod(int a, int b) {
11989                     return a + b;
11990             }
11991         }
11994         cat > conftest.xml << EOF
11995         <project name="conftest" default="conftest">
11996         <target name="conftest">
11997             <javac srcdir="." includes="conftest.java">
11998             </javac>
11999         </target>
12000         </project>
12003         oldJAVA_HOME=$JAVA_HOME
12004         if test "$JAVACISGCJ" = "yes"; then
12005             JAVA_HOME=; export JAVA_HOME
12006             ant_gcj="-Dbuild.compiler=gcj"
12007         fi
12008         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
12009         if test $? = 0 -a -f ./conftest.class; then
12010             AC_MSG_RESULT([Ant works])
12011             if test -z "$WITH_ANT_HOME"; then
12012                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
12013                 if test -z "$ANT_HOME"; then
12014                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
12015                 fi
12016             else
12017                 ANT_HOME="$WITH_ANT_HOME"
12018             fi
12019         else
12020             echo "configure: Ant test failed" >&5
12021             cat conftest.java >&5
12022             cat conftest.xml >&5
12023             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
12024             ANT_HOME=""
12025             add_warning "Ant does not work - Some Java projects will not build!"
12026         fi
12027         JAVA_HOME=$oldJAVA_HOME
12028         rm -f conftest* core core.* *.core
12029     fi
12030     if test -z "$ANT_HOME"; then
12031         ANT_HOME="NO_ANT_HOME"
12032     else
12033         PathFormat "$ANT_HOME"
12034         ANT_HOME="$formatted_path"
12035         PathFormat "$ANT"
12036         ANT="$formatted_path"
12037     fi
12038     AC_SUBST(ANT_HOME)
12039     AC_SUBST(ANT)
12041     dnl Checking for ant.jar
12042     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12043         AC_MSG_CHECKING([Ant lib directory])
12044         if test -f $ANT_HOME/lib/ant.jar; then
12045             ANT_LIB="$ANT_HOME/lib"
12046         else
12047             if test -f $ANT_HOME/ant.jar; then
12048                 ANT_LIB="$ANT_HOME"
12049             else
12050                 if test -f /usr/share/java/ant.jar; then
12051                     ANT_LIB=/usr/share/java
12052                 else
12053                     if test -f /usr/share/ant-core/lib/ant.jar; then
12054                         ANT_LIB=/usr/share/ant-core/lib
12055                     else
12056                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12057                             ANT_LIB="$ANT_HOME/lib/ant"
12058                         else
12059                             if test -f /usr/share/lib/ant/ant.jar; then
12060                                 ANT_LIB=/usr/share/lib/ant
12061                             else
12062                                 AC_MSG_ERROR([Ant libraries not found!])
12063                             fi
12064                         fi
12065                     fi
12066                 fi
12067             fi
12068         fi
12069         PathFormat "$ANT_LIB"
12070         ANT_LIB="$formatted_path"
12071         AC_MSG_RESULT([Ant lib directory found.])
12072     fi
12073     AC_SUBST(ANT_LIB)
12075     ant_minver=1.6.0
12076     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12078     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12079     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12080     ant_version_major=`echo $ant_version | cut -d. -f1`
12081     ant_version_minor=`echo $ant_version | cut -d. -f2`
12082     echo "configure: ant_version $ant_version " >&5
12083     echo "configure: ant_version_major $ant_version_major " >&5
12084     echo "configure: ant_version_minor $ant_version_minor " >&5
12085     if test "$ant_version_major" -ge "2"; then
12086         AC_MSG_RESULT([yes, $ant_version])
12087     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12088         AC_MSG_RESULT([yes, $ant_version])
12089     else
12090         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12091     fi
12093     rm -f conftest* core core.* *.core
12096 OOO_JUNIT_JAR=
12097 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12098     AC_MSG_CHECKING([for JUnit 4])
12099     if test "$with_junit" = "yes"; then
12100         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12101             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12102         elif test -e /usr/share/java/junit4.jar; then
12103             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12104         else
12105            if test -e /usr/share/lib/java/junit.jar; then
12106               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12107            else
12108               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12109            fi
12110         fi
12111     else
12112         OOO_JUNIT_JAR=$with_junit
12113     fi
12114     if test "$_os" = "WINNT"; then
12115         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12116     fi
12117     printf 'import org.junit.Before;' > conftest.java
12118     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12119         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12120     else
12121         AC_MSG_ERROR(
12122 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12123  specify its pathname via --with-junit=..., or disable it via --without-junit])
12124     fi
12125     rm -f conftest.class conftest.java
12126     if test $OOO_JUNIT_JAR != ""; then
12127     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12128     fi
12130 AC_SUBST(OOO_JUNIT_JAR)
12132 HAMCREST_JAR=
12133 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12134     AC_MSG_CHECKING([for included Hamcrest])
12135     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12136     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12137         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12138     else
12139         AC_MSG_RESULT([Not included])
12140         AC_MSG_CHECKING([for standalone hamcrest jar.])
12141         if test "$with_hamcrest" = "yes"; then
12142             if test -e /usr/share/lib/java/hamcrest.jar; then
12143                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12144             elif test -e /usr/share/java/hamcrest/core.jar; then
12145                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12146             else
12147                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12148             fi
12149         else
12150             HAMCREST_JAR=$with_hamcrest
12151         fi
12152         if test "$_os" = "WINNT"; then
12153             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12154         fi
12155         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12156             AC_MSG_RESULT([$HAMCREST_JAR])
12157         else
12158             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),
12159                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12160         fi
12161     fi
12162     rm -f conftest.class conftest.java
12164 AC_SUBST(HAMCREST_JAR)
12167 AC_SUBST(SCPDEFS)
12170 # check for wget and curl
12172 WGET=
12173 CURL=
12175 if test "$enable_fetch_external" != "no"; then
12177 CURL=`which curl 2>/dev/null`
12179 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12180     eval "$i --version" > /dev/null 2>&1
12181     ret=$?
12182     if test $ret -eq 0; then
12183         WGET=$i
12184         break
12185     fi
12186 done
12188 if test -z "$WGET" -a -z "$CURL"; then
12189     AC_MSG_ERROR([neither wget nor curl found!])
12194 AC_SUBST(WGET)
12195 AC_SUBST(CURL)
12198 # check for md5sum
12200 MD5SUM=
12202 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12203     if test "$i" = "md5"; then
12204         eval "$i -x" > /dev/null 2>&1
12205     else
12206         eval "$i --version" > /dev/null 2>&1
12207     fi
12208     ret=$?
12209     if test $ret -eq 0; then
12210         MD5SUM=$i
12211         break
12212     fi
12213 done
12215 if test "$MD5SUM" = "md5"; then
12216     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12217         MD5SUM="$MD5SUM -r"
12218     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12219         MD5SUM="$MD5SUM -n"
12220     fi
12223 if test -z "$MD5SUM"; then
12224     AC_MSG_ERROR([no md5sum found!])
12227 AC_SUBST(MD5SUM)
12229 dnl ===================================================================
12230 dnl Dealing with l10n options
12231 dnl ===================================================================
12232 AC_MSG_CHECKING([which languages to be built])
12233 # get list of all languages
12234 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12235 # the sed command does the following:
12236 #   + if a line ends with a backslash, append the next line to it
12237 #   + adds " on the beginning of the value (after =)
12238 #   + adds " at the end of the value
12239 #   + removes en-US; we want to put it on the beginning
12240 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12241 [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)]
12242 ALL_LANGS="en-US $completelangiso"
12243 # check the configured localizations
12244 WITH_LANG="$with_lang"
12245 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12246     AC_MSG_RESULT([en-US])
12247 else
12248     AC_MSG_RESULT([$WITH_LANG])
12249     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12251 # check that the list is valid
12252 for lang in $WITH_LANG; do
12253     test "$lang" = "ALL" && continue
12254     # need to check for the exact string, so add space before and after the list of all languages
12255     for vl in $ALL_LANGS; do
12256         if test "$vl" = "$lang"; then
12257            break
12258         fi
12259     done
12260     if test "$vl" != "$lang"; then
12261         # if you're reading this - you prolly quoted your languages remove the quotes ...
12262         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12263     fi
12264 done
12265 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12266     echo $WITH_LANG | grep -q en-US
12267     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12269 # list with substituted ALL
12270 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12271 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12272 test "$WITH_LANG" = "en-US" && WITH_LANG=
12273 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12274     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12275     ALL_LANGS=`echo $ALL_LANGS qtz`
12277 AC_SUBST(ALL_LANGS)
12278 AC_SUBST(WITH_LANG)
12279 AC_SUBST(WITH_LANG_LIST)
12280 AC_SUBST(GIT_NEEDED_SUBMODULES)
12282 WITH_POOR_HELP_LOCALIZATIONS=
12283 if test -d "$SRC_ROOT/translations/source"; then
12284     for l in `ls -1 $SRC_ROOT/translations/source`; do
12285         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12286             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12287         fi
12288     done
12290 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12292 if test -n "$with_locales"; then
12293     WITH_LOCALES="$with_locales"
12295     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12296     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12297     # config_host/config_locales.h.in
12298     for locale in $WITH_LOCALES; do
12299         lang=${locale%_*}
12301         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12303         case $lang in
12304         hi|mr*ne)
12305             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12306             ;;
12307         bg|ru)
12308             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12309             ;;
12310         esac
12311     done
12312 else
12313     AC_DEFINE(WITH_LOCALE_ALL)
12315 AC_SUBST(WITH_LOCALES)
12317 dnl git submodule update --reference
12318 dnl ===================================================================
12319 if test -n "${GIT_REFERENCE_SRC}"; then
12320     for repo in ${GIT_NEEDED_SUBMODULES}; do
12321         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12322             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12323         fi
12324     done
12326 AC_SUBST(GIT_REFERENCE_SRC)
12328 dnl git submodules linked dirs
12329 dnl ===================================================================
12330 if test -n "${GIT_LINK_SRC}"; then
12331     for repo in ${GIT_NEEDED_SUBMODULES}; do
12332         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12333             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12334         fi
12335     done
12337 AC_SUBST(GIT_LINK_SRC)
12339 dnl branding
12340 dnl ===================================================================
12341 AC_MSG_CHECKING([for alternative branding images directory])
12342 # initialize mapped arrays
12343 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12344 brand_files="$BRAND_INTRO_IMAGES about.svg"
12346 if test -z "$with_branding" -o "$with_branding" = "no"; then
12347     AC_MSG_RESULT([none])
12348     DEFAULT_BRAND_IMAGES="$brand_files"
12349 else
12350     if ! test -d $with_branding ; then
12351         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12352     else
12353         AC_MSG_RESULT([$with_branding])
12354         CUSTOM_BRAND_DIR="$with_branding"
12355         for lfile in $brand_files
12356         do
12357             if ! test -f $with_branding/$lfile ; then
12358                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12359                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12360             else
12361                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12362             fi
12363         done
12364         check_for_progress="yes"
12365     fi
12367 AC_SUBST([BRAND_INTRO_IMAGES])
12368 AC_SUBST([CUSTOM_BRAND_DIR])
12369 AC_SUBST([CUSTOM_BRAND_IMAGES])
12370 AC_SUBST([DEFAULT_BRAND_IMAGES])
12373 AC_MSG_CHECKING([for 'intro' progress settings])
12374 PROGRESSBARCOLOR=
12375 PROGRESSSIZE=
12376 PROGRESSPOSITION=
12377 PROGRESSFRAMECOLOR=
12378 PROGRESSTEXTCOLOR=
12379 PROGRESSTEXTBASELINE=
12381 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12382     source "$with_branding/progress.conf"
12383     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12384 else
12385     AC_MSG_RESULT([none])
12388 AC_SUBST(PROGRESSBARCOLOR)
12389 AC_SUBST(PROGRESSSIZE)
12390 AC_SUBST(PROGRESSPOSITION)
12391 AC_SUBST(PROGRESSFRAMECOLOR)
12392 AC_SUBST(PROGRESSTEXTCOLOR)
12393 AC_SUBST(PROGRESSTEXTBASELINE)
12396 AC_MSG_CHECKING([for extra build ID])
12397 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12398     EXTRA_BUILDID="$with_extra_buildid"
12400 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12401 if test -n "$EXTRA_BUILDID" ; then
12402     AC_MSG_RESULT([$EXTRA_BUILDID])
12403 else
12404     AC_MSG_RESULT([not set])
12406 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12408 OOO_VENDOR=
12409 AC_MSG_CHECKING([for vendor])
12410 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12411     OOO_VENDOR="$USERNAME"
12413     if test -z "$OOO_VENDOR"; then
12414         OOO_VENDOR="$USER"
12415     fi
12417     if test -z "$OOO_VENDOR"; then
12418         OOO_VENDOR="`id -u -n`"
12419     fi
12421     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12422 else
12423     OOO_VENDOR="$with_vendor"
12424     AC_MSG_RESULT([$OOO_VENDOR])
12426 AC_SUBST(OOO_VENDOR)
12428 if echo "$host_os" | grep -q linux-android ; then
12429     ANDROID_PACKAGE_NAME=
12430     AC_MSG_CHECKING([for Android package name])
12431     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12432         if test -n "$ENABLE_DEBUG"; then
12433             # Default to the package name that makes ndk-gdb happy.
12434             ANDROID_PACKAGE_NAME="org.libreoffice"
12435         else
12436             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12437         fi
12439         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12440     else
12441         ANDROID_PACKAGE_NAME="$with_android_package_name"
12442         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12443     fi
12444     AC_SUBST(ANDROID_PACKAGE_NAME)
12447 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12448 if test "$with_compat_oowrappers" = "yes"; then
12449     WITH_COMPAT_OOWRAPPERS=TRUE
12450     AC_MSG_RESULT(yes)
12451 else
12452     WITH_COMPAT_OOWRAPPERS=
12453     AC_MSG_RESULT(no)
12455 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12457 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
12458 AC_MSG_CHECKING([for install dirname])
12459 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12460     INSTALLDIRNAME="$with_install_dirname"
12462 AC_MSG_RESULT([$INSTALLDIRNAME])
12463 AC_SUBST(INSTALLDIRNAME)
12465 AC_MSG_CHECKING([for prefix])
12466 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12467 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12468 PREFIXDIR="$prefix"
12469 AC_MSG_RESULT([$PREFIXDIR])
12470 AC_SUBST(PREFIXDIR)
12472 LIBDIR=[$(eval echo $(eval echo $libdir))]
12473 AC_SUBST(LIBDIR)
12475 DATADIR=[$(eval echo $(eval echo $datadir))]
12476 AC_SUBST(DATADIR)
12478 MANDIR=[$(eval echo $(eval echo $mandir))]
12479 AC_SUBST(MANDIR)
12481 DOCDIR=[$(eval echo $(eval echo $docdir))]
12482 AC_SUBST(DOCDIR)
12484 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12485 AC_SUBST(INSTALLDIR)
12487 TESTINSTALLDIR="${BUILDDIR}/test-install"
12488 AC_SUBST(TESTINSTALLDIR)
12491 # ===================================================================
12492 # OAuth2 id and secrets
12493 # ===================================================================
12495 AC_MSG_CHECKING([for Google Drive client id and secret])
12496 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12497 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12498 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12499     GDRIVE_CLIENT_ID="\"\""
12502 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12503     GDRIVE_CLIENT_SECRET="\"\""
12506 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12507     AC_MSG_RESULT([not set])
12508 else
12509     AC_MSG_RESULT([set])
12512 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12513 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12515 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12516 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12517 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12518 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12519     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12522 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12523     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12526 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12527     AC_MSG_RESULT([not set])
12528 else
12529     AC_MSG_RESULT([set])
12531 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12532 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12534 AC_MSG_CHECKING([for OneDrive client id and secret])
12535 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12536 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12537 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12538     ONEDRIVE_CLIENT_ID="\"\""
12541 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12542     ONEDRIVE_CLIENT_SECRET="\"\""
12545 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12546     AC_MSG_RESULT([not set])
12547 else
12548     AC_MSG_RESULT([set])
12550 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12551 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12554 # ===================================================================
12555 # De- or increase default verbosity of build process
12556 # ===================================================================
12557 AC_MSG_CHECKING([build verbosity])
12558 if test -n "$enable_verbose"; then
12559     if test "$enable_verbose" = "yes"; then
12560         VERBOSE="TRUE"
12561         AC_MSG_RESULT([high])
12562     fi
12563     if test "$enable_verbose" = "no"; then
12564         VERBOSE="FALSE"
12565         AC_MSG_RESULT([low])
12566     fi
12567 else
12568     AC_MSG_RESULT([not set])
12570 AC_SUBST(VERBOSE)
12572 dnl ===================================================================
12573 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12574 dnl --enable-dependency-tracking configure option
12575 dnl ===================================================================
12576 AC_MSG_CHECKING([whether to enable dependency tracking])
12577 if test "$enable_dependency_tracking" = "no"; then
12578     nodep=TRUE
12579     AC_MSG_RESULT([no])
12580 else
12581     AC_MSG_RESULT([yes])
12583 AC_SUBST(nodep)
12585 dnl ===================================================================
12586 dnl Number of CPUs to use during the build
12587 dnl ===================================================================
12588 AC_MSG_CHECKING([for number of processors to use])
12589 # plain --with-parallelism is just the default
12590 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12591     if test "$with_parallelism" = "no"; then
12592         PARALLELISM=0
12593     else
12594         PARALLELISM=$with_parallelism
12595     fi
12596 else
12597     if test "$enable_icecream" = "yes"; then
12598         PARALLELISM="10"
12599     else
12600         case `uname -s` in
12602         Darwin|FreeBSD|NetBSD|OpenBSD)
12603             PARALLELISM=`sysctl -n hw.ncpu`
12604             ;;
12606         Linux)
12607             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12608         ;;
12609         # what else than above does profit here *and* has /proc?
12610         *)
12611             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12612             ;;
12613         esac
12615         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12616         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12617     fi
12620 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12621     if test -z "$with_parallelism"; then
12622             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12623             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12624             PARALLELISM="1"
12625     else
12626         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."
12627     fi
12630 if test $PARALLELISM -eq 0; then
12631     AC_MSG_RESULT([explicit make -j option needed])
12632 else
12633     AC_MSG_RESULT([$PARALLELISM])
12635 AC_SUBST(PARALLELISM)
12637 IWYU_PATH="$with_iwyu"
12638 AC_SUBST(IWYU_PATH)
12639 if test ! -z "$IWYU_PATH"; then
12640     if test ! -f "$IWYU_PATH"; then
12641         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12642     fi
12646 # Set up ILIB for MSVC build
12648 ILIB1=
12649 if test "$build_os" = "cygwin"; then
12650     ILIB="."
12651     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12652         ILIB="$ILIB;$JAVA_HOME/lib"
12653     fi
12654     ILIB1=-link
12655     if test "$BITNESS_OVERRIDE" = 64; then
12656         ILIB="$ILIB;$COMPATH/lib/amd64"
12657         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12658         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12659         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12660         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81; then
12661             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12662             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12663         fi
12664     else
12665         ILIB="$ILIB;$COMPATH/lib"
12666         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12667         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12668         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12669         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81; then
12670             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12671             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12672         fi
12673     fi
12674     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12676     AC_SUBST(ILIB)
12679 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12680 if test "$CROSS_COMPILING" = "TRUE"; then
12681     broken='assuming not (cross-compiling)'
12682 else
12683     save_CXXFLAGS=$CXXFLAGS
12684     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12685     save_LIBS=$LIBS
12686     if test -n "$ILIB1"; then
12687         LIBS="$LIBS $ILIB1"
12688     fi
12689     AC_LANG_PUSH([C++])
12690     AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12691         // Exit with failure if the static initializer_list is stored on the
12692         // stack (as done by Clang < 3.4):
12693         #include <initializer_list>
12694         struct S {};
12695         bool g(void const * p1, void const * p2) {
12696             int n;
12697             return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12698         }
12699         bool f(void const * p1) {
12700             static std::initializer_list<S> s { S() };
12701             return g(p1, s.begin());
12702         }
12703         ]],[[
12704             int n;
12705             return f(&n) ? 0 : 1;
12706         ]])], [broken=no], [broken=yes])
12707     AC_LANG_POP([C++])
12708     LIBS=$save_LIBS
12709     CXXFLAGS=$save_CXXFLAGS
12711 AC_MSG_RESULT([$broken])
12712 if test "$broken" = yes; then
12713     AC_DEFINE([HAVE_BROKEN_STATIC_INITILIZER_LIST])
12717 # ===================================================================
12718 # Creating bigger shared library to link against
12719 # ===================================================================
12720 AC_MSG_CHECKING([whether to create huge library])
12721 MERGELIBS=
12723 if test $_os = iOS -o $_os = Android; then
12724     # Never any point in mergelibs for these as we build just static
12725     # libraries anyway...
12726     enable_mergelibs=no
12729 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12730     if test $_os != Linux -a $_os != WINNT; then
12731         add_warning "--enable-mergelibs is not tested for this platform"
12732     fi
12733     MERGELIBS="TRUE"
12734     AC_MSG_RESULT([yes])
12735 else
12736     AC_MSG_RESULT([no])
12738 AC_SUBST([MERGELIBS])
12740 # ===================================================================
12741 # Create hardlinks on deliver instead of copying for smaller size and speed up
12742 # ===================================================================
12743 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12744 HARDLINKDELIVER=
12745 if test "$enable_hardlink_deliver" = "yes"; then
12746     HARDLINKDELIVER="TRUE"
12747     AC_MSG_RESULT([yes])
12748 else
12749     AC_MSG_RESULT([no])
12751 AC_SUBST(HARDLINKDELIVER)
12753 dnl ===================================================================
12754 dnl icerun is a wrapper that stops us spawning tens of processes
12755 dnl locally - for tools that can't be executed on the compile cluster
12756 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12757 dnl ===================================================================
12758 AC_MSG_CHECKING([whether to use icerun wrapper])
12759 ICECREAM_RUN=
12760 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12761     ICECREAM_RUN=icerun
12762     AC_MSG_RESULT([yes])
12763 else
12764     AC_MSG_RESULT([no])
12766 AC_SUBST(ICECREAM_RUN)
12768 dnl ===================================================================
12769 dnl Setup the ICECC_VERSION for the build the same way it was set for
12770 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12771 dnl ===================================================================
12772 x_ICECC_VERSION=[\#]
12773 if test -n "$ICECC_VERSION" ; then
12774     x_ICECC_VERSION=
12776 AC_SUBST(x_ICECC_VERSION)
12777 AC_SUBST(ICECC_VERSION)
12779 dnl ===================================================================
12781 AC_MSG_CHECKING([MPL subset])
12782 MPL_SUBSET=
12784 if test "$enable_mpl_subset" = "yes"; then
12785     warn_report=false
12786     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12787         warn_report=true
12788     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12789         warn_report=true
12790     fi
12791     if test "$warn_report" = "true"; then
12792         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12793     fi
12794     if test "x$enable_postgresql_sdbc" != "xno"; then
12795         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12796     fi
12797     if test "$enable_lotuswordpro" = "yes"; then
12798         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12799     fi
12800     if test "$WITH_WEBDAV" = "neon"; then
12801         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12802     fi
12803     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12804         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12805     fi
12806     if test -n "$ENABLE_PDFIMPORT"; then
12807         if test "x$SYSTEM_POPPLER" != "x"; then
12808             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12809         fi
12810     fi
12811     # cf. m4/libo_check_extension.m4
12812     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12813         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12814     fi
12815     for theme in $WITH_THEMES; do
12816         case $theme in
12817         breeze|crystal|default|hicontrast|human|oxygen|sifr)
12818             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12819         *) : ;;
12820         esac
12821     done
12823     ENABLE_OPENGL=
12825     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12826         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12827     fi
12829     MPL_SUBSET="TRUE"
12830     AC_DEFINE(MPL_HAVE_SUBSET)
12831     AC_MSG_RESULT([only])
12832 else
12833     AC_MSG_RESULT([no restrictions])
12835 AC_SUBST(MPL_SUBSET)
12838 dnl ===================================================================
12839 dnl Setting up the environment.
12840 dnl ===================================================================
12841 echo "setting up the build environment variables..."
12843 AC_SUBST(COMPATH)
12845 if test "$build_os" = "cygwin"; then
12846     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12847         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12848         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12849     else
12850         ATL_LIB="$COMPATH/atlmfc/lib"
12851         ATL_INCLUDE="$COMPATH/atlmfc/include"
12852     fi
12853     if test "$BITNESS_OVERRIDE" = 64; then
12854         ATL_LIB="$ATL_LIB/amd64"
12855     fi
12856     PathFormat "/usr/bin/grep.exe"
12857     WIN_GREP="$formatted_path"
12858     PathFormat "/usr/bin/find.exe"
12859     WIN_FIND="$formatted_path"
12860     PathFormat "/usr/bin/ls.exe"
12861     WIN_LS="$formatted_path"
12862     PathFormat "/usr/bin/touch.exe"
12863     WIN_TOUCH="$formatted_path"
12866 AC_SUBST(ATL_INCLUDE)
12867 AC_SUBST(ATL_LIB)
12868 AC_SUBST(WIN_FIND)
12869 AC_SUBST(WIN_GREP)
12870 AC_SUBST(WIN_LS)
12871 AC_SUBST(WIN_TOUCH)
12873 AC_SUBST(BUILD_TYPE)
12875 AC_SUBST(SOLARINC)
12877 PathFormat "$PERL"
12878 PERL="$formatted_path"
12879 AC_SUBST(PERL)
12881 if test -n "$TMPDIR"; then
12882     TEMP_DIRECTORY="$TMPDIR"
12883 else
12884     TEMP_DIRECTORY="/tmp"
12886 if test "$build_os" = "cygwin"; then
12887     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12889 AC_SUBST(TEMP_DIRECTORY)
12891 # setup the PATH for the environment
12892 if test -n "$LO_PATH_FOR_BUILD"; then
12893     LO_PATH="$LO_PATH_FOR_BUILD"
12894 else
12895     LO_PATH="$PATH"
12897     case "$host_os" in
12899     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12900         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12901             pathmunge "$JAVA_HOME/bin" "after"
12902         fi
12903         ;;
12905     cygwin*)
12906         # Win32 make needs native paths
12907         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12908             LO_PATH=`cygpath -p -m "$PATH"`
12909         fi
12910         if test "$BITNESS_OVERRIDE" = 64; then
12911             # needed for msi packaging
12912             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12913         fi
12914         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12915         pathmunge "$ASM_HOME" "before"
12916         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12917         pathmunge "$CSC_PATH" "before"
12918         pathmunge "$MIDL_PATH" "before"
12919         pathmunge "$AL_PATH" "before"
12920         pathmunge "$MSPDB_PATH" "before"
12921         if test -n "$MSBUILD_PATH" ; then
12922             pathmunge "$MSBUILD_PATH" "before"
12923         fi
12924         if test "$BITNESS_OVERRIDE" = 64; then
12925             if test "$vcexpress" = "Express"; then
12926                 pathmunge "$COMPATH/bin/x86_amd64" "before"
12927                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12928             else
12929                 pathmunge "$COMPATH/bin/amd64" "before"
12930                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12931             fi
12932         else
12933             pathmunge "$COMPATH/bin" "before"
12934             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12935         fi
12936         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12937             if test -d "$JAVA_HOME/jre/bin/client"; then
12938                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12939             fi
12940             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12941                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12942             fi
12943             pathmunge "$JAVA_HOME/bin" "before"
12944         fi
12945         ;;
12947     solaris*)
12948         pathmunge "/usr/css/bin" "before"
12949         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12950             pathmunge "$JAVA_HOME/bin" "after"
12951         fi
12952         ;;
12953     esac
12956 AC_SUBST(LO_PATH)
12958 # Generate a configuration md5 we can use for deps
12959 if test -f config_host.mk; then
12960     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12962 if test -f config_host_lang.mk; then
12963     config_lang_md5=`$MD5SUM config_host_lang.mk | sed "s/ .*//"`
12966 AC_CONFIG_FILES([config_host.mk
12967                  config_host_lang.mk
12968                  Makefile
12969                  lo.xcent
12970                  instsetoo_native/util/openoffice.lst
12971                  sysui/desktop/macosx/Info.plist
12972                  ios/lo.xcconfig])
12973 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12974 AC_CONFIG_HEADERS([config_host/config_clang.h])
12975 AC_CONFIG_HEADERS([config_host/config_eot.h])
12976 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12977 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12978 AC_CONFIG_HEADERS([config_host/config_cups.h])
12979 AC_CONFIG_HEADERS([config_host/config_features.h])
12980 AC_CONFIG_HEADERS([config_host/config_folders.h])
12981 AC_CONFIG_HEADERS([config_host/config_gcc.h])
12982 AC_CONFIG_HEADERS([config_host/config_global.h])
12983 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12984 AC_CONFIG_HEADERS([config_host/config_java.h])
12985 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12986 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12987 AC_CONFIG_HEADERS([config_host/config_locales.h])
12988 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12989 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12990 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12991 AC_CONFIG_HEADERS([config_host/config_mingw.h])
12992 AC_CONFIG_HEADERS([config_host/config_oox.h])
12993 AC_CONFIG_HEADERS([config_host/config_options.h])
12994 AC_CONFIG_HEADERS([config_host/config_test.h])
12995 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12996 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12997 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12998 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12999 AC_CONFIG_HEADERS([config_host/config_version.h])
13000 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
13001 AC_CONFIG_HEADERS([config_host/config_poppler.h])
13002 AC_OUTPUT
13004 if test "$CROSS_COMPILING" = TRUE; then
13005     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
13008 # touch the config timestamp file
13009 if test ! -f config_host.mk.stamp; then
13010     echo > config_host.mk.stamp
13011 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
13012     echo "Configuration unchanged - avoiding scp2 stamp update"
13013 else
13014     echo > config_host.mk.stamp
13017 # touch the config lang timestamp file
13018 if test ! -f config_host_lang.mk.stamp; then
13019     echo > config_host_lang.mk.stamp
13020 elif test "$config_lang_md5" = `$MD5SUM config_host_lang.mk | sed "s/ .*//"`; then
13021     echo "Configuration unchanged - avoiding scp2 stamp update"
13022 else
13023     echo > config_host_lang.mk.stamp
13027 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
13029 cat << _EOS
13030 ****************************************************************************
13031 WARNING:
13032 Your make version is known to be horribly slow, and hard to debug
13033 problems with. To get a reasonably functional make please do:
13035 to install a pre-compiled binary make for Win32
13037  mkdir -p /opt/lo/bin
13038  cd /opt/lo/bin
13039  wget http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
13040  cp make-85047eb-msvc.exe make
13041  chmod +x make
13043 to install from source:
13044 place yourself in a working directory of you choice.
13046  git clone git://git.savannah.gnu.org/make.git
13048  [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"]
13049  set PATH=%PATH%;C:\Cygwin\bin
13050  [or Cygwin64, if that is what you have]
13051  cd path-to-make-repo-you-cloned-above
13052  build_w32.bat --without-guile
13054 should result in a WinRel/gnumake.exe.
13055 Copy it to to the Cygwin /opt/lo/bin directory as make.exe
13057 Then re-run autogen.sh
13059 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13060 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13062 _EOS
13065 cat << _EOF
13066 ****************************************************************************
13068 To build, issue:
13069 $GNUMAKE
13071 For details, run:
13072 $GNUMAKE help
13074 _EOF
13076 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13077     cat << _EOF
13078 After the build has finished, you can immediately run it using:
13079 instdir/program/soffice
13081 If you want to run the smoketest, issue:
13082 $GNUMAKE check
13084 _EOF
13087 if test -f warn; then
13088     cat warn
13089     rm warn
13092 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: