update emoji autocorrect files from po-files
[LibreOffice.git] / configure.ac
blobca5ae09aa2909fb3611f73c9d9f7e901d7514c48
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argumemnt to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[5.2.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84     fi
87 AbsolutePath()
89     # There appears to be no simple and portable method to get an absolute and
90     # canonical path, so we try creating the directory if does not exist and
91     # utilizing the shell and pwd.
92     rel="$1"
93     absolute_path=""
94     test ! -e "$rel" && mkdir -p "$rel"
95     if test -d "$rel" ; then
96         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
97         absolute_path="$(pwd)"
98         cd - > /dev/null
99     else
100         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
101     fi
104 rm -f warn
105 have_WARNINGS="no"
106 add_warning()
108     if test "$have_WARNINGS" = "no"; then
109         echo "*************************************" > warn
110         have_WARNINGS="yes"
111         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
112             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
113             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
114         else
115             COLORWARN="* WARNING :"
116         fi
117     fi
118     echo "$COLORWARN $@" >> warn
121 dnl Some Mac User have the bad habbit of letting a lot fo crap
122 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
123 dnl that confuse the build.
124 dnl For the ones that use LODE, let's be nice and protect them
125 dnl from themselves
127 mac_sanitize_path()
129     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
130 dnl a common but nevertheless necessary thing that may be in a fancy
131 dnl path location is git, so make sure we have it
132     mac_git_path=`which git 2>/dev/null`
133     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
134         mac_path="$mac_path:`dirname $mac_git_path`"
135     fi
136     PATH="$mac_path"
137     unset mac_path
138     unset git_mac_path
141 echo "********************************************************************"
142 echo "*"
143 echo "*   Running ${PACKAGE_NAME} build configuration."
144 echo "*"
145 echo "********************************************************************"
146 echo ""
148 dnl ===================================================================
149 dnl checks build and host OSes
150 dnl do this before argument processing to allow for platform dependent defaults
151 dnl ===================================================================
152 AC_CANONICAL_HOST
154 AC_MSG_CHECKING([for product name])
155 PRODUCTNAME="AC_PACKAGE_NAME"
156 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
157     PRODUCTNAME="${PRODUCTNAME}Dev"
159 AC_MSG_RESULT([$PRODUCTNAME])
160 AC_SUBST(PRODUCTNAME)
162 dnl ===================================================================
163 dnl Our version is defined by the AC_INIT() at the top of this script.
164 dnl ===================================================================
166 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
168 LIBO_VERSION_MAJOR=$1
169 LIBO_VERSION_MINOR=$2
170 LIBO_VERSION_MICRO=$3
171 LIBO_VERSION_PATCH=$4
173 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
174 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
175 # no way to encode that into an integer in general.
176 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
178 LIBO_VERSION_SUFFIX=$5
179 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
180 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
181 # they get undoubled before actually passed to sed.
182 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
183 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
184 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
185 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
187 AC_SUBST(LIBO_VERSION_MAJOR)
188 AC_SUBST(LIBO_VERSION_MINOR)
189 AC_SUBST(LIBO_VERSION_MICRO)
190 AC_SUBST(LIBO_VERSION_PATCH)
191 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
192 AC_SUBST(LIBO_VERSION_SUFFIX)
193 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
195 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
196 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
197 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
198 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
200 LIBO_THIS_YEAR=`date +%Y`
201 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
203 dnl ===================================================================
204 dnl Product version
205 dnl ===================================================================
206 AC_MSG_CHECKING([for product version])
207 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
208 AC_MSG_RESULT([$PRODUCTVERSION])
209 AC_SUBST(PRODUCTVERSION)
211 AC_PROG_EGREP
212 # AC_PROG_EGREP doesn't set GREP on all systems as well
213 AC_PATH_PROG(GREP, grep)
215 BUILDDIR=`pwd`
216 cd $srcdir
217 SRC_ROOT=`pwd`
218 cd $BUILDDIR
219 x_Cygwin=[\#]
221 dnl ======================================
222 dnl Required GObject introspection version
223 dnl ======================================
224 INTROSPECTION_REQUIRED_VERSION=1.32.0
226 dnl ===================================================================
227 dnl Search all the common names for GNU Make
228 dnl ===================================================================
229 AC_MSG_CHECKING([for GNU Make])
231 # try to use our own make if it is available and GNUMAKE was not already defined
232 if test -z "$GNUMAKE"; then
233     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
234         GNUMAKE="$LODE_HOME/opt/bin/make"
235     elif test -x "/opt/lo/bin/make"; then
236         GNUMAKE="/opt/lo/bin/make"
237     fi
240 GNUMAKE_WIN_NATIVE=
241 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
242     if test -n "$a"; then
243         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
244         if test $? -eq 0;  then
245             if test "$build_os" = "cygwin"; then
246                 if test -n "$($a -v | grep 'Built for Windows')" ; then
247                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
248                     GNUMAKE_WIN_NATIVE="TRUE"
249                 else
250                     GNUMAKE=`which $a`
251                 fi
252             else
253                 GNUMAKE=`which $a`
254             fi
255             break
256         fi
257     fi
258 done
259 AC_MSG_RESULT($GNUMAKE)
260 if test -z "$GNUMAKE"; then
261     AC_MSG_ERROR([not found. install GNU Make.])
262 else
263     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
264         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
265     fi
268 win_short_path_for_make()
270     local_short_path="$1"
271     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
272         cygpath -sm "$local_short_path"
273     else
274         cygpath -u "$(cygpath -d "$local_short_path")"
275     fi
279 if test "$build_os" = "cygwin"; then
280     PathFormat "$SRC_ROOT"
281     SRC_ROOT="$formatted_path"
282     PathFormat "$BUILDDIR"
283     BUILDDIR="$formatted_path"
284     x_Cygwin=
285     AC_MSG_CHECKING(for explicit COMSPEC)
286     if test -z "$COMSPEC"; then
287         AC_MSG_ERROR([COMSPEC not set in Environment, please set it an rerun])
288     fi
291 AC_SUBST(SRC_ROOT)
292 AC_SUBST(BUILDDIR)
293 AC_SUBST(x_Cygwin)
294 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
295 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
297 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
298     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
301 # need sed in os checks...
302 AC_PATH_PROGS(SED, sed)
303 if test -z "$SED"; then
304     AC_MSG_ERROR([install sed to run this script])
307 # Set the ENABLE_LTO variable
308 # ===================================================================
309 AC_MSG_CHECKING([whether to use link-time optimization])
310 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
311     ENABLE_LTO="TRUE"
312     AC_MSG_RESULT([yes])
313     AC_DEFINE(STATIC_LINKING)
314 else
315     ENABLE_LTO=""
316     AC_MSG_RESULT([no])
318 AC_SUBST(ENABLE_LTO)
320 dnl ===================================================================
321 dnl When building for Android, --with-android-ndk,
322 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
323 dnl mandatory
324 dnl ===================================================================
326 AC_ARG_WITH(android-ndk,
327     AS_HELP_STRING([--with-android-ndk],
328         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
331 AC_ARG_WITH(android-ndk-toolchain-version,
332     AS_HELP_STRING([--with-android-ndk-toolchain-version],
333         [Specify which toolchain version to use, of those present in the
334         Android NDK you are using. The default is 4.9 currently.]), ,)
336 AC_ARG_WITH(android-sdk,
337     AS_HELP_STRING([--with-android-sdk],
338         [Specify location of the Android SDK. Mandatory when building for Android,
339         or when building the Impress Remote Android app.]),
342 ANDROID_NDK_HOME=
343 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
344     with_android_ndk="$SRC_ROOT/external/android-ndk"
346 if test -n "$with_android_ndk"; then
347     ANDROID_NDK_HOME=$with_android_ndk
349     # Set up a lot of pre-canned defaults
351     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
352         AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT file in $ANDROID_NDK_HOME.])
353     fi
354     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
356     case $ANDROID_NDK_VERSION in
357     r9*|r10*)
358         ;;
359     *)
360         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r9* and r10* versions are supported])
361         ;;
362     esac
364     if test $host_cpu = arm; then
365         android_cpu=arm
366         android_platform_prefix=$android_cpu-linux-androideabi
367     elif test $host_cpu = aarch64; then
368         android_cpu=aarch64
369         android_platform_prefix=$android_cpu-linux-android
370     elif test $host_cpu = mips; then
371         android_cpu=mips
372         android_platform_prefix=$android_cpu-linux-androideabi
373     else
374         # host_cpu is something like "i386" or "i686" I guess, NDK uses
375         # "x86" in some contexts
376         android_cpu=x86
377         android_platform_prefix=$android_cpu
378     fi
380     if test -z "$with_android_ndk_toolchain_version"; then
381         # Default to gcc 4.9
382         with_android_ndk_toolchain_version=4.9
383     fi
385     case "$with_android_ndk_toolchain_version" in
386     4.6|4.7|4.8|4.9)
387         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
388         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
389         ;;
390     clang3.3|clang3.4)
391         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
392         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
393         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
394         ANDROID_USING_CLANG=true
395         ;;
396     *)
397         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
398     esac
400     if test ! -d $ANDROID_BINUTILS_DIR; then
401         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
402     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
403         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
404     fi
406     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
407     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
408     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
409     # manage to link the (app-specific) single huge .so that is built for the app in
410     # android/source/ if there is debug information in a significant part of the object files.
411     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
412     # all objects have been built with debug information.)
413     toolchain_system='*'
414     case $build_os in
415     linux-gnu*)
416         ndk_build_os=linux
417         ;;
418     darwin*)
419         ndk_build_os=darwin
420         ;;
421     *)
422         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
423         ;;
424     esac
426     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
427     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
428     if test $build_cpu = x86_64; then
429         if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
430             ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
431         fi
432         if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
433             ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
434         fi
435     fi
436     ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
438     # This stays empty if there is just one version of the toolchain in the NDK
439     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
440     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
441     */bin\ */bin*)
442         # Trailing slash intentional and necessary, compare to how this is used
443         if test -n "$ANDROID_USING_CLANG"; then
444             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
445         else
446             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
447         fi
448         ;;
449     esac
451     ANDROID_API_LEVEL=15
452     if test $host_cpu = arm; then
453         android_gnu_prefix=arm-linux-androideabi
454     elif test $host_cpu = aarch64; then
455         android_gnu_prefix=aarch64-linux-android
456         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
457         ANDROID_API_LEVEL=L
458     elif test $host_cpu = mips; then
459         android_gnu_prefix=mipsel-linux-android
460     elif test $ANDROID_NDK_VERSION = r8; then
461         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
462         android_gnu_prefix=i686-android-linux
463     else
464         android_gnu_prefix=i686-linux-android
465     fi
467     ANDROID_ARCH=$android_cpu
468     if test $host_cpu = arm; then
469         ANDROID_APP_ABI=armeabi-v7a
470         if test -n "$ANDROID_USING_CLANG"; then
471             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
472             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
473             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
474         else
475             :
476         fi
477         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
478         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
479         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
480     elif test $host_cpu = aarch64; then
481         ANDROID_APP_ABI=arm64-v8a
482         ANDROID_ARCH=arm64
483     elif test $host_cpu = mips; then
484         ANDROID_APP_ABI=mips
485         ANDROIDCFLAGS=""
486     else # x86
487         ANDROID_APP_ABI=x86
488         ANDROIDCFLAGS="-march=atom"
489     fi
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
491     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
492     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
493     export PKG_CONFIG_LIBDIR="$ANDROID_BINUTILS_PREBUILT_ROOT/lib/pkgconfig"
495     if test -n "$ANDROID_USING_CLANG"; then
496         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
497     else
498         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
499     fi
501     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
502     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
503     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
504     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
505     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
506     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
508     # When using the 4.6 or newer toolchain, use the gold linker
509     case "$with_android_ndk_toolchain_version" in
510     4.[[6789]]*|[[56789]].*|clang*)
511         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
512             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
513         fi
514         ;;
515     esac
517     if test "$ENABLE_LTO" = TRUE; then
518         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
519         # $CC and $CXX when building external libraries
520          if test "$COM_IS_CLANG" = TRUE; then
521             ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
522         else
523             ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
524         fi
525     fi
527     # gdbserver can be in different locations
528     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
529         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
530     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
531         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
532     elif test $android_cpu = aarch64; then
533         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
534     else
535         AC_MSG_ERROR([Can't find gdbserver for your Android target])
536     fi
538     if test $host_cpu = arm; then
539         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"
540     elif test $host_cpu = mips; then
541         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"
542     else # x86
543         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"
544     fi
546     if test -z "$CC"; then
547         case "$with_android_ndk_toolchain_version" in
548         4.*)
549             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
550             ;;
551         clang*)
552             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
553         esac
554     fi
555     if test -z "$CXX"; then
556         case "$with_android_ndk_toolchain_version" in
557         4.*)
558             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
559             ;;
560         clang*)
561             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
562             ;;
563         esac
564     fi
566     # remember to download the ownCloud Android library later
567     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
569 AC_SUBST(ANDROID_NDK_GDBSERVER)
570 AC_SUBST(ANDROID_APP_ABI)
572 dnl ===================================================================
573 dnl --with-android-sdk
574 dnl ===================================================================
575 ANDROID_SDK_HOME=
576 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
577     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
579 if test -n "$with_android_sdk"; then
580     ANDROID_SDK_HOME=$with_android_sdk
581     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
583 AC_SUBST(ANDROID_SDK_HOME)
585 dnl ===================================================================
586 dnl The following is a list of supported systems.
587 dnl Sequential to keep the logic very simple
588 dnl These values may be checked and reset later.
589 dnl ===================================================================
590 #defaults unless the os test overrides this:
591 test_randr=yes
592 test_xrender=yes
593 test_cups=yes
594 test_dbus=yes
595 test_fontconfig=yes
596 test_cairo=no
598 # Default values, as such probably valid just for Linux, set
599 # differently below just for Mac OSX,but at least better than
600 # hardcoding these as we used to do. Much of this is duplicated also
601 # in solenv for old build system and for gbuild, ideally we should
602 # perhaps define stuff like this only here in configure.ac?
604 LINKFLAGSSHL="-shared"
605 PICSWITCH="-fpic"
606 DLLPOST=".so"
608 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
610 INSTROOTSUFFIX=
611 SDKDIRNAME=sdk
613 case "$host_os" in
615 solaris*)
616     test_gtk=yes
617     build_gstreamer_1_0=yes
618     build_gstreamer_0_10=yes
619     test_tde=yes
620     test_freetype=yes
621     _os=SunOS
623     dnl ===========================================================
624     dnl Check whether we're using Solaris 10 - SPARC or Intel.
625     dnl ===========================================================
626     AC_MSG_CHECKING([the Solaris operating system release])
627     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
628     if test "$_os_release" -lt "10"; then
629         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
630     else
631         AC_MSG_RESULT([ok ($_os_release)])
632     fi
634     dnl Check whether we're using a SPARC or i386 processor
635     AC_MSG_CHECKING([the processor type])
636     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
637         AC_MSG_RESULT([ok ($host_cpu)])
638     else
639         AC_MSG_ERROR([only SPARC and i386 processors are supported])
640     fi
641     ;;
643 linux-gnu*|k*bsd*-gnu*)
644     test_gtk=yes
645     build_gstreamer_1_0=yes
646     build_gstreamer_0_10=yes
647     test_tde=yes
648     test_kde4=yes
649     test_freetype=yes
650     _os=Linux
651     ;;
653 gnu)
654     test_randr=no
655     test_xrender=no
656     _os=GNU
657      ;;
659 cygwin*|interix*|mingw32*)
661     # When building on Windows normally with MSVC under Cygwin,
662     # configure thinks that the host platform (the platform the
663     # built code will run on) is Cygwin, even if it obviously is
664     # Windows, which in Autoconf terminology is called
665     # "mingw32". (Which is misleading as MinGW is the name of the
666     # tool-chain, not an operating system.)
668     # Somewhat confusing, yes. But this configure script doesn't
669     # look at $host etc that much, it mostly uses its own $_os
670     # variable, set here in this case statement.
672     # When cross-compiling to Windows from Unix, the host platform
673     # is "mingw32" (because in that case it is the MinGW
674     # tool-chain that is used).
676     test_cups=no
677     test_dbus=no
678     test_randr=no
679     test_xrender=no
680     test_freetype=no
681     test_fontconfig=no
682     _os=WINNT
684     DLLPOST=".dll"
685     LINKFLAGSNOUNDEFS=
687     # If the host OS matches "mingw32*", that means we are using the
688     # MinGW cross-compiler, because we don't see the point in building
689     # LibreOffice using MinGW on Windows. If you want to build on
690     # Windows, use MSVC. If you want to use MinGW, surely you want to
691     # cross-compile (from Linux or some other Unix).
693     case "$host_os" in
694     mingw32*)
695         WITH_MINGW=yes
696         if test -z "$CC"; then
697             CC="$host_cpu-$host_vendor-$host_os-gcc"
698         fi
699         if test -z "$CXX"; then
700             CXX="$host_cpu-$host_vendor-$host_os-g++"
701         fi
702         ;;
703     esac
704     ;;
706 darwin*) # Mac OS X or iOS
707     test_gtk=yes
708     test_randr=no
709     test_xrender=no
710     test_freetype=no
711     test_fontconfig=no
712     test_dbus=no
713     if test "$host_cpu" = "arm"; then
714         _os=iOS
715         test_gtk=no
716         test_cups=no
717     else
718         _os=Darwin
719         if test -n "$LODE_HOME" ; then
720             mac_sanitize_path
721             AC_MSG_NOTICE([sanitized the PATH to $PATH])
722         fi
723         INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
724         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
725     fi
726     enable_systray=no
727     # See comment above the case "$host_os"
728     LINKFLAGSSHL="-dynamiclib -single_module"
730     # -fPIC is default
731     PICSWITCH=""
733     DLLPOST=".dylib"
735     # -undefined error is the default
736     LINKFLAGSNOUNDEFS=""
739 freebsd*)
740     test_gtk=yes
741     build_gstreamer_1_0=yes
742     build_gstreamer_0_10=yes
743     test_tde=yes
744     test_kde4=yes
745     test_freetype=yes
746     AC_MSG_CHECKING([the FreeBSD operating system release])
747     if test -n "$with_os_version"; then
748         OSVERSION="$with_os_version"
749     else
750         OSVERSION=`/sbin/sysctl -n kern.osreldate`
751     fi
752     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
753     AC_MSG_CHECKING([which thread library to use])
754     if test "$OSVERSION" -lt "500016"; then
755         PTHREAD_CFLAGS="-D_THREAD_SAFE"
756         PTHREAD_LIBS="-pthread"
757     elif test "$OSVERSION" -lt "502102"; then
758         PTHREAD_CFLAGS="-D_THREAD_SAFE"
759         PTHREAD_LIBS="-lc_r"
760     else
761         PTHREAD_CFLAGS=""
762         PTHREAD_LIBS="-pthread"
763     fi
764     AC_MSG_RESULT([$PTHREAD_LIBS])
765     _os=FreeBSD
766     ;;
768 *netbsd*)
769     test_gtk=yes
770     build_gstreamer_1_0=yes
771     build_gstreamer_0_10=yes
772     test_tde=no
773     test_kde4=yes
774     test_freetype=yes
775     PTHREAD_LIBS="-pthread -lpthread"
776     _os=NetBSD
777     ;;
779 aix*)
780     test_randr=no
781     test_freetype=yes
782     PTHREAD_LIBS=-pthread
783     _os=AIX
784     ;;
786 openbsd*)
787     test_gtk=yes
788     test_tde=yes
789     test_freetype=yes
790     PTHREAD_CFLAGS="-D_THREAD_SAFE"
791     PTHREAD_LIBS="-pthread"
792     _os=OpenBSD
793     ;;
795 dragonfly*)
796     test_gtk=yes
797     build_gstreamer_1_0=yes
798     build_gstreamer_0_10=yes
799     test_tde=yes
800     test_kde4=yes
801     test_freetype=yes
802     PTHREAD_LIBS="-pthread"
803     _os=DragonFly
804     ;;
806 linux-android*)
807     build_gstreamer_1_0=no
808     build_gstreamer_0_10=no
809     enable_lotuswordpro=no
810     enable_mpl_subset=yes
811     enable_coinmp=yes
812     enable_lpsolve=no
813     enable_report_builder=no
814     enable_odk=no
815     enable_postgresql_sdbc=no
816     enable_python=no
817     with_theme="tango"
818     test_cups=no
819     test_dbus=no
820     test_fontconfig=no
821     test_freetype=no
822     test_gtk=no
823     test_tde=no
824     test_kde4=no
825     test_randr=no
826     test_xrender=no
827     _os=Android
829     if test -z "$with_android_ndk"; then
830         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
831     fi
833     if test -z "$with_android_ndk_toolchain_version"; then
834         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
835     fi
837     # Verify that the NDK and SDK options are proper
838     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
839         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
840     fi
842     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
843     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
844     ;;
846 emscripten*)
847     build_gstreamer_1_0=no
848     build_gstreamer_0_10=no
849     enable_lotuswordpro=no
850     enable_mpl_subset=yes
851     enable_coinmp=yes
852     enable_lpsolve=no
853     enable_report_builder=no
854     with_theme="tango"
855     test_cups=no
856     test_dbus=no
857     test_fontconfig=no
858     test_freetype=no
859     test_gtk=no
860     test_tde=no
861     test_kde4=no
862     test_randr=no
863     test_xrender=no
864     _os=Emscripten
865     ;;
868     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
869     ;;
870 esac
872 if echo "$host_os" | grep -q linux-android ; then
873     if test -z "$with_android_sdk"; then
874         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
875     fi
877     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
878         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
879     fi
881     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
882     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
883         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
884                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
885                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
886         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
887         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
888         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
889     fi
890     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
891         AC_MSG_WARN([android support repository not found - install with
892                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
893                      to allow the build to download the specified version of the android support libraries])
894         add_warning "android support repository not found - install with"
895         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
896         add_warning "to allow the build to download the specified version of the android support libraries"
897     fi
900 if test "$_os" = "AIX"; then
901     AC_PATH_PROG(GAWK, gawk)
902     if test -z "$GAWK"; then
903         AC_MSG_ERROR([gawk not found in \$PATH])
904     fi
907 AC_SUBST(SDKDIRNAME)
909 AC_SUBST(WITH_MINGW)
910 AC_SUBST(PTHREAD_CFLAGS)
911 AC_SUBST(PTHREAD_LIBS)
913 if test $_os != "WINNT"; then
914     save_LIBS="$LIBS"
915     AC_SEARCH_LIBS([dlsym], [dl],
916         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
917         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
918     LIBS="$save_LIBS"
920 AC_SUBST(DLOPEN_LIBS)
922 ###############################################################################
923 # Extensions switches --enable/--disable
924 ###############################################################################
925 # By default these should be enabled unless having extra dependencies.
926 # If there is extra dependency over configure options then the enable should
927 # be automagic based on whether the requiring feature is enabled or not.
928 # All this options change anything only with --enable-extension-integration.
930 # The name of this option and its help string makes it sound as if
931 # extensions are built anyway, just not integrated in the installer,
932 # if you use --disable-extension-integration. Is that really the
933 # case?
935 AC_ARG_ENABLE(extension-integration,
936     AS_HELP_STRING([--disable-extension-integration],
937         [Disable integration of the built extensions in the installer of the
938          product. Use this switch to disable the integration.])
941 AC_ARG_ENABLE(export,
942     AS_HELP_STRING([--disable-export],
943         [Disable (some) code for document export. Useful when building viewer-only apps that lack
944          save/export functionality, to avoid having an excessive amount of code and data used
945          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
948 AC_ARG_ENABLE(avmedia,
949     AS_HELP_STRING([--disable-avmedia],
950         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
953 AC_ARG_ENABLE(database-connectivity,
954     AS_HELP_STRING([--disable-database-connectivity],
955         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
958 # This doesn't mean not building (or "integrating") extensions
959 # (although it probably should; i.e. it should imply
960 # --disable-extension-integration I guess), it means not supporting
961 # any extension mechanism at all
962 AC_ARG_ENABLE(extensions,
963     AS_HELP_STRING([--disable-extensions],
964         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
967 AC_ARG_ENABLE(scripting,
968     AS_HELP_STRING([--disable-scripting],
969         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
972 # This is mainly for Android and iOS, but could potentially be used in some
973 # special case otherwise, too, so factored out as a separate setting
975 AC_ARG_ENABLE(dynamic-loading,
976     AS_HELP_STRING([--disable-dynamic-loading],
977         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
980 AC_ARG_ENABLE(ext-mariadb-connector,
981     AS_HELP_STRING([--enable-ext-mariadb-connector],
982         [Enable the build of the MariaDB/MySQL Connector extension.])
985 AC_ARG_ENABLE(report-builder,
986     AS_HELP_STRING([--disable-report-builder],
987         [Disable the Report Builder.])
990 AC_ARG_ENABLE(ext-wiki-publisher,
991     AS_HELP_STRING([--enable-ext-wiki-publisher],
992         [Enable the Wiki Publisher extension.])
995 AC_ARG_ENABLE(lpsolve,
996     AS_HELP_STRING([--disable-lpsolve],
997         [Disable compilation of the lp solve solver ])
999 AC_ARG_ENABLE(coinmp,
1000     AS_HELP_STRING([--disable-coinmp],
1001         [Disable compilation of the CoinMP solver ])
1004 AC_ARG_ENABLE(pdfimport,
1005     AS_HELP_STRING([--disable-pdfimport],
1006         [Disable building the PDF import feature.])
1009 ###############################################################################
1011 dnl ---------- *** ----------
1013 AC_ARG_ENABLE([hardlink-deliver],
1014     AS_HELP_STRING([--enable-hardlink-deliver],
1015         [Put files into deliver folder as hardlinks instead of copying them
1016         over. Saves space and speeds up build.])
1019 AC_ARG_ENABLE(mergelibs,
1020     AS_HELP_STRING([--enable-mergelibs],
1021         [Enables linking of big, merged, library. Experimental feature, tested
1022         only for Linux at some stage in history, but possibly does not work even
1023         for Linux any more. This will link a core set of libraries into libmerged.])
1026 AC_ARG_ENABLE(graphite,
1027     AS_HELP_STRING([--disable-graphite],
1028         [Disables the compilation of Graphite smart font rendering.])
1031 AC_ARG_ENABLE(orcus,
1032     AS_HELP_STRING([--enable-orcus],
1033         [Enables orcus for extra file import filters for Calc.])
1036 AC_ARG_ENABLE(fetch-external,
1037     AS_HELP_STRING([--disable-fetch-external],
1038         [Disables fetching external tarballs from web sources.])
1041 AC_ARG_ENABLE(pch,
1042     AS_HELP_STRING([--enable-pch],
1043         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1046 AC_ARG_ENABLE(epm,
1047     AS_HELP_STRING([--enable-epm],
1048         [LibreOffice includes self-packaging code, that requires epm, however epm is
1049          useless for large scale package building.])
1052 AC_ARG_ENABLE(odk,
1053     AS_HELP_STRING([--disable-odk],
1054         [LibreOffice includes an ODK, office development kit which some packagers may
1055          wish to build without.])
1058 AC_ARG_ENABLE(mpl-subset,
1059     AS_HELP_STRING([--enable-mpl-subset],
1060         [Don't compile any pieces which are not MPL or more liberally licensed])
1063 AC_ARG_ENABLE(evolution2,
1064     AS_HELP_STRING([--enable-evolution2],
1065         [Allows the built-in evolution 2 addressbook connectivity build to be
1066          enabled.])
1069 AC_ARG_ENABLE(directx,
1070     AS_HELP_STRING([--disable-directx],
1071         [Remove DirectX implementation for the new XCanvas interface.
1072          The DirectX support requires more stuff installed on Windows to
1073          compile. (DirectX SDK, GDI+ libs)])
1076 AC_ARG_ENABLE(activex,
1077     AS_HELP_STRING([--disable-activex],
1078         [Disable the use of ActiveX for a Windows build.
1079         This switch is mandatory when using an Express edition of Visual Studio.])
1082 AC_ARG_ENABLE(atl,
1083     AS_HELP_STRING([--disable-atl],
1084         [Disable the use of ATL for a Windows build.])
1085     [
1086         This switch is mandatory when using an Express edition of Visual Studio.
1087     ],
1090 AC_ARG_ENABLE(avahi,
1091     AS_HELP_STRING([--enable-avahi],
1092         [Determines whether to use Avahi to advertise Impress to remote controls.]),
1095 AC_ARG_ENABLE(werror,
1096     AS_HELP_STRING([--enable-werror],
1097         [Turn warnings to errors. (Has no effect in modules where the treating
1098          of warnings as errors is disabled explicitly.)]),
1101 AC_ARG_ENABLE(assert-always-abort,
1102     AS_HELP_STRING([--enable-assert-always-abort],
1103         [make assert() abort even in release code.]),
1106 AC_ARG_ENABLE(dbgutil,
1107     AS_HELP_STRING([--enable-dbgutil],
1108         [Provide debugging support from --enable-debug and include additional debugging
1109          utilities such as object counting or more expensive checks.
1110          This is the recommended option for developers.
1111          Note that this makes the build ABI incompatible, it is not possible to mix object
1112          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1114 AC_ARG_ENABLE(debug,
1115     AS_HELP_STRING([--enable-debug],
1116         [Include debugging information, disable compiler optimization and inlining plus
1117          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1119 AC_ARG_ENABLE(sal-log,
1120     AS_HELP_STRING([--enable-sal-log],
1121         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1123 AC_ARG_ENABLE(selective-debuginfo,
1124     AS_HELP_STRING([--enable-selective-debuginfo],
1125         [If --enable-debug or --enable-dbgutil is used, build debugging information
1126          (-g compiler flag) only for the specified gbuild build targets
1127          (where all means everything, - prepended means not to enable, / appended means
1128          everything in the directory; there is no ordering, more specific overrides
1129          more general, and disabling takes precedence).
1130          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1132 AC_ARG_ENABLE(symbols,
1133     AS_HELP_STRING([--enable-symbols],
1134         [Include debugging symbols in output while preserve optimization.
1135          This enables -g compiler flag for GCC or equivalent,
1136          without changing anything else compared to productive code.]))
1138 AC_ARG_ENABLE(runtime-optimizations,
1139     AS_HELP_STRING([--disable-runtime-optimizations],
1140         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1141          JVM JIT) that are known to interact badly with certain dynamic analysis
1142          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1143          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1144          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1146 AC_ARG_ENABLE(compiler-plugins,
1147     AS_HELP_STRING([--enable-compiler-plugins],
1148         [Enable compiler plugins that will perform additional checks during
1149          building. Enabled automatically by --enable-dbgutil.]))
1151 AC_ARG_ENABLE(ooenv,
1152     AS_HELP_STRING([--disable-ooenv],
1153         [Disable ooenv for the instdir installation.]))
1155 AC_ARG_ENABLE(lto,
1156     AS_HELP_STRING([--enable-lto],
1157         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1158          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1159          linker. For MSVC, this option is broken at the moment. This is experimental work
1160          in progress that shouldn't be used unless you are working on it.)]))
1162 AC_ARG_ENABLE(crashdump,
1163     AS_HELP_STRING([--enable-crashdump],
1164         [Enable the crashdump feature.]))
1166 AC_ARG_ENABLE(python,
1167     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1168         [Enables or disables Python support at run-time and build-time.
1169          Also specifies what Python to use. 'auto' is the default.
1170          'fully-internal' even forces the internal version for uses of Python
1171          during the build.]))
1173 AC_ARG_ENABLE(gtk,
1174     AS_HELP_STRING([--disable-gtk],
1175         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1176 ,enable_gtk=yes)
1178 AC_ARG_ENABLE(gtk3,
1179     AS_HELP_STRING([--enable-gtk3],
1180         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1181          This is experimental and may not work.]),
1182 ,enable_gtk3=yes)
1184 AC_ARG_ENABLE(systray,
1185     AS_HELP_STRING([--disable-systray],
1186         [Determines whether to build the systray quickstarter.]),
1187 ,enable_systray=yes)
1189 AC_ARG_ENABLE(split-app-modules,
1190     AS_HELP_STRING([--enable-split-app-modules],
1191         [Split file lists for app modules, e.g. base, calc.
1192          Has effect only with make distro-pack-install]),
1195 AC_ARG_ENABLE(split-opt-features,
1196     AS_HELP_STRING([--enable-split-opt-features],
1197         [Split file lists for some optional features, .e.g. pyuno, testtool.
1198          Has effect only with make distro-pack-install]),
1201 AC_ARG_ENABLE(cairo-canvas,
1202 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
1203                           platforms where Cairo is available.
1206 AC_ARG_ENABLE(dbus,
1207     AS_HELP_STRING([--disable-dbus],
1208         [Determines whether to enable features that depend on dbus.
1209          e.g. Presentation mode screensaver control, bluetooth presentation control]),
1210 ,enable_dbus=yes)
1212 AC_ARG_ENABLE(packagekit,
1213     AS_HELP_STRING([--enable-packagekit],
1214         [Determines whether to enable features using packagekit.
1215          Right now that is auto font install]),
1218 AC_ARG_ENABLE(sdremote,
1219     AS_HELP_STRING([--disable-sdremote],
1220         [Determines whether to enable Impress remote control (i.e. the server component).]),
1221 ,enable_sdremote=yes)
1223 AC_ARG_ENABLE(sdremote-bluetooth,
1224     AS_HELP_STRING([--disable-sdremote-bluetooth],
1225         [Determines whether to build sdremote with bluetooth support.
1226          Requires dbus on Linux.]))
1228 AC_ARG_ENABLE(gio,
1229     AS_HELP_STRING([--disable-gio],
1230         [Determines whether to use the GIO support.]),
1231 ,enable_gio=yes)
1233 AC_ARG_ENABLE(telepathy,
1234     AS_HELP_STRING([--enable-telepathy],
1235         [Determines whether to enable Telepathy for collaboration.]),
1236 ,enable_telepathy=no)
1238 AC_ARG_ENABLE(tde,
1239     AS_HELP_STRING([--enable-tde],
1240         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1241          TDE are available.]),
1244 AC_ARG_ENABLE(tdeab,
1245     AS_HELP_STRING([--disable-tdeab],
1246         [Disable the TDE address book support.]),
1248     if test "$enable_tde" = "yes"; then
1249         enable_tdeab=yes
1250     fi
1253 AC_ARG_ENABLE(kde4,
1254     AS_HELP_STRING([--enable-kde4],
1255         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1256          KDE4 are available.]),
1259 AC_ARG_ENABLE(randr,
1260     AS_HELP_STRING([--disable-randr],
1261         [Disable RandR support in the vcl project.]),
1262 ,enable_randr=yes)
1264 AC_ARG_ENABLE(gstreamer-1-0,
1265     AS_HELP_STRING([--disable-gstreamer-1-0],
1266         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1267 ,enable_gstreamer_1_0=yes)
1269 AC_ARG_ENABLE(gstreamer-0-10,
1270     AS_HELP_STRING([--enable-gstreamer-0-10],
1271         [Enable building with the gstreamer 0.10 avmedia backend.]),
1272 ,enable_gstreamer_0_10=no)
1274 AC_ARG_ENABLE(vlc,
1275     AS_HELP_STRING([--enable-vlc],
1276         [Enable building with the (experimental) VLC avmedia backend.]),
1277 ,enable_vlc=no)
1279 AC_ARG_ENABLE(neon,
1280     AS_HELP_STRING([--disable-neon],
1281         [Disable neon and the compilation of webdav binding.]),
1284 AC_ARG_ENABLE([eot],
1285     [AS_HELP_STRING([--enable-eot],
1286         [Enable support for Embedded OpenType fonts.])],
1287 , [enable_eot=no])
1289 AC_ARG_ENABLE(cve-tests,
1290     AS_HELP_STRING([--disable-cve-tests],
1291         [Prevent CVE tests to be executed]),
1294 AC_ARG_ENABLE(chart-tests,
1295     AS_HELP_STRING([--enable-chart-tests],
1296         [Executes chart XShape tests. In a perfect world these tests would be
1297          stable and everyone could run them, in reality it is best to run them
1298          only on a few machines that are known to work and maintained by people
1299          who can judge if a test failure is a regression or not.]),
1302 AC_ARG_ENABLE(build-unowinreg,
1303     AS_HELP_STRING([--enable-build-unowinreg],
1304         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1305          compiler is needed on Linux.])
1306     [
1307                           Usage:     --enable-build-unowinreg
1308     ],
1311 AC_ARG_ENABLE(dependency-tracking,
1312     AS_HELP_STRING([--enable-dependency-tracking],
1313         [Do not reject slow dependency extractors.])[
1314   --disable-dependency-tracking
1315                           Disables generation of dependency information.
1316                           Speed up one-time builds.],
1319 AC_ARG_ENABLE(icecream,
1320     AS_HELP_STRING([--enable-icecream],
1321         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1322          It defaults to /opt/icecream for the location of the icecream gcc/g++
1323          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1326 AC_ARG_ENABLE(cups,
1327     AS_HELP_STRING([--disable-cups],
1328         [Do not build cups support.])
1331 AC_ARG_ENABLE(ccache,
1332     AS_HELP_STRING([--disable-ccache],
1333         [Do not try to use ccache automatically.
1334          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1335          CC/CXX are not yet set, and --enable-icecream is not given, we
1336          attempt to use ccache. --disable-ccache disables ccache completely.
1340 AC_ARG_ENABLE(64-bit,
1341     AS_HELP_STRING([--enable-64-bit],
1342         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1343          At the moment meaningful only for iOS and Windows. On Windows this option is
1344          experimental and possibly quite broken, and you should use it only if you are
1345          hacking on 64-bitness support.]), ,)
1347 AC_ARG_ENABLE(extra-gallery,
1348     AS_HELP_STRING([--enable-extra-gallery],
1349         [Add extra gallery content.]),
1352 AC_ARG_ENABLE(extra-template,
1353     AS_HELP_STRING([--enable-extra-template],
1354         [Add extra template content.]),
1357 AC_ARG_ENABLE(extra-sample,
1358     AS_HELP_STRING([--enable-extra-sample],
1359         [Add extra sample content.]),
1362 AC_ARG_ENABLE(extra-font,
1363     AS_HELP_STRING([--enable-extra-font],
1364         [Add extra font content.]),
1367 AC_ARG_ENABLE(online-update,
1368     AS_HELP_STRING([--enable-online-update],
1369         [Enable the online update service that will check for new versions of
1370          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1371          If the value is "mar", the experimental Mozilla-like update will be
1372          enabled instead of the traditional update mechanism.]),
1375 AC_ARG_ENABLE(extension-update,
1376     AS_HELP_STRING([--disable-extension-update],
1377         [Disable possibility to update installed extensions.]),
1380 AC_ARG_ENABLE(release-build,
1381     AS_HELP_STRING([--enable-release-build],
1382         [Enable release build.
1383          See http://wiki.documentfoundation.org/DevBuild]),
1386 AC_ARG_ENABLE(windows-build-signing,
1387     AS_HELP_STRING([--enable-windows-build-signing],
1388         [Enable signing of windows binaries (*.exe, *.dll)]),
1391 AC_ARG_ENABLE(silent-msi,
1392     AS_HELP_STRING([--enable-silent-msi],
1393         [Enable MSI with LIMITUI=1 (silent install).]),
1396 AC_ARG_ENABLE(macosx-code-signing,
1397     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1398         [Sign executables, dylibs, frameworks and the app bundle. If you
1399          don't provide an identity the first suitable certificate
1400          in your keychain is used.]),
1403 AC_ARG_ENABLE(macosx-package-signing,
1404     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1405         [Create a .pkg suitable for uploading to the Mac App Store and sign
1406          it. If you don't provide an identity the first suitable certificate
1407          in your keychain is used.]),
1410 AC_ARG_ENABLE(macosx-sandbox,
1411     AS_HELP_STRING([--enable-macosx-sandbox],
1412         [Make the app bundle run in a sandbox. Requires code signing.
1413          Is required by apps distributed in the Mac App Store, and implies
1414          adherence to App Store rules.]),
1417 AC_ARG_WITH(macosx-bundle-identifier,
1418     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1419         [Define the OS X bundle identifier. Default is the somewhat weird
1420          org.libreoffice.script ("script", huh?).]),
1421 ,with_macosx_bundle_identifier=org.libreoffice.script)
1423 AC_ARG_WITH(macosx-app-name,
1424     AS_HELP_STRING([--with-macosx-app-name='My Own Office Suite'],
1425         [Define the OS X app name. Default is AC_PACKAGE_NAME.]),
1426 ,with_macosx_app_name=$PRODUCTNAME)
1428 AC_ARG_ENABLE(ios-simulator,
1429     AS_HELP_STRING([--enable-ios-simulator],
1430         [Build for the iOS Simulator, not iOS device.]),
1433 AC_ARG_ENABLE(readonly-installset,
1434     AS_HELP_STRING([--enable-readonly-installset],
1435         [Prevents any attempts by LibreOffice to write into its installation. That means
1436          at least that no "system-wide" extensions can be added. Experimental work in
1437          progress.]),
1440 AC_ARG_ENABLE(postgresql-sdbc,
1441     AS_HELP_STRING([--disable-postgresql-sdbc],
1442         [Disable the build of the PostgreSQL-SDBC driver.])
1445 AC_ARG_ENABLE(lotuswordpro,
1446     AS_HELP_STRING([--disable-lotuswordpro],
1447         [Disable the build of the Lotus Word Pro filter.]),
1448 ,enable_lotuswordpro=yes)
1450 AC_ARG_ENABLE(firebird-sdbc,
1451     AS_HELP_STRING([--disable-firebird-sdbc],
1452         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1455 AC_ARG_ENABLE(winegcc,
1456     AS_HELP_STRING([--enable-winegcc],
1457         [Enable use of winegcc during the build, in order to create msi* tools
1458          needed for MinGW cross-compilation.]),
1461 AC_ARG_ENABLE(liblangtag,
1462     AS_HELP_STRING([--disable-liblangtag],
1463         [Disable use of liblangtag, and instead use an own simple
1464          implementation.]),
1467 AC_ARG_ENABLE(bogus-pkg-config,
1468     AS_HELP_STRING([--enable-bogus-pkg-config],
1469         [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.]),
1472 AC_ARG_ENABLE(openssl,
1473     AS_HELP_STRING([--disable-openssl],
1474         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1475          components will either use GNUTLS or NSS. Work in progress,
1476          use only if you are hacking on it.]),
1477 ,enable_openssl=yes)
1479 AC_ARG_WITH(prebuilt-openssl,
1480     AS_HELP_STRING([--with-prebuilt-openssl],
1481         [Don't build OpenSSL but use prebuilt binaries. Only for use on Windows, when you can't build it,
1482          thanks to the Cygwin fork() problem when running the Perl disaster in OpenSSL's build system.]))
1484 AC_ARG_ENABLE(library-bin-tar,
1485     AS_HELP_STRING([--enable-library-bin-tar],
1486         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1487         Some libraries can save their build result in a tarball
1488         stored in TARFILE_LOCATION. That binary tarball is
1489         uniquely identified by the source tarball,
1490         the content of the config_host.mk file and the content
1491         of the top-level directory in core for that library
1492         If this option is enabled, then if such a tarfile exist, it will be untarred
1493         instead of the source tarfile, and the build step will be skipped for that
1494         library.
1495         If a proper tarfile does not exist, then the normal source-based
1496         build is done for that library and a proper binary tarfile is created
1497         for the next time.]),
1500 AC_ARG_ENABLE(gltf,
1501     AS_HELP_STRING([--disable-gltf],
1502         [Determines whether to build libraries related to glTF 3D model rendering.]))
1504 AC_ARG_ENABLE(collada,
1505     AS_HELP_STRING([--disable-collada],
1506         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1508 AC_ARG_ENABLE(dconf,
1509     AS_HELP_STRING([--disable-dconf],
1510         [Disable the dconf configuration backend (enabled by default where
1511          available).]))
1513 dnl ===================================================================
1514 dnl Optional Packages (--with/without-)
1515 dnl ===================================================================
1517 AC_ARG_WITH(gnu-patch,
1518     AS_HELP_STRING([--with-gnu-patch],
1519         [Specify location of GNU patch on Solaris or FreeBSD.]),
1522 AC_ARG_WITH(build-platform-configure-options,
1523     AS_HELP_STRING([--with-build-platform-configure-options],
1524         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1527 AC_ARG_WITH(gnu-cp,
1528     AS_HELP_STRING([--with-gnu-cp],
1529         [Specify location of GNU cp on Solaris or FreeBSD.]),
1532 AC_ARG_WITH(external-tar,
1533     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1534         [Specify an absolute path of where to find (and store) tarfiles.]),
1535     TARFILE_LOCATION=$withval ,
1538 AC_ARG_WITH(referenced-git,
1539     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1540         [Specify another checkout directory to reference. This makes use of
1541                  git submodule update --reference, and saves a lot of diskspace
1542                  when having multiple trees side-by-side.]),
1543     GIT_REFERENCE_SRC=$withval ,
1546 AC_ARG_WITH(linked-git,
1547     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1548         [Specify a directory where the repositories of submodules are located.
1549          This uses a method similar to git-new-workdir to get submodules.]),
1550     GIT_LINK_SRC=$withval ,
1553 AC_ARG_WITH(galleries,
1554     AS_HELP_STRING([--with-galleries],
1555         [Specify how galleries should be built. It is possible either to
1556          build these internally from source ("build"),
1557          or to disable them ("no")]),
1560 AC_ARG_WITH(theme,
1561     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1562         [Choose which themes to include. By default those themes with an '*' are included.
1563          Possible choices: *breeze, crystal, *galaxy, *hicontrast, human, *oxygen, *sifr, *tango, *tango_testing.]),
1566 AC_ARG_WITH(helppack-integration,
1568   --without-helppack-integration      It will not integrate the helppacks to the installer
1569                           of the product.
1570                           Please use this switch to use the online help or separate help packages.],
1573 AC_ARG_WITH(fonts,
1574     AS_HELP_STRING([--without-fonts],
1575         [LibreOffice includes some third-party fonts to provide a reliable basis for
1576          help content, templates, samples, etc. When these fonts are already
1577          known to be available on the system then you should use this option.]),
1580 AC_ARG_WITH(epm,
1581     AS_HELP_STRING([--with-epm],
1582         [Decides which epm to use. Default is to use the one from the system if
1583          one is built. When either this is not there or you say =internal epm
1584          will be built.]),
1587 AC_ARG_WITH(package-format,
1588     AS_HELP_STRING([--with-package-format],
1589         [Specify package format(s) for LibreOffice installation sets. The
1590          implicit --without-package-format leads to no installation sets being
1591          generated. Possible values: aix, archive, bsd, deb, dmg,
1592          installed, msi, pkg, and rpm.
1593          Example: --with-package-format='deb rpm']),
1596 AC_ARG_WITH(tls,
1597     AS_HELP_STRING([--with-tls],
1598         [Decides which TLS/SSL and cryptographic implementations to use for
1599          LibreOffice's code. Notice that this doesn't apply for depending
1600          libraries like "neon", for example. Default is to use OpenSSL
1601          although NSS is also possible. Notice that selecting NSS restricts
1602          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1603          restrict by now the usage of NSS in LO's code. Possible values:
1604          openssl, nss. Example: --with-tls="nss"]),
1607 AC_ARG_WITH(system-libs,
1608     AS_HELP_STRING([--with-system-libs],
1609         [Use libraries already on system -- enables all --with-system-* flags.]),
1612 AC_ARG_WITH(system-bzip2,
1613     AS_HELP_STRING([--with-system-bzip2],
1614         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1615     [with_system_bzip2="$with_system_libs"])
1617 AC_ARG_WITH(system-headers,
1618     AS_HELP_STRING([--with-system-headers],
1619         [Use headers already on system -- enables all --with-system-* flags for
1620          external packages whose headers are the only entities used i.e.
1621          boost/odbc/sane-header(s).]),,
1622     [with_system_headers="$with_system_libs"])
1624 AC_ARG_WITH(system-jars,
1625     AS_HELP_STRING([--without-system-jars],
1626         [When building with --with-system-libs, also the needed jars are expected
1627          on the system. Use this to disable that]),,
1628     [with_system_jars="$with_system_libs"])
1630 AC_ARG_WITH(system-cairo,
1631     AS_HELP_STRING([--with-system-cairo],
1632         [Use cairo libraries already on system.  Happens automatically for
1633          (implicit) --enable-gtk and for --enable-gtk3.]))
1635 AC_ARG_WITH(myspell-dicts,
1636     AS_HELP_STRING([--with-myspell-dicts],
1637         [Adds myspell dictionaries to the LibreOffice installation set]),
1640 AC_ARG_WITH(system-dicts,
1641     AS_HELP_STRING([--without-system-dicts],
1642         [Do not use dictionaries from system paths.]),
1645 AC_ARG_WITH(external-dict-dir,
1646     AS_HELP_STRING([--with-external-dict-dir],
1647         [Specify external dictionary dir.]),
1650 AC_ARG_WITH(external-hyph-dir,
1651     AS_HELP_STRING([--with-external-hyph-dir],
1652         [Specify external hyphenation pattern dir.]),
1655 AC_ARG_WITH(external-thes-dir,
1656     AS_HELP_STRING([--with-external-thes-dir],
1657         [Specify external thesaurus dir.]),
1660 AC_ARG_WITH(system-zlib,
1661     AS_HELP_STRING([--with-system-zlib],
1662         [Use zlib already on system.]),,
1663     [with_system_zlib=auto])
1665 AC_ARG_WITH(system-jpeg,
1666     AS_HELP_STRING([--with-system-jpeg],
1667         [Use jpeg already on system.]),,
1668     [with_system_jpeg="$with_system_libs"])
1670 AC_ARG_WITH(system-libgltf,
1671     AS_HELP_STRING([--with-system-libgltf],
1672         [Use libgltf already on system.]),,
1673     [with_system_libgltf="$with_system_libs"])
1675 AC_ARG_WITH(system-clucene,
1676     AS_HELP_STRING([--with-system-clucene],
1677         [Use clucene already on system.]),,
1678     [with_system_clucene="$with_system_libs"])
1680 AC_ARG_WITH(system-expat,
1681     AS_HELP_STRING([--with-system-expat],
1682         [Use expat already on system.]),,
1683     [with_system_expat="$with_system_libs"])
1685 AC_ARG_WITH(system-libxml,
1686     AS_HELP_STRING([--with-system-libxml],
1687         [Use libxml/libxslt already on system.]),,
1688     [with_system_libxml=auto])
1690 AC_ARG_WITH(system-icu,
1691     AS_HELP_STRING([--with-system-icu],
1692         [Use icu already on system.]),,
1693     [with_system_icu="$with_system_libs"])
1695 AC_ARG_WITH(system-ucpp,
1696     AS_HELP_STRING([--with-system-ucpp],
1697         [Use ucpp already on system.]),,
1698     [])
1700 AC_ARG_WITH(system-opencollada,
1701     AS_HELP_STRING([--with-system-opencollada],
1702         [Use openCOLLADA already on system.]),,
1703     [with_system_opencollada=no])
1705 AC_ARG_WITH(system-collada2gltf,
1706     AS_HELP_STRING([--with-system-collada2gltf],
1707         [Use collada2gltf already on system.]),,
1708     [with_system_collada2gltf=no])
1710 AC_ARG_WITH(system-openldap,
1711     AS_HELP_STRING([--with-system-openldap],
1712         [Use the OpenLDAP LDAP SDK already on system.]),,
1713     [with_system_openldap="$with_system_libs"])
1715 AC_ARG_WITH(system-poppler,
1716     AS_HELP_STRING([--with-system-poppler],
1717         [Use system poppler (only needed for PDF import).]),,
1718     [with_system_poppler="$with_system_libs"])
1720 AC_ARG_WITH(system-apache-commons,
1721     AS_HELP_STRING([--with-system-apache-commons],
1722         [Use Apache commons libraries already on system.]),,
1723     [with_system_apache_commons="$with_system_jars"])
1725 AC_ARG_WITH(system-mariadb,
1726     AS_HELP_STRING([--with-system-mariadb],
1727         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1728          extension.]),,
1729     [with_system_mariadb="$with_system_libs"])
1731 AC_ARG_ENABLE(bundle-mariadb,
1732     AS_HELP_STRING([--enable-bundle-mariadb],
1733         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1736 AC_ARG_WITH(system-mysql-cppconn,
1737     AS_HELP_STRING([--with-system-mysql-cppconn],
1738         [Use MySQL C++ Connector libraries already on system.]),,
1739     [with_system_mysql_cppconn="$with_system_libs"])
1741 AC_ARG_WITH(system-postgresql,
1742     AS_HELP_STRING([--with-system-postgresql],
1743         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1744          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1745     [with_system_postgresql="$with_system_libs"])
1747 AC_ARG_WITH(libpq-path,
1748     AS_HELP_STRING([--with-libpq-path],
1749         [Use this PostgreSQL C interface (libpq) installation for building
1750          the PostgreSQL-SDBC extension.])
1751     [
1752                           Usage:     --with-libpq-path=<absolute path to
1753                                                   your libpq installation>
1754     ],
1757 AC_ARG_WITH(system-firebird,
1758     AS_HELP_STRING([--with-system-firebird],
1759         [Use Firebird libraries already on system, for building the Firebird-SDBC
1760          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1761     [with_system_firebird="$with_system_libs"])
1763 AC_ARG_WITH(system-hsqldb,
1764     AS_HELP_STRING([--with-system-hsqldb],
1765         [Use hsqldb already on system.]))
1767 AC_ARG_WITH(hsqldb-jar,
1768     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1769         [Specify path to jarfile manually.]),
1770     HSQLDB_JAR=$withval)
1772 AC_ARG_ENABLE(scripting-beanshell,
1773     AS_HELP_STRING([--disable-scripting-beanshell],
1774         [Disable support for scripts in BeanShell.]),
1778 AC_ARG_WITH(system-beanshell,
1779     AS_HELP_STRING([--with-system-beanshell],
1780         [Use beanshell already on system.]),,
1781     [with_system_beanshell="$with_system_jars"])
1783 AC_ARG_WITH(beanshell-jar,
1784     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1785         [Specify path to jarfile manually.]),
1786     BSH_JAR=$withval)
1788 AC_ARG_ENABLE(scripting-javascript,
1789     AS_HELP_STRING([--disable-scripting-javascript],
1790         [Disable support for scripts in JavaScript.]),
1794 AC_ARG_WITH(system-rhino,
1795     AS_HELP_STRING([--with-system-rhino],
1796         [Use rhino already on system.]),,)
1797 #    [with_system_rhino="$with_system_jars"])
1798 # Above is not used as we have different debug interface
1799 # patched into internal rhino. This code needs to be fixed
1800 # before we can enable it by default.
1802 AC_ARG_WITH(rhino-jar,
1803     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1804         [Specify path to jarfile manually.]),
1805     RHINO_JAR=$withval)
1807 AC_ARG_WITH(commons-codec-jar,
1808     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1809         [Specify path to jarfile manually.]),
1810     COMMONS_CODEC_JAR=$withval)
1812 AC_ARG_WITH(commons-lang-jar,
1813     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1814         [Specify path to jarfile manually.]),
1815     COMMONS_LANG_JAR=$withval)
1817 AC_ARG_WITH(commons-httpclient-jar,
1818     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1819         [Specify path to jarfile manually.]),
1820     COMMONS_HTTPCLIENT_JAR=$withval)
1822 AC_ARG_WITH(commons-logging-jar,
1823     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1824         [Specify path to jarfile manually.]),
1825     COMMONS_LOGGING_JAR=$withval)
1827 AC_ARG_WITH(system-jfreereport,
1828     AS_HELP_STRING([--with-system-jfreereport],
1829         [Use JFreeReport already on system.]),,
1830     [with_system_jfreereport="$with_system_jars"])
1832 AC_ARG_WITH(sac-jar,
1833     AS_HELP_STRING([--with-sac-jar=JARFILE],
1834         [Specify path to jarfile manually.]),
1835     SAC_JAR=$withval)
1837 AC_ARG_WITH(libxml-jar,
1838     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1839         [Specify path to jarfile manually.]),
1840     LIBXML_JAR=$withval)
1842 AC_ARG_WITH(flute-jar,
1843     AS_HELP_STRING([--with-flute-jar=JARFILE],
1844         [Specify path to jarfile manually.]),
1845     FLUTE_JAR=$withval)
1847 AC_ARG_WITH(jfreereport-jar,
1848     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     JFREEREPORT_JAR=$withval)
1852 AC_ARG_WITH(liblayout-jar,
1853     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     LIBLAYOUT_JAR=$withval)
1857 AC_ARG_WITH(libloader-jar,
1858     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     LIBLOADER_JAR=$withval)
1862 AC_ARG_WITH(libloader-jar,
1863     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     LIBLOADER_JAR=$withval)
1867 AC_ARG_WITH(libformula-jar,
1868     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     LIBFORMULA_JAR=$withval)
1872 AC_ARG_WITH(librepository-jar,
1873     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     LIBREPOSITORY_JAR=$withval)
1877 AC_ARG_WITH(libfonts-jar,
1878     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1879         [Specify path to jarfile manually.]),
1880     LIBFONTS_JAR=$withval)
1882 AC_ARG_WITH(libserializer-jar,
1883     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1884         [Specify path to jarfile manually.]),
1885     LIBSERIALIZER_JAR=$withval)
1887 AC_ARG_WITH(libbase-jar,
1888     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1889         [Specify path to jarfile manually.]),
1890     LIBBASE_JAR=$withval)
1892 AC_ARG_WITH(system-odbc,
1893     AS_HELP_STRING([--with-system-odbc],
1894         [Use the odbc headers already on system.]),,
1895     [with_system_odbc="auto"])
1897 AC_ARG_WITH(system-sane,
1898     AS_HELP_STRING([--with-system-sane],
1899         [Use sane.h already on system.]),,
1900     [with_system_sane="$with_system_headers"])
1902 AC_ARG_WITH(system-bluez,
1903     AS_HELP_STRING([--with-system-bluez],
1904         [Use bluetooth.h already on system.]),,
1905     [with_system_bluez="$with_system_headers"])
1907 AC_ARG_WITH(system-curl,
1908     AS_HELP_STRING([--with-system-curl],
1909         [Use curl already on system.]),,
1910     [with_system_curl=auto])
1912 AC_ARG_WITH(system-boost,
1913     AS_HELP_STRING([--with-system-boost],
1914         [Use boost already on system.]),,
1915     [with_system_boost="$with_system_headers"])
1917 AC_ARG_WITH(system-glm,
1918     AS_HELP_STRING([--with-system-glm],
1919         [Use glm already on system.]),,
1920     [with_system_glm="$with_system_headers"])
1922 AC_ARG_WITH(system-hunspell,
1923     AS_HELP_STRING([--with-system-hunspell],
1924         [Use libhunspell already on system.]),,
1925     [with_system_hunspell="$with_system_libs"])
1927 AC_ARG_WITH(system-mythes,
1928     AS_HELP_STRING([--with-system-mythes],
1929         [Use mythes already on system.]),,
1930     [with_system_mythes="$with_system_libs"])
1932 AC_ARG_WITH(system-altlinuxhyph,
1933     AS_HELP_STRING([--with-system-altlinuxhyph],
1934         [Use ALTLinuxhyph already on system.]),,
1935     [with_system_altlinuxhyph="$with_system_libs"])
1937 AC_ARG_WITH(system-lpsolve,
1938     AS_HELP_STRING([--with-system-lpsolve],
1939         [Use lpsolve already on system.]),,
1940     [with_system_lpsolve="$with_system_libs"])
1942 AC_ARG_WITH(system-coinmp,
1943     AS_HELP_STRING([--with-system-coinmp],
1944         [Use CoinMP already on system.]),,
1945     [with_system_coinmp="$with_system_libs"])
1947 AC_ARG_WITH(system-liblangtag,
1948     AS_HELP_STRING([--with-system-liblangtag],
1949         [Use liblangtag library already on system.]),,
1950     [with_system_liblangtag="$with_system_libs"])
1952 AC_ARG_WITH(jpeg-turbo,
1953     AS_HELP_STRING([--with-jpeg-turbo],
1954         [Use internal libjpeg-turbo library.]),,
1955     [with_jpeg_turbo=auto])
1957 AC_ARG_WITH(webdav,
1958     AS_HELP_STRING([--with-webdav],
1959         [Specify which library to use for webdav implementation.
1960          Possible values: "neon", "serf", "no". The default value is "neon".
1961          Example: --with-webdav="serf"]),
1962     WITH_WEBDAV=$withval,
1963     WITH_WEBDAV="neon")
1965 AC_ARG_WITH(linker-hash-style,
1966     AS_HELP_STRING([--with-linker-hash-style],
1967         [Use linker with --hash-style=<style> when linking shared objects.
1968          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1969          if supported on the build system, and "sysv" otherwise.]))
1971 AC_ARG_WITH(jdk-home,
1972     AS_HELP_STRING([--with-jdk-home],
1973         [If you have installed JDK 1.3 or later on your system please supply the
1974          path here. Note that this is not the location of the java command but the
1975          location of the entire distribution.])
1976     [
1977                           Usage:     --with-jdk-home=<absolute path to JDK home>
1978     ],
1981 AC_ARG_WITH(help,
1982     AS_HELP_STRING([--with-help],
1983         [Enable the build of help. There is a special parameter "common" that
1984          can be used to bundle only the common part, .e.g help-specific icons.
1985          This is useful when you build the helpcontent separately.])
1986     [
1987                           Usage:     --with-help    build the entire local help
1988                                  --without-help     no local help (default)
1989                                  --with-help=common bundle common files for the local
1990                                                     help but do not build the whole help
1991     ],
1994 AC_ARG_WITH(java,
1995     AS_HELP_STRING([--with-java],
1996         [Specify the name of the Java interpreter command. Typically "java"
1997          which is the default.
1999          To build without support for Java components, applets, accessibility
2000          or the XML filters written in Java, use --without-java or --with-java=no.])
2001     [
2002                           Usage:     --with-java==<java command>
2003                                      --without-java
2004     ],
2005     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2006     [ with_java=java ]
2009 AC_ARG_WITH(jvm-path,
2010     AS_HELP_STRING([--with-jvm-path],
2011         [Use a specific JVM search path at runtime.])
2012     [
2013                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
2015                           e. g.: --with-jvm-path=/usr/lib/
2016                                  to find JRE/JDK in /usr/lib/jvm/
2017     ],
2020 AC_ARG_WITH(ant-home,
2021     AS_HELP_STRING([--with-ant-home],
2022         [If you have installed Jakarta Ant on your system, please supply the path here.
2023          Note that this is not the location of the Ant binary but the location
2024          of the entire distribution.])
2025     [
2026                           Usage:     --with-ant-home=<absolute path to Ant home>
2027     ],
2030 AC_ARG_WITH(export-validation,
2031     AS_HELP_STRING([--with-export-validation],
2032         [If you want the exported files to be validated. Right now limited to OOXML files in calc export tests.
2033          Note: You need an executable script officeotron that takes the path to the file.])
2034     [
2035                             Usage: --with-export-validation
2036     ],
2039 AC_ARG_WITH(junit,
2040     AS_HELP_STRING([--with-junit],
2041         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2042          --without-junit disables those tests. Not relevant in the --without-java case.])
2043     [
2044                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
2045     ],
2046 ,with_junit=yes)
2048 AC_ARG_WITH(hamcrest,
2049     AS_HELP_STRING([--with-hamcrest],
2050         [Specifies the hamcrest jar file to use for JUnit-based tests.
2051          --without-junit disables those tests. Not relevant in the --without-java case.])
2052     [
2053                           Usage:     --with-hamcrest=<absolute path to hamcrest jar>
2054     ],
2055 ,with_hamcrest=yes)
2057 AC_ARG_WITH(perl-home,
2058     AS_HELP_STRING([--with-perl-home],
2059         [If you have installed Perl 5 Distribution, on your system, please
2060          supply the path here. Note that this is not the location of the Perl
2061          binary but the location of the entire distribution.])
2062     [
2063                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
2064     ],
2067 AC_ARG_WITH(
2068     [doxygen],
2069     AS_HELP_STRING(
2070         [--with-doxygen],
2071         [Specifies the doxygen executable to use when generating ODK C/C++
2072          documentation. --without-doxygen disables generation of ODK C/C++
2073          documentation. Not relevant in the --disable-odk case.])
2074     [
2075                           Usage:     --with-doxygen=<absolute path to doxygen executable>
2076     ],,
2077     [with_doxygen=yes])
2079 AC_ARG_WITH(visual-studio,
2080     AS_HELP_STRING([--with-visual-studio=<2013/2015>],
2081         [Specify which Visual Studio version to use in case several are
2082          installed. If not specified, only 2013 is detected automatically
2083          because 2015 support is currently experimental.])
2084     [
2085                           Usage:     --with-visual-studio=<2013/2015>
2086     ],
2089 AC_ARG_WITH(windows-sdk,
2090     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2091         [Specify which Windows SDK, or "Windows Kit", version to use
2092          in case the one that came with the selected Visual Studio
2093          is not what you want for some reason. Note that not all compiler/SDK
2094          combinations are supported. The intent is that this option should not
2095          be needed.])
2096     [
2097                           Usage:     --with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>
2098     ],
2101 AC_ARG_WITH(lang,
2102     AS_HELP_STRING([--with-lang],
2103         [Use this option to build LibreOffice with additional UI language support.
2104          English (US) is always included by default.
2105          Separate multiple languages with space.
2106          For all languages, use --with-lang=ALL.])
2107     [
2108                           Usage:     --with-lang="es sw tu cs sk"
2109     ],
2112 AC_ARG_WITH(locales,
2113     AS_HELP_STRING([--with-locales],
2114         [Use this option to limit the locale information built in.
2115          Separate multiple locales with space.
2116          Very experimental and might well break stuff.
2117          Just a desperate measure to shrink code and data size.
2118          By default all the locales available is included.
2119          This option is completely unrelated to --with-lang.])
2120     [
2121                           Affects also our character encoding conversion
2122                           tables for encodings mainly targeted for a
2123                           particular locale, like EUC-CN and EUC-TW for
2124                           zh, ISO-2022-JP for ja.
2126                           Affects also our add-on break iterator data for
2127                           some languages.
2129                           For the default, all locales, don't use this switch at all.
2130                           Specifying just the language part of a locale means all matching
2131                           locales will be included.
2133                           Usage:     --with-locales="en es pt fr zh kr ja"
2134     ],
2137 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2138 AC_ARG_WITH(krb5,
2139     AS_HELP_STRING([--with-krb5],
2140         [Enable MIT Kerberos 5 support in modules that support it.
2141          By default automatically enabled on platforms
2142          where a good system Kerberos 5 is available.]),
2145 AC_ARG_WITH(gssapi,
2146     AS_HELP_STRING([--with-gssapi],
2147         [Enable GSSAPI support in modules that support it.
2148          By default automatically enabled on platforms
2149          where a good system GSSAPI is available.]),
2152 AC_ARG_WITH(iwyu,
2153     AS_HELP_STRING([--with-iwyu],
2154         [Use given IWYU binary path to check unneeded includes instead of building.
2155          Use only if you are hacking on it.]),
2158 dnl ===================================================================
2159 dnl Branding
2160 dnl ===================================================================
2162 AC_ARG_WITH(branding,
2163     AS_HELP_STRING([--with-branding],
2164         [Use given path to retrieve branding images set.])
2165     [
2166                           Search for intro.png about.svg and flat_logo.svg.
2167                           If any is missing, default ones will be used instead.
2169                           Search also progress.conf for progress
2170                           settings on intro screen :
2172                           PROGRESSBARCOLOR="255,255,255" Set color of
2173                           progress bar. Comma separated RGB decimal values.
2174                           PROGRESSSIZE="407,6" Set size of progress bar.
2175                           Comma separated decimal values (width, height).
2176                           PROGRESSPOSITION="61,317" Set position of progress
2177                           bar from left,top. Comma separated decimal values.
2178                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2179                           bar frame. Comma separated RGB decimal values.
2180                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2181                           bar text. Comma separated RGB decimal values.
2182                           PROGRESSTEXTBASELINE="287" Set vertical position of
2183                           progress bar text from top. Decimal value.
2185                           Default values will be used if not found.
2187                           Usage:     --with-branding=/path/to/images
2188     ],
2192 AC_ARG_WITH(extra-buildid,
2193     AS_HELP_STRING([--with-extra-buildid],
2194         [Show addition build identification in about dialog.])
2195     [
2196                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
2197     ],
2201 AC_ARG_WITH(vendor,
2202     AS_HELP_STRING([--with-vendor],
2203         [Set vendor of the build.])
2204     [
2205                           Usage:     --with-vendor="John the Builder"
2206     ],
2209 AC_ARG_WITH(android-package-name,
2210     AS_HELP_STRING([--with-android-package-name],
2211         [Set Android package name of the build.])
2212     [
2213                           Usage:     --with-android-package-name="org.libreoffice"
2214     ],
2217 AC_ARG_WITH(compat-oowrappers,
2218     AS_HELP_STRING([--with-compat-oowrappers],
2219         [Install oo* wrappers in parallel with
2220          lo* ones to keep backward compatibility.
2221          Has effect only with make distro-pack-install]),
2224 AC_ARG_WITH(os-version,
2225     AS_HELP_STRING([--with-os-version],
2226         [For FreeBSD users, use this option option to override the detected OSVERSION.])
2227     [
2228                           Usage:     --with-os-version=<OSVERSION>
2229     ],
2232 AC_ARG_WITH(mingw-cross-compiler,
2233     AS_HELP_STRING([--with-mingw-cross-compiler],
2234         [Specify the MinGW cross-compiler to use.])
2235     [
2236                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2238                           When building on the ODK on Unix and building unowinreg.dll,
2239                           specify the MinGW C++ cross-compiler.
2240     ],
2243 AC_ARG_WITH(idlc-cpp,
2244     AS_HELP_STRING([--with-idlc-cpp],
2245         [Specify the C Preprocessor to use for idlc.])
2246     [
2247                           Usage:     --with-idlc-cpp=cpp
2249                           Default is ucpp.
2250     ]
2253 AC_ARG_WITH(build-version,
2254     AS_HELP_STRING([--with-build-version],
2255         [Allows the builder to add a custom version tag that will appear in the
2256          Help/About box for QA purposes.])
2257     [
2258                           Usage:     --with-build-version="Built by Jim"
2259     ],
2260     with_build_version=$withval ,
2263 AC_ARG_WITH(alloc,
2264     AS_HELP_STRING([--with-alloc],
2265         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2266          Note that on FreeBSD/NetBSD system==jemalloc]),
2269 AC_ARG_WITH(sun-templates,
2270     AS_HELP_STRING([--with-sun-templates],
2271         [Integrate Sun template packages.]),
2274 AC_ARG_WITH(parallelism,
2275     AS_HELP_STRING([--with-parallelism],
2276         [Number of jobs to run simultaneously during build. Parallel builds can
2277         save a lot of time on multi-cpu machines. Defaults to the number of
2278         CPUs on the machine, unless you configure --enable-icecream - then to
2279         10.]),
2282 AC_ARG_WITH(all-tarballs,
2283     AS_HELP_STRING([--with-all-tarballs],
2284         [Download all external tarballs unconditionally]))
2286 AC_ARG_WITH(gdrive-client-id,
2287     AS_HELP_STRING([--with-gdrive-client-id],
2288         [Provides the client id of the application for OAuth2 authentication
2289         on Google Drive. If either this or --with-gdrive-client-secret is
2290         empty, the feature will be disabled]),
2293 AC_ARG_WITH(gdrive-client-secret,
2294     AS_HELP_STRING([--with-gdrive-client-secret],
2295         [Provides the client secret of the application for OAuth2
2296         authentication on Google Drive. If either this or
2297         --with-gdrive-client-id is empty, the feature will be disabled]),
2300 AC_ARG_WITH(alfresco-cloud-client-id,
2301     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2302         [Provides the client id of the application for OAuth2 authentication
2303         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2304         empty, the feature will be disabled]),
2307 AC_ARG_WITH(alfresco-cloud-client-secret,
2308     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2309         [Provides the client secret of the application for OAuth2
2310         authentication on Alfresco Cloud. If either this or
2311         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2314 AC_ARG_WITH(onedrive-client-id,
2315     AS_HELP_STRING([--with-onedrive-client-id],
2316         [Provides the client id of the application for OAuth2 authentication
2317         on OneDrive. If either this or --with-onedrive-client-secret is
2318         empty, the feature will be disabled]),
2321 AC_ARG_WITH(onedrive-client-secret,
2322     AS_HELP_STRING([--with-onedrive-client-secret],
2323         [Provides the client secret of the application for OAuth2
2324         authentication on OneDrive. If either this or
2325         --with-onedrive-client-id is empty, the feature will be disabled]),
2327 dnl ===================================================================
2328 dnl Do we want to use pre-build binary tarball for recompile
2329 dnl ===================================================================
2331 if test "$enable_library_bin_tar" = "yes" ; then
2332     USE_LIBRARY_BIN_TAR=TRUE
2333 else
2334     USE_LIBRARY_BIN_TAR=
2336 AC_SUBST(USE_LIBRARY_BIN_TAR)
2338 dnl ===================================================================
2339 dnl Test whether build target is Release Build
2340 dnl ===================================================================
2341 AC_MSG_CHECKING([whether build target is Release Build])
2342 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2343     AC_MSG_RESULT([no])
2344     ENABLE_RELEASE_BUILD=
2345 else
2346     AC_MSG_RESULT([yes])
2347     ENABLE_RELEASE_BUILD=TRUE
2349 AC_SUBST(ENABLE_RELEASE_BUILD)
2351 dnl ===================================================================
2352 dnl Test whether to sign Windows Build
2353 dnl ===================================================================
2354 AC_MSG_CHECKING([whether to sign windows build])
2355 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2356     AC_MSG_RESULT([yes])
2357     WINDOWS_BUILD_SIGNING="TRUE"
2358 else
2359     AC_MSG_RESULT([no])
2360     WINDOWS_BUILD_SIGNING="FALSE"
2362 AC_SUBST(WINDOWS_BUILD_SIGNING)
2364 dnl ===================================================================
2365 dnl MacOSX build and runtime environment options
2366 dnl ===================================================================
2368 AC_ARG_WITH(macosx-sdk,
2369     AS_HELP_STRING([--with-macosx-sdk],
2370         [Use a specific SDK for building.])
2371     [
2372                           Usage:     --with-macosx-sdk=<version>
2374                           e. g.: --with-macosx-sdk=10.8
2376                           there are 3 options to control the MacOSX build:
2377                           --with-macosx-sdk (referred as 'sdk' below)
2378                           --with-macosx-version-min-required (referred as 'min' below)
2379                           --with-macosx-version-max-allowed (referred as 'max' below)
2381                           the connection between these value and the default they take is as follow:
2382                           ( ? means not specified on the command line, s means the SDK version found,
2383                           constraint: 8 <= x <= y <= z)
2385                           ==========================================
2386                            command line      || config result
2387                           ==========================================
2388                           min  | max  | sdk  || min  | max  | sdk  |
2389                           ?    | ?    | ?    || 10.8 | 10.s | 10.s |
2390                           ?    | ?    | 10.x || 10.8 | 10.x | 10.x |
2391                           ?    | 10.x | ?    || 10.8 | 10.s | 10.s |
2392                           ?    | 10.x | 10.y || 10.8 | 10.x | 10.y |
2393                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2394                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2395                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2396                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2399                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2400                           for a detailed technical explanation of these variables
2402                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2403     ],
2406 AC_ARG_WITH(macosx-version-min-required,
2407     AS_HELP_STRING([--with-macosx-version-min-required],
2408         [set the minimum OS version needed to run the built LibreOffice])
2409     [
2410                           Usage:     --with-macosx-version-min-required=<version>
2412                           e. g.: --with-macos-version-min-required=10.8
2413                           see --with-macosx-sdk for more info
2414     ],
2417 AC_ARG_WITH(macosx-version-max-allowed,
2418     AS_HELP_STRING([--with-macosx-version-max-allowed],
2419         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2420     [
2421                           Usage:     --with-macosx-version-max-allowed=<version>
2423                           e. g.: --with-macos-version-max-allowed=10.8
2424                           see --with-macosx-sdk for more info
2425     ],
2429 dnl ===================================================================
2430 dnl options for stuff used during cross-compilation build
2431 dnl Not quite superseded by --with-build-platform-configure-options.
2432 dnl TODO: check, if the "force" option is still needed anywhere.
2433 dnl ===================================================================
2435 AC_ARG_WITH(system-icu-for-build,
2436     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2437         [Use icu already on system for build tools (cross-compilation only).]))
2440 dnl ===================================================================
2441 dnl check for required programs (grep, awk, sed, bash)
2442 dnl ===================================================================
2444 pathmunge ()
2446     if test -n "$1"; then
2447         if test "$build_os" = "cygwin"; then
2448             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2449                 PathFormat "$1"
2450                 new_path=`cygpath -sm "$formatted_path"`
2451             else
2452                 PathFormat "$1"
2453                 new_path=`cygpath -u "$formatted_path"`
2454             fi
2455         else
2456             new_path="$1"
2457         fi
2458         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2459             if test "$2" = "after"; then
2460                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2461             else
2462                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2463             fi
2464         fi
2465         unset new_path
2466     fi
2469 AC_PROG_AWK
2470 AC_PATH_PROG( AWK, $AWK)
2471 if test -z "$AWK"; then
2472     AC_MSG_ERROR([install awk to run this script])
2475 AC_PATH_PROG(BASH, bash)
2476 if test -z "$BASH"; then
2477     AC_MSG_ERROR([bash not found in \$PATH])
2479 AC_SUBST(BASH)
2481 AC_MSG_CHECKING([for GNU or BSD tar])
2482 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2483     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2484     if test $? -eq 0;  then
2485         GNUTAR=$a
2486         break
2487     fi
2488 done
2489 AC_MSG_RESULT($GNUTAR)
2490 if test -z "$GNUTAR"; then
2491     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2493 AC_SUBST(GNUTAR)
2495 AC_MSG_CHECKING([for tar's option to strip components])
2496 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2497 if test $? -eq 0; then
2498     STRIP_COMPONENTS="--strip-components"
2499 else
2500     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2501     if test $? -eq 0; then
2502         STRIP_COMPONENTS="--strip-path"
2503     else
2504         STRIP_COMPONENTS="unsupported"
2505     fi
2507 AC_MSG_RESULT($STRIP_COMPONENTS)
2508 if test x$STRIP_COMPONENTS = xunsupported; then
2509     AC_MSG_ERROR([you need a tar that is able to strip components.])
2511 AC_SUBST(STRIP_COMPONENTS)
2513 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2514 dnl desktop OSes from "mobile" ones.
2516 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2517 dnl In other words, that when building for an OS that is not a
2518 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2520 dnl Note the direction of the implication; there is no assumption that
2521 dnl cross-compiling would imply a non-desktop OS.
2523 if test $_os != iOS -a $_os != Android; then
2524     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2525     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2526     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2529 DISABLE_EXPORT=''
2530 if test "$enable_export" != no; then
2531     BUILD_TYPE="$BUILD_TYPE EXPORT"
2532 else
2533     DISABLE_EXPORT='TRUE'
2534     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2536 AC_SUBST(DISABLE_EXPORT)
2538 # Whether to build "avmedia" functionality or not.
2540 if test -z "$enable_avmedia"; then
2541     enable_avmedia=yes
2544 if test "$enable_avmedia" = yes; then
2545     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2546     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2547 else
2548     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2551 # Decide whether to build database connectivity stuff (including
2552 # Base) or not. We probably don't want to on non-desktop OSes.
2554 if test -z "$enable_database_connectivity"; then
2555     # --disable-database-connectivity is unfinished work in progress
2556     # and the iOS test app doesn't link if we actually try to use it.
2557     # if test $_os != iOS -a $_os != Android; then
2558         enable_database_connectivity=yes
2559     # fi
2562 if test "$enable_database_connectivity" = yes; then
2563     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2564     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2567 if test -z "$enable_extensions"; then
2568     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2569     if test $_os != iOS -a $_os != Android; then
2570         enable_extensions=yes
2571     fi
2574 if test "$enable_extensions" = yes; then
2575     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2576     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2579 if test -z "$enable_scripting"; then
2580     # Disable scripting for iOS unless specifically overridden
2581     # with --enable-scripting.
2582     if test $_os != iOS; then
2583         enable_scripting=yes
2584     fi
2587 DISABLE_SCRIPTING=''
2588 if test "$enable_scripting" = yes; then
2589     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2590     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2591 else
2592     DISABLE_SCRIPTING='TRUE'
2593     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2596 if test $_os = iOS -o $_os = Android; then
2597     # Disable dynamic_loading always for iOS and Android
2598     enable_dynamic_loading=no
2599 elif test -z "$enable_dynamic_loading"; then
2600     # Otherwise enable it unless speficically disabled
2601     enable_dynamic_loading=yes
2604 DISABLE_DYNLOADING=''
2605 if test "$enable_dynamic_loading" = yes; then
2606     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2607 else
2608     DISABLE_DYNLOADING='TRUE'
2609     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2611 AC_SUBST(DISABLE_DYNLOADING)
2613 # remenber SYSBASE value
2614 AC_SUBST(SYSBASE)
2616 dnl ===================================================================
2617 dnl  Sort out various gallery compilation options
2618 dnl ===================================================================
2619 AC_MSG_CHECKING([how to build and package galleries])
2620 if test -n "${with_galleries}"; then
2621     if test "$with_galleries" = "build"; then
2622         WITH_GALLERY_BUILD=TRUE
2623         AC_MSG_RESULT([build from source images internally])
2624     elif test "$with_galleries" = "no"; then
2625         WITH_GALLERY_BUILD=
2626         AC_MSG_RESULT([disable non-internal gallery build])
2627     else
2628         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2629     fi
2630 else
2631     if test $_os != iOS -a $_os != Android; then
2632         WITH_GALLERY_BUILD=TRUE
2633         AC_MSG_RESULT([internal src images for desktop])
2634     else
2635         WITH_GALLERY_BUILD=
2636         AC_MSG_RESULT([disable src imgage build])
2637     fi
2639 AC_SUBST(WITH_GALLERY_BUILD)
2641 dnl ===================================================================
2642 dnl  Checks if ccache is available
2643 dnl ===================================================================
2644 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
2645     # on windows/VC build do not use ccache
2646     CCACHE=""
2647 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2648     case "%$CC%$CXX%" in
2649     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2650     # assume that's good then
2651     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2652         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2653         ;;
2654     *)
2655         AC_PATH_PROG([CCACHE],[ccache],[not found])
2656         if test "$CCACHE" = "not found"; then
2657             CCACHE=""
2658         else
2659             # Need to check for ccache version: otherwise prevents
2660             # caching of the results (like "-x objective-c++" for Mac)
2661             if test $_os = Darwin -o $_os = iOS; then
2662                 # Check ccache version
2663                 AC_MSG_CHECKING([whether version of ccache is suitable])
2664                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2665                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2666                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2667                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2668                 else
2669                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2670                     CCACHE=""
2671                 fi
2672             fi
2673         fi
2674         ;;
2675     esac
2676 else
2677     CCACHE=""
2680 if test "$CCACHE" != ""; then
2681     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2682     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2683     if test "$ccache_size" = ""; then
2684         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2685         if test "$ccache_size" = ""; then
2686             ccache_size=0
2687         fi
2688         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2689         if test $ccache_size -lt 1024; then
2690             CCACHE=""
2691             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2692             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2693         else
2694             # warn that ccache may be too small for debug build
2695             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2696             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2697         fi
2698     else
2699         if test $ccache_size -lt 5; then
2700             #warn that ccache may be too small for debug build
2701             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2702             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2703         fi
2704     fi
2707 dnl ===================================================================
2708 dnl  Checks for C compiler,
2709 dnl  The check for the C++ compiler is later on.
2710 dnl ===================================================================
2711 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2712     GCC_HOME_SET="true"
2713     AC_MSG_CHECKING([gcc home])
2714     if test -z "$with_gcc_home"; then
2715         if test "$enable_icecream" = "yes"; then
2716             if test -d "/usr/lib/icecc/bin"; then
2717                 GCC_HOME="/usr/lib/icecc/"
2718             else
2719                 GCC_HOME="/opt/icecream/"
2720             fi
2721         else
2722             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2723             GCC_HOME_SET="false"
2724         fi
2725     else
2726         GCC_HOME="$with_gcc_home"
2727     fi
2728     AC_MSG_RESULT($GCC_HOME)
2729     AC_SUBST(GCC_HOME)
2731     if test "$GCC_HOME_SET" = "true"; then
2732         if test -z "$CC"; then
2733             CC="$GCC_HOME/bin/gcc"
2734         fi
2735         if test -z "$CXX"; then
2736             CXX="$GCC_HOME/bin/g++"
2737         fi
2738     fi
2741 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2742 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2743     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2744     save_CFLAGS=$CFLAGS
2745     AC_PROG_CC
2746     CFLAGS=$save_CFLAGS
2749 COMPATH=`dirname "$CC"`
2750 if test "$COMPATH" = "."; then
2751     AC_PATH_PROGS(COMPATH, $CC)
2752     dnl double square bracket to get single because of M4 quote...
2753     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2755 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2757 dnl ===================================================================
2758 dnl Java support
2759 dnl ===================================================================
2760 AC_MSG_CHECKING([whether to build with Java support])
2761 if test "$with_java" != "no"; then
2762     if test "$DISABLE_SCRIPTING" = TRUE; then
2763         AC_MSG_RESULT([no, overridden by --disable-scripting])
2764         ENABLE_JAVA=""
2765         with_java=no
2766     else
2767         AC_MSG_RESULT([yes])
2768         ENABLE_JAVA="TRUE"
2769         AC_DEFINE(HAVE_FEATURE_JAVA)
2770     fi
2771 else
2772     AC_MSG_RESULT([no])
2773     ENABLE_JAVA=""
2776 AC_SUBST(ENABLE_JAVA)
2778 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2780 dnl ENABLE_JAVA="" indicate no Java support at all
2782 dnl ===================================================================
2783 dnl Export file validation
2784 dnl ===================================================================
2785 AC_MSG_CHECKING([whether to enable export file validation])
2786 if test "$with_export_validation" = yes; then
2787     AC_MSG_RESULT([yes])
2788     AC_DEFINE(HAVE_EXPORT_VALIDATION)
2790     AC_CHECK_PROGS(ODFVALIDATOR, odfvalidator)
2791     if test -z "$ODFVALIDATOR"; then
2792         AC_MSG_ERROR([odfvalidator not found, but required by --with-export-validation])
2793     fi
2794     AC_SUBST(ODFVALIDATOR)
2795     AC_CHECK_PROGS(OFFICEOTRON, officeotron)
2796     if test -z "$OFFICEOTRON"; then
2797         AC_MSG_ERROR([officeotron not found, but required by --with-export-validation])
2798     fi
2799     AC_SUBST(OFFICEOTRON)
2800 else
2801     AC_MSG_RESULT([no])
2805 dnl ===================================================================
2806 dnl Check OS X SDK and compiler
2807 dnl ===================================================================
2809 if test $_os = Darwin; then
2811     # If no --with-macosx-sdk option is given, look for one
2813     # The intent is that for "most" Mac-based developers, a suitable
2814     # SDK will be found automatically without any configure options.
2816     # For developers with a current Xcode, the lowest-numbered SDK
2817     # higher than or equal to the minimum required should be found.
2819     AC_MSG_CHECKING([what Mac OS X SDK to use])
2821     for _macosx_sdk in $with_macosx_sdk 10.8 10.9 10.10 10.11; do
2822         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2823         if test -d "$MACOSX_SDK_PATH"; then
2824             with_macosx_sdk="${_macosx_sdk}"
2825             break
2826         else
2827             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2828             if test -d "$MACOSX_SDK_PATH"; then
2829                 with_macosx_sdk="${_macosx_sdk}"
2830                 break
2831             fi
2832         fi
2833     done
2834     if test ! -d "$MACOSX_SDK_PATH"; then
2835         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2836     fi
2837     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2839     case $with_macosx_sdk in
2840     10.8)
2841         MACOSX_SDK_VERSION=1080
2842         ;;
2843     10.9)
2844         MACOSX_SDK_VERSION=1090
2845         ;;
2846     10.10)
2847         MACOSX_SDK_VERSION=101000
2848         ;;
2849     10.11)
2850         MACOSX_SDK_VERSION=101100
2851         ;;
2852     *)
2853         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.8--11])
2854         ;;
2855     esac
2857     if test "$with_macosx_version_min_required" = "" ; then
2858         with_macosx_version_min_required="10.8";
2859     fi
2861     if test "$with_macosx_version_max_allowed" = "" ; then
2862         with_macosx_version_max_allowed="$with_macosx_sdk"
2863     fi
2865     # export this so that "xcrun" invocations later return matching values
2866     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2867     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2868     export DEVELOPER_DIR
2869     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2870     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2872     case "$with_macosx_version_min_required" in
2873     10.8)
2874         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2875         ;;
2876     10.9)
2877         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2878         ;;
2879     10.10)
2880         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2881         ;;
2882     10.11)
2883         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2884         ;;
2885     *)
2886         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.8--11])
2887         ;;
2888     esac
2890     LIBTOOL=libtool
2891     INSTALL_NAME_TOOL=install_name_tool
2892     if test -z "$save_CC"; then
2893         AC_MSG_CHECKING([what compiler to use])
2894         stdlib=-stdlib=libc++
2895         if test "$ENABLE_LTO" = TRUE; then
2896             lto=-flto
2897         fi
2898         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2899         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2900         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2901         AR=`xcrun -find ar`
2902         NM=`xcrun -find nm`
2903         STRIP=`xcrun -find strip`
2904         LIBTOOL=`xcrun -find libtool`
2905         RANLIB=`xcrun -find ranlib`
2906         AC_MSG_RESULT([$CC and $CXX])
2907     fi
2909     case "$with_macosx_version_max_allowed" in
2910     10.8)
2911         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2912         ;;
2913     10.9)
2914         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2915         ;;
2916     10.10)
2917         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2918         ;;
2919     10.11)
2920         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2921         ;;
2922     *)
2923         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.8--11])
2924         ;;
2925     esac
2927     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2928     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2929         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2930     else
2931         AC_MSG_RESULT([ok])
2932     fi
2934     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2935     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2936         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2937     else
2938         AC_MSG_RESULT([ok])
2939     fi
2940     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2941     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2943     AC_MSG_CHECKING([whether to do code signing])
2945     if test "$enable_macosx_code_signing" = yes; then
2946         # By default use the first suitable certificate (?).
2948         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2949         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2950         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2951         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2952         # "Developer ID Application" one.
2954         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2955         if test -n "$identity"; then
2956             MACOSX_CODESIGNING_IDENTITY=$identity
2957             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2958             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2959         else
2960             AC_MSG_ERROR([cannot determine identity to use])
2961         fi
2962     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2963         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2964         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2965         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2966     else
2967         AC_MSG_RESULT([no])
2968     fi
2970     AC_MSG_CHECKING([whether to create a Mac App Store package])
2972     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2973         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2974     elif test "$enable_macosx_package_signing" = yes; then
2975         # By default use the first suitable certificate.
2976         # It should be a "3rd Party Mac Developer Installer" one
2978         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2979         if test -n "$identity"; then
2980             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2981             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2982             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2983         else
2984             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2985         fi
2986     elif test -n "$enable_macosx_package_signing"; then
2987         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2988         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2989         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2990     else
2991         AC_MSG_RESULT([no])
2992     fi
2994     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2995         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2996     fi
2998     AC_MSG_CHECKING([whether to sandbox the application])
3000     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3001         AC_MSG_ERROR([OS X sandboxing requires code signing])
3002     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3003         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
3004     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3005         ENABLE_MACOSX_SANDBOX=TRUE
3006         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3007         AC_MSG_RESULT([yes])
3008     else
3009         AC_MSG_RESULT([no])
3010     fi
3012     AC_MSG_CHECKING([what OS X app bundle identifier to use])
3013     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3014     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3016     AC_MSG_CHECKING([what OS X app name to use])
3017     MACOSX_APP_NAME="$with_macosx_app_name"
3018     AC_MSG_RESULT([$MACOSX_APP_NAME])
3021 AC_SUBST(MACOSX_SDK_PATH)
3022 AC_SUBST(MACOSX_SDK_VERSION)
3023 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3024 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3025 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3026 AC_SUBST(INSTALL_NAME_TOOL)
3027 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
3028 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3029 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3030 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3031 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3032 AC_SUBST(MACOSX_APP_NAME)
3034 dnl ===================================================================
3035 dnl Check iOS SDK and compiler
3036 dnl ===================================================================
3038 if test $_os = iOS; then
3040     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3041         :
3042     else
3043         BITNESS_OVERRIDE=64
3044     fi
3046     AC_MSG_CHECKING([what iOS SDK to use])
3048     if test "$enable_ios_simulator" = yes; then
3049         platform=iPhoneSimulator
3050     else
3051         platform=iPhoneOS
3052     fi
3054     xcode_developer=`xcode-select -print-path`
3056     current_sdk_ver=9.2
3057     for sdkver in 9.2 9.1 9.0 8.4 8.3 8.2 8.1 8.0; do
3058         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3059         if test -d $t; then
3060             ios_sdk=$sdkver
3061             sysroot=$t
3062             break
3063         fi
3064     done
3066     if test -z "$sysroot"; then
3067         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}])
3068     fi
3070     AC_MSG_RESULT($sysroot)
3072     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
3074     if test "$enable_ios_simulator" = yes; then
3075         if test "$BITNESS_OVERRIDE" = 64; then
3076             XCODE_ARCHS=x86_64
3077             versionmin=-mios-simulator-version-min=7.0
3078         else
3079             XCODE_ARCHS=i386
3080             versionmin=-mios-simulator-version-min=7.0
3081         fi
3082     else
3083         platform=iPhoneOS
3084         if test "$BITNESS_OVERRIDE" = 64; then
3085             XCODE_ARCHS=arm64
3086         else
3087             XCODE_ARCHS=armv7
3088         fi
3089         versionmin=-miphoneos-version-min=7.0
3090     fi
3092     # LTO is not really recommended for iOS builds,
3093     # the link time will be astronomical
3094     if test "$ENABLE_LTO" = TRUE; then
3095         lto=-flto
3096     fi
3097     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3098     # get compiled with it, to avoid ld warnings when linking all that together into one
3099     # executable.
3101     XCODE_CLANG_CXX_LIBRARY=libc++
3102     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3104     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3105     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3107     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3108     AR=`xcrun -find ar`
3109     NM=`xcrun -find nm`
3110     STRIP=`xcrun -find strip`
3111     LIBTOOL=`xcrun -find libtool`
3112     RANLIB=`xcrun -find ranlib`
3115 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3116 AC_SUBST(XCODE_ARCHS)
3117 AC_SUBST(XCODEBUILD_SDK)
3119 AC_MSG_CHECKING([whether to treat the installation as read-only])
3121 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3122         "$enable_extensions" != yes; then
3123     enable_readonly_installset=yes
3125 if test "$enable_readonly_installset" = yes; then
3126     AC_MSG_RESULT([yes])
3127     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3128 else
3129     AC_MSG_RESULT([no])
3132 dnl ===================================================================
3133 dnl Structure of install set
3134 dnl ===================================================================
3136 if test $_os = Darwin; then
3137     LIBO_BIN_FOLDER=MacOS
3138     LIBO_ETC_FOLDER=Resources
3139     LIBO_LIBEXEC_FOLDER=MacOS
3140     LIBO_LIB_FOLDER=Frameworks
3141     LIBO_LIB_PYUNO_FOLDER=Resources
3142     LIBO_SHARE_FOLDER=Resources
3143     LIBO_SHARE_HELP_FOLDER=Resources/help
3144     LIBO_SHARE_JAVA_FOLDER=Resources/java
3145     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3146     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3147     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3148     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3149     LIBO_URE_BIN_FOLDER=MacOS
3150     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3151     LIBO_URE_LIB_FOLDER=Frameworks
3152     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3153     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3154 elif test $_os = WINNT; then
3155     LIBO_BIN_FOLDER=program
3156     LIBO_ETC_FOLDER=program
3157     LIBO_LIBEXEC_FOLDER=program
3158     LIBO_LIB_FOLDER=program
3159     LIBO_LIB_PYUNO_FOLDER=program
3160     LIBO_SHARE_FOLDER=share
3161     LIBO_SHARE_HELP_FOLDER=help
3162     LIBO_SHARE_JAVA_FOLDER=program/classes
3163     LIBO_SHARE_PRESETS_FOLDER=presets
3164     LIBO_SHARE_READMES_FOLDER=readmes
3165     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3166     LIBO_SHARE_SHELL_FOLDER=program/shell
3167     LIBO_URE_BIN_FOLDER=program
3168     LIBO_URE_ETC_FOLDER=program
3169     LIBO_URE_LIB_FOLDER=program
3170     LIBO_URE_MISC_FOLDER=program
3171     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3172 else
3173     LIBO_BIN_FOLDER=program
3174     LIBO_ETC_FOLDER=program
3175     LIBO_LIBEXEC_FOLDER=program
3176     LIBO_LIB_FOLDER=program
3177     LIBO_LIB_PYUNO_FOLDER=program
3178     LIBO_SHARE_FOLDER=share
3179     LIBO_SHARE_HELP_FOLDER=help
3180     LIBO_SHARE_JAVA_FOLDER=program/classes
3181     LIBO_SHARE_PRESETS_FOLDER=presets
3182     LIBO_SHARE_READMES_FOLDER=readmes
3183     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3184     LIBO_SHARE_SHELL_FOLDER=program/shell
3185     LIBO_URE_BIN_FOLDER=program
3186     LIBO_URE_ETC_FOLDER=program
3187     LIBO_URE_LIB_FOLDER=program
3188     LIBO_URE_MISC_FOLDER=program
3189     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3191 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3192 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3193 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3194 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3195 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3196 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3197 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3198 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3199 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3200 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3201 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3202 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3203 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3204 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3205 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3206 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3208 # Not all of them needed in config_host.mk, add more if need arises
3209 AC_SUBST(LIBO_BIN_FOLDER)
3210 AC_SUBST(LIBO_ETC_FOLDER)
3211 AC_SUBST(LIBO_LIB_FOLDER)
3212 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3213 AC_SUBST(LIBO_SHARE_FOLDER)
3214 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3215 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3216 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3217 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3218 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3219 AC_SUBST(LIBO_URE_BIN_FOLDER)
3220 AC_SUBST(LIBO_URE_ETC_FOLDER)
3221 AC_SUBST(LIBO_URE_LIB_FOLDER)
3222 AC_SUBST(LIBO_URE_MISC_FOLDER)
3223 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3225 dnl ===================================================================
3226 dnl Windows specific tests and stuff
3227 dnl ===================================================================
3229 # Get a value from the 32-bit side of the Registry
3230 reg_get_value_32()
3232     # Return value: $regvalue
3233     unset regvalue
3234     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3236     if test $? -eq 0; then
3237         regvalue=$_regvalue
3238     fi
3241 # Get a value from the 64-bit side of the Registry
3242 reg_get_value_64()
3244     # Return value: $regvalue
3245     unset regvalue
3246     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3248     if test $? -eq 0; then
3249         regvalue=$_regvalue
3250     fi
3253 if test "$_os" = "WINNT"; then
3254     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3255     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3256         AC_MSG_RESULT([no])
3257         WINDOWS_SDK_ARCH="x86"
3258     else
3259         AC_MSG_RESULT([yes])
3260         WINDOWS_SDK_ARCH="x64"
3261         BITNESS_OVERRIDE=64
3262     fi
3265 if test "$cross_compiling" = "yes"; then
3266     export CROSS_COMPILING=TRUE
3267     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3268 else
3269     CROSS_COMPILING=
3270     BUILD_TYPE="$BUILD_TYPE NATIVE"
3272 AC_SUBST(CROSS_COMPILING)
3274 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3275 if test "$GCC" = "yes"; then
3276     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3277     bsymbolic_functions_ldflags_save=$LDFLAGS
3278     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3279     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3280 #include <stdio.h>
3281         ],[
3282 printf ("hello world\n");
3283         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3284     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3285         AC_MSG_RESULT( found )
3286     else
3287         AC_MSG_RESULT( not found )
3288     fi
3289     LDFLAGS=$bsymbolic_functions_ldflags_save
3291 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3293 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3294 # NOTE: must _not_ be used for bundled external libraries!
3295 ISYSTEM=
3296 if test "$GCC" = "yes"; then
3297     AC_MSG_CHECKING( for -isystem )
3298     save_CFLAGS=$CFLAGS
3299     CFLAGS="$CFLAGS -Werror"
3300     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3301     CFLAGS=$save_CFLAGS
3302     if test -n "$ISYSTEM"; then
3303         AC_MSG_RESULT(yes)
3304     else
3305         AC_MSG_RESULT(no)
3306     fi
3308 if test -z "$ISYSTEM"; then
3309     # fall back to using -I
3310     ISYSTEM=-I
3312 AC_SUBST(ISYSTEM)
3314 dnl ===================================================================
3315 dnl  Check which Visual Studio or MinGW compiler is used
3316 dnl ===================================================================
3318 map_vs_year_to_version()
3320     # Return value: $vsversion
3322     unset vsversion
3324     case $1 in
3325     2013)
3326         vsversion=12.0;;
3327     2015)
3328         vsversion=14.0;;
3329     *)
3330         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3331     esac
3334 vs_versions_to_check()
3336     # Args: $1 (optional) : versions to check, in the order of preference
3337     # Return value: $vsversions
3339     unset vsversions
3341     if test -n "$1"; then
3342         map_vs_year_to_version "$1"
3343         vsversions=$vsversion
3344     else
3345         # By default we prefer 2013
3346         vsversions=12.0
3347     fi
3350 find_msvs()
3352     # Find Visual Studio 2013/2015
3353     # Args: $1 (optional) : versions to check, in the order of preference
3354     # Return value: $vstest
3356     unset vstest
3358     vs_versions_to_check "$1"
3360     for ver in $vsversions; do
3361         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3362         if test -n "$regvalue"; then
3363             vstest=$regvalue
3364             break
3365         fi
3366         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3367         if test -n "$regvalue"; then
3368             vstest=$regvalue
3369             break
3370         fi
3371     done
3374 find_ucrt()
3376     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot10"
3377     if test -n "$regvalue"; then
3378         ucrttest=$regvalue
3379         ucrtdir=10.0.10240.0
3380     fi
3383 find_msvc()
3385     # Find Visual C++ 2013/2015
3386     # Args: $1 (optional) : The VS version year
3387     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3389     unset vctest vcnum vcnumwithdot vcexpress
3391     vs_versions_to_check "$1"
3393     for ver in $vsversions; do
3394         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3395         if test -n "$regvalue"; then
3396             vctest=$regvalue
3397             break
3398         fi
3399         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3400         if test -n "$regvalue"; then
3401             vctest=$regvalue
3402             break
3403         fi
3404     done
3405     if test -n "$vctest"; then
3406         vcnumwithdot=$ver
3407         case "$vcnumwithdot" in
3408         12.0)
3409             vcyear=2013
3410             vcnum=120
3411             ;;
3412         14.0)
3413             vcyear=2015
3414             vcnum=140
3415             ;;
3416         esac
3417         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$vcnumwithdot/Setup/VC/ProductDir
3418         if test -n "$regvalue" -a "$regvalue" = "$vctest" ; then
3419             vcexpress=Express
3420         fi
3421     fi
3424 SOLARINC=
3425 SHOWINCLUDES_PREFIX=
3426 MSBUILD_PATH=
3427 DEVENV=
3428 if test "$_os" = "WINNT"; then
3429     if test "$WITH_MINGW" != "yes"; then
3430         AC_MSG_CHECKING([Visual C++])
3432         find_msvc "$with_visual_studio"
3434         if test -z "$vctest"; then
3435             if test -n "$with_visual_studio"; then
3436                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3437             else
3438                 AC_MSG_ERROR([No Visual Studio 2013/2015 installation found])
3439             fi
3440         fi
3442         if test "$BITNESS_OVERRIDE" = ""; then
3443             if test -f "$vctest/bin/cl.exe"; then
3444                 VC_PRODUCT_DIR=$vctest
3445             else
3446                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3447             fi
3448         else
3449             if test -f "$vctest/bin/amd64/cl.exe"; then
3450                 VC_PRODUCT_DIR=$vctest
3451             else
3452                 if test -f "$vctest/bin/x86_amd64/cl.exe" -a "$vcexpress" = "Express"; then
3453                     VC_PRODUCT_DIR=$vctest
3454                 else
3455                     AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3456                 fi
3457             fi
3458         fi
3460         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3461         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3463         AC_MSG_CHECKING([Is Visual C++ Express])
3464         if test "$vcexpress" = "Express" ; then
3465             AC_MSG_RESULT([Yes])
3466         else
3467             AC_MSG_RESULT([No])
3468         fi
3470         AC_MSG_CHECKING([whether UCRT is needed for this compiler version])
3471         if test "$vcnum" = "120"; then
3472             AC_MSG_RESULT([No])
3473         else
3474             AC_MSG_RESULT([Yes])
3475             AC_MSG_CHECKING([for UCRT location])
3476             find_ucrt
3477             if test -n "$ucrttest"; then
3478                 AC_MSG_RESULT([found])
3479                 PathFormat "$ucrttest"
3480                 ucrtincpath_formatted="$formatted_path/Include/$ucrtdir/ucrt"
3481                 # SOLARINC is used for external modules and must be set too.
3482                 # And no, it's not sufficient to set SOLARINC only, as configure
3483                 # itself doesn't honour it.
3484                 SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3485                 CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3486                 CXXFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3487             else
3488                 AC_MSG_ERROR([not found])
3489             fi
3490         fi
3492         # Find the proper version of MSBuild.exe to use based on the VS version
3493         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3494         if test -n "$regvalue" ; then
3495             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3496         fi
3498         # Find the version of devenv.exe
3499         DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
3500         if test ! -e "$DEVENV" -a "$vcnum" = "120"; then
3501             # for Visual Studio 2013 Express, fall back
3502             DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/WDExpress.exe"
3503         fi
3504         if test ! -e "$DEVENV"; then
3505             AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3506         fi
3508         dnl ===========================================================
3509         dnl  Check for the corresponding mspdb*.dll
3510         dnl ===========================================================
3512         MSPDB_PATH=
3514         if test "$BITNESS_OVERRIDE" = ""; then
3515             if test "$vcnum" = "120"; then
3516                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3517             else
3518                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3519             fi
3520         else
3521             if test "$vcexpress" = "Express"; then
3522                 MSPDB_PATH="$VC_PRODUCT_DIR/bin"
3523             else
3524                 MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3525             fi
3526         fi
3528         mspdbnum=$vcnum
3530         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3531             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3532         fi
3534         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3535         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3537         dnl The path needs to be added before cl is called
3538         PATH="$MSPDB_PATH:$PATH"
3540         AC_MSG_CHECKING([cl.exe])
3542         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3543         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3544         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3545         # is not enough?
3547         if test -z "$CC"; then
3548             if test "$BITNESS_OVERRIDE" = ""; then
3549                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3550                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3551                 fi
3552             else
3553                 if test "$vcexpress" = "Express"; then
3554                    if test -f "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"; then
3555                         CC="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3556                    fi
3557                 else
3558                    if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3559                         CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3560                    fi
3561                 fi
3562             fi
3564             # This gives us a posix path with 8.3 filename restrictions
3565             CC=`win_short_path_for_make "$CC"`
3566         fi
3568         if test -n "$CC"; then
3569             # Remove /cl.exe from CC case insensitive
3570             AC_MSG_RESULT([found Visual C++ $vcyear $vcexpress ($CC)])
3571             if test "$BITNESS_OVERRIDE" = ""; then
3572                 COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3573             else
3574                 if test -n "$VC_PRODUCT_DIR"; then
3575                     COMPATH=$VC_PRODUCT_DIR
3576                 fi
3577             fi
3578             if test "$BITNESS_OVERRIDE" = ""; then
3579                 dnl since MSVC 2012, default for x86 is -arch:SSE2:
3580                 CC="$CC -arch:SSE"
3581             fi
3582             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3584             PathFormat "$COMPATH"
3585             COMPATH="$formatted_path"
3587             VCVER=$vcnum
3588             MSVSVER=$vcyear
3590             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3591             # are always "better", we list them in reverse chronological order.
3593             case $vcnum in
3594             120)
3595                 COMEX=15
3596                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0 7.1A"
3597                 ;;
3598             140)
3599                 COMEX=19
3600                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0A 8.1A 8.1 8.0 7.1A"
3601                 ;;
3602             esac
3604             # The expectation is that --with-windows-sdk should not need to be used
3605             if test -n "$with_windows_sdk"; then
3606                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3607                 *" "$with_windows_sdk" "*)
3608                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3609                     ;;
3610                 *)
3611                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3612                     ;;
3613                 esac
3614             fi
3616             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3617             ac_objext=obj
3618             ac_exeext=exe
3620         else
3621             AC_MSG_ERROR([Visual C++ not found after all, huh])
3622         fi
3624         dnl We need to guess the prefix of the -showIncludes output, it can be
3625         dnl localized
3626         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3627         echo "#include <stdlib.h>" > conftest.c
3628         dnl Filter out -FIIntrin.h when CC points at clang-cl.exe and needs to
3629         dnl explicitly state that argument:
3630         my_CC=
3631         for i in $CC; do
3632             case $i in
3633             -FIIntrin.h)
3634                 ;;
3635             *)
3636                 my_CC="$my_CC $i"
3637                 ;;
3638             esac
3639         done
3640         SHOWINCLUDES_PREFIX=`$my_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3641             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3642         rm -f conftest.c conftest.obj
3643         if test -z "$SHOWINCLUDES_PREFIX"; then
3644             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3645         else
3646             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3647         fi
3649         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3650         # version of the Explorer extension (and maybe other small
3651         # bits, too) needed when installing a 32-bit LibreOffice on a
3652         # 64-bit OS. The 64-bit Explorer extension is a feature that
3653         # has been present since long in OOo. Don't confuse it with
3654         # building LibreOffice itself as 64-bit code, which is
3655         # unfinished work and highly experimental.
3657         BUILD_X64=
3658         CXX_X64_BINARY=
3659         LINK_X64_BINARY=
3661         if test "$BITNESS_OVERRIDE" = ""; then
3662             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3663             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3664                 # Prefer native x64 compiler to cross-compiler, in case we are running
3665                 # the build on a 64-bit OS.
3666                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3667                     BUILD_X64=TRUE
3668                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3669                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3670                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3671                     BUILD_X64=TRUE
3672                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3673                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3674                 fi
3675             fi
3676             if test "$BUILD_X64" = TRUE; then
3677                 AC_MSG_RESULT([found])
3678             else
3679                 AC_MSG_RESULT([not found])
3680                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3681             fi
3682         fi
3683         AC_SUBST(BUILD_X64)
3685         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3686         AC_SUBST(CXX_X64_BINARY)
3687         AC_SUBST(LINK_X64_BINARY)
3688     else
3689         AC_MSG_CHECKING([the compiler is MinGW])
3690         MACHINE_PREFIX=`$CC -dumpmachine`
3691         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3692             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3693             AC_MSG_RESULT([yes])
3694         else
3695             AC_MSG_ERROR([Compiler is not MinGW.])
3696         fi
3697     fi
3699 AC_SUBST(VCVER)
3700 AC_SUBST(DEVENV)
3701 PathFormat "$MSPDB_PATH"
3702 MSPDB_PATH="$formatted_path"
3703 AC_SUBST(SHOWINCLUDES_PREFIX)
3705 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3706     AC_MSG_CHECKING([whether to use DirectX])
3707     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3708         ENABLE_DIRECTX="TRUE"
3709         AC_MSG_RESULT([yes])
3710     else
3711         ENABLE_DIRECTX=""
3712         AC_MSG_RESULT([no])
3713     fi
3715     AC_MSG_CHECKING([whether to use ActiveX])
3716     if test "$enable_activex" = "yes" -o "$enable_activex" = "" -a "$vcexpress" != Express; then
3717         DISABLE_ACTIVEX=""
3718         AC_MSG_RESULT([yes])
3719     else
3720         DISABLE_ACTIVEX="TRUE"
3721         AC_MSG_RESULT([no])
3722     fi
3724     AC_MSG_CHECKING([whether to use ATL])
3725     if test "$enable_atl" = "yes" -o "$enable_atl" = "" -a "$vcexpress" != Express; then
3726         DISABLE_ATL=""
3727         AC_MSG_RESULT([yes])
3728     else
3729         DISABLE_ATL="TRUE"
3730         AC_MSG_RESULT([no])
3731     fi
3732 else
3733     ENABLE_DIRECTX=""
3734     DISABLE_ACTIVEX="TRUE"
3735     DISABLE_ATL="TRUE"
3738 AC_SUBST(ENABLE_DIRECTX)
3739 AC_SUBST(DISABLE_ACTIVEX)
3740 AC_SUBST(DISABLE_ATL)
3743 # dbghelp.dll
3745 if test "$_os" = "WINNT"; then
3746     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3750 # unowinreg.dll
3752 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3753 AC_SUBST(UNOWINREG_DLL)
3755 COM_IS_CLANG=
3756 AC_MSG_CHECKING([whether the compiler is actually Clang])
3757 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3758     #ifndef __clang__
3759     you lose
3760     #endif
3761     int foo=42;
3762     ]])],
3763     [AC_MSG_RESULT([yes])
3764      COM_IS_CLANG=TRUE],
3765     [AC_MSG_RESULT([no])])
3767 if test "$COM_IS_CLANG" = TRUE; then
3768     AC_MSG_CHECKING([the Clang version])
3769     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | ${CC%-cl.exe*} -E -P -`
3770     CLANG_FULL_VERSION=`echo __clang_version__ | ${CC%-cl.exe*} -E -P -`
3771     CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3772     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3773     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3775 AC_SUBST(COM_IS_CLANG)
3777 if test "$CCACHE" != "" -a "$COM_IS_CLANG" = TRUE; then
3778     if test -z "$CCACHE_CPP2"; then
3779         AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3780         add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3781     fi
3785 # prefix C with ccache if needed
3787 if test "$CCACHE" != ""; then
3788     AC_MSG_CHECKING([whether $CC is already ccached])
3790     AC_LANG_PUSH([C])
3791     save_CFLAGS=$CFLAGS
3792     CFLAGS="$CFLAGS --ccache-skip -O2"
3793     dnl an empty program will do, we're checking the compiler flags
3794     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3795                       [use_ccache=yes], [use_ccache=no])
3796     if test $use_ccache = yes; then
3797         AC_MSG_RESULT([yes])
3798     else
3799         CC="$CCACHE $CC"
3800         AC_MSG_RESULT([no])
3801     fi
3802     CFLAGS=$save_CFLAGS
3803     AC_LANG_POP([C])
3806 # ===================================================================
3807 # check various GCC options that Clang does not support now but maybe
3808 # will somewhen in the future, check them even for GCC, so that the
3809 # flags are set
3810 # ===================================================================
3812 HAVE_GCC_GGDB2=
3813 HAVE_GCC_FINLINE_LIMIT=
3814 HAVE_GCC_FNO_INLINE=
3815 if test "$GCC" = "yes"; then
3816     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3817     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3818         # Option just ignored and silly warning that isn't a real
3819         # warning printed
3820         :
3821     else
3822         save_CFLAGS=$CFLAGS
3823         CFLAGS="$CFLAGS -Werror -ggdb2"
3824         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3825         CFLAGS=$save_CFLAGS
3826     fi
3827     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3828         AC_MSG_RESULT([yes])
3829     else
3830         AC_MSG_RESULT([no])
3831     fi
3833     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3834     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3835         # As above
3836         :
3837     else
3838         save_CFLAGS=$CFLAGS
3839         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3840         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3841         CFLAGS=$save_CFLAGS
3842     fi
3843     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3844         AC_MSG_RESULT([yes])
3845     else
3846         AC_MSG_RESULT([no])
3847     fi
3849     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3850     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3851         # Ditto
3852         :
3853     else
3854         save_CFLAGS=$CFLAGS
3855         CFLAGS="$CFLAGS -Werror -fno-inline"
3856         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3857         CFLAGS=$save_CFLAGS
3858     fi
3859     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3860         AC_MSG_RESULT([yes])
3861     else
3862         AC_MSG_RESULT([no])
3863     fi
3865 AC_SUBST(HAVE_GCC_GGDB2)
3866 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3867 AC_SUBST(HAVE_GCC_FNO_INLINE)
3869 dnl ===================================================================
3870 dnl  Test the gcc version
3871 dnl ===================================================================
3872 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3873     AC_MSG_CHECKING([the GCC version])
3874     _gcc_version=`$CC -dumpversion`
3875     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3877     AC_MSG_RESULT([gcc $_gcc_version])
3879     if test "$GCC_VERSION" -lt 0407; then
3880         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.7.0])
3881     fi
3882 else
3883     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3884     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3885     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3886     # (which reports itself as GCC 4.2.1).
3887     GCC_VERSION=
3889 AC_SUBST(GCC_VERSION)
3891 dnl Set the ENABLE_DBGUTIL variable
3892 dnl ===================================================================
3893 AC_MSG_CHECKING([whether to build with additional debug utilities])
3894 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3895     ENABLE_DBGUTIL="TRUE"
3896     # this is an extra var so it can have different default on different MSVC
3897     # versions (in case there are version specific problems with it)
3898     MSVC_USE_DEBUG_RUNTIME="TRUE"
3900     AC_MSG_RESULT([yes])
3901     # cppunit and graphite expose STL in public headers
3902     if test "$with_system_cppunit" = "yes"; then
3903         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3904     else
3905         with_system_cppunit=no
3906     fi
3907     if test "$with_system_graphite" = "yes"; then
3908         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3909     else
3910         with_system_graphite=no
3911     fi
3912     if test "$with_system_mysql_cppconn" = "yes"; then
3913         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3914     else
3915         with_system_mysql_cppconn=no
3916     fi
3917     if test "$with_system_orcus" = "yes"; then
3918         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3919     else
3920         with_system_orcus=no
3921     fi
3922     if test "$with_system_libcmis" = "yes"; then
3923         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3924     else
3925         with_system_libcmis=no
3926     fi
3927     if test "$with_system_libgltf" = "yes"; then
3928         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3929     else
3930         with_system_libgltf=no
3931     fi
3932 else
3933     ENABLE_DBGUTIL=""
3934     MSVC_USE_DEBUG_RUNTIME=""
3935     AC_MSG_RESULT([no])
3937 AC_SUBST(ENABLE_DBGUTIL)
3938 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3940 dnl Set the ENABLE_DEBUG variable.
3941 dnl ===================================================================
3942 AC_MSG_CHECKING([whether to do a debug build])
3943 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3944     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3946 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3947     AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3950 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3951     ENABLE_DEBUG="TRUE"
3952     if test -n "$ENABLE_DBGUTIL" ; then
3953         AC_MSG_RESULT([yes (dbgutil)])
3954     else
3955         AC_MSG_RESULT([yes])
3956     fi
3957 else
3958     ENABLE_DEBUG=""
3959     AC_MSG_RESULT([no])
3961 AC_SUBST(ENABLE_DEBUG)
3963 if test "$enable_sal_log" = yes; then
3964     ENABLE_SAL_LOG=TRUE
3966 AC_SUBST(ENABLE_SAL_LOG)
3968 dnl Selective debuginfo
3969 ENABLE_DEBUGINFO_FOR=
3970 if test -n "$ENABLE_DEBUG"; then
3971     AC_MSG_CHECKING([whether to use selective debuginfo])
3972     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3973         if test "$enable_selective_debuginfo" = "yes"; then
3974             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3975         fi
3976         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3977         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3978     else
3979         ENABLE_DEBUGINFO_FOR=all
3980         AC_MSG_RESULT([no, for all])
3981     fi
3982 else
3983     if test -n "$enable_selective_debuginfo"; then
3984         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3985     fi
3987 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3989 dnl Check for enable symbols option
3990 dnl ===================================================================
3991 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3992 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3993     ENABLE_SYMBOLS="TRUE"
3994     if test -n "$ENABLE_DBGUTIL"; then
3995         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3996     elif test -n "$ENABLE_DEBUG"; then
3997         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
3998     fi
3999     AC_MSG_RESULT([yes])
4000 else
4001     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
4002         ENABLE_SYMBOLS="FALSE"
4003     else
4004         ENABLE_SYMBOLS=
4005     fi
4006     AC_MSG_RESULT([no])
4008 AC_SUBST(ENABLE_SYMBOLS)
4010 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4011     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4012     AC_MSG_CHECKING([whether enough memory is available for linking])
4013     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4014     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4015     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4016         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4017     else
4018         AC_MSG_RESULT([yes])
4019     fi
4022 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
4023 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
4024 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
4025 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
4026 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
4027     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
4029 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
4031 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
4032 # By default use the ones specified by our build system,
4033 # but explicit override is possible.
4034 AC_MSG_CHECKING(for explicit AFLAGS)
4035 if test -n "$AFLAGS"; then
4036     AC_MSG_RESULT([$AFLAGS])
4037     x_AFLAGS=
4038 else
4039     AC_MSG_RESULT(no)
4040     x_AFLAGS=[\#]
4042 AC_MSG_CHECKING(for explicit CFLAGS)
4043 if test -n "$CFLAGS"; then
4044     AC_MSG_RESULT([$CFLAGS])
4045     x_CFLAGS=
4046 else
4047     AC_MSG_RESULT(no)
4048     x_CFLAGS=[\#]
4050 AC_MSG_CHECKING(for explicit CXXFLAGS)
4051 if test -n "$CXXFLAGS"; then
4052     AC_MSG_RESULT([$CXXFLAGS])
4053     x_CXXFLAGS=
4054 else
4055     AC_MSG_RESULT(no)
4056     x_CXXFLAGS=[\#]
4058 AC_MSG_CHECKING(for explicit OBJCFLAGS)
4059 if test -n "$OBJCFLAGS"; then
4060     AC_MSG_RESULT([$OBJCFLAGS])
4061     x_OBJCFLAGS=
4062 else
4063     AC_MSG_RESULT(no)
4064     x_OBJCFLAGS=[\#]
4066 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
4067 if test -n "$OBJCXXFLAGS"; then
4068     AC_MSG_RESULT([$OBJCXXFLAGS])
4069     x_OBJCXXFLAGS=
4070 else
4071     AC_MSG_RESULT(no)
4072     x_OBJCXXFLAGS=[\#]
4074 AC_MSG_CHECKING(for explicit LDFLAGS)
4075 if test -n "$LDFLAGS"; then
4076     AC_MSG_RESULT([$LDFLAGS])
4077     x_LDFLAGS=
4078 else
4079     AC_MSG_RESULT(no)
4080     x_LDFLAGS=[\#]
4082 AC_SUBST(AFLAGS)
4083 AC_SUBST(CFLAGS)
4084 AC_SUBST(CXXFLAGS)
4085 AC_SUBST(OBJCFLAGS)
4086 AC_SUBST(OBJCXXFLAGS)
4087 AC_SUBST(LDFLAGS)
4088 AC_SUBST(x_AFLAGS)
4089 AC_SUBST(x_CFLAGS)
4090 AC_SUBST(x_CXXFLAGS)
4091 AC_SUBST(x_OBJCFLAGS)
4092 AC_SUBST(x_OBJCXXFLAGS)
4093 AC_SUBST(x_LDFLAGS)
4096 # determine CPUNAME, OS, ...
4097 # The USING_X11 flag tells whether the host os uses X by default. Can be overriden with the --without-x option.
4099 case "$host_os" in
4101 aix*)
4102     COM=GCC
4103     CPUNAME=POWERPC
4104     USING_X11=TRUE
4105     OS=AIX
4106     RTL_OS=AIX
4107     RTL_ARCH=PowerPC
4108     PLATFORMID=aix_powerpc
4109     P_SEP=:
4110     ;;
4112 cygwin*)
4113     COM=MSC
4114     USING_X11=
4115     OS=WNT
4116     RTL_OS=Windows
4117     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4118         P_SEP=";"
4119     else
4120         P_SEP=:
4121     fi
4122     case "$host_cpu" in
4123     i*86|x86_64)
4124         if test "$BITNESS_OVERRIDE" = 64; then
4125             CPUNAME=X86_64
4126             RTL_ARCH=X86_64
4127             PLATFORMID=windows_x86_64
4128             WINDOWS_X64=1
4129             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4130         else
4131             CPUNAME=INTEL
4132             RTL_ARCH=x86
4133             PLATFORMID=windows_x86
4134         fi
4135         ;;
4136     *)
4137         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4138         ;;
4139     esac
4140     SCPDEFS="$SCPDEFS -D_MSC_VER"
4141     ;;
4143 darwin*)
4144     COM=GCC
4145     USING_X11=
4146     OS=MACOSX
4147     RTL_OS=MacOSX
4148     P_SEP=:
4150     case "$host_cpu" in
4151     arm*)
4152         CPUNAME=ARM
4153         RTL_ARCH=ARM_EABI
4154         PLATFORMID=ios_arm
4155         OS=IOS
4156         ;;
4157     i*86)
4158         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4159         ;;
4160     x86_64)
4161         CPUNAME=X86_64
4162         RTL_ARCH=X86_64
4163         PLATFORMID=macosx_x86_64
4164         ;;
4165     *)
4166         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4167         ;;
4168     esac
4169     ;;
4171 dragonfly*)
4172     COM=GCC
4173     USING_X11=TRUE
4174     OS=DRAGONFLY
4175     RTL_OS=DragonFly
4176     P_SEP=:
4178     case "$host_cpu" in
4179     i*86)
4180         CPUNAME=INTEL
4181         RTL_ARCH=x86
4182         PLATFORMID=dragonfly_x86
4183         ;;
4184     x86_64)
4185         CPUNAME=X86_64
4186         RTL_ARCH=X86_64
4187         PLATFORMID=dragonfly_x86_64
4188         ;;
4189     *)
4190         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4191         ;;
4192     esac
4193     ;;
4195 freebsd*)
4196     COM=GCC
4197     USING_X11=TRUE
4198     RTL_OS=FreeBSD
4199     OS=FREEBSD
4200     P_SEP=:
4202     case "$host_cpu" in
4203     i*86)
4204         CPUNAME=INTEL
4205         RTL_ARCH=x86
4206         PLATFORMID=freebsd_x86
4207         ;;
4208     x86_64|amd64)
4209         CPUNAME=X86_64
4210         RTL_ARCH=X86_64
4211         PLATFORMID=freebsd_x86_64
4212         ;;
4213     *)
4214         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4215         ;;
4216     esac
4217     ;;
4219 kfreebsd*)
4220     COM=GCC
4221     USING_X11=TRUE
4222     OS=LINUX
4223     RTL_OS=kFreeBSD
4224     P_SEP=:
4226     case "$host_cpu" in
4228     i*86)
4229         CPUNAME=INTEL
4230         RTL_ARCH=x86
4231         PLATFORMID=kfreebsd_x86
4232         ;;
4233     x86_64)
4234         CPUNAME=X86_64
4235         RTL_ARCH=X86_64
4236         PLATFORMID=kfreebsd_x86_64
4237         ;;
4238     *)
4239         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4240         ;;
4241     esac
4242     ;;
4244 linux-gnu*)
4245     COM=GCC
4246     USING_X11=TRUE
4247     OS=LINUX
4248     RTL_OS=Linux
4249     P_SEP=:
4251     case "$host_cpu" in
4253     aarch64)
4254         CPUNAME=AARCH64
4255         PLATFORMID=linux_aarch64
4256         RTL_ARCH=AARCH64
4257         ;;
4258     alpha)
4259         CPUNAME=AXP
4260         RTL_ARCH=ALPHA
4261         PLATFORMID=linux_alpha
4262         ;;
4263     arm*)
4264         CPUNAME=ARM
4265         EPM_FLAGS="-a arm"
4266         RTL_ARCH=ARM_EABI
4267         PLATFORMID=linux_arm_eabi
4268         case "$host_cpu" in
4269         arm*-linux)
4270             RTL_ARCH=ARM_OABI
4271             PLATFORMID=linux_arm_oabi
4272             ;;
4273         esac
4274         ;;
4275     hppa)
4276         CPUNAME=HPPA
4277         RTL_ARCH=HPPA
4278         EPM_FLAGS="-a hppa"
4279         PLATFORMID=linux_hppa
4280         ;;
4281     i*86)
4282         CPUNAME=INTEL
4283         RTL_ARCH=x86
4284         PLATFORMID=linux_x86
4285         ;;
4286     ia64)
4287         CPUNAME=IA64
4288         RTL_ARCH=IA64
4289         PLATFORMID=linux_ia64
4290         ;;
4291     mips)
4292         CPUNAME=GODSON
4293         RTL_ARCH=MIPS_EB
4294         EPM_FLAGS="-a mips"
4295         PLATFORMID=linux_mips_eb
4296         ;;
4297     mips64)
4298         CPUNAME=GODSON64
4299         RTL_ARCH=MIPS64_EB
4300         EPM_FLAGS="-a mips64"
4301         PLATFORMID=linux_mips64_eb
4302         ;;
4303     mips64el)
4304         CPUNAME=GODSON64
4305         RTL_ARCH=MIPS64_EL
4306         EPM_FLAGS="-a mips64el"
4307         PLATFORMID=linux_mips64_el
4308         ;;
4309     mipsel)
4310         CPUNAME=GODSON
4311         RTL_ARCH=MIPS_EL
4312         EPM_FLAGS="-a mipsel"
4313         PLATFORMID=linux_mips_el
4314         ;;
4315     m68k)
4316         CPUNAME=M68K
4317         RTL_ARCH=M68K
4318         PLATFORMID=linux_m68k
4319         ;;
4320     powerpc)
4321         CPUNAME=POWERPC
4322         RTL_ARCH=PowerPC
4323         PLATFORMID=linux_powerpc
4324         ;;
4325     powerpc64)
4326         CPUNAME=POWERPC64
4327         RTL_ARCH=PowerPC_64
4328         PLATFORMID=linux_powerpc64
4329         ;;
4330     powerpc64le)
4331         CPUNAME=POWERPC64
4332         RTL_ARCH=PowerPC_64_LE
4333         PLATFORMID=linux_powerpc64_le
4334         ;;
4335     sparc)
4336         CPUNAME=SPARC
4337         RTL_ARCH=SPARC
4338         PLATFORMID=linux_sparc
4339         ;;
4340     s390)
4341         CPUNAME=S390
4342         RTL_ARCH=S390
4343         PLATFORMID=linux_s390
4344         ;;
4345     s390x)
4346         CPUNAME=S390X
4347         RTL_ARCH=S390x
4348         PLATFORMID=linux_s390x
4349         ;;
4350     x86_64)
4351         CPUNAME=X86_64
4352         RTL_ARCH=X86_64
4353         PLATFORMID=linux_x86_64
4354         ;;
4355     *)
4356         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4357         ;;
4358     esac
4359     ;;
4361 linux-android*)
4362     COM=GCC
4363     USING_X11=
4364     OS=ANDROID
4365     RTL_OS=Android
4366     P_SEP=:
4368     case "$host_cpu" in
4370     arm|armel)
4371         CPUNAME=ARM
4372         RTL_ARCH=ARM_EABI
4373         PLATFORMID=android_arm_eabi
4374         ;;
4375     aarch64)
4376         CPUNAME=AARCH64
4377         RTL_ARCH=AARCH64
4378         PLATFORMID=android_aarch64
4379         ;;
4380     mips|mipsel)
4381         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4382         RTL_ARCH=MIPS_EL
4383         PLATFORMID=android_mips_el
4384         ;;
4385     i*86)
4386         CPUNAME=INTEL
4387         RTL_ARCH=x86
4388         PLATFORMID=android_x86
4389         ;;
4390     *)
4391         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4392         ;;
4393     esac
4394     ;;
4396 emscripten*)
4397     COM=emcc
4398     USING_X11=
4399     OS=EMSCRIPTEN
4400     RTL_OS=Emscripten
4401     P_SEP=:
4402     CPUNAME=INTEL
4403     RTL_ARCH=x86
4404     PLATFORMID=linux_x86
4405     ;;
4407 mingw*)
4408     COM=GCC
4409     USING_X11=
4410     OS=WNT
4411     RTL_OS=Windows
4412     P_SEP=:
4414     case "$host_cpu" in
4415     i*86|x86_64)
4416         if test "$BITNESS_OVERRIDE" = 64; then
4417             CPUNAME=X86_64
4418             RTL_ARCH=X86_84
4419             PLATFORMID=windows_x86_64
4420             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4421         else
4422             CPUNAME=INTEL
4423             RTL_ARCH=x86
4424             PLATFORMID=windows_x86
4425             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4426         fi
4427         ;;
4428     *)
4429         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4430         ;;
4431     esac
4432     ;;
4434 *netbsd*)
4435     COM=GCC
4436     USING_X11=TRUE
4437     OS=NETBSD
4438     RTL_OS=NetBSD
4439     P_SEP=:
4441     case "$host_cpu" in
4442     i*86)
4443         CPUNAME=INTEL
4444         RTL_ARCH=x86
4445         PLATFORMID=netbsd_x86
4446         ;;
4447     powerpc)
4448         CPUNAME=POWERPC
4449         RTL_ARCH=PowerPC
4450         PLATFORMID=netbsd_powerpc
4451         ;;
4452     sparc)
4453         CPUNAME=SPARC
4454         RTL_ARCH=SPARC
4455         PLATFORMID=netbsd_sparc
4456         ;;
4457     x86_64)
4458         CPUNAME=X86_64
4459         RTL_ARCH=X86_64
4460         PLATFORMID=netbsd_x86_64
4461         ;;
4462     *)
4463         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4464         ;;
4465     esac
4466     ;;
4468 openbsd*)
4469     COM=GCC
4470     USING_X11=TRUE
4471     OS=OPENBSD
4472     RTL_OS=OpenBSD
4473     P_SEP=:
4475     case "$host_cpu" in
4476     i*86)
4477         CPUNAME=INTEL
4478         RTL_ARCH=x86
4479         PLATFORMID=openbsd_x86
4480         ;;
4481     x86_64)
4482         CPUNAME=X86_64
4483         RTL_ARCH=X86_64
4484         PLATFORMID=openbsd_x86_64
4485         ;;
4486     *)
4487         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4488         ;;
4489     esac
4490     SOLARINC="$SOLARINC -I/usr/local/include"
4491     ;;
4493 solaris*)
4494     COM=GCC
4495     USING_X11=TRUE
4496     OS=SOLARIS
4497     RTL_OS=Solaris
4498     P_SEP=:
4500     case "$host_cpu" in
4501     i*86)
4502         CPUNAME=INTEL
4503         RTL_ARCH=x86
4504         PLATFORMID=solaris_x86
4505         ;;
4506     sparc)
4507         CPUNAME=SPARC
4508         RTL_ARCH=SPARC
4509         PLATFORMID=solaris_sparc
4510         ;;
4511     sparc64)
4512         CPUNAME=SPARC64
4513         RTL_ARCH=SPARC64
4514         PLATFORMID=solaris_sparc64
4515         ;;
4516     *)
4517         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4518         ;;
4519     esac
4520     SOLARINC="$SOLARINC -I/usr/local/include"
4521     ;;
4524     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4525     ;;
4526 esac
4528 if test "$with_x" = "no"; then
4529     if test "$USING_X11" != TRUE; then
4530         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --without-x])
4531     fi
4532     USING_X11=
4535 WORKDIR="${BUILDDIR}/workdir"
4536 INSTDIR="${BUILDDIR}/instdir"
4537 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4538 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4539 AC_SUBST(COM)
4540 AC_SUBST(CPUNAME)
4541 AC_SUBST(RTL_OS)
4542 AC_SUBST(RTL_ARCH)
4543 AC_SUBST(EPM_FLAGS)
4544 AC_SUBST(USING_X11)
4545 AC_SUBST([INSTDIR])
4546 AC_SUBST([INSTROOT])
4547 AC_SUBST(OS)
4548 AC_SUBST(P_SEP)
4549 AC_SUBST(WORKDIR)
4550 AC_SUBST(PLATFORMID)
4551 AC_SUBST(WINDOWS_X64)
4552 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4554 dnl ===================================================================
4555 dnl Test which package format to use
4556 dnl ===================================================================
4557 AC_MSG_CHECKING([which package format to use])
4558 if test -n "$with_package_format" -a "$with_package_format" != no; then
4559     for i in $with_package_format; do
4560         case "$i" in
4561         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4562             ;;
4563         *)
4564             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4565 aix - AIX software distribution
4566 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4567 deb - Debian software distribution
4568 pkg - Solaris software distribution
4569 rpm - RedHat software distribution
4571 LibreOffice additionally supports:
4572 archive - .tar.gz or .zip
4573 dmg - Mac OS X .dmg
4574 installed - installation tree
4575 msi - Windows .msi
4576         ])
4577             ;;
4578         esac
4579     done
4580     PKGFORMAT="$with_package_format"
4581     AC_MSG_RESULT([$PKGFORMAT])
4582 else
4583     PKGFORMAT=
4584     AC_MSG_RESULT([none])
4586 AC_SUBST(PKGFORMAT)
4588 dnl ===================================================================
4589 dnl Set up a different compiler to produce tools to run on the build
4590 dnl machine when doing cross-compilation
4591 dnl ===================================================================
4593 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4594 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4595 if test "$cross_compiling" = "yes"; then
4596     AC_MSG_CHECKING([for BUILD platform configuration])
4597     echo
4598     rm -rf CONF-FOR-BUILD config_build.mk
4599     mkdir CONF-FOR-BUILD
4600     # Here must be listed all files needed when running the configure script. In particular, also
4601     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4602     # keep them in the same order as there.
4603     (cd $SRC_ROOT && tar cf - \
4604         config.guess \
4605         bin/get_config_variables \
4606         solenv/bin/getcompver.awk \
4607         solenv/inc/langlist.mk \
4608         config_host.mk.in \
4609         config_host_lang.mk.in \
4610         Makefile.in \
4611         lo.xcent.in \
4612         instsetoo_native/util/openoffice.lst.in \
4613         config_host/*.in \
4614         sysui/desktop/macosx/Info.plist.in \
4615         ios/lo.xcconfig.in) \
4616     | (cd CONF-FOR-BUILD && tar xf -)
4617     cp configure CONF-FOR-BUILD
4618     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4619     (
4620     unset COM USING_X11 OS CPUNAME
4621     unset CC CXX SYSBASE CFLAGS
4622     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4623     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4624     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4625     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4626     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4627     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4628     cd CONF-FOR-BUILD
4629     sub_conf_opts=""
4630     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4631     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4632     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4633     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4634     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4635     # we need the msi build tools on mingw if we are creating the
4636     # installation set
4637     if test "$WITH_MINGW" = "yes"; then
4638         enable_winegcc_for_build=
4639         for pkgformat in $PKGFORMAT; do
4640             case "$pkgformat" in
4641             msi|native) enable_winegcc_for_build=yes ;;
4642             esac
4643         done
4644         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4645     fi
4646     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4647     # Don't bother having configure look for stuff not needed for the build platform anyway
4648     ./configure \
4649         --disable-cups \
4650         --disable-graphite \
4651         --disable-gtk3 \
4652         --disable-pdfimport \
4653         --disable-postgresql-sdbc \
4654         --with-parallelism="$with_parallelism" \
4655         --without-doxygen \
4656         --without-java \
4657         $sub_conf_opts \
4658         --srcdir=$srcdir \
4659         2>&1 | sed -e 's/^/    /'
4660     test -f ./config_host.mk 2>/dev/null || exit
4661     cp config_host.mk ../config_build.mk
4662     cp config_host_lang.mk ../config_build_lang.mk
4663     mv config.log ../config.Build.log
4664     mkdir -p ../config_build
4665     mv config_host/*.h ../config_build
4666     . ./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
4668     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
4669         VV='$'$V
4670         VV=`eval "echo $VV"`
4671         if test -n "$VV"; then
4672             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4673             echo "$line" >>build-config
4674         fi
4675     done
4677     for V in INSTDIR INSTROOT WORKDIR; do
4678         VV='$'$V
4679         VV=`eval "echo $VV"`
4680         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4681         if test -n "$VV"; then
4682             line="${V}_FOR_BUILD='$VV'"
4683             echo "$line" >>build-config
4684         fi
4685     done
4687     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4688     echo "$line" >>build-config
4690     )
4691     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4692     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])
4693     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4694              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4696     eval `cat CONF-FOR-BUILD/build-config`
4698     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4700     rm -rf CONF-FOR-BUILD
4701 else
4702     OS_FOR_BUILD="$OS"
4703     CC_FOR_BUILD="$CC"
4704     CXX_FOR_BUILD="$CXX"
4705     INSTDIR_FOR_BUILD="$INSTDIR"
4706     INSTROOT_FOR_BUILD="$INSTROOT"
4707     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4708     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4709     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4710     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4711     WORKDIR_FOR_BUILD="$WORKDIR"
4713 AC_SUBST(OS_FOR_BUILD)
4714 AC_SUBST(INSTDIR_FOR_BUILD)
4715 AC_SUBST(INSTROOT_FOR_BUILD)
4716 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4717 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4718 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4719 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4720 AC_SUBST(WORKDIR_FOR_BUILD)
4722 dnl ===================================================================
4723 dnl Check for syslog header
4724 dnl ===================================================================
4725 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4727 # placeholder for future crash reporter feature
4728 ENABLE_CRASHDUMP=""
4729 AC_SUBST(ENABLE_CRASHDUMP)
4731 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4732 dnl ===================================================================
4733 AC_MSG_CHECKING([whether to turn warnings to errors])
4734 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4735     ENABLE_WERROR="TRUE"
4736     AC_MSG_RESULT([yes])
4737 else
4738     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4739         ENABLE_WERROR="TRUE"
4740         AC_MSG_RESULT([yes])
4741     else
4742         AC_MSG_RESULT([no])
4743     fi
4745 AC_SUBST(ENABLE_WERROR)
4747 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4748 dnl ===================================================================
4749 AC_MSG_CHECKING([whether to have assert to abort in release code])
4750 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4751     ASSERT_ALWAYS_ABORT="TRUE"
4752     AC_MSG_RESULT([yes])
4753 else
4754     ASSERT_ALWAYS_ABORT="FALSE"
4755     AC_MSG_RESULT([no])
4757 AC_SUBST(ASSERT_ALWAYS_ABORT)
4759 # Determine whether to use ooenv for the instdir installation
4760 # ===================================================================
4761 if test $_os != "WINNT" -a $_os != "Darwin"; then
4762     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4763     if test "$enable_ooenv" = "no"; then
4764         AC_MSG_RESULT([no])
4765     else
4766         ENABLE_OOENV="TRUE"
4767         AC_MSG_RESULT([yes])
4768     fi
4770 AC_SUBST(ENABLE_OOENV)
4772 if test "$USING_X11" != TRUE; then
4773     # be sure to do not mess with unneeded stuff
4774     test_randr=no
4775     test_xrender=no
4776     test_cups=no
4777     test_dbus=no
4778     test_gtk=no
4779     build_gstreamer_1_0=no
4780     build_gstreamer_0_10=no
4781     test_tde=no
4782     test_kde4=no
4783     enable_cairo_canvas=no
4786 dnl ===================================================================
4787 dnl check for cups support
4788 dnl ===================================================================
4789 ENABLE_CUPS=""
4791 if test "$enable_cups" = "no"; then
4792     test_cups=no
4795 AC_MSG_CHECKING([whether to enable CUPS support])
4796 if test "$test_cups" = "yes"; then
4797     ENABLE_CUPS="TRUE"
4798     AC_MSG_RESULT([yes])
4800     AC_MSG_CHECKING([whether cups support is present])
4801     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4802     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4803     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4804         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4805     fi
4806     AC_DEFINE(ENABLE_CUPS)
4807 else
4808     AC_MSG_RESULT([no])
4811 AC_SUBST(ENABLE_CUPS)
4813 # fontconfig checks
4814 if test "$test_fontconfig" = "yes"; then
4815     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4816     SYSTEM_FONTCONFIG=TRUE
4817     FilterLibs "${FONTCONFIG_LIBS}"
4818     FONTCONFIG_LIBS="${filteredlibs}"
4820 AC_SUBST(FONTCONFIG_CFLAGS)
4821 AC_SUBST(FONTCONFIG_LIBS)
4822 AC_SUBST([SYSTEM_FONTCONFIG])
4824 dnl whether to find & fetch external tarballs?
4825 dnl ===================================================================
4826 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4827    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4828        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4829    else
4830        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4831    fi
4833 if test -z "$TARFILE_LOCATION"; then
4834     if test -d "$SRC_ROOT/src" ; then
4835         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4836         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4837     fi
4838     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4839 else
4840     AbsolutePath "$TARFILE_LOCATION"
4841     PathFormat "${absolute_path}"
4842     TARFILE_LOCATION="${formatted_path}"
4844 AC_SUBST(TARFILE_LOCATION)
4846 AC_MSG_CHECKING([whether we want to fetch tarballs])
4847 if test "$enable_fetch_external" != "no"; then
4848     if test "$with_all_tarballs" = "yes"; then
4849         AC_MSG_RESULT(["yes, all of them"])
4850         DO_FETCH_TARBALLS="ALL"
4851     else
4852         AC_MSG_RESULT(["yes, if we use them"])
4853         DO_FETCH_TARBALLS="TRUE"
4854     fi
4855 else
4856     AC_MSG_RESULT([no])
4857     DO_FETCH_TARBALLS=
4859 AC_SUBST(DO_FETCH_TARBALLS)
4861 AC_MSG_CHECKING([whether to build help])
4862 HELP_COMMON_ONLY=FALSE
4863 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4864     BUILD_TYPE="$BUILD_TYPE HELP"
4865     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4866     if test "$with_help" = "common" ; then
4867         HELP_COMMON_ONLY=TRUE
4868         AC_MSG_RESULT([common only])
4869     else
4870         SCPDEFS="$SCPDEFS -DWITH_HELP"
4871         AC_MSG_RESULT([yes])
4872     fi
4873 else
4874     AC_MSG_RESULT([no])
4876 AC_SUBST(HELP_COMMON_ONLY)
4878 dnl Test whether to include MySpell dictionaries
4879 dnl ===================================================================
4880 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4881 if test "$with_myspell_dicts" = "yes"; then
4882     AC_MSG_RESULT([yes])
4883     WITH_MYSPELL_DICTS=TRUE
4884     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4885     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4886 else
4887     AC_MSG_RESULT([no])
4888     WITH_MYSPELL_DICTS=
4890 AC_SUBST(WITH_MYSPELL_DICTS)
4892 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4893 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4894     if test "$with_system_dicts" = yes; then
4895         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4896     fi
4897     with_system_dicts=no
4900 AC_MSG_CHECKING([whether to use dicts from external paths])
4901 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4902     AC_MSG_RESULT([yes])
4903     SYSTEM_DICTS=TRUE
4904     AC_MSG_CHECKING([for spelling dictionary directory])
4905     if test -n "$with_external_dict_dir"; then
4906         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4907     else
4908         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4909         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4910             DICT_SYSTEM_DIR=file:///usr/share/myspell
4911         fi
4912     fi
4913     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4914     AC_MSG_CHECKING([for hyphenation patterns directory])
4915     if test -n "$with_external_hyph_dir"; then
4916         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4917     else
4918         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4919     fi
4920     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4921     AC_MSG_CHECKING([for thesaurus directory])
4922     if test -n "$with_external_thes_dir"; then
4923         THES_SYSTEM_DIR=file://$with_external_thes_dir
4924     else
4925         THES_SYSTEM_DIR=file:///usr/share/mythes
4926     fi
4927     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4928 else
4929     AC_MSG_RESULT([no])
4930     SYSTEM_DICTS=
4932 AC_SUBST(SYSTEM_DICTS)
4933 AC_SUBST(DICT_SYSTEM_DIR)
4934 AC_SUBST(HYPH_SYSTEM_DIR)
4935 AC_SUBST(THES_SYSTEM_DIR)
4937 dnl ===================================================================
4938 dnl enable pch by default on windows
4939 dnl enable it explicitely otherwise
4940 AC_MSG_CHECKING([whether to enable pch feature])
4941 ENABLE_PCH=""
4942 if test "$enable_pch" != "no"; then
4943     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4944         ENABLE_PCH="TRUE"
4945         AC_MSG_RESULT([yes])
4946     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4947         ENABLE_PCH="TRUE"
4948         AC_MSG_RESULT([yes])
4949     elif test -n "$enable_pch"; then
4950         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4951     else
4952         AC_MSG_RESULT([no])
4953     fi
4954 else
4955     AC_MSG_RESULT([no])
4957 AC_SUBST(ENABLE_PCH)
4959 TAB=`printf '\t'`
4961 AC_MSG_CHECKING([the GNU Make version])
4962 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4963 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4964 if test "$_make_longver" -ge "038200"; then
4965     AC_MSG_RESULT([$GNUMAKE $_make_version])
4967 elif test "$_make_longver" -ge "038100"; then
4968     if test "$build_os" = "cygwin"; then
4969         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4970     fi
4971     AC_MSG_RESULT([$GNUMAKE $_make_version])
4973     dnl ===================================================================
4974     dnl Search all the common names for sha1sum
4975     dnl ===================================================================
4976     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4977     if test -z "$SHA1SUM"; then
4978         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4979     elif test "$SHA1SUM" = "openssl"; then
4980         SHA1SUM="openssl sha1"
4981     fi
4982     AC_MSG_CHECKING([for GNU Make bug 20033])
4983     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4984     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4985 A := \$(wildcard *.a)
4987 .PHONY: all
4988 all: \$(A:.a=.b)
4989 <TAB>@echo survived bug20033.
4991 .PHONY: setup
4992 setup:
4993 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4995 define d1
4996 @echo lala \$(1)
4997 @sleep 1
4998 endef
5000 define d2
5001 @echo tyty \$(1)
5002 @sleep 1
5003 endef
5005 %.b : %.a
5006 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5007 <TAB>\$(call d1,\$(CHECKSUM)),\
5008 <TAB>\$(call d2,\$(CHECKSUM)))
5010     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5011         no_parallelism_make="YES"
5012         AC_MSG_RESULT([yes, disable parallelism])
5013     else
5014         AC_MSG_RESULT([no, keep parallelism enabled])
5015     fi
5016     rm -rf $TESTGMAKEBUG20033
5017 else
5018     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5021 # find if gnumake support file function
5022 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5023 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5024 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5025     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5027 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5028 \$(file >test.txt,Success )
5030 .PHONY: all
5031 all:
5032 <TAB>@cat test.txt
5035 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5036 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5037     HAVE_GNUMAKE_FILE_FUNC=TRUE
5038     AC_MSG_RESULT([yes])
5039 else
5040     AC_MSG_RESULT([no])
5042 rm -rf $TESTGMAKEFILEFUNC
5043 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5044 AC_SUBST(GNUMAKE_WIN_NATIVE)
5046 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5047 STALE_MAKE=
5048 if test "$_make_ver_check" = ""; then
5049    STALE_MAKE=TRUE
5052 HAVE_LD_HASH_STYLE=FALSE
5053 WITH_LINKER_HASH_STYLE=
5054 AC_MSG_CHECKING( for --hash-style gcc linker support )
5055 if test "$GCC" = "yes"; then
5056     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5057         hash_styles="gnu sysv"
5058     elif test "$with_linker_hash_style" = "no"; then
5059         hash_styles=
5060     else
5061         hash_styles="$with_linker_hash_style"
5062     fi
5064     for hash_style in $hash_styles; do
5065         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5066         hash_style_ldflags_save=$LDFLAGS
5067         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5069         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5070             [
5071 #include <stdio.h>
5072             ],[
5073 printf ("");
5074             ])],
5075             [
5076                   HAVE_LD_HASH_STYLE=TRUE
5077                   WITH_LINKER_HASH_STYLE=$hash_style
5078             ],
5079             [HAVE_LD_HASH_STYLE=FALSE],
5080             [HAVE_LD_HASH_STYLE=FALSE])
5081         LDFLAGS=$hash_style_ldflags_save
5082     done
5084     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5085         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5086     else
5087         AC_MSG_RESULT( no )
5088     fi
5089     LDFLAGS=$hash_style_ldflags_save
5090 else
5091     AC_MSG_RESULT( no )
5093 AC_SUBST(HAVE_LD_HASH_STYLE)
5094 AC_SUBST(WITH_LINKER_HASH_STYLE)
5096 dnl ===================================================================
5097 dnl Check whether there's a Perl version available.
5098 dnl ===================================================================
5099 if test -z "$with_perl_home"; then
5100     AC_PATH_PROG(PERL, perl)
5101 else
5102     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5103     _perl_path="$with_perl_home/bin/perl"
5104     if test -x "$_perl_path"; then
5105         PERL=$_perl_path
5106     else
5107         AC_MSG_ERROR([$_perl_path not found])
5108     fi
5111 dnl ===================================================================
5112 dnl Testing for Perl version 5 or greater.
5113 dnl $] is the Perl version variable, it is returned as an integer
5114 dnl ===================================================================
5115 if test "$PERL"; then
5116     AC_MSG_CHECKING([the Perl version])
5117     ${PERL} -e "exit($]);"
5118     _perl_version=$?
5119     if test "$_perl_version" -lt 5; then
5120         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5121     fi
5122     AC_MSG_RESULT([checked (perl $_perl_version)])
5123 else
5124     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5127 dnl ===================================================================
5128 dnl Testing for required Perl modules
5129 dnl ===================================================================
5131 AC_MSG_CHECKING([for required Perl modules])
5132 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5133     AC_MSG_RESULT([all modules found])
5134 else
5135     AC_MSG_RESULT([failed to find some modules])
5136     # Find out which modules are missing.
5137     missing_perl_modules=
5138     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
5139         missing_perl_modules=Archive::Zip
5140     fi
5141     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5142         missing_perl_modules="$missing_perl_modules Cwd"
5143     fi
5144     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5145         missing_perl_modules="$missing_perl_modules Digest::MD5"
5146     fi
5147        AC_MSG_ERROR([
5148     The missing Perl modules are: $missing_perl_modules
5149     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5152 dnl ===================================================================
5153 dnl Check for pkg-config
5154 dnl ===================================================================
5155 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5156     PKG_PROG_PKG_CONFIG
5159 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5161     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5162     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5163     # explicitly. Or put /path/to/compiler in PATH yourself.
5165     # Use wrappers for LTO
5166     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5167         AC_CHECK_TOOL(AR,gcc-ar)
5168         AC_CHECK_TOOL(NM,gcc-nm)
5169         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5170     else
5171         AC_CHECK_TOOL(AR,ar)
5172         AC_CHECK_TOOL(NM,nm)
5173         AC_CHECK_TOOL(RANLIB,ranlib)
5174     fi
5175     AC_CHECK_TOOL(OBJDUMP,objdump)
5176     AC_CHECK_TOOL(READELF,readelf)
5177     AC_CHECK_TOOL(STRIP,strip)
5178     if test "$_os" = "WINNT"; then
5179         AC_CHECK_TOOL(DLLTOOL,dlltool)
5180         AC_CHECK_TOOL(WINDRES,windres)
5181     fi
5183 AC_SUBST(AR)
5184 AC_SUBST(DLLTOOL)
5185 AC_SUBST(NM)
5186 AC_SUBST(OBJDUMP)
5187 AC_SUBST(PKG_CONFIG)
5188 AC_SUBST(RANLIB)
5189 AC_SUBST(READELF)
5190 AC_SUBST(STRIP)
5191 AC_SUBST(WINDRES)
5193 dnl ===================================================================
5194 dnl pkg-config checks on Mac OS X
5195 dnl ===================================================================
5197 if test $_os = Darwin; then
5198     AC_MSG_CHECKING([for bogus pkg-config])
5199     if test -n "$PKG_CONFIG"; then
5200         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5201             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5202         else
5203             if test "$enable_bogus_pkg_config" = "yes"; then
5204                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5205             else
5206                 AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please modify your PATH variable so that $PKG_CONFIG is no longer found by configure scripts.])
5207             fi
5208         fi
5209     else
5210         AC_MSG_RESULT([no, good])
5211     fi
5214 find_csc()
5216     # Return value: $csctest
5218     unset csctest
5220     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5221     if test -n "$regvalue"; then
5222         csctest=$regvalue
5223         return
5224     fi
5227 find_al()
5229     # Return value: $altest
5231     unset altest
5233     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5234         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5235         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5236             altest=$regvalue
5237             return
5238         fi
5239     done
5242 find_dotnetsdk()
5244     # Return value: $frametest (that's a silly name...)
5246     unset frametest
5248     for ver in 1.1 2.0; do
5249         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5250         if test -n "$regvalue"; then
5251             frametest=$regvalue
5252             return
5253         fi
5254     done
5257 find_dotnetsdk46()
5259     unset frametest
5261     for ver in 4.6; do
5262         # TODO(davido): Do we need to take care about 32bit?
5263         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5264         if test -n "$regvalue"; then
5265             frametest=$regvalue
5266             return
5267         fi
5268     done
5271 find_winsdk_version()
5273     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5274     # Return values: $winsdktest, $winsdklibsubdir
5276     unset winsdktest winsdklibsubdir
5278     # Why we look for them in this particular order I don't know. But OTOH I
5279     case "$1" in
5280     7.*)
5281         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5282         if test -n "$regvalue"; then
5283             winsdktest=$regvalue
5284             winsdklibsubdir=.
5285             return
5286         fi
5287         ;;
5288     8.1|8.1A)
5289         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5290         if test -n "$regvalue"; then
5291             winsdktest=$regvalue
5292             winsdklibsubdir=winv6.3
5293             return
5294         fi
5295         ;;
5296     8.0|8.0A)
5297         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5298         if test -n "$regvalue"; then
5299             winsdktest=$regvalue
5300             winsdklibsubdir=win8
5301             return
5302         fi
5303         ;;
5304     10)
5305         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot10"
5306         if test -n "$regvalue"; then
5307             winsdktest=$regvalue
5308             winsdklibsubdir=10.0.10056.0
5309             return
5310         fi
5311         ;;
5312     esac
5315 find_winsdk()
5317     # Args: $1 (optional) : list of acceptable SDK versions
5318     # Return value: $winsdktest
5320     unset winsdktest
5322     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5323         find_winsdk_version $ver
5324         if test -n "$winsdktest"; then
5325             return
5326         fi
5327     done
5330 find_msms()
5332     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5333     AC_MSG_CHECKING([for $my_msm_file])
5334     msmdir=
5335     for ver in 12.0 14.0; do
5336         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5337         if test -n "$regvalue"; then
5338             if test -e "$regvalue/$my_msm_file"; then
5339                 msmdir=$regvalue
5340                 break
5341             fi
5342         fi
5343     done
5344     dnl Is the following fallback really necessary, or was it added in response
5345     dnl to never having started Visual Studio on a given machine, so the
5346     dnl registry keys checked above had presumably not yet been created?
5347     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5348     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5349     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5350     dnl expanding to "C:\Program Files\Common Files"), which would need
5351     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5352     dnl obtain its value from cygwin:
5353     if test -z "$msmdir"; then
5354         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5355         if test -e "$my_msm_dir/$my_msm_file"; then
5356             msmdir=$my_msm_dir
5357         fi
5358     fi
5359     if test -n "$msmdir"; then
5360         msmdir=`cygpath -m "$msmdir"`
5361         AC_MSG_RESULT([$msmdir])
5362     else
5363         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5364             AC_MSG_ERROR([not found])
5365         else
5366             AC_MSG_WARN([not found])
5367         fi
5368     fi
5371 find_msvc_x64_dlls()
5373     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5374     # http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
5375     # Refactored C Runtime (CRT): This CTP contains the first preview of the substantially refactored CRT.
5376     # msvcr140.dll no longer exists. It is replaced by a trio of DLLs: vcruntime140.dll, appcrt140.dll,
5377     # and desktopcrt140.dll.
5378     if test "$VCVER" = 140; then
5379        msvcdlls="msvcp${VCVER}.dll vcruntime${VCVER}.dll"
5380     else
5381        msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5382     fi
5383     for dll in $msvcdlls; do
5384         if ! test -f "$msvcdllpath/$dll"; then
5385             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5386         fi
5387     done
5390 if test "$build_os" = "cygwin"; then
5391     dnl Check midl.exe
5392     AC_MSG_CHECKING([for midl.exe])
5394     find_winsdk
5395     if test -f "$winsdktest/Bin/midl.exe"; then
5396         MIDL_PATH="$winsdktest/Bin"
5397     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5398         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5399     fi
5400     if test ! -f "$MIDL_PATH/midl.exe"; then
5401         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5402     else
5403         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5404     fi
5406     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5407     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5409     dnl Check csc.exe
5410     AC_MSG_CHECKING([for csc.exe])
5411     find_csc
5412     if test -f "$csctest/csc.exe"; then
5413         CSC_PATH="$csctest"
5414     fi
5415     if test ! -f "$CSC_PATH/csc.exe"; then
5416         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5417     else
5418         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5419     fi
5421     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5423     dnl Check al.exe
5424     AC_MSG_CHECKING([for al.exe])
5425     find_winsdk
5426     if test -f "$winsdktest/Bin/al.exe"; then
5427         AL_PATH="$winsdktest/Bin"
5428     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5429         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5430     fi
5432     if test -z "$AL_PATH"; then
5433         find_al
5434         if test -f "$altest/bin/al.exe"; then
5435             AL_PATH="$altest/bin"
5436         elif test -f "$altest/al.exe"; then
5437             AL_PATH="$altest"
5438         fi
5439     fi
5440     if test ! -f "$AL_PATH/al.exe"; then
5441         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5442     else
5443         AC_MSG_RESULT([$AL_PATH/al.exe])
5444     fi
5446     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5448     dnl Check mscoree.lib / .NET Framework dir
5449     AC_MSG_CHECKING(.NET Framework find_dotnetsdk)
5450     find_dotnetsdk
5451     if test -f "$frametest/lib/mscoree.lib"; then
5452         DOTNET_FRAMEWORK_HOME="$frametest"
5453     else
5454         AC_MSG_CHECKING(.NET Framework find_winsdk)
5455         find_winsdk
5456         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5457             DOTNET_FRAMEWORK_HOME="$winsdktest"
5458         else
5459             AC_MSG_CHECKING(.NET Framework find_dotnetsdk46)
5460             find_dotnetsdk46
5461             PathFormat "$frametest"
5462             frametest="$formatted_path"
5463             AC_MSG_CHECKING(found: $frametest/um/$WINDOWS_SDK_ARCH/mscoree.lib)
5464             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5465                  DOTNET_FRAMEWORK_HOME="$frametest"
5466             fi
5467         fi
5468     fi
5470     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5471         AC_MSG_ERROR([mscoree.lib not found])
5472     fi
5473     AC_MSG_RESULT(found)
5475     PathFormat "$MIDL_PATH"
5476     MIDL_PATH="$formatted_path"
5478     PathFormat "$AL_PATH"
5479     AL_PATH="$formatted_path"
5481     PathFormat "$DOTNET_FRAMEWORK_HOME"
5482     DOTNET_FRAMEWORK_HOME="$formatted_path"
5484     PathFormat "$CSC_PATH"
5485     CSC_PATH="$formatted_path"
5488 dnl ===================================================================
5489 dnl Check if stdc headers are available excluding MSVC.
5490 dnl ===================================================================
5491 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5492     AC_HEADER_STDC
5495 dnl ===================================================================
5496 dnl Testing for C++ compiler and version...
5497 dnl ===================================================================
5499 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5500     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5501     save_CXXFLAGS=$CXXFLAGS
5502     AC_PROG_CXX
5503     CXXFLAGS=$save_CXXFLAGS
5504 else
5505     if test -n "$CC" -a -z "$CXX"; then
5506         CXX="$CC"
5507     fi
5510 dnl check for GNU C++ compiler version
5511 if test "$GXX" = "yes" -a "$CXX" != "emcc"; then
5512     AC_MSG_CHECKING([the GNU C++ compiler version])
5514     _gpp_version=`$CXX -dumpversion`
5515     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5517     if test "$_gpp_majmin" -lt "401"; then
5518         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5519     else
5520         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5521     fi
5523     dnl see https://code.google.com/p/android/issues/detail?id=41770
5524     if test "$_gpp_majmin" -ge "401"; then
5525         glibcxx_threads=no
5526         AC_LANG_PUSH([C++])
5527         AC_REQUIRE_CPP
5528         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5529         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5530             #include <bits/c++config.h>]],[[
5531             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5532             && !defined(_GLIBCXX__PTHREADS) \
5533             && !defined(_GLIBCXX_HAS_GTHREADS)
5534             choke me
5535             #endif
5536         ]])],[AC_MSG_RESULT([yes])
5537         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5538         AC_LANG_POP([C++])
5539         if test $glibcxx_threads = yes; then
5540             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5541         fi
5542      fi
5544 AC_SUBST(BOOST_CXXFLAGS)
5547 # prefx CXX with ccache if needed
5549 if test "$CCACHE" != ""; then
5550     AC_MSG_CHECKING([whether $CXX is already ccached])
5551     AC_LANG_PUSH([C++])
5552     save_CXXFLAGS=$CXXFLAGS
5553     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5554     dnl an empty program will do, we're checking the compiler flags
5555     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5556                       [use_ccache=yes], [use_ccache=no])
5557     if test $use_ccache = yes; then
5558         AC_MSG_RESULT([yes])
5559     else
5560         CXX="$CCACHE $CXX"
5561         AC_MSG_RESULT([no])
5562     fi
5563     CXXFLAGS=$save_CXXFLAGS
5564     AC_LANG_POP([C++])
5567 dnl ===================================================================
5568 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5569 dnl ===================================================================
5571 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5572     AC_PROG_CXXCPP
5574     dnl Check whether there's a C pre-processor.
5575     AC_PROG_CPP
5579 dnl ===================================================================
5580 dnl Find integral type sizes and alignments
5581 dnl ===================================================================
5583 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5585     AC_CHECK_SIZEOF(long)
5586     AC_CHECK_SIZEOF(short)
5587     AC_CHECK_SIZEOF(int)
5588     AC_CHECK_SIZEOF(long long)
5589     AC_CHECK_SIZEOF(double)
5590     AC_CHECK_SIZEOF(void*)
5592     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5593     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5594     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5595     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5596     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5598     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5599     m4_pattern_allow([AC_CHECK_ALIGNOF])
5600     m4_ifdef([AC_CHECK_ALIGNOF],
5601         [
5602             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5603             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5604             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5605             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5606         ],
5607         [
5608             case "$_os-$host_cpu" in
5609             Linux-i686)
5610                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5611                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5612                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5613                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5614                 ;;
5615             Linux-x86_64)
5616                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5617                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5618                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5619                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5620                 ;;
5621             *)
5622                 if test -z "$ac_cv_alignof_short" -o \
5623                         -z "$ac_cv_alignof_int" -o \
5624                         -z "$ac_cv_alignof_long" -o \
5625                         -z "$ac_cv_alignof_double"; then
5626                    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.])
5627                 fi
5628                 ;;
5629             esac
5630         ])
5632     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5633     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5634     if test $ac_cv_sizeof_long -eq 8; then
5635         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5636     elif test $ac_cv_sizeof_double -eq 8; then
5637         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5638     else
5639         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5640     fi
5642     dnl Check for large file support
5643     AC_SYS_LARGEFILE
5644     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5645         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5646     fi
5647     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5648         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5649     fi
5650 else
5651     # Hardcode for MSVC
5652     SAL_TYPES_SIZEOFSHORT=2
5653     SAL_TYPES_SIZEOFINT=4
5654     SAL_TYPES_SIZEOFLONG=4
5655     SAL_TYPES_SIZEOFLONGLONG=8
5656     if test "$BITNESS_OVERRIDE" = ""; then
5657         SAL_TYPES_SIZEOFPOINTER=4
5658     else
5659         SAL_TYPES_SIZEOFPOINTER=8
5660     fi
5661     SAL_TYPES_ALIGNMENT2=2
5662     SAL_TYPES_ALIGNMENT4=4
5663     SAL_TYPES_ALIGNMENT8=8
5664     LFS_CFLAGS=''
5666 AC_SUBST(LFS_CFLAGS)
5668 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5669 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5670 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5671 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5672 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5673 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5674 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5675 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5677 dnl ===================================================================
5678 dnl Check whether to enable runtime optimizations
5679 dnl ===================================================================
5680 ENABLE_RUNTIME_OPTIMIZATIONS=
5681 AC_MSG_CHECKING([whether to enable runtime optimizations])
5682 if test -z "$enable_runtime_optimizations"; then
5683     for i in $CC; do
5684         case $i in
5685         -fsanitize=*)
5686             enable_runtime_optimizations=no
5687             break
5688             ;;
5689         esac
5690     done
5692 if test "$enable_runtime_optimizations" != no; then
5693     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5694     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5695     AC_MSG_RESULT([yes])
5696 else
5697     AC_MSG_RESULT([no])
5699 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5701 dnl ===================================================================
5702 dnl Check if valgrind headers are available
5703 dnl ===================================================================
5704 ENABLE_VALGRIND=
5705 if test "$cross_compiling" != yes; then
5706     prev_cppflags=$CPPFLAGS
5707     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5708     # or where does it come from?
5709     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5710     AC_CHECK_HEADER([valgrind/valgrind.h],
5711         [ENABLE_VALGRIND=TRUE])
5712     CPPFLAGS=$prev_cppflags
5714 AC_SUBST([ENABLE_VALGRIND])
5715 if test -z "$ENABLE_VALGRIND"; then
5716     VALGRIND_CFLAGS=
5718 AC_SUBST([VALGRIND_CFLAGS])
5721 dnl ===================================================================
5722 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5723 dnl ===================================================================
5725 # We need at least the sys/sdt.h include header.
5726 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5727 if test "$SDT_H_FOUND" = "TRUE"; then
5728     # Found sys/sdt.h header, now make sure the c++ compiler works.
5729     # Old g++ versions had problems with probes in constructors/destructors.
5730     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5731     AC_LANG_PUSH([C++])
5732     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5733     #include <sys/sdt.h>
5734     class ProbeClass
5735     {
5736     private:
5737       int& ref;
5738       const char *name;
5740     public:
5741       ProbeClass(int& v, const char *n) : ref(v), name(n)
5742       {
5743         DTRACE_PROBE2(_test_, cons, name, ref);
5744       }
5746       void method(int min)
5747       {
5748         DTRACE_PROBE3(_test_, meth, name, ref, min);
5749         ref -= min;
5750       }
5752       ~ProbeClass()
5753       {
5754         DTRACE_PROBE2(_test_, dest, name, ref);
5755       }
5756     };
5757     ]],[[
5758     int i = 64;
5759     DTRACE_PROBE1(_test_, call, i);
5760     ProbeClass inst = ProbeClass(i, "call");
5761     inst.method(24);
5762     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5763           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5764     AC_LANG_POP([C++])
5766 AC_CONFIG_HEADERS([config_host/config_probes.h])
5768 dnl ===================================================================
5769 dnl Set the MinGW sys-root
5770 dnl ===================================================================
5771 if test "$WITH_MINGW" = "yes"; then
5772     AC_MSG_CHECKING([for MinGW sysroot])
5773     sysroot=`$CC -print-sysroot`
5774     AS_IF([test -d "$sysroot"/mingw],
5775           [MINGW_SYSROOT="$sysroot"/mingw
5776            AC_MSG_RESULT([$MINGW_SYSROOT])],
5777           [AC_MSG_RESULT([not found])
5778            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5780 AC_SUBST([MINGW_DLLS])
5781 AC_SUBST([MINGW_SYSROOT])
5783 dnl ===================================================================
5784 dnl Set the MinGW include directories
5785 dnl ===================================================================
5786 if test "$WITH_MINGW" = "yes"; then
5787     AC_MSG_CHECKING([for MinGW include path])
5788     cat >conftest.$ac_ext <<_ACEOF
5789 #include <stddef.h>
5790 #include <bits/c++config.h>
5791 _ACEOF
5792     _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`
5793     rm conftest.$ac_ext
5794     if test -z "$_mingw_lib_include_path"; then
5795         _mingw_lib_include_path="NO_LIB_INCLUDE"
5796         AC_MSG_RESULT([no MinGW include path])
5797     else
5798         AC_MSG_RESULT([$_mingw_lib_include_path])
5799     fi
5800     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5801     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5803     AC_LANG_PUSH([C++])
5805     AC_MSG_CHECKING([for dynamic libgcc])
5806     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5807 #include <iostream>
5808 using namespace std;
5809 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5810             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5811             if test -n "$MINGW_GCCDLL"; then
5812                 MINGW_SHARED_GCCLIB=TRUE
5813                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5814             else
5815                 MINGW_SHARED_GCCLIB=
5816                 AC_MSG_RESULT([no])
5817             fi
5818        ],[ AC_MSG_RESULT([no])
5820     ])
5822     AC_MSG_CHECKING([for dynamic libstdc++])
5823     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5824 #include <iostream>
5825 using namespace std;
5826 ]], [[ cout << "Hello there." << endl; ]])],[
5827             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5828             if test -n "$MINGW_GXXDLL"; then
5829                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5830                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5831                 if test "$CROSS_COMPILING" = "TRUE"; then
5832                     dnl m4 escaping!
5833                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5834                 fi
5835                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5836                 MINGW_SHARED_GXXLIB=TRUE
5837                 AC_MSG_RESULT([$MINGW_GXXDLL])
5838             else
5839                 MINGW_SHARED_GXXLIB=
5840                 AC_MSG_RESULT([no])
5841             fi
5842        ],[ AC_MSG_RESULT([no])
5844     ])
5846     AC_LANG_POP([C++])
5848     AC_SUBST(MINGW_SHARED_GCCLIB)
5849     AC_SUBST(MINGW_SHARED_GXXLIB)
5850     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5851     AC_SUBST(MINGW_GCCDLL)
5852     AC_SUBST(MINGW_GXXDLL)
5855 dnl *************************************************************
5856 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5857 dnl *************************************************************
5858 if test "$WITH_MINGW" = "yes"; then
5859     AC_MSG_CHECKING([exception type])
5860     AC_LANG_PUSH([C++])
5861     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5863         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5865         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5866     ])
5867     AC_MSG_RESULT($exceptions_type)
5868     AC_LANG_POP([C++])
5871 EXCEPTIONS="$exceptions_type"
5872 AC_SUBST(EXCEPTIONS)
5874 dnl ===================================================================
5875 dnl thread-safe statics
5876 dnl ===================================================================
5877 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5878 unset HAVE_THREADSAFE_STATICS
5879 if test "$GCC" = "yes"; then
5880     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5881     dnl us.  However, some C++ runtimes use a single lock for all static
5882     dnl variables, which can cause deadlock in multi-threaded applications.
5883     dnl This is not easily tested here; for POSIX-based systems, if executing
5884     dnl the following C++ program does not terminate then the tool chain
5885     dnl apparently has this problem:
5886     dnl
5887     dnl   #include <pthread.h>
5888     dnl   int h() { return 0; }
5889     dnl   void * g(void * unused) {
5890     dnl     static int n = h();
5891     dnl     return &n;
5892     dnl   }
5893     dnl   int f() {
5894     dnl     pthread_t t;
5895     dnl     pthread_create(&t, 0, g, 0);
5896     dnl     pthread_join(t, 0);
5897     dnl     return 0;
5898     dnl   }
5899     dnl   int main() {
5900     dnl     static int n = f();
5901     dnl     return n;
5902     dnl   }
5903     dnl
5904     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5905     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5906     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5907     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5908     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5909     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5910     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5911     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5912     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5913     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5914     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5915     dnl "too old"):
5916     if test "$_os" = Darwin; then
5917         dnl On Mac OS X, both /usr/lib/libstdc++.6.dylib and
5918         dnl /usr/lib/libc++1.dylib delegate to /usr/lib/libc++abi.dylib for the
5919         dnl __cxa_guard_* functionality; up to 10.8, libc++abi.dylib is
5920         dnl apparently provided by a libcppabi project that has broken semantics
5921         dnl (cf. <http://www.opensource.apple.com/source/libcppabi/libcppabi-26/
5922         dnl src/cxa_guard.cxx>), while in 10.9 (verified at least on 10.9.4) it
5923         dnl is apparently provided by LLVM's libcxxabi project, which has good
5924         dnl semantics (cf. <http://llvm.org/svn/llvm-project/libcxxabi/trunk/
5925         dnl src/cxa_guard.cpp>):
5926         if test "$MAC_OS_X_VERSION_MIN_REQUIRED" -ge 1090; then
5927             HAVE_THREADSAFE_STATICS=TRUE
5928         fi
5929     elif test "$_os" != Android; then
5930         if test "$COM_IS_CLANG" = TRUE; then
5931             AC_LANG_PUSH([C++])
5932             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5933 #include <list>
5934 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5935 #error
5936 #endif
5937                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5938             AC_LANG_POP([C++])
5939         else # known to work in GCC since version 4.3
5940             HAVE_THREADSAFE_STATICS=TRUE
5941         fi
5942     fi
5943     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5944         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5945         AC_MSG_RESULT([yes])
5946     else
5947         AC_MSG_RESULT([broken (i.e., no)])
5948     fi
5949 else
5950     # MSVC has sprouted C++11 thread-safe statics in 2015
5951     # http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
5952     if test "$COM" = "MSC" -a "$VCVER" -ge "140"; then
5953         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5954         AC_MSG_RESULT([yes])
5955     else
5956         AC_MSG_RESULT([no])
5957     fi
5959 AC_SUBST(HAVE_THREADSAFE_STATICS)
5961 dnl ===================================================================
5962 dnl visibility and other gcc features
5963 dnl ===================================================================
5964 if test "$GCC" = "yes"; then
5965     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5966     save_CFLAGS=$CFLAGS
5967     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5968     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5969     CFLAGS=$save_CFLAGS
5971     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5972         AC_MSG_RESULT([yes])
5973     else
5974         AC_MSG_RESULT([no])
5975     fi
5977     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5978     save_CFLAGS=$CFLAGS
5979     CFLAGS="$CFLAGS -Werror -mno-avx"
5980     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5981     CFLAGS=$save_CFLAGS
5982     if test "$HAVE_GCC_AVX" = "TRUE"; then
5983         AC_MSG_RESULT([yes])
5984     else
5985         AC_MSG_RESULT([no])
5986     fi
5988     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5989     save_CFLAGS=$CFLAGS
5990     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5991     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5992     CFLAGS=$save_CFLAGS
5993     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5994         AC_MSG_RESULT([yes])
5995     else
5996         AC_MSG_RESULT([no])
5997     fi
5999     AC_MSG_CHECKING([whether $CC supports atomic functions])
6000     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6001     int v = 0;
6002     if (__sync_add_and_fetch(&v, 1) != 1 ||
6003         __sync_sub_and_fetch(&v, 1) != 0)
6004         return 1;
6005     __sync_synchronize();
6006     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6007         v != 1)
6008         return 1;
6009     return 0;
6010 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6011     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6012         AC_MSG_RESULT([yes])
6013         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6014     else
6015         AC_MSG_RESULT([no])
6016     fi
6018     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6019     save_CFLAGS=$CFLAGS
6020     CFLAGS="$CFLAGS -Werror"
6021     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6022             __attribute__((deprecated("test"))) void f();
6023         ])], [
6024             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6025             AC_MSG_RESULT([yes])
6026         ], [AC_MSG_RESULT([no])])
6027     CFLAGS=$save_CFLAGS
6029     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6030     AC_LANG_PUSH([C++])
6031     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6032             #include <cxxabi.h>
6033             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6034         ])], [
6035             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6036             AC_MSG_RESULT([yes])
6037         ], [AC_MSG_RESULT([no])])
6038     AC_LANG_POP([C++])
6040     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6041     AC_LANG_PUSH([C++])
6042     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6043             #include <cxxabi.h>
6044             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6045         ])], [
6046             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
6047             AC_MSG_RESULT([yes])
6048         ], [AC_MSG_RESULT([no])])
6049     AC_LANG_POP([C++])
6051     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6052     AC_LANG_PUSH([C++])
6053     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6054             #include <cxxabi.h>
6055             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6056         ])], [
6057             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
6058             AC_MSG_RESULT([yes])
6059         ], [AC_MSG_RESULT([no])])
6060     AC_LANG_POP([C++])
6062     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6063     AC_LANG_PUSH([C++])
6064     save_CXXFLAGS=$CXXFLAGS
6065     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
6066     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6067             #include <string>
6068             void f() { std::string s; }
6069         ])], [
6070             AC_MSG_RESULT([no])
6071         ], [
6072             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6073             AC_MSG_RESULT([yes])])
6074     CXXFLAGS=$save_CXXFLAGS
6075     AC_LANG_POP([C++])
6078 AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6079 AC_LANG_PUSH([C++])
6080 save_CXXFLAGS=$CXXFLAGS
6081 CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
6082 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6083         struct __attribute__((warn_unused)) dummy {};
6084     ])], [
6085         AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6086         AC_MSG_RESULT([yes])
6087     ], [AC_MSG_RESULT([no])])
6088 CXXFLAGS=$save_CXXFLAGS
6089 AC_LANG_POP([C++])
6091 AC_SUBST(HAVE_GCC_AVX)
6092 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6093 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6095 dnl ===================================================================
6096 dnl Identify the C++ library
6097 dnl ===================================================================
6099 AC_MSG_CHECKING([What the C++ library is])
6100 AC_LANG_PUSH([C++])
6101 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6102 #include <utility>
6103 #ifndef __GLIBCXX__
6104 foo bar
6105 #endif
6106 ]])],
6107     [CPP_LIBRARY=GLIBCXX
6108      cpp_library_name="GNU libstdc++"
6109     ],
6110     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6111 #include <utility>
6112 #ifndef _LIBCPP_VERSION
6113 foo bar
6114 #endif
6115 ]])],
6116     [CPP_LIBRARY=LIBCPP
6117      cpp_library_name="LLVM libc++"
6118     ],
6119     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6120 #include <utility>
6121 #ifndef _MSC_VER
6122 foo bar
6123 #endif
6124 ]])],
6125     [CPP_LIBRARY=MSVCRT
6126      cpp_library_name="Microsoft"
6127     ],
6128     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6129 AC_MSG_RESULT([$cpp_library_name])
6130 AC_LANG_POP([C++])
6132 dnl ===================================================================
6133 dnl C++11
6134 dnl ===================================================================
6136 CXXFLAGS_CXX11=
6137 if test "$COM" = MSC; then
6138     AC_MSG_CHECKING([whether $CXX supports C++11])
6139     AC_MSG_RESULT(yes)
6140     # MSVC supports (a subset of) CXX11 without any switch
6141 elif test "$GCC" = "yes"; then
6142     HAVE_CXX11=
6143     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
6144     for flag in -std=gnu++14 -std=gnu++1y -std=c++14 -std=c++1y -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do
6145         save_CXXFLAGS=$CXXFLAGS
6146         CXXFLAGS="$CXXFLAGS $flag -Werror"
6147         AC_LANG_PUSH([C++])
6148         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6149             #include <algorithm>
6150             #include <functional>
6151             #include <vector>
6152             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6153                 std::sort(v.begin(), v.end(), fn);
6154             }
6155             ]])],[CXXFLAGS_CXX11=$flag])
6156         AC_LANG_POP([C++])
6157         CXXFLAGS=$save_CXXFLAGS
6158         if test -n "$CXXFLAGS_CXX11"; then
6159             HAVE_CXX11=TRUE
6160             break
6161         fi
6162     done
6163     if test "$HAVE_CXX11" = TRUE; then
6164         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6165     else
6166         AC_MSG_ERROR(no)
6167     fi
6170 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6171 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6172 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6173 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6174 dnl again towards 4.7.2:
6175 if test $CPP_LIBRARY = GLIBCXX; then
6176     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6177     AC_LANG_PUSH([C++])
6178     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6179 #include <list>
6180 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6181     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6182     //   GCC 4.7.0: 20120322
6183     //   GCC 4.7.1: 20120614
6184     // and using a range check is not possible as the mapping between
6185     // __GLIBCXX__ values and GCC versions is not monotonic
6186 /* ok */
6187 #else
6188 abi broken
6189 #endif
6190         ]])], [AC_MSG_RESULT(no, ok)],
6191         [AC_MSG_ERROR(yes)])
6192     AC_LANG_POP([C++])
6195 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6196 save_CXXFLAGS=$CXXFLAGS
6197 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6198 AC_LANG_PUSH([C++])
6200 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6201 #include <stddef.h>
6203 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6205 namespace
6207         struct b
6208         {
6209                 int i;
6210                 int j;
6211         };
6213 ]], [[
6214 struct a
6216         int i;
6217         int j;
6219 a thinga[]={{0,0}, {1,1}};
6220 b thingb[]={{0,0}, {1,1}};
6221 size_t i = sizeof(sal_n_array_size(thinga));
6222 size_t j = sizeof(sal_n_array_size(thingb));
6223 return !(i != 0 && j != 0);
6225     ], [ AC_MSG_RESULT(yes) ],
6226     [ AC_MSG_ERROR(no)])
6227 AC_LANG_POP([C++])
6228 CXXFLAGS=$save_CXXFLAGS
6230 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6231 save_CXXFLAGS=$CXXFLAGS
6232 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6233 AC_LANG_PUSH([C++])
6235 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6236 #include <vector>
6237     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6238     // (__float128)
6240     ],[ AC_MSG_RESULT(yes) ],
6241     [
6242         AC_MSG_RESULT(no)
6243         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6244         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6245         # __float128 is available during its build, but it's usually built using GCC,
6246         # and so c++config.h hardcodes __float128 being supported). As the only place
6247         # where __float128 is actually used is in a template specialization,
6248         # -D__float128=void will avoid the problem there while still causing a problem
6249         # if somebody actually uses the type.
6250         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6251         CXXFLAGS="$CXXFLAGS -D__float128=void"
6252         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6253 #include <vector>
6254     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6255     // (__float128)
6257     ],
6258     [
6259      AC_MSG_RESULT(yes)
6260      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6261     ],
6262     [
6263      AC_MSG_ERROR(no)
6264     ])
6267 AC_LANG_POP([C++])
6268 CXXFLAGS=$save_CXXFLAGS
6270 AC_SUBST(CXXFLAGS_CXX11)
6272 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6273 save_CXXFLAGS=$CXXFLAGS
6274 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6275 AC_LANG_PUSH([C++])
6276 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6277     struct S {
6278         int n_;
6279         constexpr S(int n): n_(n) {}
6280     };
6281     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6282 AC_LANG_POP([C++])
6283 CXXFLAGS=$save_CXXFLAGS
6284 AC_MSG_RESULT([$cxx11_constexpr])
6285 if test "$cxx11_constexpr" = yes; then
6286     AC_DEFINE([HAVE_CXX11_CONSTEXPR])
6289 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6290 save_CXXFLAGS=$CXXFLAGS
6291 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6292 if test "$ENABLE_DEBUG" != TRUE -a "$ENABLE_DBGUTIL" != TRUE \
6293     -a "$ASSERT_ALWAYS_ABORT" != TRUE
6294 then
6295     CXXFLAGS="$CXXFLAGS -DNDEBUG"
6297 AC_LANG_PUSH([C++])
6298 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6299     // A somewhat over-complicated way of checking for
6300     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6301     // in constexpr function":
6302     #include <cassert>
6303     template<typename T> inline constexpr T f(T x) { return x; }
6304     template<typename T> inline constexpr T g(T x) {
6305         assert(f(static_cast<int>(x)));
6306         return x;
6307     }
6308     enum E { e };
6309     auto v = g(E::e);
6311     struct S {
6312         int n_;
6313         constexpr bool f() {
6314             int n = n_;
6315             int i = 0;
6316             while (n > 0) { --n; ++i; }
6317             return i == 0;
6318         }
6319     };
6320     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6321 AC_LANG_POP([C++])
6322 CXXFLAGS=$save_CXXFLAGS
6323 AC_MSG_RESULT([$cxx14_constexpr])
6324 if test "$cxx14_constexpr" = yes; then
6325     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6328 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6329 save_CXXFLAGS=$CXXFLAGS
6330 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6331 AC_LANG_PUSH([C++])
6332 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6333     struct S {
6334         void f() &;
6335         void f() &&;
6336     };
6337     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6338 AC_LANG_POP([C++])
6339 CXXFLAGS=$save_CXXFLAGS
6340 AC_MSG_RESULT([$cxx11_ref_qualifier])
6341 if test "$cxx11_ref_qualifier" = yes; then
6342     AC_DEFINE([HAVE_CXX11_REF_QUALIFIER])
6345 AC_MSG_CHECKING([whether $CXX supports C++14 sized deallocation])
6346 dnl At least Clang -fsanitize=address causes "multiple definition of
6347 dnl `operator delete(void*, unsigned long)'" also defined in
6348 dnl projects/compiler-rt/lib/asan/asan_new_delete.cc:
6349 save_CXX=$CXX
6350 if test "$COM_IS_CLANG" = TRUE; then
6351     my_CXX=
6352     for i in $CXX; do
6353         case $i in
6354         -fsanitize=address)
6355             ;;
6356         *)
6357             my_CXX="$my_CXX $i"
6358             ;;
6359         esac
6360     done
6361     CXX=$my_CXX
6363 save_CXXFLAGS=$CXXFLAGS
6364 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6365 AC_LANG_PUSH([C++])
6366 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
6367     #include <cstddef>
6368     #include <cstdlib>
6369     void operator delete(void *) throw () { std::exit(1); }
6370     void operator delete(void *, std::size_t) throw () { std::exit(0); }
6371     struct S { S() { throw 0; } };
6372     ]],[[
6373     try { new S; } catch (...) {}
6374     return 1;
6375     ]])], [cxx14_sized_deallocation=yes], [cxx14_sized_deallocation=no], [cxx14_sized_deallocation=no])
6376 AC_LANG_POP([C++])
6377 CXX=$save_CXX
6378 CXXFLAGS=$save_CXXFLAGS
6379 AC_MSG_RESULT([$cxx14_sized_deallocation])
6380 if test "$cxx14_sized_deallocation" = yes; then
6381     AC_DEFINE([HAVE_CXX14_SIZED_DEALLOCATION])
6384 HAVE_GCC_PRAGMA_OPERATOR=
6385 dnl _Pragma support (may require C++11)
6386 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6387     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6388     AC_LANG_PUSH([C++])
6389     save_CXXFLAGS=$CXXFLAGS
6390     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6391     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6392             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6393         ])], [
6394             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6395             HAVE_GCC_PRAGMA_OPERATOR=1
6396             AC_MSG_RESULT([yes])
6397         ], [AC_MSG_RESULT([no])])
6398     AC_LANG_POP([C++])
6399     CXXFLAGS=$save_CXXFLAGS
6401 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6403 dnl ===================================================================
6404 dnl system stl sanity tests
6405 dnl ===================================================================
6406 HAVE_GCC_VISIBILITY_BROKEN=
6407 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6409     AC_LANG_PUSH([C++])
6411     save_CPPFLAGS="$CPPFLAGS"
6412     if test -n "$MACOSX_SDK_PATH"; then
6413         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6414     fi
6416     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6417     # only.
6418     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6419         dnl gcc#19664, gcc#22482, rhbz#162935
6420         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6421         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6422         AC_MSG_RESULT([$stlvisok])
6423         if test "$stlvisok" = "no"; then
6424             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6425             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6426             unset HAVE_GCC_VISIBILITY_FEATURE
6427         fi
6428     fi
6430     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6431         sharedlink_ldflags_save=$LDFLAGS
6432         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6434         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6435         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6436 #include <sstream>
6437 using namespace std;
6438             ]], [[
6439 istringstream strm( "test" ); return 0;
6440             ]])],
6441             # Ugh, surely bad to assume an error message will contain
6442             # the word "unresolvable", a problem with
6443             # -fvisibility-inlines-hidden and STL headers might cause
6444             # some more obscure message on some platform, and anway,
6445             # the error message could be localised.
6446             [$EGREP -q unresolvable conftest.err;
6447             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6448         ])
6449         AC_MSG_RESULT([$gccvisok])
6450         if test "$gccvisok" = "no"; then
6451             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6452             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6453             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6454         fi
6456         LDFLAGS=$sharedlink_ldflags_save
6457     fi
6459     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6460     # when we don't make any dynamic libraries?
6461     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6462         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6463         cat > conftestlib1.cc <<_ACEOF
6464 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6465 struct S2: S1<int> { virtual ~S2(); };
6466 S2::~S2() {}
6467 _ACEOF
6468         cat > conftestlib2.cc <<_ACEOF
6469 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6470 struct S2: S1<int> { virtual ~S2(); };
6471 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6472 _ACEOF
6473         gccvisinlineshiddenok=yes
6474         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6475             gccvisinlineshiddenok=no
6476         else
6477             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6478             dnl known to not work with -z defs (unsetting which makes the test
6479             dnl moot, though):
6480             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6481             if test "$COM_IS_CLANG" = TRUE; then
6482                 for i in $CXX; do
6483                     case $i in
6484                     -fsanitize=*)
6485                         my_linkflagsnoundefs=
6486                         break
6487                         ;;
6488                     esac
6489                 done
6490             fi
6491             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6492                 gccvisinlineshiddenok=no
6493             fi
6494         fi
6496         rm -fr libconftest*
6497         AC_MSG_RESULT([$gccvisinlineshiddenok])
6498         if test "$gccvisinlineshiddenok" = "no"; then
6499             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6500             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6501             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6502         fi
6503     fi
6505     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6506         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6507         cat >visibility.cxx <<_ACEOF
6508 #pragma GCC visibility push(hidden)
6509 struct __attribute__ ((visibility ("default"))) TestStruct {
6510   static void Init();
6512 __attribute__ ((visibility ("default"))) void TestFunc() {
6513   TestStruct::Init();
6515 _ACEOF
6516         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6517             gccvisbroken=yes
6518         else
6519             case "$host_cpu" in
6520             i?86|x86_64)
6521                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6522                     gccvisbroken=no
6523                 else
6524                     if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6525                         gccvisbroken=no
6526                     else
6527                         gccvisbroken=yes
6528                     fi
6529                 fi
6530                 ;;
6531             *)
6532                 gccvisbroken=no
6533                 ;;
6534             esac
6535         fi
6536         rm -f visibility.s visibility.cxx
6538         AC_MSG_RESULT([$gccvisbroken])
6539         if test "$gccvisbroken" = "yes"; then
6540             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6541             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6542             unset HAVE_GCC_VISIBILITY_FEATURE
6543         fi
6544     fi
6546     CPPFLAGS="$save_CPPFLAGS"
6548     AC_LANG_POP([C++])
6551 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6552 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6554 dnl ===================================================================
6555 dnl  Clang++ tests
6556 dnl ===================================================================
6558 HAVE_GCC_FNO_DEFAULT_INLINE=
6559 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6560 if test "$GCC" = "yes"; then
6561     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6562     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6563         # Option just ignored and silly warning that isn't a real
6564         # warning printed
6565         :
6566     else
6567         AC_LANG_PUSH([C++])
6568         save_CXXFLAGS=$CXXFLAGS
6569         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6570         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6571         CXXFLAGS=$save_CXXFLAGS
6572         AC_LANG_POP([C++])
6573     fi
6574     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6575         AC_MSG_RESULT([yes])
6576     else
6577         AC_MSG_RESULT([no])
6578     fi
6580     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6581     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6582         # As above
6583         :
6584     else
6585         AC_LANG_PUSH([C++])
6586         save_CXXFLAGS=$CXXFLAGS
6587         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6588         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6589         CXXFLAGS=$save_CXXFLAGS
6590         AC_LANG_POP([C++])
6591     fi
6592     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6593         AC_MSG_RESULT([yes])
6594     else
6595         AC_MSG_RESULT([no])
6596     fi
6598 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6599 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6601 dnl ===================================================================
6602 dnl Compiler plugins
6603 dnl ===================================================================
6605 COMPILER_PLUGINS=
6606 # currently only Clang
6607 if test "$COM_IS_CLANG" = "TRUE"; then
6608     if test -n "$enable_compiler_plugins"; then
6609         compiler_plugins="$enable_compiler_plugins"
6610     elif test -n "$ENABLE_DBGUTIL"; then
6611         compiler_plugins=test
6612     else
6613         compiler_plugins=no
6614     fi
6615     if test "$compiler_plugins" != "no"; then
6616         dnl The prefix where Clang resides, override to where Clang resides if
6617         dnl using a source build:
6618         if test -z "$CLANGDIR"; then
6619             CLANGDIR=/usr
6620         fi
6621         AC_LANG_PUSH([C++])
6622         save_CPPFLAGS=$CPPFLAGS
6623         save_CXX=$CXX
6624         # compiler plugins must be built with "native" bitness of clang
6625         # because they link against clang libraries
6626         CXX=`echo $CXX | sed -e s/-m64// -e s/-m32//`
6627         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6628         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6629             [COMPILER_PLUGINS=TRUE],
6630             [
6631             if test "$compiler_plugins" = "yes"; then
6632                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6633             else
6634                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6635                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6636             fi
6637             ])
6638         CXX=$save_CXX
6639         CPPFLAGS=$save_CPPFLAGS
6640         AC_LANG_POP([C++])
6641     fi
6642 else
6643     if test "$enable_compiler_plugins" = "yes"; then
6644         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6645     fi
6647 AC_SUBST(COMPILER_PLUGINS)
6648 AC_SUBST(CLANGDIR)
6650 # Plugin to help linker.
6651 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6652 # This makes --enable-lto build with clang work.
6653 AC_SUBST(LD_PLUGIN)
6655 dnl ===================================================================
6656 dnl allocator
6657 dnl ===================================================================
6658 AC_MSG_CHECKING([which memory allocator to use])
6659 if test "$with_alloc" = "system"; then
6660     AC_MSG_RESULT([system])
6661     ALLOC="SYS_ALLOC"
6663 if test "$with_alloc" = "tcmalloc"; then
6664     AC_MSG_RESULT(tcmalloc)
6665     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6666         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6667     fi
6668     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6669         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6670     ALLOC="TCMALLOC"
6672 if test "$with_alloc" = "jemalloc"; then
6673     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6674         AC_MSG_RESULT(jemalloc)
6675         save_CFLAGS=$CFLAGS
6676         CFLAGS="$CFLAGS -pthread"
6677         AC_CHECK_LIB([jemalloc], [malloc], [:],
6678             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6679         ALLOC="JEMALLOC"
6680         CFLAGS=$save_CFLAGS
6681     else
6682         AC_MSG_RESULT([system])
6683         ALLOC="SYS_ALLOC"
6684     fi
6686 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6687     AC_MSG_RESULT([internal])
6689 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6690 AC_SUBST(HAVE_POSIX_FALLOCATE)
6691 AC_SUBST(ALLOC)
6693 dnl ===================================================================
6694 dnl Custom build version
6695 dnl ===================================================================
6697 AC_MSG_CHECKING([whether to add custom build version])
6698 if test "$with_build_version" != ""; then
6699     BUILD_VER_STRING=$with_build_version
6700     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6701 else
6702     BUILD_VER_STRING=
6703     AC_MSG_RESULT([no])
6705 AC_SUBST(BUILD_VER_STRING)
6707 JITC_PROCESSOR_TYPE=""
6708 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6709     # IBMs JDK needs this...
6710     JITC_PROCESSOR_TYPE=6
6711     export JITC_PROCESSOR_TYPE
6713 AC_SUBST([JITC_PROCESSOR_TYPE])
6715 # Misc Windows Stuff
6716 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6717     find_msvc_x64_dlls
6718     find_msms
6719     MSVC_DLL_PATH="$msvcdllpath"
6720     MSVC_DLLS="$msvcdlls"
6721     MSM_PATH="$msmdir"
6722     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6725 AC_SUBST(MSVC_DLL_PATH)
6726 AC_SUBST(MSVC_DLLS)
6727 AC_SUBST(MSM_PATH)
6729 dnl ===================================================================
6730 dnl Checks for Java
6731 dnl ===================================================================
6732 if test "$ENABLE_JAVA" != ""; then
6734     # Windows-specific tests
6735     if test "$build_os" = "cygwin"; then
6736         if test "$BITNESS_OVERRIDE" = 64; then
6737             bitness=64
6738         else
6739             bitness=32
6740         fi
6742         if test -z "$with_jdk_home"; then
6743             for ver in 1.8 1.7 1.6; do
6744                 reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6745                 if test -n "$regvalue"; then
6746                     _jdk_home=$regvalue
6747                     break
6748                 fi
6749             done
6750             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6751                 with_jdk_home="$_jdk_home"
6752                 howfound="found automatically"
6753             else
6754                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6755             fi
6756         else
6757             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6758             howfound="you passed"
6759         fi
6760     fi
6762     # 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.
6763     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6764     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6765         with_jdk_home=`/usr/libexec/java_home`
6766     fi
6768     JAVA_HOME=; export JAVA_HOME
6769     if test -z "$with_jdk_home"; then
6770         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6771     else
6772         _java_path="$with_jdk_home/bin/$with_java"
6773         dnl Check if there is a Java interpreter at all.
6774         if test -x "$_java_path"; then
6775             JAVAINTERPRETER=$_java_path
6776         else
6777             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6778         fi
6779     fi
6781     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6782     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6783     dnl loaded by java to run JunitTests:
6784     if test "$build_os" = "cygwin"; then
6785         shortjdkhome=`cygpath -d "$with_jdk_home"`
6786         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
6787             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6788             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6789         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
6790             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6791             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6792         fi
6794         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6795             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6796         fi
6797         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6798     elif test "$cross_compiling" != "yes"; then
6799         case $CPUNAME in
6800             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6801                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6802                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6803                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6804                 fi
6805                 ;;
6806             *) # assumption: everything else 32-bit
6807                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6808                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6809                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6810                 fi
6811                 ;;
6812         esac
6813     fi
6816 HAVE_JAVA6=
6817 HAVE_JAVA9=
6818 dnl ===================================================================
6819 dnl Checks for JDK.
6820 dnl ===================================================================
6822 # Note that JAVA_HOME as for now always means the *build* platform's
6823 # JAVA_HOME. Whether all the complexity here actually is needed any
6824 # more or not, no idea.
6826 if test "$ENABLE_JAVA" != ""; then
6827     _gij_longver=0
6828     AC_MSG_CHECKING([the installed JDK])
6829     if test -n "$JAVAINTERPRETER"; then
6830         dnl java -version sends output to stderr!
6831         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6832             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6833         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6834             JDK=gcj
6835             AC_MSG_RESULT([checked (gcj)])
6836             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6837             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6839         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6840             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6841         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6842             JDK=ibm
6844             dnl IBM JDK specific tests
6845             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6846             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6848             if test "$_jdk_ver" -lt 10500; then
6849                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6850             fi
6851             if test "$_jdk_ver" -ge 10600; then
6852                 HAVE_JAVA6=TRUE
6853             fi
6855             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6857             if test "$with_jdk_home" = ""; then
6858                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6859 you must use the "--with-jdk-home" configure option explicitly])
6860             fi
6862             JAVA_HOME=$with_jdk_home
6863         else
6864             JDK=sun
6866             dnl Sun JDK specific tests
6867             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6868             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6870             if test "$_jdk_ver" -lt 10500; then
6871                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6872             fi
6873             if test "$_jdk_ver" -gt 10600; then
6874                 JAVA_CLASSPATH_NOT_SET="1"
6875             fi
6876             if test "$_jdk_ver" -ge 10600; then
6877                 HAVE_JAVA6=TRUE
6878             fi
6879             if test "$_jdk_ver" -ge 10900; then
6880                 HAVE_JAVA9=TRUE
6881             fi
6883             AC_MSG_RESULT([checked (JDK $_jdk)])
6884             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6885             if test "$_os" = "WINNT"; then
6886                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6887             fi
6889             # set to limit VM usage for JunitTests
6890             JAVAIFLAGS=-Xmx64M
6891             # set to limit VM usage for javac
6892             JAVAFLAGS=-J-Xmx128M
6893         fi
6894     else
6895         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6896     fi
6897 else
6898     dnl Java disabled
6899     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6901 AC_SUBST([HAVE_JAVA6])
6902 AC_SUBST([HAVE_JAVA9])
6904 dnl ===================================================================
6905 dnl Set target Java bytecode version
6906 dnl ===================================================================
6907 if test "$ENABLE_JAVA" != ""; then
6908     if test "$HAVE_JAVA9" = "TRUE"; then
6909         _java_target_ver="1.6"
6910     else
6911         _java_target_ver="1.5"
6912     fi
6913     JAVA_SOURCE_VER="$_java_target_ver"
6914     JAVA_TARGET_VER="$_java_target_ver"
6917 dnl ===================================================================
6918 dnl Checks for javac
6919 dnl ===================================================================
6920 if test "$ENABLE_JAVA" != ""; then
6921     if test "$JDK" = "gcj"; then
6922         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6923     else
6924         javacompiler="javac"
6925     fi
6926     if test -z "$with_jdk_home"; then
6927         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6928     else
6929         _javac_path="$with_jdk_home/bin/$javacompiler"
6930         dnl Check if there is a Java compiler at all.
6931         if test -x "$_javac_path"; then
6932             JAVACOMPILER=$_javac_path
6933         fi
6934     fi
6935     if test -z "$JAVACOMPILER"; then
6936         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6937     fi
6938     if test "$build_os" = "cygwin"; then
6939         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6940             JAVACOMPILER="${JAVACOMPILER}.exe"
6941         fi
6942         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6943     fi
6945     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6946         AC_MSG_CHECKING([re-checking JDK])
6947         JDK=gcj
6948         AC_MSG_RESULT([checked (ecj)])
6949         _gij_longver="40200"
6950     fi
6953 JAVACISGCJ=""
6954 dnl ===================================================================
6955 dnl Checks that javac is gcj
6956 dnl ===================================================================
6957 if test "$ENABLE_JAVA" != ""; then
6958     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6959         JAVACISGCJ="yes"
6960     fi
6962 AC_SUBST(JAVACISGCJ)
6964 dnl ===================================================================
6965 dnl Checks for javadoc
6966 dnl ===================================================================
6967 if test "$ENABLE_JAVA" != ""; then
6968     if test -z "$with_jdk_home"; then
6969         AC_PATH_PROG(JAVADOC, javadoc)
6970     else
6971         _javadoc_path="$with_jdk_home/bin/javadoc"
6972         dnl Check if there is a javadoc at all.
6973         if test -x "$_javadoc_path"; then
6974             JAVADOC=$_javadoc_path
6975         else
6976             AC_PATH_PROG(JAVADOC, javadoc)
6977         fi
6978     fi
6979     if test -z "$JAVADOC"; then
6980         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6981     fi
6982     if test "$build_os" = "cygwin"; then
6983         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6984             JAVADOC="${JAVADOC}.exe"
6985         fi
6986         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6987     fi
6989     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6990     JAVADOCISGJDOC="yes"
6991     fi
6993 AC_SUBST(JAVADOCISGJDOC)
6995 if test "$ENABLE_JAVA" != ""; then
6996     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6997     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6998         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6999            # try to recover first by looking whether we have a alternatives
7000            # system as in Debian or newer SuSEs where following /usr/bin/javac
7001            # over /etc/alternatives/javac leads to the right bindir where we
7002            # just need to strip a bit away to get a valid JAVA_HOME
7003            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7004         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7005             # maybe only one level of symlink (e.g. on Mac)
7006             JAVA_HOME=$(readlink $JAVACOMPILER)
7007             if test "$(dirname $JAVA_HOME)" = "."; then
7008                 # we've got no path to trim back
7009                 JAVA_HOME=""
7010             fi
7011         else
7012             # else warn
7013             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7014             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7015             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7016             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7017         fi
7018         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
7019         if test "$JAVA_HOME" != "/usr"; then
7020             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7021                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7022                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7023                 dnl Tiger already returns a JDK path..
7024                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7025             else
7026                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7027             fi
7028         fi
7029     fi
7030     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7032     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7033     if test -z "$JAVA_HOME"; then
7034         if test "x$with_jdk_home" = "x"; then
7035             cat > findhome.java <<_ACEOF
7036 [import java.io.File;
7038 class findhome
7040     public static void main(String args[])
7041     {
7042         String jrelocation = System.getProperty("java.home");
7043         File jre = new File(jrelocation);
7044         System.out.println(jre.getParent());
7045     }
7047 _ACEOF
7048             AC_MSG_CHECKING([if javac works])
7049             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7050             AC_TRY_EVAL(javac_cmd)
7051             if test $? = 0 -a -f ./findhome.class; then
7052                 AC_MSG_RESULT([javac works])
7053             else
7054                 echo "configure: javac test failed" >&5
7055                 cat findhome.java >&5
7056                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7057             fi
7058             AC_MSG_CHECKING([if gij knows its java.home])
7059             JAVA_HOME=`$JAVAINTERPRETER findhome`
7060             if test $? = 0 -a "$JAVA_HOME" != ""; then
7061                 AC_MSG_RESULT([$JAVA_HOME])
7062             else
7063                 echo "configure: java test failed" >&5
7064                 cat findhome.java >&5
7065                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7066             fi
7067             # clean-up after ourselves
7068             rm -f ./findhome.java ./findhome.class
7069         else
7070             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7071         fi
7072     fi
7074     dnl second sanity check JAVA_HOME if possible
7075     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
7076         # now check if $JAVA_HOME is really valid
7077         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7078             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7079                 JAVA_HOME_OK="NO"
7080             fi
7081         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7082             JAVA_HOME_OK="NO"
7083         fi
7084         if test "$JAVA_HOME_OK" = "NO"; then
7085             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7086             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7087             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7088             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7089             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7090             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7091         fi
7092     fi
7093     PathFormat "$JAVA_HOME"
7094     JAVA_HOME="$formatted_path"
7097 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7098     "$_os" != Darwin
7099 then
7100     AC_MSG_CHECKING([for JAWT lib])
7101     if test "$_os" = WINNT; then
7102         if test "$WITH_MINGW" = yes; then
7103             # The path is taken care of in gb_LinkTarget__use_jawt
7104             # in RepositoryExternal.mk:
7105             JAWTLIB=-ljawt
7106         else
7107             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7108             JAWTLIB=jawt.lib
7109         fi
7110     else
7111         case "$host_cpu" in
7112         arm*)
7113             my_java_arch=arm
7114             ;;
7115         i*86)
7116             my_java_arch=i386
7117             ;;
7118         m68k)
7119             my_java_arch=mk68
7120             ;;
7121         powerpc)
7122             my_java_arch=ppc
7123             ;;
7124         powerpc64)
7125             my_java_arch=ppc64
7126             ;;
7127         powerpc64le)
7128             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7129             JAVA_ARCH=$my_java_arch
7130             ;;
7131         x86_64)
7132             my_java_arch=amd64
7133             ;;
7134         *)
7135             my_java_arch=$host_cpu
7136             ;;
7137         esac
7138         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7139         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7140     fi
7141     AC_MSG_RESULT([$JAWTLIB])
7143 AC_SUBST(JAWTLIB)
7145 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7146     case "$host_os" in
7148     aix*)
7149         JAVAINC="-I$JAVA_HOME/include"
7150         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7151         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7152         ;;
7154     cygwin*)
7155         JAVAINC="-I$JAVA_HOME/include/win32"
7156         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7157         ;;
7159     darwin*)
7160         if test -d "$JAVA_HOME/include/darwin"; then
7161             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7162         else
7163             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7164         fi
7165         ;;
7167     dragonfly*)
7168         JAVAINC="-I$JAVA_HOME/include"
7169         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7170         ;;
7172     freebsd*)
7173         JAVAINC="-I$JAVA_HOME/include"
7174         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7175         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7176         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7177         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7178         ;;
7180     k*bsd*-gnu*)
7181         JAVAINC="-I$JAVA_HOME/include"
7182         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7183         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7184         ;;
7186     linux-gnu*)
7187         JAVAINC="-I$JAVA_HOME/include"
7188         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7189         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7190         ;;
7192     mingw*)
7193         JAVAINC="-I$JAVA_HOME/include"
7194         ;;
7196     *netbsd*)
7197         JAVAINC="-I$JAVA_HOME/include"
7198         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7199         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7200        ;;
7202     openbsd*)
7203         JAVAINC="-I$JAVA_HOME/include"
7204         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7205         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7206         ;;
7208     solaris*)
7209         JAVAINC="-I$JAVA_HOME/include"
7210         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7211         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7212         ;;
7213     esac
7215 SOLARINC="$SOLARINC $JAVAINC"
7217 AC_SUBST(JAVACOMPILER)
7218 AC_SUBST(JAVADOC)
7219 AC_SUBST(JAVAINTERPRETER)
7220 AC_SUBST(JAVAIFLAGS)
7221 AC_SUBST(JAVAFLAGS)
7222 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7223 AC_SUBST(JAVA_HOME)
7224 AC_SUBST(JAVA_SOURCE_VER)
7225 AC_SUBST(JAVA_TARGET_VER)
7226 AC_SUBST(JDK)
7228 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7229 if test -n "$with_idlc_cpp"; then
7230     AC_MSG_RESULT([$with_idlc_cpp])
7231     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7232 else
7233     AC_MSG_RESULT([ucpp])
7234     AC_MSG_CHECKING([which ucpp tp use])
7235     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7236         AC_MSG_RESULT([external])
7237         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7238     else
7239         AC_MSG_RESULT([internal])
7240         BUILD_TYPE="$BUILD_TYPE UCPP"
7241     fi
7243 AC_SUBST(SYSTEM_UCPP)
7245 dnl ===================================================================
7246 dnl Check for epm (not needed for Windows)
7247 dnl ===================================================================
7248 AC_MSG_CHECKING([whether to enable EPM for packing])
7249 if test "$enable_epm" = "yes"; then
7250     AC_MSG_RESULT([yes])
7251     if test "$_os" != "WINNT"; then
7252         if test $_os = Darwin; then
7253             EPM=internal
7254         elif test -n "$with_epm"; then
7255             EPM=$with_epm
7256         else
7257             AC_PATH_PROG(EPM, epm, no)
7258         fi
7259         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7260             AC_MSG_NOTICE([EPM will be built.])
7261             BUILD_TYPE="$BUILD_TYPE EPM"
7262             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7263         else
7264             # Gentoo has some epm which is something different...
7265             AC_MSG_CHECKING([whether the found epm is the right epm])
7266             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7267                 AC_MSG_RESULT([yes])
7268             else
7269                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7270             fi
7271             AC_MSG_CHECKING([epm version])
7272             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7273             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7274                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7275                 AC_MSG_RESULT([OK, >= 3.7])
7276             else
7277                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7278                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7279             fi
7280         fi
7281     fi
7283     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7284         AC_MSG_CHECKING([for rpm])
7285         for a in "$RPM" rpmbuild rpm; do
7286             $a --usage >/dev/null 2> /dev/null
7287             if test $? -eq 0; then
7288                 RPM=$a
7289                 break
7290             else
7291                 $a --version >/dev/null 2> /dev/null
7292                 if test $? -eq 0; then
7293                     RPM=$a
7294                     break
7295                 fi
7296             fi
7297         done
7298         if test -z "$RPM"; then
7299             AC_MSG_ERROR([not found])
7300         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7301             RPM_PATH=`which $RPM`
7302             AC_MSG_RESULT([$RPM_PATH])
7303             SCPDEFS="$SCPDEFS -DWITH_RPM"
7304         else
7305             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7306         fi
7307     fi
7308     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7309         AC_PATH_PROG(DPKG, dpkg, no)
7310         if test "$DPKG" = "no"; then
7311             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7312         fi
7313     fi
7314     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7315        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7316         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7317             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7318                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7319                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7320                     AC_MSG_RESULT([yes])
7321                 else
7322                     AC_MSG_RESULT([no])
7323                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7324                         _pt="rpm"
7325                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7326                         add_warning "the rpms will need to be installed with --nodeps"
7327                     else
7328                         _pt="pkg"
7329                     fi
7330                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7331                     add_warning "the ${_pt}s will not be relocateable"
7332                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7333                                  relocation will work, you need to patch your epm with the
7334                                  patch in epm/epm-3.7.patch or build with
7335                                  --with-epm=internal which will build a suitable epm])
7336                 fi
7337             fi
7338         fi
7339     fi
7340     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7341         AC_PATH_PROG(PKGMK, pkgmk, no)
7342         if test "$PKGMK" = "no"; then
7343             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7344         fi
7345     fi
7346     AC_SUBST(RPM)
7347     AC_SUBST(DPKG)
7348     AC_SUBST(PKGMK)
7349 else
7350     for i in $PKGFORMAT; do
7351         case "$i" in
7352         aix | bsd | deb | pkg | rpm | native | portable)
7353             AC_MSG_ERROR(
7354                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7355             ;;
7356         esac
7357     done
7358     AC_MSG_RESULT([no])
7359     EPM=NO
7361 AC_SUBST(EPM)
7363 dnl ===================================================================
7364 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7365 dnl ===================================================================
7366 WINEGCC=
7367 if test "$enable_winegcc" = "yes"; then
7368     AC_PATH_PROG(WINEGCC, winegcc)
7369     if test "$WINEGCC" = ""; then
7370         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7371     fi
7372     CC_save="$CC"
7373     ac_exeext_save="$ac_exeext"
7374     CC="$WINEGCC -m32"
7375     ac_exeext=".exe"
7376     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7377 #include <stdio.h>
7378         ],[
7379 printf ("hello world\n");
7380         ])],,
7381         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7382     )
7383     CC="$CC_save"
7384     ac_exeext="$ac_exeext_save"
7386 AC_SUBST(WINEGCC)
7388 if test $_os = iOS; then
7389     enable_mpl_subset=yes
7390     enable_lotuswordpro=no
7391     enable_coinmp=yes
7392     enable_lpsolve=no
7393     enable_postgresql_sdbc=no
7394     enable_extension_integration=no
7395     enable_report_builder=no
7396     with_theme="tango"
7397     with_ppds=no
7400 ENABLE_LWP=
7401 if test "$enable_lotuswordpro" = "yes"; then
7402     ENABLE_LWP="TRUE"
7403     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7405 AC_SUBST(ENABLE_LWP)
7407 dnl ===================================================================
7408 dnl Check for gperf
7409 dnl ===================================================================
7410 AC_PATH_PROG(GPERF, gperf)
7411 if test -z "$GPERF"; then
7412     AC_MSG_ERROR([gperf not found but needed. Install it.])
7414 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7415     GPERF=`cygpath -m $GPERF`
7417 AC_MSG_CHECKING([gperf version])
7418 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7419     AC_MSG_RESULT([OK])
7420 else
7421     AC_MSG_ERROR([too old, you need at least 3.0.0])
7423 AC_SUBST(GPERF)
7425 dnl ===================================================================
7426 dnl Check for building ODK
7427 dnl ===================================================================
7428 if test "$enable_odk" = no; then
7429     unset DOXYGEN
7430 else
7431     if test "$with_doxygen" = no; then
7432         AC_MSG_CHECKING([for doxygen])
7433         unset DOXYGEN
7434         AC_MSG_RESULT([no])
7435     else
7436         if test "$with_doxygen" = yes; then
7437             AC_PATH_PROG([DOXYGEN], [doxygen])
7438             if test -z "$DOXYGEN"; then
7439                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7440             fi
7441         else
7442             AC_MSG_CHECKING([for doxygen])
7443             DOXYGEN=$with_doxygen
7444             AC_MSG_RESULT([$DOXYGEN])
7445         fi
7446         if test -n "$DOXYGEN"; then
7447             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7448             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7449             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7450                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7451             fi
7452         fi
7453     fi
7455 AC_SUBST([DOXYGEN])
7457 AC_MSG_CHECKING([whether to build the ODK])
7458 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7459     AC_MSG_RESULT([yes])
7461     if test "$with_java" != "no"; then
7462         AC_MSG_CHECKING([whether to build unowinreg.dll])
7463         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7464             # build on Win by default
7465             enable_build_unowinreg=yes
7466         fi
7467         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7468             AC_MSG_RESULT([no])
7469             BUILD_UNOWINREG=
7470         else
7471             AC_MSG_RESULT([yes])
7472             BUILD_UNOWINREG=TRUE
7473         fi
7474         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7475             if test -z "$with_mingw_cross_compiler"; then
7476                 dnl Guess...
7477                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7478             elif test -x "$with_mingw_cross_compiler"; then
7479                  MINGWCXX="$with_mingw_cross_compiler"
7480             else
7481                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7482             fi
7484             if test "$MINGWCXX" = "false"; then
7485                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7486             fi
7488             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7489             if test -x "$mingwstrip_test"; then
7490                 MINGWSTRIP="$mingwstrip_test"
7491             else
7492                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7493             fi
7495             if test "$MINGWSTRIP" = "false"; then
7496                 AC_MSG_ERROR(MinGW32 binutils not found.)
7497             fi
7498         fi
7499     fi
7500     BUILD_TYPE="$BUILD_TYPE ODK"
7501 else
7502     AC_MSG_RESULT([no])
7503     BUILD_UNOWINREG=
7505 AC_SUBST(BUILD_UNOWINREG)
7506 AC_SUBST(MINGWCXX)
7507 AC_SUBST(MINGWSTRIP)
7509 dnl ===================================================================
7510 dnl Check for system zlib
7511 dnl ===================================================================
7512 if test "$with_system_zlib" = "auto"; then
7513     case "$_os" in
7514     WINNT)
7515         with_system_zlib="$with_system_libs"
7516         ;;
7517     *)
7518         with_system_zlib=yes
7519         ;;
7520     esac
7523 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7524 dnl and has no pkg-config for it at least on some tinderboxes,
7525 dnl so leaving that out for now
7526 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7527 AC_MSG_CHECKING([which zlib to use])
7528 if test "$with_system_zlib" = "yes"; then
7529     AC_MSG_RESULT([external])
7530     SYSTEM_ZLIB=TRUE
7531     if test "$_os" != "Emscripten"; then
7532         # Emscripten provides its own zlib, don't check for that
7533         AC_CHECK_HEADER(zlib.h, [],
7534             [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7535         AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7536             [AC_MSG_ERROR(zlib not found or functional)], [])
7537     fi
7538 else
7539     AC_MSG_RESULT([internal])
7540     SYSTEM_ZLIB=
7541     BUILD_TYPE="$BUILD_TYPE ZLIB"
7542     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7543     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7545 AC_SUBST(ZLIB_CFLAGS)
7546 AC_SUBST(ZLIB_LIBS)
7547 AC_SUBST(SYSTEM_ZLIB)
7549 dnl ===================================================================
7550 dnl Check for system jpeg
7551 dnl ===================================================================
7552 AC_MSG_CHECKING([which libjpeg to use])
7553 if test "$with_jpeg_turbo" = "auto"; then
7554     # TODO use jpeg-turbo on Darwin too
7555     case "$_os" in
7556     WINNT)
7557         with_jpeg_turbo=yes
7558         ;;
7559     *)
7560         with_jpeg_turbo=no
7561         ;;
7562     esac
7565 if test "$with_system_jpeg" = "yes"; then
7566     AC_MSG_RESULT([external])
7567     SYSTEM_JPEG=TRUE
7568     AC_CHECK_HEADER(jpeglib.h, [],
7569         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7570     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7571     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7572     libo_MINGW_CHECK_DLL([libjpeg])
7573 else
7574     SYSTEM_JPEG=
7575     if test "$with_jpeg_turbo" = "yes"; then
7576         AC_MSG_RESULT([internal, jpeg-turbo])
7577         BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7578         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7580         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7581             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7582                 NASM="$LODE_HOME/opt/bin/nasm"
7583             elif test -x "/opt/lo/bin/nasm"; then
7584                 NASM="/opt/lo/bin/nasm"
7585             fi
7586         fi
7587         if test -z "$NASM"; then
7588 cat << _EOS
7589 ****************************************************************************
7590 You need nasm (Netwide Assembler) to build internal jpeg library.
7591 To get one please do:
7593 _EOS
7594         if test "$build_os" = "cygwin"; then
7595 cat << _EOS
7596 install a pre-compiled binary for Win32
7598  mkdir -p /opt/lo/bin
7599  cd /opt/lo/bin
7600  wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7601  chmod +x nasm
7602 _EOS
7603             else
7604 cat << _EOS
7605 consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
7606 _EOS
7607             fi
7608 cat << _EOS
7610 or get and install one from http://www.nasm.us/
7612 Then re-run autogen.sh
7614 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7615 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7617 _EOS
7618         AC_MSG_ERROR([no nasm (Netwide Assembler) found])
7619         fi
7620     else
7621         AC_MSG_RESULT([internal, jpeg])
7622         BUILD_TYPE="$BUILD_TYPE JPEG"
7623     fi
7625 AC_SUBST(NASM)
7626 AC_SUBST(SYSTEM_JPEG)
7628 dnl ===================================================================
7629 dnl Check for system clucene
7630 dnl ===================================================================
7631 dnl we should rather be using
7632 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7633 dnl but the contribs-lib check seems tricky
7634 AC_MSG_CHECKING([which clucene to use])
7635 if test "$with_system_clucene" = "yes"; then
7636     AC_MSG_RESULT([external])
7637     SYSTEM_CLUCENE=TRUE
7638     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7639     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7640     FilterLibs "${CLUCENE_LIBS}"
7641     CLUCENE_LIBS="${filteredlibs}"
7642     AC_LANG_PUSH([C++])
7643     save_CXXFLAGS=$CXXFLAGS
7644     save_CPPFLAGS=$CPPFLAGS
7645     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7646     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7647     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7648     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7649     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7650                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7651     CXXFLAGS=$save_CXXFLAGS
7652     CPPFLAGS=$save_CPPFLAGS
7653     AC_LANG_POP([C++])
7655     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7656 else
7657     AC_MSG_RESULT([internal])
7658     SYSTEM_CLUCENE=
7659     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7661 AC_SUBST(SYSTEM_CLUCENE)
7662 AC_SUBST(CLUCENE_CFLAGS)
7663 AC_SUBST(CLUCENE_LIBS)
7665 dnl ===================================================================
7666 dnl Check for system expat
7667 dnl ===================================================================
7668 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7669 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7670 AC_MSG_CHECKING([which expat to use])
7671 if test "$with_system_expat" = "yes"; then
7672     AC_MSG_RESULT([external])
7673     SYSTEM_EXPAT=TRUE
7674     AC_CHECK_HEADER(expat.h, [],
7675         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7676     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7677         [AC_MSG_RESULT(expat library not found or functional.)], [])
7678     libo_MINGW_CHECK_DLL([libexpat])
7679 else
7680     AC_MSG_RESULT([internal])
7681     SYSTEM_EXPAT=
7682     BUILD_TYPE="$BUILD_TYPE EXPAT"
7684 AC_SUBST(SYSTEM_EXPAT)
7686 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7687 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7688     ENABLE_EOT="TRUE"
7689     AC_DEFINE([ENABLE_EOT])
7690     AC_MSG_RESULT([yes])
7692     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7693 else
7694     ENABLE_EOT=
7695     AC_MSG_RESULT([no])
7697 AC_SUBST([ENABLE_EOT])
7699 dnl ===================================================================
7700 dnl Check for system librevenge
7701 dnl ===================================================================
7702 AS_IF([test "$COM" = "MSC"],
7703       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7704       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7706 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7708 dnl ===================================================================
7709 dnl Check for system libe-book
7710 dnl ===================================================================
7711 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7712 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7714 dnl ===================================================================
7715 dnl Check for system libetonyek
7716 dnl ===================================================================
7717 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7718 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
7720 dnl ===================================================================
7721 dnl Check for system libfreehand
7722 dnl ===================================================================
7723 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7725 dnl ===================================================================
7726 dnl Check for system libodfgen
7727 dnl ===================================================================
7728 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7730 dnl ===================================================================
7731 dnl Check for system libcdr
7732 dnl ===================================================================
7733 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7735 dnl ===================================================================
7736 dnl Check for system libmspub
7737 dnl ===================================================================
7738 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7740 dnl ===================================================================
7741 dnl Check for system libmwaw
7742 dnl ===================================================================
7743 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7744 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.7])
7746 dnl ===================================================================
7747 dnl Check for system libpagemaker
7748 dnl ===================================================================
7749 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7751 dnl ===================================================================
7752 dnl Check for system libvisio
7753 dnl ===================================================================
7754 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7756 dnl ===================================================================
7757 dnl Check for system libcmis
7758 dnl ===================================================================
7759 # libcmis requires curl and we can't build curl for iOS
7760 if test $_os != iOS; then
7761     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7762     ENABLE_CMIS=TRUE
7763 else
7764     ENABLE_CMIS=
7766 AC_SUBST(ENABLE_CMIS)
7768 dnl ===================================================================
7769 dnl Check for system libwpd
7770 dnl ===================================================================
7771 AS_IF([test "$COM" = "MSC"],
7772       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7773       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7775 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7777 dnl ===================================================================
7778 dnl Check for system lcms2
7779 dnl ===================================================================
7780 if test "$with_system_lcms2" = "yes"; then
7781     libo_MINGW_CHECK_DLL([liblcms2])
7782 else
7783     SYSTEM_LCMS2=
7785 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7786 if test "$GCC" = "yes"; then
7787     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7789 if test "$COM" = "MSC"; then # override the above
7790     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7793 dnl ===================================================================
7794 dnl Check for system cppunit
7795 dnl ===================================================================
7796 if test "$cross_compiling" != "yes"; then
7797     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7800 dnl ===================================================================
7801 dnl Check whether freetype is available
7802 dnl ===================================================================
7803 if test  "$test_freetype" = "yes"; then
7804     AC_MSG_CHECKING([whether freetype is available])
7805     # FreeType has 3 different kinds of versions
7806     # * release, like 2.4.10
7807     # * libtool, like 13.0.7 (this what pkg-config returns)
7808     # * soname
7809     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7810     #
7811     # 9.9.3 is 2.2.0
7812     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7813     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7814     FilterLibs "${FREETYPE_LIBS}"
7815     FREETYPE_LIBS="${filteredlibs}"
7816     SYSTEM_FREETYPE=TRUE
7817     _save_libs="$LIBS"
7818     _save_cflags="$CFLAGS"
7819     LIBS="$LIBS $FREETYPE_LIBS"
7820     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7821     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7822     LIBS="$_save_libs"
7823     CFLAGS="$_save_cflags"
7825 AC_SUBST(FREETYPE_CFLAGS)
7826 AC_SUBST(FREETYPE_LIBS)
7827 AC_SUBST([SYSTEM_FREETYPE])
7829 dnl ===================================================================
7830 dnl Check for system libabw
7831 dnl ===================================================================
7832 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7834 dnl ===================================================================
7835 dnl Check for system libwps
7836 dnl ===================================================================
7837 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7838 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.2])
7840 dnl ===================================================================
7841 dnl Check for system libwpg
7842 dnl ===================================================================
7843 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7845 # ===================================================================
7846 # Check for system libxslt
7847 # to prevent incompatibilities between internal libxml2 and external libxslt,
7848 # or vice versa, use with_system_libxml here
7849 # ===================================================================
7850 if test "$with_system_libxml" = "auto"; then
7851     case "$_os" in
7852     WINNT|iOS|Android)
7853         with_system_libxml="$with_system_libs"
7854         ;;
7855     *)
7856         with_system_libxml=yes
7857         ;;
7858     esac
7861 AC_MSG_CHECKING([which libxslt to use])
7862 if test "$with_system_libxml" = "yes"; then
7863     AC_MSG_RESULT([external])
7864     SYSTEM_LIBXSLT=TRUE
7865     if test "$_os" = "Darwin"; then
7866         dnl make sure to use SDK path
7867         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7868         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7869         dnl omit -L/usr/lib
7870         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7871         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7872     else
7873         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7874         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7875         FilterLibs "${LIBXSLT_LIBS}"
7876         LIBXSLT_LIBS="${filteredlibs}"
7877         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7878         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7879         FilterLibs "${LIBEXSLT_LIBS}"
7880         LIBEXSLT_LIBS="${filteredlibs}"
7881     fi
7883     dnl Check for xsltproc
7884     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7885     if test "$XSLTPROC" = "no"; then
7886         AC_MSG_ERROR([xsltproc is required])
7887     fi
7889     libo_MINGW_CHECK_DLL([libxslt])
7890     libo_MINGW_CHECK_DLL([libexslt])
7891     libo_MINGW_TRY_DLL([iconv])
7892 else
7893     AC_MSG_RESULT([internal])
7894     SYSTEM_LIBXSLT=
7895     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7897     if test "$cross_compiling" = "yes"; then
7898         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7899         if test "$XSLTPROC" = "no"; then
7900             AC_MSG_ERROR([xsltproc is required])
7901         fi
7902     fi
7904 AC_SUBST(SYSTEM_LIBXSLT)
7905 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7906     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7908 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7910 AC_SUBST(LIBEXSLT_CFLAGS)
7911 AC_SUBST(LIBEXSLT_LIBS)
7912 AC_SUBST(LIBXSLT_CFLAGS)
7913 AC_SUBST(LIBXSLT_LIBS)
7914 AC_SUBST(XSLTPROC)
7916 # ===================================================================
7917 # Check for system libxml
7918 # ===================================================================
7919 AC_MSG_CHECKING([which libxml to use])
7920 if test "$with_system_libxml" = "yes"; then
7921     AC_MSG_RESULT([external])
7922     SYSTEM_LIBXML=TRUE
7923     if test "$_os" = "Darwin"; then
7924         dnl make sure to use SDK path
7925         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7926         dnl omit -L/usr/lib
7927         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7928     elif test $_os = iOS; then
7929         dnl make sure to use SDK path
7930         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7931         LIBXML_CFLAGS="-I$usr/include/libxml2"
7932         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7933     else
7934         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7935         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7936         FilterLibs "${LIBXML_LIBS}"
7937         LIBXML_LIBS="${filteredlibs}"
7938     fi
7940     dnl Check for xmllint
7941     AC_PATH_PROG(XMLLINT, xmllint, no)
7942     if test "$XMLLINT" = "no"; then
7943         AC_MSG_ERROR([xmllint is required])
7944     fi
7946     libo_MINGW_CHECK_DLL([libxml2])
7947     libo_MINGW_TRY_DLL([zlib1])
7948 else
7949     AC_MSG_RESULT([internal])
7950     SYSTEM_LIBXML=
7951     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
7952     if test "$COM" = "MSC"; then
7953         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7954     fi
7955     if test "$COM" = "MSC"; then
7956         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
7957     else
7958         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
7959     fi
7960     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7962 AC_SUBST(SYSTEM_LIBXML)
7963 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7964     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7966 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7967 AC_SUBST(LIBXML_CFLAGS)
7968 AC_SUBST(LIBXML_LIBS)
7969 AC_SUBST(XMLLINT)
7971 # =====================================================================
7972 # Checking for a Python interpreter with version >= 2.6.
7973 # Build and runtime requires Python 3 compatible version (>= 2.6).
7974 # Optionally user can pass an option to configure, i. e.
7975 # ./configure PYTHON=/usr/bin/python
7976 # =====================================================================
7977 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7978     # This allows a lack of system python with no error, we use internal one in that case.
7979     AM_PATH_PYTHON([2.6],, [:])
7980     # Clean PYTHON_VERSION checked below if cross-compiling
7981     PYTHON_VERSION=""
7982     if test "$PYTHON" != ":"; then
7983         PYTHON_FOR_BUILD=$PYTHON
7984     fi
7986 AC_SUBST(PYTHON_FOR_BUILD)
7988 # Checks for Python to use for Pyuno
7989 AC_MSG_CHECKING([which Python to use for Pyuno])
7990 case "$enable_python" in
7991 no|disable)
7992     if test -z $PYTHON_FOR_BUILD; then
7993         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7994         # requirement from the choice whether to include Python stuff in the installer, but why
7995         # bother?
7996         AC_MSG_ERROR([Python is required at build time.])
7997     fi
7998     enable_python=no
7999     AC_MSG_RESULT([none])
8000     ;;
8001 ""|yes|auto)
8002     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8003         AC_MSG_RESULT([no, overridden by --disable-scripting])
8004         enable_python=no
8005     elif test $build_os = cygwin; then
8006         dnl When building on Windows we don't attempt to use any installed
8007         dnl "system"  Python.
8008         dnl
8009         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
8010         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
8011         dnl MinGW cross-compilation setups.)
8012         AC_MSG_RESULT([fully internal])
8013         enable_python=internal
8014     elif test "$cross_compiling" = yes; then
8015         AC_MSG_RESULT([system])
8016         enable_python=system
8017     else
8018         # Unset variables set by the above AM_PATH_PYTHON so that
8019         # we actually do check anew.
8020         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
8021         AM_PATH_PYTHON([3.3],, [:])
8022         if test "$PYTHON" = ":"; then
8023             if test -z "$PYTHON_FOR_BUILD"; then
8024                 AC_MSG_RESULT([fully internal])
8025             else
8026                 AC_MSG_RESULT([internal])
8027             fi
8028             enable_python=internal
8029         else
8030             AC_MSG_RESULT([system])
8031             enable_python=system
8032         fi
8033     fi
8034     ;;
8035 internal)
8036     AC_MSG_RESULT([internal])
8037     ;;
8038 fully-internal)
8039     AC_MSG_RESULT([fully internal])
8040     enable_python=internal
8041     ;;
8042 system)
8043     AC_MSG_RESULT([system])
8044     ;;
8046     AC_MSG_ERROR([Incorrect --enable-python option])
8047     ;;
8048 esac
8050 if test $enable_python != no; then
8051     BUILD_TYPE="$BUILD_TYPE PYUNO"
8054 if test $enable_python = system; then
8055     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8056         python_version=2.7
8057         PYTHON=python$python_version
8058         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8059             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8060             PYTHON_LIBS="-framework Python"
8061         else
8062             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8063             PYTHON_LIBS="`$PYTHON-config --libs`"
8064         fi
8065     fi
8066     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8067         # Fallback: Accept these in the environment, or as set above
8068         # for MacOSX.
8069         :
8070     elif test "$cross_compiling" != yes; then
8071         # Unset variables set by the above AM_PATH_PYTHON so that
8072         # we actually do check anew.
8073         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
8074         # This causes an error if no python command is found
8075         AM_PATH_PYTHON([3.3])
8076         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8077         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8078         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8079         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8080         if test -z "$PKG_CONFIG"; then
8081             PYTHON_CFLAGS="-I$python_include"
8082             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8083         elif $PKG_CONFIG --exists python-$python_version; then
8084             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8085             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8086         else
8087             PYTHON_CFLAGS="-I$python_include"
8088             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8089         fi
8090         FilterLibs "${PYTHON_LIBS}"
8091         PYTHON_LIBS="${filteredlibs}"
8092     else
8093         dnl How to find out the cross-compilation Python installation path?
8094         dnl Let's hardocode what we know for different distributions for now...
8095         for python_version in 2.6; do
8096             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8097                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8098                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8099                 AC_MSG_CHECKING([for python.exe])
8100                 libo_MINGW_CHECK_DLL([libpython$python_version])
8101                 libo_MINGW_CHECK_DLL([libreadline6])
8102                 libo_MINGW_CHECK_DLL([libtermcap])
8103                 # could we somehow extract the really mingw python version from
8104                 # actual distro package?
8105                 # 2.6.2 currently on OpenSUSE 12.1?
8106                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8107                 PYTHON_VERSION=$python_version.2
8108                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8109                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8110                 break
8111             fi
8112         done
8113         AC_MSG_CHECKING([for python version])
8114         AS_IF([test -n "$PYTHON_VERSION"],
8115               [AC_MSG_RESULT([$PYTHON_VERSION])],
8116               [AC_MSG_RESULT([not found])
8117                AC_MSG_ERROR([no usable python found])])
8118         test -n "$PYTHON_CFLAGS" && break
8119     fi
8120     # let the PYTHON_FOR_BUILD match the same python installation that
8121     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8122     # better for PythonTests.
8123     PYTHON_FOR_BUILD=$PYTHON
8126 dnl By now enable_python should be "system", "internal" or "no"
8127 case $enable_python in
8128 system)
8129     SYSTEM_PYTHON=TRUE
8131     dnl Check if the headers really work
8132     save_CPPFLAGS="$CPPFLAGS"
8133     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8134     AC_CHECK_HEADER(Python.h, [],
8135        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8136        [])
8137     CPPFLAGS="$save_CPPFLAGS"
8139     AC_LANG_PUSH(C)
8140     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8141     AC_MSG_CHECKING([for correct python library version])
8142        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8143 #include <Python.h>
8145 int main(int argc, char **argv) {
8146    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8147        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8148    else return 1;
8150        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.6 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8151     CFLAGS=$save_CFLAGS
8152     AC_LANG_POP(C)
8154     dnl FIXME Check if the Python library can be linked with, too?
8155     ;;
8157 internal)
8158     SYSTEM_PYTHON=
8159     PYTHON_VERSION_MAJOR=3
8160     # On windows we are supporting two different python versions: 3.3 and 3.5.
8161     # We msut do it as long as we support MSVC 2013. Python 3.3 can be removed
8162     # when MSVC 2013 support was dropped.
8163     if test "$COM" = "MSC" -a "$VCVER" = "120"; then
8164         PYTHON_VERSION_MINOR=3
8165     else
8166         PYTHON_VERSION_MINOR=5
8167     fi
8168     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
8169     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8170     BUILD_TYPE="$BUILD_TYPE PYTHON"
8171     # Embedded Python dies without Home set
8172     if test "$HOME" = ""; then
8173         export HOME=""
8174     fi
8175     # bz2 tarball and bzip2 is not standard
8176     if test -z "$BZIP2"; then
8177         AC_PATH_PROG( BZIP2, bzip2)
8178         if test -z "$BZIP2"; then
8179             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8180         fi
8181     fi
8182     ;;
8184     DISABLE_PYTHON=TRUE
8185     SYSTEM_PYTHON=
8186     ;;
8188     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8189     ;;
8190 esac
8192 AC_SUBST(DISABLE_PYTHON)
8193 AC_SUBST(SYSTEM_PYTHON)
8194 AC_SUBST(PYTHON_CFLAGS)
8195 AC_SUBST(PYTHON_LIBS)
8196 AC_SUBST(PYTHON_VERSION)
8197 AC_SUBST(PYTHON_VERSION_MAJOR)
8198 AC_SUBST(PYTHON_VERSION_MINOR)
8200 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8201 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8202     AC_MSG_RESULT([yes])
8203     ENABLE_MARIADBC=TRUE
8204     MARIADBC_MAJOR=1
8205     MARIADBC_MINOR=0
8206     MARIADBC_MICRO=2
8207     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8208 else
8209     AC_MSG_RESULT([no])
8210     ENABLE_MARIADBC=
8212 AC_SUBST(ENABLE_MARIADBC)
8213 AC_SUBST(MARIADBC_MAJOR)
8214 AC_SUBST(MARIADBC_MINOR)
8215 AC_SUBST(MARIADBC_MICRO)
8217 if test "$ENABLE_MARIADBC" = "TRUE"; then
8219     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8221     dnl ===================================================================
8222     dnl Check for system MariaDB
8223     dnl ===================================================================
8224     AC_MSG_CHECKING([which MariaDB to use])
8225     if test "$with_system_mariadb" = "yes"; then
8226         AC_MSG_RESULT([external])
8227         SYSTEM_MARIADB=TRUE
8228         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8229         if test -z "$MARIADBCONFIG"; then
8230             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8231             if test -z "$MARIADBCONFIG"; then
8232                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8233                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8234             fi
8235         fi
8236         AC_MSG_CHECKING([MariaDB version])
8237         MARIADB_VERSION=`$MARIADBCONFIG --version`
8238         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8239         if test "$MARIADB_MAJOR" -ge "5"; then
8240             AC_MSG_RESULT([OK])
8241         else
8242             AC_MSG_ERROR([too old, use 5.0.x or later])
8243         fi
8244         AC_MSG_CHECKING([for MariaDB Client library])
8245         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8246         if test "$COM_IS_CLANG" = TRUE; then
8247             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8248         fi
8249         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8250         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8251         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8252         dnl linux32:
8253         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8254             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8255             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8256                 | sed -e 's|/lib64/|/lib/|')
8257         fi
8258         FilterLibs "${MARIADB_LIBS}"
8259         MARIADB_LIBS="${filteredlibs}"
8260         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8261         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8262         if test "$enable_bundle_mariadb" = "yes"; then
8263             AC_MSG_RESULT([yes])
8264             BUNDLE_MARIADB=TRUE
8265             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8267 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8269 /g' | grep -E '(mysqlclient|mariadb)')
8270             if test "$_os" = "Darwin"; then
8271                 LIBMARIADB=${LIBMARIADB}.dylib
8272             elif test "$_os" = "WINNT"; then
8273                 LIBMARIADB=${LIBMARIADB}.dll
8274             else
8275                 LIBMARIADB=${LIBMARIADB}.so
8276             fi
8277             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8278             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8279             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8280                 AC_MSG_RESULT([found.])
8281                 PathFormat "$LIBMARIADB_PATH"
8282                 LIBMARIADB_PATH="$formatted_path"
8283             else
8284                 AC_MSG_ERROR([not found.])
8285             fi
8286         else
8287             AC_MSG_RESULT([no])
8288             BUNDLE_MARIADB=
8289         fi
8290     else
8291         AC_MSG_RESULT([internal])
8292         SYSTEM_MARIADB=
8293         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8294         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8295         BUILD_TYPE="$BUILD_TYPE MARIADB"
8296     fi
8298     AC_SUBST(SYSTEM_MARIADB)
8299     AC_SUBST(MARIADB_CFLAGS)
8300     AC_SUBST(MARIADB_LIBS)
8301     AC_SUBST(LIBMARIADB)
8302     AC_SUBST(LIBMARIADB_PATH)
8303     AC_SUBST(BUNDLE_MARIADB)
8305     AC_LANG_PUSH([C++])
8306     dnl ===================================================================
8307     dnl Check for system MySQL C++ Connector
8308     dnl ===================================================================
8309     # FIXME!
8310     # who thought this too-generic cppconn dir was a good idea?
8311     AC_MSG_CHECKING([MySQL Connector/C++])
8312     if test "$with_system_mysql_cppconn" = "yes"; then
8313         AC_MSG_RESULT([external])
8314         SYSTEM_MYSQL_CPPCONN=TRUE
8315         AC_LANG_PUSH([C++])
8316         AC_CHECK_HEADER(mysql_driver.h, [],
8317                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8318         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8319                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8320         save_LIBS=$LIBS
8321         LIBS="$LIBS -lmysqlcppconn"
8322         AC_MSG_CHECKING([version])
8323         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8324 #include <mysql_driver.h>
8326 int main(int argc, char **argv) {
8327     sql::Driver *driver;
8328     driver = get_driver_instance();
8329     if (driver->getMajorVersion() > 1 || \
8330        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8331        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8332         return 0;
8333       else
8334         return 1;
8336       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[AC_MSG_ERROR([MySQL C++ Connecter not tested with cross-compilation])])
8338         AC_LANG_POP([C++])
8339         LIBS=$save_LIBS
8340     else
8341         AC_MSG_RESULT([internal])
8342         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8343         SYSTEM_MYSQL_CPPCONN=
8344     fi
8345     AC_LANG_POP([C++])
8347 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8349 dnl ===================================================================
8350 dnl Check for system hsqldb
8351 dnl ===================================================================
8352 if test "$with_java" != "no"; then
8353     HSQLDB_USE_JDBC_4_1=
8354     AC_MSG_CHECKING([which hsqldb to use])
8355     if test "$with_system_hsqldb" = "yes"; then
8356         AC_MSG_RESULT([external])
8357         SYSTEM_HSQLDB=TRUE
8358         if test -z $HSQLDB_JAR; then
8359             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8360         fi
8361         if ! test -f $HSQLDB_JAR; then
8362                AC_MSG_ERROR(hsqldb.jar not found.)
8363         fi
8364         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8365         export HSQLDB_JAR
8366         if $PERL -e \
8367            'use Archive::Zip;
8368             my $file = "$ENV{'HSQLDB_JAR'}";
8369             my $zip = Archive::Zip->new( $file );
8370             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8371             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8372             {
8373                 push @l, split(/\n/, $mf);
8374                 foreach my $line (@l)
8375                 {
8376                     if ($line =~ m/Specification-Version:/)
8377                     {
8378                         ($t, $version) = split (/:/,$line);
8379                         $version =~ s/^\s//;
8380                         ($a, $b, $c, $d) = split (/\./,$version);
8381                         if ($c == "0" && $d > "8")
8382                         {
8383                             exit 0;
8384                         }
8385                         else
8386                         {
8387                             exit 1;
8388                         }
8389                     }
8390                 }
8391             }
8392             else
8393             {
8394                 exit 1;
8395             }'; then
8396             AC_MSG_RESULT([yes])
8397         else
8398             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8399         fi
8400     else
8401         AC_MSG_RESULT([internal])
8402         SYSTEM_HSQLDB=
8403         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8404         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8405         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8406         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8407             AC_MSG_RESULT([yes])
8408             HSQLDB_USE_JDBC_4_1=TRUE
8409         else
8410             AC_MSG_RESULT([no])
8411         fi
8412     fi
8413     AC_SUBST(SYSTEM_HSQLDB)
8414     AC_SUBST(HSQLDB_JAR)
8415     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8418 dnl ===================================================================
8419 dnl Check for PostgreSQL stuff
8420 dnl ===================================================================
8421 if test "x$enable_postgresql_sdbc" != "xno"; then
8422     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8424     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8425         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8426     fi
8427     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8428         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8429     fi
8431     postgres_interface=""
8432     if test "$with_system_postgresql" = "yes"; then
8433         postgres_interface="external PostgreSQL"
8434         SYSTEM_POSTGRESQL=TRUE
8435         if test "$_os" = Darwin; then
8436             supp_path=''
8437             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8438                 pg_supp_path="$P_SEP$d$pg_supp_path"
8439             done
8440         fi
8441         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8442         if test -z "$PGCONFIG"; then
8443             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8444         fi
8445         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8446         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8447         FilterLibs "${POSTGRESQL_LIB}"
8448         POSTGRESQL_LIB="${filteredlibs}"
8449     else
8450         # if/when anything else than PostgreSQL uses Kerberos,
8451         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8452         WITH_KRB5=
8453         WITH_GSSAPI=
8454         case "$_os" in
8455         Darwin)
8456             # MacOS X has system MIT Kerberos 5 since 10.4
8457             if test "$with_krb5" != "no"; then
8458                 WITH_KRB5=TRUE
8459                 save_LIBS=$LIBS
8460                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8461                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8462                 KRB5_LIBS=$LIBS
8463                 LIBS=$save_LIBS
8464                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8465                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8466                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8467                 LIBS=$save_LIBS
8468             fi
8469             if test "$with_gssapi" != "no"; then
8470                 WITH_GSSAPI=TRUE
8471                 save_LIBS=$LIBS
8472                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8473                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8474                 GSSAPI_LIBS=$LIBS
8475                 LIBS=$save_LIBS
8476             fi
8477             ;;
8478         WINNT)
8479             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8480                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8481             fi
8482             ;;
8483         Linux|GNU|*BSD|DragonFly)
8484             if test "$with_krb5" != "no"; then
8485                 WITH_KRB5=TRUE
8486                 save_LIBS=$LIBS
8487                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8488                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8489                 KRB5_LIBS=$LIBS
8490                 LIBS=$save_LIBS
8491                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8492                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8493                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8494                 LIBS=$save_LIBS
8495             fi
8496             if test "$with_gssapi" != "no"; then
8497                 WITH_GSSAPI=TRUE
8498                 save_LIBS=$LIBS
8499                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8500                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8501                 GSSAPI_LIBS=$LIBS
8502                 LIBS=$save_LIBS
8503             fi
8504             ;;
8505         *)
8506             if test "$with_krb5" = "yes"; then
8507                 WITH_KRB5=TRUE
8508                 save_LIBS=$LIBS
8509                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8510                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8511                 KRB5_LIBS=$LIBS
8512                 LIBS=$save_LIBS
8513                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8514                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8515                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8516                 LIBS=$save_LIBS
8517             fi
8518             if test "$with_gssapi" = "yes"; then
8519                 WITH_GSSAPI=TRUE
8520                 save_LIBS=$LIBS
8521                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8522                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8523                 LIBS=$save_LIBS
8524                 GSSAPI_LIBS=$LIBS
8525             fi
8526         esac
8528         if test -n "$with_libpq_path"; then
8529             SYSTEM_POSTGRESQL=TRUE
8530             postgres_interface="external libpq"
8531             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8532             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8533         else
8534             SYSTEM_POSTGRESQL=
8535             postgres_interface="internal"
8536             POSTGRESQL_LIB=""
8537             POSTGRESQL_INC="%OVERRIDE_ME%"
8538             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8539         fi
8540     fi
8542     AC_MSG_CHECKING([PostgreSQL C interface])
8543     AC_MSG_RESULT([$postgres_interface])
8545     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8546         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8547         save_CFLAGS=$CFLAGS
8548         save_CPPFLAGS=$CPPFLAGS
8549         save_LIBS=$LIBS
8550         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8551         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8552         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8553         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8554             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8555         CFLAGS=$save_CFLAGS
8556         CPPFLAGS=$save_CPPFLAGS
8557         LIBS=$save_LIBS
8558     fi
8559     BUILD_POSTGRESQL_SDBC=TRUE
8561 AC_SUBST(WITH_KRB5)
8562 AC_SUBST(WITH_GSSAPI)
8563 AC_SUBST(GSSAPI_LIBS)
8564 AC_SUBST(KRB5_LIBS)
8565 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8566 AC_SUBST(SYSTEM_POSTGRESQL)
8567 AC_SUBST(POSTGRESQL_INC)
8568 AC_SUBST(POSTGRESQL_LIB)
8570 dnl ===================================================================
8571 dnl Check for Firebird stuff
8572 dnl ===================================================================
8573 ENABLE_FIREBIRD_SDBC=""
8574 if test "$enable_firebird_sdbc" = "yes" ; then
8575     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8577     dnl ===================================================================
8578     dnl Check for system Firebird
8579     dnl ===================================================================
8580     AC_MSG_CHECKING([which Firebird to use])
8581     if test "$with_system_firebird" = "yes"; then
8582         AC_MSG_RESULT([external])
8583         SYSTEM_FIREBIRD=TRUE
8584         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8585         if test -z "$FIREBIRDCONFIG"; then
8586             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8587             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8588             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8589         else
8590             AC_MSG_NOTICE([fb_config found])
8591             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8592             AC_MSG_CHECKING([for Firebird Client library])
8593             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8594             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8595             FilterLibs "${FIREBIRD_LIBS}"
8596             FIREBIRD_LIBS="${filteredlibs}"
8597         fi
8598         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8599         AC_MSG_CHECKING([Firebird version])
8600         if test -n "${FIREBIRD_VERSION}"; then
8601             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8602             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8603             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8604                 AC_MSG_RESULT([OK])
8605             else
8606                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8607             fi
8608         else
8609             __save_CFLAGS="${CFLAGS}"
8610             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8611             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8612 #if defined(FB_API_VER) && FB_API_VER == 25
8613 #else
8614 #error "Wrong Firebird API version"
8615 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8616             CFLAGS="${__save_CFLAGS}"
8617         fi
8618         ENABLE_FIREBIRD_SDBC="TRUE"
8619     elif test "$enable_database_connectivity" != yes; then
8620         AC_MSG_RESULT([none])
8621     elif test "$cross_compiling" = "yes"; then
8622         AC_MSG_RESULT([none])
8623     else
8624         dnl We need libatomic-ops for any non X86/X64 system
8625         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8626             dnl ===================================================================
8627             dnl Check for system libatomic-ops
8628             dnl ===================================================================
8629             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8630             if test "$with_system_libatomic_ops" = "yes"; then
8631                 SYSTEM_LIBATOMIC_OPS=TRUE
8632                 AC_CHECK_HEADERS(atomic_ops.h, [],
8633                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8634             else
8635                 SYSTEM_LIBATOMIC_OPS=
8636                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8637                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8638                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8639             fi
8640         fi
8642         AC_MSG_RESULT([internal])
8643         SYSTEM_FIREBIRD=
8644         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8645         FIREBIRD_LIBS="-lfbembed"
8647         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8648         ENABLE_FIREBIRD_SDBC="TRUE"
8649     fi
8651 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8652 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8653 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8654 AC_SUBST(LIBATOMIC_OPS_LIBS)
8655 AC_SUBST(SYSTEM_FIREBIRD)
8656 AC_SUBST(FIREBIRD_CFLAGS)
8657 AC_SUBST(FIREBIRD_LIBS)
8658 dnl AC_SUBST([TOMMATH_CFLAGS])
8659 dnl AC_SUBST([TOMMATH_LIBS])
8661 dnl ===================================================================
8662 dnl Check for system curl
8663 dnl ===================================================================
8664 AC_MSG_CHECKING([which libcurl to use])
8665 if test "$with_system_curl" = "auto"; then
8666     with_system_curl="$with_system_libs"
8669 if test "$with_system_curl" = "yes"; then
8670     AC_MSG_RESULT([external])
8671     SYSTEM_CURL=TRUE
8673     # First try PKGCONFIG and then fall back
8674     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8676     if test -n "$CURL_PKG_ERRORS"; then
8677         AC_PATH_PROG(CURLCONFIG, curl-config)
8678         if test -z "$CURLCONFIG"; then
8679             AC_MSG_ERROR([curl development files not found])
8680         fi
8681         CURL_LIBS=`$CURLCONFIG --libs`
8682         FilterLibs "${CURL_LIBS}"
8683         CURL_LIBS="${filteredlibs}"
8684         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8685         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8687         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8688         case $curl_version in
8689         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8690         dnl so they need to be doubled to end up in the configure script
8691         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8692             AC_MSG_RESULT([yes])
8693             ;;
8694         *)
8695             AC_MSG_ERROR([no, you have $curl_version])
8696             ;;
8697         esac
8698     fi
8700     libo_MINGW_CHECK_DLL([libcurl])
8701     libo_MINGW_TRY_DLL([libintl])
8702     libo_MINGW_TRY_DLL([libidn])
8703     libo_MINGW_TRY_DLL([libnspr4])
8704     libo_MINGW_TRY_DLL([nssutil3])
8705     libo_MINGW_TRY_DLL([libplc4])
8706     libo_MINGW_TRY_DLL([libplds4])
8707     libo_MINGW_TRY_DLL([nss3])
8708     libo_MINGW_TRY_DLL([ssl3])
8709     libo_MINGW_TRY_DLL([libgpg-error])
8710     libo_MINGW_TRY_DLL([libgcrypt])
8711     libo_MINGW_TRY_DLL([libssh2])
8712     ENABLE_CURL=TRUE
8713 elif test $_os = iOS; then
8714     # Let's see if we need curl, I think not?
8715     AC_MSG_RESULT([none])
8716     ENABLE_CURL=
8717 else
8718     AC_MSG_RESULT([internal])
8719     SYSTEM_CURL=
8720     BUILD_TYPE="$BUILD_TYPE CURL"
8721     ENABLE_CURL=TRUE
8723 AC_SUBST(SYSTEM_CURL)
8724 AC_SUBST(CURL_CFLAGS)
8725 AC_SUBST(CURL_LIBS)
8726 AC_SUBST(ENABLE_CURL)
8728 dnl ===================================================================
8729 dnl Check for system boost
8730 dnl ===================================================================
8731 AC_MSG_CHECKING([which boost to use])
8732 if test "$with_system_boost" = "yes"; then
8733     AC_MSG_RESULT([external])
8734     SYSTEM_BOOST=TRUE
8735     AX_BOOST_BASE(1.47)
8736     AX_BOOST_DATE_TIME
8737     AX_BOOST_IOSTREAMS
8738     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8739     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8740     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8741         # if not found, try again with 'lib' prefix
8742         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8743     fi
8744     AC_LANG_PUSH([C++])
8745     save_CXXFLAGS=$CXXFLAGS
8746     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8747     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8748        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8749     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8750        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8751     AC_CHECK_HEADER(boost/function.hpp, [],
8752        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8753     AC_MSG_CHECKING([whether boost signals2 works])
8754     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/signals2/signal.hpp>]],
8755         [[ boost::signals2::signal<void()> s; s(); ]])],
8756         [AC_MSG_RESULT([yes])],
8757         [AC_MSG_ERROR([no, install boost >= 1.55 or use --without-system-boost])])
8758     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8759     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8760     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8761 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8762     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8763         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8764     else
8765         AC_MSG_RESULT([yes])
8766     fi
8767     CXXFLAGS=$save_CXXFLAGS
8768     AC_LANG_POP([C++])
8769     # this is in m4/ax_boost_base.m4
8770     FilterLibs "${BOOST_LDFLAGS}"
8771     BOOST_LDFLAGS="${filteredlibs}"
8772 else
8773     AC_MSG_RESULT([internal])
8774     BUILD_TYPE="$BUILD_TYPE BOOST"
8775     SYSTEM_BOOST=
8777 AC_SUBST(SYSTEM_BOOST)
8779 dnl ===================================================================
8780 dnl Check for system mdds
8781 dnl ===================================================================
8782 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.0 >= 1.0.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8784 dnl ===================================================================
8785 dnl Check for system glm
8786 dnl ===================================================================
8787 AC_MSG_CHECKING([which glm to use])
8788 if test "$with_system_glm" = "yes"; then
8789     AC_MSG_RESULT([external])
8790     SYSTEM_GLM=TRUE
8791     AC_LANG_PUSH([C++])
8792     AC_CHECK_HEADER([glm/glm.hpp], [],
8793        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8794     AC_LANG_POP([C++])
8795 else
8796     AC_MSG_RESULT([internal])
8797     BUILD_TYPE="$BUILD_TYPE GLM"
8798     SYSTEM_GLM=
8799     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8801 AC_SUBST([GLM_CFLAGS])
8802 AC_SUBST([SYSTEM_GLM])
8804 dnl ===================================================================
8805 dnl Check for system glew
8806 dnl ===================================================================
8807 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8808 AS_IF([test "$with_system_glew" = "yes"],
8809     [PKG_CHECK_EXISTS([glew >= 1.12.0], [AC_DEFINE([HAVE_GLEW_1_12])])],
8810     [AC_DEFINE([HAVE_GLEW_1_12])])
8812 dnl ===================================================================
8813 dnl Check for system glyphy
8814 dnl ===================================================================
8815 dnl We currently use GLyphy only on Windows
8816 if test $_os = WINNT; then
8817     libo_CHECK_SYSTEM_MODULE([glyphy], [GLYPHY], [glyphy >= 0.12.0], ["-I${WORKDIR}/UnpackedTarball/glyphy/src"])
8820 dnl ===================================================================
8821 dnl Check for system odbc
8822 dnl ===================================================================
8823 AC_MSG_CHECKING([which odbc headers to use])
8824 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
8825     AC_MSG_RESULT([external])
8826     SYSTEM_ODBC_HEADERS=TRUE
8828     if test "$build_os" = "cygwin"; then
8829         save_CPPFLAGS=$CPPFLAGS
8830         find_winsdk
8831         PathFormat "$winsdktest"
8832         CPPFLAGS="$CPPFLAGS -I$formatted_path/include/um -I$formatted_path/Include/$winsdklibsubdir/um -I$formatted_path/include -I$formatted_path/include/shared"
8833         AC_CHECK_HEADER(sqlext.h, [],
8834             [AC_MSG_ERROR(odbc not found. install odbc)],
8835             [#include <windows.h>])
8836         CPPFLAGS=$save_CPPFLAGS
8837     else
8838         AC_CHECK_HEADER(sqlext.h, [],
8839             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8840     fi
8841 elif test "$enable_database_connectivity" != yes; then
8842     AC_MSG_RESULT([none])
8843 else
8844     AC_MSG_RESULT([internal])
8845     SYSTEM_ODBC_HEADERS=
8847 AC_SUBST(SYSTEM_ODBC_HEADERS)
8850 dnl ===================================================================
8851 dnl Check for system openldap
8852 dnl ===================================================================
8854 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8855 AC_MSG_CHECKING([which openldap library to use])
8856 if test "$with_system_openldap" = "yes"; then
8857     AC_MSG_RESULT([external])
8858     SYSTEM_OPENLDAP=TRUE
8859     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8860     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8861     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8862 else
8863     AC_MSG_RESULT([internal])
8864     SYSTEM_OPENLDAP=
8865     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8868 AC_SUBST(SYSTEM_OPENLDAP)
8870 dnl ===================================================================
8871 dnl Check for TLS/SSL and cryptographic implementation to use
8872 dnl ===================================================================
8873 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8874 if test -n "$with_tls"; then
8875     case $with_tls in
8876     openssl)
8877         AC_DEFINE(USE_TLS_OPENSSL)
8878         TLS=OPENSSL
8880         if test "$enable_openssl" != "yes"; then
8881             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8882         fi
8884         # warn that OpenSSL has been selected but not all TLS code has this option
8885         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8886         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8887         ;;
8888     nss)
8889         AC_DEFINE(USE_TLS_NSS)
8890         TLS=NSS
8891         ;;
8892     *)
8893         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8894 openssl - OpenSSL
8895 nss - Mozilla's Network Security Services (NSS)
8896     ])
8897         ;;
8898     esac
8899 elif test $_os = iOS -o $_os = Android; then
8900     # We don't build NSS for iOS and Android
8901     AC_DEFINE(USE_TLS_OPENSSL)
8902     TLS=OPENSSL
8903 else
8904     # default to using NSS, it results in smaller oox lib
8905     AC_DEFINE(USE_TLS_NSS)
8906     TLS=NSS
8908 AC_MSG_RESULT([$TLS])
8909 AC_SUBST(TLS)
8911 dnl ===================================================================
8912 dnl Check for system NSS
8913 dnl ===================================================================
8914 if test $_os != iOS; then
8915     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8917 if test "$with_system_nss" = "yes"; then
8918     libo_MINGW_CHECK_DLL([libnspr4])
8919     libo_MINGW_CHECK_DLL([libplc4])
8920     libo_MINGW_CHECK_DLL([libplds4])
8921     libo_MINGW_CHECK_DLL([nss3])
8922     libo_MINGW_CHECK_DLL([nssutil3])
8923     libo_MINGW_CHECK_DLL([smime3])
8924     libo_MINGW_CHECK_DLL([ssl3])
8927 if test $_os = WINNT -a -z "$ENABLE_RELEASE_BUILD" -a "$with_prebuilt_openssl" = yes; then
8928     BUILD_TYPE="$BUILD_TYPE PREBUILT_OPENSSL"
8931 dnl ===================================================================
8932 dnl Check for system sane
8933 dnl ===================================================================
8934 AC_MSG_CHECKING([which sane header to use])
8935 if test "$with_system_sane" = "yes"; then
8936     AC_MSG_RESULT([external])
8937     AC_CHECK_HEADER(sane/sane.h, [],
8938       [AC_MSG_ERROR(sane not found. install sane)], [])
8939 else
8940     AC_MSG_RESULT([internal])
8941     BUILD_TYPE="$BUILD_TYPE SANE"
8944 dnl ===================================================================
8945 dnl Check for system icu
8946 dnl ===================================================================
8947 SYSTEM_GENBRK=
8948 SYSTEM_GENCCODE=
8949 SYSTEM_GENCMN=
8951 ICU_MAJOR=56
8952 ICU_MINOR=1
8953 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
8954 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
8955 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
8956 AC_MSG_CHECKING([which icu to use])
8957 if test "$with_system_icu" = "yes"; then
8958     AC_MSG_RESULT([external])
8959     SYSTEM_ICU=TRUE
8960     AC_LANG_PUSH([C++])
8961     AC_MSG_CHECKING([for unicode/rbbi.h])
8962     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
8963     AC_LANG_POP([C++])
8965     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
8966         ICUPATH="$PATH"
8967         if test "$WITH_MINGW" = "yes"; then
8968             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
8969         fi
8970         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
8972         AC_MSG_CHECKING([ICU version])
8973         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
8974         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
8975         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
8977         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "6" \); then
8978             AC_MSG_RESULT([OK, $ICU_VERSION])
8979         else
8980             AC_MSG_ERROR([not suitable, only >= 4.6 supported currently])
8981         fi
8982     fi
8984     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
8985         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
8986         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
8987         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
8988         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
8989         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
8990         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
8991             AC_MSG_RESULT([yes])
8992         else
8993             AC_MSG_RESULT([no])
8994             if test "$with_system_icu_for_build" != "force"; then
8995                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
8996 You can use --with-system-icu-for-build=force to use it anyway.])
8997             fi
8998         fi
8999     fi
9001     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9002         # using the system icu tools can lead to version confusion, use the
9003         # ones from the build environment when cross-compiling
9004         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9005         if test -z "$SYSTEM_GENBRK"; then
9006             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9007         fi
9008         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9009         if test -z "$SYSTEM_GENCCODE"; then
9010             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9011         fi
9012         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9013         if test -z "$SYSTEM_GENCMN"; then
9014             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9015         fi
9016         if test "$ICU_MAJOR" -ge "49"; then
9017             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9018             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9019             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9020         else
9021             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9022             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9023             ICU_RECLASSIFIED_HEBREW_LETTER=
9024         fi
9025     fi
9027     if test "$cross_compiling" = "yes"; then
9028         if test "$ICU_MAJOR" -ge "50"; then
9029             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9030             ICU_MINOR=""
9031         fi
9032     fi
9034     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9035     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9036     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9037 else
9038     AC_MSG_RESULT([internal])
9039     SYSTEM_ICU=
9040     BUILD_TYPE="$BUILD_TYPE ICU"
9041     # surprisingly set these only for "internal" (to be used by various other
9042     # external libs): the system icu-config is quite unhelpful and spits out
9043     # dozens of weird flags and also default path -I/usr/include
9044     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9045     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9047 AC_SUBST(SYSTEM_ICU)
9048 AC_SUBST(SYSTEM_GENBRK)
9049 AC_SUBST(SYSTEM_GENCCODE)
9050 AC_SUBST(SYSTEM_GENCMN)
9051 AC_SUBST(ICU_MAJOR)
9052 AC_SUBST(ICU_MINOR)
9053 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9054 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9055 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9056 AC_SUBST(ICU_CFLAGS)
9057 AC_SUBST(ICU_LIBS)
9059 dnl ===================================================================
9060 dnl Graphite
9061 dnl ===================================================================
9063 AC_MSG_CHECKING([whether to enable graphite support])
9064 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9065     AC_MSG_RESULT([yes])
9066     ENABLE_GRAPHITE="TRUE"
9067     AC_DEFINE(ENABLE_GRAPHITE)
9068     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9069     if test "$with_system_graphite" = "yes"; then
9070         libo_MINGW_CHECK_DLL([libgraphite2])
9071     fi
9072 else
9073     AC_MSG_RESULT([no])
9075 AC_SUBST(ENABLE_GRAPHITE)
9077 dnl ===================================================================
9078 dnl Orcus
9079 dnl ===================================================================
9081 AC_MSG_CHECKING([whether to enable orcus])
9082 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9083     AC_MSG_RESULT([yes])
9084     ENABLE_ORCUS="TRUE"
9085     AC_DEFINE(ENABLE_ORCUS)
9087     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.10 >= 0.9.0])
9088     if test "$with_system_orcus" != "yes"; then
9089         if test "$SYSTEM_BOOST" = "TRUE"; then
9090             # ===========================================================
9091             # Determine if we are going to need to link with Boost.System
9092             # ===========================================================
9093             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9094             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9095             dnl in documentation has no effect.
9096             AC_MSG_CHECKING([if we need to link with Boost.System])
9097             AC_LANG_PUSH([C++])
9098             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9099                     @%:@include <boost/version.hpp>
9100                 ]],[[
9101                     #if BOOST_VERSION >= 105000
9102                     #   error yes, we need to link with Boost.System
9103                     #endif
9104                 ]])],[
9105                     AC_MSG_RESULT([no])
9106                 ],[
9107                     AC_MSG_RESULT([yes])
9108                     AX_BOOST_SYSTEM
9109             ])
9110             AC_LANG_POP([C++])
9111         fi
9112     fi
9113     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9114     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9115     AC_SUBST([BOOST_SYSTEM_LIB])
9116     AC_SUBST(SYSTEM_LIBORCUS)
9118 else
9119     AC_MSG_RESULT([no])
9121 AC_SUBST(ENABLE_ORCUS)
9123 dnl ===================================================================
9124 dnl HarfBuzz
9125 dnl ===================================================================
9126 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9127 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9128     AC_MSG_RESULT([yes])
9129     ENABLE_HARFBUZZ="TRUE"
9130     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9131         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"])
9132     else
9133         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9134     fi
9135 else
9136     AC_MSG_RESULT([no])
9138 AC_SUBST(ENABLE_HARFBUZZ)
9140 AC_MSG_CHECKING([whether to use X11])
9141 dnl ***************************************
9142 dnl testing for X libraries and includes...
9143 dnl ***************************************
9144 if test "$USING_X11" = TRUE; then
9145     AC_DEFINE(HAVE_FEATURE_X11)
9147 AC_MSG_RESULT([$USING_X11])
9149 if test "$USING_X11" = TRUE; then
9150     AC_PATH_X
9151     AC_PATH_XTRA
9152     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9154     if test -z "$x_includes"; then
9155         x_includes="default_x_includes"
9156     fi
9157     if test -z "$x_libraries"; then
9158         x_libraries="default_x_libraries"
9159     fi
9160     CFLAGS="$CFLAGS $X_CFLAGS"
9161     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9162     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9163 else
9164     x_includes="no_x_includes"
9165     x_libraries="no_x_libraries"
9168 if test "$USING_X11" = TRUE; then
9169     dnl ===================================================================
9170     dnl Check for Composite.h for Mozilla plugin
9171     dnl ===================================================================
9172     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9173      [#include <X11/Intrinsic.h>])
9175     dnl ===================================================================
9176     dnl Check for extension headers
9177     dnl ===================================================================
9178     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9179      [#include <X11/extensions/shape.h>])
9181     # vcl needs ICE and SM
9182     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9183     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9184         [AC_MSG_ERROR(ICE library not found)])
9185     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9186     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9187         [AC_MSG_ERROR(SM library not found)])
9190 dnl ===================================================================
9191 dnl Check for system Xrender
9192 dnl ===================================================================
9193 AC_MSG_CHECKING([whether to use Xrender])
9194 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9195     AC_MSG_RESULT([yes])
9196     PKG_CHECK_MODULES(XRENDER, xrender)
9197     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9198     FilterLibs "${XRENDER_LIBS}"
9199     XRENDER_LIBS="${filteredlibs}"
9200     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9201       [AC_MSG_ERROR(libXrender not found or functional)], [])
9202     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9203       [AC_MSG_ERROR(Xrender not found. install X)], [])
9204 else
9205     AC_MSG_RESULT([no])
9207 AC_SUBST(XRENDER_CFLAGS)
9208 AC_SUBST(XRENDER_LIBS)
9210 dnl ===================================================================
9211 dnl Check for XRandr
9212 dnl ===================================================================
9213 AC_MSG_CHECKING([whether to enable RandR support])
9214 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9215     AC_MSG_RESULT([yes])
9216     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9217     if test "$ENABLE_RANDR" != "TRUE"; then
9218         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9219                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9220         XRANDR_CFLAGS=" "
9221         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9222           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9223         XRANDR_LIBS="-lXrandr "
9224         ENABLE_RANDR="TRUE"
9225     fi
9226     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9227     FilterLibs "${XRANDR_LIBS}"
9228     XRANDR_LIBS="${filteredlibs}"
9229 else
9230     ENABLE_RANDR=""
9231     AC_MSG_RESULT([no])
9233 AC_SUBST(XRANDR_CFLAGS)
9234 AC_SUBST(XRANDR_LIBS)
9235 AC_SUBST(ENABLE_RANDR)
9237 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9238     WITH_WEBDAV="serf"
9240 if test $_os = iOS -o $_os = Android; then
9241     WITH_WEBDAV="no"
9243 AC_MSG_CHECKING([for webdav library])
9244 case "$WITH_WEBDAV" in
9245 serf)
9246     AC_MSG_RESULT([serf])
9247     # Check for system apr-util
9248     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9249                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9250                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9251     if test "$COM" = "MSC"; then
9252         APR_LIB_DIR="LibR"
9253         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9254         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9255     fi
9257     # Check for system serf
9258     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9259                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9260     if test "$COM" = "MSC"; then
9261         SERF_LIB_DIR="Release"
9262         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9263         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9264     fi
9265     ;;
9266 neon)
9267     AC_MSG_RESULT([neon])
9268     # Check for system neon
9269     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9270     if test "$with_system_neon" = "yes"; then
9271         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9272         libo_MINGW_CHECK_DLL([libneon])
9273         libo_MINGW_TRY_DLL([libtasn1])
9274         libo_MINGW_TRY_DLL([libgnutls])
9275     else
9276         NEON_VERSION=0295
9277     fi
9278     AC_SUBST(NEON_VERSION)
9279     ;;
9281     AC_MSG_RESULT([none, disabled])
9282     WITH_WEBDAV=""
9283     ;;
9284 esac
9285 AC_SUBST(WITH_WEBDAV)
9287 dnl ===================================================================
9288 dnl Check for disabling cve_tests
9289 dnl ===================================================================
9290 AC_MSG_CHECKING([whether to execute CVE tests])
9291 # If not explicitly enabled or disabled, default
9292 if test -z "$enable_cve_tests"; then
9293     case "$OS" in
9294     WNT)
9295         # Default cves off for windows with its wild and wonderful
9296         # varienty of AV software kicking in and panicing
9297         enable_cve_tests=no
9298         ;;
9299     *)
9300         # otherwise yes
9301         enable_cve_tests=yes
9302         ;;
9303     esac
9305 if test "$enable_cve_tests" = "no"; then
9306     AC_MSG_RESULT([no])
9307     DISABLE_CVE_TESTS=TRUE
9308     AC_SUBST(DISABLE_CVE_TESTS)
9309 else
9310     AC_MSG_RESULT([yes])
9313 dnl ===================================================================
9314 dnl Check for enabling chart XShape tests
9315 dnl ===================================================================
9316 AC_MSG_CHECKING([whether to execute chart XShape tests])
9317 if test "$enable_chart_tests" = "yes"; then
9318     AC_MSG_RESULT([yes])
9319     ENABLE_CHART_TESTS=TRUE
9320     AC_SUBST(ENABLE_CHART_TESTS)
9321 else
9322     AC_MSG_RESULT([no])
9325 dnl ===================================================================
9326 dnl Check for system openssl
9327 dnl ===================================================================
9328 DISABLE_OPENSSL=
9329 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9330 if test "$enable_openssl" = "yes"; then
9331     AC_MSG_RESULT([no])
9332     if test "$_os" = Darwin ; then
9333         # OpenSSL is deprecated when building for 10.7 or later.
9334         #
9335         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9336         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9338         with_system_openssl=no
9339         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9340     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9341             && test "$with_system_openssl" != "no"; then
9342         with_system_openssl=yes
9343         SYSTEM_OPENSSL=TRUE
9344         OPENSSL_CFLAGS=
9345         OPENSSL_LIBS="-lssl -lcrypto"
9346     else
9347         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9348     fi
9349     if test "$with_system_openssl" = "yes"; then
9350         libo_MINGW_CHECK_DLL([libssl])
9351         libo_MINGW_CHECK_DLL([libcrypto])
9352         AC_MSG_CHECKING([whether openssl supports SHA512])
9353         AC_LANG_PUSH([C])
9354         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9355             SHA512_CTX context;
9356 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9357         AC_LANG_POP(C)
9358     fi
9359 else
9360     AC_MSG_RESULT([yes])
9361     DISABLE_OPENSSL=TRUE
9363     # warn that although OpenSSL is disabled, system libraries may be depending on it
9364     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9365     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9368 AC_SUBST([DISABLE_OPENSSL])
9370 dnl ===================================================================
9371 dnl Check for building gnutls
9372 dnl ===================================================================
9373 AC_MSG_CHECKING([whether to use gnutls])
9374 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9375     AC_MSG_RESULT([yes])
9376     AM_PATH_LIBGCRYPT()
9377     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9378         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9379                       available in the system to use as replacement.]]))
9380     FilterLibs "${LIBGCRYPT_LIBS}"
9381     LIBGCRYPT_LIBS="${filteredlibs}"
9382 else
9383     AC_MSG_RESULT([no])
9386 AC_SUBST([LIBGCRYPT_CFLAGS])
9387 AC_SUBST([LIBGCRYPT_LIBS])
9389 dnl ===================================================================
9390 dnl Check for system redland
9391 dnl ===================================================================
9392 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9393 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9394 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9395 if test "$with_system_redland" = "yes"; then
9396     libo_MINGW_CHECK_DLL([librdf])
9397     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9398             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9399     libo_MINGW_TRY_DLL([libraptor])
9400     libo_MINGW_TRY_DLL([librasqal])
9401     libo_MINGW_TRY_DLL([libsqlite3])
9402 else
9403     RAPTOR_MAJOR="0"
9404     RASQAL_MAJOR="3"
9405     REDLAND_MAJOR="0"
9407 AC_SUBST(RAPTOR_MAJOR)
9408 AC_SUBST(RASQAL_MAJOR)
9409 AC_SUBST(REDLAND_MAJOR)
9411 dnl ===================================================================
9412 dnl Check for system hunspell
9413 dnl ===================================================================
9414 AC_MSG_CHECKING([which libhunspell to use])
9415 if test "$with_system_hunspell" = "yes"; then
9416     AC_MSG_RESULT([external])
9417     SYSTEM_HUNSPELL=TRUE
9418     AC_LANG_PUSH([C++])
9419     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9420     if test "$HUNSPELL_PC" != "TRUE"; then
9421         AC_CHECK_HEADER(hunspell.hxx, [],
9422             [
9423             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9424             [AC_MSG_ERROR(hunspell headers not found.)], [])
9425             ], [])
9426         AC_CHECK_LIB([hunspell], [main], [:],
9427            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9428         HUNSPELL_LIBS=-lhunspell
9429     fi
9430     AC_LANG_POP([C++])
9431     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9432     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9433     FilterLibs "${HUNSPELL_LIBS}"
9434     HUNSPELL_LIBS="${filteredlibs}"
9435 else
9436     AC_MSG_RESULT([internal])
9437     SYSTEM_HUNSPELL=
9438     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9439     if test "$COM" = "MSC"; then
9440         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9441     else
9442         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9443     fi
9444     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9446 AC_SUBST(SYSTEM_HUNSPELL)
9447 AC_SUBST(HUNSPELL_CFLAGS)
9448 AC_SUBST(HUNSPELL_LIBS)
9450 dnl ===================================================================
9451 dnl Checking for altlinuxhyph
9452 dnl ===================================================================
9453 AC_MSG_CHECKING([which altlinuxhyph to use])
9454 if test "$with_system_altlinuxhyph" = "yes"; then
9455     AC_MSG_RESULT([external])
9456     SYSTEM_HYPH=TRUE
9457     AC_CHECK_HEADER(hyphen.h, [],
9458        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9459     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9460        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9461        [#include <hyphen.h>])
9462     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9463         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9464     if test -z "$HYPHEN_LIB"; then
9465         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9466            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9467     fi
9468     if test -z "$HYPHEN_LIB"; then
9469         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9470            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9471     fi
9472     libo_MINGW_CHECK_DLL([libhyphen])
9473 else
9474     AC_MSG_RESULT([internal])
9475     SYSTEM_HYPH=
9476     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9477     if test "$COM" = "MSC"; then
9478         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9479     else
9480         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9481     fi
9483 AC_SUBST(SYSTEM_HYPH)
9484 AC_SUBST(HYPHEN_LIB)
9486 dnl ===================================================================
9487 dnl Checking for mythes
9488 dnl ===================================================================
9489 AC_MSG_CHECKING([which mythes to use])
9490 if test "$with_system_mythes" = "yes"; then
9491     AC_MSG_RESULT([external])
9492     SYSTEM_MYTHES=TRUE
9493     AC_LANG_PUSH([C++])
9494     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9495     if test "$MYTHES_PKGCONFIG" = "no"; then
9496         AC_CHECK_HEADER(mythes.hxx, [],
9497             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9498         AC_CHECK_LIB([mythes-1.2], [main], [:],
9499             [ MYTHES_FOUND=no], [])
9500     if test "$MYTHES_FOUND" = "no"; then
9501         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9502                 [ MYTHES_FOUND=no], [])
9503     fi
9504     if test "$MYTHES_FOUND" = "no"; then
9505         AC_MSG_ERROR([mythes library not found!.])
9506     fi
9507     fi
9508     AC_LANG_POP([C++])
9509     libo_MINGW_CHECK_DLL([libmythes-1.2])
9510     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9511     FilterLibs "${MYTHES_LIBS}"
9512     MYTHES_LIBS="${filteredlibs}"
9513 else
9514     AC_MSG_RESULT([internal])
9515     SYSTEM_MYTHES=
9516     BUILD_TYPE="$BUILD_TYPE MYTHES"
9517     if test "$COM" = "MSC"; then
9518         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9519     else
9520         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9521     fi
9523 AC_SUBST(SYSTEM_MYTHES)
9524 AC_SUBST(MYTHES_CFLAGS)
9525 AC_SUBST(MYTHES_LIBS)
9527 dnl ===================================================================
9528 dnl How should we build the linear programming solver ?
9529 dnl ===================================================================
9531 ENABLE_COINMP=
9532 AC_MSG_CHECKING([whether to build with CoinMP])
9533 if test "$enable_coinmp" != "no"; then
9534     ENABLE_COINMP=TRUE
9535     AC_MSG_RESULT([yes])
9536     if test "$with_system_coinmp" = "yes"; then
9537         SYSTEM_COINMP=TRUE
9538         PKG_CHECK_MODULES( COINMP, coinmp )
9539         FilterLibs "${COINMP_LIBS}"
9540         COINMP_LIBS="${filteredlibs}"
9541     else
9542         BUILD_TYPE="$BUILD_TYPE COINMP"
9543     fi
9544 else
9545     AC_MSG_RESULT([no])
9547 AC_SUBST(ENABLE_COINMP)
9548 AC_SUBST(SYSTEM_COINMP)
9549 AC_SUBST(COINMP_CFLAGS)
9550 AC_SUBST(COINMP_LIBS)
9552 ENABLE_LPSOLVE=
9553 AC_MSG_CHECKING([whether to build with lpsolve])
9554 if test "$enable_lpsolve" != "no"; then
9555     ENABLE_LPSOLVE=TRUE
9556     AC_MSG_RESULT([yes])
9557 else
9558     AC_MSG_RESULT([no])
9560 AC_SUBST(ENABLE_LPSOLVE)
9562 if test "$ENABLE_LPSOLVE" = TRUE; then
9563     AC_MSG_CHECKING([which lpsolve to use])
9564     if test "$with_system_lpsolve" = "yes"; then
9565         AC_MSG_RESULT([external])
9566         SYSTEM_LPSOLVE=TRUE
9567         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9568            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9569         save_LIBS=$LIBS
9570         # some systems need this. Like Ubuntu....
9571         AC_CHECK_LIB(m, floor)
9572         AC_CHECK_LIB(dl, dlopen)
9573         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9574             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9575         LIBS=$save_LIBS
9576         libo_MINGW_CHECK_DLL([lpsolve55])
9577     else
9578         AC_MSG_RESULT([internal])
9579         SYSTEM_LPSOLVE=
9580         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9581     fi
9583 AC_SUBST(SYSTEM_LPSOLVE)
9585 dnl ===================================================================
9586 dnl Checking for libexttextcat
9587 dnl ===================================================================
9588 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9589 if test "$with_system_libexttextcat" = "yes"; then
9590     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9592 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9594 dnl ***************************************
9595 dnl testing libc version for Linux...
9596 dnl ***************************************
9597 if test "$_os" = "Linux"; then
9598     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9599     exec 6>/dev/null # no output
9600     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9601     exec 6>&1 # output on again
9602     if test "$HAVE_LIBC"; then
9603         AC_MSG_RESULT([yes])
9604     else
9605         AC_MSG_ERROR([no, upgrade libc])
9606     fi
9609 dnl =========================================
9610 dnl Check for the Windows  SDK.
9611 dnl =========================================
9612 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9613 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9614 if test "$_os" = "WINNT"; then
9615     AC_MSG_CHECKING([for Windows SDK])
9616     if test "$build_os" = "cygwin"; then
9617         find_winsdk
9618         WINDOWS_SDK_HOME=$winsdktest
9620         # normalize if found
9621         if test -n "$WINDOWS_SDK_HOME"; then
9622             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9623             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9624         fi
9626         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
9627     fi
9629     if test -n "$WINDOWS_SDK_HOME"; then
9630         # Remove a possible trailing backslash
9631         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9633         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9634              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9635              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9636             have_windows_sdk_headers=yes
9637         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9638              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9639              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9640             have_windows_sdk_headers=yes
9641         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
9642              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
9643              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
9644             have_windows_sdk_headers=yes
9645         else
9646             have_windows_sdk_headers=no
9647         fi
9649         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9650             have_windows_sdk_libs=yes
9651         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9652             have_windows_sdk_libs=yes
9653         else
9654             have_windows_sdk_libs=no
9655         fi
9657         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9658             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9659 the  Windows SDK are installed.])
9660         fi
9662         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9663              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9664              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9665              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9666         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9667              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9668              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9669              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9670         else
9671             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9672         fi
9673     fi
9675     if test -z "$WINDOWS_SDK_HOME"; then
9676         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9677     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
9678         WINDOWS_SDK_VERSION=70
9679         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9680     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9681         WINDOWS_SDK_VERSION=80
9682         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9683         dnl compatibility warning if not explicitly choosing the 80 SDK:
9684         if test -z "$with_windows_sdk"; then
9685             AC_MSG_WARN([If a build should run on Windows XP,])
9686             AC_MSG_WARN([use --with-windows-sdk=7.1A])
9687             add_warning "If a build should run on Windows XP,"
9688             add_warning "use --with-windows-sdk=7.1A"
9689         fi
9690     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
9691         WINDOWS_SDK_VERSION=81
9692         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
9693     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
9694         WINDOWS_SDK_VERSION=10
9695         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
9696     else
9697         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9698     fi
9699     PathFormat "$WINDOWS_SDK_HOME"
9700     WINDOWS_SDK_HOME="$formatted_path"
9701     if test "$build_os" = "cygwin"; then
9702         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9703         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9704             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9705         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
9706             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
9707         fi
9708     fi
9710     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9711     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9712     dnl but not in v8.0), so allow this to be overridden with a
9713     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9714     dnl and configuration error if no WiLangId.vbs is found would arguably be
9715     dnl better, but I do not know under which conditions exactly it is needed by
9716     dnl msiglobal.pm:
9717     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9718         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9719         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9720             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9721         fi
9722         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9723             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9724         fi
9725         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9726             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9727             add_warning "WiLangId.vbs not found - building translated packages will fail"
9728         fi
9729     fi
9731 AC_SUBST(WINDOWS_SDK_HOME)
9732 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
9733 AC_SUBST(WINDOWS_SDK_VERSION)
9734 AC_SUBST(WINDOWS_SDK_WILANGID)
9736 dnl =========================================
9737 dnl Check for uuidgen
9738 dnl =========================================
9739 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9740     if test "$WITH_MINGW" = "yes"; then
9741         AC_PATH_PROG([UUIDGEN], [uuid])
9742         if test -z "$UUIDGEN"; then
9743             AC_MSG_WARN([uuid is needed for building installation sets])
9744         fi
9745     else
9746         # presence is already tested above in the WINDOWS_SDK_HOME check
9747         UUIDGEN=uuidgen.exe
9748         AC_SUBST(UUIDGEN)
9749     fi
9750 else
9751     AC_PATH_PROG([UUIDGEN], [uuidgen])
9752     if test -z "$UUIDGEN"; then
9753         AC_MSG_WARN([uuid is needed for building installation sets])
9754     fi
9757 dnl ***************************************
9758 dnl Checking for bison and flex
9759 dnl ***************************************
9760 AC_PATH_PROG(BISON, bison)
9761 if test -z "$BISON"; then
9762     AC_MSG_ERROR([no bison found in \$PATH, install it])
9763 else
9764     AC_MSG_CHECKING([the bison version])
9765     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9766     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9767     # Accept newer than 2.0
9768     if test "$_bison_longver" -lt 2000; then
9769         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9770     fi
9773 AC_PATH_PROG(FLEX, flex)
9774 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9775     FLEX=`cygpath -m $FLEX`
9777 if test -z "$FLEX"; then
9778     AC_MSG_ERROR([no flex found in \$PATH, install it])
9779 else
9780     AC_MSG_CHECKING([the flex version])
9781     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9782     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9783         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9784     fi
9786 AC_SUBST([FLEX])
9787 dnl ***************************************
9788 dnl Checking for patch
9789 dnl ***************************************
9790 AC_PATH_PROG(PATCH, patch)
9791 if test -z "$PATCH"; then
9792     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9795 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9796 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9797     if test -z "$with_gnu_patch"; then
9798         GNUPATCH=$PATCH
9799     else
9800         if test -x "$with_gnu_patch"; then
9801             GNUPATCH=$with_gnu_patch
9802         else
9803             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9804         fi
9805     fi
9807     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9808     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9809         AC_MSG_RESULT([yes])
9810     else
9811         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9812     fi
9813 else
9814     GNUPATCH=$PATCH
9817 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9818     GNUPATCH=`cygpath -m $GNUPATCH`
9821 dnl We also need to check for --with-gnu-cp
9823 if test -z "$with_gnu_cp"; then
9824     # check the place where the good stuff is hidden on Solaris...
9825     if test -x /usr/gnu/bin/cp; then
9826         GNUCP=/usr/gnu/bin/cp
9827     else
9828         AC_PATH_PROGS(GNUCP, gnucp cp)
9829     fi
9830     if test -z $GNUCP; then
9831         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9832     fi
9833 else
9834     if test -x "$with_gnu_cp"; then
9835         GNUCP=$with_gnu_cp
9836     else
9837         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9838     fi
9841 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9842     GNUCP=`cygpath -m $GNUCP`
9845 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9846 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9847     AC_MSG_RESULT([yes])
9848 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9849     AC_MSG_RESULT([yes])
9850 else
9851     case "$build_os" in
9852     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9853         x_GNUCP=[\#]
9854         GNUCP=''
9855         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9856         ;;
9857     *)
9858         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9859         ;;
9860     esac
9863 AC_SUBST(GNUPATCH)
9864 AC_SUBST(GNUCP)
9865 AC_SUBST(x_GNUCP)
9867 dnl ***************************************
9868 dnl testing assembler path
9869 dnl ***************************************
9870 ML_EXE=""
9871 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9872     if test "$BITNESS_OVERRIDE" = ""; then
9873         assembler=ml.exe
9874         assembler_bin=bin
9875     else
9876         if test "$vcexpress" = "Express"; then
9877             assembler=ml64.exe
9878             assembler_bin=bin/x86_amd64
9879         else
9880             assembler=ml64.exe
9881             assembler_bin=bin/amd64
9882         fi
9883     fi
9885     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9886     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9887         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9888         AC_MSG_RESULT([found])
9889         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9890     else
9891         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9892     fi
9894     PathFormat "$ASM_HOME"
9895     ASM_HOME="$formatted_path"
9896 else
9897     ASM_HOME=""
9900 AC_SUBST(ML_EXE)
9902 dnl ===================================================================
9903 dnl We need zip and unzip
9904 dnl ===================================================================
9905 AC_PATH_PROG(ZIP, zip)
9906 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9907 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9908     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],,)
9911 AC_PATH_PROG(UNZIP, unzip)
9912 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9914 dnl ===================================================================
9915 dnl Zip must be a specific type for different build types.
9916 dnl ===================================================================
9917 if test $build_os = cygwin; then
9918     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9919         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9920     fi
9923 dnl ===================================================================
9924 dnl We need touch with -h option support.
9925 dnl ===================================================================
9926 AC_PATH_PROG(TOUCH, touch)
9927 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9928 touch warn
9929 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9930     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],,)
9933 dnl ===================================================================
9934 dnl Set vcl option: coordinate device in double or sal_Int32
9935 dnl ===================================================================
9937 AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9938 if test "$_os" = "Darwin" -o  $_os = iOS ; then
9939     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9940     AC_MSG_RESULT([double])
9941 else
9942     AC_MSG_RESULT([sal_Int32])
9945 dnl ===================================================================
9946 dnl Test which vclplugs have to be built.
9947 dnl ===================================================================
9948 R=""
9949 if test "$USING_X11" != TRUE; then
9950     enable_gtk=no
9951     enable_gtk3=no
9953 GTK3_CFLAGS=""
9954 GTK3_LIBS=""
9955 ENABLE_GTK3=""
9956 if test "x$enable_gtk3" = "xyes"; then
9957     if test "$with_system_cairo" = no; then
9958         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9959     fi
9960     : ${with_system_cairo:=yes}
9961     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.8 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
9962     if test "x$ENABLE_GTK3" = "xTRUE"; then
9963         R="gtk3"
9964         dnl Avoid installed by unpackaged files for now.
9965         if test -z "$PKGFORMAT"; then
9966             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9967         fi
9968     else
9969         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9970     fi
9971     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9972     FilterLibs "${GTK3_LIBS}"
9973     GTK3_LIBS="${filteredlibs}"
9975 AC_SUBST(GTK3_LIBS)
9976 AC_SUBST(GTK3_CFLAGS)
9977 AC_SUBST(ENABLE_GTK3)
9979 ENABLE_GTK=""
9980 if test "x$enable_gtk" = "xyes"; then
9981     if test "$with_system_cairo" = no; then
9982         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9983     fi
9984     : ${with_system_cairo:=yes}
9985     ENABLE_GTK="TRUE"
9986     AC_DEFINE(ENABLE_GTK)
9987     R="gtk $R"
9989 AC_SUBST(ENABLE_GTK)
9991 ENABLE_TDE=""
9992 if test "x$enable_tde" = "xyes"; then
9993     ENABLE_TDE="TRUE"
9994     AC_DEFINE(ENABLE_TDE)
9995     R="$R tde"
9997 AC_SUBST(ENABLE_TDE)
9999 ENABLE_KDE4=""
10000 if test "x$enable_kde4" = "xyes"; then
10001     ENABLE_KDE4="TRUE"
10002     AC_DEFINE(ENABLE_KDE4)
10003     R="$R kde4"
10005 AC_SUBST(ENABLE_KDE4)
10007 ENABLE_HEADLESS=""
10008 if test "x$with_x" = "xno" -o "$CXX" = "emcc"; then
10009     ENABLE_HEADLESS="TRUE"
10010     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
10011     R="headless"
10013 AC_SUBST(ENABLE_HEADLESS)
10015 build_vcl_plugins="$R"
10016 if test -z "$build_vcl_plugins"; then
10017     build_vcl_plugins="none"
10019 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10021 dnl ===================================================================
10022 dnl check for dbus support
10023 dnl ===================================================================
10024 ENABLE_DBUS=""
10025 DBUS_CFLAGS=""
10026 DBUS_LIBS=""
10028 if test "$enable_dbus" = "no"; then
10029     test_dbus=no
10032 AC_MSG_CHECKING([whether to enable DBUS support])
10033 if test "$test_dbus" = "yes"; then
10034     ENABLE_DBUS="TRUE"
10035     AC_MSG_RESULT([yes])
10036     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10037     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10038     FilterLibs "${DBUS_LIBS}"
10039     DBUS_LIBS="${filteredlibs}"
10040 else
10041     AC_MSG_RESULT([no])
10044 AC_SUBST(ENABLE_DBUS)
10045 AC_SUBST(DBUS_CFLAGS)
10046 AC_SUBST(DBUS_LIBS)
10048 AC_MSG_CHECKING([whether to enable font install via packagekit])
10049 if test "$ENABLE_DBUS" = "TRUE"; then
10050     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10051         ENABLE_PACKAGEKIT=TRUE
10052         AC_MSG_RESULT([yes])
10053     else
10054         ENABLE_PACKAGEKIT=
10055         AC_MSG_RESULT([no])
10056     fi
10057 else
10058     AC_MSG_RESULT([no, dbus disabled.])
10060 AC_SUBST(ENABLE_PACKAGEKIT)
10062 AC_MSG_CHECKING([whether to enable Impress remote control])
10063 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10064     AC_MSG_RESULT([yes])
10065     ENABLE_SDREMOTE=TRUE
10066     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10068     # If not explicitly enabled or disabled, default
10069     if test -z "$enable_sdremote_bluetooth"; then
10070         case "$OS" in
10071         LINUX|MACOSX|WNT)
10072             # Default to yes for these
10073             enable_sdremote_bluetooth=yes
10074             ;;
10075         *)
10076             # otherwise no
10077             enable_sdremote_bluetooth=no
10078             ;;
10079         esac
10080     fi
10081     # $enable_sdremote_bluetooth is guaranteed non-empty now
10083     if test "$enable_sdremote_bluetooth" != "no"; then
10084         if test "$OS" = "LINUX"; then
10085             if test "$ENABLE_DBUS" = "TRUE"; then
10086                 AC_MSG_RESULT([yes])
10087                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10088                 dnl ===================================================================
10089                 dnl Check for system bluez
10090                 dnl ===================================================================
10091                 AC_MSG_CHECKING([which Bluetooth header to use])
10092                 if test "$with_system_bluez" = "yes"; then
10093                     AC_MSG_RESULT([external])
10094                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10095                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10096                     SYSTEM_BLUEZ=TRUE
10097                 else
10098                     AC_MSG_RESULT([internal])
10099                     SYSTEM_BLUEZ=
10100                 fi
10101             else
10102                 AC_MSG_RESULT([no, dbus disabled])
10103                 ENABLE_SDREMOTE_BLUETOOTH=
10104                 SYSTEM_BLUEZ=
10105             fi
10106         else
10107             AC_MSG_RESULT([yes])
10108             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10109             SYSTEM_BLUEZ=
10110         fi
10111     else
10112         AC_MSG_RESULT([no])
10113         ENABLE_SDREMOTE_BLUETOOTH=
10114         SYSTEM_BLUEZ=
10115     fi
10116 else
10117     ENABLE_SDREMOTE=
10118     SYSTEM_BLUEZ=
10119     AC_MSG_RESULT([no])
10121 AC_SUBST(ENABLE_SDREMOTE)
10122 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10123 AC_SUBST(SYSTEM_BLUEZ)
10125 dnl ===================================================================
10126 dnl Check whether the gtk 2.0 libraries are available.
10127 dnl ===================================================================
10129 GTK_CFLAGS=""
10130 GTK_LIBS=""
10131 ENABLE_SYSTRAY_GTK=""
10132 if test  "$test_gtk" = "yes"; then
10134     if test "$ENABLE_GTK" = "TRUE"; then
10135         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0 gdk-pixbuf-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
10136         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10137         FilterLibs "${GTK_LIBS}"
10138         GTK_LIBS="${filteredlibs}"
10139         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]))
10140         BUILD_TYPE="$BUILD_TYPE GTK"
10141         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10142         FilterLibs "${GTHREAD_LIBS}"
10143         GTHREAD_LIBS="${filteredlibs}"
10145         if test "x$enable_systray" = "xyes"; then
10146             ENABLE_SYSTRAY_GTK="TRUE"
10147         fi
10149         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10150         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10151                           [ENABLE_GTK_PRINT="TRUE"],
10152                           [ENABLE_GTK_PRINT=""])
10153         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10154         FilterLibs "${GTK_PRINT_LIBS}"
10155         GTK_PRINT_LIBS="${filteredlibs}"
10157         AC_MSG_CHECKING([whether to enable GIO support])
10158         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10159             dnl Need at least 2.26 for the dbus support.
10160             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10161                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10162             if test "$ENABLE_GIO" = "TRUE"; then
10163                 AC_DEFINE(ENABLE_GIO)
10164                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10165                 FilterLibs "${GIO_LIBS}"
10166                 GIO_LIBS="${filteredlibs}"
10167             fi
10168         else
10169             AC_MSG_RESULT([no])
10170         fi
10171     fi
10173 AC_SUBST(ENABLE_GIO)
10174 AC_SUBST(GIO_CFLAGS)
10175 AC_SUBST(GIO_LIBS)
10176 AC_SUBST(ENABLE_SYSTRAY_GTK)
10177 AC_SUBST(GTK_CFLAGS)
10178 AC_SUBST(GTK_LIBS)
10179 AC_SUBST(GTHREAD_CFLAGS)
10180 AC_SUBST(GTHREAD_LIBS)
10181 AC_SUBST([ENABLE_GTK_PRINT])
10182 AC_SUBST([GTK_PRINT_CFLAGS])
10183 AC_SUBST([GTK_PRINT_LIBS])
10186 dnl ===================================================================
10187 dnl Check whether the Telepathy libraries are available.
10188 dnl ===================================================================
10190 ENABLE_TELEPATHY=""
10191 TELEPATHY_CFLAGS=""
10192 TELEPATHY_LIBS=""
10194 AC_MSG_CHECKING([whether to enable Telepathy support])
10195 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10196     ENABLE_TELEPATHY="TRUE"
10197     AC_DEFINE(ENABLE_TELEPATHY)
10198     AC_MSG_RESULT([yes])
10199     PKG_CHECK_MODULES( TELEPATHY, telepathy-glib >= 0.18.0 glib-2.0 gobject-2.0 gthread-2.0 gio-2.0 gtk+-2.0 >= 2.18.0 )
10200     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10201     FilterLibs "${TELEPATHY_LIBS}"
10202     TELEPATHY_LIBS="${filteredlibs}"
10203 else
10204     AC_MSG_RESULT([no])
10207 AC_SUBST(ENABLE_TELEPATHY)
10208 AC_SUBST(TELEPATHY_CFLAGS)
10209 AC_SUBST(TELEPATHY_LIBS)
10212 dnl ===================================================================
10214 SPLIT_APP_MODULES=""
10215 if test "$enable_split_app_modules" = "yes"; then
10216     SPLIT_APP_MODULES="TRUE"
10218 AC_SUBST(SPLIT_APP_MODULES)
10220 SPLIT_OPT_FEATURES=""
10221 if test "$enable_split_opt_features" = "yes"; then
10222     SPLIT_OPT_FEATURES="TRUE"
10224 AC_SUBST(SPLIT_OPT_FEATURES)
10226 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10227     if test "$enable_cairo_canvas" = yes; then
10228         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10229     fi
10230     enable_cairo_canvas=no
10231 elif test -z "$enable_cairo_canvas"; then
10232     enable_cairo_canvas=yes
10235 ENABLE_CAIRO_CANVAS=""
10236 if test "$enable_cairo_canvas" = "yes"; then
10237     test_cairo=yes
10238     ENABLE_CAIRO_CANVAS="TRUE"
10239     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10241 AC_SUBST(ENABLE_CAIRO_CANVAS)
10243 dnl ===================================================================
10244 dnl Check whether the GStreamer libraries are available.
10245 dnl It's possible to build avmedia with both GStreamer backends!
10246 dnl ===================================================================
10248 ENABLE_GSTREAMER_1_0=""
10250 if test "$build_gstreamer_1_0" = "yes"; then
10252     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10253     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10254         ENABLE_GSTREAMER_1_0="TRUE"
10255         AC_MSG_RESULT([yes])
10256         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10257         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10258         FilterLibs "${GSTREAMER_1_0_LIBS}"
10259         GSTREAMER_1_0_LIBS="${filteredlibs}"
10260     else
10261         AC_MSG_RESULT([no])
10262     fi
10264 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10265 AC_SUBST(GSTREAMER_1_0_LIBS)
10266 AC_SUBST(ENABLE_GSTREAMER_1_0)
10269 ENABLE_GSTREAMER_0_10=""
10270 if test "$build_gstreamer_0_10" = "yes"; then
10272     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10273     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10274         ENABLE_GSTREAMER_0_10="TRUE"
10275         AC_MSG_RESULT([yes])
10276         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10277             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10278         ])
10279         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10280         FilterLibs "${GSTREAMER_0_10_LIBS}"
10281         GSTREAMER_0_10_LIBS="${filteredlibs}"
10282     else
10283         AC_MSG_RESULT([no])
10284     fi
10287 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10288 AC_SUBST(GSTREAMER_0_10_LIBS)
10289 AC_SUBST(ENABLE_GSTREAMER_0_10)
10291 dnl ===================================================================
10292 dnl Check whether to build the VLC avmedia backend
10293 dnl ===================================================================
10295 ENABLE_VLC=""
10297 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10298 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10299     ENABLE_VLC="TRUE"
10300     AC_MSG_RESULT([yes])
10301 else
10302     AC_MSG_RESULT([no])
10304 AC_SUBST(ENABLE_VLC)
10306 # this is for opengl transitions in impress slideshow
10307 ENABLE_OPENGL=
10308 if test $_os = iOS -o $_os = Android; then
10309    : # disable
10310 elif test "$_os" = "Darwin"; then
10311     # We use frameworks on Mac OS X, no need for detail checks
10312     ENABLE_OPENGL=TRUE
10313     ENABLE_OPENGL_CANVAS=TRUE
10314 elif test $_os = WINNT; then
10315     ENABLE_OPENGL=TRUE
10316     ENABLE_OPENGL_CANVAS=TRUE
10317 else
10318     if test "$USING_X11" = TRUE; then
10319         ENABLE_OPENGL=TRUE
10320     fi
10321     ENABLE_OPENGL_CANVAS=TRUE
10324 AC_SUBST(ENABLE_OPENGL)
10325 AC_SUBST(ENABLE_OPENGL_CANVAS)
10327 dnl =================================================
10328 dnl Check whether to build with OpenCL support.
10329 dnl =================================================
10331 if test $_os != iOS -a $_os != Android; then
10332     # OPENCL in BUILD_TYPE tells that OpenCL is potentially available on the platform (optional at run-time,
10333     # used through clew).
10334     BUILD_TYPE="$BUILD_TYPE OPENCL"
10335     AC_DEFINE(HAVE_FEATURE_OPENCL)
10338 dnl ===================================================================
10339 dnl Check whether to enable glTF support
10340 dnl ===================================================================
10341 AC_MSG_CHECKING([whether to enable glTF support])
10342 ENABLE_GLTF=
10343 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android; then
10344     ENABLE_GLTF=TRUE
10345     AC_MSG_RESULT([yes])
10346     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10347     if test "$with_system_libgltf" = "yes"; then
10348         SYSTEM_LIBGLTF=TRUE
10349         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10350         FilterLibs "${LIBGLTF_LIBS}"
10351         LIBGLTF_LIBS="${filteredlibs}"
10352     else
10353         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10354     fi
10355 else
10356     AC_MSG_RESULT([no])
10358 AC_SUBST(ENABLE_GLTF)
10359 AC_SUBST(SYSTEM_LIBGLTF)
10360 AC_SUBST(LIBGLTF_CFLAGS)
10361 AC_SUBST(LIBGLTF_LIBS)
10363 dnl ===================================================================
10364 dnl Check whether to enable COLLADA support
10365 dnl ===================================================================
10366 AC_MSG_CHECKING([whether to enable COLLADA support])
10367 ENABLE_COLLADA=
10368 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10369     AC_MSG_RESULT([yes])
10370     ENABLE_COLLADA=TRUE
10371     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10373     AC_MSG_CHECKING([which OPENCOLLADA to use])
10374     if test "$with_system_opencollada" = "yes"; then
10375         AC_MSG_RESULT([external])
10376         SYSTEM_OPENCOLLADA=TRUE
10377         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10378         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10379         AC_LANG_PUSH([C++])
10380         save_CXXFLAGS=$CXXFLAGS
10381         save_CPPFLAGS=$CPPFLAGS
10382         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10383         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10384         AC_CHECK_HEADERS(
10385                 COLLADABU.h \
10386                 COLLADAFW.h \
10387                 COLLADASaxFWLLoader.h \
10388                 GeneratedSaxParser.h,
10389             [],
10390             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10391             [])
10392         CXXFLAGS=$save_CXXFLAGS
10393         CPPFLAGS=$save_CPPFLAGS
10394         AC_LANG_POP([C++])
10395         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10396         FilterLibs "${OPENCOLLADA_LIBS}"
10397         OPENCOLLADA_LIBS="${filteredlibs}"
10398     else
10399         AC_MSG_RESULT([internal])
10400         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10401     fi
10403     AC_MSG_CHECKING([which collada2gltf to use])
10404     if test "$with_system_collada2gltf" = "yes"; then
10405         if test "$with_system_opencollada" = "no"; then
10406             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10407         fi
10408         AC_MSG_RESULT([external])
10409         SYSTEM_COLLADA2GLTF=TRUE
10410         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10411         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10412         AC_LANG_PUSH([C++])
10413         save_CXXFLAGS=$CXXFLAGS
10414         save_CPPFLAGS=$CPPFLAGS
10415         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10416         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10417         AC_CHECK_HEADERS(
10418                 GLTF.h \
10419                 encodingHelpers.h,
10420             [],
10421             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10422             [])
10423         CXXFLAGS=$save_CXXFLAGS
10424         CPPFLAGS=$save_CPPFLAGS
10425         AC_LANG_POP([C++])
10426         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10427         FilterLibs "${COLLADA2GLTF_LIBS}"
10428         COLLADA2GLTF_LIBS="${filteredlibs}"
10429     else
10430         AC_MSG_RESULT([internal])
10431         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10432     fi
10433 else
10434     AC_MSG_RESULT([no])
10436 AC_SUBST(ENABLE_COLLADA)
10437 AC_SUBST([OPENCOLLADA_CFLAGS])
10438 AC_SUBST([OPENCOLLADA_LIBS])
10439 AC_SUBST([SYSTEM_OPENCOLLADA])
10441 AC_SUBST([COLLADA2GLTF_CFLAGS])
10442 AC_SUBST([COLLADA2GLTF_LIBS])
10443 AC_SUBST([SYSTEM_COLLADA2GLTF])
10445 if test "$enable_dconf" != no; then
10446     PKG_CHECK_MODULES([DCONF], [dconf], [], [
10447         if test "$enable_dconf" = yes; then
10448             AC_MSG_ERROR([dconf not found])
10449         else
10450             enable_dconf=no
10451         fi])
10453 AC_MSG_CHECKING([whether to enable dconf])
10454 if test "$enable_dconf" = no; then
10455     DCONF_CFLAGS=
10456     DCONF_LIBS=
10457     ENABLE_DCONF=
10458     AC_MSG_RESULT([no])
10459 else
10460     ENABLE_DCONF=TRUE
10461     AC_DEFINE(ENABLE_DCONF)
10462     AC_MSG_RESULT([yes])
10464 AC_SUBST([DCONF_CFLAGS])
10465 AC_SUBST([DCONF_LIBS])
10466 AC_SUBST([ENABLE_DCONF])
10468 # pdf import?
10469 AC_MSG_CHECKING([whether to build the PDF import feature])
10470 ENABLE_PDFIMPORT=
10471 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10472     AC_MSG_RESULT([yes])
10473     ENABLE_PDFIMPORT=TRUE
10475     dnl ===================================================================
10476     dnl Check for system poppler
10477     dnl ===================================================================
10478     AC_MSG_CHECKING([which PDF import backend to use])
10479     if test "$with_system_poppler" = "yes"; then
10480         AC_MSG_RESULT([external])
10481         SYSTEM_POPPLER=TRUE
10482         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10483         AC_LANG_PUSH([C++])
10484         save_CXXFLAGS=$CXXFLAGS
10485         save_CPPFLAGS=$CPPFLAGS
10486         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10487         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10488         AC_CHECK_HEADER([cpp/poppler-version.h],
10489             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10490             [])
10491         CXXFLAGS=$save_CXXFLAGS
10492         CPPFLAGS=$save_CPPFLAGS
10493         AC_LANG_POP([C++])
10494         libo_MINGW_CHECK_DLL([libpoppler])
10495         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10497         FilterLibs "${POPPLER_LIBS}"
10498         POPPLER_LIBS="${filteredlibs}"
10499     else
10500         AC_MSG_RESULT([internal])
10501         SYSTEM_POPPLER=
10502         BUILD_TYPE="$BUILD_TYPE POPPLER"
10503         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10504     fi
10505     AC_DEFINE([ENABLE_PDFIMPORT],1)
10506 else
10507     AC_MSG_RESULT([no])
10509 AC_SUBST(ENABLE_PDFIMPORT)
10510 AC_SUBST(SYSTEM_POPPLER)
10511 AC_SUBST(POPPLER_CFLAGS)
10512 AC_SUBST(POPPLER_LIBS)
10514 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10515 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10516     AC_MSG_RESULT([yes])
10517     ENABLE_MEDIAWIKI=TRUE
10518     BUILD_TYPE="$BUILD_TYPE XSLTML"
10519     if test  "x$with_java" = "xno"; then
10520         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10521     fi
10522 else
10523     AC_MSG_RESULT([no])
10524     ENABLE_MEDIAWIKI=
10525     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10527 AC_SUBST(ENABLE_MEDIAWIKI)
10529 AC_MSG_CHECKING([whether to build the Report Builder])
10530 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10531     AC_MSG_RESULT([yes])
10532     ENABLE_REPORTBUILDER=TRUE
10533     AC_MSG_CHECKING([which jfreereport libs to use])
10534     if test "$with_system_jfreereport" = "yes"; then
10535         SYSTEM_JFREEREPORT=TRUE
10536         AC_MSG_RESULT([external])
10537         if test -z $SAC_JAR; then
10538             SAC_JAR=/usr/share/java/sac.jar
10539         fi
10540         if ! test -f $SAC_JAR; then
10541              AC_MSG_ERROR(sac.jar not found.)
10542         fi
10544         if test -z $LIBXML_JAR; then
10545             if test -f /usr/share/java/libxml-1.0.0.jar; then
10546                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10547             elif test -f /usr/share/java/libxml.jar; then
10548                 LIBXML_JAR=/usr/share/java/libxml.jar
10549             else
10550                 AC_MSG_ERROR(libxml.jar replacement not found.)
10551             fi
10552         elif ! test -f $LIBXML_JAR; then
10553             AC_MSG_ERROR(libxml.jar not found.)
10554         fi
10556         if test -z $FLUTE_JAR; then
10557             if test -f/usr/share/java/flute-1.3.0.jar; then
10558                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10559             elif test -f /usr/share/java/flute.jar; then
10560                 FLUTE_JAR=/usr/share/java/flute.jar
10561             else
10562                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10563             fi
10564         elif ! test -f $FLUTE_JAR; then
10565             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10566         fi
10568         if test -z $JFREEREPORT_JAR; then
10569             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10570                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10571             elif test -f /usr/share/java/flow-engine.jar; then
10572                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10573             else
10574                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10575             fi
10576         elif ! test -f  $JFREEREPORT_JAR; then
10577                 AC_MSG_ERROR(jfreereport.jar not found.)
10578         fi
10580         if test -z $LIBLAYOUT_JAR; then
10581             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10582                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10583             elif test -f /usr/share/java/liblayout.jar; then
10584                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10585             else
10586                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10587             fi
10588         elif ! test -f $LIBLAYOUT_JAR; then
10589                 AC_MSG_ERROR(liblayout.jar not found.)
10590         fi
10592         if test -z $LIBLOADER_JAR; then
10593             if test -f /usr/share/java/libloader-1.0.0.jar; then
10594                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10595             elif test -f /usr/share/java/libloader.jar; then
10596                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10597             else
10598                 AC_MSG_ERROR(libloader.jar replacement not found.)
10599             fi
10600         elif ! test -f  $LIBLOADER_JAR; then
10601             AC_MSG_ERROR(libloader.jar not found.)
10602         fi
10604         if test -z $LIBFORMULA_JAR; then
10605             if test -f /usr/share/java/libformula-0.2.0.jar; then
10606                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10607             elif test -f /usr/share/java/libformula.jar; then
10608                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10609             else
10610                 AC_MSG_ERROR(libformula.jar replacement not found.)
10611             fi
10612         elif ! test -f $LIBFORMULA_JAR; then
10613                 AC_MSG_ERROR(libformula.jar not found.)
10614         fi
10616         if test -z $LIBREPOSITORY_JAR; then
10617             if test -f /usr/share/java/librepository-1.0.0.jar; then
10618                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10619             elif test -f /usr/share/java/librepository.jar; then
10620                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10621             else
10622                 AC_MSG_ERROR(librepository.jar replacement not found.)
10623             fi
10624         elif ! test -f $LIBREPOSITORY_JAR; then
10625             AC_MSG_ERROR(librepository.jar not found.)
10626         fi
10628         if test -z $LIBFONTS_JAR; then
10629             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10630                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10631             elif test -f /usr/share/java/libfonts.jar; then
10632                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10633             else
10634                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10635             fi
10636         elif ! test -f $LIBFONTS_JAR; then
10637                 AC_MSG_ERROR(libfonts.jar not found.)
10638         fi
10640         if test -z $LIBSERIALIZER_JAR; then
10641             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10642                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10643             elif test -f /usr/share/java/libserializer.jar; then
10644                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10645             else
10646                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10647             fi
10648         elif ! test -f $LIBSERIALIZER_JAR; then
10649                 AC_MSG_ERROR(libserializer.jar not found.)
10650         fi
10652         if test -z $LIBBASE_JAR; then
10653             if test -f /usr/share/java/libbase-1.0.0.jar; then
10654                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10655             elif test -f /usr/share/java/libbase.jar; then
10656                 LIBBASE_JAR=/usr/share/java/libbase.jar
10657             else
10658                 AC_MSG_ERROR(libbase.jar replacement not found.)
10659             fi
10660         elif ! test -f $LIBBASE_JAR; then
10661             AC_MSG_ERROR(libbase.jar not found.)
10662         fi
10664     else
10665         AC_MSG_RESULT([internal])
10666         SYSTEM_JFREEREPORT=
10667         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10668     fi
10669 else
10670     AC_MSG_RESULT([no])
10671     ENABLE_REPORTBUILDER=
10672     SYSTEM_JFREEREPORT=
10674 AC_SUBST(ENABLE_REPORTBUILDER)
10675 AC_SUBST(SYSTEM_JFREEREPORT)
10676 AC_SUBST(SAC_JAR)
10677 AC_SUBST(LIBXML_JAR)
10678 AC_SUBST(FLUTE_JAR)
10679 AC_SUBST(JFREEREPORT_JAR)
10680 AC_SUBST(LIBBASE_JAR)
10681 AC_SUBST(LIBLAYOUT_JAR)
10682 AC_SUBST(LIBLOADER_JAR)
10683 AC_SUBST(LIBFORMULA_JAR)
10684 AC_SUBST(LIBREPOSITORY_JAR)
10685 AC_SUBST(LIBFONTS_JAR)
10686 AC_SUBST(LIBSERIALIZER_JAR)
10688 # this has to be here because both the Wiki Publisher and the SRB use
10689 # commons-logging
10690 COMMONS_LOGGING_VERSION=1.2
10691 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10692     AC_MSG_CHECKING([which Apache commons-* libs to use])
10693     if test "$with_system_apache_commons" = "yes"; then
10694         SYSTEM_APACHE_COMMONS=TRUE
10695         AC_MSG_RESULT([external])
10696         if test -z $COMMONS_LOGGING_JAR; then
10697             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10698                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10699            elif test -f /usr/share/java/commons-logging.jar; then
10700                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10701             else
10702                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10703             fi
10704         elif ! test -f $COMMONS_LOGGING_JAR; then
10705             AC_MSG_ERROR(commons-logging.jar not found.)
10706         fi
10707     else
10708         AC_MSG_RESULT([internal])
10709         SYSTEM_APACHE_COMMONS=
10710         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10711     fi
10713 AC_SUBST(SYSTEM_APACHE_COMMONS)
10714 AC_SUBST(COMMONS_LOGGING_JAR)
10715 AC_SUBST(COMMONS_LOGGING_VERSION)
10717 # scripting provider for BeanShell?
10718 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10719 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10720     AC_MSG_RESULT([yes])
10721     ENABLE_SCRIPTING_BEANSHELL=TRUE
10723     dnl ===================================================================
10724     dnl Check for system beanshell
10725     dnl ===================================================================
10726     AC_MSG_CHECKING([which beanshell to use])
10727     if test "$with_system_beanshell" = "yes"; then
10728         AC_MSG_RESULT([external])
10729         SYSTEM_BSH=TRUE
10730         if test -z $BSH_JAR; then
10731             BSH_JAR=/usr/share/java/bsh.jar
10732         fi
10733         if ! test -f $BSH_JAR; then
10734             AC_MSG_ERROR(bsh.jar not found.)
10735         fi
10736     else
10737         AC_MSG_RESULT([internal])
10738         SYSTEM_BSH=
10739         BUILD_TYPE="$BUILD_TYPE BSH"
10740     fi
10741 else
10742     AC_MSG_RESULT([no])
10743     ENABLE_SCRIPTING_BEANSHELL=
10744     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10746 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10747 AC_SUBST(SYSTEM_BSH)
10748 AC_SUBST(BSH_JAR)
10750 # scripting provider for JavaScript?
10751 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10752 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10753     AC_MSG_RESULT([yes])
10754     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10756     dnl ===================================================================
10757     dnl Check for system rhino
10758     dnl ===================================================================
10759     AC_MSG_CHECKING([which rhino to use])
10760     if test "$with_system_rhino" = "yes"; then
10761         AC_MSG_RESULT([external])
10762         SYSTEM_RHINO=TRUE
10763         if test -z $RHINO_JAR; then
10764             RHINO_JAR=/usr/share/java/js.jar
10765         fi
10766         if ! test -f $RHINO_JAR; then
10767             AC_MSG_ERROR(js.jar not found.)
10768         fi
10769     else
10770         AC_MSG_RESULT([internal])
10771         SYSTEM_RHINO=
10772         BUILD_TYPE="$BUILD_TYPE RHINO"
10773     fi
10774 else
10775     AC_MSG_RESULT([no])
10776     ENABLE_SCRIPTING_JAVASCRIPT=
10777     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10779 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10780 AC_SUBST(SYSTEM_RHINO)
10781 AC_SUBST(RHINO_JAR)
10783 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10784 # paths should be added to library search path. So lets put all 64-bit
10785 # platforms there.
10786 supports_multilib=
10787 case "$host_cpu" in
10788 x86_64 | powerpc64 | powerpc64le | s390x | aarch64)
10789     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10790         supports_multilib="yes"
10791     fi
10792     ;;
10794     ;;
10795 esac
10797 dnl ===================================================================
10798 dnl Check whether the TQt and TDE libraries are available.
10799 dnl ===================================================================
10801 TDE_CFLAGS=""
10802 TDE_LIBS=""
10803 if test "$_os" != "OpenBSD"; then
10804     MOC="moc"
10806 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10807     dnl Search paths for TQt and TDE
10808     if test -z "$supports_multilib"; then
10809         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"
10810         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"
10811     else
10812         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"
10813         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"
10814     fi
10815     if test -n "$TQTDIR"; then
10816         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10817         if test -z "$supports_multilib"; then
10818             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10819         else
10820             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10821         fi
10822     fi
10823     if test -z "$supports_multilib"; then
10824         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"
10825         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"
10826     else
10827         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"
10828         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"
10829     fi
10830     if test -n "$TDEDIR"; then
10831         tde_incdirs="$TDEDIR/include $tde_incdirs"
10832         if test -z "$supports_multilib"; then
10833             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10834         else
10835             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10836         fi
10837     fi
10839     dnl What to test
10840     tqt_test_include="ntqstyle.h"
10841     tde_test_include="kapp.h"
10843     if test "$_os" != "OpenBSD"; then
10844         tqt_test_library="libtqt-mt.so"
10845         tde_test_library="libDCOP.so"
10846     else
10847         tqt_test_library="libtqt-mt.so*"
10848         tde_test_library="libDCOP.so*"
10849     fi
10851     dnl Check for TQt headers
10852     AC_MSG_CHECKING([for TQt headers])
10853     tqt_incdir="no"
10854     for tde_check in $tqt_incdirs; do
10855         if test -r "$tde_check/$tqt_test_include"; then
10856             tqt_incdir="$tde_check"
10857             break
10858         fi
10859     done
10860     AC_MSG_RESULT([$tqt_incdir])
10861     if test "x$tqt_incdir" = "xno"; then
10862         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10863 your TQt installation by exporting TQTDIR before running "configure".])
10864     fi
10866     dnl Check for TQt libraries
10867     AC_MSG_CHECKING([for TQt libraries])
10868     tqt_libdir="no"
10869     for tqt_check in $tqt_libdirs; do
10870         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10871             tqt_libdir="$tqt_check"
10872             break
10873         fi
10874     done
10875     AC_MSG_RESULT([$tqt_libdir])
10876     if test "x$tqt_libdir" = "xno"; then
10877         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10878 your TQt installation by exporting TQTDIR before running "configure".])
10879     fi
10881     dnl Check for Meta Object Compiler
10882     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
10883     if test "$MOC" = "no"; then
10884         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
10885 the root of your TQt installation by exporting TQTDIR before running "configure".])
10886     fi
10888     dnl Check for TDE headers
10889     AC_MSG_CHECKING([for TDE headers])
10890     tde_incdir="no"
10891     for tde_check in $tde_incdirs; do
10892         if test -r "$tde_check/$tde_test_include"; then
10893             tde_incdir="$tde_check"
10894             break
10895         fi
10896     done
10897     AC_MSG_RESULT([$tde_incdir])
10898     if test "x$tde_incdir" = "xno"; then
10899         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
10900 your TDE installation by exporting TDEDIR before running "configure".])
10901     fi
10903     dnl Check for TDE libraries
10904     AC_MSG_CHECKING([for TDE libraries])
10905     tde_libdir="no"
10906     for tde_check in $tde_libdirs; do
10907         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
10908             tde_libdir="$tde_check"
10909             break
10910         fi
10911     done
10912     AC_MSG_RESULT([$tde_libdir])
10913     if test "x$tde_libdir" = "xno"; then
10914         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
10915 your TDE installation by exporting TDEDIR before running "configure".])
10916     fi
10918     dnl Set the variables
10919     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10920     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
10922 AC_SUBST(TDE_CFLAGS)
10923 AC_SUBST(TDE_LIBS)
10924 AC_SUBST(MOC)
10926 dnl ===================================================================
10927 dnl KDE4 Integration
10928 dnl ===================================================================
10930 KDE4_CFLAGS=""
10931 KDE4_LIBS=""
10932 QMAKE4="qmake"
10933 MOC4="moc"
10934 KDE_GLIB_CFLAGS=""
10935 KDE_GLIB_LIBS=""
10936 KDE_HAVE_GLIB=""
10937 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10938     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10939     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10941     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
10942     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10944     if test -n "$supports_multilib"; then
10945         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10946         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10947     fi
10949     if test -n "$QTDIR"; then
10950         qt_incdirs="$QTDIR/include $qt_incdirs"
10951         if test -z "$supports_multilib"; then
10952             qt_libdirs="$QTDIR/lib $qt_libdirs"
10953         else
10954             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
10955         fi
10956     fi
10957     if test -n "$QT4DIR"; then
10958         qt_incdirs="$QT4DIR/include $qt_incdirs"
10959         if test -z "$supports_multilib"; then
10960             qt_libdirs="$QT4DIR/lib $qt_libdirs"
10961         else
10962             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
10963         fi
10964     fi
10966     if test -n "$KDEDIR"; then
10967         kde_incdirs="$KDEDIR/include $kde_incdirs"
10968         if test -z "$supports_multilib"; then
10969             kde_libdirs="$KDEDIR/lib $kde_libdirs"
10970         else
10971             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
10972         fi
10973     fi
10974     if test -n "$KDE4DIR"; then
10975         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
10976         if test -z "$supports_multilib"; then
10977             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
10978         else
10979             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
10980         fi
10981     fi
10983     qt_test_include="Qt/qobject.h"
10984     qt_test_library="libQtNetwork.so"
10985     kde_test_include="kwindowsystem.h"
10986     kde_test_library="libsolid.so"
10988     AC_MSG_CHECKING([for Qt4 headers])
10989     qt_header_dir="no"
10990     for inc_dir in $qt_incdirs; do
10991         if test -r "$inc_dir/$qt_test_include"; then
10992             qt_header_dir="$inc_dir"
10993             break
10994         fi
10995     done
10997     AC_MSG_RESULT([$qt_header_dir])
10998     if test "x$qt_header_dir" = "xno"; then
10999         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11000     fi
11002     dnl Check for qmake
11003     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11004     QMAKE4="$QMAKEQT4"
11005     if test "$QMAKE4" = "no"; then
11006         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11007         if test "$QMAKE4" = "no"; then
11008             AC_MSG_ERROR([Qmake not found.  Please specify
11009 the root of your Qt installation by exporting QT4DIR before running "configure".])
11010         fi
11011     fi
11013     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11014     AC_MSG_CHECKING([for Qt4 libraries])
11015     qt_lib_dir="no"
11016     for lib_dir in $qt_libdirs; do
11017         if test -r "$lib_dir/$qt_test_library"; then
11018             qt_lib_dir="$lib_dir"
11019             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11020             break
11021         fi
11022     done
11024     AC_MSG_RESULT([$qt_lib_dir])
11026     if test "x$qt_lib_dir" = "xno"; then
11027         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11028     fi
11030     dnl Check for Meta Object Compiler
11032     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11033     MOC4="$MOCQT4"
11034     if test "$MOC4" = "no"; then
11035         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11036         if test "$MOC4" = "no"; then
11037             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11038 the root of your Qt installation by exporting QT4DIR before running "configure".])
11039         fi
11040     fi
11042     dnl Check for KDE4 headers
11043     AC_MSG_CHECKING([for KDE4 headers])
11044     kde_incdir="no"
11045     for kde_check in $kde_incdirs; do
11046         if test -r "$kde_check/$kde_test_include"; then
11047             kde_incdir="$kde_check"
11048             break
11049         fi
11050     done
11051     AC_MSG_RESULT([$kde_incdir])
11052     if test "x$kde_incdir" = "xno"; then
11053         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11054     fi
11056     dnl Check for KDE4 libraries
11057     AC_MSG_CHECKING([for KDE4 libraries])
11058     kde_libdir="no"
11059     for kde_check in $kde_libdirs; do
11060         if test -r "$kde_check/$kde_test_library"; then
11061             kde_libdir="$kde_check"
11062             break
11063         fi
11064     done
11066     AC_MSG_RESULT([$kde_libdir])
11067     if test "x$kde_libdir" = "xno"; then
11068         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11069     fi
11071     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11072     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11073     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11074     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11075     FilterLibs "$KDE4_LIBS"
11076     KDE4_LIBS="$filteredlibs"
11078     AC_LANG_PUSH([C++])
11079     save_CXXFLAGS=$CXXFLAGS
11080     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11081     AC_MSG_CHECKING([whether KDE is >= 4.2])
11082        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11083 #include <kdeversion.h>
11085 int main(int argc, char **argv) {
11086        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11087        else return 1;
11089 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11090     CXXFLAGS=$save_CXXFLAGS
11091     AC_LANG_POP([C++])
11093     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11094     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11095     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11096         [
11097             KDE_HAVE_GLIB=1
11098             AC_DEFINE(KDE_HAVE_GLIB,1)
11099             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11100             FilterLibs "${KDE_GLIB_LIBS}"
11101             KDE_GLIB_LIBS="${filteredlibs}"
11103             qt4_fix_warning=
11105             AC_LANG_PUSH([C++])
11106             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11107             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11108             #  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
11109             #               ^~~~~~~~~~~~~~~~~~~~~~~
11110             #               vptr for 'QObjectPrivate'
11111             save_CXX=$CXX
11112             CXX=$(printf %s "$CXX" \
11113                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11114             save_CXXFLAGS=$CXXFLAGS
11115             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11116             save_LIBS=$LIBS
11117             LIBS="$LIBS $KDE4_LIBS"
11118             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11120             # Prepare meta object data
11121             TSTBASE="tst_exclude_socket_notifiers"
11122             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11123             ln -fs "${TSTMOC}.hxx"
11124             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11126             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11127 #include <cstdlib>
11128 #include "tst_exclude_socket_notifiers.moc"
11130 int main(int argc, char *argv[])
11132     QCoreApplication app(argc, argv);
11133     exit(tst_processEventsExcludeSocket());
11134     return 0;
11136             ]])],[
11137                 AC_MSG_RESULT([yes])
11138             ],[
11139                 AC_MSG_RESULT([no])
11140                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11141                 if test -z "$qt4_fix_warning"; then
11142                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11143                 fi
11144                 qt4_fix_warning=1
11145                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11146                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11148             # Remove meta object data
11149             rm -f "${TSTBASE}."*
11151             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11153             # Prepare meta object data
11154             TSTBASE="tst_exclude_posted_events"
11155             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11156             ln -fs "${TSTMOC}.hxx"
11157             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11159             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11160 #include <cstdlib>
11161 #include "tst_exclude_posted_events.moc"
11163 int main(int argc, char *argv[])
11165     QCoreApplication app(argc, argv);
11166     exit(tst_excludePostedEvents());
11167     return 0;
11169             ]])],[
11170                 AC_MSG_RESULT([yes])
11171             ],[
11172                 AC_MSG_RESULT([no])
11173                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11174                 if test -z "$qt4_fix_warning"; then
11175                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11176                 fi
11177                 qt4_fix_warning=1
11178                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11179             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11181             # Remove meta object data
11182             rm -f "${TSTBASE}."*
11184             if test -n "$qt4_fix_warning"; then
11185                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11186             fi
11188             LIBS=$save_LIBS
11189             CXXFLAGS=$save_CXXFLAGS
11190             CXX=$save_CXX
11191             AC_LANG_POP([C++])
11192         ],
11193         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11195 AC_SUBST(KDE4_CFLAGS)
11196 AC_SUBST(KDE4_LIBS)
11197 AC_SUBST(MOC4)
11198 AC_SUBST(KDE_GLIB_CFLAGS)
11199 AC_SUBST(KDE_GLIB_LIBS)
11200 AC_SUBST(KDE_HAVE_GLIB)
11202 dnl ===================================================================
11203 dnl Test whether to include Evolution 2 support
11204 dnl ===================================================================
11205 AC_MSG_CHECKING([whether to enable evolution 2 support])
11206 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11207     AC_MSG_RESULT([yes])
11208     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11209     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11210     FilterLibs "${GOBJECT_LIBS}"
11211     GOBJECT_LIBS="${filteredlibs}"
11212     ENABLE_EVOAB2="TRUE"
11213 else
11214     ENABLE_EVOAB2=""
11215     AC_MSG_RESULT([no])
11217 AC_SUBST(ENABLE_EVOAB2)
11218 AC_SUBST(GOBJECT_CFLAGS)
11219 AC_SUBST(GOBJECT_LIBS)
11221 dnl ===================================================================
11222 dnl Test whether to include TDE AB support
11223 dnl ===================================================================
11224 AC_MSG_CHECKING([whether to enable TDE address book support])
11225 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11226     AC_MSG_RESULT([yes])
11227     AC_LANG_PUSH([C++])
11228     save_CXXFLAGS=$CXXFLAGS
11229     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11230     AC_MSG_CHECKING([whether TDE is at least R14.0])
11231        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11232 #include <tdeversion.h>
11234 int main(int argc, char **argv) {
11235        if (TDE_VERSION_MAJOR >= 14) return 0;
11236        else return 1;
11238        ]])],[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])],
11239        [AC_MSG_ERROR([TDE support not tested with cross compilation])])
11240     CXXFLAGS=$save_CXXFLAGS
11241     AC_LANG_POP([C++])
11242     ENABLE_TDEAB=TRUE
11243 else
11244     AC_MSG_RESULT([no])
11245     ENABLE_TDEAB=
11247 AC_SUBST(ENABLE_TDEAB)
11249 dnl ===================================================================
11250 dnl Test which themes to include
11251 dnl ===================================================================
11252 AC_MSG_CHECKING([which themes to include])
11253 # if none given use default subset of available themes
11254 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11255     with_theme="breeze galaxy hicontrast oxygen sifr tango"
11256     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11259 WITH_THEMES=""
11260 if test "x$with_theme" != "xno"; then
11261     for theme in $with_theme; do
11262         case $theme in
11263         breeze|crystal|elementary|galaxy|hicontrast|human|oxygen|sifr|tango|tango_testing) real_theme="$theme" ;;
11264         default) real_theme=galaxy ;;
11265         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11266         esac
11267         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11268     done
11270 AC_MSG_RESULT([$WITH_THEMES])
11271 AC_SUBST([WITH_THEMES])
11272 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11273 for theme in $with_theme; do
11274     case $theme in
11275     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11276     *) ;;
11277     esac
11278 done
11280 dnl ===================================================================
11281 dnl Test whether to integrate helppacks into the product's installer
11282 dnl ===================================================================
11283 AC_MSG_CHECKING([for helppack integration])
11284 if test "$with_helppack_integration" = "no"; then
11285     WITH_HELPPACK_INTEGRATION=
11286     AC_MSG_RESULT([no integration])
11287 else
11288     WITH_HELPPACK_INTEGRATION=TRUE
11289     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11290     AC_MSG_RESULT([integration])
11292 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11294 ###############################################################################
11295 # Extensions checking
11296 ###############################################################################
11297 AC_MSG_CHECKING([for extensions integration])
11298 if test "x$enable_extension_integration" != "xno"; then
11299     WITH_EXTENSION_INTEGRATION=TRUE
11300     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11301     AC_MSG_RESULT([yes, use integration])
11302 else
11303     WITH_EXTENSION_INTEGRATION=
11304     AC_MSG_RESULT([no, do not integrate])
11306 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11308 dnl Should any extra extensions be included?
11309 dnl There are standalone tests for each of these below.
11310 WITH_EXTRA_EXTENSIONS=
11311 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11313 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11314 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11315 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11316 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11317 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11318 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11319 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11320 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11321 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11322 if test "x$with_java" != "xno"; then
11323     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11324     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11327 dnl ===================================================================
11328 dnl Test whether to include Sun Professional Template Pack
11329 dnl ===================================================================
11330 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11331 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11332     AC_MSG_RESULT([no integration])
11333 else
11334     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11335     sun_supported_langs="en-US de it fr es hu"
11336     if test "$with_sun_templates" = "yes"; then
11337         wanted_sun_templates="$sun_supported_langs"
11338     else
11339         # check whether the langs are supported by Sun
11340         wanted_sun_templates=
11341         for lang in $with_sun_templates; do
11342             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11343                 wanted_sun_templates="$wanted_sun_templates $lang"
11344             fi
11345         done
11346     fi
11347     SUNTEMPLATES_LANG=
11348     SUNTEMPLATES_DE_PACK=
11349     SUNTEMPLATES_EN_US_PACK=
11350     SUNTEMPLATES_ES_PACK=
11351     SUNTEMPLATES_FR_PACK=
11352     SUNTEMPLATES_HU_PACK=
11353     SUNTEMPLATES_IT_PACK=
11354     # check whether the langs are requested at all
11355     for lang in $wanted_sun_templates; do
11356     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11357         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11358         case $lang in
11359         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11360         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11361         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11362         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11363         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11364         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11365         esac
11366     fi
11367     done
11368     WITH_EXTRA_EXTENSIONS=TRUE
11369     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11371 AC_SUBST(SUNTEMPLATES_DE_PACK)
11372 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11373 AC_SUBST(SUNTEMPLATES_ES_PACK)
11374 AC_SUBST(SUNTEMPLATES_FR_PACK)
11375 AC_SUBST(SUNTEMPLATES_HU_PACK)
11376 AC_SUBST(SUNTEMPLATES_IT_PACK)
11378 TEST_FONTS_MISSING=0
11380 # $1  = font family
11381 # $2+ = accepted font mappings
11382 test_font_map()
11384     FONT="$1" ; shift
11385     AC_MSG_CHECKING([font mapping for '$FONT'])
11386     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11387     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11389     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11390     while test "$#" -ge 1 ; do
11391         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11392         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11393     done
11394     if test $TESTEXPR
11395     then
11396         AC_MSG_RESULT([ok])
11397     else
11398         AC_MSG_RESULT([unknown ($FONTFILE)])
11399         TEST_FONTS_MISSING=1
11400     fi
11403 dnl ===================================================================
11404 dnl Test whether to include fonts
11405 dnl ===================================================================
11406 AC_MSG_CHECKING([whether to include third-party fonts])
11407 if test "$with_fonts" != "no"; then
11408     AC_MSG_RESULT([yes])
11409     WITH_FONTS=TRUE
11410     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11411 else
11412     AC_MSG_RESULT([no])
11413     WITH_FONTS=
11414     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11415     if test "$test_fontconfig" = "yes"; then
11416         AC_PATH_PROG([FCMATCH], [fc-match])
11417         if test -z "$FCMATCH"; then
11418             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11419             TEST_FONTS_MISSING=1
11420         else
11421             test_font_map 'Calibri' 'Carlito'
11422             if test ${TEST_FONTS_MISSING} -eq 1
11423             then
11424                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11425             fi
11426         fi
11427     else
11428         TEST_FONTS_MISSING=0
11429     fi
11431 AC_SUBST(WITH_FONTS)
11432 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11434 dnl ===================================================================
11435 dnl Test whether to include extra galleries
11436 dnl ===================================================================
11437 AC_MSG_CHECKING([whether to include extra galleries])
11438 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11439     AC_MSG_RESULT([no])
11440     WITH_EXTRA_GALLERY=
11441     OOOP_GALLERY_PACK=""
11442 else
11443     AC_MSG_RESULT([yes])
11444     WITH_EXTRA_GALLERY=TRUE
11445     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11446     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11447     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11449 AC_SUBST(WITH_EXTRA_GALLERY)
11450 AC_SUBST(OOOP_GALLERY_PACK)
11452 dnl ===================================================================
11453 dnl Test whether to include extra templates
11454 dnl ===================================================================
11455 AC_MSG_CHECKING([whether to include extra templates])
11456 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11457     AC_MSG_RESULT([no])
11458     WITH_EXTRA_TEMPLATE=
11459     OOOP_TEMPLATES_PACK=""
11460 else
11461     AC_MSG_RESULT([yes])
11462     WITH_EXTRA_TEMPLATE=TRUE
11463     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11464     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11465     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11467 AC_SUBST(WITH_EXTRA_TEMPLATE)
11468 AC_SUBST(OOOP_TEMPLATES_PACK)
11470 dnl ===================================================================
11471 dnl Test whether to include extra samples
11472 dnl ===================================================================
11473 AC_MSG_CHECKING([whether to include extra samples])
11474 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11475     AC_MSG_RESULT([no])
11476     WITH_EXTRA_SAMPLE=
11477     OOOP_SAMPLES_PACK=""
11478 else
11479     AC_MSG_RESULT([yes])
11480     WITH_EXTRA_SAMPLE=TRUE
11481     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11482     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11483     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11485 AC_SUBST(WITH_EXTRA_SAMPLE)
11486 AC_SUBST(OOOP_SAMPLES_PACK)
11488 dnl ===================================================================
11489 dnl Test whether to include extra fonts
11490 dnl ===================================================================
11491 AC_MSG_CHECKING([whether to include extra fonts])
11492 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11493     AC_MSG_RESULT([no])
11494     WITH_EXTRA_FONT=
11495     OOOP_FONTS_PACK=""
11496 else
11497     AC_MSG_RESULT([yes])
11498     WITH_EXTRA_FONT=TRUE
11499     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11500     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11501     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11503 AC_SUBST(WITH_EXTRA_FONT)
11504 AC_SUBST(OOOP_FONTS_PACK)
11506 dnl ===================================================================
11507 dnl Test whether to enable online update service
11508 dnl ===================================================================
11509 AC_MSG_CHECKING([whether to enable online update])
11510 ENABLE_ONLINE_UPDATE=
11511 ENABLE_ONLINE_UPDATE_MAR=
11512 if test "$enable_online_update" = ""; then
11513     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11514         AC_MSG_RESULT([yes])
11515         ENABLE_ONLINE_UPDATE="TRUE"
11516     else
11517         AC_MSG_RESULT([no])
11518     fi
11519 else
11520     if test "$enable_online_update" = "mar"; then
11521         AC_MSG_RESULT([yes - MAR-based online update])
11522         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11523     elif test "$enable_online_update" = "yes"; then
11524         AC_MSG_RESULT([yes])
11525         ENABLE_ONLINE_UPDATE="TRUE"
11526     else
11527         AC_MSG_RESULT([no])
11528     fi
11530 AC_SUBST(ENABLE_ONLINE_UPDATE)
11531 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11533 dnl ===================================================================
11534 dnl Test whether we need bzip2
11535 dnl ===================================================================
11536 SYSTEM_BZIP2=
11537 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11538     AC_MSG_CHECKING([whether to use system bzip2])
11539     if test "$with_system_bzip2" = yes; then
11540         SYSTEM_BZIP2=TRUE
11541         AC_MSG_RESULT([yes])
11542         PKG_CHECK_MODULES(BZIP2, bzip2)
11543         FilterLibs "${BZIP2_LIBS}"
11544         BZIP2_LIBS="${filteredlibs}"
11545     else
11546         AC_MSG_RESULT([no])
11547         BUILD_TYPE="$BUILD_TYPE BZIP2"
11548     fi
11550 AC_SUBST(SYSTEM_BZIP2)
11551 AC_SUBST(BZIP2_CFLAGS)
11552 AC_SUBST(BZIP2_LIBS)
11554 dnl ===================================================================
11555 dnl Test whether to enable extension update
11556 dnl ===================================================================
11557 AC_MSG_CHECKING([whether to enable extension update])
11558 ENABLE_EXTENSION_UPDATE=
11559 if test "x$enable_extension_update" = "xno"; then
11560     AC_MSG_RESULT([no])
11561 else
11562     AC_MSG_RESULT([yes])
11563     ENABLE_EXTENSION_UPDATE="TRUE"
11564     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11565     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11567 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11570 dnl ===================================================================
11571 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11572 dnl ===================================================================
11573 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11574 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11575     AC_MSG_RESULT([no])
11576     ENABLE_SILENT_MSI=
11577 else
11578     AC_MSG_RESULT([yes])
11579     ENABLE_SILENT_MSI=TRUE
11580     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11582 AC_SUBST(ENABLE_SILENT_MSI)
11584 AC_MSG_CHECKING([whether and how to use Xinerama])
11585 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11586     if test "$x_libraries" = "default_x_libraries"; then
11587         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11588         if test "x$XINERAMALIB" = x; then
11589            XINERAMALIB="/usr/lib"
11590         fi
11591     else
11592         XINERAMALIB="$x_libraries"
11593     fi
11594     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11595         # we have both versions, let the user decide but use the dynamic one
11596         # per default
11597         USE_XINERAMA=TRUE
11598         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11599             XINERAMA_LINK=dynamic
11600         else
11601             XINERAMA_LINK=static
11602         fi
11603     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11604         # we have only the dynamic version
11605         USE_XINERAMA=TRUE
11606         XINERAMA_LINK=dynamic
11607     elif test -e "$XINERAMALIB/libXinerama.a"; then
11608         # static version
11609         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11610             USE_XINERAMA=TRUE
11611             XINERAMA_LINK=static
11612         else
11613             USE_XINERAMA=
11614             XINERAMA_LINK=none
11615         fi
11616     else
11617         # no Xinerama
11618         USE_XINERAMA=
11619         XINERAMA_LINK=none
11620     fi
11621     if test "$USE_XINERAMA" = "TRUE"; then
11622         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11623         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11624             [AC_MSG_ERROR(Xinerama header not found.)], [])
11625         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11626         if test "x$XEXTLIB" = x; then
11627            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11628         fi
11629         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11630         if test "$_os" = "FreeBSD"; then
11631             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11632         fi
11633         if test "$_os" = "Linux"; then
11634             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11635         fi
11636         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11637             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11638     else
11639         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11640     fi
11641 else
11642     USE_XINERAMA=
11643     XINERAMA_LINK=none
11644     AC_MSG_RESULT([no])
11646 AC_SUBST(USE_XINERAMA)
11647 AC_SUBST(XINERAMA_LINK)
11649 dnl ===================================================================
11650 dnl Test whether to build cairo or rely on the system version
11651 dnl ===================================================================
11653 if test "$USING_X11" = TRUE; then
11654     # Used in vcl/Library_vclplug_gen.mk
11655     test_cairo=yes
11658 if test "$test_cairo" = "yes"; then
11659     AC_MSG_CHECKING([whether to use the system cairo])
11661     : ${with_system_cairo:=$with_system_libs}
11662     if test "$with_system_cairo" = "yes"; then
11663         SYSTEM_CAIRO=TRUE
11664         AC_MSG_RESULT([yes])
11666         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11667         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11668         FilterLibs "${CAIRO_LIBS}"
11669         CAIRO_LIBS="${filteredlibs}"
11671         if test "$test_xrender" = "yes"; then
11672             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11673             AC_LANG_PUSH([C])
11674             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11675 #ifdef PictStandardA8
11676 #else
11677       return fail;
11678 #endif
11679 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11681             AC_LANG_POP([C])
11682         fi
11683         libo_MINGW_CHECK_DLL([libcairo])
11684         libo_MINGW_TRY_DLL([libfontconfig])
11685         libo_MINGW_TRY_DLL([libfreetype])
11686         libo_MINGW_TRY_DLL([libpixman])
11687         libo_MINGW_TRY_DLL([libpng15])
11688     else
11689         SYSTEM_CAIRO=
11690         AC_MSG_RESULT([no])
11692         BUILD_TYPE="$BUILD_TYPE CAIRO"
11693         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11694     fi
11697 AC_SUBST(SYSTEM_CAIRO)
11698 AC_SUBST(CAIRO_CFLAGS)
11699 AC_SUBST(CAIRO_LIBS)
11701 dnl ===================================================================
11702 dnl Test whether to use avahi
11703 dnl ===================================================================
11704 if test "$_os" = "WINNT"; then
11705     # Windows uses bundled mDNSResponder
11706     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11707 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11708     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11709                       [ENABLE_AVAHI="TRUE"])
11710     AC_DEFINE(HAVE_FEATURE_AVAHI)
11711     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11712     FilterLibs "${AVAHI_LIBS}"
11713     AVAHI_LIBS="${filteredlibs}"
11716 AC_SUBST(ENABLE_AVAHI)
11717 AC_SUBST(AVAHI_CFLAGS)
11718 AC_SUBST(AVAHI_LIBS)
11720 dnl ===================================================================
11721 dnl Test whether to use liblangtag
11722 dnl ===================================================================
11723 ENABLE_LIBLANGTAG=
11724 SYSTEM_LIBLANGTAG=
11725 AC_MSG_CHECKING([whether to use liblangtag])
11726 if test "$enable_liblangtag" = "yes" -o \
11727         \( "$enable_liblangtag" = "" -a $_os != iOS -a $_os != Emscripten \); then
11728     ENABLE_LIBLANGTAG=TRUE
11729     AC_MSG_RESULT([yes])
11730     AC_MSG_CHECKING([whether to use system liblangtag])
11731     if test "$with_system_liblangtag" = yes; then
11732         SYSTEM_LIBLANGTAG=TRUE
11733         AC_MSG_RESULT([yes])
11734         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11735         dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11736         PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11737         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11738         FilterLibs "${LIBLANGTAG_LIBS}"
11739         LIBLANGTAG_LIBS="${filteredlibs}"
11740         libo_MINGW_CHECK_DLL([liblangtag])
11741     else
11742         SYSTEM_LIBLANGTAG=
11743         AC_MSG_RESULT([no])
11744         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11745         LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/langtag"
11746         if test "$COM" = "MSC"; then
11747             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11748         else
11749             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11750         fi
11751     fi
11752     AC_DEFINE(ENABLE_LIBLANGTAG)
11753 else
11754     AC_MSG_RESULT([no])
11756 AC_SUBST(ENABLE_LIBLANGTAG)
11757 AC_SUBST(SYSTEM_LIBLANGTAG)
11758 AC_SUBST(LIBLANGTAG_CFLAGS)
11759 AC_SUBST(LIBLANGTAG_LIBS)
11761 dnl ===================================================================
11762 dnl Test whether to build libpng or rely on the system version
11763 dnl ===================================================================
11765 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11767 dnl ===================================================================
11768 dnl Check for runtime JVM search path
11769 dnl ===================================================================
11770 if test "$ENABLE_JAVA" != ""; then
11771     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11772     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11773         AC_MSG_RESULT([yes])
11774         if ! test -d "$with_jvm_path"; then
11775             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11776         fi
11777         if ! test -d "$with_jvm_path"jvm; then
11778             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11779         fi
11780         JVM_ONE_PATH_CHECK="$with_jvm_path"
11781         AC_SUBST(JVM_ONE_PATH_CHECK)
11782     else
11783         AC_MSG_RESULT([no])
11784     fi
11787 dnl ===================================================================
11788 dnl Test for the presence of Ant and that it works
11789 dnl ===================================================================
11791 if test "$ENABLE_JAVA" != ""; then
11792     ANT_HOME=; export ANT_HOME
11793     WITH_ANT_HOME=; export WITH_ANT_HOME
11794     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11795         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11796             if test "$_os" = "WINNT"; then
11797                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11798             else
11799                 with_ant_home="$LODE_HOME/opt/ant"
11800             fi
11801         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11802             with_ant_home="$LODE_HOME/opt/ant"
11803         fi
11804     fi
11805     if test -z "$with_ant_home"; then
11806         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11807     else
11808         if test "$_os" = "WINNT"; then
11809             # AC_PATH_PROGS needs unix path
11810             with_ant_home=`cygpath -u "$with_ant_home"`
11811         fi
11812         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11813         WITH_ANT_HOME=$with_ant_home
11814         ANT_HOME=$with_ant_home
11815     fi
11817     if test -z "$ANT"; then
11818         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11819     else
11820         # resolve relative or absolute symlink
11821         while test -h "$ANT"; do
11822             a_cwd=`pwd`
11823             a_basename=`basename "$ANT"`
11824             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11825             cd "`dirname "$ANT"`"
11826             cd "`dirname "$a_script"`"
11827             ANT="`pwd`"/"`basename "$a_script"`"
11828             cd "$a_cwd"
11829         done
11831         AC_MSG_CHECKING([if $ANT works])
11832         cat > conftest.java << EOF
11833         public class conftest {
11834             int testmethod(int a, int b) {
11835                     return a + b;
11836             }
11837         }
11840         cat > conftest.xml << EOF
11841         <project name="conftest" default="conftest">
11842         <target name="conftest">
11843             <javac srcdir="." includes="conftest.java">
11844             </javac>
11845         </target>
11846         </project>
11849         oldJAVA_HOME=$JAVA_HOME
11850         if test "$JAVACISGCJ" = "yes"; then
11851             JAVA_HOME=; export JAVA_HOME
11852             ant_gcj="-Dbuild.compiler=gcj"
11853         fi
11854         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11855         if test $? = 0 -a -f ./conftest.class; then
11856             AC_MSG_RESULT([Ant works])
11857             if test -z "$WITH_ANT_HOME"; then
11858                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11859                 if test -z "$ANT_HOME"; then
11860                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11861                 fi
11862             else
11863                 ANT_HOME="$WITH_ANT_HOME"
11864             fi
11865         else
11866             echo "configure: Ant test failed" >&5
11867             cat conftest.java >&5
11868             cat conftest.xml >&5
11869             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
11870             ANT_HOME=""
11871             add_warning "Ant does not work - Some Java projects will not build!"
11872         fi
11873         JAVA_HOME=$oldJAVA_HOME
11874         rm -f conftest* core core.* *.core
11875     fi
11876     if test -z "$ANT_HOME"; then
11877         ANT_HOME="NO_ANT_HOME"
11878     else
11879         PathFormat "$ANT_HOME"
11880         ANT_HOME="$formatted_path"
11881         PathFormat "$ANT"
11882         ANT="$formatted_path"
11883     fi
11884     AC_SUBST(ANT_HOME)
11885     AC_SUBST(ANT)
11887     dnl Checking for ant.jar
11888     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11889         AC_MSG_CHECKING([Ant lib directory])
11890         if test -f $ANT_HOME/lib/ant.jar; then
11891             ANT_LIB="$ANT_HOME/lib"
11892         else
11893             if test -f $ANT_HOME/ant.jar; then
11894                 ANT_LIB="$ANT_HOME"
11895             else
11896                 if test -f /usr/share/java/ant.jar; then
11897                     ANT_LIB=/usr/share/java
11898                 else
11899                     if test -f /usr/share/ant-core/lib/ant.jar; then
11900                         ANT_LIB=/usr/share/ant-core/lib
11901                     else
11902                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11903                             ANT_LIB="$ANT_HOME/lib/ant"
11904                         else
11905                             if test -f /usr/share/lib/ant/ant.jar; then
11906                                 ANT_LIB=/usr/share/lib/ant
11907                             else
11908                                 AC_MSG_ERROR([Ant libraries not found!])
11909                             fi
11910                         fi
11911                     fi
11912                 fi
11913             fi
11914         fi
11915         PathFormat "$ANT_LIB"
11916         ANT_LIB="$formatted_path"
11917         AC_MSG_RESULT([Ant lib directory found.])
11918     fi
11919     AC_SUBST(ANT_LIB)
11921     ant_minver=1.6.0
11922     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11924     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11925     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11926     ant_version_major=`echo $ant_version | cut -d. -f1`
11927     ant_version_minor=`echo $ant_version | cut -d. -f2`
11928     echo "configure: ant_version $ant_version " >&5
11929     echo "configure: ant_version_major $ant_version_major " >&5
11930     echo "configure: ant_version_minor $ant_version_minor " >&5
11931     if test "$ant_version_major" -ge "2"; then
11932         AC_MSG_RESULT([yes, $ant_version])
11933     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11934         AC_MSG_RESULT([yes, $ant_version])
11935     else
11936         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11937     fi
11939     rm -f conftest* core core.* *.core
11942 OOO_JUNIT_JAR=
11943 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11944     AC_MSG_CHECKING([for JUnit 4])
11945     if test "$with_junit" = "yes"; then
11946         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11947             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11948         elif test -e /usr/share/java/junit4.jar; then
11949             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11950         else
11951            if test -e /usr/share/lib/java/junit.jar; then
11952               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11953            else
11954               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11955            fi
11956         fi
11957     else
11958         OOO_JUNIT_JAR=$with_junit
11959     fi
11960     if test "$_os" = "WINNT"; then
11961         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11962     fi
11963     printf 'import org.junit.Before;' > conftest.java
11964     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11965         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11966     else
11967         AC_MSG_ERROR(
11968 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11969  specify its pathname via --with-junit=..., or disable it via --without-junit])
11970     fi
11971     rm -f conftest.class conftest.java
11972     if test $OOO_JUNIT_JAR != ""; then
11973     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11974     fi
11976 AC_SUBST(OOO_JUNIT_JAR)
11978 HAMCREST_JAR=
11979 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11980     AC_MSG_CHECKING([for included Hamcrest])
11981     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11982     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11983         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11984     else
11985         AC_MSG_RESULT([Not included])
11986         AC_MSG_CHECKING([for standalone hamcrest jar.])
11987         if test "$with_hamcrest" = "yes"; then
11988             if test -e /usr/share/lib/java/hamcrest.jar; then
11989                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11990             elif test -e /usr/share/java/hamcrest/core.jar; then
11991                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11992             else
11993                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11994             fi
11995         else
11996             HAMCREST_JAR=$with_hamcrest
11997         fi
11998         if test "$_os" = "WINNT"; then
11999             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12000         fi
12001         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12002             AC_MSG_RESULT([$HAMCREST_JAR])
12003         else
12004             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),
12005                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12006         fi
12007     fi
12008     rm -f conftest.class conftest.java
12010 AC_SUBST(HAMCREST_JAR)
12013 AC_SUBST(SCPDEFS)
12016 # check for wget and curl
12018 WGET=
12019 CURL=
12021 if test "$enable_fetch_external" != "no"; then
12023 CURL=`which curl 2>/dev/null`
12025 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12026     eval "$i --version" > /dev/null 2>&1
12027     ret=$?
12028     if test $ret -eq 0; then
12029         WGET=$i
12030         break
12031     fi
12032 done
12034 if test -z "$WGET" -a -z "$CURL"; then
12035     AC_MSG_ERROR([neither wget nor curl found!])
12040 AC_SUBST(WGET)
12041 AC_SUBST(CURL)
12044 # check for md5sum
12046 MD5SUM=
12048 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12049     if test "$i" = "md5"; then
12050         eval "$i -x" > /dev/null 2>&1
12051     else
12052         eval "$i --version" > /dev/null 2>&1
12053     fi
12054     ret=$?
12055     if test $ret -eq 0; then
12056         MD5SUM=$i
12057         break
12058     fi
12059 done
12061 if test "$MD5SUM" = "md5"; then
12062     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12063         MD5SUM="$MD5SUM -r"
12064     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12065         MD5SUM="$MD5SUM -n"
12066     fi
12069 if test -z "$MD5SUM"; then
12070     AC_MSG_ERROR([no md5sum found!])
12073 AC_SUBST(MD5SUM)
12075 dnl ===================================================================
12076 dnl Dealing with l10n options
12077 dnl ===================================================================
12078 AC_MSG_CHECKING([which languages to be built])
12079 # get list of all languages
12080 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12081 # the sed command does the following:
12082 #   + if a line ends with a backslash, append the next line to it
12083 #   + adds " on the beginning of the value (after =)
12084 #   + adds " at the end of the value
12085 #   + removes en-US; we want to put it on the beginning
12086 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12087 [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)]
12088 ALL_LANGS="en-US $completelangiso"
12089 # check the configured localizations
12090 WITH_LANG="$with_lang"
12091 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12092     AC_MSG_RESULT([en-US])
12093 else
12094     AC_MSG_RESULT([$WITH_LANG])
12095     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12097 # check that the list is valid
12098 for lang in $WITH_LANG; do
12099     test "$lang" = "ALL" && continue
12100     # need to check for the exact string, so add space before and after the list of all languages
12101     for vl in $ALL_LANGS; do
12102         if test "$vl" = "$lang"; then
12103            break
12104         fi
12105     done
12106     if test "$vl" != "$lang"; then
12107         # if you're reading this - you prolly quoted your languages remove the quotes ...
12108         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12109     fi
12110 done
12111 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12112     echo $WITH_LANG | grep -q en-US
12113     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12115 # list with substituted ALL
12116 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12117 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12118 test "$WITH_LANG" = "en-US" && WITH_LANG=
12119 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12120     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12121     ALL_LANGS=`echo $ALL_LANGS qtz`
12123 AC_SUBST(ALL_LANGS)
12124 AC_SUBST(WITH_LANG)
12125 AC_SUBST(WITH_LANG_LIST)
12126 AC_SUBST(GIT_NEEDED_SUBMODULES)
12128 WITH_POOR_HELP_LOCALIZATIONS=
12129 if test -d "$SRC_ROOT/translations/source"; then
12130     for l in `ls -1 $SRC_ROOT/translations/source`; do
12131         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12132             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12133         fi
12134     done
12136 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12138 if test -n "$with_locales"; then
12139     WITH_LOCALES="$with_locales"
12141     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12142     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12143     # config_host/config_locales.h.in
12144     for locale in $WITH_LOCALES; do
12145         lang=${locale%_*}
12147         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12149         case $lang in
12150         hi|mr*ne)
12151             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12152             ;;
12153         bg|ru)
12154             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12155             ;;
12156         esac
12157     done
12158 else
12159     AC_DEFINE(WITH_LOCALE_ALL)
12161 AC_SUBST(WITH_LOCALES)
12163 dnl git submodule update --reference
12164 dnl ===================================================================
12165 if test -n "${GIT_REFERENCE_SRC}"; then
12166     for repo in ${GIT_NEEDED_SUBMODULES}; do
12167         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12168             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12169         fi
12170     done
12172 AC_SUBST(GIT_REFERENCE_SRC)
12174 dnl git submodules linked dirs
12175 dnl ===================================================================
12176 if test -n "${GIT_LINK_SRC}"; then
12177     for repo in ${GIT_NEEDED_SUBMODULES}; do
12178         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12179             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12180         fi
12181     done
12183 AC_SUBST(GIT_LINK_SRC)
12185 dnl branding
12186 dnl ===================================================================
12187 AC_MSG_CHECKING([for alternative branding images directory])
12188 # initialize mapped arrays
12189 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12190 brand_files="$BRAND_INTRO_IMAGES about.svg"
12192 if test -z "$with_branding" -o "$with_branding" = "no"; then
12193     AC_MSG_RESULT([none])
12194     DEFAULT_BRAND_IMAGES="$brand_files"
12195 else
12196     if ! test -d $with_branding ; then
12197         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12198     else
12199         AC_MSG_RESULT([$with_branding])
12200         CUSTOM_BRAND_DIR="$with_branding"
12201         for lfile in $brand_files
12202         do
12203             if ! test -f $with_branding/$lfile ; then
12204                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12205                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12206             else
12207                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12208             fi
12209         done
12210         check_for_progress="yes"
12211     fi
12213 AC_SUBST([BRAND_INTRO_IMAGES])
12214 AC_SUBST([CUSTOM_BRAND_DIR])
12215 AC_SUBST([CUSTOM_BRAND_IMAGES])
12216 AC_SUBST([DEFAULT_BRAND_IMAGES])
12219 AC_MSG_CHECKING([for 'intro' progress settings])
12220 PROGRESSBARCOLOR=
12221 PROGRESSSIZE=
12222 PROGRESSPOSITION=
12223 PROGRESSFRAMECOLOR=
12224 PROGRESSTEXTCOLOR=
12225 PROGRESSTEXTBASELINE=
12227 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12228     source "$with_branding/progress.conf"
12229     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12230 else
12231     AC_MSG_RESULT([none])
12234 AC_SUBST(PROGRESSBARCOLOR)
12235 AC_SUBST(PROGRESSSIZE)
12236 AC_SUBST(PROGRESSPOSITION)
12237 AC_SUBST(PROGRESSFRAMECOLOR)
12238 AC_SUBST(PROGRESSTEXTCOLOR)
12239 AC_SUBST(PROGRESSTEXTBASELINE)
12242 AC_MSG_CHECKING([for extra build ID])
12243 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12244     EXTRA_BUILDID="$with_extra_buildid"
12246 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12247 if test -n "$EXTRA_BUILDID" ; then
12248     AC_MSG_RESULT([$EXTRA_BUILDID])
12249 else
12250     AC_MSG_RESULT([not set])
12252 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12254 OOO_VENDOR=
12255 AC_MSG_CHECKING([for vendor])
12256 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12257     OOO_VENDOR="$USERNAME"
12259     if test -z "$OOO_VENDOR"; then
12260         OOO_VENDOR="$USER"
12261     fi
12263     if test -z "$OOO_VENDOR"; then
12264         OOO_VENDOR="`id -u -n`"
12265     fi
12267     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12268 else
12269     OOO_VENDOR="$with_vendor"
12270     AC_MSG_RESULT([$OOO_VENDOR])
12272 AC_SUBST(OOO_VENDOR)
12274 if echo "$host_os" | grep -q linux-android ; then
12275     ANDROID_PACKAGE_NAME=
12276     AC_MSG_CHECKING([for Android package name])
12277     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12278         if test -n "$ENABLE_DEBUG"; then
12279             # Default to the package name that makes ndk-gdb happy.
12280             ANDROID_PACKAGE_NAME="org.libreoffice"
12281         else
12282             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12283         fi
12285         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12286     else
12287         ANDROID_PACKAGE_NAME="$with_android_package_name"
12288         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12289     fi
12290     AC_SUBST(ANDROID_PACKAGE_NAME)
12293 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12294 if test "$with_compat_oowrappers" = "yes"; then
12295     WITH_COMPAT_OOWRAPPERS=TRUE
12296     AC_MSG_RESULT(yes)
12297 else
12298     WITH_COMPAT_OOWRAPPERS=
12299     AC_MSG_RESULT(no)
12301 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12303 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12304 AC_MSG_CHECKING([for install dirname])
12305 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12306     INSTALLDIRNAME="$with_install_dirname"
12308 AC_MSG_RESULT([$INSTALLDIRNAME])
12309 AC_SUBST(INSTALLDIRNAME)
12311 AC_MSG_CHECKING([for prefix])
12312 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12313 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12314 PREFIXDIR="$prefix"
12315 AC_MSG_RESULT([$PREFIXDIR])
12316 AC_SUBST(PREFIXDIR)
12318 LIBDIR=[$(eval echo $(eval echo $libdir))]
12319 AC_SUBST(LIBDIR)
12321 DATADIR=[$(eval echo $(eval echo $datadir))]
12322 AC_SUBST(DATADIR)
12324 MANDIR=[$(eval echo $(eval echo $mandir))]
12325 AC_SUBST(MANDIR)
12327 DOCDIR=[$(eval echo $(eval echo $docdir))]
12328 AC_SUBST(DOCDIR)
12330 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12331 AC_SUBST(INSTALLDIR)
12333 TESTINSTALLDIR="${BUILDDIR}/test-install"
12334 AC_SUBST(TESTINSTALLDIR)
12337 # ===================================================================
12338 # OAuth2 id and secrets
12339 # ===================================================================
12341 AC_MSG_CHECKING([for Google Drive client id and secret])
12342 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12343 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12344 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12345     GDRIVE_CLIENT_ID="\"\""
12348 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12349     GDRIVE_CLIENT_SECRET="\"\""
12352 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12353     AC_MSG_RESULT([not set])
12354 else
12355     AC_MSG_RESULT([set])
12358 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12359 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12361 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12362 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12363 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12364 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12365     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12368 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12369     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12372 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12373     AC_MSG_RESULT([not set])
12374 else
12375     AC_MSG_RESULT([set])
12377 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12378 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12380 AC_MSG_CHECKING([for OneDrive client id and secret])
12381 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12382 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12383 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12384     ONEDRIVE_CLIENT_ID="\"\""
12387 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12388     ONEDRIVE_CLIENT_SECRET="\"\""
12391 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12392     AC_MSG_RESULT([not set])
12393 else
12394     AC_MSG_RESULT([set])
12396 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12397 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12400 dnl ===================================================================
12401 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12402 dnl --enable-dependency-tracking configure option
12403 dnl ===================================================================
12404 AC_MSG_CHECKING([whether to enable dependency tracking])
12405 if test "$enable_dependency_tracking" = "no"; then
12406     nodep=TRUE
12407     AC_MSG_RESULT([no])
12408 else
12409     AC_MSG_RESULT([yes])
12411 AC_SUBST(nodep)
12413 dnl ===================================================================
12414 dnl Number of CPUs to use during the build
12415 dnl ===================================================================
12416 AC_MSG_CHECKING([for number of processors to use])
12417 # plain --with-parallelism is just the default
12418 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12419     if test "$with_parallelism" = "no"; then
12420         PARALLELISM=0
12421     else
12422         PARALLELISM=$with_parallelism
12423     fi
12424 else
12425     if test "$enable_icecream" = "yes"; then
12426         PARALLELISM="10"
12427     else
12428         case `uname -s` in
12430         Darwin|FreeBSD|NetBSD|OpenBSD)
12431             PARALLELISM=`sysctl -n hw.ncpu`
12432             ;;
12434         Linux)
12435             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12436         ;;
12437         # what else than above does profit here *and* has /proc?
12438         *)
12439             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12440             ;;
12441         esac
12443         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12444         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12445     fi
12448 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12449     if test -z "$with_parallelism"; then
12450             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12451             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12452             PARALLELISM="1"
12453     else
12454         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."
12455     fi
12458 if test $PARALLELISM -eq 0; then
12459     AC_MSG_RESULT([explicit make -j option needed])
12460 else
12461     AC_MSG_RESULT([$PARALLELISM])
12463 AC_SUBST(PARALLELISM)
12465 IWYU_PATH="$with_iwyu"
12466 AC_SUBST(IWYU_PATH)
12467 if test ! -z "$IWYU_PATH"; then
12468     if test ! -f "$IWYU_PATH"; then
12469         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12470     fi
12474 # Set up ILIB for MSVC build
12476 ILIB1=
12477 if test "$build_os" = "cygwin"; then
12478     ILIB="."
12479     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12480         ILIB="$ILIB;$JAVA_HOME/lib"
12481     fi
12482     ILIB1=-link
12483     if test "$BITNESS_OVERRIDE" = 64; then
12484         ILIB="$ILIB;$COMPATH/lib/amd64"
12485         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12486         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12487         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12488         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12489             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12490             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12491         fi
12492         if test $VCVER = 140; then
12493             PathFormat "$ucrttest"
12494             ucrtlibpath_formatted="$formatted_path/lib/$ucrtdir/ucrt/x64"
12495             ILIB="$ILIB;$ucrtlibpath_formatted"
12496         fi
12497     else
12498         ILIB="$ILIB;$COMPATH/lib"
12499         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12500         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12501         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12502         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12503             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12504             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12505         fi
12506         if test $VCVER = 140; then
12507             PathFormat "$ucrttest"
12508             ucrtlibpath_formatted="$formatted_path/lib/$ucrtdir/ucrt/x86"
12509             ILIB="$ILIB;$ucrtlibpath_formatted"
12510         fi
12511     fi
12512     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12513         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12514     else
12515         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12516     fi
12518     AC_SUBST(ILIB)
12521 AC_MSG_CHECKING(
12522     [whether C++11 use of const_iterator in standard containers is broken])
12523 save_CXXFLAGS=$CXXFLAGS
12524 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12525 AC_LANG_PUSH([C++])
12526 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12527     #include <list>
12528     ]],[[
12529         std::list<int> l;
12530         l.erase(l.cbegin());
12531     ]])],
12532     [broken=no], [broken=yes])
12533 AC_LANG_POP([C++])
12534 LIBS=$save_LIBS
12535 CXXFLAGS=$save_CXXFLAGS
12536 AC_MSG_RESULT([$broken])
12537 if test "$broken" = yes; then
12538     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12542 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12543 save_CXXFLAGS=$CXXFLAGS
12544 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12545 save_LIBS=$LIBS
12546 if test -n "$ILIB1"; then
12547     LIBS="$LIBS $ILIB1"
12549 AC_LANG_PUSH([C++])
12550 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12551     // Exit with failure if the static initializer_list is stored on the
12552     // stack (as done by Clang < 3.4):
12553     #include <initializer_list>
12554     struct S {};
12555     bool g(void const * p1, void const * p2) {
12556         int n;
12557         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12558     }
12559     bool f(void const * p1) {
12560         static std::initializer_list<S> s { S() };
12561         return g(p1, s.begin());
12562     }
12563     ]],[[
12564         int n;
12565         return f(&n) ? 0 : 1;
12566     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12567 AC_LANG_POP([C++])
12568 LIBS=$save_LIBS
12569 CXXFLAGS=$save_CXXFLAGS
12570 AC_MSG_RESULT([$broken])
12571 if test "$broken" = yes; then
12572     AC_DEFINE([HAVE_BROKEN_STATIC_INITILIZER_LIST])
12576 # ===================================================================
12577 # Creating bigger shared library to link against
12578 # ===================================================================
12579 AC_MSG_CHECKING([whether to create huge library])
12580 MERGELIBS=
12582 if test $_os = iOS -o $_os = Android; then
12583     # Never any point in mergelibs for these as we build just static
12584     # libraries anyway...
12585     enable_mergelibs=no
12588 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12589     if test $_os != Linux -a $_os != WINNT; then
12590         add_warning "--enable-mergelibs is not tested for this platform"
12591     fi
12592     MERGELIBS="TRUE"
12593     AC_MSG_RESULT([yes])
12594 else
12595     AC_MSG_RESULT([no])
12597 AC_SUBST([MERGELIBS])
12599 # ===================================================================
12600 # Create hardlinks on deliver instead of copying for smaller size and speed up
12601 # ===================================================================
12602 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12603 HARDLINKDELIVER=
12604 if test "$enable_hardlink_deliver" = "yes"; then
12605     HARDLINKDELIVER="TRUE"
12606     AC_MSG_RESULT([yes])
12607 else
12608     AC_MSG_RESULT([no])
12610 AC_SUBST(HARDLINKDELIVER)
12612 dnl ===================================================================
12613 dnl icerun is a wrapper that stops us spawning tens of processes
12614 dnl locally - for tools that can't be executed on the compile cluster
12615 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12616 dnl ===================================================================
12617 AC_MSG_CHECKING([whether to use icerun wrapper])
12618 ICECREAM_RUN=
12619 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12620     ICECREAM_RUN=icerun
12621     AC_MSG_RESULT([yes])
12622 else
12623     AC_MSG_RESULT([no])
12625 AC_SUBST(ICECREAM_RUN)
12627 dnl ===================================================================
12628 dnl Setup the ICECC_VERSION for the build the same way it was set for
12629 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12630 dnl ===================================================================
12631 x_ICECC_VERSION=[\#]
12632 if test -n "$ICECC_VERSION" ; then
12633     x_ICECC_VERSION=
12635 AC_SUBST(x_ICECC_VERSION)
12636 AC_SUBST(ICECC_VERSION)
12638 dnl ===================================================================
12640 AC_MSG_CHECKING([MPL subset])
12641 MPL_SUBSET=
12643 if test "$enable_mpl_subset" = "yes"; then
12644     warn_report=false
12645     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12646         warn_report=true
12647     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12648         warn_report=true
12649     fi
12650     if test "$warn_report" = "true"; then
12651         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12652     fi
12653     if test "x$enable_postgresql_sdbc" != "xno"; then
12654         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12655     fi
12656     if test "$enable_lotuswordpro" = "yes"; then
12657         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12658     fi
12659     if test "$WITH_WEBDAV" = "neon"; then
12660         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12661     fi
12662     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12663         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12664     fi
12665     if test -n "$ENABLE_PDFIMPORT"; then
12666         if test "x$SYSTEM_POPPLER" = "x"; then
12667             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12668         fi
12669     fi
12670     # cf. m4/libo_check_extension.m4
12671     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12672         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12673     fi
12674     for theme in $WITH_THEMES; do
12675         case $theme in
12676         breeze|crystal|default|hicontrast|human|oxygen|sifr)
12677             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12678         *) : ;;
12679         esac
12680     done
12682     ENABLE_OPENGL=
12684     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12685         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12686     fi
12688     MPL_SUBSET="TRUE"
12689     AC_DEFINE(MPL_HAVE_SUBSET)
12690     AC_MSG_RESULT([only])
12691 else
12692     AC_MSG_RESULT([no restrictions])
12694 AC_SUBST(MPL_SUBSET)
12697 dnl ===================================================================
12698 dnl Setting up the environment.
12699 dnl ===================================================================
12700 AC_MSG_NOTICE([setting up the build environment variables...])
12702 AC_SUBST(COMPATH)
12704 if test "$build_os" = "cygwin"; then
12705     if test -d "$COMPATH/atlmfc/lib"; then
12706         ATL_LIB="$COMPATH/atlmfc/lib"
12707         ATL_INCLUDE="$COMPATH/atlmfc/include"
12708     else
12709         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12710         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12711     fi
12712     if test "$BITNESS_OVERRIDE" = 64; then
12713         ATL_LIB="$ATL_LIB/amd64"
12714     fi
12715     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12716     PathFormat "/usr/bin/find.exe"
12717     FIND="$formatted_path"
12718     PathFormat "/usr/bin/sort.exe"
12719     SORT="$formatted_path"
12720     PathFormat "/usr/bin/grep.exe"
12721     WIN_GREP="$formatted_path"
12722     PathFormat "/usr/bin/ls.exe"
12723     WIN_LS="$formatted_path"
12724     PathFormat "/usr/bin/touch.exe"
12725     WIN_TOUCH="$formatted_path"
12726 else
12727     FIND=find
12728     SORT=sort
12731 AC_SUBST(ATL_INCLUDE)
12732 AC_SUBST(ATL_LIB)
12733 AC_SUBST(FIND)
12734 AC_SUBST(SORT)
12735 AC_SUBST(WIN_GREP)
12736 AC_SUBST(WIN_LS)
12737 AC_SUBST(WIN_TOUCH)
12739 AC_SUBST(BUILD_TYPE)
12741 AC_SUBST(SOLARINC)
12743 PathFormat "$PERL"
12744 PERL="$formatted_path"
12745 AC_SUBST(PERL)
12747 if test -n "$TMPDIR"; then
12748     TEMP_DIRECTORY="$TMPDIR"
12749 else
12750     TEMP_DIRECTORY="/tmp"
12752 if test "$build_os" = "cygwin"; then
12753     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12755 AC_SUBST(TEMP_DIRECTORY)
12757 # setup the PATH for the environment
12758 if test -n "$LO_PATH_FOR_BUILD"; then
12759     LO_PATH="$LO_PATH_FOR_BUILD"
12760 else
12761     LO_PATH="$PATH"
12763     case "$host_os" in
12765     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12766         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12767             pathmunge "$JAVA_HOME/bin" "after"
12768         fi
12769         ;;
12771     cygwin*)
12772         # Win32 make needs native paths
12773         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12774             LO_PATH=`cygpath -p -m "$PATH"`
12775         fi
12776         if test "$BITNESS_OVERRIDE" = 64; then
12777             # needed for msi packaging
12778             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12779         fi
12780         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12781         pathmunge "$ASM_HOME" "before"
12782         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12783         pathmunge "$CSC_PATH" "before"
12784         pathmunge "$MIDL_PATH" "before"
12785         pathmunge "$AL_PATH" "before"
12786         pathmunge "$MSPDB_PATH" "before"
12787         if test -n "$MSBUILD_PATH" ; then
12788             pathmunge "$MSBUILD_PATH" "before"
12789         fi
12790         if test "$BITNESS_OVERRIDE" = 64; then
12791             if test "$vcexpress" = "Express"; then
12792                 pathmunge "$COMPATH/bin/x86_amd64" "before"
12793                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12794             else
12795                 pathmunge "$COMPATH/bin/amd64" "before"
12796                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12797             fi
12798         else
12799             pathmunge "$COMPATH/bin" "before"
12800             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12801         fi
12802         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12803             if test -d "$JAVA_HOME/jre/bin/client"; then
12804                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12805             fi
12806             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12807                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12808             fi
12809             pathmunge "$JAVA_HOME/bin" "before"
12810         fi
12811         ;;
12813     solaris*)
12814         pathmunge "/usr/css/bin" "before"
12815         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12816             pathmunge "$JAVA_HOME/bin" "after"
12817         fi
12818         ;;
12819     esac
12822 AC_SUBST(LO_PATH)
12824 # Generate a configuration md5 we can use for deps
12825 if test -f config_host.mk; then
12826     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12828 if test -f config_host_lang.mk; then
12829     config_lang_md5=`$MD5SUM config_host_lang.mk | sed "s/ .*//"`
12832 AC_CONFIG_FILES([config_host.mk
12833                  config_host_lang.mk
12834                  Makefile
12835                  lo.xcent
12836                  instsetoo_native/util/openoffice.lst
12837                  sysui/desktop/macosx/Info.plist
12838                  ios/lo.xcconfig])
12839 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12840 AC_CONFIG_HEADERS([config_host/config_clang.h])
12841 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12842 AC_CONFIG_HEADERS([config_host/config_eot.h])
12843 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12844 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12845 AC_CONFIG_HEADERS([config_host/config_cups.h])
12846 AC_CONFIG_HEADERS([config_host/config_features.h])
12847 AC_CONFIG_HEADERS([config_host/config_folders.h])
12848 AC_CONFIG_HEADERS([config_host/config_gcc.h])
12849 AC_CONFIG_HEADERS([config_host/config_global.h])
12850 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12851 AC_CONFIG_HEADERS([config_host/config_java.h])
12852 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12853 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12854 AC_CONFIG_HEADERS([config_host/config_locales.h])
12855 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12856 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12857 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12858 AC_CONFIG_HEADERS([config_host/config_oox.h])
12859 AC_CONFIG_HEADERS([config_host/config_opengl.h])
12860 AC_CONFIG_HEADERS([config_host/config_options.h])
12861 AC_CONFIG_HEADERS([config_host/config_test.h])
12862 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12863 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12864 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12865 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12866 AC_CONFIG_HEADERS([config_host/config_version.h])
12867 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12868 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12869 AC_CONFIG_HEADERS([config_host/config_python.h])
12870 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12871 AC_OUTPUT
12873 if test "$CROSS_COMPILING" = TRUE; then
12874     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12877 # touch the config timestamp file
12878 if test ! -f config_host.mk.stamp; then
12879     echo > config_host.mk.stamp
12880 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12881     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12882 else
12883     echo > config_host.mk.stamp
12886 # touch the config lang timestamp file
12887 if test ! -f config_host_lang.mk.stamp; then
12888     echo > config_host_lang.mk.stamp
12889 elif test "$config_lang_md5" = `$MD5SUM config_host_lang.mk | sed "s/ .*//"`; then
12890     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12891 else
12892     echo > config_host_lang.mk.stamp
12896 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12898 cat << _EOS
12899 ****************************************************************************
12900 WARNING:
12901 Your make version is known to be horribly slow, and hard to debug
12902 problems with. To get a reasonably functional make please do:
12904 to install a pre-compiled binary make for Win32
12906  mkdir -p /opt/lo/bin
12907  cd /opt/lo/bin
12908  wget http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12909  cp make-85047eb-msvc.exe make
12910  chmod +x make
12912 to install from source:
12913 place yourself in a working directory of you choice.
12915  git clone git://git.savannah.gnu.org/make.git
12917  [go to Start menu, click "All Programs", click "Visual Studio 2013", click "Visual Studio Tools", double-click "VS2013 x86 Native Tools Command Prompt" or "VS2013 x64 Native Tools Command Prompt"]
12918  set PATH=%PATH%;C:\Cygwin\bin
12919  [or Cygwin64, if that is what you have]
12920  cd path-to-make-repo-you-cloned-above
12921  build_w32.bat --without-guile
12923 should result in a WinRel/gnumake.exe.
12924 Copy it to to the Cygwin /opt/lo/bin directory as make.exe
12926 Then re-run autogen.sh
12928 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12929 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12931 _EOS
12934 cat << _EOF
12935 ****************************************************************************
12937 To build, run:
12938 $GNUMAKE
12940 To view some help, run:
12941 $GNUMAKE help
12943 _EOF
12945 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12946     cat << _EOF
12947 After the build has finished, you can immediately run it using:
12948 _EOF
12950     if test $_os = Darwin; then
12951         echo open instdir/$PRODUCTNAME.app
12952     else
12953         echo instdir/program/soffice
12954     fi
12955     cat << _EOF
12957 If you want to run the smoketest, run:
12958 $GNUMAKE check
12960 _EOF
12963 if test -f warn; then
12964     cat warn
12965     rm warn
12968 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: