Version 4.4.4.1, tag libreoffice-4.4.4.1
[LibreOffice.git] / configure.ac
blobd0d066f1212e66be16db2d55dcbd129736df4413
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.4.4.1],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 PathFormat()
30     formatted_path="$1"
31     if test "$build_os" = "cygwin"; then
32         pf_conv_to_dos=
33         # spaces,parentheses,brackets,braces are problematic in pathname
34         # so are backslashes
35         case "$formatted_path" in
36             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
37                 pf_conv_to_dos="yes"
38             ;;
39         esac
40         if test "$pf_conv_to_dos" = "yes"; then
41             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
42                 formatted_path=`cygpath -sm "$formatted_path"`
43             else
44                 formatted_path=`cygpath -d "$formatted_path"`
45             fi
46             if test $? -ne 0;  then
47                 AC_MSG_ERROR([path conversion failed for "$1".])
48             fi
49         fi
50         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
51         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
52         if test "$fp_count_slash$fp_count_colon" != "00"; then
53             if test "$fp_count_colon" = "0"; then
54                 new_formatted_path=`realpath "$formatted_path"`
55                 if test $? -ne 0;  then
56                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
57                 else
58                     formatted_path="$new_formatted_path"
59                 fi
60             fi
61             formatted_path=`cygpath -m "$formatted_path"`
62             if test $? -ne 0;  then
63                 AC_MSG_ERROR([path conversion failed for "$1".])
64             fi
65         fi
66     fi
69 AbsolutePath()
71     # There appears to be no simple and portable method to get an absolute and
72     # canonical path, so we try creating the directory if does not exist and
73     # utilizing the shell and pwd.
74     rel="$1"
75     absolute_path=""
76     test ! -e "$rel" && mkdir -p "$rel"
77     if test -d "$rel" ; then
78         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
79         absolute_path="$(pwd)"
80         cd - > /dev/null
81     else
82         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
83     fi
86 rm -f warn
87 have_WARNINGS="no"
88 add_warning()
90     if test "$have_WARNINGS" = "no"; then
91         echo "*************************************" > warn
92         have_WARNINGS="yes"
93         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
94             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
95             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
96         else
97             COLORWARN="* WARNING :"
98         fi
99     fi
100     echo "$COLORWARN $@" >> warn
103 echo "********************************************************************"
104 echo "*"
105 echo "*   Running ${PACKAGE_NAME} build configuration."
106 echo "*"
107 echo "********************************************************************"
108 echo ""
110 dnl ===================================================================
111 dnl checks build and host OSes
112 dnl do this before argument processing to allow for platform dependent defaults
113 dnl ===================================================================
114 AC_CANONICAL_HOST
116 AC_MSG_CHECKING([for product name])
117 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
118     PRODUCTNAME=AC_PACKAGE_NAME"Dev"
119 else
120     PRODUCTNAME=AC_PACKAGE_NAME
122 AC_MSG_RESULT([$PRODUCTNAME])
123 AC_SUBST(PRODUCTNAME)
125 dnl ===================================================================
126 dnl Our version is defined by the AC_INIT() at the top of this script.
127 dnl ===================================================================
129 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
131 LIBO_VERSION_MAJOR=$1
132 LIBO_VERSION_MINOR=$2
133 LIBO_VERSION_MICRO=$3
134 LIBO_VERSION_PATCH=$4
136 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
137 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
138 # no way to encode that into an integer in general.
139 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
141 LIBO_VERSION_SUFFIX=$5
142 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
143 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
144 # they get undoubled before actually passed to sed.
145 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
146 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
147 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
148 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
150 AC_SUBST(LIBO_VERSION_MAJOR)
151 AC_SUBST(LIBO_VERSION_MINOR)
152 AC_SUBST(LIBO_VERSION_MICRO)
153 AC_SUBST(LIBO_VERSION_PATCH)
154 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
155 AC_SUBST(LIBO_VERSION_SUFFIX)
156 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
158 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
159 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
160 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
161 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
163 LIBO_THIS_YEAR=`date +%Y`
164 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
166 dnl ===================================================================
167 dnl Product version
168 dnl ===================================================================
169 AC_MSG_CHECKING([for product version])
170 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
171 AC_MSG_RESULT([$PRODUCTVERSION])
172 AC_SUBST(PRODUCTVERSION)
174 AC_PROG_EGREP
175 # AC_PROG_EGREP doesn't set GREP on all systems as well
176 AC_PATH_PROG(GREP, grep)
178 BUILDDIR=`pwd`
179 cd $srcdir
180 SRC_ROOT=`pwd`
181 cd $BUILDDIR
182 x_Cygwin=[\#]
184 dnl ===================================================================
185 dnl Search all the common names for GNU Make
186 dnl ===================================================================
187 AC_MSG_CHECKING([for GNU Make])
189 # try to use our own make if it is available and GNUMAKE was not already defined
190 if test -z "$GNUMAKE"; then
191     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
192         GNUMAKE="$LODE_HOME/opt/bin/make"
193     elif test -x "/opt/lo/bin/make"; then
194         GNUMAKE="/opt/lo/bin/make"
195     fi
198 GNUMAKE_WIN_NATIVE=
199 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
200     if test -n "$a"; then
201         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
202         if test $? -eq 0;  then
203             if test "$build_os" = "cygwin"; then
204                 if test -n "$($a -v | grep 'Built for Windows')" ; then
205                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
206                     GNUMAKE_WIN_NATIVE="TRUE"
207                 else
208                     GNUMAKE=`which $a`
209                 fi
210             else
211                 GNUMAKE=`which $a`
212             fi
213             break
214         fi
215     fi
216 done
217 AC_MSG_RESULT($GNUMAKE)
218 if test -z "$GNUMAKE"; then
219     AC_MSG_ERROR([not found. install GNU Make.])
220 else
221     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
222         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
223     fi
226 win_short_path_for_make()
228     local_short_path="$1"
229     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
230         cygpath -sm "$local_short_path"
231     else
232         cygpath -u "$(cygpath -d "$local_short_path")"
233     fi
237 if test "$build_os" = "cygwin"; then
238     PathFormat "$SRC_ROOT"
239     SRC_ROOT="$formatted_path"
240     PathFormat "$BUILDDIR"
241     BUILDDIR="$formatted_path"
242     x_Cygwin=
245 AC_SUBST(SRC_ROOT)
246 AC_SUBST(BUILDDIR)
247 AC_SUBST(x_Cygwin)
248 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
249 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
251 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
252     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
255 # need sed in os checks...
256 AC_PATH_PROGS(SED, sed)
257 if test -z "$SED"; then
258     AC_MSG_ERROR([install sed to run this script])
261 # Set the ENABLE_LTO variable
262 # ===================================================================
263 AC_MSG_CHECKING([whether to use link-time optimization])
264 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
265     ENABLE_LTO="TRUE"
266     AC_MSG_RESULT([yes])
267     AC_DEFINE(STATIC_LINKING)
268 else
269     ENABLE_LTO=""
270     AC_MSG_RESULT([no])
272 AC_SUBST(ENABLE_LTO)
274 dnl ===================================================================
275 dnl When building for Android, --with-android-ndk,
276 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
277 dnl mandatory
278 dnl ===================================================================
280 AC_ARG_WITH(android-ndk,
281     AS_HELP_STRING([--with-android-ndk],
282         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
285 AC_ARG_WITH(android-ndk-toolchain-version,
286     AS_HELP_STRING([--with-android-ndk-toolchain-version],
287         [Specify which toolchain version to use, of those present in the
288         Android NDK you are using. Mandatory if the NDK used has several
289         toolchain versions for the host architecture you are building for.
290         Possible values are 4.6, 4.8, clang3.3 and clang3.4. Only 4.8 has been
291         tested for real...]), ,)
293 AC_ARG_WITH(android-sdk,
294     AS_HELP_STRING([--with-android-sdk],
295         [Specify location of the Android SDK. Mandatory when building for Android,
296         or when building the Impress Remote Android app.]),
299 ANDROID_NDK_HOME=
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     case "$with_android_ndk_toolchain_version" in
335     4.6|4.7|4.8|4.9)
336         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
337         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
338         ;;
339     clang3.3|clang3.4)
340         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
341         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
342         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
343         ANDROID_USING_CLANG=true
344         ;;
345     *)
346         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
347     esac
349     if test ! -d $ANDROID_BINUTILS_DIR; then
350         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
351     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
352         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
353     fi
355     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
356     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
357     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
358     # manage to link the (app-specific) single huge .so that is built for the apps in
359     # android/experimental/* if there is debug information in a significant part of the object files.
360     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
361     # all objects have been built with debug information.)
362     toolchain_system='*'
363     if test $build_os = linux-gnu; then
364         ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86/bin
365         ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86
366         if test $build_cpu = x86_64; then
367             if test -d $ANDROID_COMPILER_DIR/prebuilt/linux-x86_64; then
368                 ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/linux-x86_64/bin
369             fi
370             if test -d $ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64; then
371                 ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/linux-x86_64
372             fi
373         fi
374         ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
375     fi
377     # This stays empty if there is just one version of the toolchain in the NDK
378     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
379     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
380     */bin\ */bin*)
381         # Trailing slash intentional and necessary, compare to how this is used
382         if test -n "$ANDROID_USING_CLANG"; then
383             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
384         else
385             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
386         fi
387         ;;
388     esac
390     ANDROID_API_LEVEL=15
391     if test $host_cpu = arm; then
392         android_gnu_prefix=arm-linux-androideabi
393     elif test $host_cpu = aarch64; then
394         android_gnu_prefix=aarch64-linux-android
395         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
396         ANDROID_API_LEVEL=L
397     elif test $host_cpu = mips; then
398         android_gnu_prefix=mipsel-linux-android
399     elif test $ANDROID_NDK_VERSION = r8; then
400         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
401         android_gnu_prefix=i686-android-linux
402     else
403         android_gnu_prefix=i686-linux-android
404     fi
406     ANDROID_ARCH=$android_cpu
407     if test $host_cpu = arm; then
408         ANDROID_APP_ABI=armeabi-v7a
409         if test -n "$ANDROID_USING_CLANG"; then
410             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
411             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
412             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
413         else
414             :
415         fi
416         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
417         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
418         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
419     elif test $host_cpu = aarch64; then
420         ANDROID_APP_ABI=arm64-v8a
421         ANDROID_ARCH=arm64
422     elif test $host_cpu = mips; then
423         ANDROID_APP_ABI=mips
424         ANDROIDCFLAGS=""
425     else # x86
426         ANDROID_APP_ABI=x86
427         ANDROIDCFLAGS="-march=atom"
428     fi
429     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
430     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
431     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot $ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
433     if test -n "$ANDROID_USING_CLANG"; then
434         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
435     else
436         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
437     fi
439     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
440     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
441     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
442     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
443     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
444     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
446     # When using the 4.6 or newer toolchain, use the gold linker
447     case "$with_android_ndk_toolchain_version" in
448     4.[[6789]]*|[[56789]].*|clang*)
449         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
450             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
451         fi
452         ;;
453     esac
455     if test "$ENABLE_LTO" = TRUE; then
456         # -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of
457         # $CC and $CXX when building external libraries
458         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
459     fi
461     # gdbserver can be in different locations
462     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
463         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
464     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
465         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
466     elif test $android_cpu = aarch64; then
467         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
468     else
469         AC_MSG_ERROR([Can't find gdbserver for your Android target])
470     fi
472     if test $host_cpu = arm; then
473         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"
474     elif test $host_cpu = mips; then
475         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"
476     else # x86
477         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"
478     fi
480     if test -z "$CC"; then
481         case "$with_android_ndk_toolchain_version" in
482         4.*)
483             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
484             ;;
485         clang*)
486             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
487         esac
488     fi
489     if test -z "$CXX"; then
490         case "$with_android_ndk_toolchain_version" in
491         4.*)
492             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
493             ;;
494         clang*)
495             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
496             ;;
497         esac
498     fi
500 AC_SUBST(ANDROID_NDK_GDBSERVER)
501 AC_SUBST(ANDROID_APP_ABI)
503 dnl ===================================================================
504 dnl Also --with-android-sdk is mandatory
505 dnl ===================================================================
506 ANDROID_SDK_HOME=
507 if test -n "$with_android_sdk"; then
508     ANDROID_SDK_HOME=$with_android_sdk
509     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
511 AC_SUBST(ANDROID_SDK_HOME)
513 dnl ===================================================================
514 dnl The following is a list of supported systems.
515 dnl Sequential to keep the logic very simple
516 dnl These values may be checked and reset later.
517 dnl ===================================================================
518 #defaults unless the os test overrides this:
519 test_randr=yes
520 test_xrender=yes
521 test_cups=yes
522 test_dbus=yes
523 test_fontconfig=yes
524 test_cairo=no
526 # Default values, as such probably valid just for Linux, set
527 # differently below just for Mac OSX,but at least better than
528 # hardcoding these as we used to do. Much of this is duplicated also
529 # in solenv for old build system and for gbuild, ideally we should
530 # perhaps define stuff like this only here in configure.ac?
532 LINKFLAGSSHL="-shared"
533 PICSWITCH="-fpic"
534 DLLPOST=".so"
536 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
538 INSTROOTSUFFIX=
539 SDKDIRNAME=sdk
541 case "$host_os" in
543 solaris*)
544     test_gtk=yes
545     build_gstreamer_1_0=yes
546     build_gstreamer_0_10=yes
547     test_tde=yes
548     test_kde=yes
549     test_freetype=yes
550     _os=SunOS
552     dnl ===========================================================
553     dnl Check whether we're using Solaris 10 - SPARC or Intel.
554     dnl ===========================================================
555     AC_MSG_CHECKING([the Solaris operating system release])
556     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
557     if test "$_os_release" -lt "10"; then
558         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
559     else
560         AC_MSG_RESULT([ok ($_os_release)])
561     fi
563     dnl Check whether we're using a SPARC or i386 processor
564     AC_MSG_CHECKING([the processor type])
565     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
566         AC_MSG_RESULT([ok ($host_cpu)])
567     else
568         AC_MSG_ERROR([only SPARC and i386 processors are supported])
569     fi
570     ;;
572 linux-gnu*|k*bsd*-gnu*)
573     test_gtk=yes
574     build_gstreamer_1_0=yes
575     build_gstreamer_0_10=yes
576     test_tde=yes
577     test_kde=yes
578     test_kde4=yes
579     test_freetype=yes
580     _os=Linux
581     ;;
583 gnu)
584     test_randr=no
585     test_xrender=no
586     _os=GNU
587      ;;
589 cygwin*|interix*|mingw32*)
591     # When building on Windows normally with MSVC under Cygwin,
592     # configure thinks that the host platform (the platform the
593     # built code will run on) is Cygwin, even if it obviously is
594     # Windows, which in Autoconf terminology is called
595     # "mingw32". (Which is misleading as MinGW is the name of the
596     # tool-chain, not an operating system.)
598     # Somewhat confusing, yes. But this configure script doesn't
599     # look at $host etc that much, it mostly uses its own $_os
600     # variable, set here in this case statement.
602     # When cross-compiling to Windows from Unix, the host platform
603     # is "mingw32" (because in that case it is the MinGW
604     # tool-chain that is used).
606     test_cups=no
607     test_dbus=no
608     test_randr=no
609     test_xrender=no
610     test_freetype=no
611     test_fontconfig=no
612     _os=WINNT
614     DLLPOST=".dll"
615     LINKFLAGSNOUNDEFS=
617     # If the host OS matches "mingw32*", that means we are using the
618     # MinGW cross-compiler, because we don't see the point in building
619     # LibreOffice using MinGW on Windows. If you want to build on
620     # Windows, use MSVC. If you want to use MinGW, surely you want to
621     # cross-compile (from Linux or some other Unix).
623     case "$host_os" in
624     mingw32*)
625         WITH_MINGW=yes
626         if test -z "$CC"; then
627             CC="$host_cpu-$host_vendor-$host_os-gcc"
628         fi
629         if test -z "$CXX"; then
630             CXX="$host_cpu-$host_vendor-$host_os-g++"
631         fi
632         ;;
633     esac
634     ;;
636 darwin*) # Mac OS X or iOS
637     test_gtk=yes
638     test_randr=no
639     test_xrender=no
640     test_freetype=no
641     test_fontconfig=no
642     test_dbus=no
643     if test "$host_cpu" = "arm"; then
644         _os=iOS
645         test_gtk=no
646         test_cups=no
647     else
648         _os=Darwin
649         INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
650         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
651     fi
652     enable_systray=no
653     # See comment above the case "$host_os"
654     LINKFLAGSSHL="-dynamiclib -single_module"
656     # -fPIC is default
657     PICSWITCH=""
659     DLLPOST=".dylib"
661     # -undefined error is the default
662     LINKFLAGSNOUNDEFS=""
665 freebsd*)
666     test_gtk=yes
667     build_gstreamer_1_0=yes
668     build_gstreamer_0_10=yes
669     test_tde=yes
670     test_kde=yes
671     test_kde4=yes
672     test_freetype=yes
673     AC_MSG_CHECKING([the FreeBSD operating system release])
674     if test -n "$with_os_version"; then
675         OSVERSION="$with_os_version"
676     else
677         OSVERSION=`/sbin/sysctl -n kern.osreldate`
678     fi
679     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
680     AC_MSG_CHECKING([which thread library to use])
681     if test "$OSVERSION" -lt "500016"; then
682         PTHREAD_CFLAGS="-D_THREAD_SAFE"
683         PTHREAD_LIBS="-pthread"
684     elif test "$OSVERSION" -lt "502102"; then
685         PTHREAD_CFLAGS="-D_THREAD_SAFE"
686         PTHREAD_LIBS="-lc_r"
687     else
688         PTHREAD_CFLAGS=""
689         PTHREAD_LIBS="-pthread"
690     fi
691     AC_MSG_RESULT([$PTHREAD_LIBS])
692     _os=FreeBSD
693     ;;
695 *netbsd*)
696     test_gtk=yes
697     build_gstreamer_1_0=yes
698     build_gstreamer_0_10=yes
699     test_tde=no
700     test_kde=no
701     test_kde4=yes
702     test_freetype=yes
703     PTHREAD_LIBS="-pthread -lpthread"
704     _os=NetBSD
705     ;;
707 aix*)
708     test_randr=no
709     test_freetype=yes
710     PTHREAD_LIBS=-pthread
711     _os=AIX
712     ;;
714 openbsd*)
715     test_gtk=yes
716     test_tde=yes
717     test_kde=yes
718     test_freetype=yes
719     PTHREAD_CFLAGS="-D_THREAD_SAFE"
720     PTHREAD_LIBS="-pthread"
721     _os=OpenBSD
722     ;;
724 dragonfly*)
725     test_gtk=yes
726     build_gstreamer_1_0=yes
727     build_gstreamer_0_10=yes
728     test_tde=yes
729     test_kde=yes
730     test_kde4=yes
731     test_freetype=yes
732     PTHREAD_LIBS="-pthread"
733     _os=DragonFly
734     ;;
736 linux-android*)
737     build_gstreamer_1_0=no
738     build_gstreamer_0_10=no
739     enable_lotuswordpro=no
740     enable_mpl_subset=yes
741     enable_coinmp=yes
742     enable_lpsolve=no
743     enable_report_builder=no
744     with_theme="tango"
745     test_cups=no
746     test_dbus=no
747     test_fontconfig=no
748     test_freetype=no
749     test_gtk=no
750     test_tde=no
751     test_kde=no
752     test_kde4=no
753     test_randr=no
754     test_xrender=no
755     _os=Android
757     if test -z "$with_android_ndk"; then
758         AC_MSG_ERROR([the --with-android-ndk option is mandatory])
759     fi
761     if test -z "$with_android_ndk_toolchain_version"; then
762         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
763     fi
765     # Verify that the NDK and SDK options are proper
766     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
767         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
768     fi
770     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
771     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
772     ;;
775     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
776     ;;
777 esac
779 if echo "$host_os" | grep -q linux-android ; then
780     if test -z "$with_android_sdk"; then
781         AC_MSG_ERROR([the --with-android-sdk option is mandatory])
782     fi
784     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
785         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
786     fi
789 if test "$_os" = "AIX"; then
790     AC_PATH_PROG(GAWK, gawk)
791     if test -z "$GAWK"; then
792         AC_MSG_ERROR([gawk not found in \$PATH])
793     fi
796 AC_SUBST(SDKDIRNAME)
798 AC_SUBST(WITH_MINGW)
799 AC_SUBST(PTHREAD_CFLAGS)
800 AC_SUBST(PTHREAD_LIBS)
802 ###############################################################################
803 # Extensions switches --enable/--disable
804 ###############################################################################
805 # By default these should be enabled unless having extra dependencies.
806 # If there is extra dependency over configure options then the enable should
807 # be automagic based on whether the requiring feature is enabled or not.
808 # All this options change anything only with --enable-extension-integration.
810 # The name of this option and its help string makes it sound as if
811 # extensions are built anyway, just not integrated in the installer,
812 # if you use --disable-extension-integration. Is that really the
813 # case?
815 AC_ARG_ENABLE(extension-integration,
816     AS_HELP_STRING([--disable-extension-integration],
817         [Disable integration of the built extensions in the installer of the
818          product. Use this switch to disable the integration.])
821 AC_ARG_ENABLE(export,
822     AS_HELP_STRING([--disable-export],
823         [Disable (some) code for document export. Useful when building viewer-only apps that lack
824          save/export functionality, to avoid having an excessive amount of code and data used
825          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
828 AC_ARG_ENABLE(avmedia,
829     AS_HELP_STRING([--disable-avmedia],
830         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
833 AC_ARG_ENABLE(database-connectivity,
834     AS_HELP_STRING([--disable-database-connectivity],
835         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
838 # This doesn't mean not building (or "integrating") extensions
839 # (although it probably should; i.e. it should imply
840 # --disable-extension-integration I guess), it means not supporting
841 # any extension mechanism at all
842 AC_ARG_ENABLE(extensions,
843     AS_HELP_STRING([--disable-extensions],
844         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
847 AC_ARG_ENABLE(scripting,
848     AS_HELP_STRING([--disable-scripting],
849         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
852 # This is mainly for Android and iOS, but could potentially be used in some
853 # special case otherwise, too, so factored out as a separate setting
855 AC_ARG_ENABLE(dynamic-loading,
856     AS_HELP_STRING([--disable-dynamic-loading],
857         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
860 AC_ARG_ENABLE(ext-mariadb-connector,
861     AS_HELP_STRING([--enable-ext-mariadb-connector],
862         [Enable the build of the MariaDB/MySQL Connector extension.])
865 AC_ARG_ENABLE(report-builder,
866     AS_HELP_STRING([--disable-report-builder],
867         [Disable the Report Builder.])
870 AC_ARG_ENABLE(ext-wiki-publisher,
871     AS_HELP_STRING([--enable-ext-wiki-publisher],
872         [Enable the Wiki Publisher extension.])
875 AC_ARG_ENABLE(lpsolve,
876     AS_HELP_STRING([--disable-lpsolve],
877         [Disable compilation of the lp solve solver ])
879 AC_ARG_ENABLE(coinmp,
880     AS_HELP_STRING([--disable-coinmp],
881         [Disable compilation of the CoinMP solver ])
884 AC_ARG_ENABLE(pdfimport,
885     AS_HELP_STRING([--disable-pdfimport],
886         [Disable building the PDF import feature.])
889 ###############################################################################
891 dnl ---------- *** ----------
893 AC_ARG_ENABLE([hardlink-deliver],
894     AS_HELP_STRING([--enable-hardlink-deliver],
895         [Put files into deliver folder as hardlinks instead of copying them
896         over. Saves space and speeds up build.])
899 AC_ARG_ENABLE(mergelibs,
900     AS_HELP_STRING([--enable-mergelibs=<all/yes>],
901         [Enables linking of big, merged, library. Experimental feature, tested
902         only for Linux at some stage in history, but possibly does not work even
903         for Linux any more. 'all' will link a lot of libraries into libmerged
904         while 'yes' will do it for just a core set of libraries.])
907 AC_ARG_ENABLE(graphite,
908     AS_HELP_STRING([--enable-graphite],
909         [Enables the compilation of Graphite smart font rendering.])
912 AC_ARG_ENABLE(orcus,
913     AS_HELP_STRING([--enable-orcus],
914         [Enables orcus for extra file import filters for Calc.])
917 AC_ARG_ENABLE(fetch-external,
918     AS_HELP_STRING([--disable-fetch-external],
919         [Disables fetching external tarballs from web sources.])
922 AC_ARG_ENABLE(lockdown,
923     AS_HELP_STRING([--disable-lockdown],
924         [Disables the gconf integration work in LibreOffice.]),
927 AC_ARG_ENABLE(pch,
928     AS_HELP_STRING([--enable-pch],
929         [Enables precompiled header support for C++.])
932 AC_ARG_ENABLE(win-mozab-driver,
933     AS_HELP_STRING([--enable-win-mozab-driver],
934         [LibreOffice includes a driver to connect to Mozilla
935          address books under Windows, to build with this version, use this option.])
938 AC_ARG_ENABLE(epm,
939     AS_HELP_STRING([--enable-epm],
940         [LibreOffice includes self-packaging code, that requires epm, however epm is
941          useless for large scale package building.])
944 AC_ARG_ENABLE(odk,
945     AS_HELP_STRING([--disable-odk],
946         [LibreOffice includes an ODK, office development kit which some packagers may
947          wish to build without.])
950 AC_ARG_ENABLE(mpl-subset,
951     AS_HELP_STRING([--enable-mpl-subset],
952         [Don't compile any pieces which are not MPL or more liberally licensed])
955 AC_ARG_ENABLE(evolution2,
956     AS_HELP_STRING([--enable-evolution2],
957         [Allows the built-in evolution 2 addressbook connectivity build to be
958          enabled.])
961 AC_ARG_ENABLE(directx,
962     AS_HELP_STRING([--disable-directx],
963         [Remove DirectX implementation for the new XCanvas interface.
964          The DirectX support requires more stuff installed on Windows to
965          compile. (DirectX SDK, GDI+ libs)])
968 AC_ARG_ENABLE(activex,
969     AS_HELP_STRING([--disable-activex],
970         [Disable the use of ActiveX for a Windows build.
971         This switch is mandatory when using an Express edition of Visual Studio.])
974 AC_ARG_ENABLE(atl,
975     AS_HELP_STRING([--disable-atl],
976         [Disable the use of ATL for a Windows build.])
977     [
978         This switch is mandatory when using an Express edition of Visual Studio.
979     ],
982 AC_ARG_ENABLE(avahi,
983     AS_HELP_STRING([--enable-avahi],
984         [Determines whether to use Avahi to advertise Impress to remote controls.]),
987 AC_ARG_ENABLE(werror,
988     AS_HELP_STRING([--enable-werror],
989         [Turn warnings to errors. (Has no effect in modules where the treating
990          of warnings as errors is disabled explicitly.)]),
993 AC_ARG_ENABLE(assert-always-abort,
994     AS_HELP_STRING([--enable-assert-always-abort],
995         [make assert() abort even in release code.]),
998 AC_ARG_ENABLE(dbgutil,
999     AS_HELP_STRING([--enable-dbgutil],
1000         [Provide debugging support from --enable-debug and include additional debugging
1001          utilities such as object counting or more expensive checks.
1002          This is the recommended option for developers.
1003          Note that this makes the build ABI incompatible, it is not possible to mix object
1004          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1006 AC_ARG_ENABLE(debug,
1007     AS_HELP_STRING([--enable-debug],
1008         [Include debugging information, disable compiler optimization and inlining plus
1009          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1011 AC_ARG_ENABLE(sal-log,
1012     AS_HELP_STRING([--enable-sal-log],
1013         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1015 AC_ARG_ENABLE(selective-debuginfo,
1016     AS_HELP_STRING([--enable-selective-debuginfo],
1017         [If --enable-debug or --enable-dbgutil is used, build debugging information
1018          (-g compiler flag) only for the specified gbuild build targets
1019          (where all means everything, - prepended means not to enable, / appended means
1020          everything in the directory; there is no ordering, more specific overrides
1021          more general, and disabling takes precedence).
1022          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1024 AC_ARG_ENABLE(symbols,
1025     AS_HELP_STRING([--enable-symbols],
1026         [Include debugging symbols in output while preserve optimization.
1027          This enables -g compiler flag for GCC or equivalent,
1028          without changing anything else compared to productive code.]))
1030 AC_ARG_ENABLE(runtime-optimizations,
1031     AS_HELP_STRING([--disable-runtime-optimizations],
1032         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1033          JVM JIT) that are known to interact badly with certain dynamic analysis
1034          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1035          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1036          are typcially disabled dynamically via RUNNING_ON_VALGRIND.)]))
1038 AC_ARG_ENABLE(compiler-plugins,
1039     AS_HELP_STRING([--enable-compiler-plugins],
1040         [Enable compiler plugins that will perform additional checks during
1041          building. Enabled automatically by --enable-dbgutil.]))
1043 AC_ARG_ENABLE(ooenv,
1044     AS_HELP_STRING([--disable-ooenv],
1045         [Disable ooenv for the instdir installation.]))
1047 AC_ARG_ENABLE(lto,
1048     AS_HELP_STRING([--enable-lto],
1049         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1050          longer but libraries and executables are optimized for speed. (For GCC, best to use GCC 4.6
1051          or later and 'gold' linker. Works fine (and is turned on automatically in an optimising
1052          build) for MSVC, otherwise experimental work in progress that shouldn't be used unless you
1053          are working on it.)]))
1055 AC_ARG_ENABLE(crashdump,
1056     AS_HELP_STRING([--enable-crashdump],
1057         [Enable the crashdump feature.]))
1059 AC_ARG_ENABLE(python,
1060     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1061         [Enables or disables Python support at run-time and build-time.
1062          Also specifies what Python to use. 'auto' is the default.
1063          'fully-internal' even forces the internal version for uses of Python
1064          during the build.]))
1066 AC_ARG_ENABLE(gtk,
1067     AS_HELP_STRING([--disable-gtk],
1068         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1069 ,enable_gtk=yes)
1071 AC_ARG_ENABLE(gtk3,
1072     AS_HELP_STRING([--enable-gtk3],
1073         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1074          This is experimental and may not work.]),
1075 ,enable_gtk3=no)
1077 AC_ARG_ENABLE(systray,
1078     AS_HELP_STRING([--disable-systray],
1079         [Determines whether to build the systray quickstarter.]),
1080 ,enable_systray=yes)
1082 AC_ARG_ENABLE(split-app-modules,
1083     AS_HELP_STRING([--enable-split-app-modules],
1084         [Split file lists for app modules, e.g. base, calc.
1085          Has effect only with make distro-pack-install]),
1088 AC_ARG_ENABLE(split-opt-features,
1089     AS_HELP_STRING([--enable-split-opt-features],
1090         [Split file lists for some optional features, .e.g. pyuno, testtool.
1091          Has effect only with make distro-pack-install]),
1094 AC_ARG_ENABLE(cairo-canvas,
1095 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
1096                           platforms where Cairo is available.
1099 AC_ARG_ENABLE(dbus,
1100     AS_HELP_STRING([--disable-dbus],
1101         [Determines whether to enable features that depend on dbus.
1102          e.g. Presentation mode screensaver control, bluetooth presentation control]),
1103 ,enable_dbus=yes)
1105 AC_ARG_ENABLE(packagekit,
1106     AS_HELP_STRING([--enable-packagekit],
1107         [Determines whether to enable features using packagekit.
1108          Right now that is auto font install]),
1111 AC_ARG_ENABLE(sdremote,
1112     AS_HELP_STRING([--disable-sdremote],
1113         [Determines whether to enable Impress remote control (i.e. the server component).]),
1114 ,enable_sdremote=yes)
1116 AC_ARG_ENABLE(sdremote-bluetooth,
1117     AS_HELP_STRING([--disable-sdremote-bluetooth],
1118         [Determines whether to build sdremote with bluetooth support.
1119          Requires dbus on Linux.]))
1121 AC_ARG_ENABLE(gconf,
1122     AS_HELP_STRING([--disable-gconf],
1123         [Determines whether to use the GConf support.]),
1124 ,enable_gconf=yes)
1126 AC_ARG_ENABLE(gnome-vfs,
1127     AS_HELP_STRING([--enable-gnome-vfs],
1128         [Determines whether to use the Gnome Virtual Filing System on platforms
1129          where that VFS is available.]),
1130 ,enable_gnome_vfs=no)
1132 AC_ARG_ENABLE(gio,
1133     AS_HELP_STRING([--disable-gio],
1134         [Determines whether to use the GIO support.]),
1135 ,enable_gio=yes)
1137 AC_ARG_ENABLE(telepathy,
1138     AS_HELP_STRING([--enable-telepathy],
1139         [Determines whether to enable Telepathy for collaboration.]),
1140 ,enable_telepathy=no)
1142 AC_ARG_ENABLE(tde,
1143     AS_HELP_STRING([--enable-tde],
1144         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1145          TDE are available.]),
1148 AC_ARG_ENABLE(tdeab,
1149     AS_HELP_STRING([--disable-tdeab],
1150         [Disable the TDE address book support.]),
1152     if test "$enable_tde" = "yes"; then
1153         enable_tdeab=yes
1154     fi
1157 AC_ARG_ENABLE(kde,
1158     AS_HELP_STRING([--enable-kde],
1159         [Determines whether to use Qt3/KDE3 vclplug on platforms where Qt3 and
1160          KDE3 are available.]),
1163 AC_ARG_ENABLE(kdeab,
1164     AS_HELP_STRING([--disable-kdeab],
1165         [Disable the KDE3 address book support.]),
1167     if test "$enable_kde" = "yes"; then
1168         enable_kdeab=yes
1169     fi
1172 AC_ARG_ENABLE(kde4,
1173     AS_HELP_STRING([--enable-kde4],
1174         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1175          KDE4 are available. May be used with --enable-kde if you want to support
1176          both KDE3 and KDE4.]),
1179 AC_ARG_ENABLE(randr,
1180     AS_HELP_STRING([--disable-randr],
1181         [Disable RandR support in the vcl project.]),
1182 ,enable_randr=yes)
1184 AC_ARG_ENABLE(randr-link,
1185     AS_HELP_STRING([--disable-randr-link],
1186         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1187 ,enable_randr_link=yes)
1189 AC_ARG_ENABLE(gstreamer-1-0,
1190     AS_HELP_STRING([--disable-gstreamer-1-0],
1191         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1192 ,enable_gstreamer_1_0=yes)
1194 AC_ARG_ENABLE(gstreamer-0-10,
1195     AS_HELP_STRING([--enable-gstreamer-0-10],
1196         [Enable building with the gstreamer 0.10 avmedia backend.]),
1197 ,enable_gstreamer_0_10=no)
1199 AC_ARG_ENABLE(vlc,
1200     AS_HELP_STRING([--enable-vlc],
1201         [Enable building with the VLC avmedia backend.]),
1202 ,enable_vlc=no)
1204 AC_ARG_ENABLE(neon,
1205     AS_HELP_STRING([--disable-neon],
1206         [Disable neon and the compilation of webdav binding.]),
1209 AC_ARG_ENABLE([eot],
1210     [AS_HELP_STRING([--enable-eot],
1211         [Enable support for Embedded OpenType fonts.])],
1212 , [enable_eot=no])
1214 AC_ARG_ENABLE(cve-tests,
1215     AS_HELP_STRING([--disable-cve-tests],
1216         [Prevent CVE tests to be executed]),
1219 AC_ARG_ENABLE(chart-tests,
1220     AS_HELP_STRING([--enable-chart-tests],
1221         [Executes chart XShape tests. In a perfect world these tests would be
1222          stable and everyone could run them, in reality it is best to run them
1223          only on a few machines that are known to work and maintained by people
1224          who can judge if a test failure is a regression or not.]),
1227 AC_ARG_ENABLE(build-unowinreg,
1228     AS_HELP_STRING([--enable-build-unowinreg],
1229         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1230          compiler is needed on Linux.])
1231     [
1232                           Usage:     --enable-build-unowinreg
1233     ],
1236 AC_ARG_ENABLE(verbose,
1237     AS_HELP_STRING([--enable-verbose],
1238         [Increase build verbosity.])[
1239   --disable-verbose       Decrease build verbosity.],
1242 AC_ARG_ENABLE(dependency-tracking,
1243     AS_HELP_STRING([--enable-dependency-tracking],
1244         [Do not reject slow dependency extractors.])[
1245   --disable-dependency-tracking
1246                           Disables generation of dependency information.
1247                           Speed up one-time builds.],
1250 AC_ARG_ENABLE(icecream,
1251     AS_HELP_STRING([--enable-icecream],
1252         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1253          It defaults to /opt/icecream for the location of the icecream gcc/g++
1254          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1257 AC_ARG_ENABLE(cups,
1258     AS_HELP_STRING([--disable-cups],
1259         [Do not build cups support.])
1262 AC_ARG_ENABLE(ccache,
1263     AS_HELP_STRING([--disable-ccache],
1264         [Do not try to use ccache automatically.
1265          By default, we will try to detect if ccache is available; in that case if
1266          CC/CXX are not yet set, and --enable-icecream is not given, we
1267          attempt to use ccache. --disable-ccache disables ccache completely.
1271 AC_ARG_ENABLE(64-bit,
1272     AS_HELP_STRING([--enable-64-bit],
1273         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1274          At the moment meaningful only for iOS and Windows. On Windows this option is
1275          experimental and possibly quite broken, and you should use it only if you are
1276          hacking on 64-bitness support.]), ,)
1278 AC_ARG_ENABLE(extra-gallery,
1279     AS_HELP_STRING([--enable-extra-gallery],
1280         [Add extra gallery content.]),
1283 AC_ARG_ENABLE(extra-template,
1284     AS_HELP_STRING([--enable-extra-template],
1285         [Add extra template content.]),
1288 AC_ARG_ENABLE(extra-sample,
1289     AS_HELP_STRING([--enable-extra-sample],
1290         [Add extra sample content.]),
1293 AC_ARG_ENABLE(extra-font,
1294     AS_HELP_STRING([--enable-extra-font],
1295         [Add extra font content.]),
1298 AC_ARG_ENABLE(online-update,
1299     AS_HELP_STRING([--enable-online-update],
1300         [Enable the online update service that will check for new versions of
1301          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.]),
1304 AC_ARG_ENABLE(release-build,
1305     AS_HELP_STRING([--enable-release-build],
1306         [Enable release build.
1307          See http://wiki.documentfoundation.org/DevBuild]),
1310 AC_ARG_ENABLE(windows-build-signing,
1311     AS_HELP_STRING([--enable-windows-build-signing],
1312         [Enable signing of windows binaries (*.exe, *.dll)]),
1315 AC_ARG_ENABLE(silent-msi,
1316     AS_HELP_STRING([--enable-silent-msi],
1317         [Enable MSI with LIMITUI=1 (silent install).]),
1320 AC_ARG_ENABLE(macosx-retina,
1321     AS_HELP_STRING([--enable-macosx-retina],
1322         [deprecated... enabled by default now. Kept for backward compat only.
1323          ]),
1326 AC_ARG_ENABLE(macosx-code-signing,
1327     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1328         [Sign executables, dylibs, frameworks and the app bundle. If you
1329          don't provide an identity the first suitable certificate
1330          in your keychain is used.]),
1333 AC_ARG_ENABLE(macosx-package-signing,
1334     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1335         [Create a .pkg suitable for uploading to the Mac App Store and sign
1336          it. If you don't provide an identity the first suitable certificate
1337          in your keychain is used.]),
1340 AC_ARG_ENABLE(macosx-sandbox,
1341     AS_HELP_STRING([--enable-macosx-sandbox],
1342         [Make the app bundle run in a sandbox. Requires code signing.
1343          Is required by apps distributed in the Mac App Store, and implies
1344          adherence to App Store rules.]),
1347 AC_ARG_WITH(macosx-bundle-identifier,
1348     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1349         [Define the OS X bundle identifier. Default is the somewhat weird
1350          org.libreoffice.script ("script", huh?).]),
1351 ,with_macosx_bundle_identifier=org.libreoffice.script)
1353 AC_ARG_WITH(macosx-app-name,
1354     AS_HELP_STRING([--with-macosx-app-name='My Own Office Suite'],
1355         [Define the OS X app name. Default is AC_PACKAGE_NAME.]),
1356 ,with_macosx_app_name=$PRODUCTNAME)
1358 AC_ARG_ENABLE(ios-simulator,
1359     AS_HELP_STRING([--enable-ios-simulator],
1360         [Build for the iOS Simulator, not iOS device.]),
1363 AC_ARG_ENABLE(readonly-installset,
1364     AS_HELP_STRING([--enable-readonly-installset],
1365         [Prevents any attempts by LibreOffice to write into its installation. That means
1366          at least that no "system-wide" extensions can be added. Experimental work in
1367          progress.]),
1370 AC_ARG_ENABLE(postgresql-sdbc,
1371     AS_HELP_STRING([--disable-postgresql-sdbc],
1372         [Disable the build of the PostgreSQL-SDBC driver.])
1375 AC_ARG_ENABLE(lotuswordpro,
1376     AS_HELP_STRING([--disable-lotuswordpro],
1377         [Disable the build of the Lotus Word Pro filter.]),
1378 ,enable_lotuswordpro=yes)
1380 AC_ARG_ENABLE(firebird-sdbc,
1381     AS_HELP_STRING([--disable-firebird-sdbc],
1382         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1383 ,enable_firebird_sdbc=yes)
1385 AC_ARG_ENABLE(winegcc,
1386     AS_HELP_STRING([--enable-winegcc],
1387         [Enable use of winegcc during the build, in order to create msi* tools
1388          needed for MinGW cross-compilation.]),
1391 AC_ARG_ENABLE(liblangtag,
1392     AS_HELP_STRING([--disable-liblangtag],
1393         [Disable use of liblangtag, and instead use an own simple
1394          implementation.]),
1397 AC_ARG_ENABLE(bogus-pkg-config,
1398     AS_HELP_STRING([--enable-bogus-pkg-config],
1399         [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.]),
1402 AC_ARG_ENABLE(openssl,
1403     AS_HELP_STRING([--disable-openssl],
1404         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1405          components will either use GNUTLS or NSS. Work in progress,
1406          use only if you are hacking on it.]),
1407 ,enable_openssl=yes)
1409 AC_ARG_ENABLE(library-bin-tar,
1410     AS_HELP_STRING([--enable-library-bin-tar],
1411         [Enable the building and reused of tarball of binary build for some 'external' libraries
1412         Some libraries can save their build result in a tarball
1413         stored in TARFILE_LOCATION. that binary tarball is
1414         uniquely identified by the source tarbal,
1415         the content of the config_host.mk file and the content
1416         of the top-level directory in core for that library
1417         If this option is enabled, then if such a tarfile exist, it will be untarred
1418         instead of the source tarfile, and the build step will be skipped for that
1419         library.
1420         If a proper tarfile does not exist, then the normal source-based
1421         build is done for that library and a proper binary tarfile is created
1422         for the next time.]),
1425 AC_ARG_ENABLE(gltf,
1426     AS_HELP_STRING([--disable-gltf],
1427         [Determines whether to build libraries related to glTF 3D model rendering.]))
1429 AC_ARG_ENABLE(collada,
1430     AS_HELP_STRING([--disable-collada],
1431         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1433 dnl ===================================================================
1434 dnl Optional Packages (--with/without-)
1435 dnl ===================================================================
1437 AC_ARG_WITH(gnu-patch,
1438     AS_HELP_STRING([--with-gnu-patch],
1439         [Specify location of GNU patch on Solaris or FreeBSD.]),
1442 AC_ARG_WITH(build-platform-configure-options,
1443     AS_HELP_STRING([--with-build-platform-configure-options],
1444         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1447 AC_ARG_WITH(gnu-cp,
1448     AS_HELP_STRING([--with-gnu-cp],
1449         [Specify location of GNU cp on Solaris or FreeBSD.]),
1452 AC_ARG_WITH(external-tar,
1453     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1454         [Specify an absolute path of where to find (and store) tarfiles.]),
1455     TARFILE_LOCATION=$withval ,
1458 AC_ARG_WITH(referenced-git,
1459     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1460         [Specify another checkout directory to reference. This makes use of
1461                  git submodule update --reference, and saves a lot of diskspace
1462                  when having multiple trees side-by-side.]),
1463     GIT_REFERENCE_SRC=$withval ,
1466 AC_ARG_WITH(linked-git,
1467     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1468         [Specify a directory where the repositories of submodules are located.
1469          This uses a method similar to git-new-workdir to get submodules.]),
1470     GIT_LINK_SRC=$withval ,
1473 AC_ARG_WITH(galleries,
1474     AS_HELP_STRING([--with-galleries],
1475         [Specify how galleries should be built. It is possible either to
1476          build these internally from source ("build"),
1477          or to disable them ("no")]),
1480 AC_ARG_WITH(theme,
1481     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1482         [Choose which themes to include. By default those themes with an '*' are included.
1483          Possible choices: *crystal, *galaxy, *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1486 AC_ARG_WITH(helppack-integration,
1488   --without-helppack-integration      It will not integrate the helppacks to the installer
1489                           of the product.
1490                           Please use this switch to use the online help or separate help packages.],
1493 AC_ARG_WITH(fonts,
1494     AS_HELP_STRING([--without-fonts],
1495         [LibreOffice includes some third-party fonts to provide a reliable basis for
1496          help content, templates, samples, etc. When these fonts are already
1497          known to be available on the system then you should use this option.]),
1500 AC_ARG_WITH(epm,
1501     AS_HELP_STRING([--with-epm],
1502         [Decides which epm to use. Default is to use the one from the system if
1503          one is built. When either this is not there or you say =internal epm
1504          will be built.]),
1507 AC_ARG_WITH(package-format,
1508     AS_HELP_STRING([--with-package-format],
1509         [Specify package format(s) for LibreOffice installation sets. The
1510          implicit --without-package-format leads to no installation sets being
1511          generated. Possible values: aix, archive, bsd, deb, dmg,
1512          installed, msi, pkg, and rpm.
1513          Example: --with-package-format='deb rpm']),
1516 AC_ARG_WITH(tls,
1517     AS_HELP_STRING([--with-tls],
1518         [Decides which TLS/SSL and cryptographic implementations to use for
1519          LibreOffice's code. Notice that this doesn't apply for depending
1520          libraries like "neon", for example. Default is to use OpenSSL
1521          although NSS is also possible. Notice that selecting NSS restricts
1522          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1523          restrict by now the usage of NSS in LO's code. Possible values:
1524          openssl, nss. Example: --with-tls="nss"]),
1527 AC_ARG_WITH(system-libs,
1528     AS_HELP_STRING([--with-system-libs],
1529         [Use libraries already on system -- enables all --with-system-* flags.]),
1532 AC_ARG_WITH(system-headers,
1533     AS_HELP_STRING([--with-system-headers],
1534         [Use headers already on system -- enables all --with-system-* flags for
1535          external packages whose headers are the only entities used i.e.
1536          boost/vigra/odbc/sane-header(s).]),,
1537     [with_system_headers="$with_system_libs"])
1539 AC_ARG_WITH(system-jars,
1540     AS_HELP_STRING([--without-system-jars],
1541         [When building with --with-system-libs, also the needed jars are expected
1542          on the system. Use this to disable that]),,
1543     [with_system_jars="$with_system_libs"])
1545 AC_ARG_WITH(system-cairo,
1546     AS_HELP_STRING([--with-system-cairo],
1547         [Use cairo libraries already on system.  Happens automatically for
1548          (implicit) --enable-gtk and for --enable-gtk3.]))
1550 AC_ARG_WITH(myspell-dicts,
1551     AS_HELP_STRING([--with-myspell-dicts],
1552         [Adds myspell dictionaries to the LibreOffice installation set]),
1555 AC_ARG_WITH(system-dicts,
1556     AS_HELP_STRING([--without-system-dicts],
1557         [Do not use dictionaries from system paths.]),
1560 AC_ARG_WITH(external-dict-dir,
1561     AS_HELP_STRING([--with-external-dict-dir],
1562         [Specify external dictionary dir.]),
1565 AC_ARG_WITH(external-hyph-dir,
1566     AS_HELP_STRING([--with-external-hyph-dir],
1567         [Specify external hyphenation pattern dir.]),
1570 AC_ARG_WITH(external-thes-dir,
1571     AS_HELP_STRING([--with-external-thes-dir],
1572         [Specify external thesaurus dir.]),
1575 AC_ARG_WITH(system-zlib,
1576     AS_HELP_STRING([--with-system-zlib],
1577         [Use zlib already on system.]),,
1578     [with_system_zlib=auto])
1580 AC_ARG_WITH(system-jpeg,
1581     AS_HELP_STRING([--with-system-jpeg],
1582         [Use jpeg already on system.]),,
1583     [with_system_jpeg="$with_system_libs"])
1585 AC_ARG_WITH(system-libgltf,
1586     AS_HELP_STRING([--with-system-libgltf],
1587         [Use libgltf already on system.]),,
1588     [with_system_libgltf="$with_system_libs"])
1590 AC_ARG_WITH(system-clucene,
1591     AS_HELP_STRING([--with-system-clucene],
1592         [Use clucene already on system.]),,
1593     [with_system_clucene="$with_system_libs"])
1595 AC_ARG_WITH(system-expat,
1596     AS_HELP_STRING([--with-system-expat],
1597         [Use expat already on system.]),,
1598     [with_system_expat="$with_system_libs"])
1600 AC_ARG_WITH(system-libxml,
1601     AS_HELP_STRING([--with-system-libxml],
1602         [Use libxml/libxslt already on system.]),,
1603     [with_system_libxml=auto])
1605 AC_ARG_WITH(system-icu,
1606     AS_HELP_STRING([--with-system-icu],
1607         [Use icu already on system.]),,
1608     [with_system_icu="$with_system_libs"])
1610 AC_ARG_WITH(system-ucpp,
1611     AS_HELP_STRING([--with-system-ucpp],
1612         [Use ucpp already on system.]),,
1613     [])
1615 AC_ARG_WITH(system-opencollada,
1616     AS_HELP_STRING([--with-system-opencollada],
1617         [Use openCOLLADA already on system.]),,
1618     [with_system_opencollada=no])
1620 AC_ARG_WITH(system-openldap,
1621     AS_HELP_STRING([--with-system-openldap],
1622         [Use the OpenLDAP LDAP SDK already on system.]),,
1623     [with_system_openldap="$with_system_libs"])
1625 AC_ARG_WITH(system-poppler,
1626     AS_HELP_STRING([--with-system-poppler],
1627         [Use system poppler (only needed for PDF import).]),,
1628     [with_system_poppler="$with_system_libs"])
1630 AC_ARG_WITH(system-apache-commons,
1631     AS_HELP_STRING([--with-system-apache-commons],
1632         [Use Apache commons libraries already on system.]),,
1633     [with_system_apache_commons="$with_system_jars"])
1635 AC_ARG_WITH(system-mariadb,
1636     AS_HELP_STRING([--with-system-mariadb],
1637         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1638          extension.]),,
1639     [with_system_mariadb="$with_system_libs"])
1641 AC_ARG_ENABLE(bundle-mariadb,
1642     AS_HELP_STRING([--enable-bundle-mariadb],
1643         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1646 AC_ARG_WITH(system-mysql-cppconn,
1647     AS_HELP_STRING([--with-system-mysql-cppconn],
1648         [Use MySQL C++ Connector libraries already on system.]),,
1649     [with_system_mysql_cppconn="$with_system_libs"])
1651 AC_ARG_WITH(system-postgresql,
1652     AS_HELP_STRING([--with-system-postgresql],
1653         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1654          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1655     [with_system_postgresql="$with_system_libs"])
1657 AC_ARG_WITH(libpq-path,
1658     AS_HELP_STRING([--with-libpq-path],
1659         [Use this PostgreSQL C interface (libpq) installation for building
1660          the PostgreSQL-SDBC extension.])
1661     [
1662                           Usage:     --with-libpq-path=<absolute path to
1663                                                   your libpq installation>
1664     ],
1667 AC_ARG_WITH(system-firebird,
1668     AS_HELP_STRING([--with-system-firebird],
1669         [Use Firebird libraries already on system, for building the Firebird-SDBC
1670          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1671     [with_system_firebird="$with_system_libs"])
1673 AC_ARG_WITH(system-hsqldb,
1674     AS_HELP_STRING([--with-system-hsqldb],
1675         [Use hsqldb already on system.]))
1677 AC_ARG_WITH(hsqldb-jar,
1678     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1679         [Specify path to jarfile manually.]),
1680     HSQLDB_JAR=$withval)
1682 AC_ARG_ENABLE(scripting-beanshell,
1683     AS_HELP_STRING([--disable-scripting-beanshell],
1684         [Disable support for scripts in BeanShell.]),
1688 AC_ARG_WITH(system-beanshell,
1689     AS_HELP_STRING([--with-system-beanshell],
1690         [Use beanshell already on system.]),,
1691     [with_system_beanshell="$with_system_jars"])
1693 AC_ARG_WITH(beanshell-jar,
1694     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1695         [Specify path to jarfile manually.]),
1696     BSH_JAR=$withval)
1698 AC_ARG_ENABLE(scripting-javascript,
1699     AS_HELP_STRING([--disable-scripting-javascript],
1700         [Disable support for scripts in JavaScript.]),
1704 AC_ARG_WITH(system-rhino,
1705     AS_HELP_STRING([--with-system-rhino],
1706         [Use rhino already on system.]),,)
1707 #    [with_system_rhino="$with_system_jars"])
1708 # Above is not used as we have different debug interface
1709 # patched into internal rhino. This code needs to be fixed
1710 # before we can enable it by default.
1712 AC_ARG_WITH(rhino-jar,
1713     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1714         [Specify path to jarfile manually.]),
1715     RHINO_JAR=$withval)
1717 AC_ARG_WITH(commons-codec-jar,
1718     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1719         [Specify path to jarfile manually.]),
1720     COMMONS_CODEC_JAR=$withval)
1722 AC_ARG_WITH(commons-lang-jar,
1723     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1724         [Specify path to jarfile manually.]),
1725     COMMONS_LANG_JAR=$withval)
1727 AC_ARG_WITH(commons-httpclient-jar,
1728     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1729         [Specify path to jarfile manually.]),
1730     COMMONS_HTTPCLIENT_JAR=$withval)
1732 AC_ARG_WITH(commons-logging-jar,
1733     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1734         [Specify path to jarfile manually.]),
1735     COMMONS_LOGGING_JAR=$withval)
1737 AC_ARG_WITH(system-jfreereport,
1738     AS_HELP_STRING([--with-system-jfreereport],
1739         [Use JFreeReport already on system.]),,
1740     [with_system_jfreereport="$with_system_jars"])
1742 AC_ARG_WITH(sac-jar,
1743     AS_HELP_STRING([--with-sac-jar=JARFILE],
1744         [Specify path to jarfile manually.]),
1745     SAC_JAR=$withval)
1747 AC_ARG_WITH(libxml-jar,
1748     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1749         [Specify path to jarfile manually.]),
1750     LIBXML_JAR=$withval)
1752 AC_ARG_WITH(flute-jar,
1753     AS_HELP_STRING([--with-flute-jar=JARFILE],
1754         [Specify path to jarfile manually.]),
1755     FLUTE_JAR=$withval)
1757 AC_ARG_WITH(jfreereport-jar,
1758     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1759         [Specify path to jarfile manually.]),
1760     JFREEREPORT_JAR=$withval)
1762 AC_ARG_WITH(liblayout-jar,
1763     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1764         [Specify path to jarfile manually.]),
1765     LIBLAYOUT_JAR=$withval)
1767 AC_ARG_WITH(libloader-jar,
1768     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1769         [Specify path to jarfile manually.]),
1770     LIBLOADER_JAR=$withval)
1772 AC_ARG_WITH(libloader-jar,
1773     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1774         [Specify path to jarfile manually.]),
1775     LIBLOADER_JAR=$withval)
1777 AC_ARG_WITH(libformula-jar,
1778     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1779         [Specify path to jarfile manually.]),
1780     LIBFORMULA_JAR=$withval)
1782 AC_ARG_WITH(librepository-jar,
1783     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1784         [Specify path to jarfile manually.]),
1785     LIBREPOSITORY_JAR=$withval)
1787 AC_ARG_WITH(libfonts-jar,
1788     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1789         [Specify path to jarfile manually.]),
1790     LIBFONTS_JAR=$withval)
1792 AC_ARG_WITH(libserializer-jar,
1793     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1794         [Specify path to jarfile manually.]),
1795     LIBSERIALIZER_JAR=$withval)
1797 AC_ARG_WITH(libbase-jar,
1798     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1799         [Specify path to jarfile manually.]),
1800     LIBBASE_JAR=$withval)
1802 AC_ARG_WITH(system-odbc,
1803     AS_HELP_STRING([--with-system-odbc],
1804         [Use the odbc headers already on system.]),,
1805     [with_system_odbc="auto"])
1807 AC_ARG_WITH(system-sane,
1808     AS_HELP_STRING([--with-system-sane],
1809         [Use sane.h already on system.]),,
1810     [with_system_sane="$with_system_headers"])
1812 AC_ARG_WITH(system-bluez,
1813     AS_HELP_STRING([--with-system-bluez],
1814         [Use bluetooth.h already on system.]),,
1815     [with_system_bluez="$with_system_headers"])
1817 AC_ARG_WITH(system-mesa-headers,
1818     AS_HELP_STRING([--with-system-mesa-headers],
1819         [Use Mesa headers already on system.]),,
1820     [with_system_mesa_headers="$with_system_headers"])
1822 AC_ARG_WITH(system-curl,
1823     AS_HELP_STRING([--with-system-curl],
1824         [Use curl already on system.]),,
1825     [with_system_curl=auto])
1827 AC_ARG_WITH(system-boost,
1828     AS_HELP_STRING([--with-system-boost],
1829         [Use boost already on system.]),,
1830     [with_system_boost="$with_system_headers"])
1832 AC_ARG_WITH(system-glm,
1833     AS_HELP_STRING([--with-system-glm],
1834         [Use glm already on system.]),,
1835     [with_system_glm="$with_system_headers"])
1837 AC_ARG_WITH(system-vigra,
1838     AS_HELP_STRING([--with-system-vigra],
1839         [Use vigra already on system.]),,
1840     [with_system_vigra="$with_system_headers"])
1842 AC_ARG_WITH(system-hunspell,
1843     AS_HELP_STRING([--with-system-hunspell],
1844         [Use libhunspell already on system.]),,
1845     [with_system_hunspell="$with_system_libs"])
1847 AC_ARG_WITH(system-mythes,
1848     AS_HELP_STRING([--with-system-mythes],
1849         [Use mythes already on system.]),,
1850     [with_system_mythes="$with_system_libs"])
1852 AC_ARG_WITH(system-altlinuxhyph,
1853     AS_HELP_STRING([--with-system-altlinuxhyph],
1854         [Use ALTLinuxhyph already on system.]),,
1855     [with_system_altlinuxhyph="$with_system_libs"])
1857 AC_ARG_WITH(system-lpsolve,
1858     AS_HELP_STRING([--with-system-lpsolve],
1859         [Use lpsolve already on system.]),,
1860     [with_system_lpsolve="$with_system_libs"])
1862 AC_ARG_WITH(system-coinmp,
1863     AS_HELP_STRING([--with-system-coinmp],
1864         [Use CoinMP already on system.]),,
1865     [with_system_coinmp="$with_system_libs"])
1867 AC_ARG_WITH(system-liblangtag,
1868     AS_HELP_STRING([--with-system-liblangtag],
1869         [Use liblangtag library already on system.]),,
1870     [with_system_liblangtag="$with_system_libs"])
1872 AC_ARG_WITH(system-npapi-headers,
1873     AS_HELP_STRING([--with-system-npapi-headers],
1874         [Use NPAPI headers provided by system instead of bundled ones. Used in
1875          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1876     [with_system_npapi_headers="$with_system_headers"]
1879 AC_ARG_WITH(jpeg-turbo,
1880     AS_HELP_STRING([--with-jpeg-turbo],
1881         [Use internal libjpeg-turbo library.]),,
1882     [with_jpeg_turbo=auto])
1884 AC_ARG_WITH(webdav,
1885     AS_HELP_STRING([--with-webdav],
1886         [Specify which library to use for webdav implementation.
1887          Possible values: "neon", "serf", "no". The default value is "neon".
1888          Example: --with-webdav="serf"]),
1889     WITH_WEBDAV=$withval,
1890     WITH_WEBDAV="neon")
1892 AC_ARG_WITH(linker-hash-style,
1893     AS_HELP_STRING([--with-linker-hash-style],
1894         [Use linker with --hash-style=<style> when linking shared objects.
1895          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1896          if supported on the build system, and "sysv" otherwise.]))
1898 AC_ARG_WITH(jdk-home,
1899     AS_HELP_STRING([--with-jdk-home],
1900         [If you have installed JDK 1.3 or later on your system please supply the
1901          path here. Note that this is not the location of the java command but the
1902          location of the entire distribution.])
1903     [
1904                           Usage:     --with-jdk-home=<absolute path to JDK home>
1905     ],
1908 AC_ARG_WITH(help,
1909     AS_HELP_STRING([--with-help],
1910         [Enable the build of help. There is a special parameter "common" that
1911          can be used to bundle only the common part, .e.g help-specific icons.
1912          This is useful when you build the helpcontent separately.])
1913     [
1914                           Usage:     --with-help    build the entire local help
1915                                  --without-help     no local help (default)
1916                                  --with-help=common bundle common files for the local
1917                                                     help but do not build the whole help
1918     ],
1921 AC_ARG_WITH(java,
1922     AS_HELP_STRING([--with-java],
1923         [Specify the name of the Java interpreter command. Typically "java"
1924          which is the default.
1926          To build without support for Java components, applets, accessibility
1927          or the XML filters written in Java, use --without-java or --with-java=no.])
1928     [
1929                           Usage:     --with-java==<java command>
1930                                      --without-java
1931     ],
1932     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1933     [ with_java=java ]
1936 AC_ARG_WITH(jvm-path,
1937     AS_HELP_STRING([--with-jvm-path],
1938         [Use a specific JVM search path at runtime.])
1939     [
1940                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
1942                           e. g.: --with-jvm-path=/usr/lib/
1943                                  to find JRE/JDK in /usr/lib/jvm/
1944     ],
1947 AC_ARG_WITH(ant-home,
1948     AS_HELP_STRING([--with-ant-home],
1949         [If you have installed Jakarta Ant on your system, please supply the path here.
1950          Note that this is not the location of the Ant binary but the location
1951          of the entire distribution.])
1952     [
1953                           Usage:     --with-ant-home=<absolute path to Ant home>
1954     ],
1957 AC_ARG_WITH(export-validation,
1958     AS_HELP_STRING([--with-export-validation],
1959         [If you want the exported files to be validated. Right now limited to OOXML files in calc export tests.
1960          Note: You need an executable script officeotron that takes the path to the file.])
1961     [
1962                             Usage: --with-export-validation
1963     ],
1966 AC_ARG_WITH(junit,
1967     AS_HELP_STRING([--with-junit],
1968         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1969          --without-junit disables those tests. Not relevant in the --without-java case.])
1970     [
1971                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
1972     ],
1973 ,with_junit=yes)
1975 AC_ARG_WITH(hamcrest,
1976     AS_HELP_STRING([--with-hamcrest],
1977         [Specifies the hamcrest jar file to use for JUnit-based tests.
1978          --without-junit disables those tests. Not relevant in the --without-java case.])
1979     [
1980                           Usage:     --with-hamcrest=<absolute path to hamcrest jar>
1981     ],
1982 ,with_hamcrest=yes)
1984 AC_ARG_WITH(perl-home,
1985     AS_HELP_STRING([--with-perl-home],
1986         [If you have installed Perl 5 Distribution, on your system, please
1987          supply the path here. Note that this is not the location of the Perl
1988          binary but the location of the entire distribution.])
1989     [
1990                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
1991     ],
1994 AC_ARG_WITH(
1995     [doxygen],
1996     AS_HELP_STRING(
1997         [--with-doxygen],
1998         [Specifies the doxygen executable to use when generating ODK C/C++
1999          documentation. --without-doxygen disables generation of ODK C/C++
2000          documentation. Not relevant in the --disable-odk case.])
2001     [
2002                           Usage:     --with-doxygen=<absolute path to doxygen executable>
2003     ],,
2004     [with_doxygen=yes])
2006 AC_ARG_WITH(visual-studio,
2007     AS_HELP_STRING([--with-visual-studio=<2013/2012>],
2008         [Specify which Visual Studio version to use in case several are
2009          are installed. If not specified, the order of preference is
2010          2013, 2012 (including Express editions). Note that it is
2011          unclear whether using 2013 actually works as intended.])
2012     [
2013                           Usage:     --with-visual-studio=<2013/2012>
2014     ],
2017 AC_ARG_WITH(windows-sdk,
2018     AS_HELP_STRING([--with-windows-sdk=<6.0(A)/7.0(A)/7.1(A)/8.0(A)>],
2019         [Specify which Windows SDK, or "Windows Kit", version to use
2020          in case the one that came with the selected Visual Studio
2021          is not what you want for some reason. Note that not all compiler/SDK
2022          combinations are supported. The intent is that this option should not
2023          be needed.])
2024     [
2025                           Usage:     --with-windows-sdk=6.0(A)/7.0(A)/7.1(A)/8.0(A)>
2026     ],
2029 AC_ARG_WITH(lang,
2030     AS_HELP_STRING([--with-lang],
2031         [Use this option to build LibreOffice with additional UI language support.
2032          English (US) is always included by default.
2033          Separate multiple languages with space.
2034          For all languages, use --with-lang=ALL.])
2035     [
2036                           Usage:     --with-lang="es sw tu cs sk"
2037     ],
2040 AC_ARG_WITH(locales,
2041     AS_HELP_STRING([--with-locales],
2042         [Use this option to limit the locale information built in.
2043          Separate multiple locales with space.
2044          Very experimental and might well break stuff.
2045          Just a desperate measure to shrink code and data size.
2046          By default all the locales available is included.
2047          This option is completely unrelated to --with-lang.])
2048     [
2049                           Affects also our character encoding conversion
2050                           tables for encodings mainly targeted for a
2051                           particular locale, like EUC-CN and EUC-TW for
2052                           zh, ISO-2022-JP for ja.
2054                           Affects also our add-on break iterator data for
2055                           some languages.
2057                           For the default, all locales, don't use this switch at all.
2058                           Specifying just the language part of a locale means all matching
2059                           locales will be included.
2061                           Usage:     --with-locales="en es pt fr zh kr ja"
2062     ],
2065 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2066 AC_ARG_WITH(krb5,
2067     AS_HELP_STRING([--with-krb5],
2068         [Enable MIT Kerberos 5 support in modules that support it.
2069          By default automatically enabled on platforms
2070          where a good system Kerberos 5 is available.]),
2073 AC_ARG_WITH(gssapi,
2074     AS_HELP_STRING([--with-gssapi],
2075         [Enable GSSAPI support in modules that support it.
2076          By default automatically enabled on platforms
2077          where a good system GSSAPI is available.]),
2080 AC_ARG_WITH(iwyu,
2081     AS_HELP_STRING([--with-iwyu],
2082         [Provide IWYU binary path to check unneeded includes instead of building.
2083          Use only if you are hacking on it.]),
2086 dnl ===================================================================
2087 dnl Branding
2088 dnl ===================================================================
2090 AC_ARG_WITH(branding,
2091     AS_HELP_STRING([--with-branding],
2092         [Use given path to retrieve branding images set.])
2093     [
2094                           Search for intro.png about.svg and flat_logo.svg.
2095                           If any is missing, default ones will be used instead.
2097                           Search also progress.conf for progress
2098                           settings on intro screen :
2100                           PROGRESSBARCOLOR="255,255,255" Set color of
2101                           progress bar. Comma separated RGB decimal values.
2102                           PROGRESSSIZE="407,6" Set size of progress bar.
2103                           Comma separated decimal values (width, height).
2104                           PROGRESSPOSITION="61,317" Set position of progress
2105                           bar from left,top. Comma separated decimal values.
2106                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2107                           bar frame. Comma separated RGB decimal values.
2108                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2109                           bar text. Comma separated RGB decimal values.
2110                           PROGRESSTEXTBASELINE="287" Set vertical position of
2111                           progress bar text from top. Decimal value.
2113                           Default values will be used if not found.
2115                           Usage:     --with-branding=/path/to/images
2116     ],
2120 AC_ARG_WITH(extra-buildid,
2121     AS_HELP_STRING([--with-extra-buildid],
2122         [Show addition build identification in about dialog.])
2123     [
2124                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
2125     ],
2129 AC_ARG_WITH(vendor,
2130     AS_HELP_STRING([--with-vendor],
2131         [Set vendor of the build.])
2132     [
2133                           Usage:     --with-vendor="John the Builder"
2134     ],
2137 AC_ARG_WITH(compat-oowrappers,
2138     AS_HELP_STRING([--with-compat-oowrappers],
2139         [Install oo* wrappers in parallel with
2140          lo* ones to keep backward compatibility.
2141          Has effect only with make distro-pack-install]),
2144 AC_ARG_WITH(os-version,
2145     AS_HELP_STRING([--with-os-version],
2146         [For FreeBSD users, use this option option to override the detected OSVERSION.])
2147     [
2148                           Usage:     --with-os-version=<OSVERSION>
2149     ],
2152 AC_ARG_WITH(mingw-cross-compiler,
2153     AS_HELP_STRING([--with-mingw-cross-compiler],
2154         [Specify the MinGW cross-compiler to use.])
2155     [
2156                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2158                           When building on the ODK on Unix and building unowinreg.dll,
2159                           specify the MinGW C++ cross-compiler.
2160     ],
2163 AC_ARG_WITH(idlc-cpp,
2164     AS_HELP_STRING([--with-idlc-cpp],
2165         [Specify the C Preprocessor to use for idlc.])
2166     [
2167                           Usage:     --with-idlc-cpp=cpp
2169                           Default is ucpp.
2170     ]
2173 AC_ARG_WITH(build-version,
2174     AS_HELP_STRING([--with-build-version],
2175         [Allows the builder to add a custom version tag that will appear in the
2176          Help/About box for QA purposes.])
2177     [
2178                           Usage:     --with-build-version="Built by Jim"
2179     ],
2180     with_build_version=$withval ,
2183 AC_ARG_WITH(alloc,
2184     AS_HELP_STRING([--with-alloc],
2185         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2186          Note that on FreeBSD/NetBSD system==jemalloc]),
2189 AC_ARG_WITH(sun-templates,
2190     AS_HELP_STRING([--with-sun-templates],
2191         [Integrate Sun template packages.]),
2194 AC_ARG_WITH(parallelism,
2195     AS_HELP_STRING([--with-parallelism],
2196         [Number of jobs to run simultaneously during build. Parallel builds can
2197         save a lot of time on multi-cpu machines. Defaults to the number of
2198         CPUs on the machine, unless you configure --enable-icecream - then to
2199         10.]),
2202 AC_ARG_WITH(all-tarballs,
2203     AS_HELP_STRING([--with-all-tarballs],
2204         [Download all external tarballs unconditionally]))
2206 AC_ARG_WITH(gdrive-client-id,
2207     AS_HELP_STRING([--with-gdrive-client-id],
2208         [Provides the client id of the application for OAuth2 authentication
2209         on Google Drive. If either this or --with-gdrive-client-secret is
2210         empty, the feature will be disabled]),
2213 AC_ARG_WITH(gdrive-client-secret,
2214     AS_HELP_STRING([--with-gdrive-client-secret],
2215         [Provides the client secret of the application for OAuth2
2216         authentication on Google Drive. If either this or
2217         --with-gdrive-client-id is empty, the feature will be disabled]),
2220 AC_ARG_WITH(alfresco-cloud-client-id,
2221     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2222         [Provides the client id of the application for OAuth2 authentication
2223         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2224         empty, the feature will be disabled]),
2227 AC_ARG_WITH(alfresco-cloud-client-secret,
2228     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2229         [Provides the client secret of the application for OAuth2
2230         authentication on Alfresco Cloud. If either this or
2231         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2234 AC_ARG_WITH(onedrive-client-id,
2235     AS_HELP_STRING([--with-onedrive-client-id],
2236         [Provides the client id of the application for OAuth2 authentication
2237         on OneDrive. If either this or --with-onedrive-client-secret is
2238         empty, the feature will be disabled]),
2241 AC_ARG_WITH(onedrive-client-secret,
2242     AS_HELP_STRING([--with-onedrive-client-secret],
2243         [Provides the client secret of the application for OAuth2
2244         authentication on OneDrive. If either this or
2245         --with-onedrive-client-id is empty, the feature will be disabled]),
2247 dnl ===================================================================
2248 dnl Do we want to use pre-build binary tarball for recompile
2249 dnl ===================================================================
2251 if test "$enable_library_bin_tar" = "yes" ; then
2252     USE_LIBRARY_BIN_TAR=TRUE
2253 else
2254     USE_LIBRARY_BIN_TAR=
2256 AC_SUBST(USE_LIBRARY_BIN_TAR)
2258 dnl ===================================================================
2259 dnl Test whether build target is Release Build
2260 dnl ===================================================================
2261 AC_MSG_CHECKING([whether build target is Release Build])
2262 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2263     AC_MSG_RESULT([no])
2264     ENABLE_RELEASE_BUILD=
2265 else
2266     AC_MSG_RESULT([yes])
2267     ENABLE_RELEASE_BUILD=TRUE
2269 AC_SUBST(ENABLE_RELEASE_BUILD)
2271 dnl ===================================================================
2272 dnl Test whether to sign Windows Build
2273 dnl ===================================================================
2274 AC_MSG_CHECKING([whether to sign windows build])
2275 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2276     AC_MSG_RESULT([yes])
2277     WINDOWS_BUILD_SIGNING="TRUE"
2278 else
2279     AC_MSG_RESULT([no])
2280     WINDOWS_BUILD_SIGNING="FALSE"
2282 AC_SUBST(WINDOWS_BUILD_SIGNING)
2284 dnl ===================================================================
2285 dnl MacOSX build and runtime environment options
2286 dnl ===================================================================
2288 AC_ARG_WITH(macosx-sdk,
2289     AS_HELP_STRING([--with-macosx-sdk],
2290         [Use a specific SDK for building.])
2291     [
2292                           Usage:     --with-macosx-sdk=<version>
2294                           e. g.: --with-macosx-sdk=10.8
2296                           there are 3 options to control the MacOSX build:
2297                           --with-macosx-sdk (referred as 'sdk' below)
2298                           --with-macosx-version-min-required (referred as 'min' below)
2299                           --with-macosx-version-max-allowed (referred as 'max' below)
2301                           the connection between these value and the default they take is as follow:
2302                           ( ? means not specified on the command line, s means the SDK version found,
2303                           constraint: 8 <= x <= y <= z)
2305                           ==========================================
2306                            command line      || config result
2307                           ==========================================
2308                           min  | max  | sdk  || min  | max  | sdk  |
2309                           ?    | ?    | ?    || 10.8 | 10.s | 10.s |
2310                           ?    | ?    | 10.x || 10.8 | 10.x | 10.x |
2311                           ?    | 10.x | ?    || 10.8 | 10.s | 10.s |
2312                           ?    | 10.x | 10.y || 10.8 | 10.x | 10.y |
2313                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2314                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2315                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2316                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2319                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2320                           for a detailed technical explanation of these variables
2322                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2323     ],
2326 AC_ARG_WITH(macosx-version-min-required,
2327     AS_HELP_STRING([--with-macosx-version-min-required],
2328         [set the minimum OS version needed to run the built LibreOffice])
2329     [
2330                           Usage:     --with-macosx-version-min-required=<version>
2332                           e. g.: --with-macos-version-min-required=10.8
2333                           see --with-macosx-sdk for more info
2334     ],
2337 AC_ARG_WITH(macosx-version-max-allowed,
2338     AS_HELP_STRING([--with-macosx-version-max-allowed],
2339         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2340     [
2341                           Usage:     --with-macosx-version-max-allowed=<version>
2343                           e. g.: --with-macos-version-max-allowed=10.8
2344                           see --with-macosx-sdk for more info
2345     ],
2349 dnl ===================================================================
2350 dnl options for stuff used during cross-compilation build
2351 dnl Not quite superseded by --with-build-platform-configure-options.
2352 dnl TODO: check, if the "force" option is still needed anywhere.
2353 dnl ===================================================================
2355 AC_ARG_WITH(system-icu-for-build,
2356     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2357         [Use icu already on system for build tools (cross-compilation only).]))
2360 dnl ===================================================================
2361 dnl check for required programs (grep, awk, sed, bash)
2362 dnl ===================================================================
2364 pathmunge ()
2366     if test -n "$1"; then
2367         if test "$build_os" = "cygwin"; then
2368             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2369                 PathFormat "$1"
2370                 new_path=`cygpath -sm "$formatted_path"`
2371             else
2372                 PathFormat "$1"
2373                 new_path=`cygpath -u "$formatted_path"`
2374             fi
2375         else
2376             new_path="$1"
2377         fi
2378         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2379             if test "$2" = "after"; then
2380                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2381             else
2382                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2383             fi
2384         fi
2385         unset new_path
2386     fi
2389 AC_PROG_AWK
2390 AC_PATH_PROG( AWK, $AWK)
2391 if test -z "$AWK"; then
2392     AC_MSG_ERROR([install awk to run this script])
2395 AC_PATH_PROG(BASH, bash)
2396 if test -z "$BASH"; then
2397     AC_MSG_ERROR([bash not found in \$PATH])
2399 AC_SUBST(BASH)
2401 AC_MSG_CHECKING([for GNU or BSD tar])
2402 for a in $GNUTAR gtar gnutar tar /usr/sfw/bin/gtar; do
2403     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2404     if test $? -eq 0;  then
2405         GNUTAR=$a
2406         break
2407     fi
2408 done
2409 AC_MSG_RESULT($GNUTAR)
2410 if test -z "$GNUTAR"; then
2411     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2413 AC_SUBST(GNUTAR)
2415 AC_MSG_CHECKING([for tar's option to strip components])
2416 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2417 if test $? -eq 0; then
2418     STRIP_COMPONENTS="--strip-components"
2419 else
2420     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2421     if test $? -eq 0; then
2422         STRIP_COMPONENTS="--strip-path"
2423     else
2424         STRIP_COMPONENTS="unsupported"
2425     fi
2427 AC_MSG_RESULT($STRIP_COMPONENTS)
2428 if test x$STRIP_COMPONENTS = xunsupported; then
2429     AC_MSG_ERROR([you need a tar that is able to strip components.])
2431 AC_SUBST(STRIP_COMPONENTS)
2433 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2434 dnl desktop OSes from "mobile" ones.
2436 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2437 dnl In other words, that when building for an OS that is not a
2438 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2440 dnl Note the direction of the implication; there is no assumption that
2441 dnl cross-compiling would imply a non-desktop OS.
2443 if test $_os != iOS -a $_os != Android; then
2444     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2445     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2446     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2449 DISABLE_EXPORT=''
2450 if test "$enable_export" != no; then
2451     BUILD_TYPE="$BUILD_TYPE EXPORT"
2452 else
2453     DISABLE_EXPORT='TRUE'
2454     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2456 AC_SUBST(DISABLE_EXPORT)
2458 # Whether to build "avmedia" functionality or not.
2460 if test -z "$enable_avmedia"; then
2461     enable_avmedia=yes
2464 if test "$enable_avmedia" = yes; then
2465     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2466     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2467 else
2468     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2471 # Decide whether to build database connectivity stuff (including
2472 # Base) or not. We probably don't want to on non-desktop OSes.
2474 if test -z "$enable_database_connectivity"; then
2475     # --disable-database-connectivity is unfinished work in progress
2476     # and the iOS test app doesn't link if we actually try to use it.
2477     # if test $_os != iOS -a $_os != Android; then
2478         enable_database_connectivity=yes
2479     # fi
2482 if test "$enable_database_connectivity" = yes; then
2483     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2484     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2487 if test -z "$enable_extensions"; then
2488     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2489     if test $_os != iOS -a $_os != Android; then
2490         enable_extensions=yes
2491     fi
2494 if test "$enable_extensions" = yes; then
2495     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2496     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2499 if test -z "$enable_scripting"; then
2500     # Disable scripting for iOS unless specifically overridden
2501     # with --enable-scripting.
2502     if test $_os != iOS; then
2503         enable_scripting=yes
2504     fi
2507 DISABLE_SCRIPTING=''
2508 if test "$enable_scripting" = yes; then
2509     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2510     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2511 else
2512     DISABLE_SCRIPTING='TRUE'
2513     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2516 if test $_os = iOS -o $_os = Android; then
2517     # Disable dynamic_loading always for iOS and Android
2518     enable_dynamic_loading=no
2519 elif test -z "$enable_dynamic_loading"; then
2520     # Otherwise enable it unless speficically disabled
2521     enable_dynamic_loading=yes
2524 DISABLE_DYNLOADING=''
2525 if test "$enable_dynamic_loading" = yes; then
2526     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2527 else
2528     DISABLE_DYNLOADING='TRUE'
2529     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2531 AC_SUBST(DISABLE_DYNLOADING)
2533 # remenber SYSBASE value
2534 AC_SUBST(SYSBASE)
2536 dnl ===================================================================
2537 dnl  Sort out various gallery compilation options
2538 dnl ===================================================================
2539 AC_MSG_CHECKING([how to build and package galleries])
2540 if test -n "${with_galleries}"; then
2541     if test "$with_galleries" = "build"; then
2542         WITH_GALLERY_BUILD=TRUE
2543         AC_MSG_RESULT([build from source images internally])
2544     elif test "$with_galleries" = "no"; then
2545         WITH_GALLERY_BUILD=
2546         AC_MSG_RESULT([disable non-internal gallery build])
2547     else
2548         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2549     fi
2550 else
2551     if test $_os != iOS -a $_os != Android; then
2552         WITH_GALLERY_BUILD=TRUE
2553         AC_MSG_RESULT([internal src images for desktop])
2554     else
2555         WITH_GALLERY_BUILD=
2556         AC_MSG_RESULT([disable src imgage build])
2557     fi
2559 AC_SUBST(WITH_GALLERY_BUILD)
2561 dnl ===================================================================
2562 dnl  Checks if ccache is available
2563 dnl ===================================================================
2564 if test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2565     case "%$CC%$CXX%" in
2566     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2567     # assume that's good then
2568     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2569         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2570         ;;
2571     *)
2572         AC_PATH_PROG([CCACHE],[ccache],[not found])
2573         if test "$CCACHE" = "not found"; then
2574             CCACHE=""
2575         else
2576             # Need to check for ccache version: otherwise prevents
2577             # caching of the results (like "-x objective-c++" for Mac)
2578             if test $_os = Darwin -o $_os = iOS; then
2579                 # Check ccache version
2580                 AC_MSG_CHECKING([whether version of ccache is suitable])
2581                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2582                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2583                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2584                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2585                 else
2586                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2587                     CCACHE=""
2588                 fi
2589             fi
2590         fi
2591         ;;
2592     esac
2593 else
2594     CCACHE=""
2597 if test "$CCACHE" != ""; then
2598     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2599     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2600     if test "$ccache_size" = ""; then
2601         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2602         if test "$ccache_size" = ""; then
2603             ccache_size=0
2604         fi
2605         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2606         if test $ccache_size -lt 1024; then
2607             CCACHE=""
2608             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2609             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2610         else
2611             # warn that ccache may be too small for debug build
2612             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2613             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2614         fi
2615     else
2616         if test $ccache_size -lt 5; then
2617             #warn that ccache may be too small for debug build
2618             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2619             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2620         fi
2621     fi
2624 dnl ===================================================================
2625 dnl  Checks for C compiler,
2626 dnl  The check for the C++ compiler is later on.
2627 dnl ===================================================================
2628 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2629     GCC_HOME_SET="true"
2630     AC_MSG_CHECKING([gcc home])
2631     if test -z "$with_gcc_home"; then
2632         if test "$enable_icecream" = "yes"; then
2633             if test -d "/usr/lib/icecc/bin"; then
2634                 GCC_HOME="/usr/lib/icecc/"
2635             else
2636                 GCC_HOME="/opt/icecream/"
2637             fi
2638         else
2639             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2640             GCC_HOME_SET="false"
2641         fi
2642     else
2643         GCC_HOME="$with_gcc_home"
2644     fi
2645     AC_MSG_RESULT($GCC_HOME)
2646     AC_SUBST(GCC_HOME)
2648     if test "$GCC_HOME_SET" = "true"; then
2649         if test -z "$CC"; then
2650             CC="$GCC_HOME/bin/gcc"
2651         fi
2652         if test -z "$CXX"; then
2653             CXX="$GCC_HOME/bin/g++"
2654         fi
2655     fi
2658 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2659 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2660     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2661     save_CFLAGS=$CFLAGS
2662     AC_PROG_CC
2663     CFLAGS=$save_CFLAGS
2666 COMPATH=`dirname "$CC"`
2667 if test "$COMPATH" = "."; then
2668     AC_PATH_PROGS(COMPATH, $CC)
2669     dnl double square bracket to get single because of M4 quote...
2670     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2672 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2674 dnl ===================================================================
2675 dnl Java support
2676 dnl ===================================================================
2677 AC_MSG_CHECKING([whether to build with Java support])
2678 if test "$with_java" != "no"; then
2679     if test "$DISABLE_SCRIPTING" = TRUE; then
2680         AC_MSG_RESULT([no, overridden by --disable-scripting])
2681         ENABLE_JAVA=""
2682         with_java=no
2683     else
2684         AC_MSG_RESULT([yes])
2685         ENABLE_JAVA="TRUE"
2686         AC_DEFINE(HAVE_FEATURE_JAVA)
2687     fi
2688 else
2689     AC_MSG_RESULT([no])
2690     ENABLE_JAVA=""
2693 AC_SUBST(ENABLE_JAVA)
2695 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2697 dnl ENABLE_JAVA="" indicate no Java support at all
2699 dnl ===================================================================
2700 dnl Export file validation
2701 dnl ===================================================================
2702 AC_MSG_CHECKING([whether to enable export file validation])
2703 if test "$with_export_validation" = yes; then
2704     AC_MSG_RESULT([yes])
2705     AC_DEFINE(HAVE_EXPORT_VALIDATION)
2706 else
2707     AC_MSG_RESULT([no])
2711 dnl ===================================================================
2712 dnl Check OS X SDK and compiler
2713 dnl ===================================================================
2715 if test $_os = Darwin; then
2717     # If no --with-macosx-sdk option is given, look for one
2719     # The intent is that for "most" Mac-based developers, a suitable
2720     # SDK will be found automatically without any configure options.
2722     # For developers with a current Xcode, the lowest-numbered SDK
2723     # higher than or equal to the minimum required should be found.
2725     AC_MSG_CHECKING([what Mac OS X SDK to use])
2727     for _macosx_sdk in $with_macosx_sdk 10.8 10.9 10.10; do
2728         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2729         if test -d "$MACOSX_SDK_PATH"; then
2730             with_macosx_sdk="${_macosx_sdk}"
2731             break
2732         else
2733             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2734             if test -d "$MACOSX_SDK_PATH"; then
2735                 with_macosx_sdk="${_macosx_sdk}"
2736                 break
2737             fi
2738         fi
2739     done
2740     if test ! -d "$MACOSX_SDK_PATH"; then
2741         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2742     fi
2743     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2745     case $with_macosx_sdk in
2746     10.8)
2747         MACOSX_SDK_VERSION=1080
2748         ;;
2749     10.9)
2750         MACOSX_SDK_VERSION=1090
2751         ;;
2752     10.10)
2753         MACOSX_SDK_VERSION=101000
2754         ;;
2755     *)
2756         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.8--10])
2757         ;;
2758     esac
2760     if test "$with_macosx_version_min_required" = "" ; then
2761         with_macosx_version_min_required="10.8";
2762     fi
2764     if test "$with_macosx_version_max_allowed" = "" ; then
2765         with_macosx_version_max_allowed="$with_macosx_sdk"
2766     fi
2768     # export this so that "xcrun" invocations later return matching values
2769     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2770     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2771     export DEVELOPER_DIR
2772     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2773     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2775     case "$with_macosx_version_min_required" in
2776     10.8)
2777         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2778         ;;
2779     10.9)
2780         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2781         ;;
2782     10.10)
2783         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2784         ;;
2785     *)
2786         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.8--10])
2787         ;;
2788     esac
2790     LIBTOOL=libtool
2791     INSTALL_NAME_TOOL=install_name_tool
2792     if test -z "$save_CC"; then
2793         AC_MSG_CHECKING([what compiler to use])
2794         stdlib=-stdlib=libc++
2795         if test "$ENABLE_LTO" = TRUE; then
2796             lto=-flto
2797         fi
2798         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2799         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2800         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2801         AR=`xcrun -find ar`
2802         NM=`xcrun -find nm`
2803         STRIP=`xcrun -find strip`
2804         LIBTOOL=`xcrun -find libtool`
2805         RANLIB=`xcrun -find ranlib`
2806         AC_MSG_RESULT([$CC and $CXX])
2807     fi
2809     case "$with_macosx_version_max_allowed" in
2810     10.8)
2811         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2812         ;;
2813     10.9)
2814         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2815         ;;
2816     10.10)
2817         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2818         ;;
2819     *)
2820         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.8--10])
2821         ;;
2822     esac
2824     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2825     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2826         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2827     else
2828         AC_MSG_RESULT([ok])
2829     fi
2831     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2832     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2833         AC_MSG_ERROR([the version maximum allowed cannot be greater thatn the sdk level])
2834     else
2835         AC_MSG_RESULT([ok])
2836     fi
2837     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2838     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2840     AC_MSG_CHECKING([whether to do code signing])
2842     if test "$enable_macosx_code_signing" = yes; then
2843         # By default use the first suitable certificate (?).
2845         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2846         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2847         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2848         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2849         # "Developer ID Application" one.
2851         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2852         if test -n "$identity"; then
2853             MACOSX_CODESIGNING_IDENTITY=$identity
2854             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2855             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2856         fi
2857     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2858         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2859         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2860         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2861     else
2862         AC_MSG_RESULT([no])
2863     fi
2865     AC_MSG_CHECKING([whether to create a Mac App Store package])
2867     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2868         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2869     elif test "$enable_macosx_package_signing" = yes; then
2870         # By default use the first suitable certificate.
2871         # It should be a "3rd Party Mac Developer Installer" one
2873         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2874         if test -n "$identity"; then
2875             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2876             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2877             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2878         else
2879             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2880         fi
2881     elif test -n "$enable_macosx_package_signing"; then
2882         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2883         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2884         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2885     else
2886         AC_MSG_RESULT([no])
2887     fi
2889     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2890         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2891     fi
2893     AC_MSG_CHECKING([whether to sandbox the application])
2895     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2896         AC_MSG_ERROR([OS X sandboxing requires code signing])
2897     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2898         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2899     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2900         ENABLE_MACOSX_SANDBOX=TRUE
2901         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2902         AC_MSG_RESULT([yes])
2903     else
2904         AC_MSG_RESULT([no])
2905     fi
2907     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2908     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2909     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2911     AC_MSG_CHECKING([what OS X app name to use])
2912     MACOSX_APP_NAME="$with_macosx_app_name"
2913     AC_MSG_RESULT([$MACOSX_APP_NAME])
2916 AC_SUBST(MACOSX_SDK_PATH)
2917 AC_SUBST(MACOSX_SDK_VERSION)
2918 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2919 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2920 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2921 AC_SUBST(INSTALL_NAME_TOOL)
2922 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2923 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2924 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2925 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2926 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2927 AC_SUBST(MACOSX_APP_NAME)
2928 AC_SUBST(MACOSX_HIGH_RESOLUTION_VALUE)
2930 dnl ===================================================================
2931 dnl Check iOS SDK and compiler
2932 dnl ===================================================================
2934 if test $_os = iOS; then
2936     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2937         :
2938     else
2939         BITNESS_OVERRIDE=64
2940     fi
2942     AC_MSG_CHECKING([what iOS SDK to use])
2944     if test "$enable_ios_simulator" = yes; then
2945         platform=iPhoneSimulator
2946     else
2947         platform=iPhoneOS
2948     fi
2950     xcode_developer=`xcode-select -print-path`
2952     current_sdk_ver=8.1
2953     for sdkver in 8.1 8.0; do
2954         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2955         if test -d $t; then
2956             ios_sdk=$sdkver
2957             sysroot=$t
2958             break
2959         fi
2960     done
2962     if test -z "$sysroot"; then
2963         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}])
2964     fi
2966     AC_MSG_RESULT($sysroot)
2968     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2970     if test "$enable_ios_simulator" = yes; then
2971         if test "$BITNESS_OVERRIDE" = 64; then
2972             XCODE_ARCHS=x86_64
2973             versionmin=-mios-simulator-version-min=7.0
2974         else
2975             XCODE_ARCHS=i386
2976             versionmin=-mios-simulator-version-min=7.0
2977         fi
2978     else
2979         platform=iPhoneOS
2980         if test "$BITNESS_OVERRIDE" = 64; then
2981             XCODE_ARCHS=arm64
2982         else
2983             XCODE_ARCHS=armv7
2984         fi
2985         versionmin=-miphoneos-version-min=7.0
2986     fi
2988     # LTO is not really recommended for iOS builds,
2989     # the link time will be astronomical
2990     if test "$ENABLE_LTO" = TRUE; then
2991         lto=-flto
2992     fi
2993     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
2994     # get compiled with it, to avoid ld warnings when linking all that together into one
2995     # executable.
2997     XCODE_CLANG_CXX_LIBRARY=libc++
2998     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3000     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3001     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3003     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3004     AR=`xcrun -find ar`
3005     NM=`xcrun -find nm`
3006     STRIP=`xcrun -find strip`
3007     LIBTOOL=`xcrun -find libtool`
3008     RANLIB=`xcrun -find ranlib`
3011 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3012 AC_SUBST(XCODE_ARCHS)
3013 AC_SUBST(XCODEBUILD_SDK)
3015 AC_MSG_CHECKING([whether to treat the installation as read-only])
3017 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3018         "$enable_extensions" != yes; then
3019     enable_readonly_installset=yes
3021 if test "$enable_readonly_installset" = yes; then
3022     AC_MSG_RESULT([yes])
3023     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3024 else
3025     AC_MSG_RESULT([no])
3028 dnl ===================================================================
3029 dnl Structure of install set
3030 dnl ===================================================================
3032 if test $_os = Darwin; then
3033     LIBO_BIN_FOLDER=MacOS
3034     LIBO_ETC_FOLDER=Resources
3035     LIBO_LIBEXEC_FOLDER=MacOS
3036     LIBO_LIB_FOLDER=Frameworks
3037     LIBO_SHARE_FOLDER=Resources
3038     LIBO_SHARE_HELP_FOLDER=Resources/help
3039     LIBO_SHARE_JAVA_FOLDER=Resources/java
3040     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3041     LIBO_LIB_PYUNO_FOLDER=Resources
3042     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3043     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3044     LIBO_URE_BIN_FOLDER=MacOS
3045     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3046     LIBO_URE_LIB_FOLDER=Frameworks
3047     LIBO_URE_SHARE_FOLDER=Resources/ure/share
3048     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3049 elif test $_os = WINNT; then
3050     LIBO_BIN_FOLDER=program
3051     LIBO_ETC_FOLDER=program
3052     LIBO_LIBEXEC_FOLDER=program
3053     LIBO_LIB_FOLDER=program
3054     LIBO_LIB_PYUNO_FOLDER=program
3055     LIBO_SHARE_FOLDER=share
3056     LIBO_SHARE_HELP_FOLDER=help
3057     LIBO_SHARE_JAVA_FOLDER=program/classes
3058     LIBO_SHARE_PRESETS_FOLDER=presets
3059     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3060     LIBO_SHARE_SHELL_FOLDER=program/shell
3061     LIBO_URE_BIN_FOLDER=URE/bin
3062     LIBO_URE_ETC_FOLDER=URE/bin
3063     LIBO_URE_LIB_FOLDER=URE/bin
3064     LIBO_URE_SHARE_FOLDER=URE
3065     LIBO_URE_SHARE_JAVA_FOLDER=URE/java
3066 else
3067     LIBO_BIN_FOLDER=program
3068     LIBO_ETC_FOLDER=program
3069     LIBO_LIBEXEC_FOLDER=program
3070     LIBO_LIB_FOLDER=program
3071     LIBO_LIB_PYUNO_FOLDER=program
3072     LIBO_SHARE_FOLDER=share
3073     LIBO_SHARE_HELP_FOLDER=help
3074     LIBO_SHARE_JAVA_FOLDER=program/classes
3075     LIBO_SHARE_PRESETS_FOLDER=presets
3076     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3077     LIBO_SHARE_SHELL_FOLDER=program/shell
3078     LIBO_URE_BIN_FOLDER=ure/bin
3079     LIBO_URE_ETC_FOLDER=ure/lib
3080     LIBO_URE_LIB_FOLDER=ure/lib
3081     LIBO_URE_SHARE_FOLDER=ure/share
3082     LIBO_URE_SHARE_JAVA_FOLDER=ure/share/java
3084 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3091 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3092 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3093 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3094 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3095 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3096 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3097 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3098 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_FOLDER,"$LIBO_URE_SHARE_FOLDER")
3099 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3101 # Not all of them needed in config_host.mk, add more if need arises
3102 AC_SUBST(LIBO_BIN_FOLDER)
3103 AC_SUBST(LIBO_ETC_FOLDER)
3104 AC_SUBST(LIBO_LIB_FOLDER)
3105 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3106 AC_SUBST(LIBO_SHARE_FOLDER)
3107 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3108 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3109 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3110 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3111 AC_SUBST(LIBO_URE_BIN_FOLDER)
3112 AC_SUBST(LIBO_URE_ETC_FOLDER)
3113 AC_SUBST(LIBO_URE_LIB_FOLDER)
3114 AC_SUBST(LIBO_URE_SHARE_FOLDER)
3115 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3117 dnl ===================================================================
3118 dnl Windows specific tests and stuff
3119 dnl ===================================================================
3121 # Get a value from the 32-bit side of the Registry
3122 reg_get_value_32()
3124     # Return value: $regvalue
3125     unset regvalue
3126     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3128     if test $? -eq 0; then
3129         regvalue=$_regvalue
3130     fi
3133 # Get a value from the 64-bit side of the Registry
3134 reg_get_value_64()
3136     # Return value: $regvalue
3137     unset regvalue
3138     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3140     if test $? -eq 0; then
3141         regvalue=$_regvalue
3142     fi
3145 if test "$_os" = "WINNT"; then
3146     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3147     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3148         AC_MSG_RESULT([no])
3149         WINDOWS_SDK_ARCH="x86"
3150     else
3151         AC_MSG_RESULT([yes])
3152         WINDOWS_SDK_ARCH="x64"
3153         BITNESS_OVERRIDE=64
3154     fi
3157 if test "$cross_compiling" = "yes"; then
3158     export CROSS_COMPILING=TRUE
3159     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3160 else
3161     CROSS_COMPILING=
3162     BUILD_TYPE="$BUILD_TYPE NATIVE"
3164 AC_SUBST(CROSS_COMPILING)
3166 dnl ===================================================================
3167 dnl  Is GCC actually Clang?
3168 dnl ===================================================================
3170 COM_GCC_IS_CLANG=
3171 if test "$GCC" = "yes"; then
3172     AC_MSG_CHECKING([whether GCC is actually Clang])
3173     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3174         #ifndef __clang__
3175         you lose
3176         #endif
3177         int foo=42;
3178         ]])],
3179         [AC_MSG_RESULT([yes])
3180          COM_GCC_IS_CLANG=TRUE],
3181         [AC_MSG_RESULT([no])])
3183     if test "$COM_GCC_IS_CLANG" = TRUE; then
3184         AC_MSG_CHECKING([the Clang version])
3185         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3186         CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3187         CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3188         AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3189         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3190     fi
3192 AC_SUBST(COM_GCC_IS_CLANG)
3194 if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
3195     if test -z "$CCACHE_CPP2"; then
3196         AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3197         add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3198     fi
3201 dnl ===================================================================
3202 dnl  Test the gcc version
3203 dnl ===================================================================
3204 if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
3205     AC_MSG_CHECKING([the GCC version])
3206     _gcc_version=`$CC -dumpversion`
3207     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3209     AC_MSG_RESULT([gcc $_gcc_version])
3211     if test "$GCC_VERSION" -lt 0406; then
3212         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.6.0])
3213     fi
3214 else
3215     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3216     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3217     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3218     # (which reports itself as GCC 4.2.1).
3219     GCC_VERSION=
3221 AC_SUBST(GCC_VERSION)
3223 # ===================================================================
3224 # check various GCC options that Clang does not support now but maybe
3225 # will somewhen in the future, check them even for GCC, so that the
3226 # flags are set
3227 # ===================================================================
3229 HAVE_GCC_GGDB2=
3230 HAVE_GCC_FINLINE_LIMIT=
3231 HAVE_GCC_FNO_INLINE=
3232 if test "$GCC" = "yes"; then
3233     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3234     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3235         # Option just ignored and silly warning that isn't a real
3236         # warning printed
3237         :
3238     else
3239         save_CFLAGS=$CFLAGS
3240         CFLAGS="$CFLAGS -Werror -ggdb2"
3241         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3242         CFLAGS=$save_CFLAGS
3243     fi
3244     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3245         AC_MSG_RESULT([yes])
3246     else
3247         AC_MSG_RESULT([no])
3248     fi
3250     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3251     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3252         # As above
3253         :
3254     else
3255         save_CFLAGS=$CFLAGS
3256         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3257         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3258         CFLAGS=$save_CFLAGS
3259     fi
3260     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3261         AC_MSG_RESULT([yes])
3262     else
3263         AC_MSG_RESULT([no])
3264     fi
3266     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3267     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3268         # Ditto
3269         :
3270     else
3271         save_CFLAGS=$CFLAGS
3272         CFLAGS="$CFLAGS -Werror -fno-inline"
3273         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3274         CFLAGS=$save_CFLAGS
3275     fi
3276     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3277         AC_MSG_RESULT([yes])
3278     else
3279         AC_MSG_RESULT([no])
3280     fi
3282 AC_SUBST(HAVE_GCC_GGDB2)
3283 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3284 AC_SUBST(HAVE_GCC_FNO_INLINE)
3286 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3287 if test "$GCC" = "yes"; then
3288     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3289     bsymbolic_functions_ldflags_save=$LDFLAGS
3290     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3291     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3292 #include <stdio.h>
3293         ],[
3294 printf ("hello world\n");
3295         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3296     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3297         AC_MSG_RESULT( found )
3298     else
3299         AC_MSG_RESULT( not found )
3300     fi
3301     LDFLAGS=$bsymbolic_functions_ldflags_save
3303 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3305 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3306 # NOTE: must _not_ be used for bundled external libraries!
3307 ISYSTEM=
3308 if test "$GCC" = "yes"; then
3309     AC_MSG_CHECKING( for -isystem )
3310     save_CFLAGS=$CFLAGS
3311     CFLAGS="$CFLAGS -Werror"
3312     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3313     CFLAGS=$save_CFLAGS
3314     if test -n "$ISYSTEM"; then
3315         AC_MSG_RESULT(yes)
3316     else
3317         AC_MSG_RESULT(no)
3318     fi
3320 if test -z "$ISYSTEM"; then
3321     # fall back to using -I
3322     ISYSTEM=-I
3324 AC_SUBST(ISYSTEM)
3326 dnl ===================================================================
3327 dnl  Check which Visual Studio or MinGW compiler is used
3328 dnl ===================================================================
3330 map_vs_year_to_version()
3332     # Return value: $vsversion
3334     unset vsversion
3336     case $1 in
3337     2012)
3338         vsversion=11.0;;
3339     2013)
3340         vsversion=12.0;;
3341     *)
3342         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3343     esac
3346 vs_versions_to_check()
3348     # Args: $1 (optional) : versions to check, in the order of preference
3349     # Return value: $vsversions
3351     unset vsversions
3353     if test -n "$1"; then
3354         map_vs_year_to_version "$1"
3355         vsversions=$vsversion
3356     else
3357         # By default we prefer 2013, then 2012
3358         vsversions="12.0 11.0"
3359     fi
3362 find_msvs()
3364     # Find Visual Studio 2013/2012
3365     # Args: $1 (optional) : versions to check, in the order of preference
3366     # Return value: $vstest
3368     unset vstest
3370     vs_versions_to_check "$1"
3372     for ver in $vsversions; do
3373         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3374         if test -n "$regvalue"; then
3375             vstest=$regvalue
3376             break
3377         fi
3378         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3379         if test -n "$regvalue"; then
3380             vstest=$regvalue
3381             break
3382         fi
3383     done
3386 find_msvc()
3388     # Find Visual C++ 2013/2012
3389     # Args: $1 (optional) : The VS version year
3390     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3392     unset vctest vcnum vcnumwithdot vcexpress
3394     vs_versions_to_check "$1"
3396     for ver in $vsversions; do
3397         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3398         if test -n "$regvalue"; then
3399             vctest=$regvalue
3400             break
3401         fi
3402         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3403         if test -n "$regvalue"; then
3404             vctest=$regvalue
3405             break
3406         fi
3407     done
3408     if test -n "$vctest"; then
3409         vcnumwithdot=$ver
3410         case "$vcnumwithdot" in
3411         11.0)
3412             vcyear=2012
3413             vcnum=110
3414             ;;
3415         12.0)
3416             vcyear=2013
3417             vcnum=120
3418             ;;
3419         esac
3420         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$vcnumwithdot/Setup/VC/ProductDir
3421         if test -n "$regvalue" -a "$regvalue" = "$vctest" ; then
3422             vcexpress=Express
3423         fi
3424     fi
3427 SHOWINCLUDES_PREFIX=
3428 MSBUILD_PATH=
3429 if test "$_os" = "WINNT"; then
3430     if test "$WITH_MINGW" != "yes"; then
3431         AC_MSG_CHECKING([Visual C++])
3433         find_msvc "$with_visual_studio"
3435         if test -z "$vctest"; then
3436             if test -n "$with_visual_studio"; then
3437                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3438             else
3439                 AC_MSG_ERROR([No Visual Studio 2012 or 2013 installation found])
3440             fi
3441         fi
3443         if test "$BITNESS_OVERRIDE" = ""; then
3444             if test -f "$vctest/bin/cl.exe"; then
3445                 VC_PRODUCT_DIR=$vctest
3446             else
3447                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3448             fi
3449         else
3450             if test -f "$vctest/bin/amd64/cl.exe"; then
3451                 VC_PRODUCT_DIR=$vctest
3452             else
3453                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe])
3454             fi
3455         fi
3457         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3458         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3460         AC_MSG_CHECKING([Is Visual C++ Express])
3461         if test "$vcexpress" = "Express" ; then
3462             AC_MSG_RESULT([Yes])
3463         else
3464             AC_MSG_RESULT([No])
3465         fi
3467         # Find the proper version of MSBuild.exe to use based on the VS version
3468         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3469         if test -n "$regvalue" ; then
3470             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3471         fi
3473         dnl ===========================================================
3474         dnl  Check for the corresponding mspdb*.dll
3475         dnl ===========================================================
3477         MSPDB_PATH=
3479         if test "$BITNESS_OVERRIDE" = ""; then
3480             if test "$vcnum" = "120"; then
3481                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3482             else
3483                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3484             fi
3485         else
3486             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3487         fi
3489         mspdbnum=$vcnum
3491         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3492             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3493         fi
3495         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3496         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3498         dnl The path needs to be added before cl is called
3499         PATH="$MSPDB_PATH:$PATH"
3501         AC_MSG_CHECKING([cl.exe])
3503         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3504         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3505         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3506         # is not enough?
3508         if test -z "$CC"; then
3509             if test "$BITNESS_OVERRIDE" = ""; then
3510                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3511                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3512                 fi
3513             else
3514                 if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3515                     CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3516                 fi
3517             fi
3519             # This gives us a posix path with 8.3 filename restrictions
3520             CC=`win_short_path_for_make "$CC"`
3521         fi
3523         if test -n "$CC"; then
3524             # Remove /cl.exe from CC case insensitive
3525             AC_MSG_RESULT([found Visual C++ $vcyear $vcexpress ($CC)])
3526             if test "$BITNESS_OVERRIDE" = ""; then
3527                 COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3528             else
3529                 if test -n "$VC_PRODUCT_DIR"; then
3530                     # Huh, why not just an assignment?
3531                     COMPATH=`echo $VC_PRODUCT_DIR`
3532                 fi
3533             fi
3534             if test "$BITNESS_OVERRIDE" = ""; then
3535                 CC="$CC -arch:SSE" # MSVC 2012 default for x86 is -arch:SSE2
3536             fi
3537             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3539             PathFormat "$COMPATH"
3540             COMPATH="$formatted_path"
3542             VCVER=$vcnum
3543             MSVSVER=$vcyear
3545             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3546             # are always "better", we list them in reverse chronological order.
3548             case $vcnum in
3549             110)
3550                 COMEX=14
3551                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.0 7.1A"
3552                 ;;
3553             120)
3554                 COMEX=15
3555                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0"
3556                 ;;
3557             esac
3559             # The expectation is that --with-windows-sdk should not need to be used
3560             if test -n "$with_windows_sdk"; then
3561                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3562                 *" "$with_windows_sdk" "*)
3563                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3564                     ;;
3565                 *)
3566                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3567                     ;;
3568                 esac
3569             fi
3571             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3572             ac_objext=obj
3573             ac_exeext=exe
3575         else
3576             AC_MSG_ERROR([Visual C++ not found after all, huh])
3577         fi
3579         dnl We need to guess the prefix of the -showIncludes output, it can be
3580         dnl localized
3581         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3582         echo "#include <stdlib.h>" > conftest.c
3583         SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
3584             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3585         rm -f conftest.c conftest.obj
3586         if test -z "$SHOWINCLUDES_PREFIX"; then
3587             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3588         else
3589             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3590         fi
3592         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3593         # version of the Explorer extension (and maybe other small
3594         # bits, too) needed when installing a 32-bit LibreOffice on a
3595         # 64-bit OS. The 64-bit Explorer extension is a feature that
3596         # has been present since long in OOo. Don't confuse it with
3597         # building LibreOffice itself as 64-bit code, which is
3598         # unfinished work and highly experimental.
3600         BUILD_X64=
3601         CXX_X64_BINARY=
3602         LINK_X64_BINARY=
3604         if test "$BITNESS_OVERRIDE" = ""; then
3605             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3606             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3607                 # Prefer native x64 compiler to cross-compiler, in case we are running
3608                 # the build on a 64-bit OS.
3609                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3610                     BUILD_X64=TRUE
3611                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3612                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3613                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3614                     BUILD_X64=TRUE
3615                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3616                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3617                 fi
3618             fi
3619             if test "$BUILD_X64" = TRUE; then
3620                 AC_MSG_RESULT([found])
3621             else
3622                 AC_MSG_RESULT([not found])
3623                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3624             fi
3625         fi
3626         AC_SUBST(BUILD_X64)
3628         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3629         AC_SUBST(CXX_X64_BINARY)
3630         AC_SUBST(LINK_X64_BINARY)
3631     else
3632         AC_MSG_CHECKING([the compiler is MinGW])
3633         MACHINE_PREFIX=`$CC -dumpmachine`
3634         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3635             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3636             AC_MSG_RESULT([yes])
3637         else
3638             AC_MSG_ERROR([Compiler is not MinGW.])
3639         fi
3640     fi
3642 AC_SUBST(VCVER)
3643 PathFormat "$MSPDB_PATH"
3644 MSPDB_PATH="$formatted_path"
3645 AC_SUBST(SHOWINCLUDES_PREFIX)
3647 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3648     AC_MSG_CHECKING([whether to use DirectX])
3649     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3650         ENABLE_DIRECTX="TRUE"
3651         AC_MSG_RESULT([yes])
3652     else
3653         ENABLE_DIRECTX=""
3654         AC_MSG_RESULT([no])
3655     fi
3657     AC_MSG_CHECKING([whether to use ActiveX])
3658     if test "$enable_activex" = "yes" -o "$enable_activex" = "" -a "$vcexpress" != Express; then
3659         DISABLE_ACTIVEX=""
3660         AC_MSG_RESULT([yes])
3661     else
3662         DISABLE_ACTIVEX="TRUE"
3663         AC_MSG_RESULT([no])
3664     fi
3666     AC_MSG_CHECKING([whether to use ATL])
3667     if test "$enable_atl" = "yes" -o "$enable_atl" = "" -a "$vcexpress" != Express; then
3668         DISABLE_ATL=""
3669         AC_MSG_RESULT([yes])
3670     else
3671         DISABLE_ATL="TRUE"
3672         AC_MSG_RESULT([no])
3673     fi
3674 else
3675     ENABLE_DIRECTX=""
3676     DISABLE_ACTIVEX="TRUE"
3677     DISABLE_ATL="TRUE"
3680 AC_SUBST(ENABLE_DIRECTX)
3681 AC_SUBST(DISABLE_ACTIVEX)
3682 AC_SUBST(DISABLE_ATL)
3685 # dbghelp.dll
3687 if test "$_os" = "WINNT"; then
3688     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3692 # unowinreg.dll
3694 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3695 AC_SUBST(UNOWINREG_DLL)
3698 # prefix C with ccache if needed
3700 if test "$CCACHE" != ""; then
3701     AC_MSG_CHECKING([whether $CC is already ccached])
3703     AC_LANG_PUSH([C])
3704     save_CFLAGS=$CFLAGS
3705     CFLAGS="$CFLAGS --ccache-skip -O2"
3706     dnl an empty program will do, we're checking the compiler flags
3707     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3708                       [use_ccache=yes], [use_ccache=no])
3709     if test $use_ccache = yes; then
3710         AC_MSG_RESULT([yes])
3711     else
3712         CC="$CCACHE $CC"
3713         AC_MSG_RESULT([no])
3714     fi
3715     CFLAGS=$save_CFLAGS
3716     AC_LANG_POP([C])
3719 dnl Set the ENABLE_DBGUTIL variable
3720 dnl ===================================================================
3721 AC_MSG_CHECKING([whether to build with additional debug utilities])
3722 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3723     ENABLE_DBGUTIL="TRUE"
3724     # this is an extra var so it can have different default on different MSVC
3725     # versions (in case there are version specific problems with it)
3726     MSVC_USE_DEBUG_RUNTIME="TRUE"
3728     AC_MSG_RESULT([yes])
3729     # cppunit and graphite expose STL in public headers
3730     if test "$with_system_cppunit" = "yes"; then
3731         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3732     else
3733         with_system_cppunit=no
3734     fi
3735     if test "$with_system_graphite" = "yes"; then
3736         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3737     else
3738         with_system_graphite=no
3739     fi
3740     if test "$with_system_mysql_cppconn" = "yes"; then
3741         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3742     else
3743         with_system_mysql_cppconn=no
3744     fi
3745     if test "$with_system_orcus" = "yes"; then
3746         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3747     else
3748         with_system_orcus=no
3749     fi
3750     if test "$with_system_libcmis" = "yes"; then
3751         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3752     else
3753         with_system_libcmis=no
3754     fi
3755     if test "$with_system_libgltf" = "yes"; then
3756         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3757     else
3758         with_system_libgltf=no
3759     fi
3760     if test "$enable_win_mozab_driver" = "yes"; then
3761         AC_MSG_ERROR([--enable-win-mozab-driver conflicts with --enable-dbgutil])
3762     fi
3763 else
3764     ENABLE_DBGUTIL=""
3765     MSVC_USE_DEBUG_RUNTIME=""
3766     AC_MSG_RESULT([no])
3768 AC_SUBST(ENABLE_DBGUTIL)
3769 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3771 dnl Set the ENABLE_DEBUG variable.
3772 dnl ===================================================================
3773 AC_MSG_CHECKING([whether to do a debug build])
3774 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3775     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3777 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3778     AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3781 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3782     ENABLE_DEBUG="TRUE"
3783     ANDROID_DEBUGGABLE='android:debuggable="true"'
3784     ANDROID_INSTALL_LOCATION='android:installLocation="internalOnly"'
3785     if test -n "$ENABLE_DBGUTIL" ; then
3786         AC_MSG_RESULT([yes (dbgutil)])
3787     else
3788         AC_MSG_RESULT([yes])
3789     fi
3790 else
3791     ENABLE_DEBUG=""
3792     ANDROID_DEBUGGABLE=""
3793     ANDROID_INSTALL_LOCATION='android:installLocation="preferExternal"'
3794     AC_MSG_RESULT([no])
3796 AC_SUBST(ENABLE_DEBUG)
3797 AC_SUBST(ANDROID_DEBUGGABLE)
3798 AC_SUBST(ANDROID_INSTALL_LOCATION)
3800 if test "$enable_sal_log" = yes; then
3801     ENABLE_SAL_LOG=TRUE
3803 AC_SUBST(ENABLE_SAL_LOG)
3805 dnl Selective debuginfo
3806 ENABLE_DEBUGINFO_FOR=
3807 if test -n "$ENABLE_DEBUG"; then
3808     AC_MSG_CHECKING([whether to use selective debuginfo])
3809     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3810         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3811         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3812     else
3813         ENABLE_DEBUGINFO_FOR=all
3814         AC_MSG_RESULT([no, for all])
3815     fi
3817 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3819 dnl Check for enable symbols option
3820 dnl ===================================================================
3821 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3822 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3823     ENABLE_SYMBOLS="TRUE"
3824     if test -n "$ENABLE_DBGUTIL"; then
3825         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3826     elif test -n "$ENABLE_DEBUG"; then
3827         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3828     fi
3829     AC_MSG_RESULT([yes])
3830 else
3831     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
3832         ENABLE_SYMBOLS="FALSE"
3833     else
3834         ENABLE_SYMBOLS=
3835     fi
3836     AC_MSG_RESULT([no])
3838 AC_SUBST(ENABLE_SYMBOLS)
3840 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3841 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3842 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3843 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3844 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3845     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
3847 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
3849 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3850 # By default use the ones specified by our build system,
3851 # but explicit override is possible.
3852 AC_MSG_CHECKING(for explicit AFLAGS)
3853 if test -n "$AFLAGS"; then
3854     AC_MSG_RESULT([$AFLAGS])
3855     x_AFLAGS=
3856 else
3857     AC_MSG_RESULT(no)
3858     x_AFLAGS=[\#]
3860 AC_MSG_CHECKING(for explicit CFLAGS)
3861 if test -n "$CFLAGS"; then
3862     AC_MSG_RESULT([$CFLAGS])
3863     x_CFLAGS=
3864 else
3865     AC_MSG_RESULT(no)
3866     x_CFLAGS=[\#]
3868 AC_MSG_CHECKING(for explicit CXXFLAGS)
3869 if test -n "$CXXFLAGS"; then
3870     AC_MSG_RESULT([$CXXFLAGS])
3871     x_CXXFLAGS=
3872 else
3873     AC_MSG_RESULT(no)
3874     x_CXXFLAGS=[\#]
3876 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3877 if test -n "$OBJCFLAGS"; then
3878     AC_MSG_RESULT([$OBJCFLAGS])
3879     x_OBJCFLAGS=
3880 else
3881     AC_MSG_RESULT(no)
3882     x_OBJCFLAGS=[\#]
3884 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
3885 if test -n "$OBJCXXFLAGS"; then
3886     AC_MSG_RESULT([$OBJCXXFLAGS])
3887     x_OBJCXXFLAGS=
3888 else
3889     AC_MSG_RESULT(no)
3890     x_OBJCXXFLAGS=[\#]
3892 AC_MSG_CHECKING(for explicit LDFLAGS)
3893 if test -n "$LDFLAGS"; then
3894     AC_MSG_RESULT([$LDFLAGS])
3895     x_LDFLAGS=
3896 else
3897     AC_MSG_RESULT(no)
3898     x_LDFLAGS=[\#]
3900 AC_SUBST(AFLAGS)
3901 AC_SUBST(CFLAGS)
3902 AC_SUBST(CXXFLAGS)
3903 AC_SUBST(OBJCFLAGS)
3904 AC_SUBST(OBJCXXFLAGS)
3905 AC_SUBST(LDFLAGS)
3906 AC_SUBST(x_AFLAGS)
3907 AC_SUBST(x_CFLAGS)
3908 AC_SUBST(x_CXXFLAGS)
3909 AC_SUBST(x_OBJCFLAGS)
3910 AC_SUBST(x_OBJCXXFLAGS)
3911 AC_SUBST(x_LDFLAGS)
3914 # determine CPUNAME, GUIBASE, ...
3916 SOLARINC=
3918 case "$host_os" in
3920 aix*)
3921     COM=GCC
3922     CPUNAME=POWERPC
3923     GUIBASE=unx
3924     OS=AIX
3925     RTL_OS=AIX
3926     RTL_ARCH=PowerPC
3927     PLATFORMID=aix_powerpc
3928     P_SEP=:
3929     ;;
3931 cygwin*)
3932     COM=MSC
3933     GUIBASE=not-used
3934     OS=WNT
3935     RTL_OS=Windows
3936     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3937         P_SEP=";"
3938     else
3939         P_SEP=:
3940     fi
3941     case "$host_cpu" in
3942     i*86|x86_64)
3943         if test "$BITNESS_OVERRIDE" = 64; then
3944             CPUNAME=X86_64
3945             RTL_ARCH=X86_64
3946             PLATFORMID=windows_x86_64
3947         else
3948             CPUNAME=INTEL
3949             RTL_ARCH=x86
3950             PLATFORMID=windows_x86
3951         fi
3952         ;;
3953     *)
3954         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3955         ;;
3956     esac
3957     SCPDEFS="$SCPDEFS -D_MSC_VER"
3958     ;;
3960 darwin*)
3961     COM=GCC
3962     GUIBASE=not-used
3963     OS=MACOSX
3964     RTL_OS=MacOSX
3965     P_SEP=:
3967     case "$host_cpu" in
3968     arm*)
3969         CPUNAME=ARM
3970         RTL_ARCH=ARM_EABI
3971         PLATFORMID=ios_arm
3972         OS=IOS
3973         ;;
3974     i*86)
3975         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3976         ;;
3977     x86_64)
3978         CPUNAME=X86_64
3979         RTL_ARCH=X86_64
3980         PLATFORMID=macosx_x86_64
3981         ;;
3982     *)
3983         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3984         ;;
3985     esac
3986     ;;
3988 dragonfly*)
3989     COM=GCC
3990     GUIBASE=unx
3991     OS=DRAGONFLY
3992     RTL_OS=DragonFly
3993     P_SEP=:
3995     case "$host_cpu" in
3996     i*86)
3997         CPUNAME=INTEL
3998         RTL_ARCH=x86
3999         PLATFORMID=dragonfly_x86
4000         ;;
4001     x86_64)
4002         CPUNAME=X86_64
4003         RTL_ARCH=X86_64
4004         PLATFORMID=dragonfly_x86_64
4005         ;;
4006     *)
4007         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4008         ;;
4009     esac
4010     ;;
4012 freebsd*)
4013     COM=GCC
4014     GUIBASE=unx
4015     RTL_OS=FreeBSD
4016     OS=FREEBSD
4017     P_SEP=:
4019     case "$host_cpu" in
4020     i*86)
4021         CPUNAME=INTEL
4022         RTL_ARCH=x86
4023         PLATFORMID=freebsd_x86
4024         ;;
4025     x86_64|amd64)
4026         CPUNAME=X86_64
4027         RTL_ARCH=X86_64
4028         PLATFORMID=freebsd_x86_64
4029         ;;
4030     *)
4031         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4032         ;;
4033     esac
4034     ;;
4036 kfreebsd*)
4037     COM=GCC
4038     GUIBASE=unx
4039     OS=LINUX
4040     RTL_OS=kFreeBSD
4041     P_SEP=:
4043     case "$host_cpu" in
4045     i*86)
4046         CPUNAME=INTEL
4047         RTL_ARCH=x86
4048         PLATFORMID=kfreebsd_x86
4049         ;;
4050     x86_64)
4051         CPUNAME=X86_64
4052         RTL_ARCH=X86_64
4053         PLATFORMID=kfreebsd_x86_64
4054         ;;
4055     *)
4056         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4057         ;;
4058     esac
4059     ;;
4061 linux-gnu*)
4062     COM=GCC
4063     GUIBASE=unx
4064     OS=LINUX
4065     RTL_OS=Linux
4066     P_SEP=:
4068     case "$host_cpu" in
4070     aarch64)
4071         CPUNAME=AARCH64
4072         PLATFORMID=linux_aarch64
4073         RTL_ARCH=AARCH64
4074         ;;
4075     alpha)
4076         CPUNAME=AXP
4077         RTL_ARCH=ALPHA
4078         PLATFORMID=linux_alpha
4079         ;;
4080     arm*)
4081         CPUNAME=ARM
4082         EPM_FLAGS="-a arm"
4083         RTL_ARCH=ARM_EABI
4084         PLATFORMID=linux_arm_eabi
4085         case "$host_cpu" in
4086         arm*-linux)
4087             RTL_ARCH=ARM_OABI
4088             PLATFORMID=linux_arm_oabi
4089             ;;
4090         esac
4091         ;;
4092     hppa)
4093         CPUNAME=HPPA
4094         RTL_ARCH=HPPA
4095         EPM_FLAGS="-a hppa"
4096         PLATFORMID=linux_hppa
4097         ;;
4098     i*86)
4099         CPUNAME=INTEL
4100         RTL_ARCH=x86
4101         PLATFORMID=linux_x86
4102         ;;
4103     ia64)
4104         CPUNAME=IA64
4105         RTL_ARCH=IA64
4106         PLATFORMID=linux_ia64
4107         ;;
4108     mips)
4109         CPUNAME=GODSON
4110         RTL_ARCH=MIPS_EB
4111         EPM_FLAGS="-a mips"
4112         PLATFORMID=linux_mips_eb
4113         ;;
4114     mips64)
4115         CPUNAME=GODSON
4116         RTL_ARCH=MIPS_EB
4117         EPM_FLAGS="-a mips64"
4118         PLATFORMID=linux_mips_eb
4119         ;;
4120     mips64el)
4121         CPUNAME=GODSON
4122         RTL_ARCH=MIPS_EL
4123         EPM_FLAGS="-a mips64el"
4124         PLATFORMID=linux_mips_el
4125         ;;
4126     mipsel)
4127         CPUNAME=GODSON
4128         RTL_ARCH=MIPS_EL
4129         EPM_FLAGS="-a mipsel"
4130         PLATFORMID=linux_mips_el
4131         ;;
4132     m68k)
4133         CPUNAME=M68K
4134         RTL_ARCH=M68K
4135         PLATFORMID=linux_m68k
4136         ;;
4137     powerpc)
4138         CPUNAME=POWERPC
4139         RTL_ARCH=PowerPC
4140         PLATFORMID=linux_powerpc
4141         ;;
4142     powerpc64)
4143         CPUNAME=POWERPC64
4144         RTL_ARCH=PowerPC_64
4145         PLATFORMID=linux_powerpc64
4146         ;;
4147     powerpc64le)
4148         CPUNAME=POWERPC64
4149         RTL_ARCH=PowerPC_64_LE
4150         PLATFORMID=linux_powerpc64_le
4151         ;;
4152     sparc)
4153         CPUNAME=SPARC
4154         RTL_ARCH=SPARC
4155         PLATFORMID=linux_sparc
4156         ;;
4157     s390)
4158         CPUNAME=S390
4159         RTL_ARCH=S390
4160         PLATFORMID=linux_s390
4161         ;;
4162     s390x)
4163         CPUNAME=S390X
4164         RTL_ARCH=S390x
4165         PLATFORMID=linux_s390x
4166         ;;
4167     x86_64)
4168         CPUNAME=X86_64
4169         RTL_ARCH=X86_64
4170         PLATFORMID=linux_x86_64
4171         ;;
4172     *)
4173         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4174         ;;
4175     esac
4176     ;;
4178 linux-android*)
4179     COM=GCC
4180     GUIBASE=not-used
4181     OS=ANDROID
4182     RTL_OS=Android
4183     P_SEP=:
4185     case "$host_cpu" in
4187     arm|armel)
4188         CPUNAME=ARM
4189         RTL_ARCH=ARM_EABI
4190         PLATFORMID=android_arm_eabi
4191         ;;
4192     aarch64)
4193         CPUNAME=AARCH64
4194         RTL_ARCH=AARCH64
4195         PLATFORMID=android_aarch64
4196         ;;
4197     mips|mipsel)
4198         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4199         RTL_ARCH=MIPS_EL
4200         PLATFORMID=android_mips_el
4201         ;;
4202     i*86)
4203         CPUNAME=INTEL
4204         RTL_ARCH=x86
4205         PLATFORMID=android_x86
4206         ;;
4207     *)
4208         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4209         ;;
4210     esac
4211     ;;
4213 mingw*)
4214     COM=GCC
4215     GUIBASE=not-used
4216     OS=WNT
4217     RTL_OS=Windows
4218     P_SEP=:
4220     case "$host_cpu" in
4221     i*86|x86_64)
4222         if test "$BITNESS_OVERRIDE" = 64; then
4223             CPUNAME=X86_64
4224             RTL_ARCH=X86_84
4225             PLATFORMID=windows_x86_64
4226             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4227         else
4228             CPUNAME=INTEL
4229             RTL_ARCH=x86
4230             PLATFORMID=windows_x86
4231             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4232         fi
4233         ;;
4234     *)
4235         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4236         ;;
4237     esac
4238     ;;
4240 *netbsd*)
4242     COM=GCC
4243     GUIBASE=unx
4244     OS=NETBSD
4245     RTL_OS=NetBSD
4246     P_SEP=:
4248     case "$host_cpu" in
4249     i*86)
4250         CPUNAME=INTEL
4251         RTL_ARCH=x86
4252         PLATFORMID=netbsd_x86
4253         ;;
4254     powerpc)
4255         CPUNAME=POWERPC
4256         RTL_ARCH=PowerPC
4257         PLATFORMID=netbsd_powerpc
4258         ;;
4259     sparc)
4260         CPUNAME=SPARC
4261         RTL_ARCH=SPARC
4262         PLATFORMID=netbsd_sparc
4263         ;;
4264     x86_64)
4265         CPUNAME=X86_64
4266         RTL_ARCH=X86_64
4267         PLATFORMID=netbsd_x86_64
4268         ;;
4269     *)
4270         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4271         ;;
4272     esac
4273     ;;
4275 openbsd*)
4276     COM=GCC
4277     GUIBASE=unx
4278     OS=OPENBSD
4279     RTL_OS=OpenBSD
4280     P_SEP=:
4282     case "$host_cpu" in
4283     i*86)
4284         CPUNAME=INTEL
4285         RTL_ARCH=x86
4286         PLATFORMID=openbsd_x86
4287         ;;
4288     x86_64)
4289         CPUNAME=X86_64
4290         RTL_ARCH=X86_64
4291         PLATFORMID=openbsd_x86_64
4292         ;;
4293     *)
4294         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4295         ;;
4296     esac
4297     SOLARINC="$SOLARINC -I/usr/local/include"
4298     ;;
4300 solaris*)
4302     COM=GCC
4303     GUIBASE=unx
4304     OS=SOLARIS
4305     RTL_OS=Solaris
4306     P_SEP=:
4308     case "$host_cpu" in
4309     i*86)
4310         CPUNAME=INTEL
4311         RTL_ARCH=x86
4312         PLATFORMID=solaris_x86
4313         ;;
4314     sparc)
4315         CPUNAME=SPARC
4316         RTL_ARCH=SPARC
4317         PLATFORMID=solaris_sparc
4318         ;;
4319     sparc64)
4320         CPUNAME=SPARC64
4321         RTL_ARCH=SPARC64
4322         PLATFORMID=solaris_sparc64
4323         ;;
4324     *)
4325         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4326         ;;
4327     esac
4328     SOLARINC="$SOLARINC -I/usr/local/include"
4329     ;;
4332     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4333     ;;
4334 esac
4336 if test "$with_x" = "no"; then
4337     if test "$GUIBASE" != "unx"; then
4338         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --without-x])
4339     fi
4340     GUIBASE=not-used
4343 WORKDIR="${BUILDDIR}/workdir"
4344 INSTDIR="${BUILDDIR}/instdir"
4345 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4346 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4347 AC_SUBST(COM)
4348 AC_SUBST(CPUNAME)
4349 AC_SUBST(RTL_OS)
4350 AC_SUBST(RTL_ARCH)
4351 AC_SUBST(EPM_FLAGS)
4352 AC_SUBST(GUIBASE)
4353 AC_SUBST([INSTDIR])
4354 AC_SUBST([INSTROOT])
4355 AC_SUBST(OS)
4356 AC_SUBST(P_SEP)
4357 AC_SUBST(WORKDIR)
4358 AC_SUBST(PLATFORMID)
4359 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4361 dnl ===================================================================
4362 dnl Test which package format to use
4363 dnl ===================================================================
4364 AC_MSG_CHECKING([which package format to use])
4365 if test -n "$with_package_format" -a "$with_package_format" != no; then
4366     for i in $with_package_format; do
4367         case "$i" in
4368         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4369             ;;
4370         *)
4371             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4372 aix - AIX software distribution
4373 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4374 deb - Debian software distribution
4375 pkg - Solaris software distribution
4376 rpm - RedHat software distribution
4378 LibreOffice additionally supports:
4379 archive - .tar.gz or .zip
4380 dmg - Mac OS X .dmg
4381 installed - installation tree
4382 msi - Windows .msi
4383         ])
4384             ;;
4385         esac
4386     done
4387     PKGFORMAT="$with_package_format"
4388     AC_MSG_RESULT([$PKGFORMAT])
4389 else
4390     PKGFORMAT=
4391     AC_MSG_RESULT([none])
4393 AC_SUBST(PKGFORMAT)
4395 dnl ===================================================================
4396 dnl Set up a different compiler to produce tools to run on the build
4397 dnl machine when doing cross-compilation
4398 dnl ===================================================================
4400 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4401 if test "$cross_compiling" = "yes"; then
4402     AC_MSG_CHECKING([for BUILD platform configuration])
4403     echo
4404     rm -rf CONF-FOR-BUILD config_build.mk
4405     mkdir CONF-FOR-BUILD
4406     # Here must be listed all files needed when running the configure script. In particular, also
4407     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4408     # keep them in the same order as there.
4409     (cd $SRC_ROOT && tar cf - \
4410         config.guess \
4411         bin/get_config_variables \
4412         solenv/bin/getcompver.awk \
4413         solenv/inc/langlist.mk \
4414         android/experimental/LOAndroid3/AndroidManifest.xml.in \
4415         config_host.mk.in \
4416         Makefile.in \
4417         lo.xcent.in \
4418         instsetoo_native/util/openoffice.lst.in \
4419         config_host/*.in \
4420         sysui/desktop/macosx/Info.plist.in \
4421         ios/lo.xcconfig.in) \
4422     | (cd CONF-FOR-BUILD && tar xf -)
4423     cp configure CONF-FOR-BUILD
4424     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4425     (
4426     unset COM GUIBASE OS CPUNAME
4427     unset CC CXX SYSBASE CFLAGS
4428     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4429     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4430     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4431     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4432     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4433     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4434     cd CONF-FOR-BUILD
4435     sub_conf_opts=""
4436     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4437     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4438     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4439     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4440     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4441     # we need the msi build tools on mingw if we are creating the
4442     # installation set
4443     if test "$WITH_MINGW" = "yes"; then
4444         enable_winegcc_for_build=
4445         for pkgformat in $PKGFORMAT; do
4446             case "$pkgformat" in
4447             msi|native) enable_winegcc_for_build=yes ;;
4448             esac
4449         done
4450         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4451     fi
4452     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4453     # Don't bother having configure look for stuff not needed for the build platform anyway
4454     ./configure \
4455         --disable-cups \
4456         --disable-graphite \
4457         --disable-pdfimport \
4458         --disable-postgresql-sdbc \
4459         --with-parallelism="$with_parallelism" \
4460         --without-doxygen \
4461         --without-java \
4462         $sub_conf_opts \
4463         --srcdir=$srcdir \
4464         2>&1 | sed -e 's/^/    /'
4465     test -f ./config_host.mk 2>/dev/null || exit
4466     cp config_host.mk ../config_build.mk
4467     mv config.log ../config.Build.log
4468     mkdir -p ../config_build
4469     mv config_host/*.h ../config_build
4470     . ./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
4472     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
4473         VV='$'$V
4474         VV=`eval "echo $VV"`
4475         if test -n "$VV"; then
4476             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4477             echo "$line" >>build-config
4478         fi
4479     done
4481     for V in INSTDIR INSTROOT WORKDIR; do
4482         VV='$'$V
4483         VV=`eval "echo $VV"`
4484         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4485         if test -n "$VV"; then
4486             line="${V}_FOR_BUILD='$VV'"
4487             echo "$line" >>build-config
4488         fi
4489     done
4491     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4492     echo "$line" >>build-config
4494     )
4495     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4496     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])
4497     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4498              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4500     eval `cat CONF-FOR-BUILD/build-config`
4502     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4504     rm -rf CONF-FOR-BUILD
4505 else
4506     OS_FOR_BUILD="$OS"
4507     CC_FOR_BUILD="$CC"
4508     CXX_FOR_BUILD="$CXX"
4509     INSTDIR_FOR_BUILD="$INSTDIR"
4510     INSTROOT_FOR_BUILD="$INSTROOT"
4511     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4512     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4513     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4514     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4515     WORKDIR_FOR_BUILD="$WORKDIR"
4517 AC_SUBST(OS_FOR_BUILD)
4518 AC_SUBST(INSTDIR_FOR_BUILD)
4519 AC_SUBST(INSTROOT_FOR_BUILD)
4520 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4521 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4522 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4523 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4524 AC_SUBST(WORKDIR_FOR_BUILD)
4526 dnl ===================================================================
4527 dnl Check for syslog header
4528 dnl ===================================================================
4529 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4531 dnl ===================================================================
4532 dnl Set the ENABLE_CRASHDUMP variable.
4533 dnl ===================================================================
4534 AC_MSG_CHECKING([whether to enable crashdump feature])
4535 if test "$enable_crashdump" = "yes"; then
4536     ENABLE_CRASHDUMP="TRUE"
4537     BUILD_TYPE="$BUILD_TYPE CRASHREP"
4538     AC_MSG_RESULT([yes])
4539     AC_DEFINE(HAVE_FEATURE_CRASHDUMP)
4540 else
4541     ENABLE_CRASHDUMP=""
4542     AC_MSG_RESULT([no])
4544 AC_SUBST(ENABLE_CRASHDUMP)
4547 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4548 dnl ===================================================================
4549 AC_MSG_CHECKING([whether to turn warnings to errors])
4550 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4551     ENABLE_WERROR="TRUE"
4552     AC_MSG_RESULT([yes])
4553 else
4554     AC_MSG_RESULT([no])
4556 AC_SUBST(ENABLE_WERROR)
4558 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4559 dnl ===================================================================
4560 AC_MSG_CHECKING([whether to have assert to abort in release code])
4561 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4562     ASSERT_ALWAYS_ABORT="TRUE"
4563     AC_MSG_RESULT([yes])
4564 else
4565     ASSERT_ALWAYS_ABORT="FALSE"
4566     AC_MSG_RESULT([no])
4568 AC_SUBST(ASSERT_ALWAYS_ABORT)
4570 # Determine whether to use ooenv for the instdir installation
4571 # ===================================================================
4572 if test $_os != "WINNT" -a $_os != "Darwin"; then
4573     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4574     if test "$enable_ooenv" = "no"; then
4575         AC_MSG_RESULT([no])
4576     else
4577         ENABLE_OOENV="TRUE"
4578         AC_MSG_RESULT([yes])
4579     fi
4581 AC_SUBST(ENABLE_OOENV)
4583 if test "$with_x" = "no"; then
4584     # be sure to do not mess with uneeded stuff
4585     test_randr=no
4586     test_xrender=no
4587     test_cups=no
4588     test_dbus=no
4589     test_fontconfig=yes
4590     test_gtk=no
4591     build_gstreamer_1_0=no
4592     build_gstreamer_0_10=no
4593     test_tde=no
4594     test_kde=no
4595     test_kde4=no
4596     enable_cairo_canvas=no
4597     enable_gnome_vfs=no
4600 dnl ===================================================================
4601 dnl check for cups support
4602 dnl ===================================================================
4603 ENABLE_CUPS=""
4605 if test "$enable_cups" = "no"; then
4606     test_cups=no
4609 AC_MSG_CHECKING([whether to enable CUPS support])
4610 if test "$test_cups" = "yes"; then
4611     ENABLE_CUPS="TRUE"
4612     AC_MSG_RESULT([yes])
4614     AC_MSG_CHECKING([whether cups support is present])
4615     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4616     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4617     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4618         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4619     fi
4621 else
4622     AC_MSG_RESULT([no])
4625 AC_SUBST(ENABLE_CUPS)
4627 # fontconfig checks
4628 if test "$test_fontconfig" = "yes"; then
4629     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4630     SYSTEM_FONTCONFIG=TRUE
4632 AC_SUBST(FONTCONFIG_CFLAGS)
4633 AC_SUBST(FONTCONFIG_LIBS)
4634 AC_SUBST([SYSTEM_FONTCONFIG])
4636 dnl whether to find & fetch external tarballs?
4637 dnl ===================================================================
4638 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4639    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4640        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4641    else
4642        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4643    fi
4645 if test -z "$TARFILE_LOCATION"; then
4646     if test -d "$SRC_ROOT/src" ; then
4647         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4648         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4649     fi
4650     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4651 else
4652     AbsolutePath "$TARFILE_LOCATION"
4653     PathFormat "${absolute_path}"
4654     TARFILE_LOCATION="${formatted_path}"
4656 AC_SUBST(TARFILE_LOCATION)
4658 AC_MSG_CHECKING([whether we want to fetch tarballs])
4659 if test "$enable_fetch_external" != "no"; then
4660     if test "$with_all_tarballs" = "yes"; then
4661         AC_MSG_RESULT(["yes, all of them"])
4662         DO_FETCH_TARBALLS="ALL"
4663     else
4664         AC_MSG_RESULT(["yes, if we use them"])
4665         DO_FETCH_TARBALLS="TRUE"
4666     fi
4667 else
4668     AC_MSG_RESULT([no])
4669     DO_FETCH_TARBALLS=
4671 AC_SUBST(DO_FETCH_TARBALLS)
4673 AC_MSG_CHECKING([whether to build help])
4674 HELP_COMMON_ONLY=FALSE
4675 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4676     BUILD_TYPE="$BUILD_TYPE HELP"
4677     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4678     if test "$with_help" = "common" ; then
4679         HELP_COMMON_ONLY=TRUE
4680         AC_MSG_RESULT([common only])
4681     else
4682         SCPDEFS="$SCPDEFS -DWITH_HELP"
4683         AC_MSG_RESULT([yes])
4684     fi
4685 else
4686     AC_MSG_RESULT([no])
4688 AC_SUBST(HELP_COMMON_ONLY)
4690 dnl Test whether to include MySpell dictionaries
4691 dnl ===================================================================
4692 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4693 if test "$with_myspell_dicts" = "yes"; then
4694     AC_MSG_RESULT([yes])
4695     WITH_MYSPELL_DICTS=TRUE
4696     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4697     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4698 else
4699     AC_MSG_RESULT([no])
4700     WITH_MYSPELL_DICTS=
4702 AC_SUBST(WITH_MYSPELL_DICTS)
4704 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4705 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4706     if test "$with_system_dicts" = yes; then
4707         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4708     fi
4709     with_system_dicts=no
4712 AC_MSG_CHECKING([whether to use dicts from external paths])
4713 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4714     AC_MSG_RESULT([yes])
4715     SYSTEM_DICTS=TRUE
4716     AC_MSG_CHECKING([for spelling dictionary directory])
4717     if test -n "$with_external_dict_dir"; then
4718         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4719     else
4720         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4721         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4722             DICT_SYSTEM_DIR=file:///usr/share/myspell
4723         fi
4724     fi
4725     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4726     AC_MSG_CHECKING([for hyphenation patterns directory])
4727     if test -n "$with_external_hyph_dir"; then
4728         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4729     else
4730         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4731     fi
4732     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4733     AC_MSG_CHECKING([for thesaurus directory])
4734     if test -n "$with_external_thes_dir"; then
4735         THES_SYSTEM_DIR=file://$with_external_thes_dir
4736     else
4737         THES_SYSTEM_DIR=file:///usr/share/mythes
4738     fi
4739     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4740 else
4741     AC_MSG_RESULT([no])
4742     SYSTEM_DICTS=
4744 AC_SUBST(SYSTEM_DICTS)
4745 AC_SUBST(DICT_SYSTEM_DIR)
4746 AC_SUBST(HYPH_SYSTEM_DIR)
4747 AC_SUBST(THES_SYSTEM_DIR)
4749 dnl ===================================================================
4750 AC_MSG_CHECKING([whether to enable pch feature])
4751 if test -n "$enable_pch" && test "$enable_pch" != "no"; then
4752     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4753         ENABLE_PCH="TRUE"
4754         AC_MSG_RESULT([yes])
4755     elif test "$GCC" = "yes"; then
4756         ENABLE_PCH="TRUE"
4757         AC_MSG_RESULT([yes])
4758     else
4759         ENABLE_PCH=""
4760         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4761     fi
4762 else
4763     ENABLE_PCH=""
4764     AC_MSG_RESULT([no])
4766 AC_SUBST(ENABLE_PCH)
4768 TAB=`printf '\t'`
4770 AC_MSG_CHECKING([the GNU Make version])
4771 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4772 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4773 if test "$_make_longver" -ge "038200"; then
4774     AC_MSG_RESULT([$GNUMAKE $_make_version])
4776 elif test "$_make_longver" -ge "038100"; then
4777     if test "$build_os" = "cygwin"; then
4778         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4779     fi
4780     AC_MSG_RESULT([$GNUMAKE $_make_version])
4782     dnl ===================================================================
4783     dnl Search all the common names for sha1sum
4784     dnl ===================================================================
4785     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4786     if test -z "$SHA1SUM"; then
4787         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4788     elif test "$SHA1SUM" = "openssl"; then
4789         SHA1SUM="openssl sha1"
4790     fi
4791     AC_MSG_CHECKING([for GNU Make bug 20033])
4792     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4793     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4794 A := \$(wildcard *.a)
4796 .PHONY: all
4797 all: \$(A:.a=.b)
4798 <TAB>@echo survived bug20033.
4800 .PHONY: setup
4801 setup:
4802 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4804 define d1
4805 @echo lala \$(1)
4806 @sleep 1
4807 endef
4809 define d2
4810 @echo tyty \$(1)
4811 @sleep 1
4812 endef
4814 %.b : %.a
4815 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4816 <TAB>\$(call d1,\$(CHECKSUM)),\
4817 <TAB>\$(call d2,\$(CHECKSUM)))
4819     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4820         no_parallelism_make="YES"
4821         AC_MSG_RESULT([yes, disable parallelism])
4822     else
4823         AC_MSG_RESULT([no, keep parallelism enabled])
4824     fi
4825     rm -rf $TESTGMAKEBUG20033
4826 else
4827     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4830 # find if gnumake support file function
4831 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4832 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4833 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4834     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4836 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4837 \$(file >test.txt,Success )
4839 .PHONY: all
4840 all:
4841 <TAB>@cat test.txt
4844 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4845 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4846     HAVE_GNUMAKE_FILE_FUNC=TRUE
4847     AC_MSG_RESULT([yes])
4848 else
4849     AC_MSG_RESULT([no])
4851 rm -rf $TESTGMAKEFILEFUNC
4852 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4853 AC_SUBST(GNUMAKE_WIN_NATIVE)
4855 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4856 STALE_MAKE=
4857 if test "$_make_ver_check" = ""; then
4858    STALE_MAKE=TRUE
4861 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4862     SHELL_BASH=$(cygpath -m $(which bash))
4863 else
4864     SHELL_BASH=`which bash`
4866 AC_SUBST(SHELL_BASH)
4868 HAVE_LD_HASH_STYLE=FALSE
4869 WITH_LINKER_HASH_STYLE=
4870 AC_MSG_CHECKING( for --hash-style gcc linker support )
4871 if test "$GCC" = "yes"; then
4872     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4873         hash_styles="gnu sysv"
4874     elif test "$with_linker_hash_style" = "no"; then
4875         hash_styles=
4876     else
4877         hash_styles="$with_linker_hash_style"
4878     fi
4880     for hash_style in $hash_styles; do
4881         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4882         hash_style_ldflags_save=$LDFLAGS
4883         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4885         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4886             [
4887 #include <stdio.h>
4888             ],[
4889 printf ("");
4890             ])],
4891             [
4892                   HAVE_LD_HASH_STYLE=TRUE
4893                   WITH_LINKER_HASH_STYLE=$hash_style
4894             ],
4895             [HAVE_LD_HASH_STYLE=FALSE],
4896             [HAVE_LD_HASH_STYLE=FALSE])
4897         LDFLAGS=$hash_style_ldflags_save
4898     done
4900     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4901         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4902     else
4903         AC_MSG_RESULT( no )
4904     fi
4905     LDFLAGS=$hash_style_ldflags_save
4906 else
4907     AC_MSG_RESULT( no )
4909 AC_SUBST(HAVE_LD_HASH_STYLE)
4910 AC_SUBST(WITH_LINKER_HASH_STYLE)
4912 dnl ===================================================================
4913 dnl Check whether there's a Perl version available.
4914 dnl ===================================================================
4915 if test -z "$with_perl_home"; then
4916     AC_PATH_PROG(PERL, perl)
4917 else
4918     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4919     _perl_path="$with_perl_home/bin/perl"
4920     if test -x "$_perl_path"; then
4921         PERL=$_perl_path
4922     else
4923         AC_MSG_ERROR([$_perl_path not found])
4924     fi
4927 dnl ===================================================================
4928 dnl Testing for Perl version 5 or greater.
4929 dnl $] is the Perl version variable, it is returned as an integer
4930 dnl ===================================================================
4931 if test "$PERL"; then
4932     AC_MSG_CHECKING([the Perl version])
4933     ${PERL} -e "exit($]);"
4934     _perl_version=$?
4935     if test "$_perl_version" -lt 5; then
4936         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
4937     fi
4938     AC_MSG_RESULT([checked (perl $_perl_version)])
4939 else
4940     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
4943 dnl ===================================================================
4944 dnl Testing for required Perl modules
4945 dnl ===================================================================
4947 AC_MSG_CHECKING([for required Perl modules])
4948 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
4949     AC_MSG_RESULT([all modules found])
4950 else
4951     AC_MSG_RESULT([failed to find some modules])
4952     # Find out which modules are missing.
4953     missing_perl_modules=
4954     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
4955         missing_perl_modules=Archive::Zip
4956     fi
4957     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
4958         missing_perl_modules="$missing_perl_modules Cwd"
4959     fi
4960     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
4961         missing_perl_modules="$missing_perl_modules Digest::MD5"
4962     fi
4963        AC_MSG_ERROR([
4964     The missing Perl modules are: $missing_perl_modules
4965     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
4968 dnl ===================================================================
4969 dnl Check for pkg-config
4970 dnl ===================================================================
4971 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4972     PKG_PROG_PKG_CONFIG
4975 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
4977     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
4978     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
4979     # explicitly. Or put /path/to/compiler in PATH yourself.
4981     AC_CHECK_TOOL(AR,ar)
4982     AC_CHECK_TOOL(NM,nm)
4983     AC_CHECK_TOOL(OBJDUMP,objdump)
4984     AC_CHECK_TOOL(RANLIB,ranlib)
4985     AC_CHECK_TOOL(READELF,readelf)
4986     AC_CHECK_TOOL(STRIP,strip)
4987     if test "$_os" = "WINNT"; then
4988         AC_CHECK_TOOL(DLLTOOL,dlltool)
4989         AC_CHECK_TOOL(WINDRES,windres)
4990     fi
4992 AC_SUBST(AR)
4993 AC_SUBST(DLLTOOL)
4994 AC_SUBST(NM)
4995 AC_SUBST(OBJDUMP)
4996 AC_SUBST(PKG_CONFIG)
4997 AC_SUBST(RANLIB)
4998 AC_SUBST(READELF)
4999 AC_SUBST(STRIP)
5000 AC_SUBST(WINDRES)
5002 dnl ===================================================================
5003 dnl pkg-config checks on Mac OS X
5004 dnl ===================================================================
5006 if test $_os = Darwin; then
5007     AC_MSG_CHECKING([for bogus pkg-config])
5008     if test -n "$PKG_CONFIG"; then
5009         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5010             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5011         else
5012             if test "$enable_bogus_pkg_config" = "yes"; then
5013                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5014             else
5015                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please remove or hide $PKG_CONFIG])
5016             fi
5017         fi
5018     else
5019         AC_MSG_RESULT([no, good])
5020     fi
5023 find_csc()
5025     # Return value: $csctest
5027     unset csctest
5029     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5030     if test -n "$regvalue"; then
5031         csctest=$regvalue
5032         return
5033     fi
5036 find_al()
5038     # Return value: $altest
5040     unset altest
5042     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5043         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5044         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5045             altest=$regvalue
5046             return
5047         fi
5048     done
5051 find_dotnetsdk()
5053     # Return value: $frametest (that's a silly name...)
5055     unset frametest
5057     for ver in 1.1 2.0; do
5058         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5059         if test -n "$regvalue"; then
5060             frametest=$regvalue
5061             return
5062         fi
5063     done
5066 find_winsdk_version()
5068     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5069     # Return values: $winsdktest, $winsdklibsubdir
5071     unset winsdktest winsdklibsubdir
5073     # Why we look for them in this particular order I don't know. But OTOH I
5074     case "$1" in
5075     6.0*|7.*)
5076         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5077         if test -n "$regvalue"; then
5078             winsdktest=$regvalue
5079             winsdklibsubdir=.
5080             return
5081         fi
5082         ;;
5083     8.1|8.1A)
5084         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5085         if test -n "$regvalue"; then
5086             winsdktest=$regvalue
5087             winsdklibsubdir=winv6.3
5088             return
5089         fi
5090         ;;
5091     8.0|8.0A)
5092         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5093         if test -n "$regvalue"; then
5094             winsdktest=$regvalue
5095             winsdklibsubdir=win8
5096             return
5097         fi
5098         ;;
5099     esac
5102 find_winsdk()
5104     # Args: $1 (optional) : list of acceptable SDK versions
5105     # Return value: $winsdktest
5107     unset winsdktest
5109     if test -n "$1"; then
5110         sdkversions=$1
5111     else
5112         sdkversions="$WINDOWS_SDK_ACCEPTABLE_VERSIONS"
5113     fi
5115     for ver in $sdkversions; do
5116         find_winsdk_version $ver
5117         if test -n "$winsdktest"; then
5118             return
5119         fi
5120     done
5123 find_msms()
5125     for ver in 10.0 11.0; do
5126         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5127         if test -n "$regvalue"; then
5128             if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
5129                 msmdir=$regvalue
5130                 break
5131             fi
5132         fi
5133     done
5134     if test -z "$msmdir"; then
5135         AC_MSG_NOTICE([no registry entry for Merge Module directory - trying "${COMMONPROGRAMFILES}/Merge Modules/"])
5136         msmdir="${COMMONPROGRAMFILES}/Merge Modules/"
5137     fi
5138     msmdir=`cygpath -m "$msmdir"`
5139     if test -z "$msmdir"; then
5140         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5141             AC_MSG_ERROR([Merge modules not found in $msmdir])
5142         else
5143             AC_MSG_WARN([Merge modules not found in $msmdir])
5144             msmdir=""
5145         fi
5146     fi
5149 find_msvc_x64_dlls()
5151     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5152     msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5153     for dll in $msvcdlls; do
5154         if ! test -f "$msvcdllpath/$dll"; then
5155             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5156         fi
5157     done
5160 if test "$build_os" = "cygwin"; then
5161     dnl Check midl.exe
5162     AC_MSG_CHECKING([for midl.exe])
5164     find_winsdk
5165     if test -f "$winsdktest/Bin/midl.exe"; then
5166         MIDL_PATH="$winsdktest/Bin"
5167     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5168         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5169     fi
5170     if test ! -f "$MIDL_PATH/midl.exe"; then
5171         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5172     else
5173         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5174     fi
5176     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5177     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5179     dnl Check csc.exe
5180     AC_MSG_CHECKING([for csc.exe])
5181     find_csc
5182     if test -f "$csctest/csc.exe"; then
5183         CSC_PATH="$csctest"
5184     fi
5185     if test ! -f "$CSC_PATH/csc.exe"; then
5186         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5187     else
5188         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5189     fi
5191     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5193     dnl Check al.exe
5194     AC_MSG_CHECKING([for al.exe])
5195     find_winsdk
5196     if test -f "$winsdktest/Bin/al.exe"; then
5197         AL_PATH="$winsdktest/Bin"
5198     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5199         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5200     fi
5202     if test -z "$AL_PATH"; then
5203         find_al
5204         if test -f "$altest/bin/al.exe"; then
5205             AL_PATH="$altest/bin"
5206         elif test -f "$altest/al.exe"; then
5207             AL_PATH="$altest"
5208         fi
5209     fi
5210     if test ! -f "$AL_PATH/al.exe"; then
5211         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5212     else
5213         AC_MSG_RESULT([$AL_PATH/al.exe])
5214     fi
5216     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5218     dnl Check mscoree.lib / .NET Framework dir
5219     AC_MSG_CHECKING(.NET Framework)
5220     find_dotnetsdk
5221     if test -f "$frametest/lib/mscoree.lib"; then
5222         DOTNET_FRAMEWORK_HOME="$frametest"
5223     else
5224         find_winsdk
5225         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5226             DOTNET_FRAMEWORK_HOME="$winsdktest"
5227         fi
5228     fi
5230     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5231         AC_MSG_ERROR([mscoree.lib not found])
5232     fi
5233     AC_MSG_RESULT(found)
5235     PathFormat "$MIDL_PATH"
5236     MIDL_PATH="$formatted_path"
5238     PathFormat "$AL_PATH"
5239     AL_PATH="$formatted_path"
5241     PathFormat "$DOTNET_FRAMEWORK_HOME"
5242     DOTNET_FRAMEWORK_HOME="$formatted_path"
5244     PathFormat "$CSC_PATH"
5245     CSC_PATH="$formatted_path"
5248 dnl ===================================================================
5249 dnl Check if stdc headers are available excluding MSVC.
5250 dnl ===================================================================
5251 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5252     AC_HEADER_STDC
5255 dnl ===================================================================
5256 dnl Testing for C++ compiler and version...
5257 dnl ===================================================================
5259 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5260     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5261     save_CXXFLAGS=$CXXFLAGS
5262     AC_PROG_CXX
5263     CXXFLAGS=$save_CXXFLAGS
5264 else
5265     if test -n "$CC" -a -z "$CXX"; then
5266         CXX="$CC"
5267     fi
5270 dnl check for GNU C++ compiler version
5271 if test "$GXX" = "yes"; then
5272     AC_MSG_CHECKING([the GNU C++ compiler version])
5274     _gpp_version=`$CXX -dumpversion`
5275     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5277     if test "$_gpp_majmin" -lt "401"; then
5278         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5279     else
5280         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5281     fi
5283     dnl see https://code.google.com/p/android/issues/detail?id=41770
5284     if test "$_gpp_majmin" -ge "401"; then
5285         glibcxx_threads=no
5286         AC_LANG_PUSH([C++])
5287         AC_REQUIRE_CPP
5288         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5289         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5290             #include <bits/c++config.h>]],[[
5291             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5292             && !defined(_GLIBCXX__PTHREADS) \
5293             && !defined(_GLIBCXX_HAS_GTHREADS)
5294             choke me
5295             #endif
5296         ]])],[AC_MSG_RESULT([yes])
5297         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5298         AC_LANG_POP([C++])
5299         if test $glibcxx_threads = yes; then
5300             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5301         fi
5302      fi
5304 AC_SUBST(BOOST_CXXFLAGS)
5307 # prefx CXX with ccache if needed
5309 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5310     if test "$CCACHE" != ""; then
5311         AC_MSG_CHECKING([whether $CXX is already ccached])
5312         AC_LANG_PUSH([C++])
5313         save_CXXFLAGS=$CXXFLAGS
5314         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5315         dnl an empty program will do, we're checking the compiler flags
5316         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5317                           [use_ccache=yes], [use_ccache=no])
5318         if test $use_ccache = yes; then
5319             AC_MSG_RESULT([yes])
5320         else
5321             CXX="$CCACHE $CXX"
5322             AC_MSG_RESULT([no])
5323         fi
5324         CXXFLAGS=$save_CXXFLAGS
5325         AC_LANG_POP([C++])
5326     fi
5329 dnl ===================================================================
5330 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5331 dnl ===================================================================
5333 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5334     AC_PROG_CXXCPP
5336     dnl Check whether there's a C pre-processor.
5337     AC_PROG_CPP
5341 dnl ===================================================================
5342 dnl Find integral type sizes and alignments
5343 dnl ===================================================================
5345 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5347     AC_CHECK_SIZEOF(long)
5348     AC_CHECK_SIZEOF(short)
5349     AC_CHECK_SIZEOF(int)
5350     AC_CHECK_SIZEOF(long long)
5351     AC_CHECK_SIZEOF(double)
5352     AC_CHECK_SIZEOF(void*)
5354     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5355     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5356     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5357     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5358     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5360     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5361     m4_pattern_allow([AC_CHECK_ALIGNOF])
5362     m4_ifdef([AC_CHECK_ALIGNOF],
5363         [
5364             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5365             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5366             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5367             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5368         ],
5369         [
5370             case "$_os-$host_cpu" in
5371             Linux-i686)
5372                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5373                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5374                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5375                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5376                 ;;
5377             Linux-x86_64)
5378                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5379                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5380                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5381                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5382                 ;;
5383             *)
5384                 if test -z "$ac_cv_alignof_short" -o \
5385                         -z "$ac_cv_alignof_int" -o \
5386                         -z "$ac_cv_alignof_long" -o \
5387                         -z "$ac_cv_alignof_double"; then
5388                    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.])
5389                 fi
5390                 ;;
5391             esac
5392         ])
5394     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5395     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5396     if test $ac_cv_sizeof_long -eq 8; then
5397         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5398     elif test $ac_cv_sizeof_double -eq 8; then
5399         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5400     else
5401         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5402     fi
5404     dnl Check for large file support
5405     AC_SYS_LARGEFILE
5406     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5407         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5408     fi
5409     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5410         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5411     fi
5412 else
5413     # Hardcode for MSVC
5414     SAL_TYPES_SIZEOFSHORT=2
5415     SAL_TYPES_SIZEOFINT=4
5416     SAL_TYPES_SIZEOFLONG=4
5417     SAL_TYPES_SIZEOFLONGLONG=8
5418     if test "$BITNESS_OVERRIDE" = ""; then
5419         SAL_TYPES_SIZEOFPOINTER=4
5420     else
5421         SAL_TYPES_SIZEOFPOINTER=8
5422     fi
5423     SAL_TYPES_ALIGNMENT2=2
5424     SAL_TYPES_ALIGNMENT4=4
5425     SAL_TYPES_ALIGNMENT8=8
5426     LFS_CFLAGS=''
5428 AC_SUBST(LFS_CFLAGS)
5430 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5431 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5432 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5433 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5434 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5435 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5436 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5437 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5439 dnl ===================================================================
5440 dnl Check whether to enable runtime optimizations
5441 dnl ===================================================================
5442 ENABLE_RUNTIME_OPTIMIZATIONS=
5443 AC_MSG_CHECKING([whether to enable runtime optimizations])
5444 if test -z "$enable_runtime_optimizations"; then
5445     for i in $CC; do
5446         case $i in
5447         -fsanitize=*)
5448             enable_runtime_optimizations=no
5449             break
5450             ;;
5451         esac
5452     done
5454 if test "$enable_runtime_optimizations" != no; then
5455     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5456     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5457     AC_MSG_RESULT([yes])
5458 else
5459     AC_MSG_RESULT([no])
5461 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5463 dnl ===================================================================
5464 dnl Check if valgrind headers are available
5465 dnl ===================================================================
5466 ENABLE_VALGRIND=
5467 if test "$cross_compiling" != yes; then
5468     prev_cppflags=$CPPFLAGS
5469     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5470     # or where does it come from?
5471     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5472     AC_CHECK_HEADER([valgrind/valgrind.h],
5473         [ENABLE_VALGRIND=TRUE])
5474     CPPFLAGS=$prev_cppflags
5476 AC_SUBST([ENABLE_VALGRIND])
5477 if test -z "$ENABLE_VALGRIND"; then
5478     VALGRIND_CFLAGS=
5480 AC_SUBST([VALGRIND_CFLAGS])
5483 dnl ===================================================================
5484 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5485 dnl ===================================================================
5487 # We need at least the sys/sdt.h include header.
5488 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5489 if test "$SDT_H_FOUND" = "TRUE"; then
5490     # Found sys/sdt.h header, now make sure the c++ compiler works.
5491     # Old g++ versions had problems with probes in constructors/destructors.
5492     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5493     AC_LANG_PUSH([C++])
5494     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5495     #include <sys/sdt.h>
5496     class ProbeClass
5497     {
5498     private:
5499       int& ref;
5500       const char *name;
5502     public:
5503       ProbeClass(int& v, const char *n) : ref(v), name(n)
5504       {
5505         DTRACE_PROBE2(_test_, cons, name, ref);
5506       }
5508       void method(int min)
5509       {
5510         DTRACE_PROBE3(_test_, meth, name, ref, min);
5511         ref -= min;
5512       }
5514       ~ProbeClass()
5515       {
5516         DTRACE_PROBE2(_test_, dest, name, ref);
5517       }
5518     };
5519     ]],[[
5520     int i = 64;
5521     DTRACE_PROBE1(_test_, call, i);
5522     ProbeClass inst = ProbeClass(i, "call");
5523     inst.method(24);
5524     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5525           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5526     AC_LANG_POP([C++])
5528 AC_CONFIG_HEADERS([config_host/config_probes.h])
5530 dnl ===================================================================
5531 dnl Set the MinGW sys-root
5532 dnl ===================================================================
5533 if test "$WITH_MINGW" = "yes"; then
5534     AC_MSG_CHECKING([for MinGW sysroot])
5535     sysroot=`$CC -print-sysroot`
5536     AS_IF([test -d "$sysroot"/mingw],
5537           [MINGW_SYSROOT="$sysroot"/mingw
5538            AC_MSG_RESULT([$MINGW_SYSROOT])],
5539           [AC_MSG_RESULT([not found])
5540            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5542 AC_SUBST([MINGW_DLLS])
5543 AC_SUBST([MINGW_SYSROOT])
5545 dnl ===================================================================
5546 dnl Set the MinGW include directories
5547 dnl ===================================================================
5548 if test "$WITH_MINGW" = "yes"; then
5549     AC_MSG_CHECKING([for MinGW include path])
5550     cat >conftest.$ac_ext <<_ACEOF
5551 #include <stddef.h>
5552 #include <bits/c++config.h>
5553 _ACEOF
5554     _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`
5555     rm conftest.$ac_ext
5556     if test -z "$_mingw_lib_include_path"; then
5557         _mingw_lib_include_path="NO_LIB_INCLUDE"
5558         AC_MSG_RESULT([no MinGW include path])
5559     else
5560         AC_MSG_RESULT([$_mingw_lib_include_path])
5561     fi
5562     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5563     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5565     AC_LANG_PUSH([C++])
5567     AC_MSG_CHECKING([for dynamic libgcc])
5568     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5569 #include <iostream>
5570 using namespace std;
5571 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5572             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5573             if test -n "$MINGW_GCCDLL"; then
5574                 MINGW_SHARED_GCCLIB=TRUE
5575                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5576             else
5577                 MINGW_SHARED_GCCLIB=
5578                 AC_MSG_RESULT([no])
5579             fi
5580        ],[ AC_MSG_RESULT([no])
5582     ])
5584     AC_MSG_CHECKING([for dynamic libstdc++])
5585     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5586 #include <iostream>
5587 using namespace std;
5588 ]], [[ cout << "Hello there." << endl; ]])],[
5589             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5590             if test -n "$MINGW_GXXDLL"; then
5591                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5592                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5593                 if test "$CROSS_COMPILING" = "TRUE"; then
5594                     dnl m4 escaping!
5595                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5596                 fi
5597                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5598                 MINGW_SHARED_GXXLIB=TRUE
5599                 AC_MSG_RESULT([$MINGW_GXXDLL])
5600             else
5601                 MINGW_SHARED_GXXLIB=
5602                 AC_MSG_RESULT([no])
5603             fi
5604        ],[ AC_MSG_RESULT([no])
5606     ])
5608     AC_LANG_POP([C++])
5610     AC_SUBST(MINGW_SHARED_GCCLIB)
5611     AC_SUBST(MINGW_SHARED_GXXLIB)
5612     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5613     AC_SUBST(MINGW_GCCDLL)
5614     AC_SUBST(MINGW_GXXDLL)
5617 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
5618     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5621 if test "$WITH_MINGW" = "yes"; then
5622     AC_MSG_CHECKING([for fMergeNeutralItems in SCRIPT_CONTROL])
5623     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5624     [
5625     #include <usp10.h>
5626     ],
5627     [
5628     SCRIPT_CONTROL c;
5629     c.fMergeNeutralItems = 1;
5630     ])],
5631     [
5632     AC_MSG_RESULT(yes)
5633     AC_DEFINE(HAVE_FMERGENEUTRALITEMS)
5634     ],
5635     [AC_MSG_RESULT(no)])
5638 dnl *************************************************************
5639 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5640 dnl *************************************************************
5641 if test "$WITH_MINGW" = "yes"; then
5642     AC_MSG_CHECKING([exception type])
5643     AC_LANG_PUSH([C++])
5644     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5646         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5648         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5649     ])
5650     AC_MSG_RESULT($exceptions_type)
5651     AC_LANG_POP([C++])
5654 EXCEPTIONS="$exceptions_type"
5655 AC_SUBST(EXCEPTIONS)
5657 dnl ===================================================================
5658 dnl thread-safe statics
5659 dnl ===================================================================
5660 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5661 unset HAVE_THREADSAFE_STATICS
5662 if test "$GCC" = "yes"; then
5663     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5664     dnl us.  However, some C++ runtimes use a single lock for all static
5665     dnl variables, which can cause deadlock in multi-threaded applications.
5666     dnl This is not easily tested here; for POSIX-based systems, if executing
5667     dnl the following C++ program does not terminate then the tool chain
5668     dnl apparently has this problem:
5669     dnl
5670     dnl   #include <pthread.h>
5671     dnl   int h() { return 0; }
5672     dnl   void * g(void * unused) {
5673     dnl     static int n = h();
5674     dnl     return &n;
5675     dnl   }
5676     dnl   int f() {
5677     dnl     pthread_t t;
5678     dnl     pthread_create(&t, 0, g, 0);
5679     dnl     pthread_join(t, 0);
5680     dnl     return 0;
5681     dnl   }
5682     dnl   int main() {
5683     dnl     static int n = f();
5684     dnl     return n;
5685     dnl   }
5686     dnl
5687     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5688     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5689     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5690     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5691     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5692     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5693     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5694     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5695     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5696     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5697     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5698     dnl "too old"):
5699     if test "$_os" = Darwin; then
5700         dnl On Mac OS X, both /usr/lib/libstdc++.6.dylib and
5701         dnl /usr/lib/libc++1.dylib delegate to /usr/lib/libc++abi.dylib for the
5702         dnl __cxa_guard_* functionality; up to 10.8, libc++abi.dylib is
5703         dnl apparently provided by a libcppabi project that has broken semantics
5704         dnl (cf. <http://www.opensource.apple.com/source/libcppabi/libcppabi-26/
5705         dnl src/cxa_guard.cxx>), while in 10.9 (verified at least on 10.9.4) it
5706         dnl is apparently provided by LLVM's libcxxabi project, which has good
5707         dnl semantics (cf. <http://llvm.org/svn/llvm-project/libcxxabi/trunk/
5708         dnl src/cxa_guard.cpp>):
5709         if test "$MAC_OS_X_VERSION_MIN_REQUIRED" -ge 1090; then
5710             HAVE_THREADSAFE_STATICS=TRUE
5711         fi
5712     elif test "$_os" != Android; then
5713         if test "$COM_GCC_IS_CLANG" = TRUE; then
5714             AC_LANG_PUSH([C++])
5715             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5716 #include <list>
5717 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5718 #error
5719 #endif
5720                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5721             AC_LANG_POP([C++])
5722         else # known to work in GCC since version 4.3
5723             HAVE_THREADSAFE_STATICS=TRUE
5724         fi
5725     fi
5726     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5727         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5728         AC_MSG_RESULT([yes])
5729     else
5730         AC_MSG_RESULT([broken (i.e., no)])
5731     fi
5732 else
5733     AC_MSG_RESULT([unknown (assuming no)])
5735 AC_SUBST(HAVE_THREADSAFE_STATICS)
5737 dnl ===================================================================
5738 dnl visibility and other gcc features
5739 dnl ===================================================================
5740 if test "$GCC" = "yes"; then
5741     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5742     save_CFLAGS=$CFLAGS
5743     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5744     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5745     CFLAGS=$save_CFLAGS
5747     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5748         AC_MSG_RESULT([yes])
5749     else
5750         AC_MSG_RESULT([no])
5751     fi
5753     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5754     save_CFLAGS=$CFLAGS
5755     CFLAGS="$CFLAGS -Werror -mno-avx"
5756     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5757     CFLAGS=$save_CFLAGS
5758     if test "$HAVE_GCC_AVX" = "TRUE"; then
5759         AC_MSG_RESULT([yes])
5760     else
5761         AC_MSG_RESULT([no])
5762     fi
5764     AC_MSG_CHECKING([whether $CC supports atomic functions])
5765     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5766     int v = 0;
5767     if (__sync_add_and_fetch(&v, 1) != 1 ||
5768         __sync_sub_and_fetch(&v, 1) != 0)
5769         return 1;
5770     __sync_synchronize();
5771     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5772         v != 1)
5773         return 1;
5774     return 0;
5775 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5776     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5777         AC_MSG_RESULT([yes])
5778         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5779     else
5780         AC_MSG_RESULT([no])
5781     fi
5783     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5784     save_CFLAGS=$CFLAGS
5785     CFLAGS="$CFLAGS -Werror"
5786     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5787             __attribute__((deprecated("test"))) void f();
5788         ])], [
5789             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5790             AC_MSG_RESULT([yes])
5791         ], [AC_MSG_RESULT([no])])
5792     CFLAGS=$save_CFLAGS
5794     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5795     AC_LANG_PUSH([C++])
5796     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5797             #include <cxxabi.h>
5798             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5799         ])], [
5800             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5801             AC_MSG_RESULT([yes])
5802         ], [AC_MSG_RESULT([no])])
5803     AC_LANG_POP([C++])
5805     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
5806     AC_LANG_PUSH([C++])
5807     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5808             #include <cxxabi.h>
5809             void * f() { return __cxxabiv1::__cxa_get_globals(); }
5810         ])], [
5811             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
5812             AC_MSG_RESULT([yes])
5813         ], [AC_MSG_RESULT([no])])
5814     AC_LANG_POP([C++])
5816     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
5817     AC_LANG_PUSH([C++])
5818     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5819             #include <cxxabi.h>
5820             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
5821         ])], [
5822             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
5823             AC_MSG_RESULT([yes])
5824         ], [AC_MSG_RESULT([no])])
5825     AC_LANG_POP([C++])
5827     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
5828     AC_LANG_PUSH([C++])
5829     save_CXXFLAGS=$CXXFLAGS
5830     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
5831     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5832             struct __attribute__((warn_unused)) dummy {};
5833         ])], [
5834             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
5835             AC_MSG_RESULT([yes])
5836         ], [AC_MSG_RESULT([no])])
5837     CXXFLAGS=$save_CXXFLAGS
5838     AC_LANG_POP([C++])
5840     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
5841     AC_LANG_PUSH([C++])
5842     save_CXXFLAGS=$CXXFLAGS
5843     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
5844     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5845             #include <string>
5846             void f() { std::string s; }
5847         ])], [
5848             AC_MSG_RESULT([no])
5849         ], [
5850             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
5851             AC_MSG_RESULT([yes])])
5852     CXXFLAGS=$save_CXXFLAGS
5853     AC_LANG_POP([C++])
5856 AC_SUBST(HAVE_GCC_AVX)
5857 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
5859 dnl ===================================================================
5860 dnl Identify the C++ library
5861 dnl ===================================================================
5863 AC_MSG_CHECKING([What the C++ library is])
5864 AC_LANG_PUSH([C++])
5865 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5866 #include <utility>
5867 #ifndef __GLIBCXX__
5868 foo bar
5869 #endif
5870 ]])],
5871     [CPP_LIBRARY=GLIBCXX
5872      cpp_library_name="GNU libstdc++"
5873     ],
5874     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5875 #include <utility>
5876 #ifndef _LIBCPP_VERSION
5877 foo bar
5878 #endif
5879 ]])],
5880     [CPP_LIBRARY=LIBCPP
5881      cpp_library_name="LLVM libc++"
5882     ],
5883     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5884 #include <utility>
5885 #ifndef _MSC_VER
5886 foo bar
5887 #endif
5888 ]])],
5889     [CPP_LIBRARY=MSVCRT
5890      cpp_library_name="Microsoft"
5891     ],
5892     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
5893 AC_MSG_RESULT([$cpp_library_name])
5894 AC_LANG_POP([C++])
5895 AC_SUBST(CPP_LIBRARY)
5897 dnl ===================================================================
5898 dnl C++11
5899 dnl ===================================================================
5901 CXXFLAGS_CXX11=
5902 if test "$COM" = MSC; then
5903     AC_MSG_CHECKING([whether $CXX supports C++11])
5904     AC_MSG_RESULT(yes)
5905     # MSVC supports (a subset of) CXX11 without any switch
5906     CXXFLAGS_CXX11=
5907 elif test "$GCC" = "yes"; then
5908     HAVE_CXX11=
5909     CXXFLAGS_CXX11=
5910     AC_MSG_CHECKING([whether $CXX supports C++11])
5911     for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
5912         save_CXXFLAGS=$CXXFLAGS
5913         CXXFLAGS="$CXXFLAGS $flag -Werror"
5914         AC_LANG_PUSH([C++])
5915         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void f() {}]])],[CXXFLAGS_CXX11=$flag])
5916         AC_LANG_POP([C++])
5917         CXXFLAGS=$save_CXXFLAGS
5918         if test -n "$CXXFLAGS_CXX11"; then
5919             HAVE_CXX11=TRUE
5920             break
5921         fi
5922     done
5923     if test "$HAVE_CXX11" = TRUE; then
5924         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
5925     else
5926         AC_MSG_ERROR(no)
5927     fi
5930 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
5931 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
5932 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
5933 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
5934 dnl again towards 4.7.2:
5935 if test $CPP_LIBRARY = GLIBCXX; then
5936     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
5937     AC_LANG_PUSH([C++])
5938     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5939 #include <list>
5940 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
5941     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
5942     //   GCC 4.7.0: 20120322
5943     //   GCC 4.7.1: 20120614
5944     // and using a range check is not possible as the mapping between
5945     // __GLIBCXX__ values and GCC versions is not monotonic
5946 /* ok */
5947 #else
5948 abi broken
5949 #endif
5950         ]])], [AC_MSG_RESULT(no, ok)],
5951         [AC_MSG_ERROR(yes)])
5952     AC_LANG_POP([C++])
5955 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
5956 save_CXXFLAGS=$CXXFLAGS
5957 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5958 AC_LANG_PUSH([C++])
5960 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5961 #include <stddef.h>
5963 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
5965 namespace
5967         struct b
5968         {
5969                 int i;
5970                 int j;
5971         };
5973 ]], [[
5974 struct a
5976         int i;
5977         int j;
5979 a thinga[]={{0,0}, {1,1}};
5980 b thingb[]={{0,0}, {1,1}};
5981 size_t i = sizeof(sal_n_array_size(thinga));
5982 size_t j = sizeof(sal_n_array_size(thingb));
5983 return !(i != 0 && j != 0);
5985     ], [ AC_MSG_RESULT(yes) ],
5986     [ AC_MSG_ERROR(no)])
5987 AC_LANG_POP([C++])
5988 CXXFLAGS=$save_CXXFLAGS
5990 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
5991 save_CXXFLAGS=$CXXFLAGS
5992 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
5993 AC_LANG_PUSH([C++])
5995 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5996 #include <vector>
5997     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
5998     // (__float128)
6000     ],[ AC_MSG_RESULT(yes) ],
6001     [
6002         AC_MSG_RESULT(no)
6003         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6004         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6005         # __float128 is available during its build, but it's usually built using GCC,
6006         # and so c++config.h hardcodes __float128 being supported). As the only place
6007         # where __float128 is actually used is in a template specialization,
6008         # -D__float128=void will avoid the problem there while still causing a problem
6009         # if somebody actually uses the type.
6010         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6011         CXXFLAGS="$CXXFLAGS -D__float128=void"
6012         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6013 #include <vector>
6014     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6015     // (__float128)
6017     ],
6018     [
6019      AC_MSG_RESULT(yes)
6020      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6021     ],
6022     [
6023      AC_MSG_ERROR(no)
6024     ])
6027 AC_LANG_POP([C++])
6028 CXXFLAGS=$save_CXXFLAGS
6030 AC_SUBST(CXXFLAGS_CXX11)
6032 dnl ==================================
6033 dnl Check for C++11 "= delete" support
6034 dnl ==================================
6036 AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
6037 save_CXXFLAGS=$CXXFLAGS
6038 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6039 AC_LANG_PUSH([C++])
6040 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6041 struct A
6042     {
6043     void test() = delete;
6044     };
6045 ]])],[HAVE_CXX11_DELETE=TRUE],[])
6047 AC_LANG_POP([C++])
6048 CXXFLAGS=$save_CXXFLAGS
6049 if test "$HAVE_CXX11_DELETE" = "TRUE"; then
6050     AC_MSG_RESULT([yes])
6051     AC_DEFINE([HAVE_CXX11_DELETE])
6052 else
6053     AC_MSG_RESULT([no])
6056 dnl ==================================
6057 dnl Check for C++11 "override" support
6058 dnl ==================================
6060 AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax])
6061 save_CXXFLAGS=$CXXFLAGS
6062 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6063 AC_LANG_PUSH([C++])
6064 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6065 struct A
6067         virtual void test();
6070 struct B : A
6072         virtual void test() override;
6074 ]])],[HAVE_CXX11_OVERRIDE=TRUE],[])
6076 AC_LANG_POP([C++])
6077 CXXFLAGS=$save_CXXFLAGS
6078 if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then
6079     AC_MSG_RESULT([yes])
6080     AC_DEFINE([HAVE_CXX11_OVERRIDE])
6081 else
6082     AC_MSG_RESULT([no])
6085 dnl ==================================
6086 dnl Check for C++11 "final" support
6087 dnl ==================================
6089 AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax])
6090 save_CXXFLAGS=$CXXFLAGS
6091 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6092 AC_LANG_PUSH([C++])
6093 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6094 // First check that this correct program that uses "final" compiles
6095 struct A final
6099 struct B
6101         virtual void test();
6104 struct C : B
6106         void test() final;
6108 ]])],[have_final=yes],[])
6110 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6111 // Then check that the "final" works as expected,
6112 // that this program fails to compile
6113 struct A final
6117 struct B : A
6120 ]])],[],[final_class_works=yes])
6122 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6123 // Also this should fail to compile
6124 struct B
6126         virtual void test();
6129 struct C : B
6131         void test() final;
6134 struct D : C
6136         void test();
6138 ]])],[],[final_method_works=yes])
6139 AC_LANG_POP([C++])
6141 CXXFLAGS=$save_CXXFLAGS
6143 if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then
6144     AC_MSG_RESULT([yes])
6145     AC_DEFINE([HAVE_CXX11_FINAL])
6146 else
6147     AC_MSG_RESULT([no])
6150 dnl ===================================================================
6151 dnl Check for C++11 perfect forwarding support
6152 dnl ===================================================================
6153 AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
6154 save_CXXFLAGS=$CXXFLAGS
6155 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6156 AC_LANG_PUSH([C++])
6157 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6158     #include <utility>
6159     template<typename T, typename... Args> T * f(Args &&... v) {
6160         return new T(std::forward<Args>(v)...);
6161     }
6162     ]], [[
6163     f<int>(0);
6164     ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
6165 AC_LANG_POP([C++])
6166 CXXFLAGS=$save_CXXFLAGS
6167 AC_MSG_RESULT([$perfect_forwarding])
6168 if test "$perfect_forwarding" = yes; then
6169     AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING])
6172 HAVE_GCC_PRAGMA_OPERATOR=
6173 dnl _Pragma support (may require C++11)
6174 if test "$GCC" = "yes"; then
6175     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6176     AC_LANG_PUSH([C++])
6177     save_CXXFLAGS=$CXXFLAGS
6178     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6179     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6180             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6181         ])], [
6182             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6183             HAVE_GCC_PRAGMA_OPERATOR=1
6184             AC_MSG_RESULT([yes])
6185         ], [AC_MSG_RESULT([no])])
6186     AC_LANG_POP([C++])
6187     CXXFLAGS=$save_CXXFLAGS
6189 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6191 dnl ===================================================================
6192 dnl system stl sanity tests
6193 dnl ===================================================================
6194 HAVE_GCC_VISIBILITY_BROKEN=
6195 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6197     AC_LANG_PUSH([C++])
6199     save_CPPFLAGS="$CPPFLAGS"
6200     if test -n "$MACOSX_SDK_PATH"; then
6201         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6202     fi
6204     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6205     # only.
6206     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6207         dnl gcc#19664, gcc#22482, rhbz#162935
6208         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6209         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6210         AC_MSG_RESULT([$stlvisok])
6211         if test "$stlvisok" = "no"; then
6212             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6213             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6214             unset HAVE_GCC_VISIBILITY_FEATURE
6215         fi
6216     fi
6218     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6219         sharedlink_ldflags_save=$LDFLAGS
6220         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6222         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6223         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6224 #include <sstream>
6225 using namespace std;
6226             ]], [[
6227 istringstream strm( "test" ); return 0;
6228             ]])],
6229             # Ugh, surely bad to assume an error message will contain
6230             # the word "unresolvable", a problem with
6231             # -fvisibility-inlines-hidden and STL headers might cause
6232             # some more obscure message on some platform, and anway,
6233             # the error message could be localised.
6234             [$EGREP -q unresolvable conftest.err;
6235             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6236         ])
6237         AC_MSG_RESULT([$gccvisok])
6238         if test "$gccvisok" = "no"; then
6239             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6240             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6241             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6242         fi
6244         LDFLAGS=$sharedlink_ldflags_save
6245     fi
6247     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6248     # when we don't make any dynamic libraries?
6249     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6250         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6251         cat > conftestlib1.cc <<_ACEOF
6252 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6253 struct S2: S1<int> { virtual ~S2(); };
6254 S2::~S2() {}
6255 _ACEOF
6256         cat > conftestlib2.cc <<_ACEOF
6257 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6258 struct S2: S1<int> { virtual ~S2(); };
6259 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6260 _ACEOF
6261         gccvisinlineshiddenok=yes
6262         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6263             gccvisinlineshiddenok=no
6264         else
6265             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6266             dnl known to not work with -z defs (unsetting which makes the test
6267             dnl moot, though):
6268             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6269             if test "$COM_GCC_IS_CLANG" = TRUE; then
6270                 for i in $CXX; do
6271                     case $i in
6272                     -fsanitize=*)
6273                         my_linkflagsnoundefs=
6274                         break
6275                         ;;
6276                     esac
6277                 done
6278             fi
6279             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6280                 gccvisinlineshiddenok=no
6281             fi
6282         fi
6284         rm -fr libconftest*
6285         AC_MSG_RESULT([$gccvisinlineshiddenok])
6286         if test "$gccvisinlineshiddenok" = "no"; then
6287             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6288             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6289             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6290         fi
6291     fi
6293     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6294         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6295         cat >visibility.cxx <<_ACEOF
6296 #pragma GCC visibility push(hidden)
6297 struct __attribute__ ((visibility ("default"))) TestStruct {
6298   static void Init();
6300 __attribute__ ((visibility ("default"))) void TestFunc() {
6301   TestStruct::Init();
6303 _ACEOF
6304         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6305             gccvisbroken=yes
6306         else
6307             case "$host_cpu" in
6308             i?86|x86_64)
6309                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6310                     gccvisbroken=no
6311                 else
6312                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6313                         gccvisbroken=no
6314                     else
6315                         gccvisbroken=yes
6316                     fi
6317                 fi
6318                 ;;
6319             *)
6320                 gccvisbroken=no
6321                 ;;
6322             esac
6323         fi
6324         rm -f visibility.s visibility.cxx
6326         AC_MSG_RESULT([$gccvisbroken])
6327         if test "$gccvisbroken" = "yes"; then
6328             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6329             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6330             unset HAVE_GCC_VISIBILITY_FEATURE
6331         fi
6332     fi
6334     CPPFLAGS="$save_CPPFLAGS"
6336     AC_LANG_POP([C++])
6339 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6340 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6342 dnl ===================================================================
6343 dnl  Clang++ tests
6344 dnl ===================================================================
6346 HAVE_GCC_FNO_DEFAULT_INLINE=
6347 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6348 if test "$GCC" = "yes"; then
6349     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6350     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6351         # Option just ignored and silly warning that isn't a real
6352         # warning printed
6353         :
6354     else
6355         AC_LANG_PUSH([C++])
6356         save_CXXFLAGS=$CXXFLAGS
6357         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6358         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6359         CXXFLAGS=$save_CXXFLAGS
6360         AC_LANG_POP([C++])
6361     fi
6362     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6363         AC_MSG_RESULT([yes])
6364     else
6365         AC_MSG_RESULT([no])
6366     fi
6368     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6369     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6370         # As above
6371         :
6372     else
6373         AC_LANG_PUSH([C++])
6374         save_CXXFLAGS=$CXXFLAGS
6375         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6376         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6377         CXXFLAGS=$save_CXXFLAGS
6378         AC_LANG_POP([C++])
6379     fi
6380     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6381         AC_MSG_RESULT([yes])
6382     else
6383         AC_MSG_RESULT([no])
6384     fi
6386 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6387 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6389 dnl ===================================================================
6390 dnl Compiler plugins
6391 dnl ===================================================================
6393 COMPILER_PLUGINS=
6394 # currently only Clang
6395 if test "$COM_GCC_IS_CLANG" = "TRUE"; then
6396     if test -n "$enable_compiler_plugins"; then
6397         compiler_plugins="$enable_compiler_plugins"
6398     elif test -n "$ENABLE_DBGUTIL"; then
6399         compiler_plugins=test
6400     else
6401         compiler_plugins=no
6402     fi
6403     if test "$compiler_plugins" != "no"; then
6404         dnl The prefix where Clang resides, override to where Clang resides if
6405         dnl using a source build:
6406         if test -z "$CLANGDIR"; then
6407             CLANGDIR=/usr
6408         fi
6409         AC_LANG_PUSH([C++])
6410         save_CPPFLAGS=$CPPFLAGS
6411         save_CXX=$CXX
6412         # compiler plugins must be built with "native" bitness of clang
6413         # because they link against clang libraries
6414         CXX=`echo $CXX | sed -e s/-m64// -e s/-m32//`
6415         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6416         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6417             [COMPILER_PLUGINS=TRUE],
6418             [
6419             if test "$compiler_plugins" = "yes"; then
6420                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6421             else
6422                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6423                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6424             fi
6425             ])
6426         CXX=$save_CXX
6427         CPPFLAGS=$save_CPPFLAGS
6428         AC_LANG_POP([C++])
6429     fi
6430 else
6431     if test "$enable_compiler_plugins" = "yes"; then
6432         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6433     fi
6435 AC_SUBST(COMPILER_PLUGINS)
6436 AC_SUBST(CLANGDIR)
6438 # Plugin to help linker.
6439 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6440 # This makes --enable-lto build with clang work.
6441 AC_SUBST(LD_PLUGIN)
6443 dnl ===================================================================
6444 dnl allocator
6445 dnl ===================================================================
6446 AC_MSG_CHECKING([which memory allocator to use])
6447 if test "$with_alloc" = "system"; then
6448     AC_MSG_RESULT([system])
6449     ALLOC="SYS_ALLOC"
6451 if test "$with_alloc" = "tcmalloc"; then
6452     AC_MSG_RESULT(tcmalloc)
6453     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6454         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6455     fi
6456     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6457         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6458     ALLOC="TCMALLOC"
6460 if test "$with_alloc" = "jemalloc"; then
6461     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6462         AC_MSG_RESULT(jemalloc)
6463         save_CFLAGS=$CFLAGS
6464         CFLAGS="$CFLAGS -pthread"
6465         AC_CHECK_LIB([jemalloc], [malloc], [:],
6466             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6467         ALLOC="JEMALLOC"
6468         CFLAGS=$save_CFLAGS
6469     else
6470         AC_MSG_RESULT([system])
6471         ALLOC="SYS_ALLOC"
6472     fi
6474 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6475     AC_MSG_RESULT([internal])
6477 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6478 AC_SUBST(HAVE_POSIX_FALLOCATE)
6479 AC_SUBST(ALLOC)
6481 dnl ===================================================================
6482 dnl Custom build version
6483 dnl ===================================================================
6485 AC_MSG_CHECKING([whether to add custom build version])
6486 if test "$with_build_version" != ""; then
6487     BUILD_VER_STRING=$with_build_version
6488     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6489 else
6490     BUILD_VER_STRING=
6491     AC_MSG_RESULT([no])
6493 AC_SUBST(BUILD_VER_STRING)
6495 JITC_PROCESSOR_TYPE=""
6496 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6497     # IBMs JDK needs this...
6498     JITC_PROCESSOR_TYPE=6
6499     export JITC_PROCESSOR_TYPE
6501 AC_SUBST([JITC_PROCESSOR_TYPE])
6503 # Misc Windows Stuff
6504 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6505     find_msvc_x64_dlls
6506     find_msms
6507     MSVC_DLL_PATH="$msvcdllpath"
6508     MSVC_DLLS="$msvcdlls"
6509     MSM_PATH="$msmdir"
6510     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6513 AC_SUBST(MSVC_DLL_PATH)
6514 AC_SUBST(MSVC_DLLS)
6515 AC_SUBST(MSM_PATH)
6517 dnl ===================================================================
6518 dnl Checks for Java
6519 dnl ===================================================================
6520 if test "$ENABLE_JAVA" != ""; then
6522     # Windows-specific tests
6523     if test "$build_os" = "cygwin"; then
6524         if test "$BITNESS_OVERRIDE" = 64; then
6525             bitness=64
6526         else
6527             bitness=32
6528         fi
6530         if test -z "$with_jdk_home"; then
6531             for ver in 1.8 1.7 1.6; do
6532                 reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6533                 if test -n "$regvalue"; then
6534                     _jdk_home=$regvalue
6535                     break
6536                 fi
6537             done
6538             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6539                 with_jdk_home="$_jdk_home"
6540                 howfound="found automatically"
6541             else
6542                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6543             fi
6544         else
6545             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6546             howfound="you passed"
6547         fi
6548     fi
6550     # 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.
6551     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6552     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6553         with_jdk_home=`/usr/libexec/java_home`
6554     fi
6556     JAVA_HOME=; export JAVA_HOME
6557     if test -z "$with_jdk_home"; then
6558         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6559     else
6560         _java_path="$with_jdk_home/bin/$with_java"
6561         dnl Check if there is a Java interpreter at all.
6562         if test -x "$_java_path"; then
6563             JAVAINTERPRETER=$_java_path
6564         else
6565             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6566         fi
6567     fi
6569     if test "$build_os" = "cygwin"; then
6570         # Check that the JDK found is correct architecture
6571         # Why is this necessary, we don't link with any library from the JDK I think,
6573         shortjdkhome=`cygpath -d "$with_jdk_home"`
6574         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
6575             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6576             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6577         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
6578             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6579             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6580         fi
6582         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6583             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6584         fi
6585         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6586     elif test "$cross_compiling" != "yes"; then
6587         # at least 2 reasons to check: officebean needs to link -ljawt,
6588         # and libjpipe.so needs to be loaded by java to run JunitTests.
6589         case $CPUNAME in
6590             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64)
6591                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6592                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6593                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6594                 fi
6595                 ;;
6596             *) # assumption: everything else 32-bit
6597                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6598                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6599                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6600                 fi
6601                 ;;
6602         esac
6603     fi
6606 HAVE_JAVA6=
6607 HAVE_JAVA9=
6608 dnl ===================================================================
6609 dnl Checks for JDK.
6610 dnl ===================================================================
6612 # Note that JAVA_HOME as for now always means the *build* platform's
6613 # JAVA_HOME. Whether all the complexity here actually is needed any
6614 # more or not, no idea.
6616 if test "$ENABLE_JAVA" != ""; then
6617     _gij_longver=0
6618     AC_MSG_CHECKING([the installed JDK])
6619     if test -n "$JAVAINTERPRETER"; then
6620         dnl java -version sends output to stderr!
6621         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6622             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6623         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6624             JDK=gcj
6625             AC_MSG_RESULT([checked (gcj)])
6626             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6627             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6629         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6630             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6631         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6632             JDK=ibm
6634             dnl IBM JDK specific tests
6635             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6636             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6638             if test "$_jdk_ver" -lt 10500; then
6639                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6640             fi
6641             if test "$_jdk_ver" -ge 10600; then
6642                 HAVE_JAVA6=TRUE
6643             fi
6645             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6647             if test "$with_jdk_home" = ""; then
6648                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6649 you must use the "--with-jdk-home" configure option explicitly])
6650             fi
6652             JAVA_HOME=$with_jdk_home
6653         else
6654             JDK=sun
6656             dnl Sun JDK specific tests
6657             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6658             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6660             if test "$_jdk_ver" -lt 10500; then
6661                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6662             fi
6663             if test "$_jdk_ver" -gt 10600; then
6664                 JAVA_CLASSPATH_NOT_SET="1"
6665             fi
6666             if test "$_jdk_ver" -ge 10600; then
6667                 HAVE_JAVA6=TRUE
6668             fi
6669             if test "$_jdk_ver" -ge 10900; then
6670                 HAVE_JAVA9=TRUE
6671             fi
6673             AC_MSG_RESULT([checked (JDK $_jdk)])
6674             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6675             if test "$_os" = "WINNT"; then
6676                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6677             fi
6679             # set to limit VM usage for JunitTests
6680             JAVAIFLAGS=-Xmx64M
6681             # set to limit VM usage for javac
6682             JAVAFLAGS=-J-Xmx128M
6683         fi
6684     else
6685         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6686     fi
6687 else
6688     dnl Java disabled
6689     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6691 AC_SUBST([HAVE_JAVA6])
6692 AC_SUBST([HAVE_JAVA9])
6694 dnl ===================================================================
6695 dnl Set target Java bytecode version
6696 dnl ===================================================================
6697 if test "$ENABLE_JAVA" != ""; then
6698     if test "$HAVE_JAVA9" == "TRUE"; then
6699         _java_target_ver="1.6"
6700     else
6701         _java_target_ver="1.5"
6702     fi
6703     JAVA_SOURCE_VER="$_java_target_ver"
6704     JAVA_TARGET_VER="$_java_target_ver"
6707 dnl ===================================================================
6708 dnl Checks for javac
6709 dnl ===================================================================
6710 if test "$ENABLE_JAVA" != ""; then
6711     if test "$JDK" = "gcj"; then
6712         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6713     else
6714         javacompiler="javac"
6715     fi
6716     if test -z "$with_jdk_home"; then
6717         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6718     else
6719         _javac_path="$with_jdk_home/bin/$javacompiler"
6720         dnl Check if there is a Java compiler at all.
6721         if test -x "$_javac_path"; then
6722             JAVACOMPILER=$_javac_path
6723         fi
6724     fi
6725     if test -z "$JAVACOMPILER"; then
6726         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6727     fi
6728     if test "$build_os" = "cygwin"; then
6729         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6730             JAVACOMPILER="${JAVACOMPILER}.exe"
6731         fi
6732         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6733     fi
6735     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6736         AC_MSG_CHECKING([re-checking JDK])
6737         JDK=gcj
6738         AC_MSG_RESULT([checked (ecj)])
6739         _gij_longver="40200"
6740     fi
6743 JAVACISGCJ=""
6744 dnl ===================================================================
6745 dnl Checks that javac is gcj
6746 dnl ===================================================================
6747 if test "$ENABLE_JAVA" != ""; then
6748     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6749         JAVACISGCJ="yes"
6750     fi
6752 AC_SUBST(JAVACISGCJ)
6754 dnl ===================================================================
6755 dnl Checks for javadoc
6756 dnl ===================================================================
6757 if test "$ENABLE_JAVA" != ""; then
6758     if test -z "$with_jdk_home"; then
6759         AC_PATH_PROG(JAVADOC, javadoc)
6760     else
6761         _javadoc_path="$with_jdk_home/bin/javadoc"
6762         dnl Check if there is a javadoc at all.
6763         if test -x "$_javadoc_path"; then
6764             JAVADOC=$_javadoc_path
6765         else
6766             AC_PATH_PROG(JAVADOC, javadoc)
6767         fi
6768     fi
6769     if test -z "$JAVADOC"; then
6770         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6771     fi
6772     if test "$build_os" = "cygwin"; then
6773         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6774             JAVADOC="${JAVADOC}.exe"
6775         fi
6776         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6777     fi
6779     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6780     JAVADOCISGJDOC="yes"
6781     fi
6783 AC_SUBST(JAVADOCISGJDOC)
6785 if test "$ENABLE_JAVA" != ""; then
6786     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6787     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6788         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6789            # try to recover first by looking whether we have a alternatives
6790            # system as in Debian or newer SuSEs where following /usr/bin/javac
6791            # over /etc/alternatives/javac leads to the right bindir where we
6792            # just need to strip a bit away to get a valid JAVA_HOME
6793            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6794         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6795             # maybe only one level of symlink (e.g. on Mac)
6796             JAVA_HOME=$(readlink $JAVACOMPILER)
6797             if test "$(dirname $JAVA_HOME)" = "."; then
6798                 # we've got no path to trim back
6799                 JAVA_HOME=""
6800             fi
6801         else
6802             # else warn
6803             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6804             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6805             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6806             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6807         fi
6808         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
6809         if test "$JAVA_HOME" != "/usr"; then
6810             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6811                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6812                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6813                 dnl Tiger already returns a JDK path..
6814                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6815             else
6816                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6817             fi
6818         fi
6819     fi
6820     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6822     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6823     if test -z "$JAVA_HOME"; then
6824         if test "x$with_jdk_home" = "x"; then
6825             cat > findhome.java <<_ACEOF
6826 [import java.io.File;
6828 class findhome
6830     public static void main(String args[])
6831     {
6832         String jrelocation = System.getProperty("java.home");
6833         File jre = new File(jrelocation);
6834         System.out.println(jre.getParent());
6835     }
6837 _ACEOF
6838             AC_MSG_CHECKING([if javac works])
6839             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
6840             AC_TRY_EVAL(javac_cmd)
6841             if test $? = 0 -a -f ./findhome.class; then
6842                 AC_MSG_RESULT([javac works])
6843             else
6844                 echo "configure: javac test failed" >&5
6845                 cat findhome.java >&5
6846                 AC_MSG_ERROR([javac does not work - java projects will not build!])
6847             fi
6848             AC_MSG_CHECKING([if gij knows its java.home])
6849             JAVA_HOME=`$JAVAINTERPRETER findhome`
6850             if test $? = 0 -a "$JAVA_HOME" != ""; then
6851                 AC_MSG_RESULT([$JAVA_HOME])
6852             else
6853                 echo "configure: java test failed" >&5
6854                 cat findhome.java >&5
6855                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
6856             fi
6857             # clean-up after ourselves
6858             rm -f ./findhome.java ./findhome.class
6859         else
6860             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
6861         fi
6862     fi
6864     dnl second sanity check JAVA_HOME if possible
6865     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
6866         # now check if $JAVA_HOME is really valid
6867         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6868             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
6869                 JAVA_HOME_OK="NO"
6870             fi
6871         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
6872             JAVA_HOME_OK="NO"
6873         fi
6874         if test "$JAVA_HOME_OK" = "NO"; then
6875             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
6876             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
6877             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
6878             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
6879             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
6880             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
6881         fi
6882     fi
6883     PathFormat "$JAVA_HOME"
6884     JAVA_HOME="$formatted_path"
6887 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
6888     "$_os" != Darwin
6889 then
6890     AC_MSG_CHECKING([for JAWT lib])
6891     if test "$_os" = WINNT; then
6892         if test "$WITH_MINGW" = yes; then
6893             # The path is taken care of in gb_LinkTarget__use_jawt
6894             # in RepositoryExternal.mk:
6895             JAWTLIB=-ljawt
6896         else
6897             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
6898             JAWTLIB=jawt.lib
6899         fi
6900     else
6901         case "$host_cpu" in
6902         arm*)
6903             my_java_arch=arm
6904             ;;
6905         i*86)
6906             my_java_arch=i386
6907             ;;
6908         m68k)
6909             my_java_arch=mk68
6910             ;;
6911         powerpc)
6912             my_java_arch=ppc
6913             ;;
6914         powerpc64*)
6915             my_java_arch=ppc64
6916             ;;
6917         x86_64)
6918             my_java_arch=amd64
6919             ;;
6920         *)
6921             my_java_arch=$host_cpu
6922             ;;
6923         esac
6924         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
6925     fi
6926     AC_MSG_RESULT([$JAWTLIB])
6928 AC_SUBST(JAWTLIB)
6930 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
6931     case "$host_os" in
6933     aix*)
6934         JAVAINC="-I$JAVA_HOME/include"
6935         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
6936         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6937         ;;
6939     cygwin*)
6940         JAVAINC="-I$JAVA_HOME/include/win32"
6941         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
6942         ;;
6944     darwin*)
6945         if test -d "$JAVA_HOME/include/darwin"; then
6946             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
6947         else
6948             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
6949         fi
6950         ;;
6952     dragonfly*)
6953         JAVAINC="-I$JAVA_HOME/include"
6954         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6955         ;;
6957     freebsd*)
6958         JAVAINC="-I$JAVA_HOME/include"
6959         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
6960         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
6961         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6962         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6963         ;;
6965     k*bsd*-gnu*)
6966         JAVAINC="-I$JAVA_HOME/include"
6967         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6968         ;;
6970     linux-gnu*)
6971         JAVAINC="-I$JAVA_HOME/include"
6972         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
6973         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6974         ;;
6976     mingw*)
6977         JAVAINC="-I$JAVA_HOME/include"
6978         ;;
6980     *netbsd*)
6981         JAVAINC="-I$JAVA_HOME/include"
6982         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
6983         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6984        ;;
6986     openbsd*)
6987         JAVAINC="-I$JAVA_HOME/include"
6988         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
6989         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6990         ;;
6992     solaris*)
6993         JAVAINC="-I$JAVA_HOME/include"
6994         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
6995         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
6996         ;;
6997     esac
6999 SOLARINC="$SOLARINC $JAVAINC"
7001 AC_SUBST(JAVACOMPILER)
7002 AC_SUBST(JAVADOC)
7003 AC_SUBST(JAVAINTERPRETER)
7004 AC_SUBST(JAVAIFLAGS)
7005 AC_SUBST(JAVAFLAGS)
7006 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7007 AC_SUBST(JAVA_HOME)
7008 AC_SUBST(JAVA_SOURCE_VER)
7009 AC_SUBST(JAVA_TARGET_VER)
7010 AC_SUBST(JDK)
7012 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7013 if test -n "$with_idlc_cpp"; then
7014     AC_MSG_RESULT([$with_idlc_cpp])
7015     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7016 else
7017     AC_MSG_RESULT([ucpp])
7018     AC_MSG_CHECKING([which ucpp tp use])
7019     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7020         AC_MSG_RESULT([external])
7021         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7022     else
7023         AC_MSG_RESULT([internal])
7024         BUILD_TYPE="$BUILD_TYPE UCPP"
7025     fi
7027 AC_SUBST(SYSTEM_UCPP)
7029 dnl ===================================================================
7030 dnl Check for epm (not needed for Windows)
7031 dnl ===================================================================
7032 AC_MSG_CHECKING([whether to enable EPM for packing])
7033 if test "$enable_epm" = "yes"; then
7034     AC_MSG_RESULT([yes])
7035     if test "$_os" != "WINNT"; then
7036         if test $_os = Darwin; then
7037             EPM=internal
7038         elif test -n "$with_epm"; then
7039             EPM=$with_epm
7040         else
7041             AC_PATH_PROG(EPM, epm, no)
7042         fi
7043         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7044             echo "EPM will be built."
7045             BUILD_TYPE="$BUILD_TYPE EPM"
7046             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7047         else
7048             # Gentoo has some epm which is something different...
7049             AC_MSG_CHECKING([whether the found epm is the right epm])
7050             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7051                 AC_MSG_RESULT([yes])
7052             else
7053                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7054             fi
7055             AC_MSG_CHECKING([epm version])
7056             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7057             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7058                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7059                 AC_MSG_RESULT([OK, >= 3.7])
7060             else
7061                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7062                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7063             fi
7064         fi
7065     fi
7067     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7068         AC_MSG_CHECKING([for rpm])
7069         for a in "$RPM" rpmbuild rpm; do
7070             $a --usage >/dev/null 2> /dev/null
7071             if test $? -eq 0; then
7072                 RPM=$a
7073                 break
7074             else
7075                 $a --version >/dev/null 2> /dev/null
7076                 if test $? -eq 0; then
7077                     RPM=$a
7078                     break
7079                 fi
7080             fi
7081         done
7082         if test -z "$RPM"; then
7083             AC_MSG_ERROR([not found])
7084         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7085             RPM_PATH=`which $RPM`
7086             AC_MSG_RESULT([$RPM_PATH])
7087             SCPDEFS="$SCPDEFS -DWITH_RPM"
7088         else
7089             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7090         fi
7091     fi
7092     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7093         AC_PATH_PROG(DPKG, dpkg, no)
7094         if test "$DPKG" = "no"; then
7095             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7096         fi
7097     fi
7098     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7099        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7100         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7101             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7102                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7103                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7104                     AC_MSG_RESULT([yes])
7105                 else
7106                     AC_MSG_RESULT([no])
7107                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7108                         _pt="rpm"
7109                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7110                         add_warning "the rpms will need to be installed with --nodeps"
7111                     else
7112                         _pt="pkg"
7113                     fi
7114                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7115                     add_warning "the ${_pt}s will not be relocateable"
7116                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7117                                  relocation will work, you need to patch your epm with the
7118                                  patch in epm/epm-3.7.patch or build with
7119                                  --with-epm=internal which will build a suitable epm])
7120                 fi
7121             fi
7122         fi
7123     fi
7124     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7125         AC_PATH_PROG(PKGMK, pkgmk, no)
7126         if test "$PKGMK" = "no"; then
7127             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7128         fi
7129     fi
7130     AC_SUBST(RPM)
7131     AC_SUBST(DPKG)
7132     AC_SUBST(PKGMK)
7133 else
7134     for i in $PKGFORMAT; do
7135         case "$i" in
7136         aix | bsd | deb | pkg | rpm | native | portable)
7137             AC_MSG_ERROR(
7138                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7139             ;;
7140         esac
7141     done
7142     AC_MSG_RESULT([no])
7143     EPM=NO
7145 AC_SUBST(EPM)
7147 dnl ===================================================================
7148 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7149 dnl ===================================================================
7150 WINEGCC=
7151 if test "$enable_winegcc" = "yes"; then
7152     AC_PATH_PROG(WINEGCC, winegcc)
7153     if test "$WINEGCC" = ""; then
7154         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7155     fi
7156     CC_save="$CC"
7157     ac_exeext_save="$ac_exeext"
7158     CC="$WINEGCC -m32"
7159     ac_exeext=".exe"
7160     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7161 #include <stdio.h>
7162         ],[
7163 printf ("hello world\n");
7164         ])],,
7165         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7166     )
7167     CC="$CC_save"
7168     ac_exeext="$ac_exeext_save"
7170 AC_SUBST(WINEGCC)
7172 if test $_os = iOS; then
7173     enable_mpl_subset=yes
7174     enable_lotuswordpro=no
7175     enable_coinmp=yes
7176     enable_lpsolve=no
7177     enable_postgresql_sdbc=no
7178     enable_extension_integration=no
7179     enable_report_builder=no
7180     with_theme="tango"
7181     with_ppds=no
7184 ENABLE_LWP=
7185 if test "$enable_lotuswordpro" = "yes"; then
7186     ENABLE_LWP="TRUE"
7187     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7189 AC_SUBST(ENABLE_LWP)
7191 dnl ===================================================================
7192 dnl Check for gperf
7193 dnl ===================================================================
7194 AC_PATH_PROG(GPERF, gperf)
7195 if test -z "$GPERF"; then
7196     AC_MSG_ERROR([gperf not found but needed. Install it.])
7198 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7199     GPERF=`cygpath -m $GPERF`
7201 AC_MSG_CHECKING([gperf version])
7202 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7203     AC_MSG_RESULT([OK])
7204 else
7205     AC_MSG_ERROR([too old, you need at least 3.0.0])
7207 AC_SUBST(GPERF)
7209 dnl ===================================================================
7210 dnl Check for building ODK
7211 dnl ===================================================================
7212 if test "$enable_odk" = no; then
7213     unset DOXYGEN
7214 else
7215     if test "$with_doxygen" = no; then
7216         AC_MSG_CHECKING([for doxygen])
7217         unset DOXYGEN
7218         AC_MSG_RESULT([no])
7219     else
7220         if test "$with_doxygen" = yes; then
7221             AC_PATH_PROG([DOXYGEN], [doxygen])
7222             if test -z "$DOXYGEN"; then
7223                 if test "$enable_odk" = "" ; then
7224                     enable_odk="no"
7225                 else
7226                     AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7227                 fi
7228             fi
7229         else
7230             AC_MSG_CHECKING([for doxygen])
7231             DOXYGEN=$with_doxygen
7232             AC_MSG_RESULT([$DOXYGEN])
7233         fi
7234         if test -n "$DOXYGEN"; then
7235             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7236             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7237             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7238                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7239             fi
7240         fi
7241     fi
7243 AC_SUBST([DOXYGEN])
7245 AC_MSG_CHECKING([whether to build the ODK])
7246 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7247     AC_MSG_RESULT([yes])
7249     if test "$with_java" != "no"; then
7250         AC_MSG_CHECKING([whether to build unowinreg.dll])
7251         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7252             # build on Win by default
7253             enable_build_unowinreg=yes
7254         fi
7255         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7256             AC_MSG_RESULT([no])
7257             BUILD_UNOWINREG=
7258         else
7259             AC_MSG_RESULT([yes])
7260             BUILD_UNOWINREG=TRUE
7261         fi
7262         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7263             if test -z "$with_mingw_cross_compiler"; then
7264                 dnl Guess...
7265                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7266             elif test -x "$with_mingw_cross_compiler"; then
7267                  MINGWCXX="$with_mingw_cross_compiler"
7268             else
7269                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7270             fi
7272             if test "$MINGWCXX" = "false"; then
7273                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7274             fi
7276             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7277             if test -x "$mingwstrip_test"; then
7278                 MINGWSTRIP="$mingwstrip_test"
7279             else
7280                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7281             fi
7283             if test "$MINGWSTRIP" = "false"; then
7284                 AC_MSG_ERROR(MinGW32 binutils not found.)
7285             fi
7286         fi
7287     fi
7288     BUILD_TYPE="$BUILD_TYPE ODK"
7289 else
7290     AC_MSG_RESULT([no])
7291     BUILD_UNOWINREG=
7293 AC_SUBST(BUILD_UNOWINREG)
7294 AC_SUBST(MINGWCXX)
7295 AC_SUBST(MINGWSTRIP)
7297 dnl ===================================================================
7298 dnl Check for system zlib
7299 dnl ===================================================================
7300 if test "$with_system_zlib" = "auto"; then
7301     case "$_os" in
7302     WINNT)
7303         with_system_zlib="$with_system_libs"
7304         ;;
7305     *)
7306         with_system_zlib=yes
7307         ;;
7308     esac
7311 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7312 dnl and has no pkg-config for it at least on some tinderboxes,
7313 dnl so leaving that out for now
7314 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7315 AC_MSG_CHECKING([which zlib to use])
7316 if test "$with_system_zlib" = "yes"; then
7317     AC_MSG_RESULT([external])
7318     SYSTEM_ZLIB=TRUE
7319     AC_CHECK_HEADER(zlib.h, [],
7320         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7321     AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7322         [AC_MSG_ERROR(zlib not found or functional)], [])
7323 else
7324     AC_MSG_RESULT([internal])
7325     SYSTEM_ZLIB=
7326     BUILD_TYPE="$BUILD_TYPE ZLIB"
7327     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7328     ZLIB_LIBS="-lzlib"
7330 AC_SUBST(ZLIB_CFLAGS)
7331 AC_SUBST(ZLIB_LIBS)
7332 AC_SUBST(SYSTEM_ZLIB)
7334 dnl ===================================================================
7335 dnl Check for system jpeg
7336 dnl ===================================================================
7337 if test "$with_jpeg_turbo" = "auto"; then
7338     # TODO use jpeg-turbo on Darwin too
7339     case "$_os" in
7340     WINNT)
7341         with_jpeg_turbo=yes
7342         ;;
7343     *)
7344         with_jpeg_turbo=no
7345         ;;
7346     esac
7349 if test "$with_system_jpeg" = "yes"; then
7350     AC_MSG_RESULT([external])
7351     SYSTEM_JPEG=TRUE
7352     AC_CHECK_HEADER(jpeglib.h, [],
7353         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7354     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7355     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7356     libo_MINGW_CHECK_DLL([libjpeg])
7357 else
7358     SYSTEM_JPEG=
7359     if test "$with_jpeg_turbo" = "yes"; then
7360         AC_MSG_RESULT([internal, jpeg-turbo])
7361         WITH_JPEG_TURBO=TRUE
7362         BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7363         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7364         if test -z "$NASM" -a "$build_os" = "cygwin" -a -x "/opt/lo/bin/nasm"; then
7365             NASM="/opt/lo/bin/nasm"
7366         fi
7367         if test -z "$NASM"; then
7368 cat << _EOS
7369 ****************************************************************************
7370 You need nasm (Netwide Assembler) to build internal jpeg library.
7371 To get one please do:
7373 _EOS
7374         if test "$build_os" = "cygwin"; then
7375 cat << _EOS
7376 install a pre-compiled binary for Win32
7378  mkdir -p /opt/lo/bin
7379  cd /opt/lo/bin
7380  wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7381  chmod +x nasm
7382 _EOS
7383             else
7384 cat << _EOS
7385 consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
7386 _EOS
7387             fi
7388 cat << _EOS
7390 or get and install one from http://www.nasm.us/
7392 Then re-run autogen.sh
7394 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7395 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7397 _EOS
7398         AC_MSG_ERROR([no nasm (Netwide Assembler) found])
7399         fi
7400     else
7401         AC_MSG_RESULT([internal, jpeg])
7402         BUILD_TYPE="$BUILD_TYPE JPEG"
7403     fi
7405 AC_SUBST(NASM)
7406 AC_SUBST(SYSTEM_JPEG)
7407 AC_SUBST(WITH_JPEG_TURBO)
7409 dnl ===================================================================
7410 dnl Check for system clucene
7411 dnl ===================================================================
7412 dnl we should rather be using
7413 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7414 dnl but the contribs-lib check seems tricky
7415 AC_MSG_CHECKING([which clucene to use])
7416 if test "$with_system_clucene" = "yes"; then
7417     AC_MSG_RESULT([external])
7418     SYSTEM_CLUCENE=TRUE
7419     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7420     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7421     AC_LANG_PUSH([C++])
7422     save_CXXFLAGS=$CXXFLAGS
7423     save_CPPFLAGS=$CPPFLAGS
7424     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7425     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7426     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7427     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7428     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7429                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7430     CXXFLAGS=$save_CXXFLAGS
7431     CPPFLAGS=$save_CPPFLAGS
7432     AC_LANG_POP([C++])
7434     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7435 else
7436     AC_MSG_RESULT([internal])
7437     SYSTEM_CLUCENE=
7438     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7440 AC_SUBST(SYSTEM_CLUCENE)
7441 AC_SUBST(CLUCENE_CFLAGS)
7442 AC_SUBST(CLUCENE_LIBS)
7444 dnl ===================================================================
7445 dnl Check for system expat
7446 dnl ===================================================================
7447 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7448 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7449 AC_MSG_CHECKING([which expat to use])
7450 if test "$with_system_expat" = "yes"; then
7451     AC_MSG_RESULT([external])
7452     SYSTEM_EXPAT=TRUE
7453     AC_CHECK_HEADER(expat.h, [],
7454         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7455     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7456         [AC_MSG_RESULT(expat library not found or functional.)], [])
7457     libo_MINGW_CHECK_DLL([libexpat])
7458 else
7459     AC_MSG_RESULT([internal])
7460     SYSTEM_EXPAT=
7461     BUILD_TYPE="$BUILD_TYPE EXPAT"
7463 AC_SUBST(SYSTEM_EXPAT)
7465 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7466 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7467     ENABLE_EOT="TRUE"
7468     AC_DEFINE([ENABLE_EOT])
7469     AC_MSG_RESULT([yes])
7471     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7472 else
7473     ENABLE_EOT=
7474     AC_MSG_RESULT([no])
7476 AC_SUBST([ENABLE_EOT])
7478 dnl ===================================================================
7479 dnl Check for system librevenge
7480 dnl ===================================================================
7481 AS_IF([test "$COM" = "MSC"],
7482       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7483       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7485 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7487 dnl ===================================================================
7488 dnl Check for system libe-book
7489 dnl ===================================================================
7490 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1 >= 0.1.1])
7492 dnl ===================================================================
7493 dnl Check for system libetonyek
7494 dnl ===================================================================
7495 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1 >= 0.1.1])
7497 dnl ===================================================================
7498 dnl Check for system libfreehand
7499 dnl ===================================================================
7500 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7502 dnl ===================================================================
7503 dnl Check for system libodfgen
7504 dnl ===================================================================
7505 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7507 dnl ===================================================================
7508 dnl Check for system libcdr
7509 dnl ===================================================================
7510 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7512 dnl ===================================================================
7513 dnl Check for system libmspub
7514 dnl ===================================================================
7515 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7517 dnl ===================================================================
7518 dnl Check for system libmwaw
7519 dnl ===================================================================
7520 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.4])
7522 dnl ===================================================================
7523 dnl Check for system libpagemaker
7524 dnl ===================================================================
7525 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7527 dnl ===================================================================
7528 dnl Check for system libvisio
7529 dnl ===================================================================
7530 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7532 dnl ===================================================================
7533 dnl Check for system libcmis
7534 dnl ===================================================================
7535 # libcmis requires curl and we can't build curl for iOS
7536 if test $_os != iOS; then
7537     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7538     ENABLE_CMIS=TRUE
7539 else
7540     ENABLE_CMIS=
7542 AC_SUBST(ENABLE_CMIS)
7544 dnl ===================================================================
7545 dnl Check for system libwpd
7546 dnl ===================================================================
7547 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs -lwpd-0.10"])
7549 dnl ===================================================================
7550 dnl Check for system lcms2
7551 dnl ===================================================================
7552 if test "$with_system_lcms2" = "yes"; then
7553     libo_MINGW_CHECK_DLL([liblcms2])
7554 else
7555     SYSTEM_LCMS2=
7557 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7558 if test "$GCC" = "yes"; then
7559     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7561 if test "$COM" = "MSC"; then # override the above
7562     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7565 dnl ===================================================================
7566 dnl Check for system cppunit
7567 dnl ===================================================================
7568 if test "$cross_compiling" != "yes"; then
7569     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7572 dnl ===================================================================
7573 dnl Check whether freetype is available
7574 dnl ===================================================================
7575 if test  "$test_freetype" = "yes"; then
7576     AC_MSG_CHECKING([whether freetype is available])
7577     # FreeType has 3 different kinds of versions
7578     # * release, like 2.4.10
7579     # * libtool, like 13.0.7 (this what pkg-config returns)
7580     # * soname
7581     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7582     #
7583     # 9.9.3 is 2.2.0
7584     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7585     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7586     SYSTEM_FREETYPE=TRUE
7587     _save_libs="$LIBS"
7588     _save_cflags="$CFLAGS"
7589     LIBS="$LIBS $FREETYPE_LIBS"
7590     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7591     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7592     LIBS="$_save_libs"
7593     CFLAGS="$_save_cflags"
7595 AC_SUBST(FREETYPE_CFLAGS)
7596 AC_SUBST(FREETYPE_LIBS)
7597 AC_SUBST([SYSTEM_FREETYPE])
7599 dnl ===================================================================
7600 dnl Check for system libabw
7601 dnl ===================================================================
7602 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7604 dnl ===================================================================
7605 dnl Check for system libwps
7606 dnl ===================================================================
7607 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.3])
7609 dnl ===================================================================
7610 dnl Check for system libwpg
7611 dnl ===================================================================
7612 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7614 # ===================================================================
7615 # Check for system libxslt
7616 # to prevent incompatibilities between internal libxml2 and external libxslt,
7617 # or vice versa, use with_system_libxml here
7618 # ===================================================================
7619 if test "$with_system_libxml" = "auto"; then
7620     case "$_os" in
7621     WINNT|iOS|Android)
7622         with_system_libxml="$with_system_libs"
7623         ;;
7624     *)
7625         with_system_libxml=yes
7626         ;;
7627     esac
7630 AC_MSG_CHECKING([which libxslt to use])
7631 if test "$with_system_libxml" = "yes"; then
7632     AC_MSG_RESULT([external])
7633     SYSTEM_LIBXSLT=TRUE
7634     if test "$_os" = "Darwin"; then
7635         dnl make sure to use SDK path
7636         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7637         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7638         dnl omit -L/usr/lib
7639         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7640         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7641     else
7642         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7643         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7644         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7645         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7646     fi
7648     dnl Check for xsltproc
7649     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7650     if test "$XSLTPROC" = "no"; then
7651         AC_MSG_ERROR([xsltproc is required])
7652     fi
7654     libo_MINGW_CHECK_DLL([libxslt])
7655     libo_MINGW_CHECK_DLL([libexslt])
7656     libo_MINGW_TRY_DLL([iconv])
7657 else
7658     AC_MSG_RESULT([internal])
7659     SYSTEM_LIBXSLT=
7660     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7662     if test "$cross_compiling" = "yes"; then
7663         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7664         if test "$XSLTPROC" = "no"; then
7665             AC_MSG_ERROR([xsltproc is required])
7666         fi
7667     fi
7669 AC_SUBST(SYSTEM_LIBXSLT)
7670 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7671     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7673 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7675 AC_SUBST(LIBEXSLT_CFLAGS)
7676 AC_SUBST(LIBEXSLT_LIBS)
7677 AC_SUBST(LIBXSLT_CFLAGS)
7678 AC_SUBST(LIBXSLT_LIBS)
7679 AC_SUBST(XSLTPROC)
7681 # ===================================================================
7682 # Check for system libxml
7683 # ===================================================================
7684 AC_MSG_CHECKING([which libxml to use])
7685 if test "$with_system_libxml" = "yes"; then
7686     AC_MSG_RESULT([external])
7687     SYSTEM_LIBXML=TRUE
7688     if test "$_os" = "Darwin"; then
7689         dnl make sure to use SDK path
7690         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7691         dnl omit -L/usr/lib
7692         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7693     elif test $_os = iOS; then
7694         dnl make sure to use SDK path
7695         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7696         LIBXML_CFLAGS="-I$usr/include/libxml2"
7697         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7698     else
7699         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7700         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7701     fi
7703     dnl Check for xmllint
7704     AC_PATH_PROG(XMLLINT, xmllint, no)
7705     if test "$XMLLINT" = "no"; then
7706         AC_MSG_ERROR([xmllint is required])
7707     fi
7709     libo_MINGW_CHECK_DLL([libxml2])
7710     libo_MINGW_TRY_DLL([zlib1])
7711 else
7712     AC_MSG_RESULT([internal])
7713     SYSTEM_LIBXML=
7714     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
7715     if test "$COM" = "MSC"; then
7716         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7717     fi
7718     if test "$COM" = "MSC"; then
7719         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
7720     else
7721         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
7722     fi
7723     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7725 AC_SUBST(SYSTEM_LIBXML)
7726 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7727     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7729 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7730 AC_SUBST(LIBXML_CFLAGS)
7731 AC_SUBST(LIBXML_LIBS)
7732 AC_SUBST(XMLLINT)
7734 # =====================================================================
7735 # Checking for a Python interpreter with version >= 2.6.
7736 # Build and runtime requires Python 3 compatible version (>= 2.6).
7737 # Optionally user can pass an option to configure, i. e.
7738 # ./configure PYTHON=/usr/bin/python
7739 # =====================================================================
7740 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7741     # This allows a lack of system python with no error, we use internal one in that case.
7742     AM_PATH_PYTHON([2.6],, [:])
7743     # Clean PYTHON_VERSION checked below if cross-compiling
7744     PYTHON_VERSION=""
7745     if test "$PYTHON" != ":"; then
7746         PYTHON_FOR_BUILD=$PYTHON
7747     fi
7749 AC_SUBST(PYTHON_FOR_BUILD)
7751 # Checks for Python to use for Pyuno
7752 AC_MSG_CHECKING([which Python to use for Pyuno])
7753 case "$enable_python" in
7754 no|disable)
7755     if test -z $PYTHON_FOR_BUILD; then
7756         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7757         # requirement from the choice whether to include Python stuff in the installer, but why
7758         # bother?
7759         AC_MSG_ERROR([Python is required at build time.])
7760     fi
7761     enable_python=no
7762     AC_MSG_RESULT([none])
7763     ;;
7764 ""|yes|auto)
7765     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7766         AC_MSG_RESULT([no, overridden by --disable-scripting])
7767         enable_python=no
7768     elif test $build_os = cygwin; then
7769         dnl When building on Windows we don't attempt to use any installed
7770         dnl "system"  Python.
7771         dnl
7772         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7773         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7774         dnl MinGW cross-compilation setups.)
7775         AC_MSG_RESULT([fully internal])
7776         enable_python=internal
7777     elif test "$cross_compiling" = yes; then
7778         AC_MSG_RESULT([system])
7779         enable_python=system
7780     else
7781         # Unset variables set by the above AM_PATH_PYTHON so that
7782         # we actually do check anew.
7783         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
7784         AM_PATH_PYTHON([3.3],, [:])
7785         if test "$PYTHON" = ":"; then
7786             if test -z "$PYTHON_FOR_BUILD"; then
7787                 AC_MSG_RESULT([fully internal])
7788             else
7789                 AC_MSG_RESULT([internal])
7790             fi
7791             enable_python=internal
7792         else
7793             AC_MSG_RESULT([system])
7794             enable_python=system
7795         fi
7796     fi
7797     ;;
7798 internal)
7799     AC_MSG_RESULT([internal])
7800     ;;
7801 fully-internal)
7802     AC_MSG_RESULT([fully internal])
7803     enable_python=internal
7804     ;;
7805 system)
7806     AC_MSG_RESULT([system])
7807     ;;
7809     AC_MSG_ERROR([Incorrect --enable-python option])
7810     ;;
7811 esac
7813 if test $enable_python != no; then
7814     BUILD_TYPE="$BUILD_TYPE PYUNO"
7817 if test $enable_python = system; then
7818     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
7819         python_version=2.7
7820         PYTHON=python$python_version
7821         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
7822             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
7823             PYTHON_LIBS="-framework Python"
7824         else
7825             PYTHON_CFLAGS="`$PYTHON-config --includes`"
7826             PYTHON_LIBS="`$PYTHON-config --libs`"
7827         fi
7828     fi
7829     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
7830         # Fallback: Accept these in the environment, or as set above
7831         # for MacOSX.
7832         :
7833     elif test "$cross_compiling" != yes; then
7834         # Unset variables set by the above AM_PATH_PYTHON so that
7835         # we actually do check anew.
7836         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
7837         # This causes an error if no python command is found
7838         AM_PATH_PYTHON([3.3])
7839         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
7840         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
7841         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
7842         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
7843         if test -z "$PKG_CONFIG"; then
7844             PYTHON_CFLAGS="-I$python_include"
7845             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7846         elif $PKG_CONFIG --exists python-$python_version; then
7847             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
7848             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
7849         else
7850             PYTHON_CFLAGS="-I$python_include"
7851             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
7852         fi
7853     else
7854         dnl How to find out the cross-compilation Python installation path?
7855         dnl Let's hardocode what we know for different distributions for now...
7856         for python_version in 2.6; do
7857             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
7858                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
7859                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
7860                 AC_MSG_CHECKING([for python.exe])
7861                 libo_MINGW_CHECK_DLL([libpython$python_version])
7862                 libo_MINGW_CHECK_DLL([libreadline6])
7863                 libo_MINGW_CHECK_DLL([libtermcap])
7864                 # could we somehow extract the really mingw python version from
7865                 # actual distro package?
7866                 # 2.6.2 currently on OpenSUSE 12.1?
7867                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
7868                 PYTHON_VERSION=$python_version.2
7869                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
7870                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
7871                 break
7872             fi
7873         done
7874         AC_MSG_CHECKING([for python version])
7875         AS_IF([test -n "$PYTHON_VERSION"],
7876               [AC_MSG_RESULT([$PYTHON_VERSION])],
7877               [AC_MSG_RESULT([not found])
7878                AC_MSG_ERROR([no usable python found])])
7879         test -n "$PYTHON_CFLAGS" && break
7880     fi
7881     # let the PYTHON_FOR_BUILD match the same python installation that
7882     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
7883     # better for PythonTests.
7884     PYTHON_FOR_BUILD=$PYTHON
7887 dnl By now enable_python should be "system", "internal" or "no"
7888 case $enable_python in
7889 system)
7890     SYSTEM_PYTHON=TRUE
7892     if test "$CROSS_COMPILING" != TRUE; then
7893         dnl Check if the headers really work
7894         save_CPPFLAGS="$CPPFLAGS"
7895         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
7896         AC_CHECK_HEADER(Python.h, [],
7897            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
7898            [])
7899         CPPFLAGS="$save_CPPFLAGS"
7901         AC_LANG_PUSH(C)
7902         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
7903         AC_MSG_CHECKING([for correct python library version])
7904            AC_RUN_IFELSE([AC_LANG_SOURCE([[
7905 #include <Python.h>
7907 int main(int argc, char **argv) {
7908        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
7909            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
7910        else return 1;
7912            ]])],[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])],[])
7913         CFLAGS=$save_CFLAGS
7914         AC_LANG_POP(C)
7916         dnl FIXME Check if the Python library can be linked with, too?
7917     fi
7918     ;;
7920 internal)
7921     SYSTEM_PYTHON=
7922     PYTHON_VERSION_MAJOR=3
7923     PYTHON_VERSION_MINOR=3
7924     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
7925     BUILD_TYPE="$BUILD_TYPE PYTHON"
7926     # Embedded Python dies without Home set
7927     if test "$HOME" = ""; then
7928         export HOME=""
7929     fi
7930     # bz2 tarball and bzip2 is not standard
7931     if test -z "$BZIP2"; then
7932         AC_PATH_PROG( BZIP2, bzip2)
7933         if test -z "$BZIP2"; then
7934             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
7935         fi
7936     fi
7937     ;;
7939     DISABLE_PYTHON=TRUE
7940     SYSTEM_PYTHON=
7941     ;;
7943     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
7944     ;;
7945 esac
7947 AC_SUBST(DISABLE_PYTHON)
7948 AC_SUBST(SYSTEM_PYTHON)
7949 AC_SUBST(PYTHON_CFLAGS)
7950 AC_SUBST(PYTHON_LIBS)
7951 AC_SUBST(PYTHON_VERSION)
7952 AC_SUBST(PYTHON_VERSION_MAJOR)
7953 AC_SUBST(PYTHON_VERSION_MINOR)
7955 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
7956 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
7957     AC_MSG_RESULT([yes])
7958     ENABLE_MARIADBC=TRUE
7959     MARIADBC_MAJOR=1
7960     MARIADBC_MINOR=0
7961     MARIADBC_MICRO=2
7962     BUILD_TYPE="$BUILD_TYPE MARIADBC"
7963 else
7964     AC_MSG_RESULT([no])
7965     ENABLE_MARIADBC=
7967 AC_SUBST(ENABLE_MARIADBC)
7968 AC_SUBST(MARIADBC_MAJOR)
7969 AC_SUBST(MARIADBC_MINOR)
7970 AC_SUBST(MARIADBC_MICRO)
7972 if test "$ENABLE_MARIADBC" = "TRUE"; then
7974     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
7976     dnl ===================================================================
7977     dnl Check for system MariaDB
7978     dnl ===================================================================
7979     AC_MSG_CHECKING([which MariaDB to use])
7980     if test "$with_system_mariadb" = "yes"; then
7981         AC_MSG_RESULT([external])
7982         SYSTEM_MARIADB=TRUE
7983         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
7984         if test -z "$MARIADBCONFIG"; then
7985             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
7986             if test -z "$MARIADBCONFIG"; then
7987                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
7988                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
7989             fi
7990         fi
7991         AC_MSG_CHECKING([MariaDB version])
7992         MARIADB_VERSION=`$MARIADBCONFIG --version`
7993         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
7994         if test "$MARIADB_MAJOR" -ge "5"; then
7995             AC_MSG_RESULT([OK])
7996         else
7997             AC_MSG_ERROR([too old, use 5.0.x or later])
7998         fi
7999         AC_MSG_CHECKING([for MariaDB Client library])
8000         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8001         if test "$COM_GCC_IS_CLANG" = TRUE; then
8002             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8003         fi
8004         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8005         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8006         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8007         dnl linux32:
8008         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8009             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8010             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8011                 | sed -e 's|/lib64/|/lib/|')
8012         fi
8013         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8014         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8015         if test "$enable_bundle_mariadb" = "yes"; then
8016             AC_MSG_RESULT([yes])
8017             BUNDLE_MARIADB=TRUE
8018             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8020 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8022 /g' | grep -E '(mysqlclient|mariadb)')
8023             if test "$_os" = "Darwin"; then
8024                 LIBMARIADB=${LIBMARIADB}.dylib
8025             elif test "$_os" = "WINNT"; then
8026                 LIBMARIADB=${LIBMARIADB}.dll
8027             else
8028                 LIBMARIADB=${LIBMARIADB}.so
8029             fi
8030             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8031             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8032             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8033                 AC_MSG_RESULT([found.])
8034                 PathFormat "$LIBMARIADB_PATH"
8035                 LIBMARIADB_PATH="$formatted_path"
8036             else
8037                 AC_MSG_ERROR([not found.])
8038             fi
8039         else
8040             AC_MSG_RESULT([no])
8041             BUNDLE_MARIADB=
8042         fi
8043     else
8044         AC_MSG_RESULT([internal])
8045         SYSTEM_MARIADB=
8046         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8047         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8048         BUILD_TYPE="$BUILD_TYPE MARIADB"
8049     fi
8051     AC_SUBST(SYSTEM_MARIADB)
8052     AC_SUBST(MARIADB_CFLAGS)
8053     AC_SUBST(MARIADB_LIBS)
8054     AC_SUBST(LIBMARIADB)
8055     AC_SUBST(LIBMARIADB_PATH)
8056     AC_SUBST(BUNDLE_MARIADB)
8058     AC_LANG_PUSH([C++])
8059     dnl ===================================================================
8060     dnl Check for system MySQL C++ Connector
8061     dnl ===================================================================
8062     # FIXME!
8063     # who thought this too-generic cppconn dir was a good idea?
8064     AC_MSG_CHECKING([MySQL Connector/C++])
8065     if test "$with_system_mysql_cppconn" = "yes"; then
8066         AC_MSG_RESULT([external])
8067         SYSTEM_MYSQL_CPPCONN=TRUE
8068         AC_LANG_PUSH([C++])
8069         AC_CHECK_HEADER(mysql_driver.h, [],
8070                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8071         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8072                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8073         save_LIBS=$LIBS
8074         LIBS="$LIBS -lmysqlcppconn"
8075         AC_MSG_CHECKING([version])
8076         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8077 #include <mysql_driver.h>
8079 int main(int argc, char **argv) {
8080     sql::Driver *driver;
8081     driver = get_driver_instance();
8082     if (driver->getMajorVersion() > 1 || \
8083        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8084        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8085         return 0;
8086       else
8087         return 1;
8089       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8091         AC_LANG_POP([C++])
8092         LIBS=$save_LIBS
8093     else
8094         AC_MSG_RESULT([internal])
8095         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8096         SYSTEM_MYSQL_CPPCONN=
8097     fi
8098     AC_LANG_POP([C++])
8100 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8102 dnl ===================================================================
8103 dnl Check for system hsqldb
8104 dnl ===================================================================
8105 if test "$with_java" != "no"; then
8106     HSQLDB_USE_JDBC_4_1=
8107     AC_MSG_CHECKING([which hsqldb to use])
8108     if test "$with_system_hsqldb" = "yes"; then
8109         AC_MSG_RESULT([external])
8110         SYSTEM_HSQLDB=TRUE
8111         if test -z $HSQLDB_JAR; then
8112             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8113         fi
8114         AC_CHECK_FILE($HSQLDB_JAR, [],
8115                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8116         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8117         export HSQLDB_JAR
8118         if $PERL -e \
8119            'use Archive::Zip;
8120             my $file = "$ENV{'HSQLDB_JAR'}";
8121             my $zip = Archive::Zip->new( $file );
8122             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8123             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8124             {
8125                 push @l, split(/\n/, $mf);
8126                 foreach my $line (@l)
8127                 {
8128                     if ($line =~ m/Specification-Version:/)
8129                     {
8130                         ($t, $version) = split (/:/,$line);
8131                         $version =~ s/^\s//;
8132                         ($a, $b, $c, $d) = split (/\./,$version);
8133                         if ($c == "0" && $d > "8")
8134                         {
8135                             exit 0;
8136                         }
8137                         else
8138                         {
8139                             exit 1;
8140                         }
8141                     }
8142                 }
8143             }
8144             else
8145             {
8146                 exit 1;
8147             }'; then
8148             AC_MSG_RESULT([yes])
8149         else
8150             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8151         fi
8152     else
8153         AC_MSG_RESULT([internal])
8154         SYSTEM_HSQLDB=
8155         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8156         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8157         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8158         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8159             AC_MSG_RESULT([yes])
8160             HSQLDB_USE_JDBC_4_1=TRUE
8161         else
8162             AC_MSG_RESULT([no])
8163         fi
8164     fi
8165     AC_SUBST(SYSTEM_HSQLDB)
8166     AC_SUBST(HSQLDB_JAR)
8167     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8170 dnl ===================================================================
8171 dnl Check for PostgreSQL stuff
8172 dnl ===================================================================
8173 if test "x$enable_postgresql_sdbc" != "xno"; then
8174     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8176     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8177         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8178     fi
8179     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8180         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8181     fi
8183     AC_MSG_CHECKING([PostgreSQL C interface])
8184     if test "$with_system_postgresql" = "yes"; then
8185         AC_MSG_RESULT([external PostgreSQL])
8186         SYSTEM_POSTGRESQL=TRUE
8187         if test "$_os" = Darwin; then
8188             supp_path=''
8189             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8190                 pg_supp_path="$P_SEP$d$pg_supp_path"
8191             done
8192         fi
8193         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8194         if test -z "$PGCONFIG"; then
8195             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8196         fi
8197         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8198         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8199     else
8200         # if/when anything else than PostgreSQL uses Kerberos,
8201         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8202         WITH_KRB5=
8203         WITH_GSSAPI=
8204         case "$_os" in
8205         Darwin)
8206             # MacOS X has system MIT Kerberos 5 since 10.4
8207             if test "$with_krb5" != "no"; then
8208                 WITH_KRB5=TRUE
8209                 save_LIBS=$LIBS
8210                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8211                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8212                 KRB5_LIBS=$LIBS
8213                 LIBS=$save_LIBS
8214                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8215                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8216                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8217                 LIBS=$save_LIBS
8218             fi
8219             if test "$with_gssapi" != "no"; then
8220                 WITH_GSSAPI=TRUE
8221                 save_LIBS=$LIBS
8222                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8223                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8224                 GSSAPI_LIBS=$LIBS
8225                 LIBS=$save_LIBS
8226             fi
8227             ;;
8228         WINNT)
8229             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8230                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8231             fi
8232             ;;
8233         Linux|GNU|*BSD|DragonFly)
8234             if test "$with_krb5" != "no"; then
8235                 WITH_KRB5=TRUE
8236                 save_LIBS=$LIBS
8237                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8238                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8239                 KRB5_LIBS=$LIBS
8240                 LIBS=$save_LIBS
8241                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8242                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8243                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8244                 LIBS=$save_LIBS
8245             fi
8246             if test "$with_gssapi" != "no"; then
8247                 WITH_GSSAPI=TRUE
8248                 save_LIBS=$LIBS
8249                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8250                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8251                 GSSAPI_LIBS=$LIBS
8252                 LIBS=$save_LIBS
8253             fi
8254             ;;
8255         *)
8256             if test "$with_krb5" = "yes"; then
8257                 WITH_KRB5=TRUE
8258                 save_LIBS=$LIBS
8259                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8260                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8261                 KRB5_LIBS=$LIBS
8262                 LIBS=$save_LIBS
8263                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8264                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8265                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8266                 LIBS=$save_LIBS
8267             fi
8268             if test "$with_gssapi" = "yes"; then
8269                 WITH_GSSAPI=TRUE
8270                 save_LIBS=$LIBS
8271                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8272                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8273                 LIBS=$save_LIBS
8274                 GSSAPI_LIBS=$LIBS
8275             fi
8276         esac
8278         if test -n "$with_libpq_path"; then
8279             SYSTEM_POSTGRESQL=TRUE
8280             AC_MSG_RESULT([external libpq])
8281             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8282             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8283         else
8284             SYSTEM_POSTGRESQL=
8285             AC_MSG_RESULT([internal])
8286             POSTGRESQL_LIB=""
8287             POSTGRESQL_INC="%OVERRIDE_ME%"
8288             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8289         fi
8290     fi
8291     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8292         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8293         save_CFLAGS=$CFLAGS
8294         save_CPPFLAGS=$CPPFLAGS
8295         save_LIBS=$LIBS
8296         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8297         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8298         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8299         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8300             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8301         CFLAGS=$save_CFLAGS
8302         CPPFLAGS=$save_CPPFLAGS
8303         LIBS=$save_LIBS
8304     fi
8305     BUILD_POSTGRESQL_SDBC=TRUE
8307 AC_SUBST(WITH_KRB5)
8308 AC_SUBST(WITH_GSSAPI)
8309 AC_SUBST(GSSAPI_LIBS)
8310 AC_SUBST(KRB5_LIBS)
8311 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8312 AC_SUBST(SYSTEM_POSTGRESQL)
8313 AC_SUBST(POSTGRESQL_INC)
8314 AC_SUBST(POSTGRESQL_LIB)
8316 dnl ===================================================================
8317 dnl Check for Firebird stuff
8318 dnl ===================================================================
8319 ENABLE_FIREBIRD_SDBC=""
8320 if test "x$enable_firebird_sdbc" = "xyes"; then
8321     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8323     dnl ===================================================================
8324     dnl Check for system Firebird
8325     dnl ===================================================================
8326     AC_MSG_CHECKING([which Firebird to use])
8327     if test "$with_system_firebird" = "yes"; then
8328         AC_MSG_RESULT([external])
8329         SYSTEM_FIREBIRD=TRUE
8330         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8331         if test -z "$FIREBIRDCONFIG"; then
8332             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8333             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8334             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8335         else
8336             AC_MSG_NOTICE([fb_config found])
8337             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8338             AC_MSG_CHECKING([for Firebird Client library])
8339             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8340             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8341         fi
8342         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8343         AC_MSG_CHECKING([Firebird version])
8344         if test -n "${FIREBIRD_VERSION}"; then
8345             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8346             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8347             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8348                 AC_MSG_RESULT([OK])
8349             else
8350                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8351             fi
8352         else
8353             __save_CFLAGS="${CFLAGS}"
8354             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8355             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8356 #if defined(FB_API_VER) && FB_API_VER == 25
8357 #else
8358 #error "Wrong Firebird API version"
8359 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8360             CFLAGS="${__save_CFLAGS}"
8361         fi
8362         ENABLE_FIREBIRD_SDBC="TRUE"
8363     elif test "$enable_database_connectivity" != yes; then
8364         AC_MSG_RESULT([none])
8365     elif test "$cross_compiling" = "yes"; then
8366         AC_MSG_RESULT([none])
8367     else
8368         dnl We need libatomic-ops for any non X86/X64 system
8369         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8370             dnl ===================================================================
8371             dnl Check for system libatomic-ops
8372             dnl ===================================================================
8373             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8374             if test "$with_system_libatomic_ops" = "yes"; then
8375                 SYSTEM_LIBATOMIC_OPS=TRUE
8376                 AC_CHECK_HEADERS(atomic_ops.h, [],
8377                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8378             else
8379                 SYSTEM_LIBATOMIC_OPS=
8380                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8381                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8382                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8383             fi
8384         fi
8386         AC_MSG_RESULT([internal])
8387         SYSTEM_FIREBIRD=
8388         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8389         FIREBIRD_LIBS="-lfbembed"
8391         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8392         ENABLE_FIREBIRD_SDBC="TRUE"
8393     fi
8395 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8396 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8397 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8398 AC_SUBST(LIBATOMIC_OPS_LIBS)
8399 AC_SUBST(SYSTEM_FIREBIRD)
8400 AC_SUBST(FIREBIRD_CFLAGS)
8401 AC_SUBST(FIREBIRD_LIBS)
8402 dnl AC_SUBST([TOMMATH_CFLAGS])
8403 dnl AC_SUBST([TOMMATH_LIBS])
8405 dnl ===================================================================
8406 dnl Check for system curl
8407 dnl ===================================================================
8408 AC_MSG_CHECKING([which libcurl to use])
8409 if test "$with_system_curl" = "auto"; then
8410     with_system_curl="$with_system_libs"
8413 if test "$with_system_curl" = "yes"; then
8414     AC_MSG_RESULT([external])
8415     SYSTEM_CURL=TRUE
8417     AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8419     # First try PKGCONFIG and then fall back
8420     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8422     if test -n "$CURL_PKG_ERRORS"; then
8423         AC_PATH_PROG(CURLCONFIG, curl-config)
8424         if test -z "$CURLCONFIG"; then
8425             AC_MSG_ERROR([curl development files not found])
8426         fi
8427         CURL_LIBS=`$CURLCONFIG --libs`
8428         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8429         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8431         case $curl_version in
8432         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8433         dnl so they need to be doubled to end up in the configure script
8434         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8435             ;;
8436         *)
8437             AC_MSG_ERROR([no, you have $curl_version])
8438             ;;
8439         esac
8440     fi
8441     AC_MSG_RESULT([yes])
8443     libo_MINGW_CHECK_DLL([libcurl])
8444     libo_MINGW_TRY_DLL([libintl])
8445     libo_MINGW_TRY_DLL([libidn])
8446     libo_MINGW_TRY_DLL([libnspr4])
8447     libo_MINGW_TRY_DLL([nssutil3])
8448     libo_MINGW_TRY_DLL([libplc4])
8449     libo_MINGW_TRY_DLL([libplds4])
8450     libo_MINGW_TRY_DLL([nss3])
8451     libo_MINGW_TRY_DLL([ssl3])
8452     libo_MINGW_TRY_DLL([libgpg-error])
8453     libo_MINGW_TRY_DLL([libgcrypt])
8454     libo_MINGW_TRY_DLL([libssh2])
8455     ENABLE_CURL=TRUE
8456 elif test $_os = iOS; then
8457     # Let's see if we need curl, I think not?
8458     AC_MSG_RESULT([none])
8459     ENABLE_CURL=
8460 else
8461     AC_MSG_RESULT([internal])
8462     SYSTEM_CURL=
8463     BUILD_TYPE="$BUILD_TYPE CURL"
8464     ENABLE_CURL=TRUE
8466 AC_SUBST(SYSTEM_CURL)
8467 AC_SUBST(CURL_CFLAGS)
8468 AC_SUBST(CURL_LIBS)
8469 AC_SUBST(ENABLE_CURL)
8471 dnl ===================================================================
8472 dnl Check for system boost
8473 dnl ===================================================================
8474 AC_MSG_CHECKING([which boost to use])
8475 if test "$with_system_boost" = "yes"; then
8476     AC_MSG_RESULT([external])
8477     SYSTEM_BOOST=TRUE
8478     AX_BOOST_BASE(1.47)
8479     AX_BOOST_DATE_TIME
8480     AX_BOOST_IOSTREAMS
8481     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8482     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8483     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8484         # if not found, try again with 'lib' prefix
8485         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8486     fi
8487     AC_LANG_PUSH([C++])
8488     save_CXXFLAGS=$CXXFLAGS
8489     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8490     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8491        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8492     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8493        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8494     AC_CHECK_HEADER(boost/function.hpp, [],
8495        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8496     AC_MSG_CHECKING([whether boost signals2 works])
8497     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/signals2/signal.hpp>]],
8498         [[ boost::signals2::signal<void()> s; s(); ]])],
8499         [AC_MSG_RESULT([yes])],
8500         [AC_MSG_ERROR([no, install boost >= 1.55 or use --without-system-boost])])
8501     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8502     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8503     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8504 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8505     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8506         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8507     else
8508         AC_MSG_RESULT([yes])
8509     fi
8510     CXXFLAGS=$save_CXXFLAGS
8511     AC_LANG_POP([C++])
8512 else
8513     AC_MSG_RESULT([internal])
8514     BUILD_TYPE="$BUILD_TYPE BOOST"
8515     SYSTEM_BOOST=
8517 AC_SUBST(SYSTEM_BOOST)
8519 dnl ===================================================================
8520 dnl Check for system mdds
8521 dnl ===================================================================
8522 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.11.2], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8524 dnl ===================================================================
8525 dnl Check for system glm
8526 dnl ===================================================================
8527 AC_MSG_CHECKING([which glm to use])
8528 if test "$with_system_glm" = "yes"; then
8529     AC_MSG_RESULT([external])
8530     SYSTEM_GLM=TRUE
8531     AC_LANG_PUSH([C++])
8532     AC_CHECK_HEADER([glm/glm.hpp], [],
8533        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8534     AC_LANG_POP([C++])
8535 else
8536     AC_MSG_RESULT([internal])
8537     BUILD_TYPE="$BUILD_TYPE GLM"
8538     SYSTEM_GLM=
8540 AC_SUBST([SYSTEM_GLM])
8542 dnl ===================================================================
8543 dnl Check for system glew
8544 dnl ===================================================================
8545 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8547 dnl ===================================================================
8548 dnl Check for system vigra
8549 dnl ===================================================================
8550 AC_MSG_CHECKING([which vigra to use])
8551 if test "$with_system_vigra" = "yes"; then
8552     AC_MSG_RESULT([external])
8553     SYSTEM_VIGRA=TRUE
8554     AC_LANG_PUSH([C++])
8555     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8556        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8557     AC_LANG_POP([C++])
8558 else
8559     AC_MSG_RESULT([internal])
8560     BUILD_TYPE="$BUILD_TYPE VIGRA"
8561     SYSTEM_VIGRA=
8563 AC_SUBST(SYSTEM_VIGRA)
8565 dnl ===================================================================
8566 dnl Check for system odbc
8567 dnl ===================================================================
8568 AC_MSG_CHECKING([which odbc headers to use])
8569 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
8570     AC_MSG_RESULT([external])
8571     SYSTEM_ODBC_HEADERS=TRUE
8573     if test "$build_os" = "cygwin"; then
8574         save_CPPFLAGS=$CPPFLAGS
8575         find_winsdk
8576         PathFormat "$winsdktest"
8577         CPPFLAGS="$CPPFLAGS -I$formatted_path/include/um -I$formatted_path/include -I$formatted_path/include/shared"
8578         AC_CHECK_HEADER(sqlext.h, [],
8579             [AC_MSG_ERROR(odbc not found. install odbc)],
8580             [#include <windows.h>])
8581         CPPFLAGS=$save_CPPFLAGS
8582     else
8583         AC_CHECK_HEADER(sqlext.h, [],
8584             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8585     fi
8586 elif test "$enable_database_connectivity" != yes; then
8587     AC_MSG_RESULT([none])
8588 else
8589     AC_MSG_RESULT([internal])
8590     SYSTEM_ODBC_HEADERS=
8592 AC_SUBST(SYSTEM_ODBC_HEADERS)
8595 dnl ===================================================================
8596 dnl Check for system openldap
8597 dnl ===================================================================
8599 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8600 AC_MSG_CHECKING([which openldap library to use])
8601 if test "$with_system_openldap" = "yes"; then
8602     AC_MSG_RESULT([external])
8603     SYSTEM_OPENLDAP=TRUE
8604     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8605     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8606     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8607 else
8608     AC_MSG_RESULT([internal])
8609     SYSTEM_OPENLDAP=
8610     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8613 AC_SUBST(SYSTEM_OPENLDAP)
8615 dnl ===================================================================
8616 dnl Check for mozilla ab connectivity for windows
8617 dnl ===================================================================
8619 if test "$_os" = "WINNT"; then
8620     AC_MSG_CHECKING([whether to enable build of Mozilla addressbook connectivity driver for Windows])
8621     if test "$enable_win_mozab_driver" = "yes" -a "$WITH_MINGW" != "YES" ; then
8622         WITH_MOZAB4WIN=TRUE
8623         AC_MSG_RESULT([yes, internal (old windows mozab driver)])
8624         BUILD_TYPE="$BUILD_TYPE MOZ"
8625         MSVC80_DLLS="msvcp80.dll msvcr80.dll Microsoft.VC80.CRT.manifest"
8626         MSVC80_DLL_PATH=`cygpath -u "$TARFILE_LOCATION"`
8627         for dll in $MSVC80_DLLS; do
8628             if ! test -f "$MSVC80_DLL_PATH/$dll"; then
8629                 AC_MSG_ERROR([can not find $dll in $MSVC80_DLL_PATH needed for the pre-built Mozilla libraries])
8630             fi
8631         done
8632     else
8633         AC_MSG_RESULT([no])
8634         WITH_MOZAB4WIN=
8635     fi
8637 AC_SUBST(WITH_MOZAB4WIN)
8638 AC_SUBST(MSVC80_DLLS)
8639 AC_SUBST(MSVC80_DLL_PATH)
8641 dnl ===================================================================
8642 dnl Check for TLS/SSL and cryptographic implementation to use
8643 dnl ===================================================================
8644 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8645 if test -n "$with_tls"; then
8646     case $with_tls in
8647     openssl)
8648         AC_DEFINE(USE_TLS_OPENSSL)
8649         TLS=OPENSSL
8651         if test "$enable_openssl" != "yes"; then
8652             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8653         fi
8655         # warn that OpenSSL has been selected but not all TLS code has this option
8656         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8657         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8658         ;;
8659     nss)
8660         AC_DEFINE(USE_TLS_NSS)
8661         TLS=NSS
8662         ;;
8663     *)
8664         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8665 openssl - OpenSSL
8666 nss - Mozilla's Network Security Services (NSS)
8667     ])
8668         ;;
8669     esac
8670 elif test $_os = iOS -o $_os = Android; then
8671     # We don't build NSS for iOS and Android
8672     AC_DEFINE(USE_TLS_OPENSSL)
8673     TLS=OPENSSL
8674 else
8675     # default to using NSS, it results in smaller oox lib
8676     AC_DEFINE(USE_TLS_NSS)
8677     TLS=NSS
8679 AC_MSG_RESULT([$TLS])
8680 AC_SUBST(TLS)
8682 dnl ===================================================================
8683 dnl Check for system NSS
8684 dnl ===================================================================
8685 libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8686 if test "$with_system_nss" = "yes"; then
8687     libo_MINGW_CHECK_DLL([libnspr4])
8688     libo_MINGW_CHECK_DLL([libplc4])
8689     libo_MINGW_CHECK_DLL([libplds4])
8690     libo_MINGW_CHECK_DLL([nss3])
8691     libo_MINGW_CHECK_DLL([nssutil3])
8692     libo_MINGW_CHECK_DLL([smime3])
8693     libo_MINGW_CHECK_DLL([ssl3])
8696 dnl ===================================================================
8697 dnl Check for system mozilla headers
8698 dnl ===================================================================
8699 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8700 AC_MSG_CHECKING([which NPAPI headers to use])
8702 if test "$with_system_npapi_headers" = "yes"; then
8703     AC_MSG_RESULT([external])
8704     SYSTEM_NPAPI_HEADERS=TRUE
8705     # First try npapi-sdk:
8706     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8707     # Then go with libxul:
8708     if test "x$LOCATED" != "xyes"; then
8709         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8710     fi
8711     if test "x$LOCATED" != "xyes"; then
8712         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8713     fi
8714     # if still not found bail out
8715     if test "x$LOCATED" != "xyes"; then
8716         AC_MSG_ERROR([npapi.h header file not found])
8717     fi
8719     AC_LANG_PUSH([C])
8720     save_CFLAGS=$CFLAGS
8721     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8722     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8723     AC_COMPILE_IFELSE(
8724         [AC_LANG_SOURCE([[
8725             #define XP_UNIX
8726             #include <npapi.h>
8727             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8728             ]])],
8729         [AC_MSG_RESULT([const char*])],
8730         [
8731         AC_MSG_RESULT([char*])
8732         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8733         ])
8734     CFLAGS=$save_CFLAGS
8735     AC_LANG_POP([C])
8736     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8737 else
8738     AC_MSG_RESULT([internal])
8739         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER
8740     SYSTEM_NPAPI_HEADERS=
8742 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8743 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8744 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8746 dnl ===================================================================
8747 dnl Check for system sane
8748 dnl ===================================================================
8749 AC_MSG_CHECKING([which sane header to use])
8750 if test "$with_system_sane" = "yes"; then
8751     AC_MSG_RESULT([external])
8752     AC_CHECK_HEADER(sane/sane.h, [],
8753       [AC_MSG_ERROR(sane not found. install sane)], [])
8754 else
8755     AC_MSG_RESULT([internal])
8756     BUILD_TYPE="$BUILD_TYPE SANE"
8759 dnl ===================================================================
8760 dnl Check for system icu
8761 dnl ===================================================================
8762 SYSTEM_GENBRK=
8763 SYSTEM_GENCCODE=
8764 SYSTEM_GENCMN=
8766 ICU_MAJOR=53
8767 ICU_MINOR=1
8768 ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
8769 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8770 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8771 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8772 AC_MSG_CHECKING([which icu to use])
8773 if test "$with_system_icu" = "yes"; then
8774     AC_MSG_RESULT([external])
8775     SYSTEM_ICU=TRUE
8776     AC_LANG_PUSH([C++])
8777     AC_MSG_CHECKING([for unicode/rbbi.h])
8778     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8779     AC_LANG_POP([C++])
8781     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8782         ICUPATH="$PATH"
8783         if test "$WITH_MINGW" = "yes"; then
8784             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8785         fi
8786         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8788         AC_MSG_CHECKING([ICU version])
8789         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8790         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8791         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8793         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "2" \); then
8794             AC_MSG_RESULT([OK, $ICU_VERSION])
8795         else
8796             AC_MSG_ERROR([not suitable, only >= 4.2 supported currently])
8797         fi
8798     fi
8800     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8801         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8802         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8803         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8804         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8805         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8806         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8807             AC_MSG_RESULT([yes])
8808         else
8809             AC_MSG_RESULT([no])
8810             if test "$with_system_icu_for_build" != "force"; then
8811                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8812 You can use --with-system-icu-for-build=force to use it anyway.])
8813             fi
8814         fi
8815     fi
8817     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
8818         # using the system icu tools can lead to version confusion, use the
8819         # ones from the build environment when cross-compiling
8820         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
8821         if test -z "$SYSTEM_GENBRK"; then
8822             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
8823         fi
8824         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8825         if test -z "$SYSTEM_GENCCODE"; then
8826             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
8827         fi
8828         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
8829         if test -z "$SYSTEM_GENCMN"; then
8830             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
8831         fi
8832         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "4" \); then
8833             ICU_RECLASSIFIED_CLOSE_PARENTHESIS="TRUE"
8834         else
8835             ICU_RECLASSIFIED_CLOSE_PARENTHESIS=
8836         fi
8837         if test "$ICU_MAJOR" -ge "49"; then
8838             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8839             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8840             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8841         else
8842             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
8843             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
8844             ICU_RECLASSIFIED_HEBREW_LETTER=
8845         fi
8846     fi
8848     if test "$cross_compiling" = "yes"; then
8849         if test "$ICU_MAJOR" -ge "50"; then
8850             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
8851             ICU_MINOR=""
8852         fi
8853     fi
8855     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
8856     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
8857     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
8858 else
8859     AC_MSG_RESULT([internal])
8860     SYSTEM_ICU=
8861     BUILD_TYPE="$BUILD_TYPE ICU"
8862     # surprisingly set these only for "internal" (to be used by various other
8863     # external libs): the system icu-config is quite unhelpful and spits out
8864     # dozens of weird flags and also default path -I/usr/include
8865     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8866     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
8868 AC_SUBST(SYSTEM_ICU)
8869 AC_SUBST(SYSTEM_GENBRK)
8870 AC_SUBST(SYSTEM_GENCCODE)
8871 AC_SUBST(SYSTEM_GENCMN)
8872 AC_SUBST(ICU_MAJOR)
8873 AC_SUBST(ICU_MINOR)
8874 AC_SUBST(ICU_RECLASSIFIED_CLOSE_PARENTHESIS)
8875 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
8876 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
8877 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
8878 AC_SUBST(ICU_CFLAGS)
8879 AC_SUBST(ICU_LIBS)
8881 dnl ===================================================================
8882 dnl Graphite
8883 dnl ===================================================================
8885 AC_MSG_CHECKING([whether to enable graphite support])
8886 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
8887     AC_MSG_RESULT([yes])
8888     ENABLE_GRAPHITE="TRUE"
8889     AC_DEFINE(ENABLE_GRAPHITE)
8890     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
8891     if test "$with_system_graphite" = "yes"; then
8892         libo_MINGW_CHECK_DLL([libgraphite2])
8893     fi
8894 else
8895     AC_MSG_RESULT([no])
8897 AC_SUBST(ENABLE_GRAPHITE)
8899 dnl ===================================================================
8900 dnl Orcus
8901 dnl ===================================================================
8903 AC_MSG_CHECKING([whether to enable orcus])
8904 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
8905     AC_MSG_RESULT([yes])
8906     ENABLE_ORCUS="TRUE"
8907     AC_DEFINE(ENABLE_ORCUS)
8909     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.8 >= 0.7.0])
8910     if test "$with_system_orcus" != "yes"; then
8911         if test "$SYSTEM_BOOST" = "TRUE"; then
8912             # ===========================================================
8913             # Determine if we are going to need to link with Boost.System
8914             # ===========================================================
8915             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
8916             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
8917             dnl in documentation has no effect.
8918             AC_MSG_CHECKING([if we need to link with Boost.System])
8919             AC_LANG_PUSH([C++])
8920             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
8921                     @%:@include <boost/version.hpp>
8922                 ]],[[
8923                     #if BOOST_VERSION >= 105000
8924                     #   error yes, we need to link with Boost.System
8925                     #endif
8926                 ]])],[
8927                     AC_MSG_RESULT([no])
8928                 ],[
8929                     AC_MSG_RESULT([yes])
8930                     AX_BOOST_SYSTEM
8931             ])
8932             AC_LANG_POP([C++])
8933         fi
8934     fi
8935     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
8936     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
8937     AC_SUBST([BOOST_SYSTEM_LIB])
8938     AC_SUBST(SYSTEM_LIBORCUS)
8940 else
8941     AC_MSG_RESULT([no])
8943 AC_SUBST(ENABLE_ORCUS)
8945 dnl ===================================================================
8946 dnl HarfBuzz
8947 dnl ===================================================================
8948 AC_MSG_CHECKING([whether to enable HarfBuzz support])
8949 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
8950     AC_MSG_RESULT([yes])
8951     ENABLE_HARFBUZZ="TRUE"
8952     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
8953         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"])
8954     else
8955         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
8956     fi
8957 else
8958     AC_MSG_RESULT([no])
8960 AC_SUBST(ENABLE_HARFBUZZ)
8962 dnl ===================================================================
8963 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
8964 dnl ===================================================================
8965 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
8966 # Obviously no such thing on iOS or Android. Also not possible when building
8967 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
8968 if test "$_os" != Android -a "$_os" != iOS -a $_os != Darwin -a \
8969         "$with_x" != "no" -a "$enable_mpl_subset" != yes
8970 then
8971     AC_MSG_RESULT([yes])
8972     ENABLE_NPAPI_FROM_BROWSER=TRUE
8973 else
8974     AC_MSG_RESULT([no])
8975     ENABLE_NPAPI_FROM_BROWSER=
8977 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
8979 AC_MSG_CHECKING([whether to use X11])
8980 dnl ***************************************
8981 dnl testing for X libraries and includes...
8982 dnl ***************************************
8983 WANT_X11="no"
8984 if test $_os != Darwin -a $_os != WINNT -a $_os != Android -a $_os != iOS -a "$with_x" != "no"; then
8985     WANT_X11="yes"
8986     AC_DEFINE(HAVE_FEATURE_X11)
8988 AC_MSG_RESULT([$WANT_X11])
8990 if test "$WANT_X11" = "yes"; then
8991     AC_PATH_X
8992     AC_PATH_XTRA
8993     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
8995     if test -z "$x_includes"; then
8996         x_includes="default_x_includes"
8997     fi
8998     if test -z "$x_libraries"; then
8999         x_libraries="default_x_libraries"
9000     fi
9001     CFLAGS="$CFLAGS $X_CFLAGS"
9002     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9003     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9004 else
9005     x_includes="no_x_includes"
9006     x_libraries="no_x_libraries"
9009 if test "$WANT_X11" = "yes"; then
9010     dnl ===================================================================
9011     dnl Check for Composite.h for Mozilla plugin
9012     dnl ===================================================================
9013     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9014      [#include <X11/Intrinsic.h>])
9016     # ENABLE_NPAPI_FROM_BROWSER requires Xt library
9017     AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:],
9018         [AC_MSG_ERROR(Xt library not found)])
9020     dnl ===================================================================
9021     dnl Check for extension headers
9022     dnl ===================================================================
9023     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9024      [#include <X11/extensions/shape.h>])
9026     # vcl needs ICE and SM
9027     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9028     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9029         [AC_MSG_ERROR(ICE library not found)])
9030     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9031     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9032         [AC_MSG_ERROR(SM library not found)])
9035 dnl ===================================================================
9036 dnl Check for system Xrender
9037 dnl ===================================================================
9038 AC_MSG_CHECKING([whether to use Xrender])
9039 if test "$WANT_X11" = "yes" -a  "$test_xrender" = "yes"; then
9040     AC_MSG_RESULT([yes])
9041     PKG_CHECK_MODULES(XRENDER, xrender)
9042     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9043     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9044       [AC_MSG_ERROR(libXrender not found or functional)], [])
9045     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9046       [AC_MSG_ERROR(Xrender not found. install X)], [])
9047 else
9048     AC_MSG_RESULT([no])
9050 AC_SUBST(XRENDER_CFLAGS)
9051 AC_SUBST(XRENDER_LIBS)
9053 dnl ===================================================================
9054 dnl Check for XRandr
9055 dnl ===================================================================
9056 AC_MSG_CHECKING([whether to enable RandR support])
9057 if test "$WANT_X11" = "yes" -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9058     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9059         XRANDR_DLOPEN="TRUE"
9060         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9061     else
9062         AC_MSG_RESULT([yes])
9063         XRANDR_DLOPEN="FALSE"
9064         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9065         if test "$ENABLE_RANDR" != "TRUE"; then
9066             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9067                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9068             XRANDR_CFLAGS=" "
9069             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9070               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9071             XRANDR_LIBS="-lXrandr "
9072             ENABLE_RANDR="TRUE"
9073         fi
9074         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9075     fi
9076 else
9077     ENABLE_RANDR=""
9078     AC_MSG_RESULT([no])
9080 AC_SUBST(XRANDR_DLOPEN)
9081 AC_SUBST(XRANDR_CFLAGS)
9082 AC_SUBST(XRANDR_LIBS)
9083 AC_SUBST(ENABLE_RANDR)
9085 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9086     WITH_WEBDAV="serf"
9088 if test $_os = iOS -o $_os = Android; then
9089     WITH_WEBDAV="no"
9091 AC_MSG_CHECKING([for webdav library])
9092 case "$WITH_WEBDAV" in
9093 serf)
9094     AC_MSG_RESULT([serf])
9095     # Check for system apr-util
9096     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9097                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9098                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9099     if test "$COM" = "MSC"; then
9100         APR_LIB_DIR="LibR"
9101         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9102         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9103     fi
9105     # Check for system serf
9106     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9107                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9108     if test "$COM" = "MSC"; then
9109         SERF_LIB_DIR="Release"
9110         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9111         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9112     fi
9113     ;;
9114 neon)
9115     AC_MSG_RESULT([neon])
9116     # Check for system neon
9117     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9118     if test "$with_system_neon" = "yes"; then
9119         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9120         libo_MINGW_CHECK_DLL([libneon])
9121         libo_MINGW_TRY_DLL([libtasn1])
9122         libo_MINGW_TRY_DLL([libgnutls])
9123     else
9124         NEON_VERSION=0295
9125     fi
9126     AC_SUBST(NEON_VERSION)
9127     ;;
9129     AC_MSG_RESULT([none, disabled])
9130     WITH_WEBDAV=""
9131     ;;
9132 esac
9133 AC_SUBST(WITH_WEBDAV)
9135 dnl ===================================================================
9136 dnl Check for disabling cve_tests
9137 dnl ===================================================================
9138 AC_MSG_CHECKING([whether to execute CVE tests])
9139 # If not explicitly enabled or disabled, default
9140 if test -z "$enable_cve_tests"; then
9141     case "$OS" in
9142     WNT)
9143         # Default cves off for windows with its wild and wonderful
9144         # varienty of AV software kicking in and panicing
9145         enable_cve_tests=no
9146         ;;
9147     *)
9148         # otherwise yes
9149         enable_cve_tests=yes
9150         ;;
9151     esac
9153 if test "$enable_cve_tests" = "no"; then
9154     AC_MSG_RESULT([no])
9155     DISABLE_CVE_TESTS=TRUE
9156     AC_SUBST(DISABLE_CVE_TESTS)
9157 else
9158     AC_MSG_RESULT([yes])
9161 dnl ===================================================================
9162 dnl Check for enabling chart XShape tests
9163 dnl ===================================================================
9164 AC_MSG_CHECKING([whether to execute chart XShape tests])
9165 if test "$enable_chart_tests" = "yes"; then
9166     AC_MSG_RESULT([yes])
9167     ENABLE_CHART_TESTS=TRUE
9168     AC_SUBST(ENABLE_CHART_TESTS)
9169 else
9170     AC_MSG_RESULT([no])
9173 dnl ===================================================================
9174 dnl Check for system openssl
9175 dnl ===================================================================
9176 DISABLE_OPENSSL=
9177 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9178 if test "$enable_openssl" = "yes"; then
9179     AC_MSG_RESULT([no])
9180     if test "$_os" = Darwin ; then
9181         # OpenSSL is deprecated when building for 10.7 or later.
9182         #
9183         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9184         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9186         with_system_openssl=no
9187         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9188     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9189             && test "$with_system_openssl" != "no"; then
9190         with_system_openssl=yes
9191         SYSTEM_OPENSSL=TRUE
9192         OPENSSL_CFLAGS=
9193         OPENSSL_LIBS="-lssl -lcrypto"
9194     else
9195         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9196     fi
9197     if test "$with_system_openssl" = "yes"; then
9198         libo_MINGW_CHECK_DLL([libssl])
9199         libo_MINGW_CHECK_DLL([libcrypto])
9200         AC_MSG_CHECKING([whether openssl supports SHA512])
9201         AC_LANG_PUSH([C])
9202         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9203             SHA512_CTX context;
9204 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9205         AC_LANG_POP(C)
9206     fi
9207 else
9208     AC_MSG_RESULT([yes])
9209     DISABLE_OPENSSL=TRUE
9211     # warn that although OpenSSL is disabled, system libraries may be depending on it
9212     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9213     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9216 AC_SUBST([DISABLE_OPENSSL])
9218 dnl ===================================================================
9219 dnl Check for building gnutls
9220 dnl ===================================================================
9221 AC_MSG_CHECKING([whether to use gnutls])
9222 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9223     AC_MSG_RESULT([yes])
9224     AM_PATH_LIBGCRYPT()
9225     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9226         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9227                       available in the system to use as replacement.]]))
9230 AC_SUBST([LIBGCRYPT_CFLAGS])
9231 AC_SUBST([LIBGCRYPT_LIBS])
9233 dnl ===================================================================
9234 dnl Check for system redland
9235 dnl ===================================================================
9236 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9237 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9238 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9239 if test "$with_system_redland" = "yes"; then
9240     libo_MINGW_CHECK_DLL([librdf])
9241     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9242             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9243     libo_MINGW_TRY_DLL([libraptor])
9244     libo_MINGW_TRY_DLL([librasqal])
9245     libo_MINGW_TRY_DLL([libsqlite3])
9246 else
9247     RAPTOR_MAJOR="0"
9248     RASQAL_MAJOR="3"
9249     REDLAND_MAJOR="0"
9251 AC_SUBST(RAPTOR_MAJOR)
9252 AC_SUBST(RASQAL_MAJOR)
9253 AC_SUBST(REDLAND_MAJOR)
9255 dnl ===================================================================
9256 dnl Check for system hunspell
9257 dnl ===================================================================
9258 AC_MSG_CHECKING([which libhunspell to use])
9259 if test "$with_system_hunspell" = "yes"; then
9260     AC_MSG_RESULT([external])
9261     SYSTEM_HUNSPELL=TRUE
9262     AC_LANG_PUSH([C++])
9263     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9264     if test "$HUNSPELL_PC" != "TRUE"; then
9265         AC_CHECK_HEADER(hunspell.hxx, [],
9266             [
9267             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9268             [AC_MSG_ERROR(hunspell headers not found.)], [])
9269             ], [])
9270         AC_CHECK_LIB([hunspell], [main], [:],
9271            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9272         HUNSPELL_LIBS=-lhunspell
9273     fi
9274     AC_LANG_POP([C++])
9275     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9276     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9277 else
9278     AC_MSG_RESULT([internal])
9279     SYSTEM_HUNSPELL=
9280     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9281     if test "$COM" = "MSC"; then
9282         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9283     else
9284         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9285     fi
9286     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9288 AC_SUBST(SYSTEM_HUNSPELL)
9289 AC_SUBST(HUNSPELL_CFLAGS)
9290 AC_SUBST(HUNSPELL_LIBS)
9292 dnl ===================================================================
9293 dnl Checking for altlinuxhyph
9294 dnl ===================================================================
9295 AC_MSG_CHECKING([which altlinuxhyph to use])
9296 if test "$with_system_altlinuxhyph" = "yes"; then
9297     AC_MSG_RESULT([external])
9298     SYSTEM_HYPH=TRUE
9299     AC_CHECK_HEADER(hyphen.h, [],
9300        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9301     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9302        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9303        [#include <hyphen.h>])
9304     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9305         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9306     if test -z "$HYPHEN_LIB"; then
9307         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9308            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9309     fi
9310     if test -z "$HYPHEN_LIB"; then
9311         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9312            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9313     fi
9314     libo_MINGW_CHECK_DLL([libhyphen])
9315 else
9316     AC_MSG_RESULT([internal])
9317     SYSTEM_HYPH=
9318     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9319     if test "$COM" = "MSC"; then
9320         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9321     else
9322         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9323     fi
9325 AC_SUBST(SYSTEM_HYPH)
9326 AC_SUBST(HYPHEN_LIB)
9328 dnl ===================================================================
9329 dnl Checking for mythes
9330 dnl ===================================================================
9331 AC_MSG_CHECKING([which mythes to use])
9332 if test "$with_system_mythes" = "yes"; then
9333     AC_MSG_RESULT([external])
9334     SYSTEM_MYTHES=TRUE
9335     AC_LANG_PUSH([C++])
9336     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9337     if test "$MYTHES_PKGCONFIG" = "no"; then
9338         AC_CHECK_HEADER(mythes.hxx, [],
9339             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9340         AC_CHECK_LIB([mythes-1.2], [main], [:],
9341             [ MYTHES_FOUND=no], [])
9342     if test "$MYTHES_FOUND" = "no"; then
9343         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9344                 [ MYTHES_FOUND=no], [])
9345     fi
9346     if test "$MYTHES_FOUND" = "no"; then
9347         AC_MSG_ERROR([mythes library not found!.])
9348     fi
9349     fi
9350     AC_LANG_POP([C++])
9351     libo_MINGW_CHECK_DLL([libmythes-1.2])
9352     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9353 else
9354     AC_MSG_RESULT([internal])
9355     SYSTEM_MYTHES=
9356     BUILD_TYPE="$BUILD_TYPE MYTHES"
9357     if test "$COM" = "MSC"; then
9358         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9359     else
9360         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9361     fi
9363 AC_SUBST(SYSTEM_MYTHES)
9364 AC_SUBST(MYTHES_CFLAGS)
9365 AC_SUBST(MYTHES_LIBS)
9367 dnl ===================================================================
9368 dnl How should we build the linear programming solver ?
9369 dnl ===================================================================
9371 ENABLE_COINMP=
9372 AC_MSG_CHECKING([whether to build with CoinMP])
9373 if test "$enable_coinmp" != "no"; then
9374     ENABLE_COINMP=TRUE
9375     AC_MSG_RESULT([yes])
9376     if test "$with_system_coinmp" = "yes"; then
9377     SYSTEM_COINMP=TRUE
9378     PKG_CHECK_MODULES( COINMP, coinmp )
9379     else
9380         BUILD_TYPE="$BUILD_TYPE COINMP"
9381     fi
9382 else
9383     AC_MSG_RESULT([no])
9385 AC_SUBST(ENABLE_COINMP)
9386 AC_SUBST(SYSTEM_COINMP)
9387 AC_SUBST(COINMP_CFLAGS)
9388 AC_SUBST(COINMP_LIBS)
9390 ENABLE_LPSOLVE=
9391 AC_MSG_CHECKING([whether to build with lpsolve])
9392 if test "$enable_lpsolve" != "no"; then
9393     ENABLE_LPSOLVE=TRUE
9394     AC_MSG_RESULT([yes])
9395 else
9396     AC_MSG_RESULT([no])
9398 AC_SUBST(ENABLE_LPSOLVE)
9400 if test "$ENABLE_LPSOLVE" = TRUE; then
9401     AC_MSG_CHECKING([which lpsolve to use])
9402     if test "$with_system_lpsolve" = "yes"; then
9403         AC_MSG_RESULT([external])
9404         SYSTEM_LPSOLVE=TRUE
9405         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9406            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9407         save_LIBS=$LIBS
9408         # some systems need this. Like Ubuntu....
9409         AC_CHECK_LIB(m, floor)
9410         AC_CHECK_LIB(dl, dlopen)
9411         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9412             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9413         LIBS=$save_LIBS
9414         libo_MINGW_CHECK_DLL([lpsolve55])
9415     else
9416         AC_MSG_RESULT([internal])
9417         SYSTEM_LPSOLVE=
9418         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9419     fi
9421 AC_SUBST(SYSTEM_LPSOLVE)
9423 dnl ===================================================================
9424 dnl Checking for libexttextcat
9425 dnl ===================================================================
9426 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
9427 if test "$with_system_libexttextcat" = "yes"; then
9428     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9430 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9432 dnl ***************************************
9433 dnl testing libc version for Linux...
9434 dnl ***************************************
9435 if test "$_os" = "Linux"; then
9436     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9437     exec 6>/dev/null # no output
9438     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9439     exec 6>&1 # output on again
9440     if test "$HAVE_LIBC"; then
9441         AC_MSG_RESULT([yes])
9442     else
9443         AC_MSG_ERROR([no, upgrade libc])
9444     fi
9447 dnl =========================================
9448 dnl Check for the Windows  SDK.
9449 dnl =========================================
9450 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9451 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9452 if test "$_os" = "WINNT"; then
9453     AC_MSG_CHECKING([for Windows SDK])
9454     if test "$build_os" = "cygwin"; then
9455         find_winsdk
9456         WINDOWS_SDK_HOME=$winsdktest
9458         # normalize if found
9459         if test -n "$WINDOWS_SDK_HOME"; then
9460             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9461             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9462         fi
9464         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
9465     fi
9467     if test -n "$WINDOWS_SDK_HOME"; then
9468         # Remove a possible trailing backslash
9469         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9471         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9472              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9473              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9474             have_windows_sdk_headers=yes
9475         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9476              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9477              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9478             have_windows_sdk_headers=yes
9479         else
9480             have_windows_sdk_headers=no
9481         fi
9483         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9484             have_windows_sdk_libs=yes
9485         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9486             have_windows_sdk_libs=yes
9487         else
9488             have_windows_sdk_libs=no
9489         fi
9491         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9492             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9493 the  Windows SDK are installed.])
9494         fi
9496         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9497              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9498              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9499              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9500         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9501              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9502              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9503              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9504         else
9505             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9506         fi
9507     fi
9509     if test -z "$WINDOWS_SDK_HOME"; then
9510         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9511     elif echo $WINDOWS_SDK_HOME | grep "v6.0" >/dev/null 2>/dev/null; then
9512         WINDOWS_SDK_VERSION=60
9513         AC_MSG_RESULT([found Windows SDK 6.0 ($WINDOWS_SDK_HOME)])
9514     elif echo $WINDOWS_SDK_HOME | grep "v6.1" >/dev/null 2>/dev/null; then
9515         WINDOWS_SDK_VERSION=61
9516         AC_MSG_RESULT([found Windows SDK 6.1 ($WINDOWS_SDK_HOME)])
9517     elif echo $WINDOWS_SDK_HOME | grep "v7" >/dev/null 2>/dev/null; then
9518         WINDOWS_SDK_VERSION=70
9519         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9520     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9521         WINDOWS_SDK_VERSION=80
9522         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9523         # compatibility warning if usind VS 2012 and not explicitly choosing the 80 SDK
9524         if test "$VCVER" = "110" -a -z "$with_windows_sdk"; then
9525             AC_MSG_WARN([If a build created with VS 2012 should run on Windows XP,])
9526             AC_MSG_WARN([use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)])
9527             add_warning "If a build created with VS 2012 should run on Windows XP,"
9528             add_warning "use --with-windows-sdk=7.1A (requires VS 2012 Update 1 or newer)"
9529         fi
9530     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
9531         WINDOWS_SDK_VERSION=81
9532         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
9533     else
9534         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9535     fi
9536     PathFormat "$WINDOWS_SDK_HOME"
9537     WINDOWS_SDK_HOME="$formatted_path"
9538     if test "$build_os" = "cygwin"; then
9539         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9540         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9541             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9542         fi
9543     fi
9545     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9546     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9547     dnl but not in v8.0), so allow this to be overridden with a
9548     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9549     dnl and configuration error if no WiLangId.vbs is found would arguably be
9550     dnl better, but I do not know under which conditions exactly it is needed by
9551     dnl msiglobal.pm:
9552     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9553         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9554         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9555             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9556         fi
9557         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9558             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.0/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9559         fi
9560         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9561             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9562             add_warning "WiLangId.vbs not found - building translated packages will fail"
9563         fi
9564     fi
9566 AC_SUBST(WINDOWS_SDK_HOME)
9567 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
9568 AC_SUBST(WINDOWS_SDK_VERSION)
9569 AC_SUBST(WINDOWS_SDK_WILANGID)
9571 dnl =========================================
9572 dnl Check for uuidgen
9573 dnl =========================================
9574 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9575     if test "$WITH_MINGW" = "yes"; then
9576         AC_PATH_PROG([UUIDGEN], [uuid])
9577         if test -z "$UUIDGEN"; then
9578             AC_MSG_WARN([uuid is needed for building installation sets])
9579         fi
9580     else
9581         # presence is already tested above in the WINDOWS_SDK_HOME check
9582         UUIDGEN=uuidgen.exe
9583         AC_SUBST(UUIDGEN)
9584     fi
9585 else
9586     AC_PATH_PROG([UUIDGEN], [uuidgen])
9587     if test -z "$UUIDGEN"; then
9588         AC_MSG_WARN([uuid is needed for building installation sets])
9589     fi
9592 dnl =========================================
9593 dnl Check for the Microsoft DirectX SDK.
9594 dnl =========================================
9595 if test -n "$ENABLE_DIRECTX" -a "$_os" = "WINNT"; then
9596     AC_MSG_CHECKING([for DirectX SDK])
9597     if test "$build_os" = "cygwin"; then
9598         dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
9599         if test -n "$DXSDK_DIR"; then
9600             DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
9601             DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
9602         fi
9603         # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
9604         # the "DirectX SDK not found" error later.
9605         # (Where?)
9607         # Remove a possible trailing backslash
9608         DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
9609     fi
9611     if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" -o -f "$DIRECTXSDK_HOME/Include/d3d9.h"; then
9612         HAVE_DIRECTXSDK_H="yes"
9613     else
9614         HAVE_DIRECTXSDK_H="no"
9615     fi
9617     if test "$BITNESS_OVERRIDE" = 64; then
9618         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x64"
9619     else
9620         DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
9621     fi
9622     PathFormat "$DIRECTXSDK_LIB"
9623     DIRECTXSDK_LIB="$formatted_path"
9625     if test -f "$DIRECTXSDK_LIB/ddraw.lib" -o -f "$DIRECTXSDK_LIB/d3d9.lib"; then
9626         HAVE_DIRECTXSDK_LIB="yes"
9627     else
9628         HAVE_DIRECTXSDK_LIB="no"
9629     fi
9631     if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
9632         AC_MSG_RESULT([found])
9633     else
9634         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway])
9635     fi
9636     if test -n "$DIRECTXSDK_HOME"; then
9637         PathFormat "$DIRECTXSDK_HOME"
9638         DIRECTXSDK_HOME="$formatted_path"
9639         SOLARINC="$SOLARINC -I$DIRECTXSDK_HOME/include"
9640     fi
9642 AC_SUBST(DIRECTXSDK_HOME)
9644 dnl ***************************************
9645 dnl Checking for bison and flex
9646 dnl ***************************************
9647 AC_PATH_PROG(BISON, bison)
9648 if test -z "$BISON"; then
9649     AC_MSG_ERROR([no bison found in \$PATH, install it])
9650 else
9651     AC_MSG_CHECKING([the bison version])
9652     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9653     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9654     # Accept newer than 2.0
9655     if test "$_bison_longver" -lt 2000; then
9656         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9657     fi
9660 AC_PATH_PROG(FLEX, flex)
9661 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9662     FLEX=`cygpath -m $FLEX`
9664 if test -z "$FLEX"; then
9665     AC_MSG_ERROR([no flex found in \$PATH, install it])
9666 else
9667     AC_MSG_CHECKING([the flex version])
9668     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9669     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9670         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9671     fi
9673 AC_SUBST([FLEX])
9674 dnl ***************************************
9675 dnl Checking for patch
9676 dnl ***************************************
9677 AC_PATH_PROG(PATCH, patch)
9678 if test -z "$PATCH"; then
9679     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9682 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9683 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9684     if test -z "$with_gnu_patch"; then
9685         GNUPATCH=$PATCH
9686     else
9687         if test -x "$with_gnu_patch"; then
9688             GNUPATCH=$with_gnu_patch
9689         else
9690             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9691         fi
9692     fi
9694     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9695     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9696         AC_MSG_RESULT([yes])
9697     else
9698         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9699     fi
9700 else
9701     GNUPATCH=$PATCH
9704 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9705     GNUPATCH=`cygpath -m $GNUPATCH`
9708 dnl We also need to check for --with-gnu-cp
9710 if test -z "$with_gnu_cp"; then
9711     # check the place where the good stuff is hidden on Solaris...
9712     if test -x /usr/gnu/bin/cp; then
9713         GNUCP=/usr/gnu/bin/cp
9714     else
9715         AC_PATH_PROGS(GNUCP, gnucp cp)
9716     fi
9717     if test -z $GNUCP; then
9718         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9719     fi
9720 else
9721     if test -x "$with_gnu_cp"; then
9722         GNUCP=$with_gnu_cp
9723     else
9724         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9725     fi
9728 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9729     GNUCP=`cygpath -m $GNUCP`
9732 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9733 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9734     AC_MSG_RESULT([yes])
9735 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9736     AC_MSG_RESULT([yes])
9737 else
9738     case "$build_os" in
9739     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9740         x_GNUCP=[\#]
9741         GNUCP=''
9742         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9743         ;;
9744     *)
9745         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9746         ;;
9747     esac
9750 AC_SUBST(GNUPATCH)
9751 AC_SUBST(GNUCP)
9752 AC_SUBST(x_GNUCP)
9754 dnl ***************************************
9755 dnl testing assembler path
9756 dnl ***************************************
9757 ML_EXE=""
9758 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9759     if test "$BITNESS_OVERRIDE" = ""; then
9760         assembler=ml.exe
9761         assembler_bin=bin
9762     else
9763         assembler=ml64.exe
9764         assembler_bin=bin/amd64
9765     fi
9767     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9768     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9769         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9770         AC_MSG_RESULT([found])
9771         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9772     else
9773         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9774     fi
9776     PathFormat "$ASM_HOME"
9777     ASM_HOME="$formatted_path"
9778 else
9779     ASM_HOME=""
9782 AC_SUBST(ML_EXE)
9784 dnl ===================================================================
9785 dnl We need zip and unzip
9786 dnl ===================================================================
9787 AC_PATH_PROG(ZIP, zip)
9788 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9789 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9790     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],,)
9793 AC_PATH_PROG(UNZIP, unzip)
9794 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9796 dnl ===================================================================
9797 dnl Zip must be a specific type for different build types.
9798 dnl ===================================================================
9799 if test $build_os = cygwin; then
9800     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9801         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9802     fi
9805 dnl ===================================================================
9806 dnl We need touch with -h option support.
9807 dnl ===================================================================
9808 AC_PATH_PROG(TOUCH, touch)
9809 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9810 touch warn
9811 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9812     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],,)
9815 dnl ===================================================================
9816 dnl Set vcl option: coordinate device in double or sal_Int32
9817 dnl ===================================================================
9819 AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9820 if test "$_os" = "Darwin" -o  $_os = iOS ; then
9821     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9822     AC_MSG_RESULT([double])
9823 else
9824     AC_MSG_RESULT([sal_Int32])
9827 dnl ===================================================================
9828 dnl Test which vclplugs have to be built.
9829 dnl ===================================================================
9830 R=""
9831 GTK3_CFLAGS=""
9832 GTK3_LIBS=""
9833 ENABLE_GTK3=""
9834 if test "x$enable_gtk3" = "xyes"; then
9835     if test "$with_system_cairo" = no; then
9836         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9837     fi
9838     : ${with_system_cairo:=yes}
9839     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="")
9840     if test "x$ENABLE_GTK3" = "xTRUE"; then
9841         R="gtk3"
9842     else
9843         AC_MSG_ERROR([gtk3 libraries of the correct versions, not found])
9844     fi
9845     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9847 AC_SUBST(GTK3_LIBS)
9848 AC_SUBST(GTK3_CFLAGS)
9849 AC_SUBST(ENABLE_GTK3)
9851 AC_MSG_CHECKING([which VCLplugs shall be built])
9852 if test "$GUIBASE" != "unx" -o "$with_x" = "no"; then
9853     enable_gtk=no
9855 ENABLE_GTK=""
9856 if test "x$enable_gtk" = "xyes"; then
9857     if test "$with_system_cairo" = no; then
9858         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9859     fi
9860     : ${with_system_cairo:=yes}
9861     ENABLE_GTK="TRUE"
9862     AC_DEFINE(ENABLE_GTK)
9863     R="gtk $R"
9865 AC_SUBST(ENABLE_GTK)
9867 ENABLE_TDE=""
9868 if test "x$enable_tde" = "xyes"; then
9869     # Libs kab and tdeab in connectivity and kdeab and tdeab in shell
9870     # are built from the same sources. So we only allow one of them.
9871     if test "x$enable_kde" = "xyes"; then
9872         AC_MSG_ERROR([enabling both KDE and TDE is not supported])
9873     fi
9874     ENABLE_TDE="TRUE"
9875     AC_DEFINE(ENABLE_TDE)
9876     R="$R tde"
9878 AC_SUBST(ENABLE_TDE)
9880 ENABLE_KDE=""
9881 if test "x$enable_kde" = "xyes"; then
9882     ENABLE_KDE="TRUE"
9883     AC_DEFINE(ENABLE_KDE)
9884     R="$R kde"
9886 AC_SUBST(ENABLE_KDE)
9888 ENABLE_KDE4=""
9889 if test "x$enable_kde4" = "xyes"; then
9890     ENABLE_KDE4="TRUE"
9891     AC_DEFINE(ENABLE_KDE4)
9892     R="$R kde4"
9894 AC_SUBST(ENABLE_KDE4)
9896 ENABLE_HEADLESS=""
9897 if test "x$with_x" = "xno"; then
9898     ENABLE_HEADLESS="TRUE"
9899     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
9900     R="headless"
9902 AC_SUBST(ENABLE_HEADLESS)
9904 if test -z "$R"; then
9905     AC_MSG_RESULT([none])
9906 else
9907     AC_MSG_RESULT([$R])
9910 dnl ===================================================================
9911 dnl GCONF check
9912 dnl ===================================================================
9914 ENABLE_GCONF=
9915 AC_MSG_CHECKING([whether to enable GConf support])
9916 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "iOS" -a "$enable_gconf" = "yes"; then
9917     ENABLE_GCONF="TRUE"
9918     AC_MSG_RESULT([yes])
9919     PKG_CHECK_MODULES( GCONF, gconf-2.0 gobject-2.0 )
9920     GCONF_CFLAGS=$(printf '%s' "$GCONF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9921 else
9922     AC_MSG_RESULT([no])
9924 AC_SUBST(GCONF_LIBS)
9925 AC_SUBST(GCONF_CFLAGS)
9926 AC_SUBST(ENABLE_GCONF)
9928 dnl ===================================================================
9929 dnl Gnome VFS check
9930 dnl ===================================================================
9932 ENABLE_GNOMEVFS=""
9933 AC_MSG_CHECKING([whether to enable GNOME VFS support])
9934 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes" -a "$enable_gconf" = "yes"; then
9935     ENABLE_GNOMEVFS="TRUE"
9936     AC_MSG_RESULT([yes])
9937     PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
9938     GNOMEVFS_CFLAGS=$(printf '%s' "$GNOMEVFS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9939     AC_DEFINE(ENABLE_GNOME_VFS)
9940 else
9941     AC_MSG_RESULT([no])
9943 AC_SUBST(GNOMEVFS_LIBS)
9944 AC_SUBST(GNOMEVFS_CFLAGS)
9945 AC_SUBST(ENABLE_GNOMEVFS)
9947 dnl ===================================================================
9948 dnl check for dbus support
9949 dnl ===================================================================
9950 ENABLE_DBUS=""
9951 DBUS_CFLAGS=""
9952 DBUS_LIBS=""
9954 if test "$enable_dbus" = "no"; then
9955     test_dbus=no
9958 AC_MSG_CHECKING([whether to enable DBUS support])
9959 if test "$test_dbus" = "yes"; then
9960     ENABLE_DBUS="TRUE"
9961     AC_MSG_RESULT([yes])
9962     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9963     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9964 else
9965     AC_MSG_RESULT([no])
9968 AC_SUBST(ENABLE_DBUS)
9969 AC_SUBST(DBUS_CFLAGS)
9970 AC_SUBST(DBUS_LIBS)
9972 AC_MSG_CHECKING([whether to enable font install via packagekit])
9973 if test "$ENABLE_DBUS" = "TRUE"; then
9974     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
9975         ENABLE_PACKAGEKIT=TRUE
9976         AC_MSG_RESULT([yes])
9977     else
9978         ENABLE_PACKAGEKIT=
9979         AC_MSG_RESULT([no])
9980     fi
9981 else
9982     AC_MSG_RESULT([no, dbus disabled.])
9984 AC_SUBST(ENABLE_PACKAGEKIT)
9986 AC_MSG_CHECKING([whether to enable Impress remote control])
9987 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9988     AC_MSG_RESULT([yes])
9989     ENABLE_SDREMOTE=TRUE
9990     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9992     # If not explicitly enabled or disabled, default
9993     if test -z "$enable_sdremote_bluetooth"; then
9994         case "$OS" in
9995         LINUX|MACOSX|WNT)
9996             # Default to yes for these
9997             enable_sdremote_bluetooth=yes
9998             ;;
9999         *)
10000             # otherwise no
10001             enable_sdremote_bluetooth=no
10002             ;;
10003         esac
10004     fi
10005     # $enable_sdremote_bluetooth is guaranteed non-empty now
10007     if test "$enable_sdremote_bluetooth" != "no"; then
10008         if test "$OS" = "LINUX"; then
10009             if test "$ENABLE_DBUS" = "TRUE"; then
10010                 AC_MSG_RESULT([yes])
10011                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10012                 dnl ===================================================================
10013                 dnl Check for system bluez
10014                 dnl ===================================================================
10015                 AC_MSG_CHECKING([which Bluetooth header to use])
10016                 if test "$with_system_bluez" = "yes"; then
10017                     AC_MSG_RESULT([external])
10018                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10019                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10020                     SYSTEM_BLUEZ=TRUE
10021                 else
10022                     AC_MSG_RESULT([internal])
10023                     SYSTEM_BLUEZ=
10024                 fi
10025             else
10026                 AC_MSG_RESULT([no, dbus disabled])
10027                 ENABLE_SDREMOTE_BLUETOOTH=
10028                 SYSTEM_BLUEZ=
10029             fi
10030         else
10031             AC_MSG_RESULT([yes])
10032             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10033             SYSTEM_BLUEZ=
10034         fi
10035     else
10036         AC_MSG_RESULT([no])
10037         ENABLE_SDREMOTE_BLUETOOTH=
10038         SYSTEM_BLUEZ=
10039     fi
10040 else
10041     ENABLE_SDREMOTE=
10042     SYSTEM_BLUEZ=
10043     AC_MSG_RESULT([no])
10045 AC_SUBST(ENABLE_SDREMOTE)
10046 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10047 AC_SUBST(SYSTEM_BLUEZ)
10049 dnl ===================================================================
10050 dnl Check whether the gtk 2.0 libraries are available.
10051 dnl ===================================================================
10053 GTK_CFLAGS=""
10054 GTK_LIBS=""
10055 ENABLE_SYSTRAY_GTK=""
10056 if test  "$test_gtk" = "yes"; then
10058     if test "$ENABLE_GTK" = "TRUE"; then
10059         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gdk-pixbuf-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10060         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10061         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]))
10062         BUILD_TYPE="$BUILD_TYPE GTK"
10063         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10065         AC_MSG_CHECKING([whether to enable the systray quickstarter])
10066         if test "x$enable_systray" = "xyes"; then
10067             AC_MSG_RESULT([yes])
10068             PKG_CHECK_MODULES( GTK210, gtk+-2.0 >= 2.10.0,
10069                             [ ENABLE_SYSTRAY_GTK="TRUE" ],
10070                             [ ENABLE_SYSTRAY_GTK="" ])
10071         else
10072             AC_MSG_RESULT([no])
10073         fi
10075         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10076         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10077                           [ENABLE_GTK_PRINT="TRUE"],
10078                           [ENABLE_GTK_PRINT=""])
10079         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10081         AC_MSG_CHECKING([whether to enable GIO support])
10082         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10083             if test "$ENABLE_GNOMEVFS" = "TRUE"; then
10084                 AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
10085             fi
10086             dnl Need at least 2.26 for the dbus support.
10087             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10088                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10089             if test "$ENABLE_GIO" = "TRUE"; then
10090                 AC_DEFINE(ENABLE_GIO)
10091                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10092             fi
10093         else
10094             AC_MSG_RESULT([no])
10095         fi
10096     fi
10098 AC_SUBST(ENABLE_GIO)
10099 AC_SUBST(GIO_CFLAGS)
10100 AC_SUBST(GIO_LIBS)
10101 AC_SUBST(ENABLE_SYSTRAY_GTK)
10102 AC_SUBST(GTK_CFLAGS)
10103 AC_SUBST(GTK_LIBS)
10104 AC_SUBST(GTHREAD_CFLAGS)
10105 AC_SUBST(GTHREAD_LIBS)
10106 AC_SUBST([ENABLE_GTK_PRINT])
10107 AC_SUBST([GTK_PRINT_CFLAGS])
10108 AC_SUBST([GTK_PRINT_LIBS])
10111 dnl ===================================================================
10112 dnl Check whether the Telepathy libraries are available.
10113 dnl ===================================================================
10115 ENABLE_TELEPATHY=""
10116 TELEPATHY_CFLAGS=""
10117 TELEPATHY_LIBS=""
10119 AC_MSG_CHECKING([whether to enable Telepathy support])
10120 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10121     ENABLE_TELEPATHY="TRUE"
10122     AC_DEFINE(ENABLE_TELEPATHY)
10123     AC_MSG_RESULT([yes])
10124     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.4 )
10125     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10126 else
10127     AC_MSG_RESULT([no])
10130 AC_SUBST(ENABLE_TELEPATHY)
10131 AC_SUBST(TELEPATHY_CFLAGS)
10132 AC_SUBST(TELEPATHY_LIBS)
10135 dnl ===================================================================
10137 SPLIT_APP_MODULES=""
10138 if test "$enable_split_app_modules" = "yes"; then
10139     SPLIT_APP_MODULES="TRUE"
10141 AC_SUBST(SPLIT_APP_MODULES)
10143 SPLIT_OPT_FEATURES=""
10144 if test "$enable_split_opt_features" = "yes"; then
10145     SPLIT_OPT_FEATURES="TRUE"
10147 AC_SUBST(SPLIT_OPT_FEATURES)
10149 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10150     if test "$enable_cairo_canvas" = yes; then
10151         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10152     fi
10153     enable_cairo_canvas=no
10154 elif test -z "$enable_cairo_canvas"; then
10155     enable_cairo_canvas=yes
10158 ENABLE_CAIRO_CANVAS=""
10159 if test "$enable_cairo_canvas" = "yes"; then
10160     test_cairo=yes
10161     ENABLE_CAIRO_CANVAS="TRUE"
10163 AC_SUBST(ENABLE_CAIRO_CANVAS)
10165 dnl ===================================================================
10166 dnl Check whether the GStreamer libraries are available.
10167 dnl It's possible to build avmedia with both GStreamer backends!
10168 dnl ===================================================================
10170 ENABLE_GSTREAMER_1_0=""
10172 if test "$build_gstreamer_1_0" = "yes"; then
10174     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10175     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10176         ENABLE_GSTREAMER_1_0="TRUE"
10177         AC_MSG_RESULT([yes])
10178         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0] )
10179         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10180     else
10181         AC_MSG_RESULT([no])
10182     fi
10184 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10185 AC_SUBST(GSTREAMER_1_0_LIBS)
10186 AC_SUBST(ENABLE_GSTREAMER_1_0)
10189 ENABLE_GSTREAMER_0_10=""
10190 if test "$build_gstreamer_0_10" = "yes"; then
10192     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10193     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10194         ENABLE_GSTREAMER_0_10="TRUE"
10195         AC_MSG_RESULT([yes])
10196         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [
10197             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] )
10198         ])
10199         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10200     else
10201         AC_MSG_RESULT([no])
10202     fi
10205 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10206 AC_SUBST(GSTREAMER_0_10_LIBS)
10207 AC_SUBST(ENABLE_GSTREAMER_0_10)
10209 dnl ===================================================================
10210 dnl Check whether to build the VLC avmedia backend
10211 dnl ===================================================================
10213 ENABLE_VLC=""
10215 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10216 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10217     ENABLE_VLC="TRUE"
10218     AC_MSG_RESULT([yes])
10219 else
10220     AC_MSG_RESULT([no])
10222 AC_SUBST(ENABLE_VLC)
10224 ENABLE_OPENGL=
10225 if test $_os = iOS -o $_os = Android; then
10226    : # disable
10227 elif test "$_os" = "Darwin"; then
10228     # We use frameworks on Mac OS X, no need for detail checks
10229     ENABLE_OPENGL=TRUE
10230     ENABLE_OPENGL_CANVAS=TRUE
10231     SYSTEM_MESA_HEADERS=TRUE
10232 elif test $_os = WINNT; then
10233     # Experimental: try to use OpenGL on Windows
10234     ENABLE_OPENGL=TRUE
10235     ENABLE_OPENGL_CANVAS=TRUE
10236     # We need the internal "Mesa" headers.
10237     SYSTEM_MESA_HEADERS=
10238     BUILD_TYPE="$BUILD_TYPE MESA"
10239 else
10240     ENABLE_OPENGL=TRUE
10241     ENABLE_OPENGL_CANVAS=TRUE
10243     dnl ===================================================================
10244     dnl Check for system Mesa
10245     dnl ===================================================================
10246     AC_MSG_CHECKING([which Mesa headers to use])
10247     if test "$with_system_mesa_headers" = "yes"; then
10248         AC_MSG_RESULT([external])
10249         SYSTEM_MESA_HEADERS=TRUE
10250         AC_LANG_PUSH(C)
10251         AC_CHECK_HEADER(GL/glxext.h, [],
10252            [ AC_MSG_ERROR(mesa headers not found.)], [#include <GL/glx.h>])
10253         AC_MSG_CHECKING([whether GL/glxext.h defines PFNGLXBINDTEXIMAGEEXTPROC])
10254         AC_EGREP_HEADER(PFNGLXBINDTEXIMAGEEXTPROC, GL/glxext.h, [AC_MSG_RESULT([yes])], AC_MSG_ERROR(no))
10255         AC_LANG_POP(C)
10256     else
10257         AC_MSG_RESULT([internal])
10258         SYSTEM_MESA_HEADERS=
10259         BUILD_TYPE="$BUILD_TYPE MESA"
10260     fi
10263 AC_SUBST(SYSTEM_MESA_HEADERS)
10264 AC_SUBST(ENABLE_OPENGL)
10265 AC_SUBST(ENABLE_OPENGL_CANVAS)
10267 dnl =================================================
10268 dnl Check whether to build with OpenCL support.
10269 dnl =================================================
10271 if test $_os != iOS -a $_os != Android; then
10272     # OPENCL in BUILD_TYPE tells that OpenCL is potentially available on the platform (optional at run-time,
10273     # used through clew).
10274     BUILD_TYPE="$BUILD_TYPE OPENCL"
10275     AC_DEFINE(HAVE_FEATURE_OPENCL)
10278 dnl ===================================================================
10279 dnl Check whether to enable glTF support
10280 dnl ===================================================================
10281 AC_MSG_CHECKING([whether to enable glTF support])
10282 ENABLE_GLTF=
10283 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android; then
10284     ENABLE_GLTF=TRUE
10285     AC_MSG_RESULT([yes])
10286     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10287     if test "$with_system_libgltf" = "yes"; then
10288         SYSTEM_LIBGLTF=TRUE
10289         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10290     else
10291         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10292     fi
10293 else
10294     AC_MSG_RESULT([no])
10296 AC_SUBST(ENABLE_GLTF)
10297 AC_SUBST(SYSTEM_LIBGLTF)
10298 AC_SUBST(LIBGLTF_CFLAGS)
10299 AC_SUBST(LIBGLTF_LIBS)
10301 dnl ===================================================================
10302 dnl Check whether to enable COLLADA support
10303 dnl ===================================================================
10304 AC_MSG_CHECKING([whether to enable COLLADA support])
10305 ENABLE_COLLADA=
10306 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10307     AC_MSG_RESULT([yes])
10308     ENABLE_COLLADA=TRUE
10309     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10310     AC_MSG_CHECKING([which OPENCOLLADA to use])
10311     if test "$with_system_opencollada" = "yes"; then
10312         AC_MSG_RESULT([external])
10313         SYSTEM_OPENCOLLADA=TRUE
10314         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10315         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10316         AC_LANG_PUSH([C++])
10317         save_CXXFLAGS=$CXXFLAGS
10318         save_CPPFLAGS=$CPPFLAGS
10319         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10320         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10321         AC_CHECK_HEADERS(
10322                 COLLADABU.h \
10323                 COLLADAFW.h \
10324                 COLLADASaxFWLLoader.h \
10325                 GeneratedSaxParser.h,
10326             [],
10327             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10328             [])
10329         CXXFLAGS=$save_CXXFLAGS
10330         CPPFLAGS=$save_CPPFLAGS
10331         AC_LANG_POP([C++])
10332         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10333     else
10334         AC_MSG_RESULT([internal])
10335         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10336     fi
10337     BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10338 else
10339     AC_MSG_RESULT([no])
10341 AC_SUBST(ENABLE_COLLADA)
10342 AC_SUBST([OPENCOLLADA_CFLAGS])
10343 AC_SUBST([OPENCOLLADA_LIBS])
10344 AC_SUBST([SYSTEM_OPENCOLLADA])
10346 # pdf import?
10347 AC_MSG_CHECKING([whether to build the PDF import feature])
10348 ENABLE_PDFIMPORT=
10349 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10350     AC_MSG_RESULT([yes])
10351     ENABLE_PDFIMPORT=TRUE
10353     dnl ===================================================================
10354     dnl Check for system poppler
10355     dnl ===================================================================
10356     AC_MSG_CHECKING([which PDF import backend to use])
10357     if test "$with_system_poppler" = "yes"; then
10358         AC_MSG_RESULT([external])
10359         SYSTEM_POPPLER=TRUE
10360         PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
10361         AC_LANG_PUSH([C++])
10362         save_CXXFLAGS=$CXXFLAGS
10363         save_CPPFLAGS=$CPPFLAGS
10364         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10365         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10366         AC_CHECK_HEADER([cpp/poppler-version.h], [],
10367                    [AC_MSG_ERROR([cpp/poppler-version.h not found. Install poppler])], [])
10368         CXXFLAGS=$save_CXXFLAGS
10369         CPPFLAGS=$save_CPPFLAGS
10370         AC_LANG_POP([C++])
10371         libo_MINGW_CHECK_DLL([libpoppler])
10372         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10373     else
10374         AC_MSG_RESULT([internal])
10375         SYSTEM_POPPLER=
10376         BUILD_TYPE="$BUILD_TYPE POPPLER"
10377     fi
10378 else
10379     AC_MSG_RESULT([no])
10381 AC_SUBST(ENABLE_PDFIMPORT)
10382 AC_SUBST(SYSTEM_POPPLER)
10383 AC_SUBST(POPPLER_CFLAGS)
10384 AC_SUBST(POPPLER_LIBS)
10386 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10387 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10388     AC_MSG_RESULT([yes])
10389     ENABLE_MEDIAWIKI=TRUE
10390     BUILD_TYPE="$BUILD_TYPE XSLTML"
10391     if test  "x$with_java" = "xno"; then
10392         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10393     fi
10394 else
10395     AC_MSG_RESULT([no])
10396     ENABLE_MEDIAWIKI=
10397     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10399 AC_SUBST(ENABLE_MEDIAWIKI)
10401 AC_MSG_CHECKING([whether to build the Report Builder])
10402 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10403     AC_MSG_RESULT([yes])
10404     ENABLE_REPORTBUILDER=TRUE
10405     AC_MSG_CHECKING([which jfreereport libs to use])
10406     if test "$with_system_jfreereport" = "yes"; then
10407         SYSTEM_JFREEREPORT=TRUE
10408         AC_MSG_RESULT([external])
10409         if test -z $SAC_JAR; then
10410             SAC_JAR=/usr/share/java/sac.jar
10411         fi
10412         AC_CHECK_FILE($SAC_JAR, [],
10413              [AC_MSG_ERROR(sac.jar not found.)], [])
10415         if test -z $LIBXML_JAR; then
10416             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10417                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10418                 [
10419                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10420                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10421                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10422                     )
10423                 ]
10424             )
10425         else
10426             AC_CHECK_FILE($LIBXML_JAR, [],
10427                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10428         fi
10430         if test -z $FLUTE_JAR; then
10431             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10432                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10433                 [
10434                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10435                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10436                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10437                     )
10438                 ]
10439             )
10440         else
10441             AC_CHECK_FILE($FLUTE_JAR, [],
10442                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10443         fi
10445         if test -z $JFREEREPORT_JAR; then
10446             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10447                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10448                 [
10449                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10450                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10451                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10452                     )
10453                 ]
10454             )
10455         else
10456             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10457                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10458         fi
10460         if test -z $LIBLAYOUT_JAR; then
10461             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10462                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10463                 [
10464                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10465                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10466                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10467                     )
10468                 ]
10469             )
10470         else
10471             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10472                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10473         fi
10475         if test -z $LIBLOADER_JAR; then
10476             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10477                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10478                 [
10479                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10480                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10481                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10482                     )
10483                 ]
10484             )
10485         else
10486             AC_CHECK_FILE($LIBLOADER_JAR, [],
10487                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10488         fi
10490         if test -z $LIBFORMULA_JAR; then
10491             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10492                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10493                  [
10494                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10495                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10496                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10497                      )
10498                  ]
10499             )
10500         else
10501             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10502                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10503         fi
10505         if test -z $LIBREPOSITORY_JAR; then
10506             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10507                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10508                 [
10509                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10510                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10511                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10512                     )
10513                 ]
10514             )
10515         else
10516             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10517                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10518         fi
10520         if test -z $LIBFONTS_JAR; then
10521             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10522                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10523                 [
10524                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10525                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10526                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10527                     )
10528                 ]
10529             )
10530         else
10531             AC_CHECK_FILE($LIBFONTS_JAR, [],
10532                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10533         fi
10535         if test -z $LIBSERIALIZER_JAR; then
10536             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10537                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10538                 [
10539                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10540                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10541                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10542                     )
10543                 ]
10544             )
10545         else
10546             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10547                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10548         fi
10550         if test -z $LIBBASE_JAR; then
10551             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10552                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10553                 [
10554                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10555                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10556                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10557                     )
10558                 ]
10559             )
10560         else
10561             AC_CHECK_FILE($LIBBASE_JAR, [],
10562                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10563         fi
10565     else
10566         AC_MSG_RESULT([internal])
10567         SYSTEM_JFREEREPORT=
10568         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10569     fi
10570 else
10571     AC_MSG_RESULT([no])
10572     ENABLE_REPORTBUILDER=
10573     SYSTEM_JFREEREPORT=
10575 AC_SUBST(ENABLE_REPORTBUILDER)
10576 AC_SUBST(SYSTEM_JFREEREPORT)
10577 AC_SUBST(SAC_JAR)
10578 AC_SUBST(LIBXML_JAR)
10579 AC_SUBST(FLUTE_JAR)
10580 AC_SUBST(JFREEREPORT_JAR)
10581 AC_SUBST(LIBBASE_JAR)
10582 AC_SUBST(LIBLAYOUT_JAR)
10583 AC_SUBST(LIBLOADER_JAR)
10584 AC_SUBST(LIBFORMULA_JAR)
10585 AC_SUBST(LIBREPOSITORY_JAR)
10586 AC_SUBST(LIBFONTS_JAR)
10587 AC_SUBST(LIBSERIALIZER_JAR)
10589 # this has to be here because both the Wiki Publisher and the SRB use
10590 # commons-logging
10591 COMMONS_LOGGING_VERSION=1.2
10592 if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10593     AC_MSG_CHECKING([which Apache commons-* libs to use])
10594     if test "$with_system_apache_commons" = "yes"; then
10595         SYSTEM_APACHE_COMMONS=TRUE
10596         AC_MSG_RESULT([external])
10597         if test "$ENABLE_MEDIAWIKI" = "TRUE"; then
10598             if test -z $COMMONS_CODEC_JAR; then
10599                 _commons_codec_path=""
10600                 if test "$HAVE_JAVA6" = "TRUE"; then
10601                     _commons_codec_path="/usr/share/java/commons-codec-1.9.jar"
10602                 else
10603                     _commons_codec_path="/usr/share/java/commons-codec-1.6.jar"
10604                 fi
10605                 AC_CHECK_FILE($_commons_codec_path,
10606                     [ COMMONS_CODEC_JAR=$_commons_codec_path ],
10607                     [
10608                         AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
10609                             [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
10610                             [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
10611                         )
10612                     ]
10613                 )
10614             else
10615                 AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
10616                     [AC_MSG_ERROR(commons-codec.jar not found.)], [])
10617             fi
10619             if test -z $COMMONS_LANG_JAR; then
10620                 _commons_lang_path=""
10621                 if test "$HAVE_JAVA6" = "TRUE"; then
10622                     _commons_lang_path="/usr/share/java/commons-lang3-3.3.1-src.tar.gz"
10623                 else
10624                     _commons_lang_path="/usr/share/java/commons-lang-2.4.jar"
10625                 fi
10626                 AC_CHECK_FILE($_commons_lang_path,
10627                     [ COMMONS_LANG_JAR=$commons_lang_path ],
10628                     [
10629                         AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
10630                             [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
10631                             [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
10632                             )
10633                     ]
10634                 )
10635             else
10636                 AC_CHECK_FILE($COMMONS_LANG_JAR, [],
10637                     [AC_MSG_ERROR(commons-lang.jar not found.)], [])
10638             fi
10640             if test -z $COMMONS_HTTPCLIENT_JAR; then
10641                 AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
10642                     [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
10643                     [
10644                         AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
10645                             [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
10646                             [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
10647                         )
10648                     ]
10649                 )
10650             else
10651                 AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
10652                     [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
10653             fi
10654         fi
10655         if test "$ENABLE_MEDIAWIKI" = "TRUE" -o "$ENABLE_REPORTBUILDER" = "TRUE"; then
10656             if test -z $COMMONS_LOGGING_JAR; then
10657                 AC_CHECK_FILE(/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar,
10658                    [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar ],
10659                    [
10660                         AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10661                             [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10662                             [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10663                         )
10664                     ]
10665                 )
10666             else
10667                 AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10668                     [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10669             fi
10670         fi
10671     else
10672         AC_MSG_RESULT([internal])
10673         SYSTEM_APACHE_COMMONS=
10674         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10675     fi
10677 AC_SUBST(SYSTEM_APACHE_COMMONS)
10678 AC_SUBST(COMMONS_CODEC_JAR)
10679 AC_SUBST(COMMONS_LANG_JAR)
10680 AC_SUBST(COMMONS_HTTPCLIENT_JAR)
10681 AC_SUBST(COMMONS_LOGGING_JAR)
10682 AC_SUBST(COMMONS_LOGGING_VERSION)
10684 # scripting provider for BeanShell?
10685 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10686 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10687     AC_MSG_RESULT([yes])
10688     ENABLE_SCRIPTING_BEANSHELL=TRUE
10690     dnl ===================================================================
10691     dnl Check for system beanshell
10692     dnl ===================================================================
10693     AC_MSG_CHECKING([which beanshell to use])
10694     if test "$with_system_beanshell" = "yes"; then
10695         AC_MSG_RESULT([external])
10696         SYSTEM_BSH=TRUE
10697         if test -z $BSH_JAR; then
10698             BSH_JAR=/usr/share/java/bsh.jar
10699         fi
10700         AC_CHECK_FILE($BSH_JAR, [],
10701                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10702     else
10703         AC_MSG_RESULT([internal])
10704         SYSTEM_BSH=
10705         BUILD_TYPE="$BUILD_TYPE BSH"
10706     fi
10707 else
10708     AC_MSG_RESULT([no])
10709     ENABLE_SCRIPTING_BEANSHELL=
10710     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10712 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10713 AC_SUBST(SYSTEM_BSH)
10714 AC_SUBST(BSH_JAR)
10716 # scripting provider for JavaScript?
10717 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10718 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10719     AC_MSG_RESULT([yes])
10720     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10722     dnl ===================================================================
10723     dnl Check for system rhino
10724     dnl ===================================================================
10725     AC_MSG_CHECKING([which rhino to use])
10726     if test "$with_system_rhino" = "yes"; then
10727         AC_MSG_RESULT([external])
10728         SYSTEM_RHINO=TRUE
10729         if test -z $RHINO_JAR; then
10730             RHINO_JAR=/usr/share/java/js.jar
10731         fi
10732         AC_CHECK_FILE($RHINO_JAR, [],
10733                    [AC_MSG_ERROR(js.jar not found.)], [])
10734     else
10735         AC_MSG_RESULT([internal])
10736         SYSTEM_RHINO=
10737         BUILD_TYPE="$BUILD_TYPE RHINO"
10738     fi
10739 else
10740     AC_MSG_RESULT([no])
10741     ENABLE_SCRIPTING_JAVASCRIPT=
10742     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10744 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10745 AC_SUBST(SYSTEM_RHINO)
10746 AC_SUBST(RHINO_JAR)
10748 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10749 # paths should be added to library search path. So lets put all 64-bit
10750 # platforms there.
10751 supports_multilib=
10752 case "$host_cpu" in
10753 x86_64 | powerpc64 | powerpc64le | s390x | aarch64)
10754     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10755         supports_multilib="yes"
10756     fi
10757     ;;
10759     ;;
10760 esac
10762 dnl ===================================================================
10763 dnl Check whether the TQt and TDE libraries are available.
10764 dnl ===================================================================
10766 TDE_CFLAGS=""
10767 TDE_LIBS=""
10768 if test "$_os" != "OpenBSD"; then
10769     MOC="moc"
10771 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10772     dnl Search paths for TQt and TDE
10773     if test -z "$supports_multilib"; then
10774         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"
10775         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"
10776     else
10777         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"
10778         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"
10779     fi
10780     if test -n "$TQTDIR"; then
10781         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10782         if test -z "$supports_multilib"; then
10783             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10784         else
10785             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10786         fi
10787     fi
10788     if test -z "$supports_multilib"; then
10789         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"
10790         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"
10791     else
10792         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"
10793         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"
10794     fi
10795     if test -n "$TDEDIR"; then
10796         tde_incdirs="$TDEDIR/include $tde_incdirs"
10797         if test -z "$supports_multilib"; then
10798             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10799         else
10800             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10801         fi
10802     fi
10804     dnl What to test
10805     tqt_test_include="ntqstyle.h"
10806     tde_test_include="kapp.h"
10808     if test "$_os" != "OpenBSD"; then
10809         tqt_test_library="libtqt-mt.so"
10810         tde_test_library="libDCOP.so"
10811     else
10812         tqt_test_library="libtqt-mt.so*"
10813         tde_test_library="libDCOP.so*"
10814     fi
10816     dnl Check for TQt headers
10817     AC_MSG_CHECKING([for TQt headers])
10818     tqt_incdir="no"
10819     for tde_check in $tqt_incdirs; do
10820         if test -r "$tde_check/$tqt_test_include"; then
10821             tqt_incdir="$tde_check"
10822             break
10823         fi
10824     done
10825     AC_MSG_RESULT([$tqt_incdir])
10826     if test "x$tqt_incdir" = "xno"; then
10827         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10828 your TQt installation by exporting TQTDIR before running "configure".])
10829     fi
10831     dnl Check for TQt libraries
10832     AC_MSG_CHECKING([for TQt libraries])
10833     tqt_libdir="no"
10834     for tqt_check in $tqt_libdirs; do
10835         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10836             tqt_libdir="$tqt_check"
10837             break
10838         fi
10839     done
10840     AC_MSG_RESULT([$tqt_libdir])
10841     if test "x$tqt_libdir" = "xno"; then
10842         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10843 your TQt installation by exporting TQTDIR before running "configure".])
10844     fi
10846     dnl Check for Meta Object Compiler
10847     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10848     if test "$MOC" = "no"; then
10849         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10850 the root of your TQt installation by exporting TQTDIR before running "configure".])
10851     fi
10853     dnl Check for TDE headers
10854     AC_MSG_CHECKING([for TDE headers])
10855     tde_incdir="no"
10856     for tde_check in $tde_incdirs; do
10857         if test -r "$tde_check/$tde_test_include"; then
10858             tde_incdir="$tde_check"
10859             break
10860         fi
10861     done
10862     AC_MSG_RESULT([$tde_incdir])
10863     if test "x$tde_incdir" = "xno"; then
10864         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10865 your TDE installation by exporting TDEDIR before running "configure".])
10866     fi
10868     dnl Check for TDE libraries
10869     AC_MSG_CHECKING([for TDE libraries])
10870     tde_libdir="no"
10871     for tde_check in $tde_libdirs; do
10872         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10873             tde_libdir="$tde_check"
10874             break
10875         fi
10876     done
10877     AC_MSG_RESULT([$tde_libdir])
10878     if test "x$tde_libdir" = "xno"; then
10879         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10880 your TDE installation by exporting TDEDIR before running "configure".])
10881     fi
10883     dnl Set the variables
10884     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10885     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10887 AC_SUBST(TDE_CFLAGS)
10888 AC_SUBST(TDE_LIBS)
10889 AC_SUBST(MOC)
10891 dnl ===================================================================
10892 dnl Check whether the Qt3 and KDE3 libraries are available.
10893 dnl ===================================================================
10895 KDE_CFLAGS=""
10896 KDE_LIBS=""
10897 if test "$_os" != "OpenBSD"; then
10898     MOC="moc"
10900 if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE"; then
10901     dnl Search paths for Qt3 and KDE3
10902     if test -z "$supports_multilib"; then
10903         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"
10904         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"
10905     else
10906         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"
10907         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"
10908     fi
10909     if test -n "$QTDIR"; then
10910         qt_incdirs="$QTDIR/include $qt_incdirs"
10911         if test -z "$supports_multilib"; then
10912             qt_libdirs="$QTDIR/lib $qt_libdirs"
10913         else
10914             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10915         fi
10916     fi
10917     if test -z "$supports_multilib"; then
10918         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"
10919         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"
10920     else
10921         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"
10922         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"
10923     fi
10924     if test -n "$KDEDIR"; then
10925         kde_incdirs="$KDEDIR/include $kde_incdirs"
10926         if test -z "$supports_multilib"; then
10927             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10928         else
10929             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10930         fi
10931     fi
10933     dnl What to test
10934     qt_test_include="qstyle.h"
10935     kde_test_include="kapp.h"
10937     if test "$_os" != "OpenBSD"; then
10938         qt_test_library="libqt-mt.so"
10939         kde_test_library="libDCOP.so"
10940     else
10941         qt_test_library="libqt-mt.so*"
10942         kde_test_library="libDCOP.so*"
10943     fi
10945     dnl Check for Qt3 headers
10946     AC_MSG_CHECKING([for Qt3 headers])
10947     qt_incdir="no"
10948     for kde_check in $qt_incdirs; do
10949         if test -r "$kde_check/$qt_test_include"; then
10950             qt_incdir="$kde_check"
10951             break
10952         fi
10953     done
10954     AC_MSG_RESULT([$qt_incdir])
10955     if test "x$qt_incdir" = "xno"; then
10956         AC_MSG_ERROR([Qt3 headers not found.  Please specify the root of
10957 your Qt3 installation by exporting QTDIR before running "configure".])
10958     fi
10960     dnl Check for Qt3 libraries
10961     AC_MSG_CHECKING([for Qt3 libraries])
10962     qt_libdir="no"
10963     for qt_check in $qt_libdirs; do
10964         if test -r "`ls $qt_check/$qt_test_library 2>/dev/null | head -1`"; then
10965             qt_libdir="$qt_check"
10966             break
10967         fi
10968     done
10969     AC_MSG_RESULT([$qt_libdir])
10970     if test "x$qt_libdir" = "xno"; then
10971         AC_MSG_ERROR([Qt3 libraries not found.  Please specify the root of
10972 your Qt3 installation by exporting QTDIR before running "configure".])
10973     fi
10975     dnl Check for Meta Object Compiler
10976     AC_PATH_PROG( MOC, moc, no, [`dirname $qt_libdir`/bin:$QTDIR/bin:$PATH] )
10977     if test "$MOC" = "no"; then
10978         AC_MSG_ERROR([Qt3 Meta Object Compiler not found.  Please specify
10979 the root of your Qt3 installation by exporting QTDIR before running "configure".])
10980     fi
10982     dnl Check for KDE3 headers
10983     AC_MSG_CHECKING([for KDE3 headers])
10984     kde_incdir="no"
10985     for kde_check in $kde_incdirs; do
10986         if test -r "$kde_check/$kde_test_include"; then
10987             kde_incdir="$kde_check"
10988             break
10989         fi
10990     done
10991     AC_MSG_RESULT([$kde_incdir])
10992     if test "x$kde_incdir" = "xno"; then
10993         AC_MSG_ERROR([KDE3 headers not found.  Please specify the root of
10994 your KDE3 installation by exporting KDEDIR before running "configure".])
10995     fi
10997     dnl Check for KDE3 libraries
10998     AC_MSG_CHECKING([for KDE3 libraries])
10999     kde_libdir="no"
11000     for kde_check in $kde_libdirs; do
11001         if test -r "`ls $kde_check/$kde_test_library 2>/dev/null | head -1`"; then
11002             kde_libdir="$kde_check"
11003             break
11004         fi
11005     done
11006     AC_MSG_RESULT([$kde_libdir])
11007     if test "x$kde_libdir" = "xno"; then
11008         AC_MSG_ERROR([KDE3 libraries not found.  Please specify the root of
11009 your KDE3 installation by exporting KDEDIR before running "configure".])
11010     fi
11012     dnl Set the variables
11013     KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11014     KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
11015     KDE_CFLAGS=$(printf '%s' "$KDE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11017 AC_SUBST(KDE_CFLAGS)
11018 AC_SUBST(KDE_LIBS)
11019 AC_SUBST(MOC)
11021 dnl ===================================================================
11022 dnl KDE4 Integration
11023 dnl ===================================================================
11025 KDE4_CFLAGS=""
11026 KDE4_LIBS=""
11027 QMAKE4="qmake"
11028 MOC4="moc"
11029 KDE_GLIB_CFLAGS=""
11030 KDE_GLIB_LIBS=""
11031 KDE_HAVE_GLIB=""
11032 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11033     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11034     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11036     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11037     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11039     if test -n "$supports_multilib"; then
11040         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11041         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11042     fi
11044     if test -n "$QTDIR"; then
11045         qt_incdirs="$QTDIR/include $qt_incdirs"
11046         if test -z "$supports_multilib"; then
11047             qt_libdirs="$QTDIR/lib $qt_libdirs"
11048         else
11049             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11050         fi
11051     fi
11052     if test -n "$QT4DIR"; then
11053         qt_incdirs="$QT4DIR/include $qt_incdirs"
11054         if test -z "$supports_multilib"; then
11055             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11056         else
11057             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11058         fi
11059     fi
11061     if test -n "$KDEDIR"; then
11062         kde_incdirs="$KDEDIR/include $kde_incdirs"
11063         if test -z "$supports_multilib"; then
11064             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11065         else
11066             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11067         fi
11068     fi
11069     if test -n "$KDE4DIR"; then
11070         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11071         if test -z "$supports_multilib"; then
11072             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11073         else
11074             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11075         fi
11076     fi
11078     qt_test_include="Qt/qobject.h"
11079     qt_test_library="libQtNetwork.so"
11080     kde_test_include="kwindowsystem.h"
11081     kde_test_library="libsolid.so"
11083     AC_MSG_CHECKING([for Qt4 headers])
11084     qt_header_dir="no"
11085     for inc_dir in $qt_incdirs; do
11086         if test -r "$inc_dir/$qt_test_include"; then
11087             qt_header_dir="$inc_dir"
11088             break
11089         fi
11090     done
11092     AC_MSG_RESULT([$qt_header_dir])
11093     if test "x$qt_header_dir" = "xno"; then
11094         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11095     fi
11097     dnl Check for qmake
11098     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11099     QMAKE4="$QMAKEQT4"
11100     if test "$QMAKE4" = "no"; then
11101         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11102         if test "$QMAKE4" = "no"; then
11103             AC_MSG_ERROR([Qmake not found.  Please specify
11104 the root of your Qt installation by exporting QT4DIR before running "configure".])
11105         fi
11106     fi
11108     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11109     AC_MSG_CHECKING([for Qt4 libraries])
11110     qt_lib_dir="no"
11111     for lib_dir in $qt_libdirs; do
11112         if test -r "$lib_dir/$qt_test_library"; then
11113             qt_lib_dir="$lib_dir"
11114             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11115             break
11116         fi
11117     done
11119     AC_MSG_RESULT([$qt_lib_dir])
11121     if test "x$qt_lib_dir" = "xno"; then
11122         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11123     fi
11125     dnl Check for Meta Object Compiler
11127     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11128     MOC4="$MOCQT4"
11129     if test "$MOC4" = "no"; then
11130         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11131         if test "$MOC4" = "no"; then
11132             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11133 the root of your Qt installation by exporting QT4DIR before running "configure".])
11134         fi
11135     fi
11137     dnl Check for KDE4 headers
11138     AC_MSG_CHECKING([for KDE4 headers])
11139     kde_incdir="no"
11140     for kde_check in $kde_incdirs; do
11141         if test -r "$kde_check/$kde_test_include"; then
11142             kde_incdir="$kde_check"
11143             break
11144         fi
11145     done
11146     AC_MSG_RESULT([$kde_incdir])
11147     if test "x$kde_incdir" = "xno"; then
11148         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11149     fi
11151     dnl Check for KDE4 libraries
11152     AC_MSG_CHECKING([for KDE4 libraries])
11153     kde_libdir="no"
11154     for kde_check in $kde_libdirs; do
11155         if test -r "$kde_check/$kde_test_library"; then
11156             kde_libdir="$kde_check"
11157             break
11158         fi
11159     done
11161     AC_MSG_RESULT([$kde_libdir])
11162     if test "x$kde_libdir" = "xno"; then
11163         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11164     fi
11166     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11167     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11168     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11169     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11171     AC_LANG_PUSH([C++])
11172     save_CXXFLAGS=$CXXFLAGS
11173     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11174     AC_MSG_CHECKING([whether KDE is >= 4.2])
11175        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11176 #include <kdeversion.h>
11178 int main(int argc, char **argv) {
11179        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11180        else return 1;
11182        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11183     CXXFLAGS=$save_CXXFLAGS
11184     AC_LANG_POP([C++])
11186     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11187     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11188     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11189         [
11190             KDE_HAVE_GLIB=1
11191             AC_DEFINE(KDE_HAVE_GLIB,1)
11192             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11194             qt4_fix_warning=
11196             AC_LANG_PUSH([C++])
11197             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11198             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11199             #  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
11200             #               ^~~~~~~~~~~~~~~~~~~~~~~
11201             #               vptr for 'QObjectPrivate'
11202             save_CXX=$CXX
11203             CXX=$(printf %s "$CXX" | sed -e s/-fno-sanitize-recover//)
11204             save_CXXFLAGS=$CXXFLAGS
11205             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11206             save_LIBS=$LIBS
11207             LIBS="$LIBS $KDE4_LIBS"
11208             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11210             # Prepare meta object data
11211             TSTBASE="tst_exclude_socket_notifiers"
11212             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11213             ln -fs "${TSTMOC}.hxx"
11214             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11216             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11217 #define SAL_OVERRIDE
11218 #include "tst_exclude_socket_notifiers.moc"
11220 int main(int argc, char *argv[])
11222     QCoreApplication app(argc, argv);
11223     exit(tst_processEventsExcludeSocket());
11224     return 0;
11226             ]])],[
11227                 AC_MSG_RESULT([yes])
11228             ],[
11229                 AC_MSG_RESULT([no])
11230                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11231                 if test -z "$qt4_fix_warning"; then
11232                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11233                 fi
11234                 qt4_fix_warning=1
11235                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11236             ])
11238             # Remove meta object data
11239             rm -f "${TSTBASE}."*
11241             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11243             # Prepare meta object data
11244             TSTBASE="tst_exclude_posted_events"
11245             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11246             ln -fs "${TSTMOC}.hxx"
11247             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11249             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11250 #define SAL_OVERRIDE
11251 #include "tst_exclude_posted_events.moc"
11253 int main(int argc, char *argv[])
11255     QCoreApplication app(argc, argv);
11256     exit(tst_excludePostedEvents());
11257     return 0;
11259             ]])],[
11260                 AC_MSG_RESULT([yes])
11261             ],[
11262                 AC_MSG_RESULT([no])
11263                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11264                 if test -z "$qt4_fix_warning"; then
11265                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11266                 fi
11267                 qt4_fix_warning=1
11268                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11269             ])
11271             # Remove meta object data
11272             rm -f "${TSTBASE}."*
11274             if test -n "$qt4_fix_warning"; then
11275                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11276             fi
11278             LIBS=$save_LIBS
11279             CXXFLAGS=$save_CXXFLAGS
11280             CXX=$save_CXX
11281             AC_LANG_POP([C++])
11282         ],
11283         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11285 AC_SUBST(KDE4_CFLAGS)
11286 AC_SUBST(KDE4_LIBS)
11287 AC_SUBST(MOC4)
11288 AC_SUBST(KDE_GLIB_CFLAGS)
11289 AC_SUBST(KDE_GLIB_LIBS)
11290 AC_SUBST(KDE_HAVE_GLIB)
11292 dnl ===================================================================
11293 dnl Test for the enabling the lockdown pieces
11294 dnl ===================================================================
11295 AC_MSG_CHECKING([whether to enable the lockdown pieces])
11296 ENABLE_LOCKDOWN=
11297 if test -n "$enable_lockdown" -a "$enable_lockdown" != "no"; then
11298     ENABLE_LOCKDOWN=TRUE
11299     AC_MSG_RESULT([yes])
11300 else
11301     AC_MSG_RESULT([no])
11303 AC_SUBST(ENABLE_LOCKDOWN)
11305 dnl ===================================================================
11306 dnl Test whether to include Evolution 2 support
11307 dnl ===================================================================
11308 AC_MSG_CHECKING([whether to enable evolution 2 support])
11309 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11310     AC_MSG_RESULT([yes])
11311     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11312     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11313     ENABLE_EVOAB2="TRUE"
11314 else
11315     ENABLE_EVOAB2=""
11316     AC_MSG_RESULT([no])
11318 AC_SUBST(ENABLE_EVOAB2)
11319 AC_SUBST(GOBJECT_CFLAGS)
11320 AC_SUBST(GOBJECT_LIBS)
11322 dnl ===================================================================
11323 dnl Test whether to include TDE AB support
11324 dnl ===================================================================
11325 AC_MSG_CHECKING([whether to enable TDE address book support])
11326 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11327     AC_MSG_RESULT([yes])
11328     AC_LANG_PUSH([C++])
11329     save_CXXFLAGS=$CXXFLAGS
11330     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11331     AC_MSG_CHECKING([whether TDE is at least R14.0])
11332        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11333 #include <tdeversion.h>
11335 int main(int argc, char **argv) {
11336        if (TDE_VERSION_MAJOR >= 14) return 0;
11337        else return 1;
11339        ]])],[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])],[])
11340     CXXFLAGS=$save_CXXFLAGS
11341     AC_LANG_POP([C++])
11342     ENABLE_TDEAB=TRUE
11343 else
11344     AC_MSG_RESULT([no])
11345     ENABLE_TDEAB=
11347 AC_SUBST(ENABLE_TDEAB)
11349 dnl ===================================================================
11350 dnl Test whether to include KDE AB support
11351 dnl ===================================================================
11352 AC_MSG_CHECKING([whether to enable KDE address book support])
11353 if test "$enable_kdeab" = "yes" -a "$enable_kde" = "yes"; then
11354     AC_MSG_RESULT([yes])
11355     AC_LANG_PUSH([C++])
11356     save_CXXFLAGS=$CXXFLAGS
11357     CXXFLAGS="$CXXFLAGS $KDE_CFLAGS"
11358     AC_MSG_CHECKING([whether KDE is between 3.2 and 3.6])
11359        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11360 #include <kdeversion.h>
11362 int main(int argc, char **argv) {
11363        if (KDE_VERSION_MAJOR == 3 && 2 <= KDE_VERSION_MINOR && KDE_VERSION_MINOR <= 6) return 0;
11364        else return 1;
11366        ]])],[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])],[])
11367     CXXFLAGS=$save_CXXFLAGS
11368     AC_LANG_POP([C++])
11369     ENABLE_KAB=TRUE
11370 else
11371     AC_MSG_RESULT([no])
11372     ENABLE_KAB=
11374 AC_SUBST(ENABLE_KAB)
11376 dnl ===================================================================
11377 dnl Test which themes to include
11378 dnl ===================================================================
11379 AC_MSG_CHECKING([which themes to include])
11380 # if none given use default subset of available themes
11381 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11382     with_theme="crystal galaxy hicontrast oxygen tango sifr"
11383     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11386 WITH_THEMES=""
11387 if test "x$with_theme" != "xno"; then
11388     for theme in $with_theme; do
11389         case $theme in
11390         crystal|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) real_theme="$theme" ;;
11391         default) real_theme=galaxy ;;
11392         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11393         esac
11394         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11395     done
11397 AC_MSG_RESULT([$WITH_THEMES])
11398 AC_SUBST([WITH_THEMES])
11399 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11400 for theme in $with_theme; do
11401     case $theme in
11402     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11403     *) ;;
11404     esac
11405 done
11407 dnl ===================================================================
11408 dnl Test whether to integrate helppacks into the product's installer
11409 dnl ===================================================================
11410 AC_MSG_CHECKING([for helppack integration])
11411 if test "$with_helppack_integration" = "no"; then
11412     WITH_HELPPACK_INTEGRATION=
11413     AC_MSG_RESULT([no integration])
11414 else
11415     WITH_HELPPACK_INTEGRATION=TRUE
11416     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11417     AC_MSG_RESULT([integration])
11419 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11421 ###############################################################################
11422 # Extensions checking
11423 ###############################################################################
11424 AC_MSG_CHECKING([for extensions integration])
11425 if test "x$enable_extension_integration" != "xno"; then
11426     WITH_EXTENSION_INTEGRATION=TRUE
11427     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11428     AC_MSG_RESULT([yes, use integration])
11429 else
11430     WITH_EXTENSION_INTEGRATION=
11431     AC_MSG_RESULT([no, do not integrate])
11433 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11435 dnl Should any extra extensions be included?
11436 dnl There are standalone tests for each of these below.
11437 WITH_EXTRA_EXTENSIONS=
11438 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11440 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11441 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11442 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11443 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11444 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11445 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11446 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11447 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11448 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11449 if test "x$with_java" != "xno"; then
11450     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11451     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11454 dnl ===================================================================
11455 dnl Test whether to include Sun Professional Template Pack
11456 dnl ===================================================================
11457 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11458 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11459     AC_MSG_RESULT([no integration])
11460 else
11461     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11462     sun_supported_langs="en-US de it fr es hu"
11463     if test "$with_sun_templates" = "yes"; then
11464         wanted_sun_templates="$sun_supported_langs"
11465     else
11466         # check whether the langs are supported by Sun
11467         wanted_sun_templates=
11468         for lang in $with_sun_templates; do
11469             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11470                 wanted_sun_templates="$wanted_sun_templates $lang"
11471             fi
11472         done
11473     fi
11474     SUNTEMPLATES_LANG=
11475     SUNTEMPLATES_DE_PACK=
11476     SUNTEMPLATES_EN_US_PACK=
11477     SUNTEMPLATES_ES_PACK=
11478     SUNTEMPLATES_FR_PACK=
11479     SUNTEMPLATES_HU_PACK=
11480     SUNTEMPLATES_IT_PACK=
11481     # check whether the langs are requested at all
11482     for lang in $wanted_sun_templates; do
11483     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11484         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11485         case $lang in
11486         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11487         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11488         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11489         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11490         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11491         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11492         esac
11493     fi
11494     done
11495     WITH_EXTRA_EXTENSIONS=TRUE
11496     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11498 AC_SUBST(SUNTEMPLATES_DE_PACK)
11499 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11500 AC_SUBST(SUNTEMPLATES_ES_PACK)
11501 AC_SUBST(SUNTEMPLATES_FR_PACK)
11502 AC_SUBST(SUNTEMPLATES_HU_PACK)
11503 AC_SUBST(SUNTEMPLATES_IT_PACK)
11505 TEST_FONTS_MISSING=0
11507 # $1  = font family
11508 # $2+ = accepted font mappings
11509 test_font_map()
11511     FONT="$1" ; shift
11512     AC_MSG_CHECKING([font mapping for '$FONT'])
11513     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11514     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11516     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11517     while true ; do
11518         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11519         test -n "$MAPPING" || break
11520         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11521     done
11522     if test $TESTEXPR
11523     then
11524         AC_MSG_RESULT([ok])
11525     else
11526         AC_MSG_RESULT([unknown ($FONTFILE)])
11527         TEST_FONTS_MISSING=1
11528     fi
11531 dnl ===================================================================
11532 dnl Test whether to include fonts
11533 dnl ===================================================================
11534 AC_MSG_CHECKING([whether to include third-party fonts])
11535 if test "$with_fonts" != "no"; then
11536     AC_MSG_RESULT([yes])
11537     WITH_FONTS=TRUE
11538     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11539 else
11540     AC_MSG_RESULT([no])
11541     WITH_FONTS=
11542     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11543     if test "$test_fontconfig" = "yes"; then
11544         AC_PATH_PROG([FCMATCH], [fc-match])
11545         if test -z "$FCMATCH"; then
11546             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11547             TEST_FONTS_MISSING=1
11548         else
11549             test_font_map 'Calibri' 'Carlito'
11550             if test ${TEST_FONTS_MISSING} -eq 1
11551             then
11552                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11553             fi
11554         fi
11555     else
11556         TEST_FONTS_MISSING=0
11557     fi
11559 AC_SUBST(WITH_FONTS)
11560 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11562 dnl ===================================================================
11563 dnl Test whether to include extra galleries
11564 dnl ===================================================================
11565 AC_MSG_CHECKING([whether to include extra galleries])
11566 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11567     AC_MSG_RESULT([no])
11568     WITH_EXTRA_GALLERY=
11569     OOOP_GALLERY_PACK=""
11570 else
11571     AC_MSG_RESULT([yes])
11572     WITH_EXTRA_GALLERY=TRUE
11573     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11574     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11575     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11577 AC_SUBST(WITH_EXTRA_GALLERY)
11578 AC_SUBST(OOOP_GALLERY_PACK)
11580 dnl ===================================================================
11581 dnl Test whether to include extra templates
11582 dnl ===================================================================
11583 AC_MSG_CHECKING([whether to include extra templates])
11584 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11585     AC_MSG_RESULT([no])
11586     WITH_EXTRA_TEMPLATE=
11587     OOOP_TEMPLATES_PACK=""
11588 else
11589     AC_MSG_RESULT([yes])
11590     WITH_EXTRA_TEMPLATE=TRUE
11591     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11592     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11593     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11595 AC_SUBST(WITH_EXTRA_TEMPLATE)
11596 AC_SUBST(OOOP_TEMPLATES_PACK)
11598 dnl ===================================================================
11599 dnl Test whether to include extra samples
11600 dnl ===================================================================
11601 AC_MSG_CHECKING([whether to include extra samples])
11602 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11603     AC_MSG_RESULT([no])
11604     WITH_EXTRA_SAMPLE=
11605     OOOP_SAMPLES_PACK=""
11606 else
11607     AC_MSG_RESULT([yes])
11608     WITH_EXTRA_SAMPLE=TRUE
11609     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11610     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11611     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11613 AC_SUBST(WITH_EXTRA_SAMPLE)
11614 AC_SUBST(OOOP_SAMPLES_PACK)
11616 dnl ===================================================================
11617 dnl Test whether to include extra fonts
11618 dnl ===================================================================
11619 AC_MSG_CHECKING([whether to include extra fonts])
11620 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11621     AC_MSG_RESULT([no])
11622     WITH_EXTRA_FONT=
11623     OOOP_FONTS_PACK=""
11624 else
11625     AC_MSG_RESULT([yes])
11626     WITH_EXTRA_FONT=TRUE
11627     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11628     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11629     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11631 AC_SUBST(WITH_EXTRA_FONT)
11632 AC_SUBST(OOOP_FONTS_PACK)
11634 dnl ===================================================================
11635 dnl Test whether to enable online update service
11636 dnl ===================================================================
11637 AC_MSG_CHECKING([whether to enable online update])
11638 ENABLE_ONLINE_UPDATE=
11639 if test "$enable_online_update" = ""; then
11640     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11641         AC_MSG_RESULT([yes])
11642         ENABLE_ONLINE_UPDATE="TRUE"
11643     else
11644         AC_MSG_RESULT([no])
11645     fi
11646 else
11647     if test "$enable_online_update" = "yes"; then
11648         AC_MSG_RESULT([yes])
11649         ENABLE_ONLINE_UPDATE="TRUE"
11650     else
11651         AC_MSG_RESULT([no])
11652     fi
11654 AC_SUBST(ENABLE_ONLINE_UPDATE)
11656 dnl ===================================================================
11657 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11658 dnl ===================================================================
11659 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11660 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11661     AC_MSG_RESULT([no])
11662     ENABLE_SILENT_MSI=
11663 else
11664     AC_MSG_RESULT([yes])
11665     ENABLE_SILENT_MSI=TRUE
11666     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11668 AC_SUBST(ENABLE_SILENT_MSI)
11670 AC_MSG_CHECKING([whether and how to use Xinerama])
11671 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11672     if test "$x_libraries" = "default_x_libraries"; then
11673         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11674         if test "x$XINERAMALIB" = x; then
11675            XINERAMALIB="/usr/lib"
11676         fi
11677     else
11678         XINERAMALIB="$x_libraries"
11679     fi
11680     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11681         # we have both versions, let the user decide but use the dynamic one
11682         # per default
11683         USE_XINERAMA=TRUE
11684         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11685             XINERAMA_LINK=dynamic
11686         else
11687             XINERAMA_LINK=static
11688         fi
11689     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11690         # we have only the dynamic version
11691         USE_XINERAMA=TRUE
11692         XINERAMA_LINK=dynamic
11693     elif test -e "$XINERAMALIB/libXinerama.a"; then
11694         # static version
11695         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11696             USE_XINERAMA=TRUE
11697             XINERAMA_LINK=static
11698         else
11699             USE_XINERAMA=
11700             XINERAMA_LINK=none
11701         fi
11702     else
11703         # no Xinerama
11704         USE_XINERAMA=
11705         XINERAMA_LINK=none
11706     fi
11707     if test "$USE_XINERAMA" = "TRUE"; then
11708         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11709         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11710             [AC_MSG_ERROR(Xinerama header not found.)], [])
11711         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11712         if test "x$XEXTLIB" = x; then
11713            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11714         fi
11715         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11716         if test "$_os" = "FreeBSD"; then
11717             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11718         fi
11719         if test "$_os" = "Linux"; then
11720             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11721         fi
11722         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11723             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11724     else
11725         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11726     fi
11727 else
11728     USE_XINERAMA=
11729     XINERAMA_LINK=none
11730     AC_MSG_RESULT([no])
11732 AC_SUBST(USE_XINERAMA)
11733 AC_SUBST(XINERAMA_LINK)
11735 dnl ===================================================================
11736 dnl Test whether to build cairo or rely on the system version
11737 dnl ===================================================================
11739 if test "$GUIBASE" = "unx"; then
11740     # Used in vcl/Library_vclplug_gen.mk
11741     test_cairo=yes
11744 if test "$test_cairo" = "yes"; then
11745     AC_MSG_CHECKING([whether to use the system cairo])
11747     : ${with_system_cairo:=$with_system_libs}
11748     if test "$with_system_cairo" = "yes"; then
11749         SYSTEM_CAIRO=TRUE
11750         AC_MSG_RESULT([yes])
11752         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11753         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11755         if test "$test_xrender" = "yes"; then
11756             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11757             AC_LANG_PUSH([C])
11758             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11759 #ifdef PictStandardA8
11760 #else
11761       return fail;
11762 #endif
11763 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11765             AC_LANG_POP([C])
11766         fi
11767         libo_MINGW_CHECK_DLL([libcairo])
11768         libo_MINGW_TRY_DLL([libfontconfig])
11769         libo_MINGW_TRY_DLL([libfreetype])
11770         libo_MINGW_TRY_DLL([libpixman])
11771         libo_MINGW_TRY_DLL([libpng15])
11772     else
11773         SYSTEM_CAIRO=
11774         AC_MSG_RESULT([no])
11776         BUILD_TYPE="$BUILD_TYPE CAIRO"
11777         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11778     fi
11781 AC_SUBST(SYSTEM_CAIRO)
11782 AC_SUBST(CAIRO_CFLAGS)
11783 AC_SUBST(CAIRO_LIBS)
11785 dnl ===================================================================
11786 dnl Test whether to use avahi
11787 dnl ===================================================================
11788 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11789     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11790                       [ENABLE_AVAHI="TRUE"])
11791     AC_DEFINE(HAVE_FEATURE_AVAHI)
11792     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11795 AC_SUBST(ENABLE_AVAHI)
11796 AC_SUBST(AVAHI_CFLAGS)
11797 AC_SUBST(AVAHI_LIBS)
11799 dnl ===================================================================
11800 dnl Test whether to use liblangtag
11801 dnl ===================================================================
11802 ENABLE_LIBLANGTAG=
11803 SYSTEM_LIBLANGTAG=
11804 AC_MSG_CHECKING([whether to use liblangtag])
11805 if test "$enable_liblangtag" = "yes" -o \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS \); then
11806     ENABLE_LIBLANGTAG=TRUE
11807     AC_MSG_RESULT([yes])
11808     AC_MSG_CHECKING([whether to use system liblangtag])
11809     if test "$with_system_liblangtag" = yes; then
11810         SYSTEM_LIBLANGTAG=TRUE
11811         AC_MSG_RESULT([yes])
11812         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11813         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11814         libo_MINGW_CHECK_DLL([liblangtag])
11815     else
11816         SYSTEM_LIBLANGTAG=
11817         AC_MSG_RESULT([no])
11818         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11819         if test "$COM" = "MSC"; then
11820             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11821         else
11822             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11823         fi
11824     fi
11825 else
11826     AC_MSG_RESULT([no])
11828 AC_SUBST(ENABLE_LIBLANGTAG)
11829 AC_SUBST(SYSTEM_LIBLANGTAG)
11830 AC_SUBST(LIBLANGTAG_CFLAGS)
11831 AC_SUBST(LIBLANGTAG_LIBS)
11833 dnl ===================================================================
11834 dnl Test whether to build libpng or rely on the system version
11835 dnl ===================================================================
11837 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11839 dnl ===================================================================
11840 dnl Check for runtime JVM search path
11841 dnl ===================================================================
11842 if test "$ENABLE_JAVA" != ""; then
11843     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11844     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11845         AC_MSG_RESULT([yes])
11846         if ! test -d "$with_jvm_path"; then
11847             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11848         fi
11849         if ! test -d "$with_jvm_path"jvm; then
11850             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11851         fi
11852         JVM_ONE_PATH_CHECK="$with_jvm_path"
11853         AC_SUBST(JVM_ONE_PATH_CHECK)
11854     else
11855         AC_MSG_RESULT([no])
11856     fi
11859 dnl ===================================================================
11860 dnl Test for the presence of Ant and that it works
11861 dnl ===================================================================
11863 if test "$ENABLE_JAVA" != ""; then
11864     ANT_HOME=; export ANT_HOME
11865     WITH_ANT_HOME=; export WITH_ANT_HOME
11866     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11867         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11868             if test "$_os" = "WINNT"; then
11869                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11870             else
11871                 with_ant_home="$LODE_HOME/opt/ant"
11872             fi
11873         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11874             with_ant_home="$LODE_HOME/opt/ant"
11875         fi
11876     fi
11877     if test -z "$with_ant_home"; then
11878         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11879     else
11880         if test "$_os" = "WINNT"; then
11881             # AC_PATH_PROGS needs unix path
11882             with_ant_home=`cygpath -u "$with_ant_home"`
11883         fi
11884         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11885         WITH_ANT_HOME=$with_ant_home
11886         ANT_HOME=$with_ant_home
11887     fi
11889     if test -z "$ANT"; then
11890         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11891     else
11892         # resolve relative or absolute symlink
11893         while test -h "$ANT"; do
11894             a_cwd=`pwd`
11895             a_basename=`basename "$ANT"`
11896             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11897             cd "`dirname "$ANT"`"
11898             cd "`dirname "$a_script"`"
11899             ANT="`pwd`"/"`basename "$a_script"`"
11900             cd "$a_cwd"
11901         done
11903         AC_MSG_CHECKING([if $ANT works])
11904         cat > conftest.java << EOF
11905         public class conftest {
11906             int testmethod(int a, int b) {
11907                     return a + b;
11908             }
11909         }
11912         cat > conftest.xml << EOF
11913         <project name="conftest" default="conftest">
11914         <target name="conftest">
11915             <javac srcdir="." includes="conftest.java">
11916             </javac>
11917         </target>
11918         </project>
11921         oldJAVA_HOME=$JAVA_HOME
11922         if test "$JAVACISGCJ" = "yes"; then
11923             JAVA_HOME=; export JAVA_HOME
11924             ant_gcj="-Dbuild.compiler=gcj"
11925         fi
11926         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11927         if test $? = 0 -a -f ./conftest.class; then
11928             AC_MSG_RESULT([Ant works])
11929             if test -z "$WITH_ANT_HOME"; then
11930                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11931                 if test -z "$ANT_HOME"; then
11932                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11933                 fi
11934             else
11935                 ANT_HOME="$WITH_ANT_HOME"
11936             fi
11937         else
11938             echo "configure: Ant test failed" >&5
11939             cat conftest.java >&5
11940             cat conftest.xml >&5
11941             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
11942             ANT_HOME=""
11943             add_warning "Ant does not work - Some Java projects will not build!"
11944         fi
11945         JAVA_HOME=$oldJAVA_HOME
11946         rm -f conftest* core core.* *.core
11947     fi
11948     if test -z "$ANT_HOME"; then
11949         ANT_HOME="NO_ANT_HOME"
11950     else
11951         PathFormat "$ANT_HOME"
11952         ANT_HOME="$formatted_path"
11953         PathFormat "$ANT"
11954         ANT="$formatted_path"
11955     fi
11956     AC_SUBST(ANT_HOME)
11957     AC_SUBST(ANT)
11959     dnl Checking for ant.jar
11960     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11961         AC_MSG_CHECKING([Ant lib directory])
11962         if test -f $ANT_HOME/lib/ant.jar; then
11963             ANT_LIB="$ANT_HOME/lib"
11964         else
11965             if test -f $ANT_HOME/ant.jar; then
11966                 ANT_LIB="$ANT_HOME"
11967             else
11968                 if test -f /usr/share/java/ant.jar; then
11969                     ANT_LIB=/usr/share/java
11970                 else
11971                     if test -f /usr/share/ant-core/lib/ant.jar; then
11972                         ANT_LIB=/usr/share/ant-core/lib
11973                     else
11974                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11975                             ANT_LIB="$ANT_HOME/lib/ant"
11976                         else
11977                             if test -f /usr/share/lib/ant/ant.jar; then
11978                                 ANT_LIB=/usr/share/lib/ant
11979                             else
11980                                 AC_MSG_ERROR([Ant libraries not found!])
11981                             fi
11982                         fi
11983                     fi
11984                 fi
11985             fi
11986         fi
11987         PathFormat "$ANT_LIB"
11988         ANT_LIB="$formatted_path"
11989         AC_MSG_RESULT([Ant lib directory found.])
11990     fi
11991     AC_SUBST(ANT_LIB)
11993     ant_minver=1.6.0
11994     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11996     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11997     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11998     ant_version_major=`echo $ant_version | cut -d. -f1`
11999     ant_version_minor=`echo $ant_version | cut -d. -f2`
12000     echo "configure: ant_version $ant_version " >&5
12001     echo "configure: ant_version_major $ant_version_major " >&5
12002     echo "configure: ant_version_minor $ant_version_minor " >&5
12003     if test "$ant_version_major" -ge "2"; then
12004         AC_MSG_RESULT([yes, $ant_version])
12005     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12006         AC_MSG_RESULT([yes, $ant_version])
12007     else
12008         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12009     fi
12011     rm -f conftest* core core.* *.core
12014 OOO_JUNIT_JAR=
12015 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12016     AC_MSG_CHECKING([for JUnit 4])
12017     if test "$with_junit" = "yes"; then
12018         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12019             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12020         elif test -e /usr/share/java/junit4.jar; then
12021             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12022         else
12023            if test -e /usr/share/lib/java/junit.jar; then
12024               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12025            else
12026               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12027            fi
12028         fi
12029     else
12030         OOO_JUNIT_JAR=$with_junit
12031     fi
12032     if test "$_os" = "WINNT"; then
12033         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12034     fi
12035     printf 'import org.junit.Before;' > conftest.java
12036     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12037         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12038     else
12039         AC_MSG_ERROR(
12040 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12041  specify its pathname via --with-junit=..., or disable it via --without-junit])
12042     fi
12043     rm -f conftest.class conftest.java
12044     if test $OOO_JUNIT_JAR != ""; then
12045     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12046     fi
12048 AC_SUBST(OOO_JUNIT_JAR)
12050 HAMCREST_JAR=
12051 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12052     AC_MSG_CHECKING([for included Hamcrest])
12053     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12054     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12055         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12056     else
12057         AC_MSG_RESULT([Not included])
12058         AC_MSG_CHECKING([for standalone hamcrest jar.])
12059         if test "$with_hamcrest" = "yes"; then
12060             if test -e /usr/share/lib/java/hamcrest.jar; then
12061                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12062             elif test -e /usr/share/java/hamcrest/core.jar; then
12063                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12064             else
12065                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12066             fi
12067         else
12068             HAMCREST_JAR=$with_hamcrest
12069         fi
12070         if test "$_os" = "WINNT"; then
12071             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12072         fi
12073         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12074             AC_MSG_RESULT([$HAMCREST_JAR])
12075         else
12076             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),
12077                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12078         fi
12079     fi
12080     rm -f conftest.class conftest.java
12082 AC_SUBST(HAMCREST_JAR)
12085 AC_SUBST(SCPDEFS)
12088 # check for wget and curl
12090 WGET=
12091 CURL=
12093 if test "$enable_fetch_external" != "no"; then
12095 CURL=`which curl 2>/dev/null`
12097 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12098     eval "$i --version" > /dev/null 2>&1
12099     ret=$?
12100     if test $ret -eq 0; then
12101         WGET=$i
12102         break
12103     fi
12104 done
12106 if test -z "$WGET" -a -z "$CURL"; then
12107     AC_MSG_ERROR([neither wget nor curl found!])
12112 AC_SUBST(WGET)
12113 AC_SUBST(CURL)
12116 # check for md5sum
12118 MD5SUM=
12120 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12121     if test "$i" = "md5"; then
12122         eval "$i -x" > /dev/null 2>&1
12123     else
12124         eval "$i --version" > /dev/null 2>&1
12125     fi
12126     ret=$?
12127     if test $ret -eq 0; then
12128         MD5SUM=$i
12129         break
12130     fi
12131 done
12133 if test "$MD5SUM" = "md5"; then
12134     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12135         MD5SUM="$MD5SUM -r"
12136     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12137         MD5SUM="$MD5SUM -n"
12138     fi
12141 if test -z "$MD5SUM"; then
12142     AC_MSG_ERROR([no md5sum found!])
12145 AC_SUBST(MD5SUM)
12147 dnl ===================================================================
12148 dnl Dealing with l10n options
12149 dnl ===================================================================
12150 AC_MSG_CHECKING([which languages to be built])
12151 # get list of all languages
12152 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12153 # the sed command does the following:
12154 #   + if a line ends with a backslash, append the next line to it
12155 #   + adds " on the beginning of the value (after =)
12156 #   + adds " at the end of the value
12157 #   + removes en-US; we want to put it on the beginning
12158 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12159 [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)]
12160 ALL_LANGS="en-US $completelangiso"
12161 # check the configured localizations
12162 WITH_LANG="$with_lang"
12163 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12164     AC_MSG_RESULT([en-US])
12165 else
12166     AC_MSG_RESULT([$WITH_LANG])
12167     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12169 # check that the list is valid
12170 for lang in $WITH_LANG; do
12171     test "$lang" = "ALL" && continue
12172     # need to check for the exact string, so add space before and after the list of all languages
12173     for vl in $ALL_LANGS; do
12174         if test "$vl" = "$lang"; then
12175            break
12176         fi
12177     done
12178     if test "$vl" != "$lang"; then
12179         # if you're reading this - you prolly quoted your languages remove the quotes ...
12180         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12181     fi
12182 done
12183 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12184     echo $WITH_LANG | grep -q en-US
12185     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12187 # list with substituted ALL
12188 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12189 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12190 test "$WITH_LANG" = "en-US" && WITH_LANG=
12191 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12192     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12193     ALL_LANGS=`echo $ALL_LANGS qtz`
12195 AC_SUBST(ALL_LANGS)
12196 AC_SUBST(WITH_LANG)
12197 AC_SUBST(WITH_LANG_LIST)
12198 AC_SUBST(GIT_NEEDED_SUBMODULES)
12200 WITH_POOR_HELP_LOCALIZATIONS=
12201 if test -d "$SRC_ROOT/translations/source"; then
12202     for l in `ls -1 $SRC_ROOT/translations/source`; do
12203         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12204             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12205         fi
12206     done
12208 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12210 if test -n "$with_locales"; then
12211     WITH_LOCALES="$with_locales"
12213     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12214     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12215     # config_host/config_locales.h.in
12216     for locale in $WITH_LOCALES; do
12217         lang=${locale%_*}
12219         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12221         case $lang in
12222         hi|mr*ne)
12223             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12224             ;;
12225         bg|ru)
12226             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12227             ;;
12228         esac
12229     done
12230 else
12231     AC_DEFINE(WITH_LOCALE_ALL)
12233 AC_SUBST(WITH_LOCALES)
12235 dnl git submodule update --reference
12236 dnl ===================================================================
12237 if test -n "${GIT_REFERENCE_SRC}"; then
12238     for repo in ${GIT_NEEDED_SUBMODULES}; do
12239         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12240             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12241         fi
12242     done
12244 AC_SUBST(GIT_REFERENCE_SRC)
12246 dnl git submodules linked dirs
12247 dnl ===================================================================
12248 if test -n "${GIT_LINK_SRC}"; then
12249     for repo in ${GIT_NEEDED_SUBMODULES}; do
12250         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12251             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12252         fi
12253     done
12255 AC_SUBST(GIT_LINK_SRC)
12257 dnl branding
12258 dnl ===================================================================
12259 AC_MSG_CHECKING([for alternative branding images directory])
12260 # initialize mapped arrays
12261 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12262 brand_files="$BRAND_INTRO_IMAGES about.svg"
12264 if test -z "$with_branding" -o "$with_branding" = "no"; then
12265     AC_MSG_RESULT([none])
12266     DEFAULT_BRAND_IMAGES="$brand_files"
12267 else
12268     if ! test -d $with_branding ; then
12269         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12270     else
12271         AC_MSG_RESULT([$with_branding])
12272         CUSTOM_BRAND_DIR="$with_branding"
12273         for lfile in $brand_files
12274         do
12275             if ! test -f $with_branding/$lfile ; then
12276                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12277                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12278             else
12279                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12280             fi
12281         done
12282         check_for_progress="yes"
12283     fi
12285 AC_SUBST([BRAND_INTRO_IMAGES])
12286 AC_SUBST([CUSTOM_BRAND_DIR])
12287 AC_SUBST([CUSTOM_BRAND_IMAGES])
12288 AC_SUBST([DEFAULT_BRAND_IMAGES])
12291 AC_MSG_CHECKING([for 'intro' progress settings])
12292 PROGRESSBARCOLOR=
12293 PROGRESSSIZE=
12294 PROGRESSPOSITION=
12295 PROGRESSFRAMECOLOR=
12296 PROGRESSTEXTCOLOR=
12297 PROGRESSTEXTBASELINE=
12299 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12300     source "$with_branding/progress.conf"
12301     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12302 else
12303     AC_MSG_RESULT([none])
12306 AC_SUBST(PROGRESSBARCOLOR)
12307 AC_SUBST(PROGRESSSIZE)
12308 AC_SUBST(PROGRESSPOSITION)
12309 AC_SUBST(PROGRESSFRAMECOLOR)
12310 AC_SUBST(PROGRESSTEXTCOLOR)
12311 AC_SUBST(PROGRESSTEXTBASELINE)
12314 AC_MSG_CHECKING([for extra build ID])
12315 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12316     EXTRA_BUILDID="$with_extra_buildid"
12318 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12319 if test -n "$EXTRA_BUILDID" ; then
12320     AC_MSG_RESULT([$EXTRA_BUILDID])
12321 else
12322     AC_MSG_RESULT([not set])
12324 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12326 OOO_VENDOR=
12327 AC_MSG_CHECKING([for vendor])
12328 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12329     OOO_VENDOR="$USERNAME"
12331     if test -z "$OOO_VENDOR"; then
12332         OOO_VENDOR="$USER"
12333     fi
12335     if test -z "$OOO_VENDOR"; then
12336         OOO_VENDOR="`id -u -n`"
12337     fi
12339     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12340 else
12341     OOO_VENDOR="$with_vendor"
12342     AC_MSG_RESULT([$OOO_VENDOR])
12344 AC_SUBST(OOO_VENDOR)
12346 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12347 if test "$with_compat_oowrappers" = "yes"; then
12348     WITH_COMPAT_OOWRAPPERS=TRUE
12349     AC_MSG_RESULT(yes)
12350 else
12351     WITH_COMPAT_OOWRAPPERS=
12352     AC_MSG_RESULT(no)
12354 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12356 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12357 AC_MSG_CHECKING([for install dirname])
12358 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12359     INSTALLDIRNAME="$with_install_dirname"
12361 AC_MSG_RESULT([$INSTALLDIRNAME])
12362 AC_SUBST(INSTALLDIRNAME)
12364 AC_MSG_CHECKING([for prefix])
12365 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12366 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12367 PREFIXDIR="$prefix"
12368 AC_MSG_RESULT([$PREFIXDIR])
12369 AC_SUBST(PREFIXDIR)
12371 LIBDIR=[$(eval echo $(eval echo $libdir))]
12372 AC_SUBST(LIBDIR)
12374 DATADIR=[$(eval echo $(eval echo $datadir))]
12375 AC_SUBST(DATADIR)
12377 MANDIR=[$(eval echo $(eval echo $mandir))]
12378 AC_SUBST(MANDIR)
12380 DOCDIR=[$(eval echo $(eval echo $docdir))]
12381 AC_SUBST(DOCDIR)
12383 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12384 AC_SUBST(INSTALLDIR)
12386 TESTINSTALLDIR="${BUILDDIR}/test-install"
12387 AC_SUBST(TESTINSTALLDIR)
12390 # ===================================================================
12391 # OAuth2 id and secrets
12392 # ===================================================================
12394 AC_MSG_CHECKING([for Google Drive client id and secret])
12395 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12396 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12397 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12398     GDRIVE_CLIENT_ID="\"\""
12401 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12402     GDRIVE_CLIENT_SECRET="\"\""
12405 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12406     AC_MSG_RESULT([not set])
12407 else
12408     AC_MSG_RESULT([set])
12411 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12412 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12414 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12415 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12416 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12417 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12418     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12421 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12422     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12425 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12426     AC_MSG_RESULT([not set])
12427 else
12428     AC_MSG_RESULT([set])
12430 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12431 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12433 AC_MSG_CHECKING([for OneDrive client id and secret])
12434 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12435 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12436 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12437     ONEDRIVE_CLIENT_ID="\"\""
12440 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12441     ONEDRIVE_CLIENT_SECRET="\"\""
12444 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12445     AC_MSG_RESULT([not set])
12446 else
12447     AC_MSG_RESULT([set])
12449 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12450 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12453 # ===================================================================
12454 # De- or increase default verbosity of build process
12455 # ===================================================================
12456 AC_MSG_CHECKING([build verbosity])
12457 if test -n "$enable_verbose"; then
12458     if test "$enable_verbose" = "yes"; then
12459         VERBOSE="TRUE"
12460         AC_MSG_RESULT([high])
12461     fi
12462     if test "$enable_verbose" = "no"; then
12463         VERBOSE="FALSE"
12464         AC_MSG_RESULT([low])
12465     fi
12466 else
12467     AC_MSG_RESULT([not set])
12469 AC_SUBST(VERBOSE)
12471 dnl ===================================================================
12472 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12473 dnl --enable-dependency-tracking configure option
12474 dnl ===================================================================
12475 AC_MSG_CHECKING([whether to enable dependency tracking])
12476 if test "$enable_dependency_tracking" = "no"; then
12477     nodep=TRUE
12478     AC_MSG_RESULT([no])
12479 else
12480     AC_MSG_RESULT([yes])
12482 AC_SUBST(nodep)
12484 dnl ===================================================================
12485 dnl Number of CPUs to use during the build
12486 dnl ===================================================================
12487 AC_MSG_CHECKING([for number of processors to use])
12488 # plain --with-parallelism is just the default
12489 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12490     if test "$with_parallelism" = "no"; then
12491         PARALLELISM=0
12492     else
12493         PARALLELISM=$with_parallelism
12494     fi
12495 else
12496     if test "$enable_icecream" = "yes"; then
12497         PARALLELISM="10"
12498     else
12499         case `uname -s` in
12501         Darwin|FreeBSD|NetBSD|OpenBSD)
12502             PARALLELISM=`sysctl -n hw.ncpu`
12503             ;;
12505         Linux)
12506             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12507         ;;
12508         # what else than above does profit here *and* has /proc?
12509         *)
12510             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12511             ;;
12512         esac
12514         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12515         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12516     fi
12519 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12520     if test -z "$with_parallelism"; then
12521             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12522             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12523             PARALLELISM="1"
12524     else
12525         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."
12526     fi
12529 if test $PARALLELISM -eq 0; then
12530     AC_MSG_RESULT([explicit make -j option needed])
12531 else
12532     AC_MSG_RESULT([$PARALLELISM])
12534 AC_SUBST(PARALLELISM)
12536 IWYU_PATH="$with_iwyu"
12537 AC_SUBST(IWYU_PATH)
12539 # Set up ILIB for MSVC build
12541 if test "$build_os" = "cygwin"; then
12542     ILIB="."
12543     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12544         ILIB="$ILIB;$JAVA_HOME/lib"
12545     fi
12546     if test "$BITNESS_OVERRIDE" = 64; then
12547         ILIB="$ILIB;$COMPATH/lib/amd64"
12548         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12549         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81; then
12550             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12551         fi
12552     else
12553         ILIB="$ILIB;$COMPATH/lib"
12554         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12555         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81; then
12556             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12557         fi
12558     fi
12559     ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12561     if test "$ENABLE_DIRECTX" = "TRUE" -a "$HAVE_DIRECTXSDK_LIB" = "yes"; then
12562         ILIB="$ILIB;$DIRECTXSDK_LIB"
12563     fi
12564     AC_SUBST(ILIB)
12568 # ===================================================================
12569 # Creating bigger shared library to link against
12570 # ===================================================================
12571 AC_MSG_CHECKING([whether to create huge library])
12572 MERGELIBS=
12574 if test $_os = iOS -o $_os = Android; then
12575     # Never any point in mergelibs for these as we build just static
12576     # libraries anyway...
12577     enable_mergelibs=no
12580 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12581     if test $_os != Linux -a $_os != WINNT; then
12582         add_warning "--enable-mergelibs is not tested for this platform"
12583     fi
12584     if test "$enable_mergelibs" = "all"; then
12585         MERGELIBS="ALL"
12586         URELIBS="TRUE"
12587         AC_DEFINE(STATIC_LINKING)
12588     else
12589         MERGELIBS="CORE"
12590     fi
12591     AC_MSG_RESULT([yes])
12592 else
12593     AC_MSG_RESULT([no])
12595 AC_SUBST([MERGELIBS])
12596 AC_SUBST([URELIBS])
12598 # ===================================================================
12599 # Create hardlinks on deliver instead of copying for smaller size and speed up
12600 # ===================================================================
12601 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12602 HARDLINKDELIVER=
12603 if test "$enable_hardlink_deliver" = "yes"; then
12604     HARDLINKDELIVER="TRUE"
12605     AC_MSG_RESULT([yes])
12606 else
12607     AC_MSG_RESULT([no])
12609 AC_SUBST(HARDLINKDELIVER)
12611 dnl ===================================================================
12612 dnl icerun is a wrapper that stops us spawning tens of processes
12613 dnl locally - for tools that can't be executed on the compile cluster
12614 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12615 dnl ===================================================================
12616 AC_MSG_CHECKING([whether to use icerun wrapper])
12617 ICECREAM_RUN=
12618 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12619     ICECREAM_RUN=icerun
12620     AC_MSG_RESULT([yes])
12621 else
12622     AC_MSG_RESULT([no])
12624 AC_SUBST(ICECREAM_RUN)
12626 dnl ===================================================================
12628 AC_MSG_CHECKING([MPL subset])
12629 MPL_SUBSET=
12631 if test "$enable_mpl_subset" = "yes"; then
12632     warn_report=false
12633     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12634         warn_report=true
12635     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12636         warn_report=true
12637     fi
12638     if test "$warn_report" = "true"; then
12639         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12640     fi
12641     if test "x$enable_postgresql_sdbc" != "xno"; then
12642         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12643     fi
12644     if test "$enable_lotuswordpro" = "yes"; then
12645         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12646     fi
12647     if test "$WITH_WEBDAV" = "neon"; then
12648         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12649     fi
12650     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12651         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12652     fi
12653     if test -n "$ENABLE_PDFIMPORT"; then
12654         if test "x$SYSTEM_POPPLER" != "x"; then
12655             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12656         fi
12657     fi
12658     # cf. m4/libo_check_extension.m4
12659     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12660         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12661     fi
12662     for theme in $WITH_THEMES; do
12663         case $theme in
12664         crystal|default|hicontrast|human|oxygen|sifr)
12665             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12666         *) : ;;
12667         esac
12668     done
12670     ENABLE_OPENGL=
12672     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12673         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12674     fi
12676     MPL_SUBSET="TRUE"
12677     AC_DEFINE(MPL_HAVE_SUBSET)
12678     AC_MSG_RESULT([only])
12679 else
12680     AC_MSG_RESULT([no restrictions])
12682 AC_SUBST(MPL_SUBSET)
12685 dnl ===================================================================
12686 dnl Setting up the environment.
12687 dnl ===================================================================
12688 echo "setting up the build environment variables..."
12690 AC_SUBST(COMPATH)
12692 if test "$build_os" = "cygwin"; then
12693     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12694         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12695         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12696     else
12697         ATL_LIB="$COMPATH/atlmfc/lib"
12698         ATL_INCLUDE="$COMPATH/atlmfc/include"
12699     fi
12700     if test "$BITNESS_OVERRIDE" = 64; then
12701         ATL_LIB="$ATL_LIB/amd64"
12702     fi
12703     PathFormat "/usr/bin/grep.exe"
12704     WIN_GREP="$formatted_path"
12705     PathFormat "/usr/bin/find.exe"
12706     WIN_FIND="$formatted_path"
12707     PathFormat "/usr/bin/ls.exe"
12708     WIN_LS="$formatted_path"
12709     PathFormat "/usr/bin/touch.exe"
12710     WIN_TOUCH="$formatted_path"
12713 AC_SUBST(ATL_INCLUDE)
12714 AC_SUBST(ATL_LIB)
12715 AC_SUBST(WIN_FIND)
12716 AC_SUBST(WIN_GREP)
12717 AC_SUBST(WIN_LS)
12718 AC_SUBST(WIN_TOUCH)
12720 AC_SUBST(BUILD_TYPE)
12722 AC_SUBST(SOLARINC)
12724 PathFormat "$PERL"
12725 PERL="$formatted_path"
12726 AC_SUBST(PERL)
12728 if test -n "$TMPDIR"; then
12729     TEMP_DIRECTORY="$TMPDIR"
12730 else
12731     TEMP_DIRECTORY="/tmp"
12733 if test "$build_os" = "cygwin"; then
12734     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12736 AC_SUBST(TEMP_DIRECTORY)
12738 # setup the PATH for the environment
12739 if test -n "$LO_PATH_FOR_BUILD"; then
12740     LO_PATH="$LO_PATH_FOR_BUILD"
12741 else
12742     LO_PATH="$PATH"
12744     case "$host_os" in
12746     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12747         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12748             pathmunge "$JAVA_HOME/bin" "after"
12749         fi
12750         ;;
12752     cygwin*)
12753         # Win32 make needs native paths
12754         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12755             LO_PATH=`cygpath -p -m "$PATH"`
12756         fi
12757         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12758         pathmunge "$ASM_HOME" "before"
12759         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12760         pathmunge "$CSC_PATH" "before"
12761         pathmunge "$MIDL_PATH" "before"
12762         pathmunge "$AL_PATH" "before"
12763         pathmunge "$MSPDB_PATH" "before"
12764         if test -n "$MSBUILD_PATH" ; then
12765             pathmunge "$MSBUILD_PATH" "before"
12766         fi
12767         if test "$BITNESS_OVERRIDE" = 64; then
12768             pathmunge "$COMPATH/bin/amd64" "before"
12769             pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12770         else
12771             pathmunge "$COMPATH/bin" "before"
12772             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12773         fi
12774         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12775             if test -d "$JAVA_HOME/jre/bin/client"; then
12776                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12777             fi
12778             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12779                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12780             fi
12781             pathmunge "$JAVA_HOME/bin" "before"
12782         fi
12783         ;;
12785     solaris*)
12786         pathmunge "/usr/css/bin" "before"
12787         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12788             pathmunge "$JAVA_HOME/bin" "after"
12789         fi
12790         ;;
12791     esac
12793     pathmunge "$SRC_ROOT/solenv/bin" "before"
12794     pathmunge "." "before"
12797 AC_SUBST(LO_PATH)
12799 # Generate a configuration md5 we can use for deps
12800 if test -f config_host.mk; then
12801     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12804 AC_CONFIG_FILES([android/experimental/LOAndroid3/AndroidManifest.xml
12805                  config_host.mk
12806                  Makefile
12807                  lo.xcent
12808                  instsetoo_native/util/openoffice.lst
12809                  sysui/desktop/macosx/Info.plist
12810                  ios/lo.xcconfig])
12811 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12812 AC_CONFIG_HEADERS([config_host/config_clang.h])
12813 AC_CONFIG_HEADERS([config_host/config_eot.h])
12814 AC_CONFIG_HEADERS([config_host/config_features.h])
12815 AC_CONFIG_HEADERS([config_host/config_folders.h])
12816 AC_CONFIG_HEADERS([config_host/config_gcc.h])
12817 AC_CONFIG_HEADERS([config_host/config_global.h])
12818 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12819 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12820 AC_CONFIG_HEADERS([config_host/config_locales.h])
12821 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12822 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12823 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12824 AC_CONFIG_HEADERS([config_host/config_mingw.h])
12825 AC_CONFIG_HEADERS([config_host/config_oox.h])
12826 AC_CONFIG_HEADERS([config_host/config_options.h])
12827 AC_CONFIG_HEADERS([config_host/config_test.h])
12828 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12829 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12830 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12831 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12832 AC_CONFIG_HEADERS([config_host/config_version.h])
12833 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12834 AC_OUTPUT
12836 if test "$CROSS_COMPILING" = TRUE; then
12837     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12840 # touch the config timestamp file
12841 if test ! -f config_host.mk.stamp; then
12842     echo > config_host.mk.stamp
12843 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12844     echo "Configuration unchanged - avoiding scp2 stamp update"
12845 else
12846     echo > config_host.mk.stamp
12850 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12852 cat << _EOS
12853 ****************************************************************************
12854 WARNING:
12855 Your make version is known to be horribly slow, and hard to debug
12856 problems with. To get a reasonably functional make please do:
12858 to install a pre-compiled binary make for Win32
12860  mkdir -p /opt/lo/bin
12861  cd /opt/lo/bin
12862  wget http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12863  cp make-85047eb-msvc.exe make
12864  chmod +x make
12866 to install from source:
12867 place yourself in a working directory of you choice.
12869  git clone git://git.savannah.gnu.org/make.git
12871  [go to Start menu, click on "VS2012 x86 Native Tools Command Prompt"]
12872  set PATH=%PATH%;C:\Cygwin\bin
12873  cd .../path/to/make_git
12874  build_w32.bat --without-guile
12876 should result in a WinRel/gnumake.exe
12878 Then re-run autogen.sh
12880 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12881 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12883 _EOS
12886 cat << _EOF
12887 ****************************************************************************
12889 To build, issue:
12890 $GNUMAKE
12892 For details, run:
12893 $GNUMAKE help
12895 _EOF
12897 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12898     cat << _EOF
12899 After the build has finished, you can immediately run it using:
12900 instdir/program/soffice
12902 If you want to run the smoketest, issue:
12903 $GNUMAKE check
12905 _EOF
12908 if test -f warn; then
12909     cat warn
12910     rm warn
12913 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: