Typo: skiped->skipped
[LibreOffice.git] / configure.ac
blobbd7eba52ebb1974dffe6a581fba221166050ed10
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argumemnt to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[4.5.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 PathFormat()
30     formatted_path="$1"
31     if test "$build_os" = "cygwin"; then
32         pf_conv_to_dos=
33         # spaces,parentheses,brackets,braces are problematic in pathname
34         # so are backslashes
35         case "$formatted_path" in
36             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
37                 pf_conv_to_dos="yes"
38             ;;
39         esac
40         if test "$pf_conv_to_dos" = "yes"; then
41             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
42                 formatted_path=`cygpath -sm "$formatted_path"`
43             else
44                 formatted_path=`cygpath -d "$formatted_path"`
45             fi
46             if test $? -ne 0;  then
47                 AC_MSG_ERROR([path conversion failed for "$1".])
48             fi
49         fi
50         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
51         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
52         if test "$fp_count_slash$fp_count_colon" != "00"; then
53             if test "$fp_count_colon" = "0"; then
54                 new_formatted_path=`realpath "$formatted_path"`
55                 if test $? -ne 0;  then
56                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
57                 else
58                     formatted_path="$new_formatted_path"
59                 fi
60             fi
61             formatted_path=`cygpath -m "$formatted_path"`
62             if test $? -ne 0;  then
63                 AC_MSG_ERROR([path conversion failed for "$1".])
64             fi
65         fi
66     fi
69 AbsolutePath()
71     # There appears to be no simple and portable method to get an absolute and
72     # canonical path, so we try creating the directory if does not exist and
73     # utilizing the shell and pwd.
74     rel="$1"
75     absolute_path=""
76     test ! -e "$rel" && mkdir -p "$rel"
77     if test -d "$rel" ; then
78         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
79         absolute_path="$(pwd)"
80         cd - > /dev/null
81     else
82         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
83     fi
86 rm -f warn
87 have_WARNINGS="no"
88 add_warning()
90     if test "$have_WARNINGS" = "no"; then
91         echo "*************************************" > warn
92         have_WARNINGS="yes"
93         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
94             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
95             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
96         else
97             COLORWARN="* WARNING :"
98         fi
99     fi
100     echo "$COLORWARN $@" >> warn
103 echo "********************************************************************"
104 echo "*"
105 echo "*   Running ${PACKAGE_NAME} build configuration."
106 echo "*"
107 echo "********************************************************************"
108 echo ""
110 dnl ===================================================================
111 dnl checks build and host OSes
112 dnl do this before argument processing to allow for platform dependent defaults
113 dnl ===================================================================
114 AC_CANONICAL_HOST
116 AC_MSG_CHECKING([for product name])
117 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
118     PRODUCTNAME=AC_PACKAGE_NAME"Dev"
119 else
120     PRODUCTNAME=AC_PACKAGE_NAME
122 AC_MSG_RESULT([$PRODUCTNAME])
123 AC_SUBST(PRODUCTNAME)
125 dnl ===================================================================
126 dnl Our version is defined by the AC_INIT() at the top of this script.
127 dnl ===================================================================
129 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
131 LIBO_VERSION_MAJOR=$1
132 LIBO_VERSION_MINOR=$2
133 LIBO_VERSION_MICRO=$3
134 LIBO_VERSION_PATCH=$4
136 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
137 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
138 # no way to encode that into an integer in general.
139 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
141 LIBO_VERSION_SUFFIX=$5
142 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
143 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
144 # they get undoubled before actually passed to sed.
145 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
146 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
147 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
148 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
150 AC_SUBST(LIBO_VERSION_MAJOR)
151 AC_SUBST(LIBO_VERSION_MINOR)
152 AC_SUBST(LIBO_VERSION_MICRO)
153 AC_SUBST(LIBO_VERSION_PATCH)
154 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
155 AC_SUBST(LIBO_VERSION_SUFFIX)
156 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
158 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
159 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
160 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
161 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
163 LIBO_THIS_YEAR=`date +%Y`
164 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
166 dnl ===================================================================
167 dnl Product version
168 dnl ===================================================================
169 AC_MSG_CHECKING([for product version])
170 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
171 AC_MSG_RESULT([$PRODUCTVERSION])
172 AC_SUBST(PRODUCTVERSION)
174 AC_PROG_EGREP
175 # AC_PROG_EGREP doesn't set GREP on all systems as well
176 AC_PATH_PROG(GREP, grep)
178 BUILDDIR=`pwd`
179 cd $srcdir
180 SRC_ROOT=`pwd`
181 cd $BUILDDIR
182 x_Cygwin=[\#]
184 dnl ===================================================================
185 dnl Search all the common names for GNU Make
186 dnl ===================================================================
187 AC_MSG_CHECKING([for GNU Make])
189 # try to use our own make if it is available and GNUMAKE was not already defined
190 if test -z "$GNUMAKE"; then
191     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
192         GNUMAKE="$LODE_HOME/opt/bin/make"
193     elif test -x "/opt/lo/bin/make"; then
194         GNUMAKE="/opt/lo/bin/make"
195     fi
198 GNUMAKE_WIN_NATIVE=
199 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
200     if test -n "$a"; then
201         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
202         if test $? -eq 0;  then
203             if test "$build_os" = "cygwin"; then
204                 if test -n "$($a -v | grep 'Built for Windows')" ; then
205                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
206                     GNUMAKE_WIN_NATIVE="TRUE"
207                 else
208                     GNUMAKE=`which $a`
209                 fi
210             else
211                 GNUMAKE=`which $a`
212             fi
213             break
214         fi
215     fi
216 done
217 AC_MSG_RESULT($GNUMAKE)
218 if test -z "$GNUMAKE"; then
219     AC_MSG_ERROR([not found. install GNU Make.])
220 else
221     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
222         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
223     fi
226 win_short_path_for_make()
228     local_short_path="$1"
229     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
230         cygpath -sm "$local_short_path"
231     else
232         cygpath -u "$(cygpath -d "$local_short_path")"
233     fi
237 if test "$build_os" = "cygwin"; then
238     PathFormat "$SRC_ROOT"
239     SRC_ROOT="$formatted_path"
240     PathFormat "$BUILDDIR"
241     BUILDDIR="$formatted_path"
242     x_Cygwin=
245 AC_SUBST(SRC_ROOT)
246 AC_SUBST(BUILDDIR)
247 AC_SUBST(x_Cygwin)
248 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
249 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
251 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
252     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
255 # need sed in os checks...
256 AC_PATH_PROGS(SED, sed)
257 if test -z "$SED"; then
258     AC_MSG_ERROR([install sed to run this script])
261 # Set the ENABLE_LTO variable
262 # ===================================================================
263 AC_MSG_CHECKING([whether to use link-time optimization])
264 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
265     ENABLE_LTO="TRUE"
266     AC_MSG_RESULT([yes])
267     AC_DEFINE(STATIC_LINKING)
268 else
269     ENABLE_LTO=""
270     AC_MSG_RESULT([no])
272 AC_SUBST(ENABLE_LTO)
274 dnl ===================================================================
275 dnl When building for Android, --with-android-ndk,
276 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
277 dnl mandatory
278 dnl ===================================================================
280 AC_ARG_WITH(android-ndk,
281     AS_HELP_STRING([--with-android-ndk],
282         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
285 AC_ARG_WITH(android-ndk-toolchain-version,
286     AS_HELP_STRING([--with-android-ndk-toolchain-version],
287         [Specify which toolchain version to use, of those present in the
288         Android NDK you are using. The default is 4.9 currently.]), ,)
290 AC_ARG_WITH(android-sdk,
291     AS_HELP_STRING([--with-android-sdk],
292         [Specify location of the Android SDK. Mandatory when building for Android,
293         or when building the Impress Remote Android app.]),
296 ANDROID_NDK_HOME=
297 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk"; then
298     with_android_ndk="$SRC_ROOT/external/android-ndk"
300 if test -n "$with_android_ndk"; then
301     ANDROID_NDK_HOME=$with_android_ndk
303     # Set up a lot of pre-canned defaults
305     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
306         AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT file in $ANDROID_NDK_HOME.])
307     fi
308     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
310     case $ANDROID_NDK_VERSION in
311     r9*|r10*)
312         ;;
313     *)
314         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r9* and r10* versions are supported])
315         ;;
316     esac
318     if test $host_cpu = arm; then
319         android_cpu=arm
320         android_platform_prefix=$android_cpu-linux-androideabi
321     elif test $host_cpu = aarch64; then
322         android_cpu=aarch64
323         android_platform_prefix=$android_cpu-linux-android
324     elif test $host_cpu = mips; then
325         android_cpu=mips
326         android_platform_prefix=$android_cpu-linux-androideabi
327     else
328         # host_cpu is something like "i386" or "i686" I guess, NDK uses
329         # "x86" in some contexts
330         android_cpu=x86
331         android_platform_prefix=$android_cpu
332     fi
334     if test -z "$with_android_ndk_toolchain_version"; then
335         # Default to gcc 4.9
336         with_android_ndk_toolchain_version=4.9
337     fi
339     case "$with_android_ndk_toolchain_version" in
340     4.6|4.7|4.8|4.9)
341         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
342         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
343         ;;
344     clang3.3|clang3.4)
345         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
346         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
347         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
348         ANDROID_USING_CLANG=true
349         ;;
350     *)
351         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
352     esac
354     if test ! -d $ANDROID_BINUTILS_DIR; then
355         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
356     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
357         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
358     fi
360     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
361     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
362     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
363     # manage to link the (app-specific) single huge .so that is built for the apps in
364     # android/experimental/* if there is debug information in a significant part of the object files.
365     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
366     # all objects have been built with debug information.)
367     toolchain_system='*'
368     case $build_os in
369     linux-gnu*)
370         ndk_build_os=linux
371         ;;
372     darwin*)
373         ndk_build_os=darwin
374         ;;
375     *)
376         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
377         ;;
378     esac
380     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
381     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
382     if test $build_cpu = x86_64; then
383         if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
384             ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
385         fi
386         if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
387             ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
388         fi
389     fi
390     ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
392     # This stays empty if there is just one version of the toolchain in the NDK
393     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
394     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
395     */bin\ */bin*)
396         # Trailing slash intentional and necessary, compare to how this is used
397         if test -n "$ANDROID_USING_CLANG"; then
398             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
399         else
400             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
401         fi
402         ;;
403     esac
405     ANDROID_API_LEVEL=15
406     if test $host_cpu = arm; then
407         android_gnu_prefix=arm-linux-androideabi
408     elif test $host_cpu = aarch64; then
409         android_gnu_prefix=aarch64-linux-android
410         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
411         ANDROID_API_LEVEL=L
412     elif test $host_cpu = mips; then
413         android_gnu_prefix=mipsel-linux-android
414     elif test $ANDROID_NDK_VERSION = r8; then
415         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
416         android_gnu_prefix=i686-android-linux
417     else
418         android_gnu_prefix=i686-linux-android
419     fi
421     ANDROID_ARCH=$android_cpu
422     if test $host_cpu = arm; then
423         ANDROID_APP_ABI=armeabi-v7a
424         if test -n "$ANDROID_USING_CLANG"; then
425             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
426             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
427             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
428         else
429             :
430         fi
431         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
432         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
433         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
434     elif test $host_cpu = aarch64; then
435         ANDROID_APP_ABI=arm64-v8a
436         ANDROID_ARCH=arm64
437     elif test $host_cpu = mips; then
438         ANDROID_APP_ABI=mips
439         ANDROIDCFLAGS=""
440     else # x86
441         ANDROID_APP_ABI=x86
442         ANDROIDCFLAGS="-march=atom"
443     fi
444     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
445     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
446     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
448     if test -n "$ANDROID_USING_CLANG"; then
449         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
450     else
451         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
452     fi
454     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
455     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
456     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
457     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
458     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
459     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
461     # When using the 4.6 or newer toolchain, use the gold linker
462     case "$with_android_ndk_toolchain_version" in
463     4.[[6789]]*|[[56789]].*|clang*)
464         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
465             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
466         fi
467         ;;
468     esac
470     if test "$ENABLE_LTO" = TRUE; then
471         # -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of
472         # $CC and $CXX when building external libraries
473         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
474     fi
476     # gdbserver can be in different locations
477     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
478         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
479     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
480         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
481     elif test $android_cpu = aarch64; then
482         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
483     else
484         AC_MSG_ERROR([Can't find gdbserver for your Android target])
485     fi
487     if test $host_cpu = arm; then
488         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/armeabi-v7a/include"
489     elif test $host_cpu = mips; then
490         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/mips/include"
491     else # x86
492         ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/x86/include"
493     fi
495     if test -z "$CC"; then
496         case "$with_android_ndk_toolchain_version" in
497         4.*)
498             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
499             ;;
500         clang*)
501             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
502         esac
503     fi
504     if test -z "$CXX"; then
505         case "$with_android_ndk_toolchain_version" in
506         4.*)
507             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
508             ;;
509         clang*)
510             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
511             ;;
512         esac
513     fi
515 AC_SUBST(ANDROID_NDK_GDBSERVER)
516 AC_SUBST(ANDROID_APP_ABI)
518 dnl ===================================================================
519 dnl --with-android-sdk
520 dnl ===================================================================
521 ANDROID_SDK_HOME=
522 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux"; then
523     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
525 if test -n "$with_android_sdk"; then
526     ANDROID_SDK_HOME=$with_android_sdk
527     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
529 AC_SUBST(ANDROID_SDK_HOME)
531 dnl ===================================================================
532 dnl The following is a list of supported systems.
533 dnl Sequential to keep the logic very simple
534 dnl These values may be checked and reset later.
535 dnl ===================================================================
536 #defaults unless the os test overrides this:
537 test_randr=yes
538 test_xrender=yes
539 test_cups=yes
540 test_dbus=yes
541 test_fontconfig=yes
542 test_cairo=no
544 # Default values, as such probably valid just for Linux, set
545 # differently below just for Mac OSX,but at least better than
546 # hardcoding these as we used to do. Much of this is duplicated also
547 # in solenv for old build system and for gbuild, ideally we should
548 # perhaps define stuff like this only here in configure.ac?
550 LINKFLAGSSHL="-shared"
551 PICSWITCH="-fpic"
552 DLLPOST=".so"
554 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
556 INSTROOTSUFFIX=
557 SDKDIRNAME=sdk
559 case "$host_os" in
561 solaris*)
562     test_gtk=yes
563     build_gstreamer_1_0=yes
564     build_gstreamer_0_10=yes
565     test_tde=yes
566     test_kde=yes
567     test_freetype=yes
568     _os=SunOS
570     dnl ===========================================================
571     dnl Check whether we're using Solaris 10 - SPARC or Intel.
572     dnl ===========================================================
573     AC_MSG_CHECKING([the Solaris operating system release])
574     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
575     if test "$_os_release" -lt "10"; then
576         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
577     else
578         AC_MSG_RESULT([ok ($_os_release)])
579     fi
581     dnl Check whether we're using a SPARC or i386 processor
582     AC_MSG_CHECKING([the processor type])
583     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
584         AC_MSG_RESULT([ok ($host_cpu)])
585     else
586         AC_MSG_ERROR([only SPARC and i386 processors are supported])
587     fi
588     ;;
590 linux-gnu*|k*bsd*-gnu*)
591     test_gtk=yes
592     build_gstreamer_1_0=yes
593     build_gstreamer_0_10=yes
594     test_tde=yes
595     test_kde=yes
596     test_kde4=yes
597     test_freetype=yes
598     _os=Linux
599     ;;
601 gnu)
602     test_randr=no
603     test_xrender=no
604     _os=GNU
605      ;;
607 cygwin*|interix*|mingw32*)
609     # When building on Windows normally with MSVC under Cygwin,
610     # configure thinks that the host platform (the platform the
611     # built code will run on) is Cygwin, even if it obviously is
612     # Windows, which in Autoconf terminology is called
613     # "mingw32". (Which is misleading as MinGW is the name of the
614     # tool-chain, not an operating system.)
616     # Somewhat confusing, yes. But this configure script doesn't
617     # look at $host etc that much, it mostly uses its own $_os
618     # variable, set here in this case statement.
620     # When cross-compiling to Windows from Unix, the host platform
621     # is "mingw32" (because in that case it is the MinGW
622     # tool-chain that is used).
624     test_cups=no
625     test_dbus=no
626     test_randr=no
627     test_xrender=no
628     test_freetype=no
629     test_fontconfig=no
630     _os=WINNT
632     DLLPOST=".dll"
633     LINKFLAGSNOUNDEFS=
635     # If the host OS matches "mingw32*", that means we are using the
636     # MinGW cross-compiler, because we don't see the point in building
637     # LibreOffice using MinGW on Windows. If you want to build on
638     # Windows, use MSVC. If you want to use MinGW, surely you want to
639     # cross-compile (from Linux or some other Unix).
641     case "$host_os" in
642     mingw32*)
643         WITH_MINGW=yes
644         if test -z "$CC"; then
645             CC="$host_cpu-$host_vendor-$host_os-gcc"
646         fi
647         if test -z "$CXX"; then
648             CXX="$host_cpu-$host_vendor-$host_os-g++"
649         fi
650         ;;
651     esac
652     ;;
654 darwin*) # Mac OS X or iOS
655     test_gtk=yes
656     test_randr=no
657     test_xrender=no
658     test_freetype=no
659     test_fontconfig=no
660     test_dbus=no
661     if test "$host_cpu" = "arm"; then
662         _os=iOS
663         test_gtk=no
664         test_cups=no
665     else
666         _os=Darwin
667         INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
668         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
669     fi
670     enable_systray=no
671     # See comment above the case "$host_os"
672     LINKFLAGSSHL="-dynamiclib -single_module"
674     # -fPIC is default
675     PICSWITCH=""
677     DLLPOST=".dylib"
679     # -undefined error is the default
680     LINKFLAGSNOUNDEFS=""
683 freebsd*)
684     test_gtk=yes
685     build_gstreamer_1_0=yes
686     build_gstreamer_0_10=yes
687     test_tde=yes
688     test_kde=yes
689     test_kde4=yes
690     test_freetype=yes
691     AC_MSG_CHECKING([the FreeBSD operating system release])
692     if test -n "$with_os_version"; then
693         OSVERSION="$with_os_version"
694     else
695         OSVERSION=`/sbin/sysctl -n kern.osreldate`
696     fi
697     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
698     AC_MSG_CHECKING([which thread library to use])
699     if test "$OSVERSION" -lt "500016"; then
700         PTHREAD_CFLAGS="-D_THREAD_SAFE"
701         PTHREAD_LIBS="-pthread"
702     elif test "$OSVERSION" -lt "502102"; then
703         PTHREAD_CFLAGS="-D_THREAD_SAFE"
704         PTHREAD_LIBS="-lc_r"
705     else
706         PTHREAD_CFLAGS=""
707         PTHREAD_LIBS="-pthread"
708     fi
709     AC_MSG_RESULT([$PTHREAD_LIBS])
710     _os=FreeBSD
711     ;;
713 *netbsd*)
714     test_gtk=yes
715     build_gstreamer_1_0=yes
716     build_gstreamer_0_10=yes
717     test_tde=no
718     test_kde=no
719     test_kde4=yes
720     test_freetype=yes
721     PTHREAD_LIBS="-pthread -lpthread"
722     _os=NetBSD
723     ;;
725 aix*)
726     test_randr=no
727     test_freetype=yes
728     PTHREAD_LIBS=-pthread
729     _os=AIX
730     ;;
732 openbsd*)
733     test_gtk=yes
734     test_tde=yes
735     test_kde=yes
736     test_freetype=yes
737     PTHREAD_CFLAGS="-D_THREAD_SAFE"
738     PTHREAD_LIBS="-pthread"
739     _os=OpenBSD
740     ;;
742 dragonfly*)
743     test_gtk=yes
744     build_gstreamer_1_0=yes
745     build_gstreamer_0_10=yes
746     test_tde=yes
747     test_kde=yes
748     test_kde4=yes
749     test_freetype=yes
750     PTHREAD_LIBS="-pthread"
751     _os=DragonFly
752     ;;
754 linux-android*)
755     build_gstreamer_1_0=no
756     build_gstreamer_0_10=no
757     enable_lotuswordpro=no
758     enable_mpl_subset=yes
759     enable_coinmp=yes
760     enable_lpsolve=no
761     enable_report_builder=no
762     with_theme="tango"
763     test_cups=no
764     test_dbus=no
765     test_fontconfig=no
766     test_freetype=no
767     test_gtk=no
768     test_tde=no
769     test_kde=no
770     test_kde4=no
771     test_randr=no
772     test_xrender=no
773     _os=Android
775     if test -z "$with_android_ndk"; then
776         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
777     fi
779     if test -z "$with_android_ndk_toolchain_version"; then
780         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
781     fi
783     # Verify that the NDK and SDK options are proper
784     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
785         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
786     fi
788     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
789     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
790     ;;
793     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
794     ;;
795 esac
797 if echo "$host_os" | grep -q linux-android ; then
798     if test -z "$with_android_sdk"; then
799         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
800     fi
802     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
803         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
804     fi
807 if test "$_os" = "AIX"; then
808     AC_PATH_PROG(GAWK, gawk)
809     if test -z "$GAWK"; then
810         AC_MSG_ERROR([gawk not found in \$PATH])
811     fi
814 AC_SUBST(SDKDIRNAME)
816 AC_SUBST(WITH_MINGW)
817 AC_SUBST(PTHREAD_CFLAGS)
818 AC_SUBST(PTHREAD_LIBS)
820 ###############################################################################
821 # Extensions switches --enable/--disable
822 ###############################################################################
823 # By default these should be enabled unless having extra dependencies.
824 # If there is extra dependency over configure options then the enable should
825 # be automagic based on whether the requiring feature is enabled or not.
826 # All this options change anything only with --enable-extension-integration.
828 # The name of this option and its help string makes it sound as if
829 # extensions are built anyway, just not integrated in the installer,
830 # if you use --disable-extension-integration. Is that really the
831 # case?
833 AC_ARG_ENABLE(extension-integration,
834     AS_HELP_STRING([--disable-extension-integration],
835         [Disable integration of the built extensions in the installer of the
836          product. Use this switch to disable the integration.])
839 AC_ARG_ENABLE(export,
840     AS_HELP_STRING([--disable-export],
841         [Disable (some) code for document export. Useful when building viewer-only apps that lack
842          save/export functionality, to avoid having an excessive amount of code and data used
843          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
846 AC_ARG_ENABLE(avmedia,
847     AS_HELP_STRING([--disable-avmedia],
848         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
851 AC_ARG_ENABLE(database-connectivity,
852     AS_HELP_STRING([--disable-database-connectivity],
853         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
856 # This doesn't mean not building (or "integrating") extensions
857 # (although it probably should; i.e. it should imply
858 # --disable-extension-integration I guess), it means not supporting
859 # any extension mechanism at all
860 AC_ARG_ENABLE(extensions,
861     AS_HELP_STRING([--disable-extensions],
862         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
865 AC_ARG_ENABLE(scripting,
866     AS_HELP_STRING([--disable-scripting],
867         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
870 # This is mainly for Android and iOS, but could potentially be used in some
871 # special case otherwise, too, so factored out as a separate setting
873 AC_ARG_ENABLE(dynamic-loading,
874     AS_HELP_STRING([--disable-dynamic-loading],
875         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
878 AC_ARG_ENABLE(ext-mariadb-connector,
879     AS_HELP_STRING([--enable-ext-mariadb-connector],
880         [Enable the build of the MariaDB/MySQL Connector extension.])
883 AC_ARG_ENABLE(report-builder,
884     AS_HELP_STRING([--disable-report-builder],
885         [Disable the Report Builder.])
888 AC_ARG_ENABLE(ext-wiki-publisher,
889     AS_HELP_STRING([--enable-ext-wiki-publisher],
890         [Enable the Wiki Publisher extension.])
893 AC_ARG_ENABLE(lpsolve,
894     AS_HELP_STRING([--disable-lpsolve],
895         [Disable compilation of the lp solve solver ])
897 AC_ARG_ENABLE(coinmp,
898     AS_HELP_STRING([--disable-coinmp],
899         [Disable compilation of the CoinMP solver ])
902 AC_ARG_ENABLE(pdfimport,
903     AS_HELP_STRING([--disable-pdfimport],
904         [Disable building the PDF import feature.])
907 ###############################################################################
909 dnl ---------- *** ----------
911 AC_ARG_ENABLE([hardlink-deliver],
912     AS_HELP_STRING([--enable-hardlink-deliver],
913         [Put files into deliver folder as hardlinks instead of copying them
914         over. Saves space and speeds up build.])
917 AC_ARG_ENABLE(mergelibs,
918     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
919         [Enables linking of big, merged, library. Experimental feature, tested
920         only for Linux at some stage in history, but possibly does not work even
921         for Linux any more. 'all' will link a lot of libraries into libmerged
922         while 'yes' will do it for just a core set of libraries.])
925 AC_ARG_ENABLE(graphite,
926     AS_HELP_STRING([--enable-graphite],
927         [Enables the compilation of Graphite smart font rendering.])
930 AC_ARG_ENABLE(orcus,
931     AS_HELP_STRING([--enable-orcus],
932         [Enables orcus for extra file import filters for Calc.])
935 AC_ARG_ENABLE(fetch-external,
936     AS_HELP_STRING([--disable-fetch-external],
937         [Disables fetching external tarballs from web sources.])
940 AC_ARG_ENABLE(lockdown,
941     AS_HELP_STRING([--disable-lockdown],
942         [Disables the gconf integration work in LibreOffice.]),
945 AC_ARG_ENABLE(pch,
946     AS_HELP_STRING([--enable-pch],
947         [Enables precompiled header support for C++.])
950 AC_ARG_ENABLE(win-mozab-driver,
951     AS_HELP_STRING([--enable-win-mozab-driver],
952         [LibreOffice includes a driver to connect to Mozilla
953          address books under Windows, to build with this version, use this option.])
956 AC_ARG_ENABLE(epm,
957     AS_HELP_STRING([--enable-epm],
958         [LibreOffice includes self-packaging code, that requires epm, however epm is
959          useless for large scale package building.])
962 AC_ARG_ENABLE(odk,
963     AS_HELP_STRING([--disable-odk],
964         [LibreOffice includes an ODK, office development kit which some packagers may
965          wish to build without.])
968 AC_ARG_ENABLE(mpl-subset,
969     AS_HELP_STRING([--enable-mpl-subset],
970         [Don't compile any pieces which are not MPL or more liberally licensed])
973 AC_ARG_ENABLE(evolution2,
974     AS_HELP_STRING([--enable-evolution2],
975         [Allows the built-in evolution 2 addressbook connectivity build to be
976          enabled.])
979 AC_ARG_ENABLE(directx,
980     AS_HELP_STRING([--disable-directx],
981         [Remove DirectX implementation for the new XCanvas interface.
982          The DirectX support requires more stuff installed on Windows to
983          compile. (DirectX SDK, GDI+ libs)])
986 AC_ARG_ENABLE(activex,
987     AS_HELP_STRING([--disable-activex],
988         [Disable the use of ActiveX for a Windows build.
989         This switch is mandatory when using an Express edition of Visual Studio.])
992 AC_ARG_ENABLE(atl,
993     AS_HELP_STRING([--disable-atl],
994         [Disable the use of ATL for a Windows build.])
995     [
996         This switch is mandatory when using an Express edition of Visual Studio.
997     ],
1000 AC_ARG_ENABLE(avahi,
1001     AS_HELP_STRING([--enable-avahi],
1002         [Determines whether to use Avahi to advertise Impress to remote controls.]),
1005 AC_ARG_ENABLE(werror,
1006     AS_HELP_STRING([--enable-werror],
1007         [Turn warnings to errors. (Has no effect in modules where the treating
1008          of warnings as errors is disabled explicitly.)]),
1011 AC_ARG_ENABLE(assert-always-abort,
1012     AS_HELP_STRING([--enable-assert-always-abort],
1013         [make assert() abort even in release code.]),
1016 AC_ARG_ENABLE(dbgutil,
1017     AS_HELP_STRING([--enable-dbgutil],
1018         [Provide debugging support from --enable-debug and include additional debugging
1019          utilities such as object counting or more expensive checks.
1020          This is the recommended option for developers.
1021          Note that this makes the build ABI incompatible, it is not possible to mix object
1022          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1024 AC_ARG_ENABLE(debug,
1025     AS_HELP_STRING([--enable-debug],
1026         [Include debugging information, disable compiler optimization and inlining plus
1027          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1029 AC_ARG_ENABLE(sal-log,
1030     AS_HELP_STRING([--enable-sal-log],
1031         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1033 AC_ARG_ENABLE(selective-debuginfo,
1034     AS_HELP_STRING([--enable-selective-debuginfo],
1035         [If --enable-debug or --enable-dbgutil is used, build debugging information
1036          (-g compiler flag) only for the specified gbuild build targets
1037          (where all means everything, - prepended means not to enable, / appended means
1038          everything in the directory; there is no ordering, more specific overrides
1039          more general, and disabling takes precedence).
1040          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1042 AC_ARG_ENABLE(symbols,
1043     AS_HELP_STRING([--enable-symbols],
1044         [Include debugging symbols in output while preserve optimization.
1045          This enables -g compiler flag for GCC or equivalent,
1046          without changing anything else compared to productive code.]))
1048 AC_ARG_ENABLE(runtime-optimizations,
1049     AS_HELP_STRING([--disable-runtime-optimizations],
1050         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1051          JVM JIT) that are known to interact badly with certain dynamic analysis
1052          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1053          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1054          are typcially disabled dynamically via RUNNING_ON_VALGRIND.)]))
1056 AC_ARG_ENABLE(compiler-plugins,
1057     AS_HELP_STRING([--enable-compiler-plugins],
1058         [Enable compiler plugins that will perform additional checks during
1059          building. Enabled automatically by --enable-dbgutil.]))
1061 AC_ARG_ENABLE(ooenv,
1062     AS_HELP_STRING([--disable-ooenv],
1063         [Disable ooenv for the instdir installation.]))
1065 AC_ARG_ENABLE(lto,
1066     AS_HELP_STRING([--enable-lto],
1067         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1068          longer but libraries and executables are optimized for speed. (For GCC, best to use GCC 4.6
1069          or later and 'gold' linker. Works fine (and is turned on automatically in an optimising
1070          build) for MSVC, otherwise experimental work in progress that shouldn't be used unless you
1071          are working on it.)]))
1073 AC_ARG_ENABLE(crashdump,
1074     AS_HELP_STRING([--enable-crashdump],
1075         [Enable the crashdump feature.]))
1077 AC_ARG_ENABLE(python,
1078     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1079         [Enables or disables Python support at run-time and build-time.
1080          Also specifies what Python to use. 'auto' is the default.
1081          'fully-internal' even forces the internal version for uses of Python
1082          during the build.]))
1084 AC_ARG_ENABLE(gtk,
1085     AS_HELP_STRING([--disable-gtk],
1086         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1087 ,enable_gtk=yes)
1089 AC_ARG_ENABLE(gtk3,
1090     AS_HELP_STRING([--enable-gtk3],
1091         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1092          This is experimental and may not work.]),
1093 ,enable_gtk3=no)
1095 AC_ARG_ENABLE(systray,
1096     AS_HELP_STRING([--disable-systray],
1097         [Determines whether to build the systray quickstarter.]),
1098 ,enable_systray=yes)
1100 AC_ARG_ENABLE(split-app-modules,
1101     AS_HELP_STRING([--enable-split-app-modules],
1102         [Split file lists for app modules, e.g. base, calc.
1103          Has effect only with make distro-pack-install]),
1106 AC_ARG_ENABLE(split-opt-features,
1107     AS_HELP_STRING([--enable-split-opt-features],
1108         [Split file lists for some optional features, .e.g. pyuno, testtool.
1109          Has effect only with make distro-pack-install]),
1112 AC_ARG_ENABLE(cairo-canvas,
1113 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
1114                           platforms where Cairo is available.
1117 AC_ARG_ENABLE(dbus,
1118     AS_HELP_STRING([--disable-dbus],
1119         [Determines whether to enable features that depend on dbus.
1120          e.g. Presentation mode screensaver control, bluetooth presentation control]),
1121 ,enable_dbus=yes)
1123 AC_ARG_ENABLE(packagekit,
1124     AS_HELP_STRING([--enable-packagekit],
1125         [Determines whether to enable features using packagekit.
1126          Right now that is auto font install]),
1129 AC_ARG_ENABLE(sdremote,
1130     AS_HELP_STRING([--disable-sdremote],
1131         [Determines whether to enable Impress remote control (i.e. the server component).]),
1132 ,enable_sdremote=yes)
1134 AC_ARG_ENABLE(sdremote-bluetooth,
1135     AS_HELP_STRING([--disable-sdremote-bluetooth],
1136         [Determines whether to build sdremote with bluetooth support.
1137          Requires dbus on Linux.]))
1139 AC_ARG_ENABLE(gconf,
1140     AS_HELP_STRING([--disable-gconf],
1141         [Determines whether to use the GConf support.]),
1142 ,enable_gconf=yes)
1144 AC_ARG_ENABLE(gnome-vfs,
1145     AS_HELP_STRING([--enable-gnome-vfs],
1146         [Determines whether to use the Gnome Virtual Filing System on platforms
1147          where that VFS is available.]),
1148 ,enable_gnome_vfs=no)
1150 AC_ARG_ENABLE(gio,
1151     AS_HELP_STRING([--disable-gio],
1152         [Determines whether to use the GIO support.]),
1153 ,enable_gio=yes)
1155 AC_ARG_ENABLE(telepathy,
1156     AS_HELP_STRING([--enable-telepathy],
1157         [Determines whether to enable Telepathy for collaboration.]),
1158 ,enable_telepathy=no)
1160 AC_ARG_ENABLE(tde,
1161     AS_HELP_STRING([--enable-tde],
1162         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1163          TDE are available.]),
1166 AC_ARG_ENABLE(tdeab,
1167     AS_HELP_STRING([--disable-tdeab],
1168         [Disable the TDE address book support.]),
1170     if test "$enable_tde" = "yes"; then
1171         enable_tdeab=yes
1172     fi
1175 AC_ARG_ENABLE(kde,
1176     AS_HELP_STRING([--enable-kde],
1177         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
1178          KDE3 are available.]),
1181 AC_ARG_ENABLE(kdeab,
1182     AS_HELP_STRING([--disable-kdeab],
1183         [Disable the KDE3 address book support.]),
1185     if test "$enable_kde" = "yes"; then
1186         enable_kdeab=yes
1187     fi
1190 AC_ARG_ENABLE(kde4,
1191     AS_HELP_STRING([--enable-kde4],
1192         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1193          KDE4 are available. May be used with --enable-kde if you want to support
1194          both KDE3 and KDE4.]),
1197 AC_ARG_ENABLE(randr,
1198     AS_HELP_STRING([--disable-randr],
1199         [Disable RandR support in the vcl project.]),
1200 ,enable_randr=yes)
1202 AC_ARG_ENABLE(randr-link,
1203     AS_HELP_STRING([--disable-randr-link],
1204         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1205 ,enable_randr_link=yes)
1207 AC_ARG_ENABLE(gstreamer-1-0,
1208     AS_HELP_STRING([--disable-gstreamer-1-0],
1209         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1210 ,enable_gstreamer_1_0=yes)
1212 AC_ARG_ENABLE(gstreamer-0-10,
1213     AS_HELP_STRING([--enable-gstreamer-0-10],
1214         [Enable building with the gstreamer 0.10 avmedia backend.]),
1215 ,enable_gstreamer_0_10=no)
1217 AC_ARG_ENABLE(vlc,
1218     AS_HELP_STRING([--enable-vlc],
1219         [Enable building with the (experimental) VLC avmedia backend.]),
1220 ,enable_vlc=no)
1222 AC_ARG_ENABLE(neon,
1223     AS_HELP_STRING([--disable-neon],
1224         [Disable neon and the compilation of webdav binding.]),
1227 AC_ARG_ENABLE([eot],
1228     [AS_HELP_STRING([--enable-eot],
1229         [Enable support for Embedded OpenType fonts.])],
1230 , [enable_eot=no])
1232 AC_ARG_ENABLE(cve-tests,
1233     AS_HELP_STRING([--disable-cve-tests],
1234         [Prevent CVE tests to be executed]),
1237 AC_ARG_ENABLE(chart-tests,
1238     AS_HELP_STRING([--enable-chart-tests],
1239         [Executes chart XShape tests. In a perfect world these tests would be
1240          stable and everyone could run them, in reality it is best to run them
1241          only on a few machines that are known to work and maintained by people
1242          who can judge if a test failure is a regression or not.]),
1245 AC_ARG_ENABLE(build-unowinreg,
1246     AS_HELP_STRING([--enable-build-unowinreg],
1247         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1248          compiler is needed on Linux.])
1249     [
1250                           Usage:     --enable-build-unowinreg
1251     ],
1254 AC_ARG_ENABLE(verbose,
1255     AS_HELP_STRING([--enable-verbose],
1256         [Increase build verbosity.])[
1257   --disable-verbose       Decrease build verbosity.],
1260 AC_ARG_ENABLE(dependency-tracking,
1261     AS_HELP_STRING([--enable-dependency-tracking],
1262         [Do not reject slow dependency extractors.])[
1263   --disable-dependency-tracking
1264                           Disables generation of dependency information.
1265                           Speed up one-time builds.],
1268 AC_ARG_ENABLE(icecream,
1269     AS_HELP_STRING([--enable-icecream],
1270         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1271          It defaults to /opt/icecream for the location of the icecream gcc/g++
1272          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1275 AC_ARG_ENABLE(cups,
1276     AS_HELP_STRING([--disable-cups],
1277         [Do not build cups support.])
1280 AC_ARG_ENABLE(ccache,
1281     AS_HELP_STRING([--disable-ccache],
1282         [Do not try to use ccache automatically.
1283          By default, we will try to detect if ccache is available; in that case if
1284          CC/CXX are not yet set, and --enable-icecream is not given, we
1285          attempt to use ccache. --disable-ccache disables ccache completely.
1289 AC_ARG_ENABLE(64-bit,
1290     AS_HELP_STRING([--enable-64-bit],
1291         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1292          At the moment meaningful only for iOS and Windows. On Windows this option is
1293          experimental and possibly quite broken, and you should use it only if you are
1294          hacking on 64-bitness support.]), ,)
1296 AC_ARG_ENABLE(extra-gallery,
1297     AS_HELP_STRING([--enable-extra-gallery],
1298         [Add extra gallery content.]),
1301 AC_ARG_ENABLE(extra-template,
1302     AS_HELP_STRING([--enable-extra-template],
1303         [Add extra template content.]),
1306 AC_ARG_ENABLE(extra-sample,
1307     AS_HELP_STRING([--enable-extra-sample],
1308         [Add extra sample content.]),
1311 AC_ARG_ENABLE(extra-font,
1312     AS_HELP_STRING([--enable-extra-font],
1313         [Add extra font content.]),
1316 AC_ARG_ENABLE(online-update,
1317     AS_HELP_STRING([--enable-online-update],
1318         [Enable the online update service that will check for new versions of
1319          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.]),
1322 AC_ARG_ENABLE(release-build,
1323     AS_HELP_STRING([--enable-release-build],
1324         [Enable release build.
1325          See http://wiki.documentfoundation.org/DevBuild]),
1328 AC_ARG_ENABLE(windows-build-signing,
1329     AS_HELP_STRING([--enable-windows-build-signing],
1330         [Enable signing of windows binaries (*.exe, *.dll)]),
1333 AC_ARG_ENABLE(silent-msi,
1334     AS_HELP_STRING([--enable-silent-msi],
1335         [Enable MSI with LIMITUI=1 (silent install).]),
1338 AC_ARG_ENABLE(macosx-code-signing,
1339     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1340         [Sign executables, dylibs, frameworks and the app bundle. If you
1341          don't provide an identity the first suitable certificate
1342          in your keychain is used.]),
1345 AC_ARG_ENABLE(macosx-package-signing,
1346     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1347         [Create a .pkg suitable for uploading to the Mac App Store and sign
1348          it. If you don't provide an identity the first suitable certificate
1349          in your keychain is used.]),
1352 AC_ARG_ENABLE(macosx-sandbox,
1353     AS_HELP_STRING([--enable-macosx-sandbox],
1354         [Make the app bundle run in a sandbox. Requires code signing.
1355          Is required by apps distributed in the Mac App Store, and implies
1356          adherence to App Store rules.]),
1359 AC_ARG_WITH(macosx-bundle-identifier,
1360     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1361         [Define the OS X bundle identifier. Default is the somewhat weird
1362          org.libreoffice.script ("script", huh?).]),
1363 ,with_macosx_bundle_identifier=org.libreoffice.script)
1365 AC_ARG_WITH(macosx-app-name,
1366     AS_HELP_STRING([--with-macosx-app-name='My Own Office Suite'],
1367         [Define the OS X app name. Default is AC_PACKAGE_NAME.]),
1368 ,with_macosx_app_name=$PRODUCTNAME)
1370 AC_ARG_ENABLE(ios-simulator,
1371     AS_HELP_STRING([--enable-ios-simulator],
1372         [Build for the iOS Simulator, not iOS device.]),
1375 AC_ARG_ENABLE(readonly-installset,
1376     AS_HELP_STRING([--enable-readonly-installset],
1377         [Prevents any attempts by LibreOffice to write into its installation. That means
1378          at least that no "system-wide" extensions can be added. Experimental work in
1379          progress.]),
1382 AC_ARG_ENABLE(postgresql-sdbc,
1383     AS_HELP_STRING([--disable-postgresql-sdbc],
1384         [Disable the build of the PostgreSQL-SDBC driver.])
1387 AC_ARG_ENABLE(lotuswordpro,
1388     AS_HELP_STRING([--disable-lotuswordpro],
1389         [Disable the build of the Lotus Word Pro filter.]),
1390 ,enable_lotuswordpro=yes)
1392 AC_ARG_ENABLE(firebird-sdbc,
1393     AS_HELP_STRING([--disable-firebird-sdbc],
1394         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1395 ,enable_firebird_sdbc=yes)
1397 AC_ARG_ENABLE(winegcc,
1398     AS_HELP_STRING([--enable-winegcc],
1399         [Enable use of winegcc during the build, in order to create msi* tools
1400          needed for MinGW cross-compilation.]),
1403 AC_ARG_ENABLE(liblangtag,
1404     AS_HELP_STRING([--disable-liblangtag],
1405         [Disable use of liblangtag, and instead use an own simple
1406          implementation.]),
1409 AC_ARG_ENABLE(bogus-pkg-config,
1410     AS_HELP_STRING([--enable-bogus-pkg-config],
1411         [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.]),
1414 AC_ARG_ENABLE(openssl,
1415     AS_HELP_STRING([--disable-openssl],
1416         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1417          components will either use GNUTLS or NSS. Work in progress,
1418          use only if you are hacking on it.]),
1419 ,enable_openssl=yes)
1421 AC_ARG_ENABLE(library-bin-tar,
1422     AS_HELP_STRING([--enable-library-bin-tar],
1423         [Enable the building and reused of tarball of binary build for some 'external' libraries
1424         Some libraries can save their build result in a tarball
1425         stored in TARFILE_LOCATION. that binary tarball is
1426         uniquely identified by the source tarbal,
1427         the content of the config_host.mk file and the content
1428         of the top-level directory in core for that library
1429         If this option is enabled, then if such a tarfile exist, it will be untarred
1430         instead of the source tarfile, and the build step will be skipped for that
1431         library.
1432         If a proper tarfile does not exist, then the normal source-based
1433         build is done for that library and a proper binary tarfile is created
1434         for the next time.]),
1437 AC_ARG_ENABLE(gltf,
1438     AS_HELP_STRING([--disable-gltf],
1439         [Determines whether to build libraries related to glTF 3D model rendering.]))
1441 AC_ARG_ENABLE(collada,
1442     AS_HELP_STRING([--disable-collada],
1443         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1445 dnl ===================================================================
1446 dnl Optional Packages (--with/without-)
1447 dnl ===================================================================
1449 AC_ARG_WITH(gnu-patch,
1450     AS_HELP_STRING([--with-gnu-patch],
1451         [Specify location of GNU patch on Solaris or FreeBSD.]),
1454 AC_ARG_WITH(build-platform-configure-options,
1455     AS_HELP_STRING([--with-build-platform-configure-options],
1456         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1459 AC_ARG_WITH(gnu-cp,
1460     AS_HELP_STRING([--with-gnu-cp],
1461         [Specify location of GNU cp on Solaris or FreeBSD.]),
1464 AC_ARG_WITH(external-tar,
1465     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1466         [Specify an absolute path of where to find (and store) tarfiles.]),
1467     TARFILE_LOCATION=$withval ,
1470 AC_ARG_WITH(referenced-git,
1471     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1472         [Specify another checkout directory to reference. This makes use of
1473                  git submodule update --reference, and saves a lot of diskspace
1474                  when having multiple trees side-by-side.]),
1475     GIT_REFERENCE_SRC=$withval ,
1478 AC_ARG_WITH(linked-git,
1479     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1480         [Specify a directory where the repositories of submodules are located.
1481          This uses a method similar to git-new-workdir to get submodules.]),
1482     GIT_LINK_SRC=$withval ,
1485 AC_ARG_WITH(galleries,
1486     AS_HELP_STRING([--with-galleries],
1487         [Specify how galleries should be built. It is possible either to
1488          build these internally from source ("build"),
1489          or to disable them ("no")]),
1492 AC_ARG_WITH(theme,
1493     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1494         [Choose which themes to include. By default those themes with an '*' are included.
1495          Possible choices: *breeze, crystal, *galaxy, *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1498 AC_ARG_WITH(helppack-integration,
1500   --without-helppack-integration      It will not integrate the helppacks to the installer
1501                           of the product.
1502                           Please use this switch to use the online help or separate help packages.],
1505 AC_ARG_WITH(fonts,
1506     AS_HELP_STRING([--without-fonts],
1507         [LibreOffice includes some third-party fonts to provide a reliable basis for
1508          help content, templates, samples, etc. When these fonts are already
1509          known to be available on the system then you should use this option.]),
1512 AC_ARG_WITH(epm,
1513     AS_HELP_STRING([--with-epm],
1514         [Decides which epm to use. Default is to use the one from the system if
1515          one is built. When either this is not there or you say =internal epm
1516          will be built.]),
1519 AC_ARG_WITH(package-format,
1520     AS_HELP_STRING([--with-package-format],
1521         [Specify package format(s) for LibreOffice installation sets. The
1522          implicit --without-package-format leads to no installation sets being
1523          generated. Possible values: aix, archive, bsd, deb, dmg,
1524          installed, msi, pkg, and rpm.
1525          Example: --with-package-format='deb rpm']),
1528 AC_ARG_WITH(tls,
1529     AS_HELP_STRING([--with-tls],
1530         [Decides which TLS/SSL and cryptographic implementations to use for
1531          LibreOffice's code. Notice that this doesn't apply for depending
1532          libraries like "neon", for example. Default is to use OpenSSL
1533          although NSS is also possible. Notice that selecting NSS restricts
1534          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1535          restrict by now the usage of NSS in LO's code. Possible values:
1536          openssl, nss. Example: --with-tls="nss"]),
1539 AC_ARG_WITH(system-libs,
1540     AS_HELP_STRING([--with-system-libs],
1541         [Use libraries already on system -- enables all --with-system-* flags.]),
1544 AC_ARG_WITH(system-headers,
1545     AS_HELP_STRING([--with-system-headers],
1546         [Use headers already on system -- enables all --with-system-* flags for
1547          external packages whose headers are the only entities used i.e.
1548          boost/vigra/odbc/sane-header(s).]),,
1549     [with_system_headers="$with_system_libs"])
1551 AC_ARG_WITH(system-jars,
1552     AS_HELP_STRING([--without-system-jars],
1553         [When building with --with-system-libs, also the needed jars are expected
1554          on the system. Use this to disable that]),,
1555     [with_system_jars="$with_system_libs"])
1557 AC_ARG_WITH(system-cairo,
1558     AS_HELP_STRING([--with-system-cairo],
1559         [Use cairo libraries already on system.  Happens automatically for
1560          (implicit) --enable-gtk and for --enable-gtk3.]))
1562 AC_ARG_WITH(myspell-dicts,
1563     AS_HELP_STRING([--with-myspell-dicts],
1564         [Adds myspell dictionaries to the LibreOffice installation set]),
1567 AC_ARG_WITH(system-dicts,
1568     AS_HELP_STRING([--without-system-dicts],
1569         [Do not use dictionaries from system paths.]),
1572 AC_ARG_WITH(external-dict-dir,
1573     AS_HELP_STRING([--with-external-dict-dir],
1574         [Specify external dictionary dir.]),
1577 AC_ARG_WITH(external-hyph-dir,
1578     AS_HELP_STRING([--with-external-hyph-dir],
1579         [Specify external hyphenation pattern dir.]),
1582 AC_ARG_WITH(external-thes-dir,
1583     AS_HELP_STRING([--with-external-thes-dir],
1584         [Specify external thesaurus dir.]),
1587 AC_ARG_WITH(system-zlib,
1588     AS_HELP_STRING([--with-system-zlib],
1589         [Use zlib already on system.]),,
1590     [with_system_zlib=auto])
1592 AC_ARG_WITH(system-jpeg,
1593     AS_HELP_STRING([--with-system-jpeg],
1594         [Use jpeg already on system.]),,
1595     [with_system_jpeg="$with_system_libs"])
1597 AC_ARG_WITH(system-libgltf,
1598     AS_HELP_STRING([--with-system-libgltf],
1599         [Use libgltf already on system.]),,
1600     [with_system_libgltf="$with_system_libs"])
1602 AC_ARG_WITH(system-clucene,
1603     AS_HELP_STRING([--with-system-clucene],
1604         [Use clucene already on system.]),,
1605     [with_system_clucene="$with_system_libs"])
1607 AC_ARG_WITH(system-expat,
1608     AS_HELP_STRING([--with-system-expat],
1609         [Use expat already on system.]),,
1610     [with_system_expat="$with_system_libs"])
1612 AC_ARG_WITH(system-libxml,
1613     AS_HELP_STRING([--with-system-libxml],
1614         [Use libxml/libxslt already on system.]),,
1615     [with_system_libxml=auto])
1617 AC_ARG_WITH(system-icu,
1618     AS_HELP_STRING([--with-system-icu],
1619         [Use icu already on system.]),,
1620     [with_system_icu="$with_system_libs"])
1622 AC_ARG_WITH(system-ucpp,
1623     AS_HELP_STRING([--with-system-ucpp],
1624         [Use ucpp already on system.]),,
1625     [])
1627 AC_ARG_WITH(system-opencollada,
1628     AS_HELP_STRING([--with-system-opencollada],
1629         [Use openCOLLADA already on system.]),,
1630     [with_system_opencollada=no])
1632 AC_ARG_WITH(system-openldap,
1633     AS_HELP_STRING([--with-system-openldap],
1634         [Use the OpenLDAP LDAP SDK already on system.]),,
1635     [with_system_openldap="$with_system_libs"])
1637 AC_ARG_WITH(system-poppler,
1638     AS_HELP_STRING([--with-system-poppler],
1639         [Use system poppler (only needed for PDF import).]),,
1640     [with_system_poppler="$with_system_libs"])
1642 AC_ARG_WITH(system-apache-commons,
1643     AS_HELP_STRING([--with-system-apache-commons],
1644         [Use Apache commons libraries already on system.]),,
1645     [with_system_apache_commons="$with_system_jars"])
1647 AC_ARG_WITH(system-mariadb,
1648     AS_HELP_STRING([--with-system-mariadb],
1649         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1650          extension.]),,
1651     [with_system_mariadb="$with_system_libs"])
1653 AC_ARG_ENABLE(bundle-mariadb,
1654     AS_HELP_STRING([--enable-bundle-mariadb],
1655         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1658 AC_ARG_WITH(system-mysql-cppconn,
1659     AS_HELP_STRING([--with-system-mysql-cppconn],
1660         [Use MySQL C++ Connector libraries already on system.]),,
1661     [with_system_mysql_cppconn="$with_system_libs"])
1663 AC_ARG_WITH(system-postgresql,
1664     AS_HELP_STRING([--with-system-postgresql],
1665         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1666          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1667     [with_system_postgresql="$with_system_libs"])
1669 AC_ARG_WITH(libpq-path,
1670     AS_HELP_STRING([--with-libpq-path],
1671         [Use this PostgreSQL C interface (libpq) installation for building
1672          the PostgreSQL-SDBC extension.])
1673     [
1674                           Usage:     --with-libpq-path=<absolute path to
1675                                                   your libpq installation>
1676     ],
1679 AC_ARG_WITH(system-firebird,
1680     AS_HELP_STRING([--with-system-firebird],
1681         [Use Firebird libraries already on system, for building the Firebird-SDBC
1682          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1683     [with_system_firebird="$with_system_libs"])
1685 AC_ARG_WITH(system-hsqldb,
1686     AS_HELP_STRING([--with-system-hsqldb],
1687         [Use hsqldb already on system.]))
1689 AC_ARG_WITH(hsqldb-jar,
1690     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1691         [Specify path to jarfile manually.]),
1692     HSQLDB_JAR=$withval)
1694 AC_ARG_ENABLE(scripting-beanshell,
1695     AS_HELP_STRING([--disable-scripting-beanshell],
1696         [Disable support for scripts in BeanShell.]),
1700 AC_ARG_WITH(system-beanshell,
1701     AS_HELP_STRING([--with-system-beanshell],
1702         [Use beanshell already on system.]),,
1703     [with_system_beanshell="$with_system_jars"])
1705 AC_ARG_WITH(beanshell-jar,
1706     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1707         [Specify path to jarfile manually.]),
1708     BSH_JAR=$withval)
1710 AC_ARG_ENABLE(scripting-javascript,
1711     AS_HELP_STRING([--disable-scripting-javascript],
1712         [Disable support for scripts in JavaScript.]),
1716 AC_ARG_WITH(system-rhino,
1717     AS_HELP_STRING([--with-system-rhino],
1718         [Use rhino already on system.]),,)
1719 #    [with_system_rhino="$with_system_jars"])
1720 # Above is not used as we have different debug interface
1721 # patched into internal rhino. This code needs to be fixed
1722 # before we can enable it by default.
1724 AC_ARG_WITH(rhino-jar,
1725     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1726         [Specify path to jarfile manually.]),
1727     RHINO_JAR=$withval)
1729 AC_ARG_WITH(commons-codec-jar,
1730     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1731         [Specify path to jarfile manually.]),
1732     COMMONS_CODEC_JAR=$withval)
1734 AC_ARG_WITH(commons-lang-jar,
1735     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1736         [Specify path to jarfile manually.]),
1737     COMMONS_LANG_JAR=$withval)
1739 AC_ARG_WITH(commons-httpclient-jar,
1740     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1741         [Specify path to jarfile manually.]),
1742     COMMONS_HTTPCLIENT_JAR=$withval)
1744 AC_ARG_WITH(commons-logging-jar,
1745     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1746         [Specify path to jarfile manually.]),
1747     COMMONS_LOGGING_JAR=$withval)
1749 AC_ARG_WITH(system-jfreereport,
1750     AS_HELP_STRING([--with-system-jfreereport],
1751         [Use JFreeReport already on system.]),,
1752     [with_system_jfreereport="$with_system_jars"])
1754 AC_ARG_WITH(sac-jar,
1755     AS_HELP_STRING([--with-sac-jar=JARFILE],
1756         [Specify path to jarfile manually.]),
1757     SAC_JAR=$withval)
1759 AC_ARG_WITH(libxml-jar,
1760     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1761         [Specify path to jarfile manually.]),
1762     LIBXML_JAR=$withval)
1764 AC_ARG_WITH(flute-jar,
1765     AS_HELP_STRING([--with-flute-jar=JARFILE],
1766         [Specify path to jarfile manually.]),
1767     FLUTE_JAR=$withval)
1769 AC_ARG_WITH(jfreereport-jar,
1770     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1771         [Specify path to jarfile manually.]),
1772     JFREEREPORT_JAR=$withval)
1774 AC_ARG_WITH(liblayout-jar,
1775     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1776         [Specify path to jarfile manually.]),
1777     LIBLAYOUT_JAR=$withval)
1779 AC_ARG_WITH(libloader-jar,
1780     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1781         [Specify path to jarfile manually.]),
1782     LIBLOADER_JAR=$withval)
1784 AC_ARG_WITH(libloader-jar,
1785     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1786         [Specify path to jarfile manually.]),
1787     LIBLOADER_JAR=$withval)
1789 AC_ARG_WITH(libformula-jar,
1790     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1791         [Specify path to jarfile manually.]),
1792     LIBFORMULA_JAR=$withval)
1794 AC_ARG_WITH(librepository-jar,
1795     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1796         [Specify path to jarfile manually.]),
1797     LIBREPOSITORY_JAR=$withval)
1799 AC_ARG_WITH(libfonts-jar,
1800     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1801         [Specify path to jarfile manually.]),
1802     LIBFONTS_JAR=$withval)
1804 AC_ARG_WITH(libserializer-jar,
1805     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1806         [Specify path to jarfile manually.]),
1807     LIBSERIALIZER_JAR=$withval)
1809 AC_ARG_WITH(libbase-jar,
1810     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1811         [Specify path to jarfile manually.]),
1812     LIBBASE_JAR=$withval)
1814 AC_ARG_WITH(system-odbc,
1815     AS_HELP_STRING([--with-system-odbc],
1816         [Use the odbc headers already on system.]),,
1817     [with_system_odbc="auto"])
1819 AC_ARG_WITH(system-sane,
1820     AS_HELP_STRING([--with-system-sane],
1821         [Use sane.h already on system.]),,
1822     [with_system_sane="$with_system_headers"])
1824 AC_ARG_WITH(system-bluez,
1825     AS_HELP_STRING([--with-system-bluez],
1826         [Use bluetooth.h already on system.]),,
1827     [with_system_bluez="$with_system_headers"])
1829 AC_ARG_WITH(system-mesa-headers,
1830     AS_HELP_STRING([--with-system-mesa-headers],
1831         [Use Mesa headers already on system.]),,
1832     [with_system_mesa_headers="$with_system_headers"])
1834 AC_ARG_WITH(system-curl,
1835     AS_HELP_STRING([--with-system-curl],
1836         [Use curl already on system.]),,
1837     [with_system_curl=auto])
1839 AC_ARG_WITH(system-boost,
1840     AS_HELP_STRING([--with-system-boost],
1841         [Use boost already on system.]),,
1842     [with_system_boost="$with_system_headers"])
1844 AC_ARG_WITH(system-glm,
1845     AS_HELP_STRING([--with-system-glm],
1846         [Use glm already on system.]),,
1847     [with_system_glm="$with_system_headers"])
1849 AC_ARG_WITH(system-vigra,
1850     AS_HELP_STRING([--with-system-vigra],
1851         [Use vigra already on system.]),,
1852     [with_system_vigra="$with_system_headers"])
1854 AC_ARG_WITH(system-hunspell,
1855     AS_HELP_STRING([--with-system-hunspell],
1856         [Use libhunspell already on system.]),,
1857     [with_system_hunspell="$with_system_libs"])
1859 AC_ARG_WITH(system-mythes,
1860     AS_HELP_STRING([--with-system-mythes],
1861         [Use mythes already on system.]),,
1862     [with_system_mythes="$with_system_libs"])
1864 AC_ARG_WITH(system-altlinuxhyph,
1865     AS_HELP_STRING([--with-system-altlinuxhyph],
1866         [Use ALTLinuxhyph already on system.]),,
1867     [with_system_altlinuxhyph="$with_system_libs"])
1869 AC_ARG_WITH(system-lpsolve,
1870     AS_HELP_STRING([--with-system-lpsolve],
1871         [Use lpsolve already on system.]),,
1872     [with_system_lpsolve="$with_system_libs"])
1874 AC_ARG_WITH(system-coinmp,
1875     AS_HELP_STRING([--with-system-coinmp],
1876         [Use CoinMP already on system.]),,
1877     [with_system_coinmp="$with_system_libs"])
1879 AC_ARG_WITH(system-liblangtag,
1880     AS_HELP_STRING([--with-system-liblangtag],
1881         [Use liblangtag library already on system.]),,
1882     [with_system_liblangtag="$with_system_libs"])
1884 AC_ARG_WITH(system-npapi-headers,
1885     AS_HELP_STRING([--with-system-npapi-headers],
1886         [Use NPAPI headers provided by system instead of bundled ones. Used in
1887          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1888     [with_system_npapi_headers="$with_system_headers"]
1891 AC_ARG_WITH(jpeg-turbo,
1892     AS_HELP_STRING([--with-jpeg-turbo],
1893         [Use internal libjpeg-turbo library.]),,
1894     [with_jpeg_turbo=auto])
1896 AC_ARG_WITH(webdav,
1897     AS_HELP_STRING([--with-webdav],
1898         [Specify which library to use for webdav implementation.
1899          Possible values: "neon", "serf", "no". The default value is "neon".
1900          Example: --with-webdav="serf"]),
1901     WITH_WEBDAV=$withval,
1902     WITH_WEBDAV="neon")
1904 AC_ARG_WITH(linker-hash-style,
1905     AS_HELP_STRING([--with-linker-hash-style],
1906         [Use linker with --hash-style=<style> when linking shared objects.
1907          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1908          if supported on the build system, and "sysv" otherwise.]))
1910 AC_ARG_WITH(jdk-home,
1911     AS_HELP_STRING([--with-jdk-home],
1912         [If you have installed JDK 1.3 or later on your system please supply the
1913          path here. Note that this is not the location of the java command but the
1914          location of the entire distribution.])
1915     [
1916                           Usage:     --with-jdk-home=<absolute path to JDK home>
1917     ],
1920 AC_ARG_WITH(help,
1921     AS_HELP_STRING([--with-help],
1922         [Enable the build of help. There is a special parameter "common" that
1923          can be used to bundle only the common part, .e.g help-specific icons.
1924          This is useful when you build the helpcontent separately.])
1925     [
1926                           Usage:     --with-help    build the entire local help
1927                                  --without-help     no local help (default)
1928                                  --with-help=common bundle common files for the local
1929                                                     help but do not build the whole help
1930     ],
1933 AC_ARG_WITH(java,
1934     AS_HELP_STRING([--with-java],
1935         [Specify the name of the Java interpreter command. Typically "java"
1936          which is the default.
1938          To build without support for Java components, applets, accessibility
1939          or the XML filters written in Java, use --without-java or --with-java=no.])
1940     [
1941                           Usage:     --with-java==<java command>
1942                                      --without-java
1943     ],
1944     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1945     [ with_java=java ]
1948 AC_ARG_WITH(jvm-path,
1949     AS_HELP_STRING([--with-jvm-path],
1950         [Use a specific JVM search path at runtime.])
1951     [
1952                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1954                           e. g.: --with-jvm-path=/usr/lib/
1955                                  to find JRE/JDK in /usr/lib/jvm/
1956     ],
1959 AC_ARG_WITH(ant-home,
1960     AS_HELP_STRING([--with-ant-home],
1961         [If you have installed Jakarta Ant on your system, please supply the path here.
1962          Note that this is not the location of the Ant binary but the location
1963          of the entire distribution.])
1964     [
1965                           Usage:     --with-ant-home=<absolute path to Ant home>
1966     ],
1969 AC_ARG_WITH(export-validation,
1970     AS_HELP_STRING([--with-export-validation],
1971         [If you want the exported files to be validated. Right now limited to OOXML files in calc export tests.
1972          Note: You need an executable script officeotron that takes the path to the file.])
1973     [
1974                             Usage: --with-export-validation
1975     ],
1978 AC_ARG_WITH(junit,
1979     AS_HELP_STRING([--with-junit],
1980         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1981          --without-junit disables those tests. Not relevant in the --without-java case.])
1982     [
1983                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1984     ],
1985 ,with_junit=yes)
1987 AC_ARG_WITH(hamcrest,
1988     AS_HELP_STRING([--with-hamcrest],
1989         [Specifies the hamcrest jar file to use for JUnit-based tests.
1990          --without-junit disables those tests. Not relevant in the --without-java case.])
1991     [
1992                           Usage:     --with-hamcrest=<absolute path to hamcrest jar>
1993     ],
1994 ,with_hamcrest=yes)
1996 AC_ARG_WITH(perl-home,
1997     AS_HELP_STRING([--with-perl-home],
1998         [If you have installed Perl 5 Distribution, on your system, please
1999          supply the path here. Note that this is not the location of the Perl
2000          binary but the location of the entire distribution.])
2001     [
2002                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
2003     ],
2006 AC_ARG_WITH(
2007     [doxygen],
2008     AS_HELP_STRING(
2009         [--with-doxygen],
2010         [Specifies the doxygen executable to use when generating ODK C/C++
2011          documentation. --without-doxygen disables generation of ODK C/C++
2012          documentation. Not relevant in the --disable-odk case.])
2013     [
2014                           Usage:     --with-doxygen=<absolute path to doxygen executable>
2015     ],,
2016     [with_doxygen=yes])
2018 AC_ARG_WITH(visual-studio,
2019     AS_HELP_STRING([--with-visual-studio=2013],
2020         [Specify which Visual Studio version to use in case several are
2021          installed. If not specified, the order of preference is 2013 (including
2022          Express editions). Not very useful at the moment, as currently only
2023          2013 is supported, anyway.])
2024     [
2025                           Usage:     --with-visual-studio=2013
2026     ],
2029 AC_ARG_WITH(windows-sdk,
2030     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
2031         [Specify which Windows SDK, or "Windows Kit", version to use
2032          in case the one that came with the selected Visual Studio
2033          is not what you want for some reason. Note that not all compiler/SDK
2034          combinations are supported. The intent is that this option should not
2035          be needed.])
2036     [
2037                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
2038     ],
2041 AC_ARG_WITH(lang,
2042     AS_HELP_STRING([--with-lang],
2043         [Use this option to build LibreOffice with additional UI language support.
2044          English (US) is always included by default.
2045          Separate multiple languages with space.
2046          For all languages, use --with-lang=ALL.])
2047     [
2048                           Usage:     --with-lang="es sw tu cs sk"
2049     ],
2052 AC_ARG_WITH(locales,
2053     AS_HELP_STRING([--with-locales],
2054         [Use this option to limit the locale information built in.
2055          Separate multiple locales with space.
2056          Very experimental and might well break stuff.
2057          Just a desperate measure to shrink code and data size.
2058          By default all the locales available is included.
2059          This option is completely unrelated to --with-lang.])
2060     [
2061                           Affects also our character encoding conversion
2062                           tables for encodings mainly targeted for a
2063                           particular locale, like EUC-CN and EUC-TW for
2064                           zh, ISO-2022-JP for ja.
2066                           Affects also our add-on break iterator data for
2067                           some languages.
2069                           For the default, all locales, don't use this switch at all.
2070                           Specifying just the language part of a locale means all matching
2071                           locales will be included.
2073                           Usage:     --with-locales="en es pt fr zh kr ja"
2074     ],
2077 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2078 AC_ARG_WITH(krb5,
2079     AS_HELP_STRING([--with-krb5],
2080         [Enable MIT Kerberos 5 support in modules that support it.
2081          By default automatically enabled on platforms
2082          where a good system Kerberos 5 is available.]),
2085 AC_ARG_WITH(gssapi,
2086     AS_HELP_STRING([--with-gssapi],
2087         [Enable GSSAPI support in modules that support it.
2088          By default automatically enabled on platforms
2089          where a good system GSSAPI is available.]),
2092 AC_ARG_WITH(iwyu,
2093     AS_HELP_STRING([--with-iwyu],
2094         [Use given IWYU binary path to check unneeded includes instead of building.
2095          Use only if you are hacking on it.]),
2098 dnl ===================================================================
2099 dnl Branding
2100 dnl ===================================================================
2102 AC_ARG_WITH(branding,
2103     AS_HELP_STRING([--with-branding],
2104         [Use given path to retrieve branding images set.])
2105     [
2106                           Search for intro.png about.svg and flat_logo.svg.
2107                           If any is missing, default ones will be used instead.
2109                           Search also progress.conf for progress
2110                           settings on intro screen :
2112                           PROGRESSBARCOLOR="255,255,255" Set color of
2113                           progress bar. Comma separated RGB decimal values.
2114                           PROGRESSSIZE="407,6" Set size of progress bar.
2115                           Comma separated decimal values (width, height).
2116                           PROGRESSPOSITION="61,317" Set position of progress
2117                           bar from left,top. Comma separated decimal values.
2118                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2119                           bar frame. Comma separated RGB decimal values.
2120                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2121                           bar text. Comma separated RGB decimal values.
2122                           PROGRESSTEXTBASELINE="287" Set vertical position of
2123                           progress bar text from top. Decimal value.
2125                           Default values will be used if not found.
2127                           Usage:     --with-branding=/path/to/images
2128     ],
2132 AC_ARG_WITH(extra-buildid,
2133     AS_HELP_STRING([--with-extra-buildid],
2134         [Show addition build identification in about dialog.])
2135     [
2136                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
2137     ],
2141 AC_ARG_WITH(vendor,
2142     AS_HELP_STRING([--with-vendor],
2143         [Set vendor of the build.])
2144     [
2145                           Usage:     --with-vendor="John the Builder"
2146     ],
2149 AC_ARG_WITH(android-package-name,
2150     AS_HELP_STRING([--with-android-package-name],
2151         [Set Android package name of the build.])
2152     [
2153                           Usage:     --with-android-package-name="org.libreoffice"
2154     ],
2157 AC_ARG_WITH(compat-oowrappers,
2158     AS_HELP_STRING([--with-compat-oowrappers],
2159         [Install oo* wrappers in parallel with
2160          lo* ones to keep backward compatibility.
2161          Has effect only with make distro-pack-install]),
2164 AC_ARG_WITH(os-version,
2165     AS_HELP_STRING([--with-os-version],
2166         [For FreeBSD users, use this option option to override the detected OSVERSION.])
2167     [
2168                           Usage:     --with-os-version=<OSVERSION>
2169     ],
2172 AC_ARG_WITH(mingw-cross-compiler,
2173     AS_HELP_STRING([--with-mingw-cross-compiler],
2174         [Specify the MinGW cross-compiler to use.])
2175     [
2176                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2178                           When building on the ODK on Unix and building unowinreg.dll,
2179                           specify the MinGW C++ cross-compiler.
2180     ],
2183 AC_ARG_WITH(idlc-cpp,
2184     AS_HELP_STRING([--with-idlc-cpp],
2185         [Specify the C Preprocessor to use for idlc.])
2186     [
2187                           Usage:     --with-idlc-cpp=cpp
2189                           Default is ucpp.
2190     ]
2193 AC_ARG_WITH(build-version,
2194     AS_HELP_STRING([--with-build-version],
2195         [Allows the builder to add a custom version tag that will appear in the
2196          Help/About box for QA purposes.])
2197     [
2198                           Usage:     --with-build-version="Built by Jim"
2199     ],
2200     with_build_version=$withval ,
2203 AC_ARG_WITH(alloc,
2204     AS_HELP_STRING([--with-alloc],
2205         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2206          Note that on FreeBSD/NetBSD system==jemalloc]),
2209 AC_ARG_WITH(sun-templates,
2210     AS_HELP_STRING([--with-sun-templates],
2211         [Integrate Sun template packages.]),
2214 AC_ARG_WITH(parallelism,
2215     AS_HELP_STRING([--with-parallelism],
2216         [Number of jobs to run simultaneously during build. Parallel builds can
2217         save a lot of time on multi-cpu machines. Defaults to the number of
2218         CPUs on the machine, unless you configure --enable-icecream - then to
2219         10.]),
2222 AC_ARG_WITH(all-tarballs,
2223     AS_HELP_STRING([--with-all-tarballs],
2224         [Download all external tarballs unconditionally]))
2226 AC_ARG_WITH(gdrive-client-id,
2227     AS_HELP_STRING([--with-gdrive-client-id],
2228         [Provides the client id of the application for OAuth2 authentication
2229         on Google Drive. If either this or --with-gdrive-client-secret is
2230         empty, the feature will be disabled]),
2233 AC_ARG_WITH(gdrive-client-secret,
2234     AS_HELP_STRING([--with-gdrive-client-secret],
2235         [Provides the client secret of the application for OAuth2
2236         authentication on Google Drive. If either this or
2237         --with-gdrive-client-id is empty, the feature will be disabled]),
2240 AC_ARG_WITH(alfresco-cloud-client-id,
2241     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2242         [Provides the client id of the application for OAuth2 authentication
2243         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2244         empty, the feature will be disabled]),
2247 AC_ARG_WITH(alfresco-cloud-client-secret,
2248     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2249         [Provides the client secret of the application for OAuth2
2250         authentication on Alfresco Cloud. If either this or
2251         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2254 AC_ARG_WITH(onedrive-client-id,
2255     AS_HELP_STRING([--with-onedrive-client-id],
2256         [Provides the client id of the application for OAuth2 authentication
2257         on OneDrive. If either this or --with-onedrive-client-secret is
2258         empty, the feature will be disabled]),
2261 AC_ARG_WITH(onedrive-client-secret,
2262     AS_HELP_STRING([--with-onedrive-client-secret],
2263         [Provides the client secret of the application for OAuth2
2264         authentication on OneDrive. If either this or
2265         --with-onedrive-client-id is empty, the feature will be disabled]),
2267 dnl ===================================================================
2268 dnl Do we want to use pre-build binary tarball for recompile
2269 dnl ===================================================================
2271 if test "$enable_library_bin_tar" = "yes" ; then
2272     USE_LIBRARY_BIN_TAR=TRUE
2273 else
2274     USE_LIBRARY_BIN_TAR=
2276 AC_SUBST(USE_LIBRARY_BIN_TAR)
2278 dnl ===================================================================
2279 dnl Test whether build target is Release Build
2280 dnl ===================================================================
2281 AC_MSG_CHECKING([whether build target is Release Build])
2282 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2283     AC_MSG_RESULT([no])
2284     ENABLE_RELEASE_BUILD=
2285 else
2286     AC_MSG_RESULT([yes])
2287     ENABLE_RELEASE_BUILD=TRUE
2289 AC_SUBST(ENABLE_RELEASE_BUILD)
2291 dnl ===================================================================
2292 dnl Test whether to sign Windows Build
2293 dnl ===================================================================
2294 AC_MSG_CHECKING([whether to sign windows build])
2295 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2296     AC_MSG_RESULT([yes])
2297     WINDOWS_BUILD_SIGNING="TRUE"
2298 else
2299     AC_MSG_RESULT([no])
2300     WINDOWS_BUILD_SIGNING="FALSE"
2302 AC_SUBST(WINDOWS_BUILD_SIGNING)
2304 dnl ===================================================================
2305 dnl MacOSX build and runtime environment options
2306 dnl ===================================================================
2308 AC_ARG_WITH(macosx-sdk,
2309     AS_HELP_STRING([--with-macosx-sdk],
2310         [Use a specific SDK for building.])
2311     [
2312                           Usage:     --with-macosx-sdk=<version>
2314                           e. g.: --with-macosx-sdk=10.8
2316                           there are 3 options to control the MacOSX build:
2317                           --with-macosx-sdk (referred as 'sdk' below)
2318                           --with-macosx-version-min-required (referred as 'min' below)
2319                           --with-macosx-version-max-allowed (referred as 'max' below)
2321                           the connection between these value and the default they take is as follow:
2322                           ( ? means not specified on the command line, s means the SDK version found,
2323                           constraint: 8 <= x <= y <= z)
2325                           ==========================================
2326                            command line      || config result
2327                           ==========================================
2328                           min  | max  | sdk  || min  | max  | sdk  |
2329                           ?    | ?    | ?    || 10.8 | 10.s | 10.s |
2330                           ?    | ?    | 10.x || 10.8 | 10.x | 10.x |
2331                           ?    | 10.x | ?    || 10.8 | 10.s | 10.s |
2332                           ?    | 10.x | 10.y || 10.8 | 10.x | 10.y |
2333                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2334                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2335                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2336                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2339                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2340                           for a detailed technical explanation of these variables
2342                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2343     ],
2346 AC_ARG_WITH(macosx-version-min-required,
2347     AS_HELP_STRING([--with-macosx-version-min-required],
2348         [set the minimum OS version needed to run the built LibreOffice])
2349     [
2350                           Usage:     --with-macosx-version-min-required=<version>
2352                           e. g.: --with-macos-version-min-required=10.8
2353                           see --with-macosx-sdk for more info
2354     ],
2357 AC_ARG_WITH(macosx-version-max-allowed,
2358     AS_HELP_STRING([--with-macosx-version-max-allowed],
2359         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2360     [
2361                           Usage:     --with-macosx-version-max-allowed=<version>
2363                           e. g.: --with-macos-version-max-allowed=10.8
2364                           see --with-macosx-sdk for more info
2365     ],
2369 dnl ===================================================================
2370 dnl options for stuff used during cross-compilation build
2371 dnl Not quite superseded by --with-build-platform-configure-options.
2372 dnl TODO: check, if the "force" option is still needed anywhere.
2373 dnl ===================================================================
2375 AC_ARG_WITH(system-icu-for-build,
2376     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2377         [Use icu already on system for build tools (cross-compilation only).]))
2380 dnl ===================================================================
2381 dnl check for required programs (grep, awk, sed, bash)
2382 dnl ===================================================================
2384 pathmunge ()
2386     if test -n "$1"; then
2387         if test "$build_os" = "cygwin"; then
2388             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2389                 PathFormat "$1"
2390                 new_path=`cygpath -sm "$formatted_path"`
2391             else
2392                 PathFormat "$1"
2393                 new_path=`cygpath -u "$formatted_path"`
2394             fi
2395         else
2396             new_path="$1"
2397         fi
2398         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2399             if test "$2" = "after"; then
2400                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2401             else
2402                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2403             fi
2404         fi
2405         unset new_path
2406     fi
2409 AC_PROG_AWK
2410 AC_PATH_PROG( AWK, $AWK)
2411 if test -z "$AWK"; then
2412     AC_MSG_ERROR([install awk to run this script])
2415 AC_PATH_PROG(BASH, bash)
2416 if test -z "$BASH"; then
2417     AC_MSG_ERROR([bash not found in \$PATH])
2419 AC_SUBST(BASH)
2421 AC_MSG_CHECKING([for GNU or BSD tar])
2422 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2423     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2424     if test $? -eq 0;  then
2425         GNUTAR=$a
2426         break
2427     fi
2428 done
2429 AC_MSG_RESULT($GNUTAR)
2430 if test -z "$GNUTAR"; then
2431     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2433 AC_SUBST(GNUTAR)
2435 AC_MSG_CHECKING([for tar's option to strip components])
2436 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2437 if test $? -eq 0; then
2438     STRIP_COMPONENTS="--strip-components"
2439 else
2440     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2441     if test $? -eq 0; then
2442         STRIP_COMPONENTS="--strip-path"
2443     else
2444         STRIP_COMPONENTS="unsupported"
2445     fi
2447 AC_MSG_RESULT($STRIP_COMPONENTS)
2448 if test x$STRIP_COMPONENTS = xunsupported; then
2449     AC_MSG_ERROR([you need a tar that is able to strip components.])
2451 AC_SUBST(STRIP_COMPONENTS)
2453 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2454 dnl desktop OSes from "mobile" ones.
2456 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2457 dnl In other words, that when building for an OS that is not a
2458 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2460 dnl Note the direction of the implication; there is no assumption that
2461 dnl cross-compiling would imply a non-desktop OS.
2463 if test $_os != iOS -a $_os != Android; then
2464     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2465     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2466     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2469 DISABLE_EXPORT=''
2470 if test "$enable_export" != no; then
2471     BUILD_TYPE="$BUILD_TYPE EXPORT"
2472 else
2473     DISABLE_EXPORT='TRUE'
2474     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2476 AC_SUBST(DISABLE_EXPORT)
2478 # Whether to build "avmedia" functionality or not.
2480 if test -z "$enable_avmedia"; then
2481     enable_avmedia=yes
2484 if test "$enable_avmedia" = yes; then
2485     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2486     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2487 else
2488     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2491 # Decide whether to build database connectivity stuff (including
2492 # Base) or not. We probably don't want to on non-desktop OSes.
2494 if test -z "$enable_database_connectivity"; then
2495     # --disable-database-connectivity is unfinished work in progress
2496     # and the iOS test app doesn't link if we actually try to use it.
2497     # if test $_os != iOS -a $_os != Android; then
2498         enable_database_connectivity=yes
2499     # fi
2502 if test "$enable_database_connectivity" = yes; then
2503     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2504     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2507 if test -z "$enable_extensions"; then
2508     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2509     if test $_os != iOS -a $_os != Android; then
2510         enable_extensions=yes
2511     fi
2514 if test "$enable_extensions" = yes; then
2515     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2516     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2519 if test -z "$enable_scripting"; then
2520     # Disable scripting for iOS unless specifically overridden
2521     # with --enable-scripting.
2522     if test $_os != iOS; then
2523         enable_scripting=yes
2524     fi
2527 DISABLE_SCRIPTING=''
2528 if test "$enable_scripting" = yes; then
2529     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2530     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2531 else
2532     DISABLE_SCRIPTING='TRUE'
2533     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2536 if test $_os = iOS -o $_os = Android; then
2537     # Disable dynamic_loading always for iOS and Android
2538     enable_dynamic_loading=no
2539 elif test -z "$enable_dynamic_loading"; then
2540     # Otherwise enable it unless speficically disabled
2541     enable_dynamic_loading=yes
2544 DISABLE_DYNLOADING=''
2545 if test "$enable_dynamic_loading" = yes; then
2546     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2547 else
2548     DISABLE_DYNLOADING='TRUE'
2549     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2551 AC_SUBST(DISABLE_DYNLOADING)
2553 # remenber SYSBASE value
2554 AC_SUBST(SYSBASE)
2556 dnl ===================================================================
2557 dnl  Sort out various gallery compilation options
2558 dnl ===================================================================
2559 AC_MSG_CHECKING([how to build and package galleries])
2560 if test -n "${with_galleries}"; then
2561     if test "$with_galleries" = "build"; then
2562         WITH_GALLERY_BUILD=TRUE
2563         AC_MSG_RESULT([build from source images internally])
2564     elif test "$with_galleries" = "no"; then
2565         WITH_GALLERY_BUILD=
2566         AC_MSG_RESULT([disable non-internal gallery build])
2567     else
2568         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2569     fi
2570 else
2571     if test $_os != iOS -a $_os != Android; then
2572         WITH_GALLERY_BUILD=TRUE
2573         AC_MSG_RESULT([internal src images for desktop])
2574     else
2575         WITH_GALLERY_BUILD=
2576         AC_MSG_RESULT([disable src imgage build])
2577     fi
2579 AC_SUBST(WITH_GALLERY_BUILD)
2581 dnl ===================================================================
2582 dnl  Checks if ccache is available
2583 dnl ===================================================================
2584 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2585     case "%$CC%$CXX%" in
2586     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2587     # assume that's good then
2588     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2589         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2590         ;;
2591     *)
2592         AC_PATH_PROG([CCACHE],[ccache],[not found])
2593         if test "$CCACHE" = "not found"; then
2594             CCACHE=""
2595         else
2596             # Need to check for ccache version: otherwise prevents
2597             # caching of the results (like "-x objective-c++" for Mac)
2598             if test $_os = Darwin -o $_os = iOS; then
2599                 # Check ccache version
2600                 AC_MSG_CHECKING([whether version of ccache is suitable])
2601                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2602                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2603                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2604                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2605                 else
2606                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2607                     CCACHE=""
2608                 fi
2609             fi
2610         fi
2611         ;;
2612     esac
2613 else
2614     CCACHE=""
2617 if test "$CCACHE" != ""; then
2618     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2619     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2620     if test "$ccache_size" = ""; then
2621         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2622         if test "$ccache_size" = ""; then
2623             ccache_size=0
2624         fi
2625         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2626         if test $ccache_size -lt 1024; then
2627             CCACHE=""
2628             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2629             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2630         else
2631             # warn that ccache may be too small for debug build
2632             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2633             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2634         fi
2635     else
2636         if test $ccache_size -lt 5; then
2637             #warn that ccache may be too small for debug build
2638             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2639             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2640         fi
2641     fi
2644 dnl ===================================================================
2645 dnl  Checks for C compiler,
2646 dnl  The check for the C++ compiler is later on.
2647 dnl ===================================================================
2648 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2649     GCC_HOME_SET="true"
2650     AC_MSG_CHECKING([gcc home])
2651     if test -z "$with_gcc_home"; then
2652         if test "$enable_icecream" = "yes"; then
2653             if test -d "/usr/lib/icecc/bin"; then
2654                 GCC_HOME="/usr/lib/icecc/"
2655             else
2656                 GCC_HOME="/opt/icecream/"
2657             fi
2658         else
2659             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2660             GCC_HOME_SET="false"
2661         fi
2662     else
2663         GCC_HOME="$with_gcc_home"
2664     fi
2665     AC_MSG_RESULT($GCC_HOME)
2666     AC_SUBST(GCC_HOME)
2668     if test "$GCC_HOME_SET" = "true"; then
2669         if test -z "$CC"; then
2670             CC="$GCC_HOME/bin/gcc"
2671         fi
2672         if test -z "$CXX"; then
2673             CXX="$GCC_HOME/bin/g++"
2674         fi
2675     fi
2678 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2679 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2680     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2681     save_CFLAGS=$CFLAGS
2682     AC_PROG_CC
2683     CFLAGS=$save_CFLAGS
2686 COMPATH=`dirname "$CC"`
2687 if test "$COMPATH" = "."; then
2688     AC_PATH_PROGS(COMPATH, $CC)
2689     dnl double square bracket to get single because of M4 quote...
2690     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2692 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2694 dnl ===================================================================
2695 dnl Java support
2696 dnl ===================================================================
2697 AC_MSG_CHECKING([whether to build with Java support])
2698 if test "$with_java" != "no"; then
2699     if test "$DISABLE_SCRIPTING" = TRUE; then
2700         AC_MSG_RESULT([no, overridden by --disable-scripting])
2701         ENABLE_JAVA=""
2702         with_java=no
2703     else
2704         AC_MSG_RESULT([yes])
2705         ENABLE_JAVA="TRUE"
2706         AC_DEFINE(HAVE_FEATURE_JAVA)
2707     fi
2708 else
2709     AC_MSG_RESULT([no])
2710     ENABLE_JAVA=""
2713 AC_SUBST(ENABLE_JAVA)
2715 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2717 dnl ENABLE_JAVA="" indicate no Java support at all
2719 dnl ===================================================================
2720 dnl Export file validation
2721 dnl ===================================================================
2722 AC_MSG_CHECKING([whether to enable export file validation])
2723 if test "$with_export_validation" = yes; then
2724     AC_MSG_RESULT([yes])
2725     AC_DEFINE(HAVE_EXPORT_VALIDATION)
2726 else
2727     AC_MSG_RESULT([no])
2731 dnl ===================================================================
2732 dnl Check OS X SDK and compiler
2733 dnl ===================================================================
2735 if test $_os = Darwin; then
2737     # If no --with-macosx-sdk option is given, look for one
2739     # The intent is that for "most" Mac-based developers, a suitable
2740     # SDK will be found automatically without any configure options.
2742     # For developers with a current Xcode, the lowest-numbered SDK
2743     # higher than or equal to the minimum required should be found.
2745     AC_MSG_CHECKING([what Mac OS X SDK to use])
2747     for _macosx_sdk in $with_macosx_sdk 10.8 10.9 10.10; do
2748         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2749         if test -d "$MACOSX_SDK_PATH"; then
2750             with_macosx_sdk="${_macosx_sdk}"
2751             break
2752         else
2753             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2754             if test -d "$MACOSX_SDK_PATH"; then
2755                 with_macosx_sdk="${_macosx_sdk}"
2756                 break
2757             fi
2758         fi
2759     done
2760     if test ! -d "$MACOSX_SDK_PATH"; then
2761         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2762     fi
2763     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2765     case $with_macosx_sdk in
2766     10.8)
2767         MACOSX_SDK_VERSION=1080
2768         ;;
2769     10.9)
2770         MACOSX_SDK_VERSION=1090
2771         ;;
2772     10.10)
2773         MACOSX_SDK_VERSION=101000
2774         ;;
2775     *)
2776         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.8--10])
2777         ;;
2778     esac
2780     if test "$with_macosx_version_min_required" = "" ; then
2781         with_macosx_version_min_required="10.8";
2782     fi
2784     if test "$with_macosx_version_max_allowed" = "" ; then
2785         with_macosx_version_max_allowed="$with_macosx_sdk"
2786     fi
2788     # export this so that "xcrun" invocations later return matching values
2789     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2790     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2791     export DEVELOPER_DIR
2792     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2793     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2795     case "$with_macosx_version_min_required" in
2796     10.8)
2797         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2798         ;;
2799     10.9)
2800         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2801         ;;
2802     10.10)
2803         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2804         ;;
2805     *)
2806         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.8--10])
2807         ;;
2808     esac
2810     LIBTOOL=libtool
2811     INSTALL_NAME_TOOL=install_name_tool
2812     if test -z "$save_CC"; then
2813         AC_MSG_CHECKING([what compiler to use])
2814         stdlib=-stdlib=libc++
2815         if test "$ENABLE_LTO" = TRUE; then
2816             lto=-flto
2817         fi
2818         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2819         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2820         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2821         AR=`xcrun -find ar`
2822         NM=`xcrun -find nm`
2823         STRIP=`xcrun -find strip`
2824         LIBTOOL=`xcrun -find libtool`
2825         RANLIB=`xcrun -find ranlib`
2826         AC_MSG_RESULT([$CC and $CXX])
2827     fi
2829     case "$with_macosx_version_max_allowed" in
2830     10.8)
2831         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2832         ;;
2833     10.9)
2834         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2835         ;;
2836     10.10)
2837         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2838         ;;
2839     *)
2840         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.8--10])
2841         ;;
2842     esac
2844     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2845     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2846         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2847     else
2848         AC_MSG_RESULT([ok])
2849     fi
2851     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2852     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2853         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2854     else
2855         AC_MSG_RESULT([ok])
2856     fi
2857     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2858     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2860     AC_MSG_CHECKING([whether to do code signing])
2862     if test "$enable_macosx_code_signing" = yes; then
2863         # By default use the first suitable certificate (?).
2865         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2866         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2867         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2868         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2869         # "Developer ID Application" one.
2871         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2872         if test -n "$identity"; then
2873             MACOSX_CODESIGNING_IDENTITY=$identity
2874             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2875             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2876         else
2877             AC_MSG_ERROR([cannot determine identity to use])
2878         fi
2879     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2880         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2881         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2882         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2883     else
2884         AC_MSG_RESULT([no])
2885     fi
2887     AC_MSG_CHECKING([whether to create a Mac App Store package])
2889     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2890         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2891     elif test "$enable_macosx_package_signing" = yes; then
2892         # By default use the first suitable certificate.
2893         # It should be a "3rd Party Mac Developer Installer" one
2895         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2896         if test -n "$identity"; then
2897             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2898             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2899             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2900         else
2901             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2902         fi
2903     elif test -n "$enable_macosx_package_signing"; then
2904         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2905         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2906         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2907     else
2908         AC_MSG_RESULT([no])
2909     fi
2911     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2912         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2913     fi
2915     AC_MSG_CHECKING([whether to sandbox the application])
2917     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2918         AC_MSG_ERROR([OS X sandboxing requires code signing])
2919     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2920         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2921     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2922         ENABLE_MACOSX_SANDBOX=TRUE
2923         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2924         AC_MSG_RESULT([yes])
2925     else
2926         AC_MSG_RESULT([no])
2927     fi
2929     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2930     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2931     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2933     AC_MSG_CHECKING([what OS X app name to use])
2934     MACOSX_APP_NAME="$with_macosx_app_name"
2935     AC_MSG_RESULT([$MACOSX_APP_NAME])
2938 AC_SUBST(MACOSX_SDK_PATH)
2939 AC_SUBST(MACOSX_SDK_VERSION)
2940 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2941 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2942 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2943 AC_SUBST(INSTALL_NAME_TOOL)
2944 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2945 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2946 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2947 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2948 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2949 AC_SUBST(MACOSX_APP_NAME)
2950 AC_SUBST(MACOSX_HIGH_RESOLUTION_VALUE)
2952 dnl ===================================================================
2953 dnl Check iOS SDK and compiler
2954 dnl ===================================================================
2956 if test $_os = iOS; then
2958     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2959         :
2960     else
2961         BITNESS_OVERRIDE=64
2962     fi
2964     AC_MSG_CHECKING([what iOS SDK to use])
2966     if test "$enable_ios_simulator" = yes; then
2967         platform=iPhoneSimulator
2968     else
2969         platform=iPhoneOS
2970     fi
2972     xcode_developer=`xcode-select -print-path`
2974     current_sdk_ver=8.1
2975     for sdkver in 8.2 8.1 8.0; do
2976         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2977         if test -d $t; then
2978             ios_sdk=$sdkver
2979             sysroot=$t
2980             break
2981         fi
2982     done
2984     if test -z "$sysroot"; then
2985         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}])
2986     fi
2988     AC_MSG_RESULT($sysroot)
2990     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2992     if test "$enable_ios_simulator" = yes; then
2993         if test "$BITNESS_OVERRIDE" = 64; then
2994             XCODE_ARCHS=x86_64
2995             versionmin=-mios-simulator-version-min=7.0
2996         else
2997             XCODE_ARCHS=i386
2998             versionmin=-mios-simulator-version-min=7.0
2999         fi
3000     else
3001         platform=iPhoneOS
3002         if test "$BITNESS_OVERRIDE" = 64; then
3003             XCODE_ARCHS=arm64
3004         else
3005             XCODE_ARCHS=armv7
3006         fi
3007         versionmin=-miphoneos-version-min=7.0
3008     fi
3010     # LTO is not really recommended for iOS builds,
3011     # the link time will be astronomical
3012     if test "$ENABLE_LTO" = TRUE; then
3013         lto=-flto
3014     fi
3015     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3016     # get compiled with it, to avoid ld warnings when linking all that together into one
3017     # executable.
3019     XCODE_CLANG_CXX_LIBRARY=libc++
3020     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3022     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3023     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3025     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3026     AR=`xcrun -find ar`
3027     NM=`xcrun -find nm`
3028     STRIP=`xcrun -find strip`
3029     LIBTOOL=`xcrun -find libtool`
3030     RANLIB=`xcrun -find ranlib`
3033 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3034 AC_SUBST(XCODE_ARCHS)
3035 AC_SUBST(XCODEBUILD_SDK)
3037 AC_MSG_CHECKING([whether to treat the installation as read-only])
3039 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3040         "$enable_extensions" != yes; then
3041     enable_readonly_installset=yes
3043 if test "$enable_readonly_installset" = yes; then
3044     AC_MSG_RESULT([yes])
3045     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3046 else
3047     AC_MSG_RESULT([no])
3050 dnl ===================================================================
3051 dnl Structure of install set
3052 dnl ===================================================================
3054 if test $_os = Darwin; then
3055     LIBO_BIN_FOLDER=MacOS
3056     LIBO_ETC_FOLDER=Resources
3057     LIBO_LIBEXEC_FOLDER=MacOS
3058     LIBO_LIB_FOLDER=Frameworks
3059     LIBO_SHARE_FOLDER=Resources
3060     LIBO_SHARE_HELP_FOLDER=Resources/help
3061     LIBO_SHARE_JAVA_FOLDER=Resources/java
3062     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3063     LIBO_LIB_PYUNO_FOLDER=Resources
3064     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3065     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3066     LIBO_URE_BIN_FOLDER=MacOS
3067     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3068     LIBO_URE_LIB_FOLDER=Frameworks
3069     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3070     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3071 elif test $_os = WINNT; then
3072     LIBO_BIN_FOLDER=program
3073     LIBO_ETC_FOLDER=program
3074     LIBO_LIBEXEC_FOLDER=program
3075     LIBO_LIB_FOLDER=program
3076     LIBO_LIB_PYUNO_FOLDER=program
3077     LIBO_SHARE_FOLDER=share
3078     LIBO_SHARE_HELP_FOLDER=help
3079     LIBO_SHARE_JAVA_FOLDER=program/classes
3080     LIBO_SHARE_PRESETS_FOLDER=presets
3081     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3082     LIBO_SHARE_SHELL_FOLDER=program/shell
3083     LIBO_URE_BIN_FOLDER=program
3084     LIBO_URE_ETC_FOLDER=program
3085     LIBO_URE_LIB_FOLDER=program
3086     LIBO_URE_MISC_FOLDER=program
3087     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3088 else
3089     LIBO_BIN_FOLDER=program
3090     LIBO_ETC_FOLDER=program
3091     LIBO_LIBEXEC_FOLDER=program
3092     LIBO_LIB_FOLDER=program
3093     LIBO_LIB_PYUNO_FOLDER=program
3094     LIBO_SHARE_FOLDER=share
3095     LIBO_SHARE_HELP_FOLDER=help
3096     LIBO_SHARE_JAVA_FOLDER=program/classes
3097     LIBO_SHARE_PRESETS_FOLDER=presets
3098     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3099     LIBO_SHARE_SHELL_FOLDER=program/shell
3100     LIBO_URE_BIN_FOLDER=program
3101     LIBO_URE_ETC_FOLDER=program
3102     LIBO_URE_LIB_FOLDER=program
3103     LIBO_URE_MISC_FOLDER=program
3104     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3106 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3107 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3108 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3109 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3110 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3111 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3112 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3113 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3114 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3115 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3116 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3117 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3118 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3119 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3120 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3121 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3123 # Not all of them needed in config_host.mk, add more if need arises
3124 AC_SUBST(LIBO_BIN_FOLDER)
3125 AC_SUBST(LIBO_ETC_FOLDER)
3126 AC_SUBST(LIBO_LIB_FOLDER)
3127 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3128 AC_SUBST(LIBO_SHARE_FOLDER)
3129 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3130 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3131 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3132 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3133 AC_SUBST(LIBO_URE_BIN_FOLDER)
3134 AC_SUBST(LIBO_URE_ETC_FOLDER)
3135 AC_SUBST(LIBO_URE_LIB_FOLDER)
3136 AC_SUBST(LIBO_URE_MISC_FOLDER)
3137 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3139 dnl ===================================================================
3140 dnl Windows specific tests and stuff
3141 dnl ===================================================================
3143 # Get a value from the 32-bit side of the Registry
3144 reg_get_value_32()
3146     # Return value: $regvalue
3147     unset regvalue
3148     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3150     if test $? -eq 0; then
3151         regvalue=$_regvalue
3152     fi
3155 # Get a value from the 64-bit side of the Registry
3156 reg_get_value_64()
3158     # Return value: $regvalue
3159     unset regvalue
3160     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3162     if test $? -eq 0; then
3163         regvalue=$_regvalue
3164     fi
3167 if test "$_os" = "WINNT"; then
3168     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3169     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3170         AC_MSG_RESULT([no])
3171         WINDOWS_SDK_ARCH="x86"
3172     else
3173         AC_MSG_RESULT([yes])
3174         WINDOWS_SDK_ARCH="x64"
3175         BITNESS_OVERRIDE=64
3176     fi
3179 if test "$cross_compiling" = "yes"; then
3180     export CROSS_COMPILING=TRUE
3181     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3182 else
3183     CROSS_COMPILING=
3184     BUILD_TYPE="$BUILD_TYPE NATIVE"
3186 AC_SUBST(CROSS_COMPILING)
3188 dnl ===================================================================
3189 dnl  Is GCC actually Clang?
3190 dnl ===================================================================
3192 COM_GCC_IS_CLANG=
3193 if test "$GCC" = "yes"; then
3194     AC_MSG_CHECKING([whether GCC is actually Clang])
3195     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3196         #ifndef __clang__
3197         you lose
3198         #endif
3199         int foo=42;
3200         ]])],
3201         [AC_MSG_RESULT([yes])
3202          COM_GCC_IS_CLANG=TRUE],
3203         [AC_MSG_RESULT([no])])
3205     if test "$COM_GCC_IS_CLANG" = TRUE; then
3206         AC_MSG_CHECKING([the Clang version])
3207         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3208         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3209         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3210         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3211         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3212     fi
3214 AC_SUBST(COM_GCC_IS_CLANG)
3216 if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
3217     if test -z "$CCACHE_CPP2"; then
3218         AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3219         add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3220     fi
3223 dnl ===================================================================
3224 dnl  Test the gcc version
3225 dnl ===================================================================
3226 if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
3227     AC_MSG_CHECKING([the GCC version])
3228     _gcc_version=`$CC -dumpversion`
3229     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3231     AC_MSG_RESULT([gcc $_gcc_version])
3233     if test "$GCC_VERSION" -lt 0406; then
3234         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.6.0])
3235     fi
3236 else
3237     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3238     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3239     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3240     # (which reports itself as GCC 4.2.1).
3241     GCC_VERSION=
3243 AC_SUBST(GCC_VERSION)
3245 # ===================================================================
3246 # check various GCC options that Clang does not support now but maybe
3247 # will somewhen in the future, check them even for GCC, so that the
3248 # flags are set
3249 # ===================================================================
3251 HAVE_GCC_GGDB2=
3252 HAVE_GCC_FINLINE_LIMIT=
3253 HAVE_GCC_FNO_INLINE=
3254 if test "$GCC" = "yes"; then
3255     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3256     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3257         # Option just ignored and silly warning that isn't a real
3258         # warning printed
3259         :
3260     else
3261         save_CFLAGS=$CFLAGS
3262         CFLAGS="$CFLAGS -Werror -ggdb2"
3263         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3264         CFLAGS=$save_CFLAGS
3265     fi
3266     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3267         AC_MSG_RESULT([yes])
3268     else
3269         AC_MSG_RESULT([no])
3270     fi
3272     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3273     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3274         # As above
3275         :
3276     else
3277         save_CFLAGS=$CFLAGS
3278         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3279         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3280         CFLAGS=$save_CFLAGS
3281     fi
3282     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3283         AC_MSG_RESULT([yes])
3284     else
3285         AC_MSG_RESULT([no])
3286     fi
3288     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3289     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3290         # Ditto
3291         :
3292     else
3293         save_CFLAGS=$CFLAGS
3294         CFLAGS="$CFLAGS -Werror -fno-inline"
3295         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3296         CFLAGS=$save_CFLAGS
3297     fi
3298     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3299         AC_MSG_RESULT([yes])
3300     else
3301         AC_MSG_RESULT([no])
3302     fi
3304 AC_SUBST(HAVE_GCC_GGDB2)
3305 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3306 AC_SUBST(HAVE_GCC_FNO_INLINE)
3308 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3309 if test "$GCC" = "yes"; then
3310     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3311     bsymbolic_functions_ldflags_save=$LDFLAGS
3312     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3313     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3314 #include <stdio.h>
3315         ],[
3316 printf ("hello world\n");
3317         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3318     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3319         AC_MSG_RESULT( found )
3320     else
3321         AC_MSG_RESULT( not found )
3322     fi
3323     LDFLAGS=$bsymbolic_functions_ldflags_save
3325 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3327 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3328 # NOTE: must _not_ be used for bundled external libraries!
3329 ISYSTEM=
3330 if test "$GCC" = "yes"; then
3331     AC_MSG_CHECKING( for -isystem )
3332     save_CFLAGS=$CFLAGS
3333     CFLAGS="$CFLAGS -Werror"
3334     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3335     CFLAGS=$save_CFLAGS
3336     if test -n "$ISYSTEM"; then
3337         AC_MSG_RESULT(yes)
3338     else
3339         AC_MSG_RESULT(no)
3340     fi
3342 if test -z "$ISYSTEM"; then
3343     # fall back to using -I
3344     ISYSTEM=-I
3346 AC_SUBST(ISYSTEM)
3348 dnl ===================================================================
3349 dnl  Check which Visual Studio or MinGW compiler is used
3350 dnl ===================================================================
3352 map_vs_year_to_version()
3354     # Return value: $vsversion
3356     unset vsversion
3358     case $1 in
3359     2013)
3360         vsversion=12.0;;
3361     *)
3362         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3363     esac
3366 vs_versions_to_check()
3368     # Args: $1 (optional) : versions to check, in the order of preference
3369     # Return value: $vsversions
3371     unset vsversions
3373     if test -n "$1"; then
3374         map_vs_year_to_version "$1"
3375         vsversions=$vsversion
3376     else
3377         # By default we prefer 2013
3378         vsversions=12.0
3379     fi
3382 find_msvs()
3384     # Find Visual Studio 2013
3385     # Args: $1 (optional) : versions to check, in the order of preference
3386     # Return value: $vstest
3388     unset vstest
3390     vs_versions_to_check "$1"
3392     for ver in $vsversions; do
3393         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3394         if test -n "$regvalue"; then
3395             vstest=$regvalue
3396             break
3397         fi
3398         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3399         if test -n "$regvalue"; then
3400             vstest=$regvalue
3401             break
3402         fi
3403     done
3406 find_msvc()
3408     # Find Visual C++ 2013
3409     # Args: $1 (optional) : The VS version year
3410     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3412     unset vctest vcnum vcnumwithdot vcexpress
3414     vs_versions_to_check "$1"
3416     for ver in $vsversions; do
3417         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3418         if test -n "$regvalue"; then
3419             vctest=$regvalue
3420             break
3421         fi
3422         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3423         if test -n "$regvalue"; then
3424             vctest=$regvalue
3425             break
3426         fi
3427     done
3428     if test -n "$vctest"; then
3429         vcnumwithdot=$ver
3430         case "$vcnumwithdot" in
3431         12.0)
3432             vcyear=2013
3433             vcnum=120
3434             ;;
3435         esac
3436         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$vcnumwithdot/Setup/VC/ProductDir
3437         if test -n "$regvalue" -a "$regvalue" = "$vctest" ; then
3438             vcexpress=Express
3439         fi
3440     fi
3443 SHOWINCLUDES_PREFIX=
3444 MSBUILD_PATH=
3445 if test "$_os" = "WINNT"; then
3446     if test "$WITH_MINGW" != "yes"; then
3447         AC_MSG_CHECKING([Visual C++])
3449         find_msvc "$with_visual_studio"
3451         if test -z "$vctest"; then
3452             if test -n "$with_visual_studio"; then
3453                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3454             else
3455                 AC_MSG_ERROR([No Visual Studio 2013 installation found])
3456             fi
3457         fi
3459         if test "$BITNESS_OVERRIDE" = ""; then
3460             if test -f "$vctest/bin/cl.exe"; then
3461                 VC_PRODUCT_DIR=$vctest
3462             else
3463                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3464             fi
3465         else
3466             if test -f "$vctest/bin/amd64/cl.exe"; then
3467                 VC_PRODUCT_DIR=$vctest
3468             else
3469                 if test -f "$vctest/bin/x86_amd64/cl.exe" -a "$vcexpress" = "Express"; then
3470                     VC_PRODUCT_DIR=$vctest
3471                 else
3472                     AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3473                 fi
3474             fi
3475         fi
3477         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3478         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3480         AC_MSG_CHECKING([Is Visual C++ Express])
3481         if test "$vcexpress" = "Express" ; then
3482             AC_MSG_RESULT([Yes])
3483         else
3484             AC_MSG_RESULT([No])
3485         fi
3487         # Find the proper version of MSBuild.exe to use based on the VS version
3488         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3489         if test -n "$regvalue" ; then
3490             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3491         fi
3493         dnl ===========================================================
3494         dnl  Check for the corresponding mspdb*.dll
3495         dnl ===========================================================
3497         MSPDB_PATH=
3499         if test "$BITNESS_OVERRIDE" = ""; then
3500             if test "$vcnum" = "120"; then
3501                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3502             else
3503                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3504             fi
3505         else
3506             if test "$vcexpress" = "Express"; then
3507                 MSPDB_PATH="$VC_PRODUCT_DIR/bin"
3508             else
3509                 MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3510             fi
3511         fi
3513         mspdbnum=$vcnum
3515         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3516             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3517         fi
3519         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3520         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3522         dnl The path needs to be added before cl is called
3523         PATH="$MSPDB_PATH:$PATH"
3525         AC_MSG_CHECKING([cl.exe])
3527         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3528         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3529         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3530         # is not enough?
3532         if test -z "$CC"; then
3533             if test "$BITNESS_OVERRIDE" = ""; then
3534                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3535                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3536                 fi
3537             else
3538                 if test "$vcexpress" = "Express"; then
3539                    if test -f "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"; then
3540                         CC="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3541                    fi
3542                 else
3543                    if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3544                         CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3545                    fi
3546                 fi
3547             fi
3549             # This gives us a posix path with 8.3 filename restrictions
3550             CC=`win_short_path_for_make "$CC"`
3551         fi
3553         if test -n "$CC"; then
3554             # Remove /cl.exe from CC case insensitive
3555             AC_MSG_RESULT([found Visual C++ $vcyear $vcexpress ($CC)])
3556             if test "$BITNESS_OVERRIDE" = ""; then
3557                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3558             else
3559                 if test -n "$VC_PRODUCT_DIR"; then
3560                     # Huh, why not just an assignment?
3561                     COMPATH=`echo $VC_PRODUCT_DIR`
3562                 fi
3563             fi
3564             if test "$BITNESS_OVERRIDE" = ""; then
3565                 dnl since MSVC 2012, default for x86 is -arch:SSE2:
3566                 CC="$CC -arch:SSE"
3567             fi
3568             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3570             PathFormat "$COMPATH"
3571             COMPATH="$formatted_path"
3573             VCVER=$vcnum
3574             MSVSVER=$vcyear
3576             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3577             # are always "better", we list them in reverse chronological order.
3579             case $vcnum in
3580             120)
3581                 COMEX=15
3582                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0 7.1A"
3583                 ;;
3584             esac
3586             # The expectation is that --with-windows-sdk should not need to be used
3587             if test -n "$with_windows_sdk"; then
3588                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3589                 *" "$with_windows_sdk" "*)
3590                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3591                     ;;
3592                 *)
3593                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3594                     ;;
3595                 esac
3596             fi
3598             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3599             ac_objext=obj
3600             ac_exeext=exe
3602         else
3603             AC_MSG_ERROR([Visual C++ not found after all, huh])
3604         fi
3606         dnl We need to guess the prefix of the -showIncludes output, it can be
3607         dnl localized
3608         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3609         echo "#include <stdlib.h>" > conftest.c
3610         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3611             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3612         rm -f conftest.c conftest.obj
3613         if test -z "$SHOWINCLUDES_PREFIX"; then
3614             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3615         else
3616             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3617         fi
3619         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3620         # version of the Explorer extension (and maybe other small
3621         # bits, too) needed when installing a 32-bit LibreOffice on a
3622         # 64-bit OS. The 64-bit Explorer extension is a feature that
3623         # has been present since long in OOo. Don't confuse it with
3624         # building LibreOffice itself as 64-bit code, which is
3625         # unfinished work and highly experimental.
3627         BUILD_X64=
3628         CXX_X64_BINARY=
3629         LINK_X64_BINARY=
3631         if test "$BITNESS_OVERRIDE" = ""; then
3632             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3633             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3634                 # Prefer native x64 compiler to cross-compiler, in case we are running
3635                 # the build on a 64-bit OS.
3636                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3637                     BUILD_X64=TRUE
3638                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3639                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3640                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3641                     BUILD_X64=TRUE
3642                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3643                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3644                 fi
3645             fi
3646             if test "$BUILD_X64" = TRUE; then
3647                 AC_MSG_RESULT([found])
3648             else
3649                 AC_MSG_RESULT([not found])
3650                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3651             fi
3652         fi
3653         AC_SUBST(BUILD_X64)
3655         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3656         AC_SUBST(CXX_X64_BINARY)
3657         AC_SUBST(LINK_X64_BINARY)
3658     else
3659         AC_MSG_CHECKING([the compiler is MinGW])
3660         MACHINE_PREFIX=`$CC -dumpmachine`
3661         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3662             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3663             AC_MSG_RESULT([yes])
3664         else
3665             AC_MSG_ERROR([Compiler is not MinGW.])
3666         fi
3667     fi
3669 AC_SUBST(VCVER)
3670 PathFormat "$MSPDB_PATH"
3671 MSPDB_PATH="$formatted_path"
3672 AC_SUBST(SHOWINCLUDES_PREFIX)
3674 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3675     AC_MSG_CHECKING([whether to use DirectX])
3676     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3677         ENABLE_DIRECTX="TRUE"
3678         AC_MSG_RESULT([yes])
3679     else
3680         ENABLE_DIRECTX=""
3681         AC_MSG_RESULT([no])
3682     fi
3684     AC_MSG_CHECKING([whether to use ActiveX])
3685     if test "$enable_activex" = "yes" -o "$enable_activex" = "" -a "$vcexpress" != Express; then
3686         DISABLE_ACTIVEX=""
3687         AC_MSG_RESULT([yes])
3688     else
3689         DISABLE_ACTIVEX="TRUE"
3690         AC_MSG_RESULT([no])
3691     fi
3693     AC_MSG_CHECKING([whether to use ATL])
3694     if test "$enable_atl" = "yes" -o "$enable_atl" = "" -a "$vcexpress" != Express; then
3695         DISABLE_ATL=""
3696         AC_MSG_RESULT([yes])
3697     else
3698         DISABLE_ATL="TRUE"
3699         AC_MSG_RESULT([no])
3700     fi
3701 else
3702     ENABLE_DIRECTX=""
3703     DISABLE_ACTIVEX="TRUE"
3704     DISABLE_ATL="TRUE"
3707 AC_SUBST(ENABLE_DIRECTX)
3708 AC_SUBST(DISABLE_ACTIVEX)
3709 AC_SUBST(DISABLE_ATL)
3712 # dbghelp.dll
3714 if test "$_os" = "WINNT"; then
3715     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3719 # unowinreg.dll
3721 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3722 AC_SUBST(UNOWINREG_DLL)
3725 # prefix C with ccache if needed
3727 if test "$CCACHE" != ""; then
3728     AC_MSG_CHECKING([whether $CC is already ccached])
3730     AC_LANG_PUSH([C])
3731     save_CFLAGS=$CFLAGS
3732     CFLAGS="$CFLAGS --ccache-skip -O2"
3733     dnl an empty program will do, we're checking the compiler flags
3734     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3735                       [use_ccache=yes], [use_ccache=no])
3736     if test $use_ccache = yes; then
3737         AC_MSG_RESULT([yes])
3738     else
3739         CC="$CCACHE $CC"
3740         AC_MSG_RESULT([no])
3741     fi
3742     CFLAGS=$save_CFLAGS
3743     AC_LANG_POP([C])
3746 dnl Set the ENABLE_DBGUTIL variable
3747 dnl ===================================================================
3748 AC_MSG_CHECKING([whether to build with additional debug utilities])
3749 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3750     ENABLE_DBGUTIL="TRUE"
3751     # this is an extra var so it can have different default on different MSVC
3752     # versions (in case there are version specific problems with it)
3753     MSVC_USE_DEBUG_RUNTIME="TRUE"
3755     AC_MSG_RESULT([yes])
3756     # cppunit and graphite expose STL in public headers
3757     if test "$with_system_cppunit" = "yes"; then
3758         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3759     else
3760         with_system_cppunit=no
3761     fi
3762     if test "$with_system_graphite" = "yes"; then
3763         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3764     else
3765         with_system_graphite=no
3766     fi
3767     if test "$with_system_mysql_cppconn" = "yes"; then
3768         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3769     else
3770         with_system_mysql_cppconn=no
3771     fi
3772     if test "$with_system_orcus" = "yes"; then
3773         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3774     else
3775         with_system_orcus=no
3776     fi
3777     if test "$with_system_libcmis" = "yes"; then
3778         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3779     else
3780         with_system_libcmis=no
3781     fi
3782     if test "$with_system_libgltf" = "yes"; then
3783         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3784     else
3785         with_system_libgltf=no
3786     fi
3787     if test "$enable_win_mozab_driver" = "yes"; then
3788         AC_MSG_ERROR([--enable-win-mozab-driver conflicts with --enable-dbgutil])
3789     fi
3790 else
3791     ENABLE_DBGUTIL=""
3792     MSVC_USE_DEBUG_RUNTIME=""
3793     AC_MSG_RESULT([no])
3795 AC_SUBST(ENABLE_DBGUTIL)
3796 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3798 dnl Set the ENABLE_DEBUG variable.
3799 dnl ===================================================================
3800 AC_MSG_CHECKING([whether to do a debug build])
3801 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3802     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3804 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3805     AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3808 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3809     ENABLE_DEBUG="TRUE"
3810     if test -n "$ENABLE_DBGUTIL" ; then
3811         AC_MSG_RESULT([yes (dbgutil)])
3812     else
3813         AC_MSG_RESULT([yes])
3814     fi
3815 else
3816     ENABLE_DEBUG=""
3817     AC_MSG_RESULT([no])
3819 AC_SUBST(ENABLE_DEBUG)
3821 if test "$enable_sal_log" = yes; then
3822     ENABLE_SAL_LOG=TRUE
3824 AC_SUBST(ENABLE_SAL_LOG)
3826 dnl Selective debuginfo
3827 ENABLE_DEBUGINFO_FOR=
3828 if test -n "$ENABLE_DEBUG"; then
3829     AC_MSG_CHECKING([whether to use selective debuginfo])
3830     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3831         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3832         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3833     else
3834         ENABLE_DEBUGINFO_FOR=all
3835         AC_MSG_RESULT([no, for all])
3836     fi
3838 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3840 dnl Check for enable symbols option
3841 dnl ===================================================================
3842 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3843 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3844     ENABLE_SYMBOLS="TRUE"
3845     if test -n "$ENABLE_DBGUTIL"; then
3846         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3847     elif test -n "$ENABLE_DEBUG"; then
3848         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3849     fi
3850     AC_MSG_RESULT([yes])
3851 else
3852     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3853         ENABLE_SYMBOLS="FALSE"
3854     else
3855         ENABLE_SYMBOLS=
3856     fi
3857     AC_MSG_RESULT([no])
3859 AC_SUBST(ENABLE_SYMBOLS)
3861 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3862 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3863 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3864 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3865 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3866     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
3868 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
3870 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3871 # By default use the ones specified by our build system,
3872 # but explicit override is possible.
3873 AC_MSG_CHECKING(for explicit AFLAGS)
3874 if test -n "$AFLAGS"; then
3875     AC_MSG_RESULT([$AFLAGS])
3876     x_AFLAGS=
3877 else
3878     AC_MSG_RESULT(no)
3879     x_AFLAGS=[\#]
3881 AC_MSG_CHECKING(for explicit CFLAGS)
3882 if test -n "$CFLAGS"; then
3883     AC_MSG_RESULT([$CFLAGS])
3884     x_CFLAGS=
3885 else
3886     AC_MSG_RESULT(no)
3887     x_CFLAGS=[\#]
3889 AC_MSG_CHECKING(for explicit CXXFLAGS)
3890 if test -n "$CXXFLAGS"; then
3891     AC_MSG_RESULT([$CXXFLAGS])
3892     x_CXXFLAGS=
3893 else
3894     AC_MSG_RESULT(no)
3895     x_CXXFLAGS=[\#]
3897 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3898 if test -n "$OBJCFLAGS"; then
3899     AC_MSG_RESULT([$OBJCFLAGS])
3900     x_OBJCFLAGS=
3901 else
3902     AC_MSG_RESULT(no)
3903     x_OBJCFLAGS=[\#]
3905 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
3906 if test -n "$OBJCXXFLAGS"; then
3907     AC_MSG_RESULT([$OBJCXXFLAGS])
3908     x_OBJCXXFLAGS=
3909 else
3910     AC_MSG_RESULT(no)
3911     x_OBJCXXFLAGS=[\#]
3913 AC_MSG_CHECKING(for explicit LDFLAGS)
3914 if test -n "$LDFLAGS"; then
3915     AC_MSG_RESULT([$LDFLAGS])
3916     x_LDFLAGS=
3917 else
3918     AC_MSG_RESULT(no)
3919     x_LDFLAGS=[\#]
3921 AC_SUBST(AFLAGS)
3922 AC_SUBST(CFLAGS)
3923 AC_SUBST(CXXFLAGS)
3924 AC_SUBST(OBJCFLAGS)
3925 AC_SUBST(OBJCXXFLAGS)
3926 AC_SUBST(LDFLAGS)
3927 AC_SUBST(x_AFLAGS)
3928 AC_SUBST(x_CFLAGS)
3929 AC_SUBST(x_CXXFLAGS)
3930 AC_SUBST(x_OBJCFLAGS)
3931 AC_SUBST(x_OBJCXXFLAGS)
3932 AC_SUBST(x_LDFLAGS)
3935 # determine CPUNAME, GUIBASE, ...
3937 SOLARINC=
3939 case "$host_os" in
3941 aix*)
3942     COM=GCC
3943     CPUNAME=POWERPC
3944     GUIBASE=unx
3945     OS=AIX
3946     RTL_OS=AIX
3947     RTL_ARCH=PowerPC
3948     PLATFORMID=aix_powerpc
3949     P_SEP=:
3950     ;;
3952 cygwin*)
3953     COM=MSC
3954     GUIBASE=not-used
3955     OS=WNT
3956     RTL_OS=Windows
3957     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3958         P_SEP=";"
3959     else
3960         P_SEP=:
3961     fi
3962     case "$host_cpu" in
3963     i*86|x86_64)
3964         if test "$BITNESS_OVERRIDE" = 64; then
3965             CPUNAME=X86_64
3966             RTL_ARCH=X86_64
3967             PLATFORMID=windows_x86_64
3968             WINDOWS_X64=1
3969             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3970         else
3971             CPUNAME=INTEL
3972             RTL_ARCH=x86
3973             PLATFORMID=windows_x86
3974         fi
3975         ;;
3976     *)
3977         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3978         ;;
3979     esac
3980     SCPDEFS="$SCPDEFS -D_MSC_VER"
3981     ;;
3983 darwin*)
3984     COM=GCC
3985     GUIBASE=not-used
3986     OS=MACOSX
3987     RTL_OS=MacOSX
3988     P_SEP=:
3990     case "$host_cpu" in
3991     arm*)
3992         CPUNAME=ARM
3993         RTL_ARCH=ARM_EABI
3994         PLATFORMID=ios_arm
3995         OS=IOS
3996         ;;
3997     i*86)
3998         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3999         ;;
4000     x86_64)
4001         CPUNAME=X86_64
4002         RTL_ARCH=X86_64
4003         PLATFORMID=macosx_x86_64
4004         ;;
4005     *)
4006         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4007         ;;
4008     esac
4009     ;;
4011 dragonfly*)
4012     COM=GCC
4013     GUIBASE=unx
4014     OS=DRAGONFLY
4015     RTL_OS=DragonFly
4016     P_SEP=:
4018     case "$host_cpu" in
4019     i*86)
4020         CPUNAME=INTEL
4021         RTL_ARCH=x86
4022         PLATFORMID=dragonfly_x86
4023         ;;
4024     x86_64)
4025         CPUNAME=X86_64
4026         RTL_ARCH=X86_64
4027         PLATFORMID=dragonfly_x86_64
4028         ;;
4029     *)
4030         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4031         ;;
4032     esac
4033     ;;
4035 freebsd*)
4036     COM=GCC
4037     GUIBASE=unx
4038     RTL_OS=FreeBSD
4039     OS=FREEBSD
4040     P_SEP=:
4042     case "$host_cpu" in
4043     i*86)
4044         CPUNAME=INTEL
4045         RTL_ARCH=x86
4046         PLATFORMID=freebsd_x86
4047         ;;
4048     x86_64|amd64)
4049         CPUNAME=X86_64
4050         RTL_ARCH=X86_64
4051         PLATFORMID=freebsd_x86_64
4052         ;;
4053     *)
4054         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4055         ;;
4056     esac
4057     ;;
4059 kfreebsd*)
4060     COM=GCC
4061     GUIBASE=unx
4062     OS=LINUX
4063     RTL_OS=kFreeBSD
4064     P_SEP=:
4066     case "$host_cpu" in
4068     i*86)
4069         CPUNAME=INTEL
4070         RTL_ARCH=x86
4071         PLATFORMID=kfreebsd_x86
4072         ;;
4073     x86_64)
4074         CPUNAME=X86_64
4075         RTL_ARCH=X86_64
4076         PLATFORMID=kfreebsd_x86_64
4077         ;;
4078     *)
4079         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4080         ;;
4081     esac
4082     ;;
4084 linux-gnu*)
4085     COM=GCC
4086     GUIBASE=unx
4087     OS=LINUX
4088     RTL_OS=Linux
4089     P_SEP=:
4091     case "$host_cpu" in
4093     aarch64)
4094         CPUNAME=AARCH64
4095         PLATFORMID=linux_aarch64
4096         RTL_ARCH=AARCH64
4097         ;;
4098     alpha)
4099         CPUNAME=AXP
4100         RTL_ARCH=ALPHA
4101         PLATFORMID=linux_alpha
4102         ;;
4103     arm*)
4104         CPUNAME=ARM
4105         EPM_FLAGS="-a arm"
4106         RTL_ARCH=ARM_EABI
4107         PLATFORMID=linux_arm_eabi
4108         case "$host_cpu" in
4109         arm*-linux)
4110             RTL_ARCH=ARM_OABI
4111             PLATFORMID=linux_arm_oabi
4112             ;;
4113         esac
4114         ;;
4115     hppa)
4116         CPUNAME=HPPA
4117         RTL_ARCH=HPPA
4118         EPM_FLAGS="-a hppa"
4119         PLATFORMID=linux_hppa
4120         ;;
4121     i*86)
4122         CPUNAME=INTEL
4123         RTL_ARCH=x86
4124         PLATFORMID=linux_x86
4125         ;;
4126     ia64)
4127         CPUNAME=IA64
4128         RTL_ARCH=IA64
4129         PLATFORMID=linux_ia64
4130         ;;
4131     mips)
4132         CPUNAME=GODSON
4133         RTL_ARCH=MIPS_EB
4134         EPM_FLAGS="-a mips"
4135         PLATFORMID=linux_mips_eb
4136         ;;
4137     mips64)
4138         CPUNAME=GODSON
4139         RTL_ARCH=MIPS_EB
4140         EPM_FLAGS="-a mips64"
4141         PLATFORMID=linux_mips_eb
4142         ;;
4143     mips64el)
4144         CPUNAME=GODSON
4145         RTL_ARCH=MIPS_EL
4146         EPM_FLAGS="-a mips64el"
4147         PLATFORMID=linux_mips_el
4148         ;;
4149     mipsel)
4150         CPUNAME=GODSON
4151         RTL_ARCH=MIPS_EL
4152         EPM_FLAGS="-a mipsel"
4153         PLATFORMID=linux_mips_el
4154         ;;
4155     m68k)
4156         CPUNAME=M68K
4157         RTL_ARCH=M68K
4158         PLATFORMID=linux_m68k
4159         ;;
4160     powerpc)
4161         CPUNAME=POWERPC
4162         RTL_ARCH=PowerPC
4163         PLATFORMID=linux_powerpc
4164         ;;
4165     powerpc64)
4166         CPUNAME=POWERPC64
4167         RTL_ARCH=PowerPC_64
4168         PLATFORMID=linux_powerpc64
4169         ;;
4170     powerpc64le)
4171         CPUNAME=POWERPC64
4172         RTL_ARCH=PowerPC_64_LE
4173         PLATFORMID=linux_powerpc64_le
4174         ;;
4175     sparc)
4176         CPUNAME=SPARC
4177         RTL_ARCH=SPARC
4178         PLATFORMID=linux_sparc
4179         ;;
4180     s390)
4181         CPUNAME=S390
4182         RTL_ARCH=S390
4183         PLATFORMID=linux_s390
4184         ;;
4185     s390x)
4186         CPUNAME=S390X
4187         RTL_ARCH=S390x
4188         PLATFORMID=linux_s390x
4189         ;;
4190     x86_64)
4191         CPUNAME=X86_64
4192         RTL_ARCH=X86_64
4193         PLATFORMID=linux_x86_64
4194         ;;
4195     *)
4196         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4197         ;;
4198     esac
4199     ;;
4201 linux-android*)
4202     COM=GCC
4203     GUIBASE=not-used
4204     OS=ANDROID
4205     RTL_OS=Android
4206     P_SEP=:
4208     case "$host_cpu" in
4210     arm|armel)
4211         CPUNAME=ARM
4212         RTL_ARCH=ARM_EABI
4213         PLATFORMID=android_arm_eabi
4214         ;;
4215     aarch64)
4216         CPUNAME=AARCH64
4217         RTL_ARCH=AARCH64
4218         PLATFORMID=android_aarch64
4219         ;;
4220     mips|mipsel)
4221         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4222         RTL_ARCH=MIPS_EL
4223         PLATFORMID=android_mips_el
4224         ;;
4225     i*86)
4226         CPUNAME=INTEL
4227         RTL_ARCH=x86
4228         PLATFORMID=android_x86
4229         ;;
4230     *)
4231         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4232         ;;
4233     esac
4234     ;;
4236 mingw*)
4237     COM=GCC
4238     GUIBASE=not-used
4239     OS=WNT
4240     RTL_OS=Windows
4241     P_SEP=:
4243     case "$host_cpu" in
4244     i*86|x86_64)
4245         if test "$BITNESS_OVERRIDE" = 64; then
4246             CPUNAME=X86_64
4247             RTL_ARCH=X86_84
4248             PLATFORMID=windows_x86_64
4249             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4250         else
4251             CPUNAME=INTEL
4252             RTL_ARCH=x86
4253             PLATFORMID=windows_x86
4254             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4255         fi
4256         ;;
4257     *)
4258         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4259         ;;
4260     esac
4261     ;;
4263 *netbsd*)
4265     COM=GCC
4266     GUIBASE=unx
4267     OS=NETBSD
4268     RTL_OS=NetBSD
4269     P_SEP=:
4271     case "$host_cpu" in
4272     i*86)
4273         CPUNAME=INTEL
4274         RTL_ARCH=x86
4275         PLATFORMID=netbsd_x86
4276         ;;
4277     powerpc)
4278         CPUNAME=POWERPC
4279         RTL_ARCH=PowerPC
4280         PLATFORMID=netbsd_powerpc
4281         ;;
4282     sparc)
4283         CPUNAME=SPARC
4284         RTL_ARCH=SPARC
4285         PLATFORMID=netbsd_sparc
4286         ;;
4287     x86_64)
4288         CPUNAME=X86_64
4289         RTL_ARCH=X86_64
4290         PLATFORMID=netbsd_x86_64
4291         ;;
4292     *)
4293         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4294         ;;
4295     esac
4296     ;;
4298 openbsd*)
4299     COM=GCC
4300     GUIBASE=unx
4301     OS=OPENBSD
4302     RTL_OS=OpenBSD
4303     P_SEP=:
4305     case "$host_cpu" in
4306     i*86)
4307         CPUNAME=INTEL
4308         RTL_ARCH=x86
4309         PLATFORMID=openbsd_x86
4310         ;;
4311     x86_64)
4312         CPUNAME=X86_64
4313         RTL_ARCH=X86_64
4314         PLATFORMID=openbsd_x86_64
4315         ;;
4316     *)
4317         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4318         ;;
4319     esac
4320     SOLARINC="$SOLARINC -I/usr/local/include"
4321     ;;
4323 solaris*)
4325     COM=GCC
4326     GUIBASE=unx
4327     OS=SOLARIS
4328     RTL_OS=Solaris
4329     P_SEP=:
4331     case "$host_cpu" in
4332     i*86)
4333         CPUNAME=INTEL
4334         RTL_ARCH=x86
4335         PLATFORMID=solaris_x86
4336         ;;
4337     sparc)
4338         CPUNAME=SPARC
4339         RTL_ARCH=SPARC
4340         PLATFORMID=solaris_sparc
4341         ;;
4342     sparc64)
4343         CPUNAME=SPARC64
4344         RTL_ARCH=SPARC64
4345         PLATFORMID=solaris_sparc64
4346         ;;
4347     *)
4348         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4349         ;;
4350     esac
4351     SOLARINC="$SOLARINC -I/usr/local/include"
4352     ;;
4355     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4356     ;;
4357 esac
4359 if test "$with_x" = "no"; then
4360     if test "$GUIBASE" != "unx"; then
4361         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --without-x])
4362     fi
4363     GUIBASE=not-used
4366 WORKDIR="${BUILDDIR}/workdir"
4367 INSTDIR="${BUILDDIR}/instdir"
4368 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4369 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4370 AC_SUBST(COM)
4371 AC_SUBST(CPUNAME)
4372 AC_SUBST(RTL_OS)
4373 AC_SUBST(RTL_ARCH)
4374 AC_SUBST(EPM_FLAGS)
4375 AC_SUBST(GUIBASE)
4376 AC_SUBST([INSTDIR])
4377 AC_SUBST([INSTROOT])
4378 AC_SUBST(OS)
4379 AC_SUBST(P_SEP)
4380 AC_SUBST(WORKDIR)
4381 AC_SUBST(PLATFORMID)
4382 AC_SUBST(WINDOWS_X64)
4383 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4385 dnl ===================================================================
4386 dnl Test which package format to use
4387 dnl ===================================================================
4388 AC_MSG_CHECKING([which package format to use])
4389 if test -n "$with_package_format" -a "$with_package_format" != no; then
4390     for i in $with_package_format; do
4391         case "$i" in
4392         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4393             ;;
4394         *)
4395             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4396 aix - AIX software distribution
4397 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4398 deb - Debian software distribution
4399 pkg - Solaris software distribution
4400 rpm - RedHat software distribution
4402 LibreOffice additionally supports:
4403 archive - .tar.gz or .zip
4404 dmg - Mac OS X .dmg
4405 installed - installation tree
4406 msi - Windows .msi
4407         ])
4408             ;;
4409         esac
4410     done
4411     PKGFORMAT="$with_package_format"
4412     AC_MSG_RESULT([$PKGFORMAT])
4413 else
4414     PKGFORMAT=
4415     AC_MSG_RESULT([none])
4417 AC_SUBST(PKGFORMAT)
4419 dnl ===================================================================
4420 dnl Set up a different compiler to produce tools to run on the build
4421 dnl machine when doing cross-compilation
4422 dnl ===================================================================
4424 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4425 if test "$cross_compiling" = "yes"; then
4426     AC_MSG_CHECKING([for BUILD platform configuration])
4427     echo
4428     rm -rf CONF-FOR-BUILD config_build.mk
4429     mkdir CONF-FOR-BUILD
4430     # Here must be listed all files needed when running the configure script. In particular, also
4431     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4432     # keep them in the same order as there.
4433     (cd $SRC_ROOT && tar cf - \
4434         config.guess \
4435         bin/get_config_variables \
4436         solenv/bin/getcompver.awk \
4437         solenv/inc/langlist.mk \
4438         config_host.mk.in \
4439         Makefile.in \
4440         lo.xcent.in \
4441         instsetoo_native/util/openoffice.lst.in \
4442         config_host/*.in \
4443         sysui/desktop/macosx/Info.plist.in \
4444         ios/lo.xcconfig.in) \
4445     | (cd CONF-FOR-BUILD && tar xf -)
4446     cp configure CONF-FOR-BUILD
4447     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4448     (
4449     unset COM GUIBASE OS CPUNAME
4450     unset CC CXX SYSBASE CFLAGS
4451     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4452     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4453     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4454     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4455     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4456     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4457     cd CONF-FOR-BUILD
4458     sub_conf_opts=""
4459     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4460     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4461     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4462     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4463     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4464     # we need the msi build tools on mingw if we are creating the
4465     # installation set
4466     if test "$WITH_MINGW" = "yes"; then
4467         enable_winegcc_for_build=
4468         for pkgformat in $PKGFORMAT; do
4469             case "$pkgformat" in
4470             msi|native) enable_winegcc_for_build=yes ;;
4471             esac
4472         done
4473         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4474     fi
4475     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4476     # Don't bother having configure look for stuff not needed for the build platform anyway
4477     ./configure \
4478         --disable-cups \
4479         --disable-graphite \
4480         --disable-pdfimport \
4481         --disable-postgresql-sdbc \
4482         --with-parallelism="$with_parallelism" \
4483         --without-doxygen \
4484         --without-java \
4485         $sub_conf_opts \
4486         --srcdir=$srcdir \
4487         2>&1 | sed -e 's/^/    /'
4488     test -f ./config_host.mk 2>/dev/null || exit
4489     cp config_host.mk ../config_build.mk
4490     mv config.log ../config.Build.log
4491     mkdir -p ../config_build
4492     mv config_host/*.h ../config_build
4493     . ./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
4495     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
4496         VV='$'$V
4497         VV=`eval "echo $VV"`
4498         if test -n "$VV"; then
4499             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4500             echo "$line" >>build-config
4501         fi
4502     done
4504     for V in INSTDIR INSTROOT WORKDIR; do
4505         VV='$'$V
4506         VV=`eval "echo $VV"`
4507         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4508         if test -n "$VV"; then
4509             line="${V}_FOR_BUILD='$VV'"
4510             echo "$line" >>build-config
4511         fi
4512     done
4514     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4515     echo "$line" >>build-config
4517     )
4518     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4519     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])
4520     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4521              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4523     eval `cat CONF-FOR-BUILD/build-config`
4525     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4527     rm -rf CONF-FOR-BUILD
4528 else
4529     OS_FOR_BUILD="$OS"
4530     CC_FOR_BUILD="$CC"
4531     CXX_FOR_BUILD="$CXX"
4532     INSTDIR_FOR_BUILD="$INSTDIR"
4533     INSTROOT_FOR_BUILD="$INSTROOT"
4534     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4535     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4536     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4537     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4538     WORKDIR_FOR_BUILD="$WORKDIR"
4540 AC_SUBST(OS_FOR_BUILD)
4541 AC_SUBST(INSTDIR_FOR_BUILD)
4542 AC_SUBST(INSTROOT_FOR_BUILD)
4543 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4544 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4545 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4546 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4547 AC_SUBST(WORKDIR_FOR_BUILD)
4549 dnl ===================================================================
4550 dnl Check for syslog header
4551 dnl ===================================================================
4552 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4554 # placeholder for future crash reporter feature
4555 ENABLE_CRASHDUMP=""
4556 AC_SUBST(ENABLE_CRASHDUMP)
4558 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4559 dnl ===================================================================
4560 AC_MSG_CHECKING([whether to turn warnings to errors])
4561 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4562     ENABLE_WERROR="TRUE"
4563     AC_MSG_RESULT([yes])
4564 else
4565     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4566         ENABLE_WERROR="TRUE"
4567         AC_MSG_RESULT([yes])
4568     else
4569         AC_MSG_RESULT([no])
4570     fi
4572 AC_SUBST(ENABLE_WERROR)
4574 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4575 dnl ===================================================================
4576 AC_MSG_CHECKING([whether to have assert to abort in release code])
4577 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4578     ASSERT_ALWAYS_ABORT="TRUE"
4579     AC_MSG_RESULT([yes])
4580 else
4581     ASSERT_ALWAYS_ABORT="FALSE"
4582     AC_MSG_RESULT([no])
4584 AC_SUBST(ASSERT_ALWAYS_ABORT)
4586 # Determine whether to use ooenv for the instdir installation
4587 # ===================================================================
4588 if test $_os != "WINNT" -a $_os != "Darwin"; then
4589     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4590     if test "$enable_ooenv" = "no"; then
4591         AC_MSG_RESULT([no])
4592     else
4593         ENABLE_OOENV="TRUE"
4594         AC_MSG_RESULT([yes])
4595     fi
4597 AC_SUBST(ENABLE_OOENV)
4599 if test "$with_x" = "no"; then
4600     # be sure to do not mess with uneeded stuff
4601     test_randr=no
4602     test_xrender=no
4603     test_cups=no
4604     test_dbus=no
4605     test_fontconfig=yes
4606     test_gtk=no
4607     build_gstreamer_1_0=no
4608     build_gstreamer_0_10=no
4609     test_tde=no
4610     test_kde=no
4611     test_kde4=no
4612     enable_cairo_canvas=no
4613     enable_gnome_vfs=no
4616 dnl ===================================================================
4617 dnl check for cups support
4618 dnl ===================================================================
4619 ENABLE_CUPS=""
4621 if test "$enable_cups" = "no"; then
4622     test_cups=no
4625 AC_MSG_CHECKING([whether to enable CUPS support])
4626 if test "$test_cups" = "yes"; then
4627     ENABLE_CUPS="TRUE"
4628     AC_MSG_RESULT([yes])
4630     AC_MSG_CHECKING([whether cups support is present])
4631     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4632     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4633     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4634         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4635     fi
4637 else
4638     AC_MSG_RESULT([no])
4641 AC_SUBST(ENABLE_CUPS)
4643 # fontconfig checks
4644 if test "$test_fontconfig" = "yes"; then
4645     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4646     SYSTEM_FONTCONFIG=TRUE
4648 AC_SUBST(FONTCONFIG_CFLAGS)
4649 AC_SUBST(FONTCONFIG_LIBS)
4650 AC_SUBST([SYSTEM_FONTCONFIG])
4652 dnl whether to find & fetch external tarballs?
4653 dnl ===================================================================
4654 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4655    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4656        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4657    else
4658        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4659    fi
4661 if test -z "$TARFILE_LOCATION"; then
4662     if test -d "$SRC_ROOT/src" ; then
4663         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4664         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4665     fi
4666     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4667 else
4668     AbsolutePath "$TARFILE_LOCATION"
4669     PathFormat "${absolute_path}"
4670     TARFILE_LOCATION="${formatted_path}"
4672 AC_SUBST(TARFILE_LOCATION)
4674 AC_MSG_CHECKING([whether we want to fetch tarballs])
4675 if test "$enable_fetch_external" != "no"; then
4676     if test "$with_all_tarballs" = "yes"; then
4677         AC_MSG_RESULT(["yes, all of them"])
4678         DO_FETCH_TARBALLS="ALL"
4679     else
4680         AC_MSG_RESULT(["yes, if we use them"])
4681         DO_FETCH_TARBALLS="TRUE"
4682     fi
4683 else
4684     AC_MSG_RESULT([no])
4685     DO_FETCH_TARBALLS=
4687 AC_SUBST(DO_FETCH_TARBALLS)
4689 AC_MSG_CHECKING([whether to build help])
4690 HELP_COMMON_ONLY=FALSE
4691 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4692     BUILD_TYPE="$BUILD_TYPE HELP"
4693     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4694     if test "$with_help" = "common" ; then
4695         HELP_COMMON_ONLY=TRUE
4696         AC_MSG_RESULT([common only])
4697     else
4698         SCPDEFS="$SCPDEFS -DWITH_HELP"
4699         AC_MSG_RESULT([yes])
4700     fi
4701 else
4702     AC_MSG_RESULT([no])
4704 AC_SUBST(HELP_COMMON_ONLY)
4706 dnl Test whether to include MySpell dictionaries
4707 dnl ===================================================================
4708 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4709 if test "$with_myspell_dicts" = "yes"; then
4710     AC_MSG_RESULT([yes])
4711     WITH_MYSPELL_DICTS=TRUE
4712     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4713     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4714 else
4715     AC_MSG_RESULT([no])
4716     WITH_MYSPELL_DICTS=
4718 AC_SUBST(WITH_MYSPELL_DICTS)
4720 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4721 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4722     if test "$with_system_dicts" = yes; then
4723         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4724     fi
4725     with_system_dicts=no
4728 AC_MSG_CHECKING([whether to use dicts from external paths])
4729 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4730     AC_MSG_RESULT([yes])
4731     SYSTEM_DICTS=TRUE
4732     AC_MSG_CHECKING([for spelling dictionary directory])
4733     if test -n "$with_external_dict_dir"; then
4734         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4735     else
4736         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4737         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4738             DICT_SYSTEM_DIR=file:///usr/share/myspell
4739         fi
4740     fi
4741     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4742     AC_MSG_CHECKING([for hyphenation patterns directory])
4743     if test -n "$with_external_hyph_dir"; then
4744         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4745     else
4746         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4747     fi
4748     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4749     AC_MSG_CHECKING([for thesaurus directory])
4750     if test -n "$with_external_thes_dir"; then
4751         THES_SYSTEM_DIR=file://$with_external_thes_dir
4752     else
4753         THES_SYSTEM_DIR=file:///usr/share/mythes
4754     fi
4755     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4756 else
4757     AC_MSG_RESULT([no])
4758     SYSTEM_DICTS=
4760 AC_SUBST(SYSTEM_DICTS)
4761 AC_SUBST(DICT_SYSTEM_DIR)
4762 AC_SUBST(HYPH_SYSTEM_DIR)
4763 AC_SUBST(THES_SYSTEM_DIR)
4765 dnl ===================================================================
4766 AC_MSG_CHECKING([whether to enable pch feature])
4767 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
4768     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4769         ENABLE_PCH="TRUE"
4770         AC_MSG_RESULT([yes])
4771     elif test "$GCC" = "yes"; then
4772         ENABLE_PCH="TRUE"
4773         AC_MSG_RESULT([yes])
4774     else
4775         ENABLE_PCH=""
4776         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4777     fi
4778 else
4779     ENABLE_PCH=""
4780     AC_MSG_RESULT([no])
4782 AC_SUBST(ENABLE_PCH)
4784 TAB=`printf '\t'`
4786 AC_MSG_CHECKING([the GNU Make version])
4787 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4788 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4789 if test "$_make_longver" -ge "038200"; then
4790     AC_MSG_RESULT([$GNUMAKE $_make_version])
4792 elif test "$_make_longver" -ge "038100"; then
4793     if test "$build_os" = "cygwin"; then
4794         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4795     fi
4796     AC_MSG_RESULT([$GNUMAKE $_make_version])
4798     dnl ===================================================================
4799     dnl Search all the common names for sha1sum
4800     dnl ===================================================================
4801     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4802     if test -z "$SHA1SUM"; then
4803         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4804     elif test "$SHA1SUM" = "openssl"; then
4805         SHA1SUM="openssl sha1"
4806     fi
4807     AC_MSG_CHECKING([for GNU Make bug 20033])
4808     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4809     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4810 A := \$(wildcard *.a)
4812 .PHONY: all
4813 all: \$(A:.a=.b)
4814 <TAB>@echo survived bug20033.
4816 .PHONY: setup
4817 setup:
4818 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4820 define d1
4821 @echo lala \$(1)
4822 @sleep 1
4823 endef
4825 define d2
4826 @echo tyty \$(1)
4827 @sleep 1
4828 endef
4830 %.b : %.a
4831 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4832 <TAB>\$(call d1,\$(CHECKSUM)),\
4833 <TAB>\$(call d2,\$(CHECKSUM)))
4835     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4836         no_parallelism_make="YES"
4837         AC_MSG_RESULT([yes, disable parallelism])
4838     else
4839         AC_MSG_RESULT([no, keep parallelism enabled])
4840     fi
4841     rm -rf $TESTGMAKEBUG20033
4842 else
4843     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4846 # find if gnumake support file function
4847 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4848 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4849 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4850     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4852 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4853 \$(file >test.txt,Success )
4855 .PHONY: all
4856 all:
4857 <TAB>@cat test.txt
4860 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4861 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4862     HAVE_GNUMAKE_FILE_FUNC=TRUE
4863     AC_MSG_RESULT([yes])
4864 else
4865     AC_MSG_RESULT([no])
4867 rm -rf $TESTGMAKEFILEFUNC
4868 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4869 AC_SUBST(GNUMAKE_WIN_NATIVE)
4871 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4872 STALE_MAKE=
4873 if test "$_make_ver_check" = ""; then
4874    STALE_MAKE=TRUE
4877 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4878     SHELL_BASH=$(cygpath -m $(which bash))
4879 else
4880     SHELL_BASH=`which bash`
4882 AC_SUBST(SHELL_BASH)
4884 HAVE_LD_HASH_STYLE=FALSE
4885 WITH_LINKER_HASH_STYLE=
4886 AC_MSG_CHECKING( for --hash-style gcc linker support )
4887 if test "$GCC" = "yes"; then
4888     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4889         hash_styles="gnu sysv"
4890     elif test "$with_linker_hash_style" = "no"; then
4891         hash_styles=
4892     else
4893         hash_styles="$with_linker_hash_style"
4894     fi
4896     for hash_style in $hash_styles; do
4897         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4898         hash_style_ldflags_save=$LDFLAGS
4899         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4901         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4902             [
4903 #include <stdio.h>
4904             ],[
4905 printf ("");
4906             ])],
4907             [
4908                   HAVE_LD_HASH_STYLE=TRUE
4909                   WITH_LINKER_HASH_STYLE=$hash_style
4910             ],
4911             [HAVE_LD_HASH_STYLE=FALSE],
4912             [HAVE_LD_HASH_STYLE=FALSE])
4913         LDFLAGS=$hash_style_ldflags_save
4914     done
4916     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4917         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4918     else
4919         AC_MSG_RESULT( no )
4920     fi
4921     LDFLAGS=$hash_style_ldflags_save
4922 else
4923     AC_MSG_RESULT( no )
4925 AC_SUBST(HAVE_LD_HASH_STYLE)
4926 AC_SUBST(WITH_LINKER_HASH_STYLE)
4928 dnl ===================================================================
4929 dnl Check whether there's a Perl version available.
4930 dnl ===================================================================
4931 if test -z "$with_perl_home"; then
4932     AC_PATH_PROG(PERL, perl)
4933 else
4934     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4935     _perl_path="$with_perl_home/bin/perl"
4936     if test -x "$_perl_path"; then
4937         PERL=$_perl_path
4938     else
4939         AC_MSG_ERROR([$_perl_path not found])
4940     fi
4943 dnl ===================================================================
4944 dnl Testing for Perl version 5 or greater.
4945 dnl $] is the Perl version variable, it is returned as an integer
4946 dnl ===================================================================
4947 if test "$PERL"; then
4948     AC_MSG_CHECKING([the Perl version])
4949     ${PERL} -e "exit($]);"
4950     _perl_version=$?
4951     if test "$_perl_version" -lt 5; then
4952         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
4953     fi
4954     AC_MSG_RESULT([checked (perl $_perl_version)])
4955 else
4956     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
4959 dnl ===================================================================
4960 dnl Testing for required Perl modules
4961 dnl ===================================================================
4963 AC_MSG_CHECKING([for required Perl modules])
4964 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
4965     AC_MSG_RESULT([all modules found])
4966 else
4967     AC_MSG_RESULT([failed to find some modules])
4968     # Find out which modules are missing.
4969     missing_perl_modules=
4970     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
4971         missing_perl_modules=Archive::Zip
4972     fi
4973     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
4974         missing_perl_modules="$missing_perl_modules Cwd"
4975     fi
4976     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
4977         missing_perl_modules="$missing_perl_modules Digest::MD5"
4978     fi
4979        AC_MSG_ERROR([
4980     The missing Perl modules are: $missing_perl_modules
4981     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
4984 dnl ===================================================================
4985 dnl Check for pkg-config
4986 dnl ===================================================================
4987 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4988     PKG_PROG_PKG_CONFIG
4991 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4993     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4994     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4995     # explicitly. Or put /path/to/compiler in PATH yourself.
4997     AC_CHECK_TOOL(AR,ar)
4998     AC_CHECK_TOOL(NM,nm)
4999     AC_CHECK_TOOL(OBJDUMP,objdump)
5000     AC_CHECK_TOOL(RANLIB,ranlib)
5001     AC_CHECK_TOOL(READELF,readelf)
5002     AC_CHECK_TOOL(STRIP,strip)
5003     if test "$_os" = "WINNT"; then
5004         AC_CHECK_TOOL(DLLTOOL,dlltool)
5005         AC_CHECK_TOOL(WINDRES,windres)
5006     fi
5008 AC_SUBST(AR)
5009 AC_SUBST(DLLTOOL)
5010 AC_SUBST(NM)
5011 AC_SUBST(OBJDUMP)
5012 AC_SUBST(PKG_CONFIG)
5013 AC_SUBST(RANLIB)
5014 AC_SUBST(READELF)
5015 AC_SUBST(STRIP)
5016 AC_SUBST(WINDRES)
5018 dnl ===================================================================
5019 dnl pkg-config checks on Mac OS X
5020 dnl ===================================================================
5022 if test $_os = Darwin; then
5023     AC_MSG_CHECKING([for bogus pkg-config])
5024     if test -n "$PKG_CONFIG"; then
5025         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5026             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5027         else
5028             if test "$enable_bogus_pkg_config" = "yes"; then
5029                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5030             else
5031                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
5032             fi
5033         fi
5034     else
5035         AC_MSG_RESULT([no, good])
5036     fi
5039 find_csc()
5041     # Return value: $csctest
5043     unset csctest
5045     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5046     if test -n "$regvalue"; then
5047         csctest=$regvalue
5048         return
5049     fi
5052 find_al()
5054     # Return value: $altest
5056     unset altest
5058     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5059         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5060         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5061             altest=$regvalue
5062             return
5063         fi
5064     done
5067 find_dotnetsdk()
5069     # Return value: $frametest (that's a silly name...)
5071     unset frametest
5073     for ver in 1.1 2.0; do
5074         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5075         if test -n "$regvalue"; then
5076             frametest=$regvalue
5077             return
5078         fi
5079     done
5082 find_winsdk_version()
5084     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5085     # Return values: $winsdktest, $winsdklibsubdir
5087     unset winsdktest winsdklibsubdir
5089     # Why we look for them in this particular order I don't know. But OTOH I
5090     case "$1" in
5091     6.0*|7.*)
5092         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5093         if test -n "$regvalue"; then
5094             winsdktest=$regvalue
5095             winsdklibsubdir=.
5096             return
5097         fi
5098         ;;
5099     8.1)
5100         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5101         if test -n "$regvalue"; then
5102             winsdktest=$regvalue
5103             winsdklibsubdir=winv6.3
5104             return
5105         fi
5106         ;;
5107     8.*)
5108         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5109         if test -n "$regvalue"; then
5110             winsdktest=$regvalue
5111             winsdklibsubdir=win8
5112             return
5113         fi
5114         ;;
5115     esac
5118 find_winsdk()
5120     # Args: $1 (optional) : list of acceptable SDK versions
5121     # Return value: $winsdktest
5123     unset winsdktest
5125     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5126         find_winsdk_version $ver
5127         if test -n "$winsdktest"; then
5128             return
5129         fi
5130     done
5133 find_msms()
5135     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5136     AC_MSG_CHECKING([for $my_msm_file])
5137     msmdir=
5138     for ver in 12.0; do
5139         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5140         if test -n "$regvalue"; then
5141             if test -e "$regvalue/$my_msm_file"; then
5142                 msmdir=$regvalue
5143                 break
5144             fi
5145         fi
5146     done
5147     dnl Is the following fallback really necessary, or was it added in response
5148     dnl to never having started Visual Studio on a given machine, so the
5149     dnl registry keys checked above had presumably not yet been created?
5150     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5151     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5152     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5153     dnl expanding to "C:\Program Files\Common Files"), which would need
5154     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5155     dnl obtain its value from cygwin:
5156     if test -z "$msmdir"; then
5157         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules"
5158         if test -e "$my_msm_dir/$my_msm_file"; then
5159             msmdir=$my_msm_dir
5160         fi
5161     fi
5162     if test -n "$msmdir"; then
5163         msmdir=`cygpath -m "$msmdir"`
5164         AC_MSG_RESULT([$msmdir])
5165     else
5166         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5167             AC_MSG_ERROR([not found])
5168         else
5169             AC_MSG_WARN([not found])
5170         fi
5171     fi
5174 find_msvc_x64_dlls()
5176     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5177     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5178     for dll in $msvcdlls; do
5179         if ! test -f "$msvcdllpath/$dll"; then
5180             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5181         fi
5182     done
5185 if test "$build_os" = "cygwin"; then
5186     dnl Check midl.exe
5187     AC_MSG_CHECKING([for midl.exe])
5189     find_winsdk
5190     if test -f "$winsdktest/Bin/midl.exe"; then
5191         MIDL_PATH="$winsdktest/Bin"
5192     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5193         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5194     fi
5195     if test ! -f "$MIDL_PATH/midl.exe"; then
5196         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5197     else
5198         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5199     fi
5201     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5202     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5204     dnl Check csc.exe
5205     AC_MSG_CHECKING([for csc.exe])
5206     find_csc
5207     if test -f "$csctest/csc.exe"; then
5208         CSC_PATH="$csctest"
5209     fi
5210     if test ! -f "$CSC_PATH/csc.exe"; then
5211         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5212     else
5213         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5214     fi
5216     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5218     dnl Check al.exe
5219     AC_MSG_CHECKING([for al.exe])
5220     find_winsdk
5221     if test -f "$winsdktest/Bin/al.exe"; then
5222         AL_PATH="$winsdktest/Bin"
5223     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5224         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5225     fi
5227     if test -z "$AL_PATH"; then
5228         find_al
5229         if test -f "$altest/bin/al.exe"; then
5230             AL_PATH="$altest/bin"
5231         elif test -f "$altest/al.exe"; then
5232             AL_PATH="$altest"
5233         fi
5234     fi
5235     if test ! -f "$AL_PATH/al.exe"; then
5236         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5237     else
5238         AC_MSG_RESULT([$AL_PATH/al.exe])
5239     fi
5241     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5243     dnl Check mscoree.lib / .NET Framework dir
5244     AC_MSG_CHECKING(.NET Framework)
5245     find_dotnetsdk
5246     if test -f "$frametest/lib/mscoree.lib"; then
5247         DOTNET_FRAMEWORK_HOME="$frametest"
5248     else
5249         find_winsdk
5250         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5251             DOTNET_FRAMEWORK_HOME="$winsdktest"
5252         fi
5253     fi
5255     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5256         AC_MSG_ERROR([mscoree.lib not found])
5257     fi
5258     AC_MSG_RESULT(found)
5260     PathFormat "$MIDL_PATH"
5261     MIDL_PATH="$formatted_path"
5263     PathFormat "$AL_PATH"
5264     AL_PATH="$formatted_path"
5266     PathFormat "$DOTNET_FRAMEWORK_HOME"
5267     DOTNET_FRAMEWORK_HOME="$formatted_path"
5269     PathFormat "$CSC_PATH"
5270     CSC_PATH="$formatted_path"
5273 dnl ===================================================================
5274 dnl Check if stdc headers are available excluding MSVC.
5275 dnl ===================================================================
5276 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5277     AC_HEADER_STDC
5280 dnl ===================================================================
5281 dnl Testing for C++ compiler and version...
5282 dnl ===================================================================
5284 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5285     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5286     save_CXXFLAGS=$CXXFLAGS
5287     AC_PROG_CXX
5288     CXXFLAGS=$save_CXXFLAGS
5289 else
5290     if test -n "$CC" -a -z "$CXX"; then
5291         CXX="$CC"
5292     fi
5295 dnl check for GNU C++ compiler version
5296 if test "$GXX" = "yes"; then
5297     AC_MSG_CHECKING([the GNU C++ compiler version])
5299     _gpp_version=`$CXX -dumpversion`
5300     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5302     if test "$_gpp_majmin" -lt "401"; then
5303         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5304     else
5305         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5306     fi
5308     dnl see https://code.google.com/p/android/issues/detail?id=41770
5309     if test "$_gpp_majmin" -ge "401"; then
5310         glibcxx_threads=no
5311         AC_LANG_PUSH([C++])
5312         AC_REQUIRE_CPP
5313         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5314         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5315             #include <bits/c++config.h>]],[[
5316             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5317             && !defined(_GLIBCXX__PTHREADS) \
5318             && !defined(_GLIBCXX_HAS_GTHREADS)
5319             choke me
5320             #endif
5321         ]])],[AC_MSG_RESULT([yes])
5322         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5323         AC_LANG_POP([C++])
5324         if test $glibcxx_threads = yes; then
5325             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5326         fi
5327      fi
5329 AC_SUBST(BOOST_CXXFLAGS)
5332 # prefx CXX with ccache if needed
5334 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5335     if test "$CCACHE" != ""; then
5336         AC_MSG_CHECKING([whether $CXX is already ccached])
5337         AC_LANG_PUSH([C++])
5338         save_CXXFLAGS=$CXXFLAGS
5339         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5340         dnl an empty program will do, we're checking the compiler flags
5341         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5342                           [use_ccache=yes], [use_ccache=no])
5343         if test $use_ccache = yes; then
5344             AC_MSG_RESULT([yes])
5345         else
5346             CXX="$CCACHE $CXX"
5347             AC_MSG_RESULT([no])
5348         fi
5349         CXXFLAGS=$save_CXXFLAGS
5350         AC_LANG_POP([C++])
5351     fi
5354 dnl ===================================================================
5355 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5356 dnl ===================================================================
5358 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5359     AC_PROG_CXXCPP
5361     dnl Check whether there's a C pre-processor.
5362     AC_PROG_CPP
5366 dnl ===================================================================
5367 dnl Find integral type sizes and alignments
5368 dnl ===================================================================
5370 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5372     AC_CHECK_SIZEOF(long)
5373     AC_CHECK_SIZEOF(short)
5374     AC_CHECK_SIZEOF(int)
5375     AC_CHECK_SIZEOF(long long)
5376     AC_CHECK_SIZEOF(double)
5377     AC_CHECK_SIZEOF(void*)
5379     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5380     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5381     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5382     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5383     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5385     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5386     m4_pattern_allow([AC_CHECK_ALIGNOF])
5387     m4_ifdef([AC_CHECK_ALIGNOF],
5388         [
5389             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5390             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5391             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5392             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5393         ],
5394         [
5395             case "$_os-$host_cpu" in
5396             Linux-i686)
5397                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5398                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5399                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5400                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5401                 ;;
5402             Linux-x86_64)
5403                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5404                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5405                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5406                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5407                 ;;
5408             *)
5409                 if test -z "$ac_cv_alignof_short" -o \
5410                         -z "$ac_cv_alignof_int" -o \
5411                         -z "$ac_cv_alignof_long" -o \
5412                         -z "$ac_cv_alignof_double"; then
5413                    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.])
5414                 fi
5415                 ;;
5416             esac
5417         ])
5419     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5420     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5421     if test $ac_cv_sizeof_long -eq 8; then
5422         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5423     elif test $ac_cv_sizeof_double -eq 8; then
5424         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5425     else
5426         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5427     fi
5429     dnl Check for large file support
5430     AC_SYS_LARGEFILE
5431     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5432         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5433     fi
5434     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5435         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5436     fi
5437 else
5438     # Hardcode for MSVC
5439     SAL_TYPES_SIZEOFSHORT=2
5440     SAL_TYPES_SIZEOFINT=4
5441     SAL_TYPES_SIZEOFLONG=4
5442     SAL_TYPES_SIZEOFLONGLONG=8
5443     if test "$BITNESS_OVERRIDE" = ""; then
5444         SAL_TYPES_SIZEOFPOINTER=4
5445     else
5446         SAL_TYPES_SIZEOFPOINTER=8
5447     fi
5448     SAL_TYPES_ALIGNMENT2=2
5449     SAL_TYPES_ALIGNMENT4=4
5450     SAL_TYPES_ALIGNMENT8=8
5451     LFS_CFLAGS=''
5453 AC_SUBST(LFS_CFLAGS)
5455 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5456 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5457 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5458 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5459 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5460 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5461 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5462 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5464 dnl ===================================================================
5465 dnl Check whether to enable runtime optimizations
5466 dnl ===================================================================
5467 ENABLE_RUNTIME_OPTIMIZATIONS=
5468 AC_MSG_CHECKING([whether to enable runtime optimizations])
5469 if test -z "$enable_runtime_optimizations"; then
5470     for i in $CC; do
5471         case $i in
5472         -fsanitize=*)
5473             enable_runtime_optimizations=no
5474             break
5475             ;;
5476         esac
5477     done
5479 if test "$enable_runtime_optimizations" != no; then
5480     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5481     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5482     AC_MSG_RESULT([yes])
5483 else
5484     AC_MSG_RESULT([no])
5486 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5488 dnl ===================================================================
5489 dnl Check if valgrind headers are available
5490 dnl ===================================================================
5491 ENABLE_VALGRIND=
5492 if test "$cross_compiling" != yes; then
5493     prev_cppflags=$CPPFLAGS
5494     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5495     # or where does it come from?
5496     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5497     AC_CHECK_HEADER([valgrind/valgrind.h],
5498         [ENABLE_VALGRIND=TRUE])
5499     CPPFLAGS=$prev_cppflags
5501 AC_SUBST([ENABLE_VALGRIND])
5502 if test -z "$ENABLE_VALGRIND"; then
5503     VALGRIND_CFLAGS=
5505 AC_SUBST([VALGRIND_CFLAGS])
5508 dnl ===================================================================
5509 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5510 dnl ===================================================================
5512 # We need at least the sys/sdt.h include header.
5513 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5514 if test "$SDT_H_FOUND" = "TRUE"; then
5515     # Found sys/sdt.h header, now make sure the c++ compiler works.
5516     # Old g++ versions had problems with probes in constructors/destructors.
5517     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5518     AC_LANG_PUSH([C++])
5519     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5520     #include <sys/sdt.h>
5521     class ProbeClass
5522     {
5523     private:
5524       int& ref;
5525       const char *name;
5527     public:
5528       ProbeClass(int& v, const char *n) : ref(v), name(n)
5529       {
5530         DTRACE_PROBE2(_test_, cons, name, ref);
5531       }
5533       void method(int min)
5534       {
5535         DTRACE_PROBE3(_test_, meth, name, ref, min);
5536         ref -= min;
5537       }
5539       ~ProbeClass()
5540       {
5541         DTRACE_PROBE2(_test_, dest, name, ref);
5542       }
5543     };
5544     ]],[[
5545     int i = 64;
5546     DTRACE_PROBE1(_test_, call, i);
5547     ProbeClass inst = ProbeClass(i, "call");
5548     inst.method(24);
5549     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5550           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5551     AC_LANG_POP([C++])
5553 AC_CONFIG_HEADERS([config_host/config_probes.h])
5555 dnl ===================================================================
5556 dnl Set the MinGW sys-root
5557 dnl ===================================================================
5558 if test "$WITH_MINGW" = "yes"; then
5559     AC_MSG_CHECKING([for MinGW sysroot])
5560     sysroot=`$CC -print-sysroot`
5561     AS_IF([test -d "$sysroot"/mingw],
5562           [MINGW_SYSROOT="$sysroot"/mingw
5563            AC_MSG_RESULT([$MINGW_SYSROOT])],
5564           [AC_MSG_RESULT([not found])
5565            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5567 AC_SUBST([MINGW_DLLS])
5568 AC_SUBST([MINGW_SYSROOT])
5570 dnl ===================================================================
5571 dnl Set the MinGW include directories
5572 dnl ===================================================================
5573 if test "$WITH_MINGW" = "yes"; then
5574     AC_MSG_CHECKING([for MinGW include path])
5575     cat >conftest.$ac_ext <<_ACEOF
5576 #include <stddef.h>
5577 #include <bits/c++config.h>
5578 _ACEOF
5579     _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`
5580     rm conftest.$ac_ext
5581     if test -z "$_mingw_lib_include_path"; then
5582         _mingw_lib_include_path="NO_LIB_INCLUDE"
5583         AC_MSG_RESULT([no MinGW include path])
5584     else
5585         AC_MSG_RESULT([$_mingw_lib_include_path])
5586     fi
5587     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5588     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5590     AC_LANG_PUSH([C++])
5592     AC_MSG_CHECKING([for dynamic libgcc])
5593     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5594 #include <iostream>
5595 using namespace std;
5596 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5597             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5598             if test -n "$MINGW_GCCDLL"; then
5599                 MINGW_SHARED_GCCLIB=TRUE
5600                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5601             else
5602                 MINGW_SHARED_GCCLIB=
5603                 AC_MSG_RESULT([no])
5604             fi
5605        ],[ AC_MSG_RESULT([no])
5607     ])
5609     AC_MSG_CHECKING([for dynamic libstdc++])
5610     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5611 #include <iostream>
5612 using namespace std;
5613 ]], [[ cout << "Hello there." << endl; ]])],[
5614             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5615             if test -n "$MINGW_GXXDLL"; then
5616                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5617                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5618                 if test "$CROSS_COMPILING" = "TRUE"; then
5619                     dnl m4 escaping!
5620                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5621                 fi
5622                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5623                 MINGW_SHARED_GXXLIB=TRUE
5624                 AC_MSG_RESULT([$MINGW_GXXDLL])
5625             else
5626                 MINGW_SHARED_GXXLIB=
5627                 AC_MSG_RESULT([no])
5628             fi
5629        ],[ AC_MSG_RESULT([no])
5631     ])
5633     AC_LANG_POP([C++])
5635     AC_SUBST(MINGW_SHARED_GCCLIB)
5636     AC_SUBST(MINGW_SHARED_GXXLIB)
5637     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5638     AC_SUBST(MINGW_GCCDLL)
5639     AC_SUBST(MINGW_GXXDLL)
5642 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5643     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5646 if test "$WITH_MINGW" = "yes"; then
5647     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5648     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5649     [
5650     #include <usp10.h>
5651     ],
5652     [
5653     SCRIPT_CONTROL c;
5654     c.fMergeNeutralItems = 1;
5655     ])],
5656     [
5657     AC_MSG_RESULT(yes)
5658     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5659     ],
5660     [AC_MSG_RESULT(no)])
5663 dnl *************************************************************
5664 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5665 dnl *************************************************************
5666 if test "$WITH_MINGW" = "yes"; then
5667     AC_MSG_CHECKING([exception type])
5668     AC_LANG_PUSH([C++])
5669     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5671         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5673         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5674     ])
5675     AC_MSG_RESULT($exceptions_type)
5676     AC_LANG_POP([C++])
5679 EXCEPTIONS="$exceptions_type"
5680 AC_SUBST(EXCEPTIONS)
5682 dnl ===================================================================
5683 dnl thread-safe statics
5684 dnl ===================================================================
5685 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5686 unset HAVE_THREADSAFE_STATICS
5687 if test "$GCC" = "yes"; then
5688     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5689     dnl us.  However, some C++ runtimes use a single lock for all static
5690     dnl variables, which can cause deadlock in multi-threaded applications.
5691     dnl This is not easily tested here; for POSIX-based systems, if executing
5692     dnl the following C++ program does not terminate then the tool chain
5693     dnl apparently has this problem:
5694     dnl
5695     dnl   #include <pthread.h>
5696     dnl   int h() { return 0; }
5697     dnl   void * g(void * unused) {
5698     dnl     static int n = h();
5699     dnl     return &n;
5700     dnl   }
5701     dnl   int f() {
5702     dnl     pthread_t t;
5703     dnl     pthread_create(&t, 0, g, 0);
5704     dnl     pthread_join(t, 0);
5705     dnl     return 0;
5706     dnl   }
5707     dnl   int main() {
5708     dnl     static int n = f();
5709     dnl     return n;
5710     dnl   }
5711     dnl
5712     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5713     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5714     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5715     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5716     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5717     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5718     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5719     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5720     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5721     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5722     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5723     dnl "too old"):
5724     if test "$_os" = Darwin; then
5725         dnl On Mac OS X, both /usr/lib/libstdc++.6.dylib and
5726         dnl /usr/lib/libc++1.dylib delegate to /usr/lib/libc++abi.dylib for the
5727         dnl __cxa_guard_* functionality; up to 10.8, libc++abi.dylib is
5728         dnl apparently provided by a libcppabi project that has broken semantics
5729         dnl (cf. <http://www.opensource.apple.com/source/libcppabi/libcppabi-26/
5730         dnl src/cxa_guard.cxx>), while in 10.9 (verified at least on 10.9.4) it
5731         dnl is apparently provided by LLVM's libcxxabi project, which has good
5732         dnl semantics (cf. <http://llvm.org/svn/llvm-project/libcxxabi/trunk/
5733         dnl src/cxa_guard.cpp>):
5734         if test "$MAC_OS_X_VERSION_MIN_REQUIRED" -ge 1090; then
5735             HAVE_THREADSAFE_STATICS=TRUE
5736         fi
5737     elif test "$_os" != Android; then
5738         if test "$COM_GCC_IS_CLANG" = TRUE; then
5739             AC_LANG_PUSH([C++])
5740             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5741 #include <list>
5742 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5743 #error
5744 #endif
5745                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5746             AC_LANG_POP([C++])
5747         else # known to work in GCC since version 4.3
5748             HAVE_THREADSAFE_STATICS=TRUE
5749         fi
5750     fi
5751     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5752         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5753         AC_MSG_RESULT([yes])
5754     else
5755         AC_MSG_RESULT([broken (i.e., no)])
5756     fi
5757 else
5758     AC_MSG_RESULT([unknown (assuming no)])
5760 AC_SUBST(HAVE_THREADSAFE_STATICS)
5762 dnl ===================================================================
5763 dnl visibility and other gcc features
5764 dnl ===================================================================
5765 if test "$GCC" = "yes"; then
5766     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5767     save_CFLAGS=$CFLAGS
5768     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5769     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5770     CFLAGS=$save_CFLAGS
5772     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5773         AC_MSG_RESULT([yes])
5774     else
5775         AC_MSG_RESULT([no])
5776     fi
5778     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5779     save_CFLAGS=$CFLAGS
5780     CFLAGS="$CFLAGS -Werror -mno-avx"
5781     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5782     CFLAGS=$save_CFLAGS
5783     if test "$HAVE_GCC_AVX" = "TRUE"; then
5784         AC_MSG_RESULT([yes])
5785     else
5786         AC_MSG_RESULT([no])
5787     fi
5789     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5790     save_CFLAGS=$CFLAGS
5791     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5792     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5793     CFLAGS=$save_CFLAGS
5794     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5795         AC_MSG_RESULT([yes])
5796     else
5797         AC_MSG_RESULT([no])
5798     fi
5800     AC_MSG_CHECKING([whether $CC supports atomic functions])
5801     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5802     int v = 0;
5803     if (__sync_add_and_fetch(&v, 1) != 1 ||
5804         __sync_sub_and_fetch(&v, 1) != 0)
5805         return 1;
5806     __sync_synchronize();
5807     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5808         v != 1)
5809         return 1;
5810     return 0;
5811 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5812     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5813         AC_MSG_RESULT([yes])
5814         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5815     else
5816         AC_MSG_RESULT([no])
5817     fi
5819     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5820     save_CFLAGS=$CFLAGS
5821     CFLAGS="$CFLAGS -Werror"
5822     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5823             __attribute__((deprecated("test"))) void f();
5824         ])], [
5825             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5826             AC_MSG_RESULT([yes])
5827         ], [AC_MSG_RESULT([no])])
5828     CFLAGS=$save_CFLAGS
5830     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5831     AC_LANG_PUSH([C++])
5832     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5833             #include <cxxabi.h>
5834             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5835         ])], [
5836             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5837             AC_MSG_RESULT([yes])
5838         ], [AC_MSG_RESULT([no])])
5839     AC_LANG_POP([C++])
5841     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5842     AC_LANG_PUSH([C++])
5843     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5844             #include <cxxabi.h>
5845             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5846         ])], [
5847             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
5848             AC_MSG_RESULT([yes])
5849         ], [AC_MSG_RESULT([no])])
5850     AC_LANG_POP([C++])
5852     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5853     AC_LANG_PUSH([C++])
5854     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5855             #include <cxxabi.h>
5856             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5857         ])], [
5858             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
5859             AC_MSG_RESULT([yes])
5860         ], [AC_MSG_RESULT([no])])
5861     AC_LANG_POP([C++])
5863     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5864     AC_LANG_PUSH([C++])
5865     save_CXXFLAGS=$CXXFLAGS
5866     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
5867     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5868             struct __attribute__((warn_unused)) dummy {};
5869         ])], [
5870             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
5871             AC_MSG_RESULT([yes])
5872         ], [AC_MSG_RESULT([no])])
5873     CXXFLAGS=$save_CXXFLAGS
5874     AC_LANG_POP([C++])
5876     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
5877     AC_LANG_PUSH([C++])
5878     save_CXXFLAGS=$CXXFLAGS
5879     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
5880     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5881             #include <string>
5882             void f() { std::string s; }
5883         ])], [
5884             AC_MSG_RESULT([no])
5885         ], [
5886             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
5887             AC_MSG_RESULT([yes])])
5888     CXXFLAGS=$save_CXXFLAGS
5889     AC_LANG_POP([C++])
5892 AC_SUBST(HAVE_GCC_AVX)
5893 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
5894 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5896 dnl ===================================================================
5897 dnl Identify the C++ library
5898 dnl ===================================================================
5900 AC_MSG_CHECKING([What the C++ library is])
5901 AC_LANG_PUSH([C++])
5902 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5903 #include <utility>
5904 #ifndef __GLIBCXX__
5905 foo bar
5906 #endif
5907 ]])],
5908     [CPP_LIBRARY=GLIBCXX
5909      cpp_library_name="GNU libstdc++"
5910     ],
5911     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5912 #include <utility>
5913 #ifndef _LIBCPP_VERSION
5914 foo bar
5915 #endif
5916 ]])],
5917     [CPP_LIBRARY=LIBCPP
5918      cpp_library_name="LLVM libc++"
5919     ],
5920     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5921 #include <utility>
5922 #ifndef _MSC_VER
5923 foo bar
5924 #endif
5925 ]])],
5926     [CPP_LIBRARY=MSVCRT
5927      cpp_library_name="Microsoft"
5928     ],
5929     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
5930 AC_MSG_RESULT([$cpp_library_name])
5931 AC_LANG_POP([C++])
5932 AC_SUBST(CPP_LIBRARY)
5934 dnl ===================================================================
5935 dnl C++11
5936 dnl ===================================================================
5938 CXXFLAGS_CXX11=
5939 if test "$COM" = MSC; then
5940     AC_MSG_CHECKING([whether $CXX supports C++11])
5941     AC_MSG_RESULT(yes)
5942     # MSVC supports (a subset of) CXX11 without any switch
5943     CXXFLAGS_CXX11=
5944 elif test "$GCC" = "yes"; then
5945     HAVE_CXX11=
5946     CXXFLAGS_CXX11=
5947     AC_MSG_CHECKING([whether $CXX supports C++11])
5948     for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
5949         save_CXXFLAGS=$CXXFLAGS
5950         CXXFLAGS="$CXXFLAGS $flag -Werror"
5951         AC_LANG_PUSH([C++])
5952         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void f() {}]])],[CXXFLAGS_CXX11=$flag])
5953         AC_LANG_POP([C++])
5954         CXXFLAGS=$save_CXXFLAGS
5955         if test -n "$CXXFLAGS_CXX11"; then
5956             HAVE_CXX11=TRUE
5957             break
5958         fi
5959     done
5960     if test "$HAVE_CXX11" = TRUE; then
5961         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
5962     else
5963         AC_MSG_ERROR(no)
5964     fi
5967 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
5968 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
5969 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
5970 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
5971 dnl again towards 4.7.2:
5972 if test $CPP_LIBRARY = GLIBCXX; then
5973     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
5974     AC_LANG_PUSH([C++])
5975     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5976 #include <list>
5977 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
5978     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
5979     //   GCC 4.7.0: 20120322
5980     //   GCC 4.7.1: 20120614
5981     // and using a range check is not possible as the mapping between
5982     // __GLIBCXX__ values and GCC versions is not monotonic
5983 /* ok */
5984 #else
5985 abi broken
5986 #endif
5987         ]])], [AC_MSG_RESULT(no, ok)],
5988         [AC_MSG_ERROR(yes)])
5989     AC_LANG_POP([C++])
5992 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
5993 save_CXXFLAGS=$CXXFLAGS
5994 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5995 AC_LANG_PUSH([C++])
5997 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5998 #include <stddef.h>
6000 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6002 namespace
6004         struct b
6005         {
6006                 int i;
6007                 int j;
6008         };
6010 ]], [[
6011 struct a
6013         int i;
6014         int j;
6016 a thinga[]={{0,0}, {1,1}};
6017 b thingb[]={{0,0}, {1,1}};
6018 size_t i = sizeof(sal_n_array_size(thinga));
6019 size_t j = sizeof(sal_n_array_size(thingb));
6020 return !(i != 0 && j != 0);
6022     ], [ AC_MSG_RESULT(yes) ],
6023     [ AC_MSG_ERROR(no)])
6024 AC_LANG_POP([C++])
6025 CXXFLAGS=$save_CXXFLAGS
6027 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6028 save_CXXFLAGS=$CXXFLAGS
6029 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6030 AC_LANG_PUSH([C++])
6032 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6033 #include <vector>
6034     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6035     // (__float128)
6037     ],[ AC_MSG_RESULT(yes) ],
6038     [
6039         AC_MSG_RESULT(no)
6040         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6041         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6042         # __float128 is available during its build, but it's usually built using GCC,
6043         # and so c++config.h hardcodes __float128 being supported). As the only place
6044         # where __float128 is actually used is in a template specialization,
6045         # -D__float128=void will avoid the problem there while still causing a problem
6046         # if somebody actually uses the type.
6047         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6048         CXXFLAGS="$CXXFLAGS -D__float128=void"
6049         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6050 #include <vector>
6051     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6052     // (__float128)
6054     ],
6055     [
6056      AC_MSG_RESULT(yes)
6057      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6058     ],
6059     [
6060      AC_MSG_ERROR(no)
6061     ])
6064 AC_LANG_POP([C++])
6065 CXXFLAGS=$save_CXXFLAGS
6067 AC_SUBST(CXXFLAGS_CXX11)
6069 dnl ==================================
6070 dnl Check for C++11 "= delete" support
6071 dnl ==================================
6073 AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
6074 save_CXXFLAGS=$CXXFLAGS
6075 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6076 AC_LANG_PUSH([C++])
6077 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6078 struct A
6079     {
6080     void test() = delete;
6081     };
6082 ]])],[HAVE_CXX11_DELETE=TRUE],[])
6084 AC_LANG_POP([C++])
6085 CXXFLAGS=$save_CXXFLAGS
6086 if test "$HAVE_CXX11_DELETE" = "TRUE"; then
6087     AC_MSG_RESULT([yes])
6088     AC_DEFINE([HAVE_CXX11_DELETE])
6089 else
6090     AC_MSG_RESULT([no])
6093 dnl ==================================
6094 dnl Check for C++11 "override" support
6095 dnl ==================================
6097 AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
6098 save_CXXFLAGS=$CXXFLAGS
6099 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6100 AC_LANG_PUSH([C++])
6101 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6102 struct A
6104         virtual void test();
6107 struct B : A
6109         virtual void test() override;
6111 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
6113 AC_LANG_POP([C++])
6114 CXXFLAGS=$save_CXXFLAGS
6115 if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
6116     AC_MSG_RESULT([yes])
6117     AC_DEFINE([HAVE_CXX11_OVERRIDE])
6118 else
6119     AC_MSG_RESULT([no])
6122 dnl ==================================
6123 dnl Check for C++11 "final" support
6124 dnl ==================================
6126 AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
6127 save_CXXFLAGS=$CXXFLAGS
6128 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6129 AC_LANG_PUSH([C++])
6130 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6131 // First check that this correct program that uses "final" compiles
6132 struct A final
6136 struct B
6138         virtual void test();
6141 struct C : B
6143         void test() final;
6145 ]])],[have_final=yes],[])
6147 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6148 // Then check that the "final" works as expected,
6149 // that this program fails to compile
6150 struct A final
6154 struct B : A
6157 ]])],[],[final_class_works=yes])
6159 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6160 // Also this should fail to compile
6161 struct B
6163         virtual void test();
6166 struct C : B
6168         void test() final;
6171 struct D : C
6173         void test();
6175 ]])],[],[final_method_works=yes])
6176 AC_LANG_POP([C++])
6178 CXXFLAGS=$save_CXXFLAGS
6180 if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
6181     AC_MSG_RESULT([yes])
6182     AC_DEFINE([HAVE_CXX11_FINAL])
6183 else
6184     AC_MSG_RESULT([no])
6187 dnl ===================================================================
6188 dnl Check for C++11 perfect forwarding support
6189 dnl ===================================================================
6190 AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
6191 save_CXXFLAGS=$CXXFLAGS
6192 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6193 AC_LANG_PUSH([C++])
6194 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6195     #include <utility>
6196     template<typename T, typename... Args> T * f(Args &&... v) {
6197         return new T(std::forward<Args>(v)...);
6198     }
6199     ]], [[
6200     f<int>(0);
6201     ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
6202 AC_LANG_POP([C++])
6203 CXXFLAGS=$save_CXXFLAGS
6204 AC_MSG_RESULT([$perfect_forwarding])
6205 if test "$perfect_forwarding" = yes; then
6206     AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
6209 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6210 save_CXXFLAGS=$CXXFLAGS
6211 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6212 AC_LANG_PUSH([C++])
6213 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6214     struct S {
6215         int n_;
6216         constexpr S(int n): n_(n) {}
6217     };
6218     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6219 AC_LANG_POP([C++])
6220 CXXFLAGS=$save_CXXFLAGS
6221 AC_MSG_RESULT([$cxx11_constexpr])
6222 if test "$cxx11_constexpr" = yes; then
6223     AC_DEFINE([HAVE_CXX11_CONSTEXPR])
6226 HAVE_GCC_PRAGMA_OPERATOR=
6227 dnl _Pragma support (may require C++11)
6228 if test "$GCC" = "yes"; then
6229     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6230     AC_LANG_PUSH([C++])
6231     save_CXXFLAGS=$CXXFLAGS
6232     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6233     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6234             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6235         ])], [
6236             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6237             HAVE_GCC_PRAGMA_OPERATOR=1
6238             AC_MSG_RESULT([yes])
6239         ], [AC_MSG_RESULT([no])])
6240     AC_LANG_POP([C++])
6241     CXXFLAGS=$save_CXXFLAGS
6243 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6245 dnl ===================================================================
6246 dnl system stl sanity tests
6247 dnl ===================================================================
6248 HAVE_GCC_VISIBILITY_BROKEN=
6249 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6251     AC_LANG_PUSH([C++])
6253     save_CPPFLAGS="$CPPFLAGS"
6254     if test -n "$MACOSX_SDK_PATH"; then
6255         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6256     fi
6258     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6259     # only.
6260     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6261         dnl gcc#19664, gcc#22482, rhbz#162935
6262         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6263         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6264         AC_MSG_RESULT([$stlvisok])
6265         if test "$stlvisok" = "no"; then
6266             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6267             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6268             unset HAVE_GCC_VISIBILITY_FEATURE
6269         fi
6270     fi
6272     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6273         sharedlink_ldflags_save=$LDFLAGS
6274         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6276         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6277         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6278 #include <sstream>
6279 using namespace std;
6280             ]], [[
6281 istringstream strm( "test" ); return 0;
6282             ]])],
6283             # Ugh, surely bad to assume an error message will contain
6284             # the word "unresolvable", a problem with
6285             # -fvisibility-inlines-hidden and STL headers might cause
6286             # some more obscure message on some platform, and anway,
6287             # the error message could be localised.
6288             [$EGREP -q unresolvable conftest.err;
6289             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6290         ])
6291         AC_MSG_RESULT([$gccvisok])
6292         if test "$gccvisok" = "no"; then
6293             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6294             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6295             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6296         fi
6298         LDFLAGS=$sharedlink_ldflags_save
6299     fi
6301     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6302     # when we don't make any dynamic libraries?
6303     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6304         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6305         cat > conftestlib1.cc <<_ACEOF
6306 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6307 struct S2: S1<int> { virtual ~S2(); };
6308 S2::~S2() {}
6309 _ACEOF
6310         cat > conftestlib2.cc <<_ACEOF
6311 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6312 struct S2: S1<int> { virtual ~S2(); };
6313 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6314 _ACEOF
6315         gccvisinlineshiddenok=yes
6316         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6317             gccvisinlineshiddenok=no
6318         else
6319             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6320             dnl known to not work with -z defs (unsetting which makes the test
6321             dnl moot, though):
6322             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6323             if test "$COM_GCC_IS_CLANG" = TRUE; then
6324                 for i in $CXX; do
6325                     case $i in
6326                     -fsanitize=*)
6327                         my_linkflagsnoundefs=
6328                         break
6329                         ;;
6330                     esac
6331                 done
6332             fi
6333             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6334                 gccvisinlineshiddenok=no
6335             fi
6336         fi
6338         rm -fr libconftest*
6339         AC_MSG_RESULT([$gccvisinlineshiddenok])
6340         if test "$gccvisinlineshiddenok" = "no"; then
6341             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6342             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6343             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6344         fi
6345     fi
6347     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6348         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6349         cat >visibility.cxx <<_ACEOF
6350 #pragma GCC visibility push(hidden)
6351 struct __attribute__ ((visibility ("default"))) TestStruct {
6352   static void Init();
6354 __attribute__ ((visibility ("default"))) void TestFunc() {
6355   TestStruct::Init();
6357 _ACEOF
6358         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6359             gccvisbroken=yes
6360         else
6361             case "$host_cpu" in
6362             i?86|x86_64)
6363                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6364                     gccvisbroken=no
6365                 else
6366                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6367                         gccvisbroken=no
6368                     else
6369                         gccvisbroken=yes
6370                     fi
6371                 fi
6372                 ;;
6373             *)
6374                 gccvisbroken=no
6375                 ;;
6376             esac
6377         fi
6378         rm -f visibility.s visibility.cxx
6380         AC_MSG_RESULT([$gccvisbroken])
6381         if test "$gccvisbroken" = "yes"; then
6382             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6383             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6384             unset HAVE_GCC_VISIBILITY_FEATURE
6385         fi
6386     fi
6388     CPPFLAGS="$save_CPPFLAGS"
6390     AC_LANG_POP([C++])
6393 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6394 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6396 dnl ===================================================================
6397 dnl  Clang++ tests
6398 dnl ===================================================================
6400 HAVE_GCC_FNO_DEFAULT_INLINE=
6401 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6402 if test "$GCC" = "yes"; then
6403     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6404     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6405         # Option just ignored and silly warning that isn't a real
6406         # warning printed
6407         :
6408     else
6409         AC_LANG_PUSH([C++])
6410         save_CXXFLAGS=$CXXFLAGS
6411         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6412         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6413         CXXFLAGS=$save_CXXFLAGS
6414         AC_LANG_POP([C++])
6415     fi
6416     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6417         AC_MSG_RESULT([yes])
6418     else
6419         AC_MSG_RESULT([no])
6420     fi
6422     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6423     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6424         # As above
6425         :
6426     else
6427         AC_LANG_PUSH([C++])
6428         save_CXXFLAGS=$CXXFLAGS
6429         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6430         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6431         CXXFLAGS=$save_CXXFLAGS
6432         AC_LANG_POP([C++])
6433     fi
6434     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6435         AC_MSG_RESULT([yes])
6436     else
6437         AC_MSG_RESULT([no])
6438     fi
6440 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6441 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6443 dnl ===================================================================
6444 dnl Compiler plugins
6445 dnl ===================================================================
6447 COMPILER_PLUGINS=
6448 # currently only Clang
6449 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
6450     if test -n "$enable_compiler_plugins"; then
6451         compiler_plugins="$enable_compiler_plugins"
6452     elif test -n "$ENABLE_DBGUTIL"; then
6453         compiler_plugins=test
6454     else
6455         compiler_plugins=no
6456     fi
6457     if test "$compiler_plugins" != "no"; then
6458         dnl The prefix where Clang resides, override to where Clang resides if
6459         dnl using a source build:
6460         if test -z "$CLANGDIR"; then
6461             CLANGDIR=/usr
6462         fi
6463         AC_LANG_PUSH([C++])
6464         save_CPPFLAGS=$CPPFLAGS
6465         save_CXX=$CXX
6466         # compiler plugins must be built with "native" bitness of clang
6467         # because they link against clang libraries
6468         CXX=`echo $CXX | sed -e s/-m64// -e s/-m32//`
6469         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6470         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6471             [COMPILER_PLUGINS=TRUE],
6472             [
6473             if test "$compiler_plugins" = "yes"; then
6474                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6475             else
6476                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6477                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6478             fi
6479             ])
6480         CXX=$save_CXX
6481         CPPFLAGS=$save_CPPFLAGS
6482         AC_LANG_POP([C++])
6483     fi
6484 else
6485     if test "$enable_compiler_plugins" = "yes"; then
6486         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6487     fi
6489 AC_SUBST(COMPILER_PLUGINS)
6490 AC_SUBST(CLANGDIR)
6492 # Plugin to help linker.
6493 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6494 # This makes --enable-lto build with clang work.
6495 AC_SUBST(LD_PLUGIN)
6497 dnl ===================================================================
6498 dnl allocator
6499 dnl ===================================================================
6500 AC_MSG_CHECKING([which memory allocator to use])
6501 if test "$with_alloc" = "system"; then
6502     AC_MSG_RESULT([system])
6503     ALLOC="SYS_ALLOC"
6505 if test "$with_alloc" = "tcmalloc"; then
6506     AC_MSG_RESULT(tcmalloc)
6507     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6508         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6509     fi
6510     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6511         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6512     ALLOC="TCMALLOC"
6514 if test "$with_alloc" = "jemalloc"; then
6515     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6516         AC_MSG_RESULT(jemalloc)
6517         save_CFLAGS=$CFLAGS
6518         CFLAGS="$CFLAGS -pthread"
6519         AC_CHECK_LIB([jemalloc], [malloc], [:],
6520             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6521         ALLOC="JEMALLOC"
6522         CFLAGS=$save_CFLAGS
6523     else
6524         AC_MSG_RESULT([system])
6525         ALLOC="SYS_ALLOC"
6526     fi
6528 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6529     AC_MSG_RESULT([internal])
6531 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6532 AC_SUBST(HAVE_POSIX_FALLOCATE)
6533 AC_SUBST(ALLOC)
6535 dnl ===================================================================
6536 dnl Custom build version
6537 dnl ===================================================================
6539 AC_MSG_CHECKING([whether to add custom build version])
6540 if test "$with_build_version" != ""; then
6541     BUILD_VER_STRING=$with_build_version
6542     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6543 else
6544     BUILD_VER_STRING=
6545     AC_MSG_RESULT([no])
6547 AC_SUBST(BUILD_VER_STRING)
6549 JITC_PROCESSOR_TYPE=""
6550 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6551     # IBMs JDK needs this...
6552     JITC_PROCESSOR_TYPE=6
6553     export JITC_PROCESSOR_TYPE
6555 AC_SUBST([JITC_PROCESSOR_TYPE])
6557 # Misc Windows Stuff
6558 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6559     find_msvc_x64_dlls
6560     find_msms
6561     MSVC_DLL_PATH="$msvcdllpath"
6562     MSVC_DLLS="$msvcdlls"
6563     MSM_PATH="$msmdir"
6564     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6567 AC_SUBST(MSVC_DLL_PATH)
6568 AC_SUBST(MSVC_DLLS)
6569 AC_SUBST(MSM_PATH)
6571 dnl ===================================================================
6572 dnl Checks for Java
6573 dnl ===================================================================
6574 if test "$ENABLE_JAVA" != ""; then
6576     # Windows-specific tests
6577     if test "$build_os" = "cygwin"; then
6578         if test "$BITNESS_OVERRIDE" = 64; then
6579             bitness=64
6580         else
6581             bitness=32
6582         fi
6584         if test -z "$with_jdk_home"; then
6585             for ver in 1.8 1.7 1.6; do
6586                 reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6587                 if test -n "$regvalue"; then
6588                     _jdk_home=$regvalue
6589                     break
6590                 fi
6591             done
6592             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6593                 with_jdk_home="$_jdk_home"
6594                 howfound="found automatically"
6595             else
6596                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6597             fi
6598         else
6599             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6600             howfound="you passed"
6601         fi
6602     fi
6604     # 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.
6605     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6606     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6607         with_jdk_home=`/usr/libexec/java_home`
6608     fi
6610     JAVA_HOME=; export JAVA_HOME
6611     if test -z "$with_jdk_home"; then
6612         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6613     else
6614         _java_path="$with_jdk_home/bin/$with_java"
6615         dnl Check if there is a Java interpreter at all.
6616         if test -x "$_java_path"; then
6617             JAVAINTERPRETER=$_java_path
6618         else
6619             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6620         fi
6621     fi
6623     if test "$build_os" = "cygwin"; then
6624         # Check that the JDK found is correct architecture
6625         # Why is this necessary, we don't link with any library from the JDK I think,
6627         shortjdkhome=`cygpath -d "$with_jdk_home"`
6628         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
6629             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6630             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6631         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
6632             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6633             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6634         fi
6636         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6637             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6638         fi
6639         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6640     elif test "$cross_compiling" != "yes"; then
6641         # at least 2 reasons to check: officebean needs to link -ljawt,
6642         # and libjpipe.so needs to be loaded by java to run JunitTests.
6643         case $CPUNAME in
6644             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64)
6645                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6646                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6647                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6648                 fi
6649                 ;;
6650             *) # assumption: everything else 32-bit
6651                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6652                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6653                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6654                 fi
6655                 ;;
6656         esac
6657     fi
6660 HAVE_JAVA6=
6661 HAVE_JAVA9=
6662 dnl ===================================================================
6663 dnl Checks for JDK.
6664 dnl ===================================================================
6666 # Note that JAVA_HOME as for now always means the *build* platform's
6667 # JAVA_HOME. Whether all the complexity here actually is needed any
6668 # more or not, no idea.
6670 if test "$ENABLE_JAVA" != ""; then
6671     _gij_longver=0
6672     AC_MSG_CHECKING([the installed JDK])
6673     if test -n "$JAVAINTERPRETER"; then
6674         dnl java -version sends output to stderr!
6675         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6676             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6677         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6678             JDK=gcj
6679             AC_MSG_RESULT([checked (gcj)])
6680             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6681             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6683         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6684             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6685         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6686             JDK=ibm
6688             dnl IBM JDK specific tests
6689             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6690             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6692             if test "$_jdk_ver" -lt 10500; then
6693                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6694             fi
6695             if test "$_jdk_ver" -ge 10600; then
6696                 HAVE_JAVA6=TRUE
6697             fi
6699             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6701             if test "$with_jdk_home" = ""; then
6702                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6703 you must use the "--with-jdk-home" configure option explicitly])
6704             fi
6706             JAVA_HOME=$with_jdk_home
6707         else
6708             JDK=sun
6710             dnl Sun JDK specific tests
6711             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6712             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6714             if test "$_jdk_ver" -lt 10500; then
6715                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6716             fi
6717             if test "$_jdk_ver" -gt 10600; then
6718                 JAVA_CLASSPATH_NOT_SET="1"
6719             fi
6720             if test "$_jdk_ver" -ge 10600; then
6721                 HAVE_JAVA6=TRUE
6722             fi
6723             if test "$_jdk_ver" -ge 10900; then
6724                 HAVE_JAVA9=TRUE
6725             fi
6727             AC_MSG_RESULT([checked (JDK $_jdk)])
6728             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6729             if test "$_os" = "WINNT"; then
6730                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6731             fi
6733             # set to limit VM usage for JunitTests
6734             JAVAIFLAGS=-Xmx64M
6735             # set to limit VM usage for javac
6736             JAVAFLAGS=-J-Xmx128M
6737         fi
6738     else
6739         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6740     fi
6741 else
6742     dnl Java disabled
6743     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6745 AC_SUBST([HAVE_JAVA6])
6746 AC_SUBST([HAVE_JAVA9])
6748 dnl ===================================================================
6749 dnl Set target Java bytecode version
6750 dnl ===================================================================
6751 if test "$ENABLE_JAVA" != ""; then
6752     if test "$HAVE_JAVA9" == "TRUE"; then
6753         _java_target_ver="1.6"
6754     else
6755         _java_target_ver="1.5"
6756     fi
6757     JAVA_SOURCE_VER="$_java_target_ver"
6758     JAVA_TARGET_VER="$_java_target_ver"
6761 dnl ===================================================================
6762 dnl Checks for javac
6763 dnl ===================================================================
6764 if test "$ENABLE_JAVA" != ""; then
6765     if test "$JDK" = "gcj"; then
6766         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6767     else
6768         javacompiler="javac"
6769     fi
6770     if test -z "$with_jdk_home"; then
6771         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6772     else
6773         _javac_path="$with_jdk_home/bin/$javacompiler"
6774         dnl Check if there is a Java compiler at all.
6775         if test -x "$_javac_path"; then
6776             JAVACOMPILER=$_javac_path
6777         fi
6778     fi
6779     if test -z "$JAVACOMPILER"; then
6780         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6781     fi
6782     if test "$build_os" = "cygwin"; then
6783         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6784             JAVACOMPILER="${JAVACOMPILER}.exe"
6785         fi
6786         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6787     fi
6789     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6790         AC_MSG_CHECKING([re-checking JDK])
6791         JDK=gcj
6792         AC_MSG_RESULT([checked (ecj)])
6793         _gij_longver="40200"
6794     fi
6797 JAVACISGCJ=""
6798 dnl ===================================================================
6799 dnl Checks that javac is gcj
6800 dnl ===================================================================
6801 if test "$ENABLE_JAVA" != ""; then
6802     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6803         JAVACISGCJ="yes"
6804     fi
6806 AC_SUBST(JAVACISGCJ)
6808 dnl ===================================================================
6809 dnl Checks for javadoc
6810 dnl ===================================================================
6811 if test "$ENABLE_JAVA" != ""; then
6812     if test -z "$with_jdk_home"; then
6813         AC_PATH_PROG(JAVADOC, javadoc)
6814     else
6815         _javadoc_path="$with_jdk_home/bin/javadoc"
6816         dnl Check if there is a javadoc at all.
6817         if test -x "$_javadoc_path"; then
6818             JAVADOC=$_javadoc_path
6819         else
6820             AC_PATH_PROG(JAVADOC, javadoc)
6821         fi
6822     fi
6823     if test -z "$JAVADOC"; then
6824         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6825     fi
6826     if test "$build_os" = "cygwin"; then
6827         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6828             JAVADOC="${JAVADOC}.exe"
6829         fi
6830         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6831     fi
6833     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6834     JAVADOCISGJDOC="yes"
6835     fi
6837 AC_SUBST(JAVADOCISGJDOC)
6839 if test "$ENABLE_JAVA" != ""; then
6840     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6841     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6842         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6843            # try to recover first by looking whether we have a alternatives
6844            # system as in Debian or newer SuSEs where following /usr/bin/javac
6845            # over /etc/alternatives/javac leads to the right bindir where we
6846            # just need to strip a bit away to get a valid JAVA_HOME
6847            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6848         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6849             # maybe only one level of symlink (e.g. on Mac)
6850             JAVA_HOME=$(readlink $JAVACOMPILER)
6851             if test "$(dirname $JAVA_HOME)" = "."; then
6852                 # we've got no path to trim back
6853                 JAVA_HOME=""
6854             fi
6855         else
6856             # else warn
6857             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6858             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6859             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6860             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6861         fi
6862         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
6863         if test "$JAVA_HOME" != "/usr"; then
6864             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6865                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6866                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6867                 dnl Tiger already returns a JDK path..
6868                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6869             else
6870                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6871             fi
6872         fi
6873     fi
6874     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6876     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6877     if test -z "$JAVA_HOME"; then
6878         if test "x$with_jdk_home" = "x"; then
6879             cat > findhome.java <<_ACEOF
6880 [import java.io.File;
6882 class findhome
6884     public static void main(String args[])
6885     {
6886         String jrelocation = System.getProperty("java.home");
6887         File jre = new File(jrelocation);
6888         System.out.println(jre.getParent());
6889     }
6891 _ACEOF
6892             AC_MSG_CHECKING([if javac works])
6893             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6894             AC_TRY_EVAL(javac_cmd)
6895             if test $? = 0 -a -f ./findhome.class; then
6896                 AC_MSG_RESULT([javac works])
6897             else
6898                 echo "configure: javac test failed" >&5
6899                 cat findhome.java >&5
6900                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6901             fi
6902             AC_MSG_CHECKING([if gij knows its java.home])
6903             JAVA_HOME=`$JAVAINTERPRETER findhome`
6904             if test $? = 0 -a "$JAVA_HOME" != ""; then
6905                 AC_MSG_RESULT([$JAVA_HOME])
6906             else
6907                 echo "configure: java test failed" >&5
6908                 cat findhome.java >&5
6909                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6910             fi
6911             # clean-up after ourselves
6912             rm -f ./findhome.java ./findhome.class
6913         else
6914             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6915         fi
6916     fi
6918     dnl second sanity check JAVA_HOME if possible
6919     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
6920         # now check if $JAVA_HOME is really valid
6921         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6922             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6923                 JAVA_HOME_OK="NO"
6924             fi
6925         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6926             JAVA_HOME_OK="NO"
6927         fi
6928         if test "$JAVA_HOME_OK" = "NO"; then
6929             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6930             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6931             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6932             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6933             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6934             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6935         fi
6936     fi
6937     PathFormat "$JAVA_HOME"
6938     JAVA_HOME="$formatted_path"
6941 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
6942     "$_os" != Darwin
6943 then
6944     AC_MSG_CHECKING([for JAWT lib])
6945     if test "$_os" = WINNT; then
6946         if test "$WITH_MINGW" = yes; then
6947             # The path is taken care of in gb_LinkTarget__use_jawt
6948             # in RepositoryExternal.mk:
6949             JAWTLIB=-ljawt
6950         else
6951             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
6952             JAWTLIB=jawt.lib
6953         fi
6954     else
6955         case "$host_cpu" in
6956         arm*)
6957             my_java_arch=arm
6958             ;;
6959         i*86)
6960             my_java_arch=i386
6961             ;;
6962         m68k)
6963             my_java_arch=mk68
6964             ;;
6965         powerpc)
6966             my_java_arch=ppc
6967             ;;
6968         powerpc64*)
6969             my_java_arch=ppc64
6970             ;;
6971         x86_64)
6972             my_java_arch=amd64
6973             ;;
6974         *)
6975             my_java_arch=$host_cpu
6976             ;;
6977         esac
6978         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
6979     fi
6980     AC_MSG_RESULT([$JAWTLIB])
6982 AC_SUBST(JAWTLIB)
6984 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
6985     case "$host_os" in
6987     aix*)
6988         JAVAINC="-I$JAVA_HOME/include"
6989         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6990         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6991         ;;
6993     cygwin*)
6994         JAVAINC="-I$JAVA_HOME/include/win32"
6995         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6996         ;;
6998     darwin*)
6999         if test -d "$JAVA_HOME/include/darwin"; then
7000             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7001         else
7002             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7003         fi
7004         ;;
7006     dragonfly*)
7007         JAVAINC="-I$JAVA_HOME/include"
7008         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7009         ;;
7011     freebsd*)
7012         JAVAINC="-I$JAVA_HOME/include"
7013         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7014         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7015         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7016         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7017         ;;
7019     k*bsd*-gnu*)
7020         JAVAINC="-I$JAVA_HOME/include"
7021         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7022         ;;
7024     linux-gnu*)
7025         JAVAINC="-I$JAVA_HOME/include"
7026         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7027         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7028         ;;
7030     mingw*)
7031         JAVAINC="-I$JAVA_HOME/include"
7032         ;;
7034     *netbsd*)
7035         JAVAINC="-I$JAVA_HOME/include"
7036         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7037         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7038        ;;
7040     openbsd*)
7041         JAVAINC="-I$JAVA_HOME/include"
7042         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7043         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7044         ;;
7046     solaris*)
7047         JAVAINC="-I$JAVA_HOME/include"
7048         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7049         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7050         ;;
7051     esac
7053 SOLARINC="$SOLARINC $JAVAINC"
7055 AC_SUBST(JAVACOMPILER)
7056 AC_SUBST(JAVADOC)
7057 AC_SUBST(JAVAINTERPRETER)
7058 AC_SUBST(JAVAIFLAGS)
7059 AC_SUBST(JAVAFLAGS)
7060 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7061 AC_SUBST(JAVA_HOME)
7062 AC_SUBST(JAVA_SOURCE_VER)
7063 AC_SUBST(JAVA_TARGET_VER)
7064 AC_SUBST(JDK)
7066 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7067 if test -n "$with_idlc_cpp"; then
7068     AC_MSG_RESULT([$with_idlc_cpp])
7069     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7070 else
7071     AC_MSG_RESULT([ucpp])
7072     AC_MSG_CHECKING([which ucpp tp use])
7073     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7074         AC_MSG_RESULT([external])
7075         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7076     else
7077         AC_MSG_RESULT([internal])
7078         BUILD_TYPE="$BUILD_TYPE UCPP"
7079     fi
7081 AC_SUBST(SYSTEM_UCPP)
7083 dnl ===================================================================
7084 dnl Check for epm (not needed for Windows)
7085 dnl ===================================================================
7086 AC_MSG_CHECKING([whether to enable EPM for packing])
7087 if test "$enable_epm" = "yes"; then
7088     AC_MSG_RESULT([yes])
7089     if test "$_os" != "WINNT"; then
7090         if test $_os = Darwin; then
7091             EPM=internal
7092         elif test -n "$with_epm"; then
7093             EPM=$with_epm
7094         else
7095             AC_PATH_PROG(EPM, epm, no)
7096         fi
7097         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7098             echo "EPM will be built."
7099             BUILD_TYPE="$BUILD_TYPE EPM"
7100             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7101         else
7102             # Gentoo has some epm which is something different...
7103             AC_MSG_CHECKING([whether the found epm is the right epm])
7104             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7105                 AC_MSG_RESULT([yes])
7106             else
7107                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7108             fi
7109             AC_MSG_CHECKING([epm version])
7110             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7111             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7112                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7113                 AC_MSG_RESULT([OK, >= 3.7])
7114             else
7115                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7116                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7117             fi
7118         fi
7119     fi
7121     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7122         AC_MSG_CHECKING([for rpm])
7123         for a in "$RPM" rpmbuild rpm; do
7124             $a --usage >/dev/null 2> /dev/null
7125             if test $? -eq 0; then
7126                 RPM=$a
7127                 break
7128             else
7129                 $a --version >/dev/null 2> /dev/null
7130                 if test $? -eq 0; then
7131                     RPM=$a
7132                     break
7133                 fi
7134             fi
7135         done
7136         if test -z "$RPM"; then
7137             AC_MSG_ERROR([not found])
7138         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7139             RPM_PATH=`which $RPM`
7140             AC_MSG_RESULT([$RPM_PATH])
7141             SCPDEFS="$SCPDEFS -DWITH_RPM"
7142         else
7143             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7144         fi
7145     fi
7146     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7147         AC_PATH_PROG(DPKG, dpkg, no)
7148         if test "$DPKG" = "no"; then
7149             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7150         fi
7151     fi
7152     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7153        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7154         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7155             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7156                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7157                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7158                     AC_MSG_RESULT([yes])
7159                 else
7160                     AC_MSG_RESULT([no])
7161                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7162                         _pt="rpm"
7163                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7164                         add_warning "the rpms will need to be installed with --nodeps"
7165                     else
7166                         _pt="pkg"
7167                     fi
7168                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7169                     add_warning "the ${_pt}s will not be relocateable"
7170                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7171                                  relocation will work, you need to patch your epm with the
7172                                  patch in epm/epm-3.7.patch or build with
7173                                  --with-epm=internal which will build a suitable epm])
7174                 fi
7175             fi
7176         fi
7177     fi
7178     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7179         AC_PATH_PROG(PKGMK, pkgmk, no)
7180         if test "$PKGMK" = "no"; then
7181             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7182         fi
7183     fi
7184     AC_SUBST(RPM)
7185     AC_SUBST(DPKG)
7186     AC_SUBST(PKGMK)
7187 else
7188     for i in $PKGFORMAT; do
7189         case "$i" in
7190         aix | bsd | deb | pkg | rpm | native | portable)
7191             AC_MSG_ERROR(
7192                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7193             ;;
7194         esac
7195     done
7196     AC_MSG_RESULT([no])
7197     EPM=NO
7199 AC_SUBST(EPM)
7201 dnl ===================================================================
7202 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7203 dnl ===================================================================
7204 WINEGCC=
7205 if test "$enable_winegcc" = "yes"; then
7206     AC_PATH_PROG(WINEGCC, winegcc)
7207     if test "$WINEGCC" = ""; then
7208         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7209     fi
7210     CC_save="$CC"
7211     ac_exeext_save="$ac_exeext"
7212     CC="$WINEGCC -m32"
7213     ac_exeext=".exe"
7214     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7215 #include <stdio.h>
7216         ],[
7217 printf ("hello world\n");
7218         ])],,
7219         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7220     )
7221     CC="$CC_save"
7222     ac_exeext="$ac_exeext_save"
7224 AC_SUBST(WINEGCC)
7226 if test $_os = iOS; then
7227     enable_mpl_subset=yes
7228     enable_lotuswordpro=no
7229     enable_coinmp=yes
7230     enable_lpsolve=no
7231     enable_postgresql_sdbc=no
7232     enable_extension_integration=no
7233     enable_report_builder=no
7234     with_theme="tango"
7235     with_ppds=no
7238 ENABLE_LWP=
7239 if test "$enable_lotuswordpro" = "yes"; then
7240     ENABLE_LWP="TRUE"
7241     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7243 AC_SUBST(ENABLE_LWP)
7245 dnl ===================================================================
7246 dnl Check for gperf
7247 dnl ===================================================================
7248 AC_PATH_PROG(GPERF, gperf)
7249 if test -z "$GPERF"; then
7250     AC_MSG_ERROR([gperf not found but needed. Install it.])
7252 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7253     GPERF=`cygpath -m $GPERF`
7255 AC_MSG_CHECKING([gperf version])
7256 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7257     AC_MSG_RESULT([OK])
7258 else
7259     AC_MSG_ERROR([too old, you need at least 3.0.0])
7261 AC_SUBST(GPERF)
7263 dnl ===================================================================
7264 dnl Check for building ODK
7265 dnl ===================================================================
7266 if test "$enable_odk" = no; then
7267     unset DOXYGEN
7268 else
7269     if test "$with_doxygen" = no; then
7270         AC_MSG_CHECKING([for doxygen])
7271         unset DOXYGEN
7272         AC_MSG_RESULT([no])
7273     else
7274         if test "$with_doxygen" = yes; then
7275             AC_PATH_PROG([DOXYGEN], [doxygen])
7276             if test -z "$DOXYGEN"; then
7277                 if test "$enable_odk" = "" ; then
7278                     enable_odk="no"
7279                 else
7280                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7281                 fi
7282             fi
7283         else
7284             AC_MSG_CHECKING([for doxygen])
7285             DOXYGEN=$with_doxygen
7286             AC_MSG_RESULT([$DOXYGEN])
7287         fi
7288         if test -n "$DOXYGEN"; then
7289             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7290             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7291             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7292                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7293             fi
7294         fi
7295     fi
7297 AC_SUBST([DOXYGEN])
7299 AC_MSG_CHECKING([whether to build the ODK])
7300 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7301     AC_MSG_RESULT([yes])
7303     if test "$with_java" != "no"; then
7304         AC_MSG_CHECKING([whether to build unowinreg.dll])
7305         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7306             # build on Win by default
7307             enable_build_unowinreg=yes
7308         fi
7309         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7310             AC_MSG_RESULT([no])
7311             BUILD_UNOWINREG=
7312         else
7313             AC_MSG_RESULT([yes])
7314             BUILD_UNOWINREG=TRUE
7315         fi
7316         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7317             if test -z "$with_mingw_cross_compiler"; then
7318                 dnl Guess...
7319                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7320             elif test -x "$with_mingw_cross_compiler"; then
7321                  MINGWCXX="$with_mingw_cross_compiler"
7322             else
7323                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7324             fi
7326             if test "$MINGWCXX" = "false"; then
7327                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7328             fi
7330             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7331             if test -x "$mingwstrip_test"; then
7332                 MINGWSTRIP="$mingwstrip_test"
7333             else
7334                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7335             fi
7337             if test "$MINGWSTRIP" = "false"; then
7338                 AC_MSG_ERROR(MinGW32 binutils not found.)
7339             fi
7340         fi
7341     fi
7342     BUILD_TYPE="$BUILD_TYPE ODK"
7343 else
7344     AC_MSG_RESULT([no])
7345     BUILD_UNOWINREG=
7347 AC_SUBST(BUILD_UNOWINREG)
7348 AC_SUBST(MINGWCXX)
7349 AC_SUBST(MINGWSTRIP)
7351 dnl ===================================================================
7352 dnl Check for system zlib
7353 dnl ===================================================================
7354 if test "$with_system_zlib" = "auto"; then
7355     case "$_os" in
7356     WINNT)
7357         with_system_zlib="$with_system_libs"
7358         ;;
7359     *)
7360         with_system_zlib=yes
7361         ;;
7362     esac
7365 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7366 dnl and has no pkg-config for it at least on some tinderboxes,
7367 dnl so leaving that out for now
7368 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7369 AC_MSG_CHECKING([which zlib to use])
7370 if test "$with_system_zlib" = "yes"; then
7371     AC_MSG_RESULT([external])
7372     SYSTEM_ZLIB=TRUE
7373     AC_CHECK_HEADER(zlib.h, [],
7374         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7375     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7376         [AC_MSG_ERROR(zlib not found or functional)], [])
7377 else
7378     AC_MSG_RESULT([internal])
7379     SYSTEM_ZLIB=
7380     BUILD_TYPE="$BUILD_TYPE ZLIB"
7381     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7382     ZLIB_LIBS="-lzlib"
7384 AC_SUBST(ZLIB_CFLAGS)
7385 AC_SUBST(ZLIB_LIBS)
7386 AC_SUBST(SYSTEM_ZLIB)
7388 dnl ===================================================================
7389 dnl Check for system jpeg
7390 dnl ===================================================================
7391 if test "$with_jpeg_turbo" = "auto"; then
7392     # TODO use jpeg-turbo on Darwin too
7393     case "$_os" in
7394     WINNT)
7395         with_jpeg_turbo=yes
7396         ;;
7397     *)
7398         with_jpeg_turbo=no
7399         ;;
7400     esac
7403 if test "$with_system_jpeg" = "yes"; then
7404     AC_MSG_RESULT([external])
7405     SYSTEM_JPEG=TRUE
7406     AC_CHECK_HEADER(jpeglib.h, [],
7407         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7408     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7409     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7410     libo_MINGW_CHECK_DLL([libjpeg])
7411 else
7412     SYSTEM_JPEG=
7413     if test "$with_jpeg_turbo" = "yes"; then
7414         AC_MSG_RESULT([internal, jpeg-turbo])
7415         BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7416         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7417         if test -z "$NASM" -a "$build_os" = "cygwin" -a -x "/opt/lo/bin/nasm"; then
7418             NASM="/opt/lo/bin/nasm"
7419         fi
7420         if test -z "$NASM"; then
7421 cat << _EOS
7422 ****************************************************************************
7423 You need nasm (Netwide Assembler) to build internal jpeg library.
7424 To get one please do:
7426 _EOS
7427         if test "$build_os" = "cygwin"; then
7428 cat << _EOS
7429 install a pre-compiled binary for Win32
7431  mkdir -p /opt/lo/bin
7432  cd /opt/lo/bin
7433  wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7434  chmod +x nasm
7435 _EOS
7436             else
7437 cat << _EOS
7438 consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
7439 _EOS
7440             fi
7441 cat << _EOS
7443 or get and install one from http://www.nasm.us/
7445 Then re-run autogen.sh
7447 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7448 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7450 _EOS
7451         AC_MSG_ERROR([no nasm (Netwide Assembler) found])
7452         fi
7453     else
7454         AC_MSG_RESULT([internal, jpeg])
7455         BUILD_TYPE="$BUILD_TYPE JPEG"
7456     fi
7458 AC_SUBST(NASM)
7459 AC_SUBST(SYSTEM_JPEG)
7461 dnl ===================================================================
7462 dnl Check for system clucene
7463 dnl ===================================================================
7464 dnl we should rather be using
7465 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7466 dnl but the contribs-lib check seems tricky
7467 AC_MSG_CHECKING([which clucene to use])
7468 if test "$with_system_clucene" = "yes"; then
7469     AC_MSG_RESULT([external])
7470     SYSTEM_CLUCENE=TRUE
7471     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7472     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7473     AC_LANG_PUSH([C++])
7474     save_CXXFLAGS=$CXXFLAGS
7475     save_CPPFLAGS=$CPPFLAGS
7476     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7477     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7478     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7479     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7480     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7481                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7482     CXXFLAGS=$save_CXXFLAGS
7483     CPPFLAGS=$save_CPPFLAGS
7484     AC_LANG_POP([C++])
7486     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7487 else
7488     AC_MSG_RESULT([internal])
7489     SYSTEM_CLUCENE=
7490     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7492 AC_SUBST(SYSTEM_CLUCENE)
7493 AC_SUBST(CLUCENE_CFLAGS)
7494 AC_SUBST(CLUCENE_LIBS)
7496 dnl ===================================================================
7497 dnl Check for system expat
7498 dnl ===================================================================
7499 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7500 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7501 AC_MSG_CHECKING([which expat to use])
7502 if test "$with_system_expat" = "yes"; then
7503     AC_MSG_RESULT([external])
7504     SYSTEM_EXPAT=TRUE
7505     AC_CHECK_HEADER(expat.h, [],
7506         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7507     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7508         [AC_MSG_RESULT(expat library not found or functional.)], [])
7509     libo_MINGW_CHECK_DLL([libexpat])
7510 else
7511     AC_MSG_RESULT([internal])
7512     SYSTEM_EXPAT=
7513     BUILD_TYPE="$BUILD_TYPE EXPAT"
7515 AC_SUBST(SYSTEM_EXPAT)
7517 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7518 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7519     ENABLE_EOT="TRUE"
7520     AC_DEFINE([ENABLE_EOT])
7521     AC_MSG_RESULT([yes])
7523     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7524 else
7525     ENABLE_EOT=
7526     AC_MSG_RESULT([no])
7528 AC_SUBST([ENABLE_EOT])
7530 dnl ===================================================================
7531 dnl Check for system librevenge
7532 dnl ===================================================================
7533 AS_IF([test "$COM" = "MSC"],
7534       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7535       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7537 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7539 dnl ===================================================================
7540 dnl Check for system libe-book
7541 dnl ===================================================================
7542 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1 >= 0.1.1])
7544 dnl ===================================================================
7545 dnl Check for system libetonyek
7546 dnl ===================================================================
7547 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1 >= 0.1.1])
7549 dnl ===================================================================
7550 dnl Check for system libfreehand
7551 dnl ===================================================================
7552 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7554 dnl ===================================================================
7555 dnl Check for system libodfgen
7556 dnl ===================================================================
7557 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7559 dnl ===================================================================
7560 dnl Check for system libcdr
7561 dnl ===================================================================
7562 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7564 dnl ===================================================================
7565 dnl Check for system libmspub
7566 dnl ===================================================================
7567 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7569 dnl ===================================================================
7570 dnl Check for system libmwaw
7571 dnl ===================================================================
7572 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.4])
7574 dnl ===================================================================
7575 dnl Check for system libpagemaker
7576 dnl ===================================================================
7577 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7579 dnl ===================================================================
7580 dnl Check for system libvisio
7581 dnl ===================================================================
7582 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7584 dnl ===================================================================
7585 dnl Check for system libcmis
7586 dnl ===================================================================
7587 # libcmis requires curl and we can't build curl for iOS
7588 if test $_os != iOS; then
7589     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7590     ENABLE_CMIS=TRUE
7591 else
7592     ENABLE_CMIS=
7594 AC_SUBST(ENABLE_CMIS)
7596 dnl ===================================================================
7597 dnl Check for system libwpd
7598 dnl ===================================================================
7599 AS_IF([test "$COM" = "MSC"],
7600       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7601       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7603 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7605 dnl ===================================================================
7606 dnl Check for system lcms2
7607 dnl ===================================================================
7608 if test "$with_system_lcms2" = "yes"; then
7609     libo_MINGW_CHECK_DLL([liblcms2])
7610 else
7611     SYSTEM_LCMS2=
7613 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7614 if test "$GCC" = "yes"; then
7615     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7617 if test "$COM" = "MSC"; then # override the above
7618     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7621 dnl ===================================================================
7622 dnl Check for system cppunit
7623 dnl ===================================================================
7624 if test "$cross_compiling" != "yes"; then
7625     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7628 dnl ===================================================================
7629 dnl Check whether freetype is available
7630 dnl ===================================================================
7631 if test  "$test_freetype" = "yes"; then
7632     AC_MSG_CHECKING([whether freetype is available])
7633     # FreeType has 3 different kinds of versions
7634     # * release, like 2.4.10
7635     # * libtool, like 13.0.7 (this what pkg-config returns)
7636     # * soname
7637     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7638     #
7639     # 9.9.3 is 2.2.0
7640     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7641     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7642     SYSTEM_FREETYPE=TRUE
7643     _save_libs="$LIBS"
7644     _save_cflags="$CFLAGS"
7645     LIBS="$LIBS $FREETYPE_LIBS"
7646     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7647     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7648     LIBS="$_save_libs"
7649     CFLAGS="$_save_cflags"
7651 AC_SUBST(FREETYPE_CFLAGS)
7652 AC_SUBST(FREETYPE_LIBS)
7653 AC_SUBST([SYSTEM_FREETYPE])
7655 dnl ===================================================================
7656 dnl Check for system libabw
7657 dnl ===================================================================
7658 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7660 dnl ===================================================================
7661 dnl Check for system libwps
7662 dnl ===================================================================
7663 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.3])
7665 dnl ===================================================================
7666 dnl Check for system libwpg
7667 dnl ===================================================================
7668 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7670 # ===================================================================
7671 # Check for system libxslt
7672 # to prevent incompatibilities between internal libxml2 and external libxslt,
7673 # or vice versa, use with_system_libxml here
7674 # ===================================================================
7675 if test "$with_system_libxml" = "auto"; then
7676     case "$_os" in
7677     WINNT|iOS|Android)
7678         with_system_libxml="$with_system_libs"
7679         ;;
7680     *)
7681         with_system_libxml=yes
7682         ;;
7683     esac
7686 AC_MSG_CHECKING([which libxslt to use])
7687 if test "$with_system_libxml" = "yes"; then
7688     AC_MSG_RESULT([external])
7689     SYSTEM_LIBXSLT=TRUE
7690     if test "$_os" = "Darwin"; then
7691         dnl make sure to use SDK path
7692         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7693         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7694         dnl omit -L/usr/lib
7695         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7696         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7697     else
7698         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7699         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7700         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7701         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7702     fi
7704     dnl Check for xsltproc
7705     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7706     if test "$XSLTPROC" = "no"; then
7707         AC_MSG_ERROR([xsltproc is required])
7708     fi
7710     libo_MINGW_CHECK_DLL([libxslt])
7711     libo_MINGW_CHECK_DLL([libexslt])
7712     libo_MINGW_TRY_DLL([iconv])
7713 else
7714     AC_MSG_RESULT([internal])
7715     SYSTEM_LIBXSLT=
7716     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7718     if test "$cross_compiling" = "yes"; then
7719         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7720         if test "$XSLTPROC" = "no"; then
7721             AC_MSG_ERROR([xsltproc is required])
7722         fi
7723     fi
7725 AC_SUBST(SYSTEM_LIBXSLT)
7726 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7727     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7729 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7731 AC_SUBST(LIBEXSLT_CFLAGS)
7732 AC_SUBST(LIBEXSLT_LIBS)
7733 AC_SUBST(LIBXSLT_CFLAGS)
7734 AC_SUBST(LIBXSLT_LIBS)
7735 AC_SUBST(XSLTPROC)
7737 # ===================================================================
7738 # Check for system libxml
7739 # ===================================================================
7740 AC_MSG_CHECKING([which libxml to use])
7741 if test "$with_system_libxml" = "yes"; then
7742     AC_MSG_RESULT([external])
7743     SYSTEM_LIBXML=TRUE
7744     if test "$_os" = "Darwin"; then
7745         dnl make sure to use SDK path
7746         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7747         dnl omit -L/usr/lib
7748         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7749     elif test $_os = iOS; then
7750         dnl make sure to use SDK path
7751         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7752         LIBXML_CFLAGS="-I$usr/include/libxml2"
7753         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7754     else
7755         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7756         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7757     fi
7759     dnl Check for xmllint
7760     AC_PATH_PROG(XMLLINT, xmllint, no)
7761     if test "$XMLLINT" = "no"; then
7762         AC_MSG_ERROR([xmllint is required])
7763     fi
7765     libo_MINGW_CHECK_DLL([libxml2])
7766     libo_MINGW_TRY_DLL([zlib1])
7767 else
7768     AC_MSG_RESULT([internal])
7769     SYSTEM_LIBXML=
7770     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
7771     if test "$COM" = "MSC"; then
7772         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7773     fi
7774     if test "$COM" = "MSC"; then
7775         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
7776     else
7777         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
7778     fi
7779     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7781 AC_SUBST(SYSTEM_LIBXML)
7782 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7783     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7785 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7786 AC_SUBST(LIBXML_CFLAGS)
7787 AC_SUBST(LIBXML_LIBS)
7788 AC_SUBST(XMLLINT)
7790 # =====================================================================
7791 # Checking for a Python interpreter with version >= 2.6.
7792 # Build and runtime requires Python 3 compatible version (>= 2.6).
7793 # Optionally user can pass an option to configure, i. e.
7794 # ./configure PYTHON=/usr/bin/python
7795 # =====================================================================
7796 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7797     # This allows a lack of system python with no error, we use internal one in that case.
7798     AM_PATH_PYTHON([2.6],, [:])
7799     # Clean PYTHON_VERSION checked below if cross-compiling
7800     PYTHON_VERSION=""
7801     if test "$PYTHON" != ":"; then
7802         PYTHON_FOR_BUILD=$PYTHON
7803     fi
7805 AC_SUBST(PYTHON_FOR_BUILD)
7807 # Checks for Python to use for Pyuno
7808 AC_MSG_CHECKING([which Python to use for Pyuno])
7809 case "$enable_python" in
7810 no|disable)
7811     if test -z $PYTHON_FOR_BUILD; then
7812         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7813         # requirement from the choice whether to include Python stuff in the installer, but why
7814         # bother?
7815         AC_MSG_ERROR([Python is required at build time.])
7816     fi
7817     enable_python=no
7818     AC_MSG_RESULT([none])
7819     ;;
7820 ""|yes|auto)
7821     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7822         AC_MSG_RESULT([no, overridden by --disable-scripting])
7823         enable_python=no
7824     elif test $build_os = cygwin; then
7825         dnl When building on Windows we don't attempt to use any installed
7826         dnl "system"  Python.
7827         dnl
7828         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7829         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7830         dnl MinGW cross-compilation setups.)
7831         AC_MSG_RESULT([fully internal])
7832         enable_python=internal
7833     elif test "$cross_compiling" = yes; then
7834         AC_MSG_RESULT([system])
7835         enable_python=system
7836     else
7837         # Unset variables set by the above AM_PATH_PYTHON so that
7838         # we actually do check anew.
7839         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
7840         AM_PATH_PYTHON([3.3],, [:])
7841         if test "$PYTHON" = ":"; then
7842             if test -z "$PYTHON_FOR_BUILD"; then
7843                 AC_MSG_RESULT([fully internal])
7844             else
7845                 AC_MSG_RESULT([internal])
7846             fi
7847             enable_python=internal
7848         else
7849             AC_MSG_RESULT([system])
7850             enable_python=system
7851         fi
7852     fi
7853     ;;
7854 internal)
7855     AC_MSG_RESULT([internal])
7856     ;;
7857 fully-internal)
7858     AC_MSG_RESULT([fully internal])
7859     enable_python=internal
7860     ;;
7861 system)
7862     AC_MSG_RESULT([system])
7863     ;;
7865     AC_MSG_ERROR([Incorrect --enable-python option])
7866     ;;
7867 esac
7869 if test $enable_python != no; then
7870     BUILD_TYPE="$BUILD_TYPE PYUNO"
7873 if test $enable_python = system; then
7874     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7875         python_version=2.7
7876         PYTHON=python$python_version
7877         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
7878             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
7879             PYTHON_LIBS="-framework Python"
7880         else
7881             PYTHON_CFLAGS="`$PYTHON-config --includes`"
7882             PYTHON_LIBS="`$PYTHON-config --libs`"
7883         fi
7884     fi
7885     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
7886         # Fallback: Accept these in the environment, or as set above
7887         # for MacOSX.
7888         :
7889     elif test "$cross_compiling" != yes; then
7890         # Unset variables set by the above AM_PATH_PYTHON so that
7891         # we actually do check anew.
7892         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
7893         # This causes an error if no python command is found
7894         AM_PATH_PYTHON([3.3])
7895         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
7896         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
7897         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
7898         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
7899         if test -z "$PKG_CONFIG"; then
7900             PYTHON_CFLAGS="-I$python_include"
7901             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7902         elif $PKG_CONFIG --exists python-$python_version; then
7903             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
7904             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
7905         else
7906             PYTHON_CFLAGS="-I$python_include"
7907             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7908         fi
7909     else
7910         dnl How to find out the cross-compilation Python installation path?
7911         dnl Let's hardocode what we know for different distributions for now...
7912         for python_version in 2.6; do
7913             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
7914                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
7915                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
7916                 AC_MSG_CHECKING([for python.exe])
7917                 libo_MINGW_CHECK_DLL([libpython$python_version])
7918                 libo_MINGW_CHECK_DLL([libreadline6])
7919                 libo_MINGW_CHECK_DLL([libtermcap])
7920                 # could we somehow extract the really mingw python version from
7921                 # actual distro package?
7922                 # 2.6.2 currently on OpenSUSE 12.1?
7923                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
7924                 PYTHON_VERSION=$python_version.2
7925                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
7926                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
7927                 break
7928             fi
7929         done
7930         AC_MSG_CHECKING([for python version])
7931         AS_IF([test -n "$PYTHON_VERSION"],
7932               [AC_MSG_RESULT([$PYTHON_VERSION])],
7933               [AC_MSG_RESULT([not found])
7934                AC_MSG_ERROR([no usable python found])])
7935         test -n "$PYTHON_CFLAGS" && break
7936     fi
7937     # let the PYTHON_FOR_BUILD match the same python installation that
7938     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
7939     # better for PythonTests.
7940     PYTHON_FOR_BUILD=$PYTHON
7943 dnl By now enable_python should be "system", "internal" or "no"
7944 case $enable_python in
7945 system)
7946     SYSTEM_PYTHON=TRUE
7948     if test "$CROSS_COMPILING" != TRUE; then
7949         dnl Check if the headers really work
7950         save_CPPFLAGS="$CPPFLAGS"
7951         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
7952         AC_CHECK_HEADER(Python.h, [],
7953            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
7954            [])
7955         CPPFLAGS="$save_CPPFLAGS"
7957         AC_LANG_PUSH(C)
7958         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
7959         AC_MSG_CHECKING([for correct python library version])
7960            AC_RUN_IFELSE([AC_LANG_SOURCE([[
7961 #include <Python.h>
7963 int main(int argc, char **argv) {
7964        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
7965            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
7966        else return 1;
7968            ]])],[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])],[])
7969         CFLAGS=$save_CFLAGS
7970         AC_LANG_POP(C)
7972         dnl FIXME Check if the Python library can be linked with, too?
7973     fi
7974     ;;
7976 internal)
7977     SYSTEM_PYTHON=
7978     PYTHON_VERSION_MAJOR=3
7979     PYTHON_VERSION_MINOR=3
7980     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
7981     BUILD_TYPE="$BUILD_TYPE PYTHON"
7982     # Embedded Python dies without Home set
7983     if test "$HOME" = ""; then
7984         export HOME=""
7985     fi
7986     # bz2 tarball and bzip2 is not standard
7987     if test -z "$BZIP2"; then
7988         AC_PATH_PROG( BZIP2, bzip2)
7989         if test -z "$BZIP2"; then
7990             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
7991         fi
7992     fi
7993     ;;
7995     DISABLE_PYTHON=TRUE
7996     SYSTEM_PYTHON=
7997     ;;
7999     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8000     ;;
8001 esac
8003 AC_SUBST(DISABLE_PYTHON)
8004 AC_SUBST(SYSTEM_PYTHON)
8005 AC_SUBST(PYTHON_CFLAGS)
8006 AC_SUBST(PYTHON_LIBS)
8007 AC_SUBST(PYTHON_VERSION)
8008 AC_SUBST(PYTHON_VERSION_MAJOR)
8009 AC_SUBST(PYTHON_VERSION_MINOR)
8011 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8012 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8013     AC_MSG_RESULT([yes])
8014     ENABLE_MARIADBC=TRUE
8015     MARIADBC_MAJOR=1
8016     MARIADBC_MINOR=0
8017     MARIADBC_MICRO=2
8018     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8019 else
8020     AC_MSG_RESULT([no])
8021     ENABLE_MARIADBC=
8023 AC_SUBST(ENABLE_MARIADBC)
8024 AC_SUBST(MARIADBC_MAJOR)
8025 AC_SUBST(MARIADBC_MINOR)
8026 AC_SUBST(MARIADBC_MICRO)
8028 if test "$ENABLE_MARIADBC" = "TRUE"; then
8030     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8032     dnl ===================================================================
8033     dnl Check for system MariaDB
8034     dnl ===================================================================
8035     AC_MSG_CHECKING([which MariaDB to use])
8036     if test "$with_system_mariadb" = "yes"; then
8037         AC_MSG_RESULT([external])
8038         SYSTEM_MARIADB=TRUE
8039         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8040         if test -z "$MARIADBCONFIG"; then
8041             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8042             if test -z "$MARIADBCONFIG"; then
8043                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8044                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8045             fi
8046         fi
8047         AC_MSG_CHECKING([MariaDB version])
8048         MARIADB_VERSION=`$MARIADBCONFIG --version`
8049         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8050         if test "$MARIADB_MAJOR" -ge "5"; then
8051             AC_MSG_RESULT([OK])
8052         else
8053             AC_MSG_ERROR([too old, use 5.0.x or later])
8054         fi
8055         AC_MSG_CHECKING([for MariaDB Client library])
8056         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8057         if test "$COM_GCC_IS_CLANG" = TRUE; then
8058             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8059         fi
8060         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8061         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8062         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8063         dnl linux32:
8064         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8065             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8066             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8067                 | sed -e 's|/lib64/|/lib/|')
8068         fi
8069         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8070         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8071         if test "$enable_bundle_mariadb" = "yes"; then
8072             AC_MSG_RESULT([yes])
8073             BUNDLE_MARIADB=TRUE
8074             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8076 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8078 /g' | grep -E '(mysqlclient|mariadb)')
8079             if test "$_os" = "Darwin"; then
8080                 LIBMARIADB=${LIBMARIADB}.dylib
8081             elif test "$_os" = "WINNT"; then
8082                 LIBMARIADB=${LIBMARIADB}.dll
8083             else
8084                 LIBMARIADB=${LIBMARIADB}.so
8085             fi
8086             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8087             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8088             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8089                 AC_MSG_RESULT([found.])
8090                 PathFormat "$LIBMARIADB_PATH"
8091                 LIBMARIADB_PATH="$formatted_path"
8092             else
8093                 AC_MSG_ERROR([not found.])
8094             fi
8095         else
8096             AC_MSG_RESULT([no])
8097             BUNDLE_MARIADB=
8098         fi
8099     else
8100         AC_MSG_RESULT([internal])
8101         SYSTEM_MARIADB=
8102         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8103         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8104         BUILD_TYPE="$BUILD_TYPE MARIADB"
8105     fi
8107     AC_SUBST(SYSTEM_MARIADB)
8108     AC_SUBST(MARIADB_CFLAGS)
8109     AC_SUBST(MARIADB_LIBS)
8110     AC_SUBST(LIBMARIADB)
8111     AC_SUBST(LIBMARIADB_PATH)
8112     AC_SUBST(BUNDLE_MARIADB)
8114     AC_LANG_PUSH([C++])
8115     dnl ===================================================================
8116     dnl Check for system MySQL C++ Connector
8117     dnl ===================================================================
8118     # FIXME!
8119     # who thought this too-generic cppconn dir was a good idea?
8120     AC_MSG_CHECKING([MySQL Connector/C++])
8121     if test "$with_system_mysql_cppconn" = "yes"; then
8122         AC_MSG_RESULT([external])
8123         SYSTEM_MYSQL_CPPCONN=TRUE
8124         AC_LANG_PUSH([C++])
8125         AC_CHECK_HEADER(mysql_driver.h, [],
8126                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8127         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8128                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8129         save_LIBS=$LIBS
8130         LIBS="$LIBS -lmysqlcppconn"
8131         AC_MSG_CHECKING([version])
8132         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8133 #include <mysql_driver.h>
8135 int main(int argc, char **argv) {
8136     sql::Driver *driver;
8137     driver = get_driver_instance();
8138     if (driver->getMajorVersion() > 1 || \
8139        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8140        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8141         return 0;
8142       else
8143         return 1;
8145       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8147         AC_LANG_POP([C++])
8148         LIBS=$save_LIBS
8149     else
8150         AC_MSG_RESULT([internal])
8151         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8152         SYSTEM_MYSQL_CPPCONN=
8153     fi
8154     AC_LANG_POP([C++])
8156 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8158 dnl ===================================================================
8159 dnl Check for system hsqldb
8160 dnl ===================================================================
8161 if test "$with_java" != "no"; then
8162     HSQLDB_USE_JDBC_4_1=
8163     AC_MSG_CHECKING([which hsqldb to use])
8164     if test "$with_system_hsqldb" = "yes"; then
8165         AC_MSG_RESULT([external])
8166         SYSTEM_HSQLDB=TRUE
8167         if test -z $HSQLDB_JAR; then
8168             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8169         fi
8170         AC_CHECK_FILE($HSQLDB_JAR, [],
8171                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8172         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8173         export HSQLDB_JAR
8174         if $PERL -e \
8175            'use Archive::Zip;
8176             my $file = "$ENV{'HSQLDB_JAR'}";
8177             my $zip = Archive::Zip->new( $file );
8178             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8179             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8180             {
8181                 push @l, split(/\n/, $mf);
8182                 foreach my $line (@l)
8183                 {
8184                     if ($line =~ m/Specification-Version:/)
8185                     {
8186                         ($t, $version) = split (/:/,$line);
8187                         $version =~ s/^\s//;
8188                         ($a, $b, $c, $d) = split (/\./,$version);
8189                         if ($c == "0" && $d > "8")
8190                         {
8191                             exit 0;
8192                         }
8193                         else
8194                         {
8195                             exit 1;
8196                         }
8197                     }
8198                 }
8199             }
8200             else
8201             {
8202                 exit 1;
8203             }'; then
8204             AC_MSG_RESULT([yes])
8205         else
8206             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8207         fi
8208     else
8209         AC_MSG_RESULT([internal])
8210         SYSTEM_HSQLDB=
8211         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8212         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8213         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8214         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8215             AC_MSG_RESULT([yes])
8216             HSQLDB_USE_JDBC_4_1=TRUE
8217         else
8218             AC_MSG_RESULT([no])
8219         fi
8220     fi
8221     AC_SUBST(SYSTEM_HSQLDB)
8222     AC_SUBST(HSQLDB_JAR)
8223     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8226 dnl ===================================================================
8227 dnl Check for PostgreSQL stuff
8228 dnl ===================================================================
8229 if test "x$enable_postgresql_sdbc" != "xno"; then
8230     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8232     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8233         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8234     fi
8235     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8236         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8237     fi
8239     AC_MSG_CHECKING([PostgreSQL C interface])
8240     if test "$with_system_postgresql" = "yes"; then
8241         AC_MSG_RESULT([external PostgreSQL])
8242         SYSTEM_POSTGRESQL=TRUE
8243         if test "$_os" = Darwin; then
8244             supp_path=''
8245             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8246                 pg_supp_path="$P_SEP$d$pg_supp_path"
8247             done
8248         fi
8249         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8250         if test -z "$PGCONFIG"; then
8251             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8252         fi
8253         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8254         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8255     else
8256         # if/when anything else than PostgreSQL uses Kerberos,
8257         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8258         WITH_KRB5=
8259         WITH_GSSAPI=
8260         case "$_os" in
8261         Darwin)
8262             # MacOS X has system MIT Kerberos 5 since 10.4
8263             if test "$with_krb5" != "no"; then
8264                 WITH_KRB5=TRUE
8265                 save_LIBS=$LIBS
8266                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8267                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8268                 KRB5_LIBS=$LIBS
8269                 LIBS=$save_LIBS
8270                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8271                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8272                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8273                 LIBS=$save_LIBS
8274             fi
8275             if test "$with_gssapi" != "no"; then
8276                 WITH_GSSAPI=TRUE
8277                 save_LIBS=$LIBS
8278                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8279                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8280                 GSSAPI_LIBS=$LIBS
8281                 LIBS=$save_LIBS
8282             fi
8283             ;;
8284         WINNT)
8285             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8286                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8287             fi
8288             ;;
8289         Linux|GNU|*BSD|DragonFly)
8290             if test "$with_krb5" != "no"; then
8291                 WITH_KRB5=TRUE
8292                 save_LIBS=$LIBS
8293                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8294                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8295                 KRB5_LIBS=$LIBS
8296                 LIBS=$save_LIBS
8297                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8298                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8299                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8300                 LIBS=$save_LIBS
8301             fi
8302             if test "$with_gssapi" != "no"; then
8303                 WITH_GSSAPI=TRUE
8304                 save_LIBS=$LIBS
8305                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8306                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8307                 GSSAPI_LIBS=$LIBS
8308                 LIBS=$save_LIBS
8309             fi
8310             ;;
8311         *)
8312             if test "$with_krb5" = "yes"; then
8313                 WITH_KRB5=TRUE
8314                 save_LIBS=$LIBS
8315                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8316                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8317                 KRB5_LIBS=$LIBS
8318                 LIBS=$save_LIBS
8319                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8320                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8321                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8322                 LIBS=$save_LIBS
8323             fi
8324             if test "$with_gssapi" = "yes"; then
8325                 WITH_GSSAPI=TRUE
8326                 save_LIBS=$LIBS
8327                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8328                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8329                 LIBS=$save_LIBS
8330                 GSSAPI_LIBS=$LIBS
8331             fi
8332         esac
8334         if test -n "$with_libpq_path"; then
8335             SYSTEM_POSTGRESQL=TRUE
8336             AC_MSG_RESULT([external libpq])
8337             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8338             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8339         else
8340             SYSTEM_POSTGRESQL=
8341             AC_MSG_RESULT([internal])
8342             POSTGRESQL_LIB=""
8343             POSTGRESQL_INC="%OVERRIDE_ME%"
8344             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8345         fi
8346     fi
8347     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8348         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8349         save_CFLAGS=$CFLAGS
8350         save_CPPFLAGS=$CPPFLAGS
8351         save_LIBS=$LIBS
8352         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8353         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8354         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8355         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8356             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8357         CFLAGS=$save_CFLAGS
8358         CPPFLAGS=$save_CPPFLAGS
8359         LIBS=$save_LIBS
8360     fi
8361     BUILD_POSTGRESQL_SDBC=TRUE
8363 AC_SUBST(WITH_KRB5)
8364 AC_SUBST(WITH_GSSAPI)
8365 AC_SUBST(GSSAPI_LIBS)
8366 AC_SUBST(KRB5_LIBS)
8367 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8368 AC_SUBST(SYSTEM_POSTGRESQL)
8369 AC_SUBST(POSTGRESQL_INC)
8370 AC_SUBST(POSTGRESQL_LIB)
8372 dnl ===================================================================
8373 dnl Check for Firebird stuff
8374 dnl ===================================================================
8375 ENABLE_FIREBIRD_SDBC=""
8376 if test "x$enable_firebird_sdbc" = "xyes"; then
8377     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8379     dnl ===================================================================
8380     dnl Check for system Firebird
8381     dnl ===================================================================
8382     AC_MSG_CHECKING([which Firebird to use])
8383     if test "$with_system_firebird" = "yes"; then
8384         AC_MSG_RESULT([external])
8385         SYSTEM_FIREBIRD=TRUE
8386         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8387         if test -z "$FIREBIRDCONFIG"; then
8388             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8389             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8390             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8391         else
8392             AC_MSG_NOTICE([fb_config found])
8393             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8394             AC_MSG_CHECKING([for Firebird Client library])
8395             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8396             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8397         fi
8398         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8399         AC_MSG_CHECKING([Firebird version])
8400         if test -n "${FIREBIRD_VERSION}"; then
8401             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8402             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8403             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8404                 AC_MSG_RESULT([OK])
8405             else
8406                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8407             fi
8408         else
8409             __save_CFLAGS="${CFLAGS}"
8410             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8411             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8412 #if defined(FB_API_VER) && FB_API_VER == 25
8413 #else
8414 #error "Wrong Firebird API version"
8415 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8416             CFLAGS="${__save_CFLAGS}"
8417         fi
8418         ENABLE_FIREBIRD_SDBC="TRUE"
8419     elif test "$enable_database_connectivity" != yes; then
8420         AC_MSG_RESULT([none])
8421     elif test "$cross_compiling" = "yes"; then
8422         AC_MSG_RESULT([none])
8423     else
8424         dnl We need libatomic-ops for any non X86/X64 system
8425         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8426             dnl ===================================================================
8427             dnl Check for system libatomic-ops
8428             dnl ===================================================================
8429             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8430             if test "$with_system_libatomic_ops" = "yes"; then
8431                 SYSTEM_LIBATOMIC_OPS=TRUE
8432                 AC_CHECK_HEADERS(atomic_ops.h, [],
8433                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8434             else
8435                 SYSTEM_LIBATOMIC_OPS=
8436                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8437                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8438                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8439             fi
8440         fi
8442         AC_MSG_RESULT([internal])
8443         SYSTEM_FIREBIRD=
8444         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8445         FIREBIRD_LIBS="-lfbembed"
8447         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8448         ENABLE_FIREBIRD_SDBC="TRUE"
8449     fi
8451 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8452 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8453 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8454 AC_SUBST(LIBATOMIC_OPS_LIBS)
8455 AC_SUBST(SYSTEM_FIREBIRD)
8456 AC_SUBST(FIREBIRD_CFLAGS)
8457 AC_SUBST(FIREBIRD_LIBS)
8458 dnl AC_SUBST([TOMMATH_CFLAGS])
8459 dnl AC_SUBST([TOMMATH_LIBS])
8461 dnl ===================================================================
8462 dnl Check for system curl
8463 dnl ===================================================================
8464 AC_MSG_CHECKING([which libcurl to use])
8465 if test "$with_system_curl" = "auto"; then
8466     with_system_curl="$with_system_libs"
8469 if test "$with_system_curl" = "yes"; then
8470     AC_MSG_RESULT([external])
8471     SYSTEM_CURL=TRUE
8473     AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8475     # First try PKGCONFIG and then fall back
8476     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8478     if test -n "$CURL_PKG_ERRORS"; then
8479         AC_PATH_PROG(CURLCONFIG, curl-config)
8480         if test -z "$CURLCONFIG"; then
8481             AC_MSG_ERROR([curl development files not found])
8482         fi
8483         CURL_LIBS=`$CURLCONFIG --libs`
8484         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8485         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8487         case $curl_version in
8488         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8489         dnl so they need to be doubled to end up in the configure script
8490         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8491             ;;
8492         *)
8493             AC_MSG_ERROR([no, you have $curl_version])
8494             ;;
8495         esac
8496     fi
8497     AC_MSG_RESULT([yes])
8499     libo_MINGW_CHECK_DLL([libcurl])
8500     libo_MINGW_TRY_DLL([libintl])
8501     libo_MINGW_TRY_DLL([libidn])
8502     libo_MINGW_TRY_DLL([libnspr4])
8503     libo_MINGW_TRY_DLL([nssutil3])
8504     libo_MINGW_TRY_DLL([libplc4])
8505     libo_MINGW_TRY_DLL([libplds4])
8506     libo_MINGW_TRY_DLL([nss3])
8507     libo_MINGW_TRY_DLL([ssl3])
8508     libo_MINGW_TRY_DLL([libgpg-error])
8509     libo_MINGW_TRY_DLL([libgcrypt])
8510     libo_MINGW_TRY_DLL([libssh2])
8511     ENABLE_CURL=TRUE
8512 elif test $_os = iOS; then
8513     # Let's see if we need curl, I think not?
8514     AC_MSG_RESULT([none])
8515     ENABLE_CURL=
8516 else
8517     AC_MSG_RESULT([internal])
8518     SYSTEM_CURL=
8519     BUILD_TYPE="$BUILD_TYPE CURL"
8520     ENABLE_CURL=TRUE
8522 AC_SUBST(SYSTEM_CURL)
8523 AC_SUBST(CURL_CFLAGS)
8524 AC_SUBST(CURL_LIBS)
8525 AC_SUBST(ENABLE_CURL)
8527 dnl ===================================================================
8528 dnl Check for system boost
8529 dnl ===================================================================
8530 AC_MSG_CHECKING([which boost to use])
8531 if test "$with_system_boost" = "yes"; then
8532     AC_MSG_RESULT([external])
8533     SYSTEM_BOOST=TRUE
8534     AX_BOOST_BASE(1.47)
8535     AX_BOOST_DATE_TIME
8536     AX_BOOST_IOSTREAMS
8537     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8538     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8539     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8540         # if not found, try again with 'lib' prefix
8541         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8542     fi
8543     AC_LANG_PUSH([C++])
8544     save_CXXFLAGS=$CXXFLAGS
8545     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8546     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8547        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8548     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8549        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8550     AC_CHECK_HEADER(boost/function.hpp, [],
8551        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8552     AC_MSG_CHECKING([whether boost signals2 works])
8553     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/signals2/signal.hpp>]],
8554         [[ boost::signals2::signal<void()> s; s(); ]])],
8555         [AC_MSG_RESULT([yes])],
8556         [AC_MSG_ERROR([no, install boost >= 1.55 or use --without-system-boost])])
8557     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8558     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8559     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8560 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8561     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8562         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8563     else
8564         AC_MSG_RESULT([yes])
8565     fi
8566     CXXFLAGS=$save_CXXFLAGS
8567     AC_LANG_POP([C++])
8568 else
8569     AC_MSG_RESULT([internal])
8570     BUILD_TYPE="$BUILD_TYPE BOOST"
8571     SYSTEM_BOOST=
8573 AC_SUBST(SYSTEM_BOOST)
8575 dnl ===================================================================
8576 dnl Check for system mdds
8577 dnl ===================================================================
8578 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.12.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8580 dnl ===================================================================
8581 dnl Check for system glm
8582 dnl ===================================================================
8583 AC_MSG_CHECKING([which glm to use])
8584 if test "$with_system_glm" = "yes"; then
8585     AC_MSG_RESULT([external])
8586     SYSTEM_GLM=TRUE
8587     AC_LANG_PUSH([C++])
8588     AC_CHECK_HEADER([glm/glm.hpp], [],
8589        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8590     AC_LANG_POP([C++])
8591 else
8592     AC_MSG_RESULT([internal])
8593     BUILD_TYPE="$BUILD_TYPE GLM"
8594     SYSTEM_GLM=
8596 AC_SUBST([SYSTEM_GLM])
8598 dnl ===================================================================
8599 dnl Check for system glew
8600 dnl ===================================================================
8601 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8603 dnl ===================================================================
8604 dnl Check for system vigra
8605 dnl ===================================================================
8606 AC_MSG_CHECKING([which vigra to use])
8607 if test "$with_system_vigra" = "yes"; then
8608     AC_MSG_RESULT([external])
8609     SYSTEM_VIGRA=TRUE
8610     AC_LANG_PUSH([C++])
8611     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8612        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8613     AC_LANG_POP([C++])
8614 else
8615     AC_MSG_RESULT([internal])
8616     BUILD_TYPE="$BUILD_TYPE VIGRA"
8617     SYSTEM_VIGRA=
8619 AC_SUBST(SYSTEM_VIGRA)
8621 dnl ===================================================================
8622 dnl Check for system odbc
8623 dnl ===================================================================
8624 AC_MSG_CHECKING([which odbc headers to use])
8625 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
8626     AC_MSG_RESULT([external])
8627     SYSTEM_ODBC_HEADERS=TRUE
8629     if test "$build_os" = "cygwin"; then
8630         save_CPPFLAGS=$CPPFLAGS
8631         find_winsdk
8632         PathFormat "$winsdktest"
8633         CPPFLAGS="$CPPFLAGS -I$formatted_path/include/um -I$formatted_path/include -I$formatted_path/include/shared"
8634         AC_CHECK_HEADER(sqlext.h, [],
8635             [AC_MSG_ERROR(odbc not found. install odbc)],
8636             [#include <windows.h>])
8637         CPPFLAGS=$save_CPPFLAGS
8638     else
8639         AC_CHECK_HEADER(sqlext.h, [],
8640             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8641     fi
8642 elif test "$enable_database_connectivity" != yes; then
8643     AC_MSG_RESULT([none])
8644 else
8645     AC_MSG_RESULT([internal])
8646     SYSTEM_ODBC_HEADERS=
8648 AC_SUBST(SYSTEM_ODBC_HEADERS)
8651 dnl ===================================================================
8652 dnl Check for system openldap
8653 dnl ===================================================================
8655 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8656 AC_MSG_CHECKING([which openldap library to use])
8657 if test "$with_system_openldap" = "yes"; then
8658     AC_MSG_RESULT([external])
8659     SYSTEM_OPENLDAP=TRUE
8660     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8661     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8662     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8663 else
8664     AC_MSG_RESULT([internal])
8665     SYSTEM_OPENLDAP=
8666     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8669 AC_SUBST(SYSTEM_OPENLDAP)
8671 dnl ===================================================================
8672 dnl Check for mozilla ab connectivity for windows
8673 dnl ===================================================================
8675 if test "$_os" = "WINNT"; then
8676     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8677     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8678         if test "$BITNESS_OVERRIDE" = 64; then
8679            AC_MSG_ERROR([--with-win-mozab-driver and --enable-64-bit options are mutually exclusive])
8680         fi
8681         WITH_MOZAB4WIN=TRUE
8682         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8683         BUILD_TYPE="$BUILD_TYPE MOZ"
8684         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8685         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8686         for dll in $MSVC80_DLLS; do
8687             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8688                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8689             fi
8690         done
8691     else
8692         AC_MSG_RESULT([no])
8693         WITH_MOZAB4WIN=
8694     fi
8696 AC_SUBST(WITH_MOZAB4WIN)
8697 AC_SUBST(MSVC80_DLLS)
8698 AC_SUBST(MSVC80_DLL_PATH)
8700 dnl ===================================================================
8701 dnl Check for TLS/SSL and cryptographic implementation to use
8702 dnl ===================================================================
8703 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8704 if test -n "$with_tls"; then
8705     case $with_tls in
8706     openssl)
8707         AC_DEFINE(USE_TLS_OPENSSL)
8708         TLS=OPENSSL
8710         if test "$enable_openssl" != "yes"; then
8711             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8712         fi
8714         # warn that OpenSSL has been selected but not all TLS code has this option
8715         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8716         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8717         ;;
8718     nss)
8719         AC_DEFINE(USE_TLS_NSS)
8720         TLS=NSS
8721         ;;
8722     *)
8723         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8724 openssl - OpenSSL
8725 nss - Mozilla's Network Security Services (NSS)
8726     ])
8727         ;;
8728     esac
8729 elif test $_os = iOS -o $_os = Android; then
8730     # We don't build NSS for iOS and Android
8731     AC_DEFINE(USE_TLS_OPENSSL)
8732     TLS=OPENSSL
8733 else
8734     # default to using NSS, it results in smaller oox lib
8735     AC_DEFINE(USE_TLS_NSS)
8736     TLS=NSS
8738 AC_MSG_RESULT([$TLS])
8739 AC_SUBST(TLS)
8741 dnl ===================================================================
8742 dnl Check for system NSS
8743 dnl ===================================================================
8744 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8745 if test "$with_system_nss" = "yes"; then
8746     libo_MINGW_CHECK_DLL([libnspr4])
8747     libo_MINGW_CHECK_DLL([libplc4])
8748     libo_MINGW_CHECK_DLL([libplds4])
8749     libo_MINGW_CHECK_DLL([nss3])
8750     libo_MINGW_CHECK_DLL([nssutil3])
8751     libo_MINGW_CHECK_DLL([smime3])
8752     libo_MINGW_CHECK_DLL([ssl3])
8755 dnl ===================================================================
8756 dnl Check for system mozilla headers
8757 dnl ===================================================================
8758 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8759 AC_MSG_CHECKING([which NPAPI headers to use])
8761 if test "$with_system_npapi_headers" = "yes"; then
8762     AC_MSG_RESULT([external])
8763     SYSTEM_NPAPI_HEADERS=TRUE
8764     # First try npapi-sdk:
8765     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8766     # Then go with libxul:
8767     if test "x$LOCATED" != "xyes"; then
8768         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8769     fi
8770     if test "x$LOCATED" != "xyes"; then
8771         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8772     fi
8773     # if still not found bail out
8774     if test "x$LOCATED" != "xyes"; then
8775         AC_MSG_ERROR([npapi.h header file not found])
8776     fi
8778     AC_LANG_PUSH([C])
8779     save_CFLAGS=$CFLAGS
8780     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8781     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8782     AC_COMPILE_IFELSE(
8783         [AC_LANG_SOURCE([[
8784             #define XP_UNIX
8785             #include <npapi.h>
8786             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8787             ]])],
8788         [AC_MSG_RESULT([const char*])],
8789         [
8790         AC_MSG_RESULT([char*])
8791         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8792         ])
8793     CFLAGS=$save_CFLAGS
8794     AC_LANG_POP([C])
8795     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8796 else
8797     AC_MSG_RESULT([internal])
8798         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER
8799     SYSTEM_NPAPI_HEADERS=
8801 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8802 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8803 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8805 dnl ===================================================================
8806 dnl Check for system sane
8807 dnl ===================================================================
8808 AC_MSG_CHECKING([which sane header to use])
8809 if test "$with_system_sane" = "yes"; then
8810     AC_MSG_RESULT([external])
8811     AC_CHECK_HEADER(sane/sane.h, [],
8812       [AC_MSG_ERROR(sane not found. install sane)], [])
8813 else
8814     AC_MSG_RESULT([internal])
8815     BUILD_TYPE="$BUILD_TYPE SANE"
8818 dnl ===================================================================
8819 dnl Check for system icu
8820 dnl ===================================================================
8821 SYSTEM_GENBRK=
8822 SYSTEM_GENCCODE=
8823 SYSTEM_GENCMN=
8825 ICU_MAJOR=54
8826 ICU_MINOR=1
8827 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
8828 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8829 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8830 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8831 AC_MSG_CHECKING([which icu to use])
8832 if test "$with_system_icu" = "yes"; then
8833     AC_MSG_RESULT([external])
8834     SYSTEM_ICU=TRUE
8835     AC_LANG_PUSH([C++])
8836     AC_MSG_CHECKING([for unicode/rbbi.h])
8837     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8838     AC_LANG_POP([C++])
8840     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8841         ICUPATH="$PATH"
8842         if test "$WITH_MINGW" = "yes"; then
8843             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8844         fi
8845         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8847         AC_MSG_CHECKING([ICU version])
8848         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8849         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8850         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8852         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8853             AC_MSG_RESULT([OK, $ICU_VERSION])
8854         else
8855             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8856         fi
8857     fi
8859     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8860         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8861         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8862         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8863         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8864         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8865         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8866             AC_MSG_RESULT([yes])
8867         else
8868             AC_MSG_RESULT([no])
8869             if test "$with_system_icu_for_build" != "force"; then
8870                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8871 You can use --with-system-icu-for-build=force to use it anyway.])
8872             fi
8873         fi
8874     fi
8876     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8877         # using the system icu tools can lead to version confusion, use the
8878         # ones from the build environment when cross-compiling
8879         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8880         if test -z "$SYSTEM_GENBRK"; then
8881             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8882         fi
8883         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8884         if test -z "$SYSTEM_GENCCODE"; then
8885             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8886         fi
8887         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8888         if test -z "$SYSTEM_GENCMN"; then
8889             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8890         fi
8891         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
8892             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
8893         else
8894             ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
8895         fi
8896         if test "$ICU_MAJOR" -ge "49"; then
8897             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8898             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8899             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8900         else
8901             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
8902             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
8903             ICU_RECLASSIFIED_HEBREW_LETTER=
8904         fi
8905     fi
8907     if test "$cross_compiling" = "yes"; then
8908         if test "$ICU_MAJOR" -ge "50"; then
8909             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8910             ICU_MINOR=""
8911         fi
8912     fi
8914     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
8915     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
8916     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
8917 else
8918     AC_MSG_RESULT([internal])
8919     SYSTEM_ICU=
8920     BUILD_TYPE="$BUILD_TYPE ICU"
8921     # surprisingly set these only for "internal" (to be used by various other
8922     # external libs): the system icu-config is quite unhelpful and spits out
8923     # dozens of weird flags and also default path -I/usr/include
8924     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8925     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
8927 AC_SUBST(SYSTEM_ICU)
8928 AC_SUBST(SYSTEM_GENBRK)
8929 AC_SUBST(SYSTEM_GENCCODE)
8930 AC_SUBST(SYSTEM_GENCMN)
8931 AC_SUBST(ICU_MAJOR)
8932 AC_SUBST(ICU_MINOR)
8933 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
8934 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8935 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8936 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8937 AC_SUBST(ICU_CFLAGS)
8938 AC_SUBST(ICU_LIBS)
8940 dnl ===================================================================
8941 dnl Graphite
8942 dnl ===================================================================
8944 AC_MSG_CHECKING([whether to enable graphite support])
8945 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
8946     AC_MSG_RESULT([yes])
8947     ENABLE_GRAPHITE="TRUE"
8948     AC_DEFINE(ENABLE_GRAPHITE)
8949     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
8950     if test "$with_system_graphite" = "yes"; then
8951         libo_MINGW_CHECK_DLL([libgraphite2])
8952     fi
8953 else
8954     AC_MSG_RESULT([no])
8956 AC_SUBST(ENABLE_GRAPHITE)
8958 dnl ===================================================================
8959 dnl Orcus
8960 dnl ===================================================================
8962 AC_MSG_CHECKING([whether to enable orcus])
8963 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
8964     AC_MSG_RESULT([yes])
8965     ENABLE_ORCUS="TRUE"
8966     AC_DEFINE(ENABLE_ORCUS)
8968     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.8 >= 0.7.0])
8969     if test "$with_system_orcus" != "yes"; then
8970         if test "$SYSTEM_BOOST" = "TRUE"; then
8971             # ===========================================================
8972             # Determine if we are going to need to link with Boost.System
8973             # ===========================================================
8974             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8975             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8976             dnl in documentation has no effect.
8977             AC_MSG_CHECKING([if we need to link with Boost.System])
8978             AC_LANG_PUSH([C++])
8979             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8980                     @%:@include <boost/version.hpp>
8981                 ]],[[
8982                     #if BOOST_VERSION >= 105000
8983                     #   error yes, we need to link with Boost.System
8984                     #endif
8985                 ]])],[
8986                     AC_MSG_RESULT([no])
8987                 ],[
8988                     AC_MSG_RESULT([yes])
8989                     AX_BOOST_SYSTEM
8990             ])
8991             AC_LANG_POP([C++])
8992         fi
8993     fi
8994     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
8995     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
8996     AC_SUBST([BOOST_SYSTEM_LIB])
8997     AC_SUBST(SYSTEM_LIBORCUS)
8999 else
9000     AC_MSG_RESULT([no])
9002 AC_SUBST(ENABLE_ORCUS)
9004 dnl ===================================================================
9005 dnl HarfBuzz
9006 dnl ===================================================================
9007 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9008 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9009     AC_MSG_RESULT([yes])
9010     ENABLE_HARFBUZZ="TRUE"
9011     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9012         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"])
9013     else
9014         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9015     fi
9016 else
9017     AC_MSG_RESULT([no])
9019 AC_SUBST(ENABLE_HARFBUZZ)
9021 dnl ===================================================================
9022 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9023 dnl ===================================================================
9024 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9025 # Obviously no such thing on iOS or Android. Also not possible when building
9026 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9027 if test "$_os" != Android -a "$_os" != iOS -a $_os != Darwin -a \
9028         "$with_x" != "no" -a "$enable_mpl_subset" != yes
9029 then
9030     AC_MSG_RESULT([yes])
9031     ENABLE_NPAPI_FROM_BROWSER=TRUE
9032 else
9033     AC_MSG_RESULT([no])
9034     ENABLE_NPAPI_FROM_BROWSER=
9036 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9038 AC_MSG_CHECKING([whether to use X11])
9039 dnl ***************************************
9040 dnl testing for X libraries and includes...
9041 dnl ***************************************
9042 WANT_X11="no"
9043 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$with_x" != "no"; then
9044     WANT_X11="yes"
9045     AC_DEFINE(HAVE_FEATURE_X11)
9047 AC_MSG_RESULT([$WANT_X11])
9049 if test "$WANT_X11" = "yes"; then
9050     AC_PATH_X
9051     AC_PATH_XTRA
9052     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9054     if test -z "$x_includes"; then
9055         x_includes="default_x_includes"
9056     fi
9057     if test -z "$x_libraries"; then
9058         x_libraries="default_x_libraries"
9059     fi
9060     CFLAGS="$CFLAGS $X_CFLAGS"
9061     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9062     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9063 else
9064     x_includes="no_x_includes"
9065     x_libraries="no_x_libraries"
9068 if test "$WANT_X11" = "yes"; then
9069     dnl ===================================================================
9070     dnl Check for Composite.h for Mozilla plugin
9071     dnl ===================================================================
9072     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9073      [#include <X11/Intrinsic.h>])
9075     # ENABLE_NPAPI_FROM_BROWSER requires Xt library
9076     AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:],
9077         [AC_MSG_ERROR(Xt library not found)])
9079     dnl ===================================================================
9080     dnl Check for extension headers
9081     dnl ===================================================================
9082     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9083      [#include <X11/extensions/shape.h>])
9085     # vcl needs ICE and SM
9086     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9087     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9088         [AC_MSG_ERROR(ICE library not found)])
9089     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9090     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9091         [AC_MSG_ERROR(SM library not found)])
9094 dnl ===================================================================
9095 dnl Check for system Xrender
9096 dnl ===================================================================
9097 AC_MSG_CHECKING([whether to use Xrender])
9098 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9099     AC_MSG_RESULT([yes])
9100     PKG_CHECK_MODULES(XRENDER, xrender)
9101     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9102     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9103       [AC_MSG_ERROR(libXrender not found or functional)], [])
9104     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9105       [AC_MSG_ERROR(Xrender not found. install X)], [])
9106 else
9107     AC_MSG_RESULT([no])
9109 AC_SUBST(XRENDER_CFLAGS)
9110 AC_SUBST(XRENDER_LIBS)
9112 dnl ===================================================================
9113 dnl Check for XRandr
9114 dnl ===================================================================
9115 AC_MSG_CHECKING([whether to enable RandR support])
9116 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9117     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9118         XRANDR_DLOPEN="TRUE"
9119         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9120     else
9121         AC_MSG_RESULT([yes])
9122         XRANDR_DLOPEN="FALSE"
9123         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9124         if test "$ENABLE_RANDR" != "TRUE"; then
9125             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9126                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9127             XRANDR_CFLAGS=" "
9128             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9129               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9130             XRANDR_LIBS="-lXrandr "
9131             ENABLE_RANDR="TRUE"
9132         fi
9133         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9134     fi
9135 else
9136     ENABLE_RANDR=""
9137     AC_MSG_RESULT([no])
9139 AC_SUBST(XRANDR_DLOPEN)
9140 AC_SUBST(XRANDR_CFLAGS)
9141 AC_SUBST(XRANDR_LIBS)
9142 AC_SUBST(ENABLE_RANDR)
9144 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9145     WITH_WEBDAV="serf"
9147 if test $_os = iOS -o $_os = Android; then
9148     WITH_WEBDAV="no"
9150 AC_MSG_CHECKING([for webdav library])
9151 case "$WITH_WEBDAV" in
9152 serf)
9153     AC_MSG_RESULT([serf])
9154     # Check for system apr-util
9155     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9156                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9157                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9158     if test "$COM" = "MSC"; then
9159         APR_LIB_DIR="LibR"
9160         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9161         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9162     fi
9164     # Check for system serf
9165     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9166                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9167     if test "$COM" = "MSC"; then
9168         SERF_LIB_DIR="Release"
9169         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9170         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9171     fi
9172     ;;
9173 neon)
9174     AC_MSG_RESULT([neon])
9175     # Check for system neon
9176     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9177     if test "$with_system_neon" = "yes"; then
9178         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9179         libo_MINGW_CHECK_DLL([libneon])
9180         libo_MINGW_TRY_DLL([libtasn1])
9181         libo_MINGW_TRY_DLL([libgnutls])
9182     else
9183         NEON_VERSION=0295
9184     fi
9185     AC_SUBST(NEON_VERSION)
9186     ;;
9188     AC_MSG_RESULT([none, disabled])
9189     WITH_WEBDAV=""
9190     ;;
9191 esac
9192 AC_SUBST(WITH_WEBDAV)
9194 dnl ===================================================================
9195 dnl Check for disabling cve_tests
9196 dnl ===================================================================
9197 AC_MSG_CHECKING([whether to execute CVE tests])
9198 # If not explicitly enabled or disabled, default
9199 if test -z "$enable_cve_tests"; then
9200     case "$OS" in
9201     WNT)
9202         # Default cves off for windows with its wild and wonderful
9203         # varienty of AV software kicking in and panicing
9204         enable_cve_tests=no
9205         ;;
9206     *)
9207         # otherwise yes
9208         enable_cve_tests=yes
9209         ;;
9210     esac
9212 if test "$enable_cve_tests" = "no"; then
9213     AC_MSG_RESULT([no])
9214     DISABLE_CVE_TESTS=TRUE
9215     AC_SUBST(DISABLE_CVE_TESTS)
9216 else
9217     AC_MSG_RESULT([yes])
9220 dnl ===================================================================
9221 dnl Check for enabling chart XShape tests
9222 dnl ===================================================================
9223 AC_MSG_CHECKING([whether to execute chart XShape tests])
9224 if test "$enable_chart_tests" = "yes"; then
9225     AC_MSG_RESULT([yes])
9226     ENABLE_CHART_TESTS=TRUE
9227     AC_SUBST(ENABLE_CHART_TESTS)
9228 else
9229     AC_MSG_RESULT([no])
9232 dnl ===================================================================
9233 dnl Check for system openssl
9234 dnl ===================================================================
9235 DISABLE_OPENSSL=
9236 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9237 if test "$enable_openssl" = "yes"; then
9238     AC_MSG_RESULT([no])
9239     if test "$_os" = Darwin ; then
9240         # OpenSSL is deprecated when building for 10.7 or later.
9241         #
9242         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9243         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9245         with_system_openssl=no
9246         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9247     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9248             && test "$with_system_openssl" != "no"; then
9249         with_system_openssl=yes
9250         SYSTEM_OPENSSL=TRUE
9251         OPENSSL_CFLAGS=
9252         OPENSSL_LIBS="-lssl -lcrypto"
9253     else
9254         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9255     fi
9256     if test "$with_system_openssl" = "yes"; then
9257         libo_MINGW_CHECK_DLL([libssl])
9258         libo_MINGW_CHECK_DLL([libcrypto])
9259         AC_MSG_CHECKING([whether openssl supports SHA512])
9260         AC_LANG_PUSH([C])
9261         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9262             SHA512_CTX context;
9263 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9264         AC_LANG_POP(C)
9265     fi
9266 else
9267     AC_MSG_RESULT([yes])
9268     DISABLE_OPENSSL=TRUE
9270     # warn that although OpenSSL is disabled, system libraries may be depending on it
9271     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9272     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9275 AC_SUBST([DISABLE_OPENSSL])
9277 dnl ===================================================================
9278 dnl Check for building gnutls
9279 dnl ===================================================================
9280 AC_MSG_CHECKING([whether to use gnutls])
9281 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9282     AC_MSG_RESULT([yes])
9283     AM_PATH_LIBGCRYPT()
9284     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9285         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9286                       available in the system to use as replacement.]]))
9289 AC_SUBST([LIBGCRYPT_CFLAGS])
9290 AC_SUBST([LIBGCRYPT_LIBS])
9292 dnl ===================================================================
9293 dnl Check for system redland
9294 dnl ===================================================================
9295 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9296 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9297 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9298 if test "$with_system_redland" = "yes"; then
9299     libo_MINGW_CHECK_DLL([librdf])
9300     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9301             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9302     libo_MINGW_TRY_DLL([libraptor])
9303     libo_MINGW_TRY_DLL([librasqal])
9304     libo_MINGW_TRY_DLL([libsqlite3])
9305 else
9306     RAPTOR_MAJOR="0"
9307     RASQAL_MAJOR="3"
9308     REDLAND_MAJOR="0"
9310 AC_SUBST(RAPTOR_MAJOR)
9311 AC_SUBST(RASQAL_MAJOR)
9312 AC_SUBST(REDLAND_MAJOR)
9314 dnl ===================================================================
9315 dnl Check for system hunspell
9316 dnl ===================================================================
9317 AC_MSG_CHECKING([which libhunspell to use])
9318 if test "$with_system_hunspell" = "yes"; then
9319     AC_MSG_RESULT([external])
9320     SYSTEM_HUNSPELL=TRUE
9321     AC_LANG_PUSH([C++])
9322     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9323     if test "$HUNSPELL_PC" != "TRUE"; then
9324         AC_CHECK_HEADER(hunspell.hxx, [],
9325             [
9326             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9327             [AC_MSG_ERROR(hunspell headers not found.)], [])
9328             ], [])
9329         AC_CHECK_LIB([hunspell], [main], [:],
9330            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9331         HUNSPELL_LIBS=-lhunspell
9332     fi
9333     AC_LANG_POP([C++])
9334     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9335     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9336 else
9337     AC_MSG_RESULT([internal])
9338     SYSTEM_HUNSPELL=
9339     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9340     if test "$COM" = "MSC"; then
9341         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9342     else
9343         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9344     fi
9345     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9347 AC_SUBST(SYSTEM_HUNSPELL)
9348 AC_SUBST(HUNSPELL_CFLAGS)
9349 AC_SUBST(HUNSPELL_LIBS)
9351 dnl ===================================================================
9352 dnl Checking for altlinuxhyph
9353 dnl ===================================================================
9354 AC_MSG_CHECKING([which altlinuxhyph to use])
9355 if test "$with_system_altlinuxhyph" = "yes"; then
9356     AC_MSG_RESULT([external])
9357     SYSTEM_HYPH=TRUE
9358     AC_CHECK_HEADER(hyphen.h, [],
9359        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9360     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9361        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9362        [#include <hyphen.h>])
9363     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9364         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9365     if test -z "$HYPHEN_LIB"; then
9366         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9367            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9368     fi
9369     if test -z "$HYPHEN_LIB"; then
9370         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9371            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9372     fi
9373     libo_MINGW_CHECK_DLL([libhyphen])
9374 else
9375     AC_MSG_RESULT([internal])
9376     SYSTEM_HYPH=
9377     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9378     if test "$COM" = "MSC"; then
9379         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9380     else
9381         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9382     fi
9384 AC_SUBST(SYSTEM_HYPH)
9385 AC_SUBST(HYPHEN_LIB)
9387 dnl ===================================================================
9388 dnl Checking for mythes
9389 dnl ===================================================================
9390 AC_MSG_CHECKING([which mythes to use])
9391 if test "$with_system_mythes" = "yes"; then
9392     AC_MSG_RESULT([external])
9393     SYSTEM_MYTHES=TRUE
9394     AC_LANG_PUSH([C++])
9395     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9396     if test "$MYTHES_PKGCONFIG" = "no"; then
9397         AC_CHECK_HEADER(mythes.hxx, [],
9398             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9399         AC_CHECK_LIB([mythes-1.2], [main], [:],
9400             [ MYTHES_FOUND=no], [])
9401     if test "$MYTHES_FOUND" = "no"; then
9402         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9403                 [ MYTHES_FOUND=no], [])
9404     fi
9405     if test "$MYTHES_FOUND" = "no"; then
9406         AC_MSG_ERROR([mythes library not found!.])
9407     fi
9408     fi
9409     AC_LANG_POP([C++])
9410     libo_MINGW_CHECK_DLL([libmythes-1.2])
9411     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9412 else
9413     AC_MSG_RESULT([internal])
9414     SYSTEM_MYTHES=
9415     BUILD_TYPE="$BUILD_TYPE MYTHES"
9416     if test "$COM" = "MSC"; then
9417         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9418     else
9419         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9420     fi
9422 AC_SUBST(SYSTEM_MYTHES)
9423 AC_SUBST(MYTHES_CFLAGS)
9424 AC_SUBST(MYTHES_LIBS)
9426 dnl ===================================================================
9427 dnl How should we build the linear programming solver ?
9428 dnl ===================================================================
9430 ENABLE_COINMP=
9431 AC_MSG_CHECKING([whether to build with CoinMP])
9432 if test "$enable_coinmp" != "no"; then
9433     ENABLE_COINMP=TRUE
9434     AC_MSG_RESULT([yes])
9435     if test "$with_system_coinmp" = "yes"; then
9436     SYSTEM_COINMP=TRUE
9437     PKG_CHECK_MODULES( COINMP, coinmp )
9438     else
9439         BUILD_TYPE="$BUILD_TYPE COINMP"
9440     fi
9441 else
9442     AC_MSG_RESULT([no])
9444 AC_SUBST(ENABLE_COINMP)
9445 AC_SUBST(SYSTEM_COINMP)
9446 AC_SUBST(COINMP_CFLAGS)
9447 AC_SUBST(COINMP_LIBS)
9449 ENABLE_LPSOLVE=
9450 AC_MSG_CHECKING([whether to build with lpsolve])
9451 if test "$enable_lpsolve" != "no"; then
9452     ENABLE_LPSOLVE=TRUE
9453     AC_MSG_RESULT([yes])
9454 else
9455     AC_MSG_RESULT([no])
9457 AC_SUBST(ENABLE_LPSOLVE)
9459 if test "$ENABLE_LPSOLVE" = TRUE; then
9460     AC_MSG_CHECKING([which lpsolve to use])
9461     if test "$with_system_lpsolve" = "yes"; then
9462         AC_MSG_RESULT([external])
9463         SYSTEM_LPSOLVE=TRUE
9464         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9465            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9466         save_LIBS=$LIBS
9467         # some systems need this. Like Ubuntu....
9468         AC_CHECK_LIB(m, floor)
9469         AC_CHECK_LIB(dl, dlopen)
9470         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9471             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9472         LIBS=$save_LIBS
9473         libo_MINGW_CHECK_DLL([lpsolve55])
9474     else
9475         AC_MSG_RESULT([internal])
9476         SYSTEM_LPSOLVE=
9477         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9478     fi
9480 AC_SUBST(SYSTEM_LPSOLVE)
9482 dnl ===================================================================
9483 dnl Checking for libexttextcat
9484 dnl ===================================================================
9485 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9486 if test "$with_system_libexttextcat" = "yes"; then
9487     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9489 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9491 dnl ***************************************
9492 dnl testing libc version for Linux...
9493 dnl ***************************************
9494 if test "$_os" = "Linux"; then
9495     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9496     exec 6>/dev/null # no output
9497     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9498     exec 6>&1 # output on again
9499     if test "$HAVE_LIBC"; then
9500         AC_MSG_RESULT([yes])
9501     else
9502         AC_MSG_ERROR([no, upgrade libc])
9503     fi
9506 dnl =========================================
9507 dnl Check for the Windows  SDK.
9508 dnl =========================================
9509 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9510 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9511 if test "$_os" = "WINNT"; then
9512     AC_MSG_CHECKING([for Windows SDK])
9513     if test "$build_os" = "cygwin"; then
9514         find_winsdk
9515         WINDOWS_SDK_HOME=$winsdktest
9517         # normalize if found
9518         if test -n "$WINDOWS_SDK_HOME"; then
9519             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9520             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9521         fi
9523         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
9524     fi
9526     if test -n "$WINDOWS_SDK_HOME"; then
9527         # Remove a possible trailing backslash
9528         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9530         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9531              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9532              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9533             have_windows_sdk_headers=yes
9534         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9535              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9536              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9537             have_windows_sdk_headers=yes
9538         else
9539             have_windows_sdk_headers=no
9540         fi
9542         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9543             have_windows_sdk_libs=yes
9544         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9545             have_windows_sdk_libs=yes
9546         else
9547             have_windows_sdk_libs=no
9548         fi
9550         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9551             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9552 the  Windows SDK are installed.])
9553         fi
9555         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9556              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9557              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9558              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9559         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9560              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9561              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9562              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9563         else
9564             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9565         fi
9566     fi
9568     if test -z "$WINDOWS_SDK_HOME"; then
9569         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9570     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
9571         WINDOWS_SDK_VERSION=60
9572         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
9573     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
9574         WINDOWS_SDK_VERSION=61
9575         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
9576     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
9577         WINDOWS_SDK_VERSION=70
9578         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9579     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9580         WINDOWS_SDK_VERSION=80
9581         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9582         dnl compatibility warning if not explicitly choosing the 80 SDK:
9583         if test -z "$with_windows_sdk"; then
9584             AC_MSG_WARN([If a build should run on Windows XP,])
9585             AC_MSG_WARN([use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)])
9586             add_warning "If a build should run on Windows XP,"
9587             add_warning "use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)"
9588         fi
9589     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
9590         WINDOWS_SDK_VERSION=81
9591         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
9592     else
9593         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9594     fi
9595     PathFormat "$WINDOWS_SDK_HOME"
9596     WINDOWS_SDK_HOME="$formatted_path"
9597     if test "$build_os" = "cygwin"; then
9598         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9599         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9600             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9601         fi
9602     fi
9604     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9605     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9606     dnl but not in v8.0), so allow this to be overridden with a
9607     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9608     dnl and configuration error if no WiLangId.vbs is found would arguably be
9609     dnl better, but I do not know under which conditions exactly it is needed by
9610     dnl msiglobal.pm:
9611     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9612         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9613         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9614             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9615         fi
9616         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9617             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9618         fi
9619         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9620             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9621             add_warning "WiLangId.vbs not found - building translated packages will fail"
9622         fi
9623     fi
9625 AC_SUBST(WINDOWS_SDK_HOME)
9626 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
9627 AC_SUBST(WINDOWS_SDK_VERSION)
9628 AC_SUBST(WINDOWS_SDK_WILANGID)
9630 dnl =========================================
9631 dnl Check for uuidgen
9632 dnl =========================================
9633 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9634     if test "$WITH_MINGW" = "yes"; then
9635         AC_PATH_PROG([UUIDGEN], [uuid])
9636         if test -z "$UUIDGEN"; then
9637             AC_MSG_WARN([uuid is needed for building installation sets])
9638         fi
9639     else
9640         # presence is already tested above in the WINDOWS_SDK_HOME check
9641         UUIDGEN=uuidgen.exe
9642         AC_SUBST(UUIDGEN)
9643     fi
9644 else
9645     AC_PATH_PROG([UUIDGEN], [uuidgen])
9646     if test -z "$UUIDGEN"; then
9647         AC_MSG_WARN([uuid is needed for building installation sets])
9648     fi
9651 dnl ***************************************
9652 dnl Checking for bison and flex
9653 dnl ***************************************
9654 AC_PATH_PROG(BISON, bison)
9655 if test -z "$BISON"; then
9656     AC_MSG_ERROR([no bison found in \$PATH, install it])
9657 else
9658     AC_MSG_CHECKING([the bison version])
9659     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9660     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9661     # Accept newer than 2.0
9662     if test "$_bison_longver" -lt 2000; then
9663         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9664     fi
9667 AC_PATH_PROG(FLEX, flex)
9668 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9669     FLEX=`cygpath -m $FLEX`
9671 if test -z "$FLEX"; then
9672     AC_MSG_ERROR([no flex found in \$PATH, install it])
9673 else
9674     AC_MSG_CHECKING([the flex version])
9675     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9676     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9677         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9678     fi
9680 AC_SUBST([FLEX])
9681 dnl ***************************************
9682 dnl Checking for patch
9683 dnl ***************************************
9684 AC_PATH_PROG(PATCH, patch)
9685 if test -z "$PATCH"; then
9686     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9689 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9690 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9691     if test -z "$with_gnu_patch"; then
9692         GNUPATCH=$PATCH
9693     else
9694         if test -x "$with_gnu_patch"; then
9695             GNUPATCH=$with_gnu_patch
9696         else
9697             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9698         fi
9699     fi
9701     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9702     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9703         AC_MSG_RESULT([yes])
9704     else
9705         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9706     fi
9707 else
9708     GNUPATCH=$PATCH
9711 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9712     GNUPATCH=`cygpath -m $GNUPATCH`
9715 dnl We also need to check for --with-gnu-cp
9717 if test -z "$with_gnu_cp"; then
9718     # check the place where the good stuff is hidden on Solaris...
9719     if test -x /usr/gnu/bin/cp; then
9720         GNUCP=/usr/gnu/bin/cp
9721     else
9722         AC_PATH_PROGS(GNUCP, gnucp cp)
9723     fi
9724     if test -z $GNUCP; then
9725         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9726     fi
9727 else
9728     if test -x "$with_gnu_cp"; then
9729         GNUCP=$with_gnu_cp
9730     else
9731         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9732     fi
9735 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9736     GNUCP=`cygpath -m $GNUCP`
9739 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9740 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9741     AC_MSG_RESULT([yes])
9742 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9743     AC_MSG_RESULT([yes])
9744 else
9745     case "$build_os" in
9746     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9747         x_GNUCP=[\#]
9748         GNUCP=''
9749         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9750         ;;
9751     *)
9752         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9753         ;;
9754     esac
9757 AC_SUBST(GNUPATCH)
9758 AC_SUBST(GNUCP)
9759 AC_SUBST(x_GNUCP)
9761 dnl ***************************************
9762 dnl testing assembler path
9763 dnl ***************************************
9764 ML_EXE=""
9765 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9766     if test "$BITNESS_OVERRIDE" = ""; then
9767         assembler=ml.exe
9768         assembler_bin=bin
9769     else
9770         if test "$vcexpress" = "Express"; then
9771             assembler=ml64.exe
9772             assembler_bin=bin/x86_amd64
9773         else
9774             assembler=ml64.exe
9775             assembler_bin=bin/amd64
9776         fi
9777     fi
9779     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9780     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9781         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9782         AC_MSG_RESULT([found])
9783         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9784     else
9785         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9786     fi
9788     PathFormat "$ASM_HOME"
9789     ASM_HOME="$formatted_path"
9790 else
9791     ASM_HOME=""
9794 AC_SUBST(ML_EXE)
9796 dnl ===================================================================
9797 dnl We need zip and unzip
9798 dnl ===================================================================
9799 AC_PATH_PROG(ZIP, zip)
9800 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9801 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9802     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],,)
9805 AC_PATH_PROG(UNZIP, unzip)
9806 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9808 dnl ===================================================================
9809 dnl Zip must be a specific type for different build types.
9810 dnl ===================================================================
9811 if test $build_os = cygwin; then
9812     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9813         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9814     fi
9817 dnl ===================================================================
9818 dnl We need touch with -h option support.
9819 dnl ===================================================================
9820 AC_PATH_PROG(TOUCH, touch)
9821 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9822 touch warn
9823 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9824     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],,)
9827 dnl ===================================================================
9828 dnl Set vcl option: coordinate device in double or sal_Int32
9829 dnl ===================================================================
9831 AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9832 if test "$_os" = "Darwin" -o  $_os = iOS ; then
9833     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9834     AC_MSG_RESULT([double])
9835 else
9836     AC_MSG_RESULT([sal_Int32])
9839 dnl ===================================================================
9840 dnl Test which vclplugs have to be built.
9841 dnl ===================================================================
9842 R=""
9843 GTK3_CFLAGS=""
9844 GTK3_LIBS=""
9845 ENABLE_GTK3=""
9846 if test "x$enable_gtk3" = "xyes"; then
9847     if test "$with_system_cairo" = no; then
9848         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9849     fi
9850     : ${with_system_cairo:=yes}
9851     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.2 gtk+-unix-print-3.0 gmodule-no-export-2.0 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
9852     if test "x$ENABLE_GTK3" = "xTRUE"; then
9853         R="gtk3"
9854     else
9855         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9856     fi
9857     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9859 AC_SUBST(GTK3_LIBS)
9860 AC_SUBST(GTK3_CFLAGS)
9861 AC_SUBST(ENABLE_GTK3)
9863 AC_MSG_CHECKING([which VCLplugs shall be built])
9864 if test "$GUIBASE" != "unx" -o "$with_x" = "no"; then
9865     enable_gtk=no
9867 ENABLE_GTK=""
9868 if test "x$enable_gtk" = "xyes"; then
9869     if test "$with_system_cairo" = no; then
9870         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9871     fi
9872     : ${with_system_cairo:=yes}
9873     ENABLE_GTK="TRUE"
9874     AC_DEFINE(ENABLE_GTK)
9875     R="gtk $R"
9877 AC_SUBST(ENABLE_GTK)
9879 ENABLE_TDE=""
9880 if test "x$enable_tde" = "xyes"; then
9881     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
9882     # are built from the same sources. So we only allow one of them.
9883     if test "x$enable_kde" = "xyes"; then
9884         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
9885     fi
9886     ENABLE_TDE="TRUE"
9887     AC_DEFINE(ENABLE_TDE)
9888     R="$R tde"
9890 AC_SUBST(ENABLE_TDE)
9892 ENABLE_KDE=""
9893 if test "x$enable_kde" = "xyes"; then
9894     ENABLE_KDE="TRUE"
9895     AC_DEFINE(ENABLE_KDE)
9896     R="$R kde"
9898 AC_SUBST(ENABLE_KDE)
9900 ENABLE_KDE4=""
9901 if test "x$enable_kde4" = "xyes"; then
9902     ENABLE_KDE4="TRUE"
9903     AC_DEFINE(ENABLE_KDE4)
9904     R="$R kde4"
9906 AC_SUBST(ENABLE_KDE4)
9908 ENABLE_HEADLESS=""
9909 if test "x$with_x" = "xno"; then
9910     ENABLE_HEADLESS="TRUE"
9911     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
9912     R="headless"
9914 AC_SUBST(ENABLE_HEADLESS)
9916 if test -z "$R"; then
9917     AC_MSG_RESULT([none])
9918 else
9919     AC_MSG_RESULT([$R])
9922 dnl ===================================================================
9923 dnl GCONF check
9924 dnl ===================================================================
9926 ENABLE_GCONF=
9927 AC_MSG_CHECKING([whether to enable GConf support])
9928 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
9929     ENABLE_GCONF="TRUE"
9930     AC_MSG_RESULT([yes])
9931     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
9932     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9933 else
9934     AC_MSG_RESULT([no])
9936 AC_SUBST(GCONF_LIBS)
9937 AC_SUBST(GCONF_CFLAGS)
9938 AC_SUBST(ENABLE_GCONF)
9940 dnl ===================================================================
9941 dnl Gnome VFS check
9942 dnl ===================================================================
9944 ENABLE_GNOMEVFS=""
9945 AC_MSG_CHECKING([whether to enable GNOME VFS support])
9946 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
9947     ENABLE_GNOMEVFS="TRUE"
9948     AC_MSG_RESULT([yes])
9949     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
9950     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9951     AC_DEFINE(ENABLE_GNOME_VFS)
9952 else
9953     AC_MSG_RESULT([no])
9955 AC_SUBST(GNOMEVFS_LIBS)
9956 AC_SUBST(GNOMEVFS_CFLAGS)
9957 AC_SUBST(ENABLE_GNOMEVFS)
9959 dnl ===================================================================
9960 dnl check for dbus support
9961 dnl ===================================================================
9962 ENABLE_DBUS=""
9963 DBUS_CFLAGS=""
9964 DBUS_LIBS=""
9966 if test "$enable_dbus" = "no"; then
9967     test_dbus=no
9970 AC_MSG_CHECKING([whether to enable DBUS support])
9971 if test "$test_dbus" = "yes"; then
9972     ENABLE_DBUS="TRUE"
9973     AC_MSG_RESULT([yes])
9974     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9975     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9976 else
9977     AC_MSG_RESULT([no])
9980 AC_SUBST(ENABLE_DBUS)
9981 AC_SUBST(DBUS_CFLAGS)
9982 AC_SUBST(DBUS_LIBS)
9984 AC_MSG_CHECKING([whether to enable font install via packagekit])
9985 if test "$ENABLE_DBUS" = "TRUE"; then
9986     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
9987         ENABLE_PACKAGEKIT=TRUE
9988         AC_MSG_RESULT([yes])
9989     else
9990         ENABLE_PACKAGEKIT=
9991         AC_MSG_RESULT([no])
9992     fi
9993 else
9994     AC_MSG_RESULT([no, dbus disabled.])
9996 AC_SUBST(ENABLE_PACKAGEKIT)
9998 AC_MSG_CHECKING([whether to enable Impress remote control])
9999 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10000     AC_MSG_RESULT([yes])
10001     ENABLE_SDREMOTE=TRUE
10002     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10004     # If not explicitly enabled or disabled, default
10005     if test -z "$enable_sdremote_bluetooth"; then
10006         case "$OS" in
10007         LINUX|MACOSX|WNT)
10008             # Default to yes for these
10009             enable_sdremote_bluetooth=yes
10010             ;;
10011         *)
10012             # otherwise no
10013             enable_sdremote_bluetooth=no
10014             ;;
10015         esac
10016     fi
10017     # $enable_sdremote_bluetooth is guaranteed non-empty now
10019     if test "$enable_sdremote_bluetooth" != "no"; then
10020         if test "$OS" = "LINUX"; then
10021             if test "$ENABLE_DBUS" = "TRUE"; then
10022                 AC_MSG_RESULT([yes])
10023                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10024                 dnl ===================================================================
10025                 dnl Check for system bluez
10026                 dnl ===================================================================
10027                 AC_MSG_CHECKING([which Bluetooth header to use])
10028                 if test "$with_system_bluez" = "yes"; then
10029                     AC_MSG_RESULT([external])
10030                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10031                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10032                     SYSTEM_BLUEZ=TRUE
10033                 else
10034                     AC_MSG_RESULT([internal])
10035                     SYSTEM_BLUEZ=
10036                 fi
10037             else
10038                 AC_MSG_RESULT([no, dbus disabled])
10039                 ENABLE_SDREMOTE_BLUETOOTH=
10040                 SYSTEM_BLUEZ=
10041             fi
10042         else
10043             AC_MSG_RESULT([yes])
10044             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10045             SYSTEM_BLUEZ=
10046         fi
10047     else
10048         AC_MSG_RESULT([no])
10049         ENABLE_SDREMOTE_BLUETOOTH=
10050         SYSTEM_BLUEZ=
10051     fi
10052 else
10053     ENABLE_SDREMOTE=
10054     SYSTEM_BLUEZ=
10055     AC_MSG_RESULT([no])
10057 AC_SUBST(ENABLE_SDREMOTE)
10058 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10059 AC_SUBST(SYSTEM_BLUEZ)
10061 dnl ===================================================================
10062 dnl Check whether the gtk 2.0 libraries are available.
10063 dnl ===================================================================
10065 GTK_CFLAGS=""
10066 GTK_LIBS=""
10067 ENABLE_SYSTRAY_GTK=""
10068 if test  "$test_gtk" = "yes"; then
10070     if test "$ENABLE_GTK" = "TRUE"; then
10071         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.10.0 gdk-pixbuf-xlib-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10072         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10073         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]))
10074         BUILD_TYPE="$BUILD_TYPE GTK"
10075         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10077         if test "x$enable_systray" = "xyes"; then
10078             ENABLE_SYSTRAY_GTK="TRUE"
10079         fi
10081         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10082         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10083                           [ENABLE_GTK_PRINT="TRUE"],
10084                           [ENABLE_GTK_PRINT=""])
10085         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10087         AC_MSG_CHECKING([whether to enable GIO support])
10088         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10089             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10090                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10091             fi
10092             dnl Need at least 2.26 for the dbus support.
10093             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10094                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10095             if test "$ENABLE_GIO" = "TRUE"; then
10096                 AC_DEFINE(ENABLE_GIO)
10097                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10098             fi
10099         else
10100             AC_MSG_RESULT([no])
10101         fi
10102     fi
10104 AC_SUBST(ENABLE_GIO)
10105 AC_SUBST(GIO_CFLAGS)
10106 AC_SUBST(GIO_LIBS)
10107 AC_SUBST(ENABLE_SYSTRAY_GTK)
10108 AC_SUBST(GTK_CFLAGS)
10109 AC_SUBST(GTK_LIBS)
10110 AC_SUBST(GTHREAD_CFLAGS)
10111 AC_SUBST(GTHREAD_LIBS)
10112 AC_SUBST([ENABLE_GTK_PRINT])
10113 AC_SUBST([GTK_PRINT_CFLAGS])
10114 AC_SUBST([GTK_PRINT_LIBS])
10117 dnl ===================================================================
10118 dnl Check whether the Telepathy libraries are available.
10119 dnl ===================================================================
10121 ENABLE_TELEPATHY=""
10122 TELEPATHY_CFLAGS=""
10123 TELEPATHY_LIBS=""
10125 AC_MSG_CHECKING([whether to enable Telepathy support])
10126 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10127     ENABLE_TELEPATHY="TRUE"
10128     AC_DEFINE(ENABLE_TELEPATHY)
10129     AC_MSG_RESULT([yes])
10130     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 )
10131     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10132 else
10133     AC_MSG_RESULT([no])
10136 AC_SUBST(ENABLE_TELEPATHY)
10137 AC_SUBST(TELEPATHY_CFLAGS)
10138 AC_SUBST(TELEPATHY_LIBS)
10141 dnl ===================================================================
10143 SPLIT_APP_MODULES=""
10144 if test "$enable_split_app_modules" = "yes"; then
10145     SPLIT_APP_MODULES="TRUE"
10147 AC_SUBST(SPLIT_APP_MODULES)
10149 SPLIT_OPT_FEATURES=""
10150 if test "$enable_split_opt_features" = "yes"; then
10151     SPLIT_OPT_FEATURES="TRUE"
10153 AC_SUBST(SPLIT_OPT_FEATURES)
10155 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10156     if test "$enable_cairo_canvas" = yes; then
10157         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10158     fi
10159     enable_cairo_canvas=no
10160 elif test -z "$enable_cairo_canvas"; then
10161     enable_cairo_canvas=yes
10164 ENABLE_CAIRO_CANVAS=""
10165 if test "$enable_cairo_canvas" = "yes"; then
10166     test_cairo=yes
10167     ENABLE_CAIRO_CANVAS="TRUE"
10169 AC_SUBST(ENABLE_CAIRO_CANVAS)
10171 dnl ===================================================================
10172 dnl Check whether the GStreamer libraries are available.
10173 dnl It's possible to build avmedia with both GStreamer backends!
10174 dnl ===================================================================
10176 ENABLE_GSTREAMER_1_0=""
10178 if test "$build_gstreamer_1_0" = "yes"; then
10180     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10181     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10182         ENABLE_GSTREAMER_1_0="TRUE"
10183         AC_MSG_RESULT([yes])
10184         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0] )
10185         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10186     else
10187         AC_MSG_RESULT([no])
10188     fi
10190 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10191 AC_SUBST(GSTREAMER_1_0_LIBS)
10192 AC_SUBST(ENABLE_GSTREAMER_1_0)
10195 ENABLE_GSTREAMER_0_10=""
10196 if test "$build_gstreamer_0_10" = "yes"; then
10198     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10199     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10200         ENABLE_GSTREAMER_0_10="TRUE"
10201         AC_MSG_RESULT([yes])
10202         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
10203             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
10204         ])
10205         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10206     else
10207         AC_MSG_RESULT([no])
10208     fi
10211 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10212 AC_SUBST(GSTREAMER_0_10_LIBS)
10213 AC_SUBST(ENABLE_GSTREAMER_0_10)
10215 dnl ===================================================================
10216 dnl Check whether to build the VLC avmedia backend
10217 dnl ===================================================================
10219 ENABLE_VLC=""
10221 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10222 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10223     ENABLE_VLC="TRUE"
10224     AC_MSG_RESULT([yes])
10225 else
10226     AC_MSG_RESULT([no])
10228 AC_SUBST(ENABLE_VLC)
10230 # this is for opengl transitions in impress slideshow
10231 ENABLE_OPENGL=
10232 if test $_os = iOS -o $_os = Android; then
10233    : # disable
10234 elif test "$_os" = "Darwin"; then
10235     # We use frameworks on Mac OS X, no need for detail checks
10236     ENABLE_OPENGL=TRUE
10237     ENABLE_OPENGL_CANVAS=TRUE
10238     SYSTEM_MESA_HEADERS=TRUE
10239 elif test $_os = WINNT; then
10240     # Experimental: try to use OpenGL on Windows
10241     ENABLE_OPENGL=TRUE
10242     ENABLE_OPENGL_CANVAS=TRUE
10243     # We need the internal "Mesa" headers.
10244     SYSTEM_MESA_HEADERS=
10245     BUILD_TYPE="$BUILD_TYPE MESA"
10246 else
10247     if test "$with_x" != "no"; then
10248         ENABLE_OPENGL=TRUE
10249     fi
10250     ENABLE_OPENGL_CANVAS=TRUE
10252     dnl ===================================================================
10253     dnl Check for system Mesa
10254     dnl ===================================================================
10255     AC_MSG_CHECKING([which Mesa headers to use])
10256     if test "$with_system_mesa_headers" = "yes"; then
10257         AC_MSG_RESULT([external])
10258         SYSTEM_MESA_HEADERS=TRUE
10259         AC_LANG_PUSH(C)
10260         AC_CHECK_HEADER(GL/glxext.h, [],
10261            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10262         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10263         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10264         AC_LANG_POP(C)
10265     else
10266         AC_MSG_RESULT([internal])
10267         SYSTEM_MESA_HEADERS=
10268         BUILD_TYPE="$BUILD_TYPE MESA"
10269     fi
10272 AC_SUBST(SYSTEM_MESA_HEADERS)
10273 AC_SUBST(ENABLE_OPENGL)
10274 AC_SUBST(ENABLE_OPENGL_CANVAS)
10276 dnl =================================================
10277 dnl Check whether to build with OpenCL support.
10278 dnl =================================================
10280 if test $_os != iOS -a $_os != Android; then
10281     # OPENCL in BUILD_TYPE tells that OpenCL is potentially available on the platform (optional at run-time,
10282     # used through clew).
10283     BUILD_TYPE="$BUILD_TYPE OPENCL"
10284     AC_DEFINE(HAVE_FEATURE_OPENCL)
10287 dnl ===================================================================
10288 dnl Check whether to enable glTF support
10289 dnl ===================================================================
10290 AC_MSG_CHECKING([whether to enable glTF support])
10291 ENABLE_GLTF=
10292 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android; then
10293     ENABLE_GLTF=TRUE
10294     AC_MSG_RESULT([yes])
10295     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10296     if test "$with_system_libgltf" = "yes"; then
10297         SYSTEM_LIBGLTF=TRUE
10298         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10299     else
10300         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10301     fi
10302 else
10303     AC_MSG_RESULT([no])
10305 AC_SUBST(ENABLE_GLTF)
10306 AC_SUBST(SYSTEM_LIBGLTF)
10307 AC_SUBST(LIBGLTF_CFLAGS)
10308 AC_SUBST(LIBGLTF_LIBS)
10310 dnl ===================================================================
10311 dnl Check whether to enable COLLADA support
10312 dnl ===================================================================
10313 AC_MSG_CHECKING([whether to enable COLLADA support])
10314 ENABLE_COLLADA=
10315 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10316     AC_MSG_RESULT([yes])
10317     ENABLE_COLLADA=TRUE
10318     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10319     AC_MSG_CHECKING([which OPENCOLLADA to use])
10320     if test "$with_system_opencollada" = "yes"; then
10321         AC_MSG_RESULT([external])
10322         SYSTEM_OPENCOLLADA=TRUE
10323         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10324         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10325         AC_LANG_PUSH([C++])
10326         save_CXXFLAGS=$CXXFLAGS
10327         save_CPPFLAGS=$CPPFLAGS
10328         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10329         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10330         AC_CHECK_HEADERS(
10331                 COLLADABU.h \
10332                 COLLADAFW.h \
10333                 COLLADASaxFWLLoader.h \
10334                 GeneratedSaxParser.h,
10335             [],
10336             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10337             [])
10338         CXXFLAGS=$save_CXXFLAGS
10339         CPPFLAGS=$save_CPPFLAGS
10340         AC_LANG_POP([C++])
10341         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10342     else
10343         AC_MSG_RESULT([internal])
10344         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10345     fi
10346     BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10347 else
10348     AC_MSG_RESULT([no])
10350 AC_SUBST(ENABLE_COLLADA)
10351 AC_SUBST([OPENCOLLADA_CFLAGS])
10352 AC_SUBST([OPENCOLLADA_LIBS])
10353 AC_SUBST([SYSTEM_OPENCOLLADA])
10355 # pdf import?
10356 AC_MSG_CHECKING([whether to build the PDF import feature])
10357 ENABLE_PDFIMPORT=
10358 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10359     AC_MSG_RESULT([yes])
10360     ENABLE_PDFIMPORT=TRUE
10362     dnl ===================================================================
10363     dnl Check for system poppler
10364     dnl ===================================================================
10365     AC_MSG_CHECKING([which PDF import backend to use])
10366     if test "$with_system_poppler" = "yes"; then
10367         AC_MSG_RESULT([external])
10368         SYSTEM_POPPLER=TRUE
10369         PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
10370         AC_LANG_PUSH([C++])
10371         save_CXXFLAGS=$CXXFLAGS
10372         save_CPPFLAGS=$CPPFLAGS
10373         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10374         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10375         AC_CHECK_HEADER([cpp/poppler-version.h], [],
10376                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
10377         CXXFLAGS=$save_CXXFLAGS
10378         CPPFLAGS=$save_CPPFLAGS
10379         AC_LANG_POP([C++])
10380         libo_MINGW_CHECK_DLL([libpoppler])
10381         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10382     else
10383         AC_MSG_RESULT([internal])
10384         SYSTEM_POPPLER=
10385         BUILD_TYPE="$BUILD_TYPE POPPLER"
10386     fi
10387 else
10388     AC_MSG_RESULT([no])
10390 AC_SUBST(ENABLE_PDFIMPORT)
10391 AC_SUBST(SYSTEM_POPPLER)
10392 AC_SUBST(POPPLER_CFLAGS)
10393 AC_SUBST(POPPLER_LIBS)
10395 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10396 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10397     AC_MSG_RESULT([yes])
10398     ENABLE_MEDIAWIKI=TRUE
10399     BUILD_TYPE="$BUILD_TYPE XSLTML"
10400     if test  "x$with_java" = "xno"; then
10401         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10402     fi
10403 else
10404     AC_MSG_RESULT([no])
10405     ENABLE_MEDIAWIKI=
10406     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10408 AC_SUBST(ENABLE_MEDIAWIKI)
10410 AC_MSG_CHECKING([whether to build the Report Builder])
10411 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10412     AC_MSG_RESULT([yes])
10413     ENABLE_REPORTBUILDER=TRUE
10414     AC_MSG_CHECKING([which jfreereport libs to use])
10415     if test "$with_system_jfreereport" = "yes"; then
10416         SYSTEM_JFREEREPORT=TRUE
10417         AC_MSG_RESULT([external])
10418         if test -z $SAC_JAR; then
10419             SAC_JAR=/usr/share/java/sac.jar
10420         fi
10421         AC_CHECK_FILE($SAC_JAR, [],
10422              [AC_MSG_ERROR(sac.jar not found.)], [])
10424         if test -z $LIBXML_JAR; then
10425             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10426                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10427                 [
10428                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10429                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10430                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10431                     )
10432                 ]
10433             )
10434         else
10435             AC_CHECK_FILE($LIBXML_JAR, [],
10436                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10437         fi
10439         if test -z $FLUTE_JAR; then
10440             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10441                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10442                 [
10443                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10444                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10445                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10446                     )
10447                 ]
10448             )
10449         else
10450             AC_CHECK_FILE($FLUTE_JAR, [],
10451                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10452         fi
10454         if test -z $JFREEREPORT_JAR; then
10455             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10456                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10457                 [
10458                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10459                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10460                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10461                     )
10462                 ]
10463             )
10464         else
10465             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10466                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10467         fi
10469         if test -z $LIBLAYOUT_JAR; then
10470             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10471                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10472                 [
10473                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10474                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10475                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10476                     )
10477                 ]
10478             )
10479         else
10480             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10481                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10482         fi
10484         if test -z $LIBLOADER_JAR; then
10485             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10486                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10487                 [
10488                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10489                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10490                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10491                     )
10492                 ]
10493             )
10494         else
10495             AC_CHECK_FILE($LIBLOADER_JAR, [],
10496                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10497         fi
10499         if test -z $LIBFORMULA_JAR; then
10500             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10501                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10502                  [
10503                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10504                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10505                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10506                      )
10507                  ]
10508             )
10509         else
10510             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10511                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10512         fi
10514         if test -z $LIBREPOSITORY_JAR; then
10515             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10516                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10517                 [
10518                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10519                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10520                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10521                     )
10522                 ]
10523             )
10524         else
10525             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10526                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10527         fi
10529         if test -z $LIBFONTS_JAR; then
10530             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10531                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10532                 [
10533                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10534                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10535                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10536                     )
10537                 ]
10538             )
10539         else
10540             AC_CHECK_FILE($LIBFONTS_JAR, [],
10541                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10542         fi
10544         if test -z $LIBSERIALIZER_JAR; then
10545             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10546                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10547                 [
10548                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10549                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10550                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10551                     )
10552                 ]
10553             )
10554         else
10555             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10556                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10557         fi
10559         if test -z $LIBBASE_JAR; then
10560             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10561                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10562                 [
10563                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10564                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10565                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10566                     )
10567                 ]
10568             )
10569         else
10570             AC_CHECK_FILE($LIBBASE_JAR, [],
10571                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10572         fi
10574     else
10575         AC_MSG_RESULT([internal])
10576         SYSTEM_JFREEREPORT=
10577         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10578     fi
10579 else
10580     AC_MSG_RESULT([no])
10581     ENABLE_REPORTBUILDER=
10582     SYSTEM_JFREEREPORT=
10584 AC_SUBST(ENABLE_REPORTBUILDER)
10585 AC_SUBST(SYSTEM_JFREEREPORT)
10586 AC_SUBST(SAC_JAR)
10587 AC_SUBST(LIBXML_JAR)
10588 AC_SUBST(FLUTE_JAR)
10589 AC_SUBST(JFREEREPORT_JAR)
10590 AC_SUBST(LIBBASE_JAR)
10591 AC_SUBST(LIBLAYOUT_JAR)
10592 AC_SUBST(LIBLOADER_JAR)
10593 AC_SUBST(LIBFORMULA_JAR)
10594 AC_SUBST(LIBREPOSITORY_JAR)
10595 AC_SUBST(LIBFONTS_JAR)
10596 AC_SUBST(LIBSERIALIZER_JAR)
10598 # this has to be here because both the Wiki Publisher and the SRB use
10599 # commons-logging
10600 COMMONS_LOGGING_VERSION=1.2
10601 if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10602     AC_MSG_CHECKING([which Apache commons-* libs to use])
10603     if test "$with_system_apache_commons" = "yes"; then
10604         SYSTEM_APACHE_COMMONS=TRUE
10605         AC_MSG_RESULT([external])
10606         if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
10607             if test -z $COMMONS_CODEC_JAR; then
10608                 _commons_codec_path=""
10609                 if test "$HAVE_JAVA6" = "TRUE"; then
10610                     _commons_codec_path="/usr/share/java/commons-codec-1.9.jar"
10611                 else
10612                     _commons_codec_path="/usr/share/java/commons-codec-1.6.jar"
10613                 fi
10614                 AC_CHECK_FILE($_commons_codec_path,
10615                     [ COMMONS_CODEC_JAR=$_commons_codec_path ],
10616                     [
10617                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
10618                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
10619                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
10620                         )
10621                     ]
10622                 )
10623             else
10624                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
10625                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10626             fi
10628             if test -z $COMMONS_LANG_JAR; then
10629                 _commons_lang_path=""
10630                 if test "$HAVE_JAVA6" = "TRUE"; then
10631                     _commons_lang_path="/usr/share/java/commons-lang3-3.3.1-src.tar.gz"
10632                 else
10633                     _commons_lang_path="/usr/share/java/commons-lang-2.4.jar"
10634                 fi
10635                 AC_CHECK_FILE($_commons_lang_path,
10636                     [ COMMONS_LANG_JAR=$commons_lang_path ],
10637                     [
10638                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10639                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10640                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10641                             )
10642                     ]
10643                 )
10644             else
10645                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10646                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10647             fi
10649             if test -z $COMMONS_HTTPCLIENT_JAR; then
10650                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10651                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10652                     [
10653                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10654                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10655                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10656                         )
10657                     ]
10658                 )
10659             else
10660                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10661                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10662             fi
10663         fi
10664         if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10665             if test -z $COMMONS_LOGGING_JAR; then
10666                 AC_CHECK_FILE(/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar,
10667                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar ],
10668                    [
10669                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10670                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10671                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10672                         )
10673                     ]
10674                 )
10675             else
10676                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10677                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10678             fi
10679         fi
10680     else
10681         AC_MSG_RESULT([internal])
10682         SYSTEM_APACHE_COMMONS=
10683         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10684     fi
10686 AC_SUBST(SYSTEM_APACHE_COMMONS)
10687 AC_SUBST(COMMONS_CODEC_JAR)
10688 AC_SUBST(COMMONS_LANG_JAR)
10689 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10690 AC_SUBST(COMMONS_LOGGING_JAR)
10691 AC_SUBST(COMMONS_LOGGING_VERSION)
10693 # scripting provider for BeanShell?
10694 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10695 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10696     AC_MSG_RESULT([yes])
10697     ENABLE_SCRIPTING_BEANSHELL=TRUE
10699     dnl ===================================================================
10700     dnl Check for system beanshell
10701     dnl ===================================================================
10702     AC_MSG_CHECKING([which beanshell to use])
10703     if test "$with_system_beanshell" = "yes"; then
10704         AC_MSG_RESULT([external])
10705         SYSTEM_BSH=TRUE
10706         if test -z $BSH_JAR; then
10707             BSH_JAR=/usr/share/java/bsh.jar
10708         fi
10709         AC_CHECK_FILE($BSH_JAR, [],
10710                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10711     else
10712         AC_MSG_RESULT([internal])
10713         SYSTEM_BSH=
10714         BUILD_TYPE="$BUILD_TYPE BSH"
10715     fi
10716 else
10717     AC_MSG_RESULT([no])
10718     ENABLE_SCRIPTING_BEANSHELL=
10719     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10721 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10722 AC_SUBST(SYSTEM_BSH)
10723 AC_SUBST(BSH_JAR)
10725 # scripting provider for JavaScript?
10726 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10727 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10728     AC_MSG_RESULT([yes])
10729     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10731     dnl ===================================================================
10732     dnl Check for system rhino
10733     dnl ===================================================================
10734     AC_MSG_CHECKING([which rhino to use])
10735     if test "$with_system_rhino" = "yes"; then
10736         AC_MSG_RESULT([external])
10737         SYSTEM_RHINO=TRUE
10738         if test -z $RHINO_JAR; then
10739             RHINO_JAR=/usr/share/java/js.jar
10740         fi
10741         AC_CHECK_FILE($RHINO_JAR, [],
10742                    [AC_MSG_ERROR(js.jar not found.)], [])
10743     else
10744         AC_MSG_RESULT([internal])
10745         SYSTEM_RHINO=
10746         BUILD_TYPE="$BUILD_TYPE RHINO"
10747     fi
10748 else
10749     AC_MSG_RESULT([no])
10750     ENABLE_SCRIPTING_JAVASCRIPT=
10751     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10753 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10754 AC_SUBST(SYSTEM_RHINO)
10755 AC_SUBST(RHINO_JAR)
10757 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10758 # paths should be added to library search path. So lets put all 64-bit
10759 # platforms there.
10760 supports_multilib=
10761 case "$host_cpu" in
10762 x86_64 | powerpc64 | powerpc64le | s390x | aarch64)
10763     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10764         supports_multilib="yes"
10765     fi
10766     ;;
10768     ;;
10769 esac
10771 dnl ===================================================================
10772 dnl Check whether the TQt and TDE libraries are available.
10773 dnl ===================================================================
10775 TDE_CFLAGS=""
10776 TDE_LIBS=""
10777 if test "$_os" != "OpenBSD"; then
10778     MOC="moc"
10780 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10781     dnl Search paths for TQt and TDE
10782     if test -z "$supports_multilib"; then
10783         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"
10784         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"
10785     else
10786         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"
10787         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"
10788     fi
10789     if test -n "$TQTDIR"; then
10790         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10791         if test -z "$supports_multilib"; then
10792             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10793         else
10794             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10795         fi
10796     fi
10797     if test -z "$supports_multilib"; then
10798         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"
10799         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"
10800     else
10801         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"
10802         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"
10803     fi
10804     if test -n "$TDEDIR"; then
10805         tde_incdirs="$TDEDIR/include $tde_incdirs"
10806         if test -z "$supports_multilib"; then
10807             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10808         else
10809             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10810         fi
10811     fi
10813     dnl What to test
10814     tqt_test_include="ntqstyle.h"
10815     tde_test_include="kapp.h"
10817     if test "$_os" != "OpenBSD"; then
10818         tqt_test_library="libtqt-mt.so"
10819         tde_test_library="libDCOP.so"
10820     else
10821         tqt_test_library="libtqt-mt.so*"
10822         tde_test_library="libDCOP.so*"
10823     fi
10825     dnl Check for TQt headers
10826     AC_MSG_CHECKING([for TQt headers])
10827     tqt_incdir="no"
10828     for tde_check in $tqt_incdirs; do
10829         if test -r "$tde_check/$tqt_test_include"; then
10830             tqt_incdir="$tde_check"
10831             break
10832         fi
10833     done
10834     AC_MSG_RESULT([$tqt_incdir])
10835     if test "x$tqt_incdir" = "xno"; then
10836         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10837 your TQt installation by exporting TQTDIR before running "configure".])
10838     fi
10840     dnl Check for TQt libraries
10841     AC_MSG_CHECKING([for TQt libraries])
10842     tqt_libdir="no"
10843     for tqt_check in $tqt_libdirs; do
10844         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10845             tqt_libdir="$tqt_check"
10846             break
10847         fi
10848     done
10849     AC_MSG_RESULT([$tqt_libdir])
10850     if test "x$tqt_libdir" = "xno"; then
10851         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10852 your TQt installation by exporting TQTDIR before running "configure".])
10853     fi
10855     dnl Check for Meta Object Compiler
10856     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10857     if test "$MOC" = "no"; then
10858         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10859 the root of your TQt installation by exporting TQTDIR before running "configure".])
10860     fi
10862     dnl Check for TDE headers
10863     AC_MSG_CHECKING([for TDE headers])
10864     tde_incdir="no"
10865     for tde_check in $tde_incdirs; do
10866         if test -r "$tde_check/$tde_test_include"; then
10867             tde_incdir="$tde_check"
10868             break
10869         fi
10870     done
10871     AC_MSG_RESULT([$tde_incdir])
10872     if test "x$tde_incdir" = "xno"; then
10873         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10874 your TDE installation by exporting TDEDIR before running "configure".])
10875     fi
10877     dnl Check for TDE libraries
10878     AC_MSG_CHECKING([for TDE libraries])
10879     tde_libdir="no"
10880     for tde_check in $tde_libdirs; do
10881         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10882             tde_libdir="$tde_check"
10883             break
10884         fi
10885     done
10886     AC_MSG_RESULT([$tde_libdir])
10887     if test "x$tde_libdir" = "xno"; then
10888         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10889 your TDE installation by exporting TDEDIR before running "configure".])
10890     fi
10892     dnl Set the variables
10893     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10894     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10896 AC_SUBST(TDE_CFLAGS)
10897 AC_SUBST(TDE_LIBS)
10898 AC_SUBST(MOC)
10900 dnl ===================================================================
10901 dnl Check whether the Qt3 and KDE3 libraries are available.
10902 dnl ===================================================================
10904 KDE_CFLAGS=""
10905 KDE_LIBS=""
10906 if test "$_os" != "OpenBSD"; then
10907     MOC="moc"
10909 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
10910     dnl Search paths for Qt3 and KDE3
10911     if test -z "$supports_multilib"; then
10912         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"
10913         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"
10914     else
10915         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"
10916         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"
10917     fi
10918     if test -n "$QTDIR"; then
10919         qt_incdirs="$QTDIR/include $qt_incdirs"
10920         if test -z "$supports_multilib"; then
10921             qt_libdirs="$QTDIR/lib $qt_libdirs"
10922         else
10923             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10924         fi
10925     fi
10926     if test -z "$supports_multilib"; then
10927         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"
10928         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"
10929     else
10930         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"
10931         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"
10932     fi
10933     if test -n "$KDEDIR"; then
10934         kde_incdirs="$KDEDIR/include $kde_incdirs"
10935         if test -z "$supports_multilib"; then
10936             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10937         else
10938             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10939         fi
10940     fi
10942     dnl What to test
10943     qt_test_include="qstyle.h"
10944     kde_test_include="kapp.h"
10946     if test "$_os" != "OpenBSD"; then
10947         qt_test_library="libqt-mt.so"
10948         kde_test_library="libDCOP.so"
10949     else
10950         qt_test_library="libqt-mt.so*"
10951         kde_test_library="libDCOP.so*"
10952     fi
10954     dnl Check for Qt3 headers
10955     AC_MSG_CHECKING([for Qt3 headers])
10956     qt_incdir="no"
10957     for kde_check in $qt_incdirs; do
10958         if test -r "$kde_check/$qt_test_include"; then
10959             qt_incdir="$kde_check"
10960             break
10961         fi
10962     done
10963     AC_MSG_RESULT([$qt_incdir])
10964     if test "x$qt_incdir" = "xno"; then
10965         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
10966 your Qt3 installation by exporting QTDIR before running "configure".])
10967     fi
10969     dnl Check for Qt3 libraries
10970     AC_MSG_CHECKING([for Qt3 libraries])
10971     qt_libdir="no"
10972     for qt_check in $qt_libdirs; do
10973         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
10974             qt_libdir="$qt_check"
10975             break
10976         fi
10977     done
10978     AC_MSG_RESULT([$qt_libdir])
10979     if test "x$qt_libdir" = "xno"; then
10980         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
10981 your Qt3 installation by exporting QTDIR before running "configure".])
10982     fi
10984     dnl Check for Meta Object Compiler
10985     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
10986     if test "$MOC" = "no"; then
10987         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
10988 the root of your Qt3 installation by exporting QTDIR before running "configure".])
10989     fi
10991     dnl Check for KDE3 headers
10992     AC_MSG_CHECKING([for KDE3 headers])
10993     kde_incdir="no"
10994     for kde_check in $kde_incdirs; do
10995         if test -r "$kde_check/$kde_test_include"; then
10996             kde_incdir="$kde_check"
10997             break
10998         fi
10999     done
11000     AC_MSG_RESULT([$kde_incdir])
11001     if test "x$kde_incdir" = "xno"; then
11002         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
11003 your KDE3 installation by exporting KDEDIR before running "configure".])
11004     fi
11006     dnl Check for KDE3 libraries
11007     AC_MSG_CHECKING([for KDE3 libraries])
11008     kde_libdir="no"
11009     for kde_check in $kde_libdirs; do
11010         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11011             kde_libdir="$kde_check"
11012             break
11013         fi
11014     done
11015     AC_MSG_RESULT([$kde_libdir])
11016     if test "x$kde_libdir" = "xno"; then
11017         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11018 your KDE3 installation by exporting KDEDIR before running "configure".])
11019     fi
11021     dnl Set the variables
11022     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11023     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11024     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11026 AC_SUBST(KDE_CFLAGS)
11027 AC_SUBST(KDE_LIBS)
11028 AC_SUBST(MOC)
11030 dnl ===================================================================
11031 dnl KDE4 Integration
11032 dnl ===================================================================
11034 KDE4_CFLAGS=""
11035 KDE4_LIBS=""
11036 QMAKE4="qmake"
11037 MOC4="moc"
11038 KDE_GLIB_CFLAGS=""
11039 KDE_GLIB_LIBS=""
11040 KDE_HAVE_GLIB=""
11041 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11042     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11043     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11045     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11046     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11048     if test -n "$supports_multilib"; then
11049         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11050         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11051     fi
11053     if test -n "$QTDIR"; then
11054         qt_incdirs="$QTDIR/include $qt_incdirs"
11055         if test -z "$supports_multilib"; then
11056             qt_libdirs="$QTDIR/lib $qt_libdirs"
11057         else
11058             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11059         fi
11060     fi
11061     if test -n "$QT4DIR"; then
11062         qt_incdirs="$QT4DIR/include $qt_incdirs"
11063         if test -z "$supports_multilib"; then
11064             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11065         else
11066             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11067         fi
11068     fi
11070     if test -n "$KDEDIR"; then
11071         kde_incdirs="$KDEDIR/include $kde_incdirs"
11072         if test -z "$supports_multilib"; then
11073             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11074         else
11075             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11076         fi
11077     fi
11078     if test -n "$KDE4DIR"; then
11079         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11080         if test -z "$supports_multilib"; then
11081             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11082         else
11083             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11084         fi
11085     fi
11087     qt_test_include="Qt/qobject.h"
11088     qt_test_library="libQtNetwork.so"
11089     kde_test_include="kwindowsystem.h"
11090     kde_test_library="libsolid.so"
11092     AC_MSG_CHECKING([for Qt4 headers])
11093     qt_header_dir="no"
11094     for inc_dir in $qt_incdirs; do
11095         if test -r "$inc_dir/$qt_test_include"; then
11096             qt_header_dir="$inc_dir"
11097             break
11098         fi
11099     done
11101     AC_MSG_RESULT([$qt_header_dir])
11102     if test "x$qt_header_dir" = "xno"; then
11103         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11104     fi
11106     dnl Check for qmake
11107     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11108     QMAKE4="$QMAKEQT4"
11109     if test "$QMAKE4" = "no"; then
11110         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11111         if test "$QMAKE4" = "no"; then
11112             AC_MSG_ERROR([Qmake not found.  Please specify
11113 the root of your Qt installation by exporting QT4DIR before running "configure".])
11114         fi
11115     fi
11117     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11118     AC_MSG_CHECKING([for Qt4 libraries])
11119     qt_lib_dir="no"
11120     for lib_dir in $qt_libdirs; do
11121         if test -r "$lib_dir/$qt_test_library"; then
11122             qt_lib_dir="$lib_dir"
11123             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11124             break
11125         fi
11126     done
11128     AC_MSG_RESULT([$qt_lib_dir])
11130     if test "x$qt_lib_dir" = "xno"; then
11131         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11132     fi
11134     dnl Check for Meta Object Compiler
11136     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11137     MOC4="$MOCQT4"
11138     if test "$MOC4" = "no"; then
11139         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11140         if test "$MOC4" = "no"; then
11141             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11142 the root of your Qt installation by exporting QT4DIR before running "configure".])
11143         fi
11144     fi
11146     dnl Check for KDE4 headers
11147     AC_MSG_CHECKING([for KDE4 headers])
11148     kde_incdir="no"
11149     for kde_check in $kde_incdirs; do
11150         if test -r "$kde_check/$kde_test_include"; then
11151             kde_incdir="$kde_check"
11152             break
11153         fi
11154     done
11155     AC_MSG_RESULT([$kde_incdir])
11156     if test "x$kde_incdir" = "xno"; then
11157         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11158     fi
11160     dnl Check for KDE4 libraries
11161     AC_MSG_CHECKING([for KDE4 libraries])
11162     kde_libdir="no"
11163     for kde_check in $kde_libdirs; do
11164         if test -r "$kde_check/$kde_test_library"; then
11165             kde_libdir="$kde_check"
11166             break
11167         fi
11168     done
11170     AC_MSG_RESULT([$kde_libdir])
11171     if test "x$kde_libdir" = "xno"; then
11172         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11173     fi
11175     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11176     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11177     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11178     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11180     AC_LANG_PUSH([C++])
11181     save_CXXFLAGS=$CXXFLAGS
11182     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11183     AC_MSG_CHECKING([whether KDE is >= 4.2])
11184        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11185 #include <kdeversion.h>
11187 int main(int argc, char **argv) {
11188        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11189        else return 1;
11191        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11192     CXXFLAGS=$save_CXXFLAGS
11193     AC_LANG_POP([C++])
11195     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11196     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11197     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11198         [
11199             KDE_HAVE_GLIB=1
11200             AC_DEFINE(KDE_HAVE_GLIB,1)
11201             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11203             qt4_fix_warning=
11205             AC_LANG_PUSH([C++])
11206             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11207             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11208             #  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
11209             #               ^~~~~~~~~~~~~~~~~~~~~~~
11210             #               vptr for 'QObjectPrivate'
11211             save_CXX=$CXX
11212             CXX=$(printf %s "$CXX" | sed -e s/-fno-sanitize-recover//)
11213             save_CXXFLAGS=$CXXFLAGS
11214             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11215             save_LIBS=$LIBS
11216             LIBS="$LIBS $KDE4_LIBS"
11217             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11219             # Prepare meta object data
11220             TSTBASE="tst_exclude_socket_notifiers"
11221             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11222             ln -fs "${TSTMOC}.hxx"
11223             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11225             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11226 #define SAL_OVERRIDE
11227 #include "tst_exclude_socket_notifiers.moc"
11229 int main(int argc, char *argv[])
11231     QCoreApplication app(argc, argv);
11232     exit(tst_processEventsExcludeSocket());
11233     return 0;
11235             ]])],[
11236                 AC_MSG_RESULT([yes])
11237             ],[
11238                 AC_MSG_RESULT([no])
11239                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11240                 if test -z "$qt4_fix_warning"; then
11241                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11242                 fi
11243                 qt4_fix_warning=1
11244                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11245             ])
11247             # Remove meta object data
11248             rm -f "${TSTBASE}."*
11250             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11252             # Prepare meta object data
11253             TSTBASE="tst_exclude_posted_events"
11254             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11255             ln -fs "${TSTMOC}.hxx"
11256             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11258             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11259 #define SAL_OVERRIDE
11260 #include "tst_exclude_posted_events.moc"
11262 int main(int argc, char *argv[])
11264     QCoreApplication app(argc, argv);
11265     exit(tst_excludePostedEvents());
11266     return 0;
11268             ]])],[
11269                 AC_MSG_RESULT([yes])
11270             ],[
11271                 AC_MSG_RESULT([no])
11272                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11273                 if test -z "$qt4_fix_warning"; then
11274                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11275                 fi
11276                 qt4_fix_warning=1
11277                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11278             ])
11280             # Remove meta object data
11281             rm -f "${TSTBASE}."*
11283             if test -n "$qt4_fix_warning"; then
11284                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11285             fi
11287             LIBS=$save_LIBS
11288             CXXFLAGS=$save_CXXFLAGS
11289             CXX=$save_CXX
11290             AC_LANG_POP([C++])
11291         ],
11292         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11294 AC_SUBST(KDE4_CFLAGS)
11295 AC_SUBST(KDE4_LIBS)
11296 AC_SUBST(MOC4)
11297 AC_SUBST(KDE_GLIB_CFLAGS)
11298 AC_SUBST(KDE_GLIB_LIBS)
11299 AC_SUBST(KDE_HAVE_GLIB)
11301 dnl ===================================================================
11302 dnl Test for the enabling the lockdown pieces
11303 dnl ===================================================================
11304 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11305 ENABLE_LOCKDOWN=
11306 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11307     ENABLE_LOCKDOWN=TRUE
11308     AC_MSG_RESULT([yes])
11309 else
11310     AC_MSG_RESULT([no])
11312 AC_SUBST(ENABLE_LOCKDOWN)
11314 dnl ===================================================================
11315 dnl Test whether to include Evolution 2 support
11316 dnl ===================================================================
11317 AC_MSG_CHECKING([whether to enable evolution 2 support])
11318 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11319     AC_MSG_RESULT([yes])
11320     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11321     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11322     ENABLE_EVOAB2="TRUE"
11323 else
11324     ENABLE_EVOAB2=""
11325     AC_MSG_RESULT([no])
11327 AC_SUBST(ENABLE_EVOAB2)
11328 AC_SUBST(GOBJECT_CFLAGS)
11329 AC_SUBST(GOBJECT_LIBS)
11331 dnl ===================================================================
11332 dnl Test whether to include TDE AB support
11333 dnl ===================================================================
11334 AC_MSG_CHECKING([whether to enable TDE address book support])
11335 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11336     AC_MSG_RESULT([yes])
11337     AC_LANG_PUSH([C++])
11338     save_CXXFLAGS=$CXXFLAGS
11339     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11340     AC_MSG_CHECKING([whether TDE is at least R14.0])
11341        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11342 #include <tdeversion.h>
11344 int main(int argc, char **argv) {
11345        if (TDE_VERSION_MAJOR >= 14) return 0;
11346        else return 1;
11348        ]])],[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])],[])
11349     CXXFLAGS=$save_CXXFLAGS
11350     AC_LANG_POP([C++])
11351     ENABLE_TDEAB=TRUE
11352 else
11353     AC_MSG_RESULT([no])
11354     ENABLE_TDEAB=
11356 AC_SUBST(ENABLE_TDEAB)
11358 dnl ===================================================================
11359 dnl Test whether to include KDE AB support
11360 dnl ===================================================================
11361 AC_MSG_CHECKING([whether to enable KDE address book support])
11362 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11363     AC_MSG_RESULT([yes])
11364     AC_LANG_PUSH([C++])
11365     save_CXXFLAGS=$CXXFLAGS
11366     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11367     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11368        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11369 #include <kdeversion.h>
11371 int main(int argc, char **argv) {
11372        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11373        else return 1;
11375        ]])],[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])],[])
11376     CXXFLAGS=$save_CXXFLAGS
11377     AC_LANG_POP([C++])
11378     ENABLE_KAB=TRUE
11379 else
11380     AC_MSG_RESULT([no])
11381     ENABLE_KAB=
11383 AC_SUBST(ENABLE_KAB)
11385 dnl ===================================================================
11386 dnl Test which themes to include
11387 dnl ===================================================================
11388 AC_MSG_CHECKING([which themes to include])
11389 # if none given use default subset of available themes
11390 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11391     with_theme="breeze galaxy hicontrast oxygen sifr tango"
11392     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11395 WITH_THEMES=""
11396 if test "x$with_theme" != "xno"; then
11397     for theme in $with_theme; do
11398         case $theme in
11399         breeze|crystal|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) real_theme="$theme" ;;
11400         default) real_theme=galaxy ;;
11401         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11402         esac
11403         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11404     done
11406 AC_MSG_RESULT([$WITH_THEMES])
11407 AC_SUBST([WITH_THEMES])
11408 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11409 for theme in $with_theme; do
11410     case $theme in
11411     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11412     *) ;;
11413     esac
11414 done
11416 dnl ===================================================================
11417 dnl Test whether to integrate helppacks into the product's installer
11418 dnl ===================================================================
11419 AC_MSG_CHECKING([for helppack integration])
11420 if test "$with_helppack_integration" = "no"; then
11421     WITH_HELPPACK_INTEGRATION=
11422     AC_MSG_RESULT([no integration])
11423 else
11424     WITH_HELPPACK_INTEGRATION=TRUE
11425     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11426     AC_MSG_RESULT([integration])
11428 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11430 ###############################################################################
11431 # Extensions checking
11432 ###############################################################################
11433 AC_MSG_CHECKING([for extensions integration])
11434 if test "x$enable_extension_integration" != "xno"; then
11435     WITH_EXTENSION_INTEGRATION=TRUE
11436     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11437     AC_MSG_RESULT([yes, use integration])
11438 else
11439     WITH_EXTENSION_INTEGRATION=
11440     AC_MSG_RESULT([no, do not integrate])
11442 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11444 dnl Should any extra extensions be included?
11445 dnl There are standalone tests for each of these below.
11446 WITH_EXTRA_EXTENSIONS=
11447 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11449 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11450 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11451 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11452 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11453 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11454 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11455 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11456 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11457 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11458 if test "x$with_java" != "xno"; then
11459     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11460     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11463 dnl ===================================================================
11464 dnl Test whether to include Sun Professional Template Pack
11465 dnl ===================================================================
11466 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11467 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11468     AC_MSG_RESULT([no integration])
11469 else
11470     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11471     sun_supported_langs="en-US de it fr es hu"
11472     if test "$with_sun_templates" = "yes"; then
11473         wanted_sun_templates="$sun_supported_langs"
11474     else
11475         # check whether the langs are supported by Sun
11476         wanted_sun_templates=
11477         for lang in $with_sun_templates; do
11478             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11479                 wanted_sun_templates="$wanted_sun_templates $lang"
11480             fi
11481         done
11482     fi
11483     SUNTEMPLATES_LANG=
11484     SUNTEMPLATES_DE_PACK=
11485     SUNTEMPLATES_EN_US_PACK=
11486     SUNTEMPLATES_ES_PACK=
11487     SUNTEMPLATES_FR_PACK=
11488     SUNTEMPLATES_HU_PACK=
11489     SUNTEMPLATES_IT_PACK=
11490     # check whether the langs are requested at all
11491     for lang in $wanted_sun_templates; do
11492     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11493         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11494         case $lang in
11495         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11496         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11497         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11498         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11499         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11500         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11501         esac
11502     fi
11503     done
11504     WITH_EXTRA_EXTENSIONS=TRUE
11505     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11507 AC_SUBST(SUNTEMPLATES_DE_PACK)
11508 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11509 AC_SUBST(SUNTEMPLATES_ES_PACK)
11510 AC_SUBST(SUNTEMPLATES_FR_PACK)
11511 AC_SUBST(SUNTEMPLATES_HU_PACK)
11512 AC_SUBST(SUNTEMPLATES_IT_PACK)
11514 TEST_FONTS_MISSING=0
11516 # $1  = font family
11517 # $2+ = accepted font mappings
11518 test_font_map()
11520     FONT="$1" ; shift
11521     AC_MSG_CHECKING([font mapping for '$FONT'])
11522     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11523     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11525     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11526     while test "$#" -ge 1 ; do
11527         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11528         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11529     done
11530     if test $TESTEXPR
11531     then
11532         AC_MSG_RESULT([ok])
11533     else
11534         AC_MSG_RESULT([unknown ($FONTFILE)])
11535         TEST_FONTS_MISSING=1
11536     fi
11539 dnl ===================================================================
11540 dnl Test whether to include fonts
11541 dnl ===================================================================
11542 AC_MSG_CHECKING([whether to include third-party fonts])
11543 if test "$with_fonts" != "no"; then
11544     AC_MSG_RESULT([yes])
11545     WITH_FONTS=TRUE
11546     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11547 else
11548     AC_MSG_RESULT([no])
11549     WITH_FONTS=
11550     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11551     if test "$test_fontconfig" = "yes"; then
11552         AC_PATH_PROG([FCMATCH], [fc-match])
11553         if test -z "$FCMATCH"; then
11554             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11555             TEST_FONTS_MISSING=1
11556         else
11557             test_font_map 'Calibri' 'Carlito'
11558             if test ${TEST_FONTS_MISSING} -eq 1
11559             then
11560                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11561             fi
11562         fi
11563     else
11564         TEST_FONTS_MISSING=0
11565     fi
11567 AC_SUBST(WITH_FONTS)
11568 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11570 dnl ===================================================================
11571 dnl Test whether to include extra galleries
11572 dnl ===================================================================
11573 AC_MSG_CHECKING([whether to include extra galleries])
11574 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11575     AC_MSG_RESULT([no])
11576     WITH_EXTRA_GALLERY=
11577     OOOP_GALLERY_PACK=""
11578 else
11579     AC_MSG_RESULT([yes])
11580     WITH_EXTRA_GALLERY=TRUE
11581     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11582     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11583     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11585 AC_SUBST(WITH_EXTRA_GALLERY)
11586 AC_SUBST(OOOP_GALLERY_PACK)
11588 dnl ===================================================================
11589 dnl Test whether to include extra templates
11590 dnl ===================================================================
11591 AC_MSG_CHECKING([whether to include extra templates])
11592 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11593     AC_MSG_RESULT([no])
11594     WITH_EXTRA_TEMPLATE=
11595     OOOP_TEMPLATES_PACK=""
11596 else
11597     AC_MSG_RESULT([yes])
11598     WITH_EXTRA_TEMPLATE=TRUE
11599     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11600     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11601     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11603 AC_SUBST(WITH_EXTRA_TEMPLATE)
11604 AC_SUBST(OOOP_TEMPLATES_PACK)
11606 dnl ===================================================================
11607 dnl Test whether to include extra samples
11608 dnl ===================================================================
11609 AC_MSG_CHECKING([whether to include extra samples])
11610 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11611     AC_MSG_RESULT([no])
11612     WITH_EXTRA_SAMPLE=
11613     OOOP_SAMPLES_PACK=""
11614 else
11615     AC_MSG_RESULT([yes])
11616     WITH_EXTRA_SAMPLE=TRUE
11617     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11618     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11619     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11621 AC_SUBST(WITH_EXTRA_SAMPLE)
11622 AC_SUBST(OOOP_SAMPLES_PACK)
11624 dnl ===================================================================
11625 dnl Test whether to include extra fonts
11626 dnl ===================================================================
11627 AC_MSG_CHECKING([whether to include extra fonts])
11628 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11629     AC_MSG_RESULT([no])
11630     WITH_EXTRA_FONT=
11631     OOOP_FONTS_PACK=""
11632 else
11633     AC_MSG_RESULT([yes])
11634     WITH_EXTRA_FONT=TRUE
11635     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11636     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11637     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11639 AC_SUBST(WITH_EXTRA_FONT)
11640 AC_SUBST(OOOP_FONTS_PACK)
11642 dnl ===================================================================
11643 dnl Test whether to enable online update service
11644 dnl ===================================================================
11645 AC_MSG_CHECKING([whether to enable online update])
11646 ENABLE_ONLINE_UPDATE=
11647 if test "$enable_online_update" = ""; then
11648     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11649         AC_MSG_RESULT([yes])
11650         ENABLE_ONLINE_UPDATE="TRUE"
11651     else
11652         AC_MSG_RESULT([no])
11653     fi
11654 else
11655     if test "$enable_online_update" = "yes"; then
11656         AC_MSG_RESULT([yes])
11657         ENABLE_ONLINE_UPDATE="TRUE"
11658     else
11659         AC_MSG_RESULT([no])
11660     fi
11662 AC_SUBST(ENABLE_ONLINE_UPDATE)
11664 dnl ===================================================================
11665 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11666 dnl ===================================================================
11667 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11668 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11669     AC_MSG_RESULT([no])
11670     ENABLE_SILENT_MSI=
11671 else
11672     AC_MSG_RESULT([yes])
11673     ENABLE_SILENT_MSI=TRUE
11674     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11676 AC_SUBST(ENABLE_SILENT_MSI)
11678 AC_MSG_CHECKING([whether and how to use Xinerama])
11679 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11680     if test "$x_libraries" = "default_x_libraries"; then
11681         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11682         if test "x$XINERAMALIB" = x; then
11683            XINERAMALIB="/usr/lib"
11684         fi
11685     else
11686         XINERAMALIB="$x_libraries"
11687     fi
11688     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11689         # we have both versions, let the user decide but use the dynamic one
11690         # per default
11691         USE_XINERAMA=TRUE
11692         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11693             XINERAMA_LINK=dynamic
11694         else
11695             XINERAMA_LINK=static
11696         fi
11697     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11698         # we have only the dynamic version
11699         USE_XINERAMA=TRUE
11700         XINERAMA_LINK=dynamic
11701     elif test -e "$XINERAMALIB/libXinerama.a"; then
11702         # static version
11703         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11704             USE_XINERAMA=TRUE
11705             XINERAMA_LINK=static
11706         else
11707             USE_XINERAMA=
11708             XINERAMA_LINK=none
11709         fi
11710     else
11711         # no Xinerama
11712         USE_XINERAMA=
11713         XINERAMA_LINK=none
11714     fi
11715     if test "$USE_XINERAMA" = "TRUE"; then
11716         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11717         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11718             [AC_MSG_ERROR(Xinerama header not found.)], [])
11719         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11720         if test "x$XEXTLIB" = x; then
11721            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11722         fi
11723         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11724         if test "$_os" = "FreeBSD"; then
11725             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11726         fi
11727         if test "$_os" = "Linux"; then
11728             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11729         fi
11730         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11731             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11732     else
11733         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11734     fi
11735 else
11736     USE_XINERAMA=
11737     XINERAMA_LINK=none
11738     AC_MSG_RESULT([no])
11740 AC_SUBST(USE_XINERAMA)
11741 AC_SUBST(XINERAMA_LINK)
11743 dnl ===================================================================
11744 dnl Test whether to build cairo or rely on the system version
11745 dnl ===================================================================
11747 if test "$GUIBASE" = "unx"; then
11748     # Used in vcl/Library_vclplug_gen.mk
11749     test_cairo=yes
11752 if test "$test_cairo" = "yes"; then
11753     AC_MSG_CHECKING([whether to use the system cairo])
11755     : ${with_system_cairo:=$with_system_libs}
11756     if test "$with_system_cairo" = "yes"; then
11757         SYSTEM_CAIRO=TRUE
11758         AC_MSG_RESULT([yes])
11760         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11761         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11763         if test "$test_xrender" = "yes"; then
11764             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11765             AC_LANG_PUSH([C])
11766             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11767 #ifdef PictStandardA8
11768 #else
11769       return fail;
11770 #endif
11771 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11773             AC_LANG_POP([C])
11774         fi
11775         libo_MINGW_CHECK_DLL([libcairo])
11776         libo_MINGW_TRY_DLL([libfontconfig])
11777         libo_MINGW_TRY_DLL([libfreetype])
11778         libo_MINGW_TRY_DLL([libpixman])
11779         libo_MINGW_TRY_DLL([libpng15])
11780     else
11781         SYSTEM_CAIRO=
11782         AC_MSG_RESULT([no])
11784         BUILD_TYPE="$BUILD_TYPE CAIRO"
11785         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11786     fi
11789 AC_SUBST(SYSTEM_CAIRO)
11790 AC_SUBST(CAIRO_CFLAGS)
11791 AC_SUBST(CAIRO_LIBS)
11793 dnl ===================================================================
11794 dnl Test whether to use avahi
11795 dnl ===================================================================
11796 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11797     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11798                       [ENABLE_AVAHI="TRUE"])
11799     AC_DEFINE(HAVE_FEATURE_AVAHI)
11800     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11803 AC_SUBST(ENABLE_AVAHI)
11804 AC_SUBST(AVAHI_CFLAGS)
11805 AC_SUBST(AVAHI_LIBS)
11807 dnl ===================================================================
11808 dnl Test whether to use liblangtag
11809 dnl ===================================================================
11810 ENABLE_LIBLANGTAG=
11811 SYSTEM_LIBLANGTAG=
11812 AC_MSG_CHECKING([whether to use liblangtag])
11813 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11814     ENABLE_LIBLANGTAG=TRUE
11815     AC_MSG_RESULT([yes])
11816     AC_MSG_CHECKING([whether to use system liblangtag])
11817     if test "$with_system_liblangtag" = yes; then
11818         SYSTEM_LIBLANGTAG=TRUE
11819         AC_MSG_RESULT([yes])
11820         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11821         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11822         libo_MINGW_CHECK_DLL([liblangtag])
11823     else
11824         SYSTEM_LIBLANGTAG=
11825         AC_MSG_RESULT([no])
11826         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11827         if test "$COM" = "MSC"; then
11828             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11829         else
11830             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11831         fi
11832     fi
11833 else
11834     AC_MSG_RESULT([no])
11836 AC_SUBST(ENABLE_LIBLANGTAG)
11837 AC_SUBST(SYSTEM_LIBLANGTAG)
11838 AC_SUBST(LIBLANGTAG_CFLAGS)
11839 AC_SUBST(LIBLANGTAG_LIBS)
11841 dnl ===================================================================
11842 dnl Test whether to build libpng or rely on the system version
11843 dnl ===================================================================
11845 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11847 dnl ===================================================================
11848 dnl Check for runtime JVM search path
11849 dnl ===================================================================
11850 if test "$ENABLE_JAVA" != ""; then
11851     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11852     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11853         AC_MSG_RESULT([yes])
11854         if ! test -d "$with_jvm_path"; then
11855             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11856         fi
11857         if ! test -d "$with_jvm_path"jvm; then
11858             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11859         fi
11860         JVM_ONE_PATH_CHECK="$with_jvm_path"
11861         AC_SUBST(JVM_ONE_PATH_CHECK)
11862     else
11863         AC_MSG_RESULT([no])
11864     fi
11867 dnl ===================================================================
11868 dnl Test for the presence of Ant and that it works
11869 dnl ===================================================================
11871 if test "$ENABLE_JAVA" != ""; then
11872     ANT_HOME=; export ANT_HOME
11873     WITH_ANT_HOME=; export WITH_ANT_HOME
11874     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11875         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11876             if test "$_os" = "WINNT"; then
11877                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11878             else
11879                 with_ant_home="$LODE_HOME/opt/ant"
11880             fi
11881         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11882             with_ant_home="$LODE_HOME/opt/ant"
11883         fi
11884     fi
11885     if test -z "$with_ant_home"; then
11886         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11887     else
11888         if test "$_os" = "WINNT"; then
11889             # AC_PATH_PROGS needs unix path
11890             with_ant_home=`cygpath -u "$with_ant_home"`
11891         fi
11892         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11893         WITH_ANT_HOME=$with_ant_home
11894         ANT_HOME=$with_ant_home
11895     fi
11897     if test -z "$ANT"; then
11898         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11899     else
11900         # resolve relative or absolute symlink
11901         while test -h "$ANT"; do
11902             a_cwd=`pwd`
11903             a_basename=`basename "$ANT"`
11904             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11905             cd "`dirname "$ANT"`"
11906             cd "`dirname "$a_script"`"
11907             ANT="`pwd`"/"`basename "$a_script"`"
11908             cd "$a_cwd"
11909         done
11911         AC_MSG_CHECKING([if $ANT works])
11912         cat > conftest.java << EOF
11913         public class conftest {
11914             int testmethod(int a, int b) {
11915                     return a + b;
11916             }
11917         }
11920         cat > conftest.xml << EOF
11921         <project name="conftest" default="conftest">
11922         <target name="conftest">
11923             <javac srcdir="." includes="conftest.java">
11924             </javac>
11925         </target>
11926         </project>
11929         oldJAVA_HOME=$JAVA_HOME
11930         if test "$JAVACISGCJ" = "yes"; then
11931             JAVA_HOME=; export JAVA_HOME
11932             ant_gcj="-Dbuild.compiler=gcj"
11933         fi
11934         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11935         if test $? = 0 -a -f ./conftest.class; then
11936             AC_MSG_RESULT([Ant works])
11937             if test -z "$WITH_ANT_HOME"; then
11938                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11939                 if test -z "$ANT_HOME"; then
11940                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11941                 fi
11942             else
11943                 ANT_HOME="$WITH_ANT_HOME"
11944             fi
11945         else
11946             echo "configure: Ant test failed" >&5
11947             cat conftest.java >&5
11948             cat conftest.xml >&5
11949             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
11950             ANT_HOME=""
11951             add_warning "Ant does not work - Some Java projects will not build!"
11952         fi
11953         JAVA_HOME=$oldJAVA_HOME
11954         rm -f conftest* core core.* *.core
11955     fi
11956     if test -z "$ANT_HOME"; then
11957         ANT_HOME="NO_ANT_HOME"
11958     else
11959         PathFormat "$ANT_HOME"
11960         ANT_HOME="$formatted_path"
11961         PathFormat "$ANT"
11962         ANT="$formatted_path"
11963     fi
11964     AC_SUBST(ANT_HOME)
11965     AC_SUBST(ANT)
11967     dnl Checking for ant.jar
11968     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11969         AC_MSG_CHECKING([Ant lib directory])
11970         if test -f $ANT_HOME/lib/ant.jar; then
11971             ANT_LIB="$ANT_HOME/lib"
11972         else
11973             if test -f $ANT_HOME/ant.jar; then
11974                 ANT_LIB="$ANT_HOME"
11975             else
11976                 if test -f /usr/share/java/ant.jar; then
11977                     ANT_LIB=/usr/share/java
11978                 else
11979                     if test -f /usr/share/ant-core/lib/ant.jar; then
11980                         ANT_LIB=/usr/share/ant-core/lib
11981                     else
11982                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11983                             ANT_LIB="$ANT_HOME/lib/ant"
11984                         else
11985                             if test -f /usr/share/lib/ant/ant.jar; then
11986                                 ANT_LIB=/usr/share/lib/ant
11987                             else
11988                                 AC_MSG_ERROR([Ant libraries not found!])
11989                             fi
11990                         fi
11991                     fi
11992                 fi
11993             fi
11994         fi
11995         PathFormat "$ANT_LIB"
11996         ANT_LIB="$formatted_path"
11997         AC_MSG_RESULT([Ant lib directory found.])
11998     fi
11999     AC_SUBST(ANT_LIB)
12001     ant_minver=1.6.0
12002     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12004     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12005     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12006     ant_version_major=`echo $ant_version | cut -d. -f1`
12007     ant_version_minor=`echo $ant_version | cut -d. -f2`
12008     echo "configure: ant_version $ant_version " >&5
12009     echo "configure: ant_version_major $ant_version_major " >&5
12010     echo "configure: ant_version_minor $ant_version_minor " >&5
12011     if test "$ant_version_major" -ge "2"; then
12012         AC_MSG_RESULT([yes, $ant_version])
12013     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12014         AC_MSG_RESULT([yes, $ant_version])
12015     else
12016         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12017     fi
12019     rm -f conftest* core core.* *.core
12022 OOO_JUNIT_JAR=
12023 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12024     AC_MSG_CHECKING([for JUnit 4])
12025     if test "$with_junit" = "yes"; then
12026         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12027             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12028         elif test -e /usr/share/java/junit4.jar; then
12029             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12030         else
12031            if test -e /usr/share/lib/java/junit.jar; then
12032               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12033            else
12034               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12035            fi
12036         fi
12037     else
12038         OOO_JUNIT_JAR=$with_junit
12039     fi
12040     if test "$_os" = "WINNT"; then
12041         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12042     fi
12043     printf 'import org.junit.Before;' > conftest.java
12044     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12045         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12046     else
12047         AC_MSG_ERROR(
12048 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12049  specify its pathname via --with-junit=..., or disable it via --without-junit])
12050     fi
12051     rm -f conftest.class conftest.java
12052     if test $OOO_JUNIT_JAR != ""; then
12053     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12054     fi
12056 AC_SUBST(OOO_JUNIT_JAR)
12058 HAMCREST_JAR=
12059 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12060     AC_MSG_CHECKING([for included Hamcrest])
12061     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12062     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12063         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12064     else
12065         AC_MSG_RESULT([Not included])
12066         AC_MSG_CHECKING([for standalone hamcrest jar.])
12067         if test "$with_hamcrest" = "yes"; then
12068             if test -e /usr/share/lib/java/hamcrest.jar; then
12069                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12070             elif test -e /usr/share/java/hamcrest/core.jar; then
12071                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12072             else
12073                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12074             fi
12075         else
12076             HAMCREST_JAR=$with_hamcrest
12077         fi
12078         if test "$_os" = "WINNT"; then
12079             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12080         fi
12081         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12082             AC_MSG_RESULT([$HAMCREST_JAR])
12083         else
12084             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),
12085                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12086         fi
12087     fi
12088     rm -f conftest.class conftest.java
12090 AC_SUBST(HAMCREST_JAR)
12093 AC_SUBST(SCPDEFS)
12096 # check for wget and curl
12098 WGET=
12099 CURL=
12101 if test "$enable_fetch_external" != "no"; then
12103 CURL=`which curl 2>/dev/null`
12105 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12106     eval "$i --version" > /dev/null 2>&1
12107     ret=$?
12108     if test $ret -eq 0; then
12109         WGET=$i
12110         break
12111     fi
12112 done
12114 if test -z "$WGET" -a -z "$CURL"; then
12115     AC_MSG_ERROR([neither wget nor curl found!])
12120 AC_SUBST(WGET)
12121 AC_SUBST(CURL)
12124 # check for md5sum
12126 MD5SUM=
12128 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12129     if test "$i" = "md5"; then
12130         eval "$i -x" > /dev/null 2>&1
12131     else
12132         eval "$i --version" > /dev/null 2>&1
12133     fi
12134     ret=$?
12135     if test $ret -eq 0; then
12136         MD5SUM=$i
12137         break
12138     fi
12139 done
12141 if test "$MD5SUM" = "md5"; then
12142     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12143         MD5SUM="$MD5SUM -r"
12144     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12145         MD5SUM="$MD5SUM -n"
12146     fi
12149 if test -z "$MD5SUM"; then
12150     AC_MSG_ERROR([no md5sum found!])
12153 AC_SUBST(MD5SUM)
12155 dnl ===================================================================
12156 dnl Dealing with l10n options
12157 dnl ===================================================================
12158 AC_MSG_CHECKING([which languages to be built])
12159 # get list of all languages
12160 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12161 # the sed command does the following:
12162 #   + if a line ends with a backslash, append the next line to it
12163 #   + adds " on the beginning of the value (after =)
12164 #   + adds " at the end of the value
12165 #   + removes en-US; we want to put it on the beginning
12166 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12167 [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)]
12168 ALL_LANGS="en-US $completelangiso"
12169 # check the configured localizations
12170 WITH_LANG="$with_lang"
12171 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12172     AC_MSG_RESULT([en-US])
12173 else
12174     AC_MSG_RESULT([$WITH_LANG])
12175     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12177 # check that the list is valid
12178 for lang in $WITH_LANG; do
12179     test "$lang" = "ALL" && continue
12180     # need to check for the exact string, so add space before and after the list of all languages
12181     for vl in $ALL_LANGS; do
12182         if test "$vl" = "$lang"; then
12183            break
12184         fi
12185     done
12186     if test "$vl" != "$lang"; then
12187         # if you're reading this - you prolly quoted your languages remove the quotes ...
12188         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12189     fi
12190 done
12191 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12192     echo $WITH_LANG | grep -q en-US
12193     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12195 # list with substituted ALL
12196 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12197 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12198 test "$WITH_LANG" = "en-US" && WITH_LANG=
12199 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12200     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12201     ALL_LANGS=`echo $ALL_LANGS qtz`
12203 AC_SUBST(ALL_LANGS)
12204 AC_SUBST(WITH_LANG)
12205 AC_SUBST(WITH_LANG_LIST)
12206 AC_SUBST(GIT_NEEDED_SUBMODULES)
12208 WITH_POOR_HELP_LOCALIZATIONS=
12209 if test -d "$SRC_ROOT/translations/source"; then
12210     for l in `ls -1 $SRC_ROOT/translations/source`; do
12211         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12212             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12213         fi
12214     done
12216 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12218 if test -n "$with_locales"; then
12219     WITH_LOCALES="$with_locales"
12221     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12222     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12223     # config_host/config_locales.h.in
12224     for locale in $WITH_LOCALES; do
12225         lang=${locale%_*}
12227         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12229         case $lang in
12230         hi|mr*ne)
12231             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12232             ;;
12233         bg|ru)
12234             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12235             ;;
12236         esac
12237     done
12238 else
12239     AC_DEFINE(WITH_LOCALE_ALL)
12241 AC_SUBST(WITH_LOCALES)
12243 dnl git submodule update --reference
12244 dnl ===================================================================
12245 if test -n "${GIT_REFERENCE_SRC}"; then
12246     for repo in ${GIT_NEEDED_SUBMODULES}; do
12247         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12248             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12249         fi
12250     done
12252 AC_SUBST(GIT_REFERENCE_SRC)
12254 dnl git submodules linked dirs
12255 dnl ===================================================================
12256 if test -n "${GIT_LINK_SRC}"; then
12257     for repo in ${GIT_NEEDED_SUBMODULES}; do
12258         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12259             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12260         fi
12261     done
12263 AC_SUBST(GIT_LINK_SRC)
12265 dnl branding
12266 dnl ===================================================================
12267 AC_MSG_CHECKING([for alternative branding images directory])
12268 # initialize mapped arrays
12269 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12270 brand_files="$BRAND_INTRO_IMAGES about.svg"
12272 if test -z "$with_branding" -o "$with_branding" = "no"; then
12273     AC_MSG_RESULT([none])
12274     DEFAULT_BRAND_IMAGES="$brand_files"
12275 else
12276     if ! test -d $with_branding ; then
12277         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12278     else
12279         AC_MSG_RESULT([$with_branding])
12280         CUSTOM_BRAND_DIR="$with_branding"
12281         for lfile in $brand_files
12282         do
12283             if ! test -f $with_branding/$lfile ; then
12284                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12285                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12286             else
12287                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12288             fi
12289         done
12290         check_for_progress="yes"
12291     fi
12293 AC_SUBST([BRAND_INTRO_IMAGES])
12294 AC_SUBST([CUSTOM_BRAND_DIR])
12295 AC_SUBST([CUSTOM_BRAND_IMAGES])
12296 AC_SUBST([DEFAULT_BRAND_IMAGES])
12299 AC_MSG_CHECKING([for 'intro' progress settings])
12300 PROGRESSBARCOLOR=
12301 PROGRESSSIZE=
12302 PROGRESSPOSITION=
12303 PROGRESSFRAMECOLOR=
12304 PROGRESSTEXTCOLOR=
12305 PROGRESSTEXTBASELINE=
12307 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12308     source "$with_branding/progress.conf"
12309     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12310 else
12311     AC_MSG_RESULT([none])
12314 AC_SUBST(PROGRESSBARCOLOR)
12315 AC_SUBST(PROGRESSSIZE)
12316 AC_SUBST(PROGRESSPOSITION)
12317 AC_SUBST(PROGRESSFRAMECOLOR)
12318 AC_SUBST(PROGRESSTEXTCOLOR)
12319 AC_SUBST(PROGRESSTEXTBASELINE)
12322 AC_MSG_CHECKING([for extra build ID])
12323 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12324     EXTRA_BUILDID="$with_extra_buildid"
12326 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12327 if test -n "$EXTRA_BUILDID" ; then
12328     AC_MSG_RESULT([$EXTRA_BUILDID])
12329 else
12330     AC_MSG_RESULT([not set])
12332 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12334 OOO_VENDOR=
12335 AC_MSG_CHECKING([for vendor])
12336 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12337     OOO_VENDOR="$USERNAME"
12339     if test -z "$OOO_VENDOR"; then
12340         OOO_VENDOR="$USER"
12341     fi
12343     if test -z "$OOO_VENDOR"; then
12344         OOO_VENDOR="`id -u -n`"
12345     fi
12347     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12348 else
12349     OOO_VENDOR="$with_vendor"
12350     AC_MSG_RESULT([$OOO_VENDOR])
12352 AC_SUBST(OOO_VENDOR)
12354 if echo "$host_os" | grep -q linux-android ; then
12355     ANDROID_PACKAGE_NAME=
12356     AC_MSG_CHECKING([for Android package name])
12357     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12358         if test -n "$ENABLE_DEBUG"; then
12359             # Default to the package name that makes ndk-gdb happy.
12360             ANDROID_PACKAGE_NAME="org.libreoffice"
12361         else
12362             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12363         fi
12365         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12366     else
12367         if test -n "$ENABLE_DEBUG" -a "$with_android_package_name" != "org.libreoffice" ; then
12368             AC_MSG_ERROR([The package name must be set
12369 to org.libreoffice when debugging, please avoid --with-android-package-name.])
12370         fi
12371         ANDROID_PACKAGE_NAME="$with_android_package_name"
12372         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12373     fi
12374     AC_SUBST(ANDROID_PACKAGE_NAME)
12377 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12378 if test "$with_compat_oowrappers" = "yes"; then
12379     WITH_COMPAT_OOWRAPPERS=TRUE
12380     AC_MSG_RESULT(yes)
12381 else
12382     WITH_COMPAT_OOWRAPPERS=
12383     AC_MSG_RESULT(no)
12385 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12387 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12388 AC_MSG_CHECKING([for install dirname])
12389 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12390     INSTALLDIRNAME="$with_install_dirname"
12392 AC_MSG_RESULT([$INSTALLDIRNAME])
12393 AC_SUBST(INSTALLDIRNAME)
12395 AC_MSG_CHECKING([for prefix])
12396 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12397 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12398 PREFIXDIR="$prefix"
12399 AC_MSG_RESULT([$PREFIXDIR])
12400 AC_SUBST(PREFIXDIR)
12402 LIBDIR=[$(eval echo $(eval echo $libdir))]
12403 AC_SUBST(LIBDIR)
12405 DATADIR=[$(eval echo $(eval echo $datadir))]
12406 AC_SUBST(DATADIR)
12408 MANDIR=[$(eval echo $(eval echo $mandir))]
12409 AC_SUBST(MANDIR)
12411 DOCDIR=[$(eval echo $(eval echo $docdir))]
12412 AC_SUBST(DOCDIR)
12414 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12415 AC_SUBST(INSTALLDIR)
12417 TESTINSTALLDIR="${BUILDDIR}/test-install"
12418 AC_SUBST(TESTINSTALLDIR)
12421 # ===================================================================
12422 # OAuth2 id and secrets
12423 # ===================================================================
12425 AC_MSG_CHECKING([for Google Drive client id and secret])
12426 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12427 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12428 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12429     GDRIVE_CLIENT_ID="\"\""
12432 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12433     GDRIVE_CLIENT_SECRET="\"\""
12436 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12437     AC_MSG_RESULT([not set])
12438 else
12439     AC_MSG_RESULT([set])
12442 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12443 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12445 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12446 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12447 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12448 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12449     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12452 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12453     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12456 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12457     AC_MSG_RESULT([not set])
12458 else
12459     AC_MSG_RESULT([set])
12461 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12462 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12464 AC_MSG_CHECKING([for OneDrive client id and secret])
12465 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12466 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12467 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12468     ONEDRIVE_CLIENT_ID="\"\""
12471 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12472     ONEDRIVE_CLIENT_SECRET="\"\""
12475 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12476     AC_MSG_RESULT([not set])
12477 else
12478     AC_MSG_RESULT([set])
12480 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12481 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12484 # ===================================================================
12485 # De- or increase default verbosity of build process
12486 # ===================================================================
12487 AC_MSG_CHECKING([build verbosity])
12488 if test -n "$enable_verbose"; then
12489     if test "$enable_verbose" = "yes"; then
12490         VERBOSE="TRUE"
12491         AC_MSG_RESULT([high])
12492     fi
12493     if test "$enable_verbose" = "no"; then
12494         VERBOSE="FALSE"
12495         AC_MSG_RESULT([low])
12496     fi
12497 else
12498     AC_MSG_RESULT([not set])
12500 AC_SUBST(VERBOSE)
12502 dnl ===================================================================
12503 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12504 dnl --enable-dependency-tracking configure option
12505 dnl ===================================================================
12506 AC_MSG_CHECKING([whether to enable dependency tracking])
12507 if test "$enable_dependency_tracking" = "no"; then
12508     nodep=TRUE
12509     AC_MSG_RESULT([no])
12510 else
12511     AC_MSG_RESULT([yes])
12513 AC_SUBST(nodep)
12515 dnl ===================================================================
12516 dnl Number of CPUs to use during the build
12517 dnl ===================================================================
12518 AC_MSG_CHECKING([for number of processors to use])
12519 # plain --with-parallelism is just the default
12520 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12521     if test "$with_parallelism" = "no"; then
12522         PARALLELISM=0
12523     else
12524         PARALLELISM=$with_parallelism
12525     fi
12526 else
12527     if test "$enable_icecream" = "yes"; then
12528         PARALLELISM="10"
12529     else
12530         case `uname -s` in
12532         Darwin|FreeBSD|NetBSD|OpenBSD)
12533             PARALLELISM=`sysctl -n hw.ncpu`
12534             ;;
12536         Linux)
12537             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12538         ;;
12539         # what else than above does profit here *and* has /proc?
12540         *)
12541             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12542             ;;
12543         esac
12545         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12546         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12547     fi
12550 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12551     if test -z "$with_parallelism"; then
12552             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12553             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12554             PARALLELISM="1"
12555     else
12556         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."
12557     fi
12560 if test $PARALLELISM -eq 0; then
12561     AC_MSG_RESULT([explicit make -j option needed])
12562 else
12563     AC_MSG_RESULT([$PARALLELISM])
12565 AC_SUBST(PARALLELISM)
12567 IWYU_PATH="$with_iwyu"
12568 AC_SUBST(IWYU_PATH)
12569 if test ! -z "$IWYU_PATH"; then
12570     if test ! -f "$IWYU_PATH"; then
12571         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12572     fi
12576 # Set up ILIB for MSVC build
12578 ILIB1=
12579 if test "$build_os" = "cygwin"; then
12580     ILIB="."
12581     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12582         ILIB="$ILIB;$JAVA_HOME/lib"
12583     fi
12584     ILIB1=-link
12585     if test "$BITNESS_OVERRIDE" = 64; then
12586         ILIB="$ILIB;$COMPATH/lib/amd64"
12587         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12588         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12589         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12590         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81; then
12591             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12592             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12593         fi
12594     else
12595         ILIB="$ILIB;$COMPATH/lib"
12596         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12597         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12598         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12599         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81; then
12600             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12601             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12602         fi
12603     fi
12604     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12606     AC_SUBST(ILIB)
12609 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12610 if test "$CROSS_COMPILING" = "TRUE"; then
12611     broken='assuming not (cross-compiling)'
12612 else
12613     save_CXXFLAGS=$CXXFLAGS
12614     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12615     save_LIBS=$LIBS
12616     if test -n "$ILIB1"; then
12617         LIBS="$LIBS $ILIB1"
12618     fi
12619     AC_LANG_PUSH([C++])
12620     AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12621         // Exit with failure if the static initializer_list is stored on the
12622         // stack (as done by Clang < 3.4):
12623         #include <initializer_list>
12624         struct S {};
12625         bool g(void const * p1, void const * p2) {
12626             int n;
12627             return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12628         }
12629         bool f(void const * p1) {
12630             static std::initializer_list<S> s { S() };
12631             return g(p1, s.begin());
12632         }
12633         ]],[[
12634             int n;
12635             return f(&n) ? 0 : 1;
12636         ]])], [broken=no], [broken=yes])
12637     AC_LANG_POP([C++])
12638     LIBS=$save_LIBS
12639     CXXFLAGS=$save_CXXFLAGS
12641 AC_MSG_RESULT([$broken])
12642 if test "$broken" = yes; then
12643     AC_DEFINE([HAVE_BROKEN_STATIC_INITILIZER_LIST])
12647 # ===================================================================
12648 # Creating bigger shared library to link against
12649 # ===================================================================
12650 AC_MSG_CHECKING([whether to create huge library])
12651 MERGELIBS=
12653 if test $_os = iOS -o $_os = Android; then
12654     # Never any point in mergelibs for these as we build just static
12655     # libraries anyway...
12656     enable_mergelibs=no
12659 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12660     if test $_os != Linux -a $_os != WINNT; then
12661         add_warning "--enable-mergelibs is not tested for this platform"
12662     fi
12663     if test "$enable_mergelibs" = "all"; then
12664         MERGELIBS="ALL"
12665         URELIBS="TRUE"
12666         AC_DEFINE(STATIC_LINKING)
12667     else
12668         MERGELIBS="CORE"
12669     fi
12670     AC_MSG_RESULT([yes])
12671 else
12672     AC_MSG_RESULT([no])
12674 AC_SUBST([MERGELIBS])
12675 AC_SUBST([URELIBS])
12677 # ===================================================================
12678 # Create hardlinks on deliver instead of copying for smaller size and speed up
12679 # ===================================================================
12680 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12681 HARDLINKDELIVER=
12682 if test "$enable_hardlink_deliver" = "yes"; then
12683     HARDLINKDELIVER="TRUE"
12684     AC_MSG_RESULT([yes])
12685 else
12686     AC_MSG_RESULT([no])
12688 AC_SUBST(HARDLINKDELIVER)
12690 dnl ===================================================================
12691 dnl icerun is a wrapper that stops us spawning tens of processes
12692 dnl locally - for tools that can't be executed on the compile cluster
12693 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12694 dnl ===================================================================
12695 AC_MSG_CHECKING([whether to use icerun wrapper])
12696 ICECREAM_RUN=
12697 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12698     ICECREAM_RUN=icerun
12699     AC_MSG_RESULT([yes])
12700 else
12701     AC_MSG_RESULT([no])
12703 AC_SUBST(ICECREAM_RUN)
12705 dnl ===================================================================
12706 dnl Setup the ICECC_VERSION for the build the same way it was set for
12707 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12708 dnl ===================================================================
12709 x_ICECC_VERSION=[\#]
12710 if test -n "$ICECC_VERSION" ; then
12711     x_ICECC_VERSION=
12713 AC_SUBST(x_ICECC_VERSION)
12714 AC_SUBST(ICECC_VERSION)
12716 dnl ===================================================================
12718 AC_MSG_CHECKING([MPL subset])
12719 MPL_SUBSET=
12721 if test "$enable_mpl_subset" = "yes"; then
12722     warn_report=false
12723     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12724         warn_report=true
12725     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12726         warn_report=true
12727     fi
12728     if test "$warn_report" = "true"; then
12729         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12730     fi
12731     if test "x$enable_postgresql_sdbc" != "xno"; then
12732         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12733     fi
12734     if test "$enable_lotuswordpro" = "yes"; then
12735         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12736     fi
12737     if test "$WITH_WEBDAV" = "neon"; then
12738         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12739     fi
12740     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12741         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12742     fi
12743     if test -n "$ENABLE_PDFIMPORT"; then
12744         if test "x$SYSTEM_POPPLER" != "x"; then
12745             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12746         fi
12747     fi
12748     # cf. m4/libo_check_extension.m4
12749     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12750         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12751     fi
12752     for theme in $WITH_THEMES; do
12753         case $theme in
12754         breeze|crystal|default|hicontrast|human|oxygen|sifr)
12755             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12756         *) : ;;
12757         esac
12758     done
12760     ENABLE_OPENGL=
12762     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12763         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12764     fi
12766     MPL_SUBSET="TRUE"
12767     AC_DEFINE(MPL_HAVE_SUBSET)
12768     AC_MSG_RESULT([only])
12769 else
12770     AC_MSG_RESULT([no restrictions])
12772 AC_SUBST(MPL_SUBSET)
12775 dnl ===================================================================
12776 dnl Setting up the environment.
12777 dnl ===================================================================
12778 echo "setting up the build environment variables..."
12780 AC_SUBST(COMPATH)
12782 if test "$build_os" = "cygwin"; then
12783     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12784         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12785         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12786     else
12787         ATL_LIB="$COMPATH/atlmfc/lib"
12788         ATL_INCLUDE="$COMPATH/atlmfc/include"
12789     fi
12790     if test "$BITNESS_OVERRIDE" = 64; then
12791         ATL_LIB="$ATL_LIB/amd64"
12792     fi
12793     PathFormat "/usr/bin/grep.exe"
12794     WIN_GREP="$formatted_path"
12795     PathFormat "/usr/bin/find.exe"
12796     WIN_FIND="$formatted_path"
12797     PathFormat "/usr/bin/ls.exe"
12798     WIN_LS="$formatted_path"
12799     PathFormat "/usr/bin/touch.exe"
12800     WIN_TOUCH="$formatted_path"
12803 AC_SUBST(ATL_INCLUDE)
12804 AC_SUBST(ATL_LIB)
12805 AC_SUBST(WIN_FIND)
12806 AC_SUBST(WIN_GREP)
12807 AC_SUBST(WIN_LS)
12808 AC_SUBST(WIN_TOUCH)
12810 AC_SUBST(BUILD_TYPE)
12812 AC_SUBST(SOLARINC)
12814 PathFormat "$PERL"
12815 PERL="$formatted_path"
12816 AC_SUBST(PERL)
12818 if test -n "$TMPDIR"; then
12819     TEMP_DIRECTORY="$TMPDIR"
12820 else
12821     TEMP_DIRECTORY="/tmp"
12823 if test "$build_os" = "cygwin"; then
12824     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12826 AC_SUBST(TEMP_DIRECTORY)
12828 # setup the PATH for the environment
12829 if test -n "$LO_PATH_FOR_BUILD"; then
12830     LO_PATH="$LO_PATH_FOR_BUILD"
12831 else
12832     LO_PATH="$PATH"
12834     case "$host_os" in
12836     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12837         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12838             pathmunge "$JAVA_HOME/bin" "after"
12839         fi
12840         ;;
12842     cygwin*)
12843         # Win32 make needs native paths
12844         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12845             LO_PATH=`cygpath -p -m "$PATH"`
12846         fi
12847         if test "$BITNESS_OVERRIDE" = 64; then
12848             # needed for msi packaging
12849             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12850         fi
12851         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12852         pathmunge "$ASM_HOME" "before"
12853         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12854         pathmunge "$CSC_PATH" "before"
12855         pathmunge "$MIDL_PATH" "before"
12856         pathmunge "$AL_PATH" "before"
12857         pathmunge "$MSPDB_PATH" "before"
12858         if test -n "$MSBUILD_PATH" ; then
12859             pathmunge "$MSBUILD_PATH" "before"
12860         fi
12861         if test "$BITNESS_OVERRIDE" = 64; then
12862             if test "$vcexpress" = "Express"; then
12863                 pathmunge "$COMPATH/bin/x86_amd64" "before"
12864                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12865             else
12866                 pathmunge "$COMPATH/bin/amd64" "before"
12867                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12868             fi
12869         else
12870             pathmunge "$COMPATH/bin" "before"
12871             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12872         fi
12873         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12874             if test -d "$JAVA_HOME/jre/bin/client"; then
12875                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12876             fi
12877             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12878                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12879             fi
12880             pathmunge "$JAVA_HOME/bin" "before"
12881         fi
12882         ;;
12884     solaris*)
12885         pathmunge "/usr/css/bin" "before"
12886         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12887             pathmunge "$JAVA_HOME/bin" "after"
12888         fi
12889         ;;
12890     esac
12893 AC_SUBST(LO_PATH)
12895 # Generate a configuration md5 we can use for deps
12896 if test -f config_host.mk; then
12897     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12900 AC_CONFIG_FILES([config_host.mk
12901                  Makefile
12902                  lo.xcent
12903                  instsetoo_native/util/openoffice.lst
12904                  sysui/desktop/macosx/Info.plist
12905                  ios/lo.xcconfig])
12906 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12907 AC_CONFIG_HEADERS([config_host/config_clang.h])
12908 AC_CONFIG_HEADERS([config_host/config_eot.h])
12909 AC_CONFIG_HEADERS([config_host/config_features.h])
12910 AC_CONFIG_HEADERS([config_host/config_folders.h])
12911 AC_CONFIG_HEADERS([config_host/config_gcc.h])
12912 AC_CONFIG_HEADERS([config_host/config_global.h])
12913 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12914 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12915 AC_CONFIG_HEADERS([config_host/config_locales.h])
12916 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12917 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12918 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12919 AC_CONFIG_HEADERS([config_host/config_mingw.h])
12920 AC_CONFIG_HEADERS([config_host/config_oox.h])
12921 AC_CONFIG_HEADERS([config_host/config_options.h])
12922 AC_CONFIG_HEADERS([config_host/config_test.h])
12923 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12924 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12925 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12926 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12927 AC_CONFIG_HEADERS([config_host/config_version.h])
12928 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12929 AC_OUTPUT
12931 if test "$CROSS_COMPILING" = TRUE; then
12932     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12935 # touch the config timestamp file
12936 if test ! -f config_host.mk.stamp; then
12937     echo > config_host.mk.stamp
12938 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12939     echo "Configuration unchanged - avoiding scp2 stamp update"
12940 else
12941     echo > config_host.mk.stamp
12945 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12947 cat << _EOS
12948 ****************************************************************************
12949 WARNING:
12950 Your make version is known to be horribly slow, and hard to debug
12951 problems with. To get a reasonably functional make please do:
12953 to install a pre-compiled binary make for Win32
12955  mkdir -p /opt/lo/bin
12956  cd /opt/lo/bin
12957  wget http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12958  cp make-85047eb-msvc.exe make
12959  chmod +x make
12961 to install from source:
12962 place yourself in a working directory of you choice.
12964  git clone git://git.savannah.gnu.org/make.git
12966  [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 Comand Prompt"]
12967  set PATH=%PATH%;C:\Cygwin\bin
12968  [or Cygwin64, if that is what you have]
12969  cd path-to-make-repo-you-cloned-above
12970  build_w32.bat --without-guile
12972 should result in a WinRel/gnumake.exe.
12973 Copy it to to the Cygwin /opt/lo/bin directory as make.exe
12975 Then re-run autogen.sh
12977 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12978 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12980 _EOS
12983 cat << _EOF
12984 ****************************************************************************
12986 To build, issue:
12987 $GNUMAKE
12989 For details, run:
12990 $GNUMAKE help
12992 _EOF
12994 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12995     cat << _EOF
12996 After the build has finished, you can immediately run it using:
12997 instdir/program/soffice
12999 If you want to run the smoketest, issue:
13000 $GNUMAKE check
13002 _EOF
13005 if test -f warn; then
13006     cat warn
13007     rm warn
13010 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: