bump product version to 5.1.2.2
[LibreOffice.git] / configure.ac
blobfbe95297c067cd275ef681dc9e01eec1d124c6ef
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.1.2.2],[],[],[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=
287 AC_SUBST(SRC_ROOT)
288 AC_SUBST(BUILDDIR)
289 AC_SUBST(x_Cygwin)
290 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
291 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
293 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
294     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
297 # need sed in os checks...
298 AC_PATH_PROGS(SED, sed)
299 if test -z "$SED"; then
300     AC_MSG_ERROR([install sed to run this script])
303 # Set the ENABLE_LTO variable
304 # ===================================================================
305 AC_MSG_CHECKING([whether to use link-time optimization])
306 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
307     ENABLE_LTO="TRUE"
308     AC_MSG_RESULT([yes])
309     AC_DEFINE(STATIC_LINKING)
310 else
311     ENABLE_LTO=""
312     AC_MSG_RESULT([no])
314 AC_SUBST(ENABLE_LTO)
316 dnl ===================================================================
317 dnl When building for Android, --with-android-ndk,
318 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
319 dnl mandatory
320 dnl ===================================================================
322 AC_ARG_WITH(android-ndk,
323     AS_HELP_STRING([--with-android-ndk],
324         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
327 AC_ARG_WITH(android-ndk-toolchain-version,
328     AS_HELP_STRING([--with-android-ndk-toolchain-version],
329         [Specify which toolchain version to use, of those present in the
330         Android NDK you are using. The default is 4.9 currently.]), ,)
332 AC_ARG_WITH(android-sdk,
333     AS_HELP_STRING([--with-android-sdk],
334         [Specify location of the Android SDK. Mandatory when building for Android,
335         or when building the Impress Remote Android app.]),
338 ANDROID_NDK_HOME=
339 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk"; then
340     with_android_ndk="$SRC_ROOT/external/android-ndk"
342 if test -n "$with_android_ndk"; then
343     ANDROID_NDK_HOME=$with_android_ndk
345     # Set up a lot of pre-canned defaults
347     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
348         AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT file in $ANDROID_NDK_HOME.])
349     fi
350     ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
352     case $ANDROID_NDK_VERSION in
353     r9*|r10*)
354         ;;
355     *)
356         AC_MSG_ERROR([Unsupported NDK version $ANDROID_NDK_VERSION, only r9* and r10* versions are supported])
357         ;;
358     esac
360     if test $host_cpu = arm; then
361         android_cpu=arm
362         android_platform_prefix=$android_cpu-linux-androideabi
363     elif test $host_cpu = aarch64; then
364         android_cpu=aarch64
365         android_platform_prefix=$android_cpu-linux-android
366     elif test $host_cpu = mips; then
367         android_cpu=mips
368         android_platform_prefix=$android_cpu-linux-androideabi
369     else
370         # host_cpu is something like "i386" or "i686" I guess, NDK uses
371         # "x86" in some contexts
372         android_cpu=x86
373         android_platform_prefix=$android_cpu
374     fi
376     if test -z "$with_android_ndk_toolchain_version"; then
377         # Default to gcc 4.9
378         with_android_ndk_toolchain_version=4.9
379     fi
381     case "$with_android_ndk_toolchain_version" in
382     4.6|4.7|4.8|4.9)
383         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
384         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
385         ;;
386     clang3.3|clang3.4)
387         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
388         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
389         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
390         ANDROID_USING_CLANG=true
391         ;;
392     *)
393         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
394     esac
396     if test ! -d $ANDROID_BINUTILS_DIR; then
397         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
398     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
399         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
400     fi
402     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
403     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
404     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
405     # manage to link the (app-specific) single huge .so that is built for the app in
406     # android/source/ if there is debug information in a significant part of the object files.
407     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
408     # all objects have been built with debug information.)
409     toolchain_system='*'
410     case $build_os in
411     linux-gnu*)
412         ndk_build_os=linux
413         ;;
414     darwin*)
415         ndk_build_os=darwin
416         ;;
417     *)
418         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
419         ;;
420     esac
422     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
423     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
424     if test $build_cpu = x86_64; then
425         if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
426             ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
427         fi
428         if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
429             ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
430         fi
431     fi
432     ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
434     # This stays empty if there is just one version of the toolchain in the NDK
435     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
436     case "`echo $ANDROID_NDK_HOME/toolchains/$android_cpu*-*/prebuilt/*/bin`" in
437     */bin\ */bin*)
438         # Trailing slash intentional and necessary, compare to how this is used
439         if test -n "$ANDROID_USING_CLANG"; then
440             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
441         else
442             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
443         fi
444         ;;
445     esac
447     ANDROID_API_LEVEL=15
448     if test $host_cpu = arm; then
449         android_gnu_prefix=arm-linux-androideabi
450     elif test $host_cpu = aarch64; then
451         android_gnu_prefix=aarch64-linux-android
452         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
453         ANDROID_API_LEVEL=L
454     elif test $host_cpu = mips; then
455         android_gnu_prefix=mipsel-linux-android
456     elif test $ANDROID_NDK_VERSION = r8; then
457         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
458         android_gnu_prefix=i686-android-linux
459     else
460         android_gnu_prefix=i686-linux-android
461     fi
463     ANDROID_ARCH=$android_cpu
464     if test $host_cpu = arm; then
465         ANDROID_APP_ABI=armeabi-v7a
466         if test -n "$ANDROID_USING_CLANG"; then
467             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
468             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
469             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
470         else
471             :
472         fi
473         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
474         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
475         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
476     elif test $host_cpu = aarch64; then
477         ANDROID_APP_ABI=arm64-v8a
478         ANDROID_ARCH=arm64
479     elif test $host_cpu = mips; then
480         ANDROID_APP_ABI=mips
481         ANDROIDCFLAGS=""
482     else # x86
483         ANDROID_APP_ABI=x86
484         ANDROIDCFLAGS="-march=atom"
485     fi
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
487     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
488     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
490     if test -n "$ANDROID_USING_CLANG"; then
491         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
492     else
493         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
494     fi
496     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
497     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
498     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
499     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
500     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
501     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
503     # When using the 4.6 or newer toolchain, use the gold linker
504     case "$with_android_ndk_toolchain_version" in
505     4.[[6789]]*|[[56789]].*|clang*)
506         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
507             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
508         fi
509         ;;
510     esac
512     if test "$ENABLE_LTO" = TRUE; then
513         # -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of
514         # $CC and $CXX when building external libraries
515         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
516     fi
518     # gdbserver can be in different locations
519     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
520         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
521     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
522         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
523     elif test $android_cpu = aarch64; then
524         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
525     else
526         AC_MSG_ERROR([Can't find gdbserver for your Android target])
527     fi
529     if test $host_cpu = arm; then
530         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"
531     elif test $host_cpu = mips; then
532         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"
533     else # x86
534         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"
535     fi
537     if test -z "$CC"; then
538         case "$with_android_ndk_toolchain_version" in
539         4.*)
540             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
541             ;;
542         clang*)
543             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
544         esac
545     fi
546     if test -z "$CXX"; then
547         case "$with_android_ndk_toolchain_version" in
548         4.*)
549             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
550             ;;
551         clang*)
552             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
553             ;;
554         esac
555     fi
557     # remember to download the ownCloud Android library later
558     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
560 AC_SUBST(ANDROID_NDK_GDBSERVER)
561 AC_SUBST(ANDROID_APP_ABI)
563 dnl ===================================================================
564 dnl --with-android-sdk
565 dnl ===================================================================
566 ANDROID_SDK_HOME=
567 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux"; then
568     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
570 if test -n "$with_android_sdk"; then
571     ANDROID_SDK_HOME=$with_android_sdk
572     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
574 AC_SUBST(ANDROID_SDK_HOME)
576 dnl ===================================================================
577 dnl The following is a list of supported systems.
578 dnl Sequential to keep the logic very simple
579 dnl These values may be checked and reset later.
580 dnl ===================================================================
581 #defaults unless the os test overrides this:
582 test_randr=yes
583 test_xrender=yes
584 test_cups=yes
585 test_dbus=yes
586 test_fontconfig=yes
587 test_cairo=no
589 # Default values, as such probably valid just for Linux, set
590 # differently below just for Mac OSX,but at least better than
591 # hardcoding these as we used to do. Much of this is duplicated also
592 # in solenv for old build system and for gbuild, ideally we should
593 # perhaps define stuff like this only here in configure.ac?
595 LINKFLAGSSHL="-shared"
596 PICSWITCH="-fpic"
597 DLLPOST=".so"
599 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
601 INSTROOTSUFFIX=
602 SDKDIRNAME=sdk
604 case "$host_os" in
606 solaris*)
607     test_gtk=yes
608     build_gstreamer_1_0=yes
609     build_gstreamer_0_10=yes
610     test_tde=yes
611     test_freetype=yes
612     _os=SunOS
614     dnl ===========================================================
615     dnl Check whether we're using Solaris 10 - SPARC or Intel.
616     dnl ===========================================================
617     AC_MSG_CHECKING([the Solaris operating system release])
618     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
619     if test "$_os_release" -lt "10"; then
620         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
621     else
622         AC_MSG_RESULT([ok ($_os_release)])
623     fi
625     dnl Check whether we're using a SPARC or i386 processor
626     AC_MSG_CHECKING([the processor type])
627     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
628         AC_MSG_RESULT([ok ($host_cpu)])
629     else
630         AC_MSG_ERROR([only SPARC and i386 processors are supported])
631     fi
632     ;;
634 linux-gnu*|k*bsd*-gnu*)
635     test_gtk=yes
636     build_gstreamer_1_0=yes
637     build_gstreamer_0_10=yes
638     test_tde=yes
639     test_kde4=yes
640     test_freetype=yes
641     _os=Linux
642     ;;
644 gnu)
645     test_randr=no
646     test_xrender=no
647     _os=GNU
648      ;;
650 cygwin*|interix*|mingw32*)
652     # When building on Windows normally with MSVC under Cygwin,
653     # configure thinks that the host platform (the platform the
654     # built code will run on) is Cygwin, even if it obviously is
655     # Windows, which in Autoconf terminology is called
656     # "mingw32". (Which is misleading as MinGW is the name of the
657     # tool-chain, not an operating system.)
659     # Somewhat confusing, yes. But this configure script doesn't
660     # look at $host etc that much, it mostly uses its own $_os
661     # variable, set here in this case statement.
663     # When cross-compiling to Windows from Unix, the host platform
664     # is "mingw32" (because in that case it is the MinGW
665     # tool-chain that is used).
667     test_cups=no
668     test_dbus=no
669     test_randr=no
670     test_xrender=no
671     test_freetype=no
672     test_fontconfig=no
673     _os=WINNT
675     DLLPOST=".dll"
676     LINKFLAGSNOUNDEFS=
678     # If the host OS matches "mingw32*", that means we are using the
679     # MinGW cross-compiler, because we don't see the point in building
680     # LibreOffice using MinGW on Windows. If you want to build on
681     # Windows, use MSVC. If you want to use MinGW, surely you want to
682     # cross-compile (from Linux or some other Unix).
684     case "$host_os" in
685     mingw32*)
686         WITH_MINGW=yes
687         if test -z "$CC"; then
688             CC="$host_cpu-$host_vendor-$host_os-gcc"
689         fi
690         if test -z "$CXX"; then
691             CXX="$host_cpu-$host_vendor-$host_os-g++"
692         fi
693         ;;
694     esac
695     ;;
697 darwin*) # Mac OS X or iOS
698     test_gtk=yes
699     test_randr=no
700     test_xrender=no
701     test_freetype=no
702     test_fontconfig=no
703     test_dbus=no
704     if test "$host_cpu" = "arm"; then
705         _os=iOS
706         test_gtk=no
707         test_cups=no
708     else
709         _os=Darwin
710         if test -n "$LODE_HOME" ; then
711             mac_sanitize_path
712             AC_MSG_NOTICE([sanitized the PATH to $PATH])
713         fi
714         INSTROOTSUFFIX=/$PRODUCTNAME.app/Contents
715         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
716     fi
717     enable_systray=no
718     # See comment above the case "$host_os"
719     LINKFLAGSSHL="-dynamiclib -single_module"
721     # -fPIC is default
722     PICSWITCH=""
724     DLLPOST=".dylib"
726     # -undefined error is the default
727     LINKFLAGSNOUNDEFS=""
730 freebsd*)
731     test_gtk=yes
732     build_gstreamer_1_0=yes
733     build_gstreamer_0_10=yes
734     test_tde=yes
735     test_kde4=yes
736     test_freetype=yes
737     AC_MSG_CHECKING([the FreeBSD operating system release])
738     if test -n "$with_os_version"; then
739         OSVERSION="$with_os_version"
740     else
741         OSVERSION=`/sbin/sysctl -n kern.osreldate`
742     fi
743     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
744     AC_MSG_CHECKING([which thread library to use])
745     if test "$OSVERSION" -lt "500016"; then
746         PTHREAD_CFLAGS="-D_THREAD_SAFE"
747         PTHREAD_LIBS="-pthread"
748     elif test "$OSVERSION" -lt "502102"; then
749         PTHREAD_CFLAGS="-D_THREAD_SAFE"
750         PTHREAD_LIBS="-lc_r"
751     else
752         PTHREAD_CFLAGS=""
753         PTHREAD_LIBS="-pthread"
754     fi
755     AC_MSG_RESULT([$PTHREAD_LIBS])
756     _os=FreeBSD
757     ;;
759 *netbsd*)
760     test_gtk=yes
761     build_gstreamer_1_0=yes
762     build_gstreamer_0_10=yes
763     test_tde=no
764     test_kde4=yes
765     test_freetype=yes
766     PTHREAD_LIBS="-pthread -lpthread"
767     _os=NetBSD
768     ;;
770 aix*)
771     test_randr=no
772     test_freetype=yes
773     PTHREAD_LIBS=-pthread
774     _os=AIX
775     ;;
777 openbsd*)
778     test_gtk=yes
779     test_tde=yes
780     test_freetype=yes
781     PTHREAD_CFLAGS="-D_THREAD_SAFE"
782     PTHREAD_LIBS="-pthread"
783     _os=OpenBSD
784     ;;
786 dragonfly*)
787     test_gtk=yes
788     build_gstreamer_1_0=yes
789     build_gstreamer_0_10=yes
790     test_tde=yes
791     test_kde4=yes
792     test_freetype=yes
793     PTHREAD_LIBS="-pthread"
794     _os=DragonFly
795     ;;
797 linux-android*)
798     build_gstreamer_1_0=no
799     build_gstreamer_0_10=no
800     enable_lotuswordpro=no
801     enable_mpl_subset=yes
802     enable_coinmp=yes
803     enable_lpsolve=no
804     enable_report_builder=no
805     with_theme="tango"
806     test_cups=no
807     test_dbus=no
808     test_fontconfig=no
809     test_freetype=no
810     test_gtk=no
811     test_tde=no
812     test_kde4=no
813     test_randr=no
814     test_xrender=no
815     _os=Android
817     if test -z "$with_android_ndk"; then
818         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
819     fi
821     if test -z "$with_android_ndk_toolchain_version"; then
822         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
823     fi
825     # Verify that the NDK and SDK options are proper
826     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
827         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
828     fi
830     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
831     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
832     ;;
834 emscripten*)
835     build_gstreamer_1_0=no
836     build_gstreamer_0_10=no
837     enable_lotuswordpro=no
838     enable_mpl_subset=yes
839     enable_coinmp=yes
840     enable_lpsolve=no
841     enable_report_builder=no
842     with_theme="tango"
843     test_cups=no
844     test_dbus=no
845     test_fontconfig=no
846     test_freetype=no
847     test_gtk=no
848     test_tde=no
849     test_kde4=no
850     test_randr=no
851     test_xrender=no
852     _os=Emscripten
853     ;;
856     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
857     ;;
858 esac
860 if echo "$host_os" | grep -q linux-android ; then
861     if test -z "$with_android_sdk"; then
862         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
863     fi
865     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
866         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
867     fi
869     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
870     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
871         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
872                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
873                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
874         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
875         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
876         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
877     fi
878     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
879         AC_MSG_WARN([android support repository not found - install with
880                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
881                      to allow the build to download the specified version of the android support libraries])
882         add_warning "android support repository not found - install with"
883         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
884         add_warning "to allow the build to download the specified version of the android support libraries"
885     fi
888 if test "$_os" = "AIX"; then
889     AC_PATH_PROG(GAWK, gawk)
890     if test -z "$GAWK"; then
891         AC_MSG_ERROR([gawk not found in \$PATH])
892     fi
895 AC_SUBST(SDKDIRNAME)
897 AC_SUBST(WITH_MINGW)
898 AC_SUBST(PTHREAD_CFLAGS)
899 AC_SUBST(PTHREAD_LIBS)
901 if test $_os != "WINNT"; then
902     save_LIBS="$LIBS"
903     AC_SEARCH_LIBS([dlsym], [dl],
904         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
905         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
906     LIBS="$save_LIBS"
908 AC_SUBST(DLOPEN_LIBS)
910 ###############################################################################
911 # Extensions switches --enable/--disable
912 ###############################################################################
913 # By default these should be enabled unless having extra dependencies.
914 # If there is extra dependency over configure options then the enable should
915 # be automagic based on whether the requiring feature is enabled or not.
916 # All this options change anything only with --enable-extension-integration.
918 # The name of this option and its help string makes it sound as if
919 # extensions are built anyway, just not integrated in the installer,
920 # if you use --disable-extension-integration. Is that really the
921 # case?
923 AC_ARG_ENABLE(extension-integration,
924     AS_HELP_STRING([--disable-extension-integration],
925         [Disable integration of the built extensions in the installer of the
926          product. Use this switch to disable the integration.])
929 AC_ARG_ENABLE(export,
930     AS_HELP_STRING([--disable-export],
931         [Disable (some) code for document export. Useful when building viewer-only apps that lack
932          save/export functionality, to avoid having an excessive amount of code and data used
933          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
936 AC_ARG_ENABLE(avmedia,
937     AS_HELP_STRING([--disable-avmedia],
938         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
941 AC_ARG_ENABLE(database-connectivity,
942     AS_HELP_STRING([--disable-database-connectivity],
943         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
946 # This doesn't mean not building (or "integrating") extensions
947 # (although it probably should; i.e. it should imply
948 # --disable-extension-integration I guess), it means not supporting
949 # any extension mechanism at all
950 AC_ARG_ENABLE(extensions,
951     AS_HELP_STRING([--disable-extensions],
952         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
955 AC_ARG_ENABLE(scripting,
956     AS_HELP_STRING([--disable-scripting],
957         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
960 # This is mainly for Android and iOS, but could potentially be used in some
961 # special case otherwise, too, so factored out as a separate setting
963 AC_ARG_ENABLE(dynamic-loading,
964     AS_HELP_STRING([--disable-dynamic-loading],
965         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
968 AC_ARG_ENABLE(ext-mariadb-connector,
969     AS_HELP_STRING([--enable-ext-mariadb-connector],
970         [Enable the build of the MariaDB/MySQL Connector extension.])
973 AC_ARG_ENABLE(report-builder,
974     AS_HELP_STRING([--disable-report-builder],
975         [Disable the Report Builder.])
978 AC_ARG_ENABLE(ext-wiki-publisher,
979     AS_HELP_STRING([--enable-ext-wiki-publisher],
980         [Enable the Wiki Publisher extension.])
983 AC_ARG_ENABLE(lpsolve,
984     AS_HELP_STRING([--disable-lpsolve],
985         [Disable compilation of the lp solve solver ])
987 AC_ARG_ENABLE(coinmp,
988     AS_HELP_STRING([--disable-coinmp],
989         [Disable compilation of the CoinMP solver ])
992 AC_ARG_ENABLE(pdfimport,
993     AS_HELP_STRING([--disable-pdfimport],
994         [Disable building the PDF import feature.])
997 ###############################################################################
999 dnl ---------- *** ----------
1001 AC_ARG_ENABLE([hardlink-deliver],
1002     AS_HELP_STRING([--enable-hardlink-deliver],
1003         [Put files into deliver folder as hardlinks instead of copying them
1004         over. Saves space and speeds up build.])
1007 AC_ARG_ENABLE(mergelibs,
1008     AS_HELP_STRING([--enable-mergelibs],
1009         [Enables linking of big, merged, library. Experimental feature, tested
1010         only for Linux at some stage in history, but possibly does not work even
1011         for Linux any more. This will link a core set of libraries into libmerged.])
1014 AC_ARG_ENABLE(graphite,
1015     AS_HELP_STRING([--disable-graphite],
1016         [Disables the compilation of Graphite smart font rendering.])
1019 AC_ARG_ENABLE(orcus,
1020     AS_HELP_STRING([--enable-orcus],
1021         [Enables orcus for extra file import filters for Calc.])
1024 AC_ARG_ENABLE(fetch-external,
1025     AS_HELP_STRING([--disable-fetch-external],
1026         [Disables fetching external tarballs from web sources.])
1029 AC_ARG_ENABLE(pch,
1030     AS_HELP_STRING([--enable-pch],
1031         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1034 AC_ARG_ENABLE(epm,
1035     AS_HELP_STRING([--enable-epm],
1036         [LibreOffice includes self-packaging code, that requires epm, however epm is
1037          useless for large scale package building.])
1040 AC_ARG_ENABLE(odk,
1041     AS_HELP_STRING([--disable-odk],
1042         [LibreOffice includes an ODK, office development kit which some packagers may
1043          wish to build without.])
1046 AC_ARG_ENABLE(mpl-subset,
1047     AS_HELP_STRING([--enable-mpl-subset],
1048         [Don't compile any pieces which are not MPL or more liberally licensed])
1051 AC_ARG_ENABLE(evolution2,
1052     AS_HELP_STRING([--enable-evolution2],
1053         [Allows the built-in evolution 2 addressbook connectivity build to be
1054          enabled.])
1057 AC_ARG_ENABLE(directx,
1058     AS_HELP_STRING([--disable-directx],
1059         [Remove DirectX implementation for the new XCanvas interface.
1060          The DirectX support requires more stuff installed on Windows to
1061          compile. (DirectX SDK, GDI+ libs)])
1064 AC_ARG_ENABLE(activex,
1065     AS_HELP_STRING([--disable-activex],
1066         [Disable the use of ActiveX for a Windows build.
1067         This switch is mandatory when using an Express edition of Visual Studio.])
1070 AC_ARG_ENABLE(atl,
1071     AS_HELP_STRING([--disable-atl],
1072         [Disable the use of ATL for a Windows build.])
1073     [
1074         This switch is mandatory when using an Express edition of Visual Studio.
1075     ],
1078 AC_ARG_ENABLE(avahi,
1079     AS_HELP_STRING([--enable-avahi],
1080         [Determines whether to use Avahi to advertise Impress to remote controls.]),
1083 AC_ARG_ENABLE(werror,
1084     AS_HELP_STRING([--enable-werror],
1085         [Turn warnings to errors. (Has no effect in modules where the treating
1086          of warnings as errors is disabled explicitly.)]),
1089 AC_ARG_ENABLE(assert-always-abort,
1090     AS_HELP_STRING([--enable-assert-always-abort],
1091         [make assert() abort even in release code.]),
1094 AC_ARG_ENABLE(dbgutil,
1095     AS_HELP_STRING([--enable-dbgutil],
1096         [Provide debugging support from --enable-debug and include additional debugging
1097          utilities such as object counting or more expensive checks.
1098          This is the recommended option for developers.
1099          Note that this makes the build ABI incompatible, it is not possible to mix object
1100          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1102 AC_ARG_ENABLE(debug,
1103     AS_HELP_STRING([--enable-debug],
1104         [Include debugging information, disable compiler optimization and inlining plus
1105          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1107 AC_ARG_ENABLE(sal-log,
1108     AS_HELP_STRING([--enable-sal-log],
1109         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1111 AC_ARG_ENABLE(selective-debuginfo,
1112     AS_HELP_STRING([--enable-selective-debuginfo],
1113         [If --enable-debug or --enable-dbgutil is used, build debugging information
1114          (-g compiler flag) only for the specified gbuild build targets
1115          (where all means everything, - prepended means not to enable, / appended means
1116          everything in the directory; there is no ordering, more specific overrides
1117          more general, and disabling takes precedence).
1118          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1120 AC_ARG_ENABLE(symbols,
1121     AS_HELP_STRING([--enable-symbols],
1122         [Include debugging symbols in output while preserve optimization.
1123          This enables -g compiler flag for GCC or equivalent,
1124          without changing anything else compared to productive code.]))
1126 AC_ARG_ENABLE(runtime-optimizations,
1127     AS_HELP_STRING([--disable-runtime-optimizations],
1128         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1129          JVM JIT) that are known to interact badly with certain dynamic analysis
1130          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1131          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1132          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1134 AC_ARG_ENABLE(compiler-plugins,
1135     AS_HELP_STRING([--enable-compiler-plugins],
1136         [Enable compiler plugins that will perform additional checks during
1137          building. Enabled automatically by --enable-dbgutil.]))
1139 AC_ARG_ENABLE(ooenv,
1140     AS_HELP_STRING([--disable-ooenv],
1141         [Disable ooenv for the instdir installation.]))
1143 AC_ARG_ENABLE(lto,
1144     AS_HELP_STRING([--enable-lto],
1145         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1146          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1147          linker. For MSVC, this option is broken at the moment. This is experimental work
1148          in progress that shouldn't be used unless you are working on it.)]))
1150 AC_ARG_ENABLE(crashdump,
1151     AS_HELP_STRING([--enable-crashdump],
1152         [Enable the crashdump feature.]))
1154 AC_ARG_ENABLE(python,
1155     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1156         [Enables or disables Python support at run-time and build-time.
1157          Also specifies what Python to use. 'auto' is the default.
1158          'fully-internal' even forces the internal version for uses of Python
1159          during the build.]))
1161 AC_ARG_ENABLE(gtk,
1162     AS_HELP_STRING([--disable-gtk],
1163         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1164 ,enable_gtk=yes)
1166 AC_ARG_ENABLE(gtk3,
1167     AS_HELP_STRING([--enable-gtk3],
1168         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1169          This is experimental and may not work.]),
1170 ,enable_gtk3=yes)
1172 AC_ARG_ENABLE(systray,
1173     AS_HELP_STRING([--disable-systray],
1174         [Determines whether to build the systray quickstarter.]),
1175 ,enable_systray=yes)
1177 AC_ARG_ENABLE(split-app-modules,
1178     AS_HELP_STRING([--enable-split-app-modules],
1179         [Split file lists for app modules, e.g. base, calc.
1180          Has effect only with make distro-pack-install]),
1183 AC_ARG_ENABLE(split-opt-features,
1184     AS_HELP_STRING([--enable-split-opt-features],
1185         [Split file lists for some optional features, .e.g. pyuno, testtool.
1186          Has effect only with make distro-pack-install]),
1189 AC_ARG_ENABLE(cairo-canvas,
1190 [  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
1191                           platforms where Cairo is available.
1194 AC_ARG_ENABLE(dbus,
1195     AS_HELP_STRING([--disable-dbus],
1196         [Determines whether to enable features that depend on dbus.
1197          e.g. Presentation mode screensaver control, bluetooth presentation control]),
1198 ,enable_dbus=yes)
1200 AC_ARG_ENABLE(packagekit,
1201     AS_HELP_STRING([--enable-packagekit],
1202         [Determines whether to enable features using packagekit.
1203          Right now that is auto font install]),
1206 AC_ARG_ENABLE(sdremote,
1207     AS_HELP_STRING([--disable-sdremote],
1208         [Determines whether to enable Impress remote control (i.e. the server component).]),
1209 ,enable_sdremote=yes)
1211 AC_ARG_ENABLE(sdremote-bluetooth,
1212     AS_HELP_STRING([--disable-sdremote-bluetooth],
1213         [Determines whether to build sdremote with bluetooth support.
1214          Requires dbus on Linux.]))
1216 AC_ARG_ENABLE(gio,
1217     AS_HELP_STRING([--disable-gio],
1218         [Determines whether to use the GIO support.]),
1219 ,enable_gio=yes)
1221 AC_ARG_ENABLE(telepathy,
1222     AS_HELP_STRING([--enable-telepathy],
1223         [Determines whether to enable Telepathy for collaboration.]),
1224 ,enable_telepathy=no)
1226 AC_ARG_ENABLE(tde,
1227     AS_HELP_STRING([--enable-tde],
1228         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1229          TDE are available.]),
1232 AC_ARG_ENABLE(tdeab,
1233     AS_HELP_STRING([--disable-tdeab],
1234         [Disable the TDE address book support.]),
1236     if test "$enable_tde" = "yes"; then
1237         enable_tdeab=yes
1238     fi
1241 AC_ARG_ENABLE(kde4,
1242     AS_HELP_STRING([--enable-kde4],
1243         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1244          KDE4 are available.]),
1247 AC_ARG_ENABLE(randr,
1248     AS_HELP_STRING([--disable-randr],
1249         [Disable RandR support in the vcl project.]),
1250 ,enable_randr=yes)
1252 AC_ARG_ENABLE(randr-link,
1253     AS_HELP_STRING([--disable-randr-link],
1254         [Disable linking with libXrandr, instead dynamically open it at runtime.]),
1255 ,enable_randr_link=yes)
1257 AC_ARG_ENABLE(gstreamer-1-0,
1258     AS_HELP_STRING([--disable-gstreamer-1-0],
1259         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1260 ,enable_gstreamer_1_0=yes)
1262 AC_ARG_ENABLE(gstreamer-0-10,
1263     AS_HELP_STRING([--enable-gstreamer-0-10],
1264         [Enable building with the gstreamer 0.10 avmedia backend.]),
1265 ,enable_gstreamer_0_10=no)
1267 AC_ARG_ENABLE(vlc,
1268     AS_HELP_STRING([--enable-vlc],
1269         [Enable building with the (experimental) VLC avmedia backend.]),
1270 ,enable_vlc=no)
1272 AC_ARG_ENABLE(neon,
1273     AS_HELP_STRING([--disable-neon],
1274         [Disable neon and the compilation of webdav binding.]),
1277 AC_ARG_ENABLE([eot],
1278     [AS_HELP_STRING([--enable-eot],
1279         [Enable support for Embedded OpenType fonts.])],
1280 , [enable_eot=no])
1282 AC_ARG_ENABLE(cve-tests,
1283     AS_HELP_STRING([--disable-cve-tests],
1284         [Prevent CVE tests to be executed]),
1287 AC_ARG_ENABLE(chart-tests,
1288     AS_HELP_STRING([--enable-chart-tests],
1289         [Executes chart XShape tests. In a perfect world these tests would be
1290          stable and everyone could run them, in reality it is best to run them
1291          only on a few machines that are known to work and maintained by people
1292          who can judge if a test failure is a regression or not.]),
1295 AC_ARG_ENABLE(build-unowinreg,
1296     AS_HELP_STRING([--enable-build-unowinreg],
1297         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1298          compiler is needed on Linux.])
1299     [
1300                           Usage:     --enable-build-unowinreg
1301     ],
1304 AC_ARG_ENABLE(dependency-tracking,
1305     AS_HELP_STRING([--enable-dependency-tracking],
1306         [Do not reject slow dependency extractors.])[
1307   --disable-dependency-tracking
1308                           Disables generation of dependency information.
1309                           Speed up one-time builds.],
1312 AC_ARG_ENABLE(icecream,
1313     AS_HELP_STRING([--enable-icecream],
1314         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1315          It defaults to /opt/icecream for the location of the icecream gcc/g++
1316          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1319 AC_ARG_ENABLE(cups,
1320     AS_HELP_STRING([--disable-cups],
1321         [Do not build cups support.])
1324 AC_ARG_ENABLE(ccache,
1325     AS_HELP_STRING([--disable-ccache],
1326         [Do not try to use ccache automatically.
1327          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1328          CC/CXX are not yet set, and --enable-icecream is not given, we
1329          attempt to use ccache. --disable-ccache disables ccache completely.
1333 AC_ARG_ENABLE(64-bit,
1334     AS_HELP_STRING([--enable-64-bit],
1335         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1336          At the moment meaningful only for iOS and Windows. On Windows this option is
1337          experimental and possibly quite broken, and you should use it only if you are
1338          hacking on 64-bitness support.]), ,)
1340 AC_ARG_ENABLE(extra-gallery,
1341     AS_HELP_STRING([--enable-extra-gallery],
1342         [Add extra gallery content.]),
1345 AC_ARG_ENABLE(extra-template,
1346     AS_HELP_STRING([--enable-extra-template],
1347         [Add extra template content.]),
1350 AC_ARG_ENABLE(extra-sample,
1351     AS_HELP_STRING([--enable-extra-sample],
1352         [Add extra sample content.]),
1355 AC_ARG_ENABLE(extra-font,
1356     AS_HELP_STRING([--enable-extra-font],
1357         [Add extra font content.]),
1360 AC_ARG_ENABLE(online-update,
1361     AS_HELP_STRING([--enable-online-update],
1362         [Enable the online update service that will check for new versions of
1363          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1364          If the value is "mar", the experimental Mozilla-like update will be
1365          enabled instead of the traditional update mechanism.]),
1368 AC_ARG_ENABLE(extension-update,
1369     AS_HELP_STRING([--disable-extension-update],
1370         [Disable possibility to update installed extensions.]),
1373 AC_ARG_ENABLE(release-build,
1374     AS_HELP_STRING([--enable-release-build],
1375         [Enable release build.
1376          See http://wiki.documentfoundation.org/DevBuild]),
1379 AC_ARG_ENABLE(windows-build-signing,
1380     AS_HELP_STRING([--enable-windows-build-signing],
1381         [Enable signing of windows binaries (*.exe, *.dll)]),
1384 AC_ARG_ENABLE(silent-msi,
1385     AS_HELP_STRING([--enable-silent-msi],
1386         [Enable MSI with LIMITUI=1 (silent install).]),
1389 AC_ARG_ENABLE(macosx-code-signing,
1390     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1391         [Sign executables, dylibs, frameworks and the app bundle. If you
1392          don't provide an identity the first suitable certificate
1393          in your keychain is used.]),
1396 AC_ARG_ENABLE(macosx-package-signing,
1397     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1398         [Create a .pkg suitable for uploading to the Mac App Store and sign
1399          it. If you don't provide an identity the first suitable certificate
1400          in your keychain is used.]),
1403 AC_ARG_ENABLE(macosx-sandbox,
1404     AS_HELP_STRING([--enable-macosx-sandbox],
1405         [Make the app bundle run in a sandbox. Requires code signing.
1406          Is required by apps distributed in the Mac App Store, and implies
1407          adherence to App Store rules.]),
1410 AC_ARG_WITH(macosx-bundle-identifier,
1411     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1412         [Define the OS X bundle identifier. Default is the somewhat weird
1413          org.libreoffice.script ("script", huh?).]),
1414 ,with_macosx_bundle_identifier=org.libreoffice.script)
1416 AC_ARG_WITH(macosx-app-name,
1417     AS_HELP_STRING([--with-macosx-app-name='My Own Office Suite'],
1418         [Define the OS X app name. Default is AC_PACKAGE_NAME.]),
1419 ,with_macosx_app_name=$PRODUCTNAME)
1421 AC_ARG_ENABLE(ios-simulator,
1422     AS_HELP_STRING([--enable-ios-simulator],
1423         [Build for the iOS Simulator, not iOS device.]),
1426 AC_ARG_ENABLE(readonly-installset,
1427     AS_HELP_STRING([--enable-readonly-installset],
1428         [Prevents any attempts by LibreOffice to write into its installation. That means
1429          at least that no "system-wide" extensions can be added. Experimental work in
1430          progress.]),
1433 AC_ARG_ENABLE(postgresql-sdbc,
1434     AS_HELP_STRING([--disable-postgresql-sdbc],
1435         [Disable the build of the PostgreSQL-SDBC driver.])
1438 AC_ARG_ENABLE(lotuswordpro,
1439     AS_HELP_STRING([--disable-lotuswordpro],
1440         [Disable the build of the Lotus Word Pro filter.]),
1441 ,enable_lotuswordpro=yes)
1443 AC_ARG_ENABLE(firebird-sdbc,
1444     AS_HELP_STRING([--disable-firebird-sdbc],
1445         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1448 AC_ARG_ENABLE(winegcc,
1449     AS_HELP_STRING([--enable-winegcc],
1450         [Enable use of winegcc during the build, in order to create msi* tools
1451          needed for MinGW cross-compilation.]),
1454 AC_ARG_ENABLE(liblangtag,
1455     AS_HELP_STRING([--disable-liblangtag],
1456         [Disable use of liblangtag, and instead use an own simple
1457          implementation.]),
1460 AC_ARG_ENABLE(bogus-pkg-config,
1461     AS_HELP_STRING([--enable-bogus-pkg-config],
1462         [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.]),
1465 AC_ARG_ENABLE(openssl,
1466     AS_HELP_STRING([--disable-openssl],
1467         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1468          components will either use GNUTLS or NSS. Work in progress,
1469          use only if you are hacking on it.]),
1470 ,enable_openssl=yes)
1472 AC_ARG_WITH(prebuilt-openssl,
1473     AS_HELP_STRING([--with-prebuilt-openssl],
1474         [Don't build OpenSSL but use prebuilt binaries. Only for use on Windows, when you can't build it,
1475          thanks to the Cygwin fork() problem when running the Perl disaster in OpenSSL's build system.]))
1477 AC_ARG_ENABLE(library-bin-tar,
1478     AS_HELP_STRING([--enable-library-bin-tar],
1479         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1480         Some libraries can save their build result in a tarball
1481         stored in TARFILE_LOCATION. That binary tarball is
1482         uniquely identified by the source tarball,
1483         the content of the config_host.mk file and the content
1484         of the top-level directory in core for that library
1485         If this option is enabled, then if such a tarfile exist, it will be untarred
1486         instead of the source tarfile, and the build step will be skipped for that
1487         library.
1488         If a proper tarfile does not exist, then the normal source-based
1489         build is done for that library and a proper binary tarfile is created
1490         for the next time.]),
1493 AC_ARG_ENABLE(gltf,
1494     AS_HELP_STRING([--disable-gltf],
1495         [Determines whether to build libraries related to glTF 3D model rendering.]))
1497 AC_ARG_ENABLE(collada,
1498     AS_HELP_STRING([--disable-collada],
1499         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1501 AC_ARG_ENABLE(dconf,
1502     AS_HELP_STRING([--disable-dconf],
1503         [Disable the dconf configuration backend (enabled by default where
1504          available).]))
1506 dnl ===================================================================
1507 dnl Optional Packages (--with/without-)
1508 dnl ===================================================================
1510 AC_ARG_WITH(gnu-patch,
1511     AS_HELP_STRING([--with-gnu-patch],
1512         [Specify location of GNU patch on Solaris or FreeBSD.]),
1515 AC_ARG_WITH(build-platform-configure-options,
1516     AS_HELP_STRING([--with-build-platform-configure-options],
1517         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1520 AC_ARG_WITH(gnu-cp,
1521     AS_HELP_STRING([--with-gnu-cp],
1522         [Specify location of GNU cp on Solaris or FreeBSD.]),
1525 AC_ARG_WITH(external-tar,
1526     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1527         [Specify an absolute path of where to find (and store) tarfiles.]),
1528     TARFILE_LOCATION=$withval ,
1531 AC_ARG_WITH(referenced-git,
1532     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1533         [Specify another checkout directory to reference. This makes use of
1534                  git submodule update --reference, and saves a lot of diskspace
1535                  when having multiple trees side-by-side.]),
1536     GIT_REFERENCE_SRC=$withval ,
1539 AC_ARG_WITH(linked-git,
1540     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1541         [Specify a directory where the repositories of submodules are located.
1542          This uses a method similar to git-new-workdir to get submodules.]),
1543     GIT_LINK_SRC=$withval ,
1546 AC_ARG_WITH(galleries,
1547     AS_HELP_STRING([--with-galleries],
1548         [Specify how galleries should be built. It is possible either to
1549          build these internally from source ("build"),
1550          or to disable them ("no")]),
1553 AC_ARG_WITH(theme,
1554     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1555         [Choose which themes to include. By default those themes with an '*' are included.
1556          Possible choices: *breeze, crystal, *galaxy, *hicontrast, human, industrial, *oxygen, *sifr, *tango, *tango_testing.]),
1559 AC_ARG_WITH(helppack-integration,
1561   --without-helppack-integration      It will not integrate the helppacks to the installer
1562                           of the product.
1563                           Please use this switch to use the online help or separate help packages.],
1566 AC_ARG_WITH(fonts,
1567     AS_HELP_STRING([--without-fonts],
1568         [LibreOffice includes some third-party fonts to provide a reliable basis for
1569          help content, templates, samples, etc. When these fonts are already
1570          known to be available on the system then you should use this option.]),
1573 AC_ARG_WITH(epm,
1574     AS_HELP_STRING([--with-epm],
1575         [Decides which epm to use. Default is to use the one from the system if
1576          one is built. When either this is not there or you say =internal epm
1577          will be built.]),
1580 AC_ARG_WITH(package-format,
1581     AS_HELP_STRING([--with-package-format],
1582         [Specify package format(s) for LibreOffice installation sets. The
1583          implicit --without-package-format leads to no installation sets being
1584          generated. Possible values: aix, archive, bsd, deb, dmg,
1585          installed, msi, pkg, and rpm.
1586          Example: --with-package-format='deb rpm']),
1589 AC_ARG_WITH(tls,
1590     AS_HELP_STRING([--with-tls],
1591         [Decides which TLS/SSL and cryptographic implementations to use for
1592          LibreOffice's code. Notice that this doesn't apply for depending
1593          libraries like "neon", for example. Default is to use OpenSSL
1594          although NSS is also possible. Notice that selecting NSS restricts
1595          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1596          restrict by now the usage of NSS in LO's code. Possible values:
1597          openssl, nss. Example: --with-tls="nss"]),
1600 AC_ARG_WITH(system-libs,
1601     AS_HELP_STRING([--with-system-libs],
1602         [Use libraries already on system -- enables all --with-system-* flags.]),
1605 AC_ARG_WITH(system-bzip2,
1606     AS_HELP_STRING([--with-system-bzip2],
1607         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1608     [with_system_bzip2="$with_system_libs"])
1610 AC_ARG_WITH(system-headers,
1611     AS_HELP_STRING([--with-system-headers],
1612         [Use headers already on system -- enables all --with-system-* flags for
1613          external packages whose headers are the only entities used i.e.
1614          boost/vigra/odbc/sane-header(s).]),,
1615     [with_system_headers="$with_system_libs"])
1617 AC_ARG_WITH(system-jars,
1618     AS_HELP_STRING([--without-system-jars],
1619         [When building with --with-system-libs, also the needed jars are expected
1620          on the system. Use this to disable that]),,
1621     [with_system_jars="$with_system_libs"])
1623 AC_ARG_WITH(system-cairo,
1624     AS_HELP_STRING([--with-system-cairo],
1625         [Use cairo libraries already on system.  Happens automatically for
1626          (implicit) --enable-gtk and for --enable-gtk3.]))
1628 AC_ARG_WITH(myspell-dicts,
1629     AS_HELP_STRING([--with-myspell-dicts],
1630         [Adds myspell dictionaries to the LibreOffice installation set]),
1633 AC_ARG_WITH(system-dicts,
1634     AS_HELP_STRING([--without-system-dicts],
1635         [Do not use dictionaries from system paths.]),
1638 AC_ARG_WITH(external-dict-dir,
1639     AS_HELP_STRING([--with-external-dict-dir],
1640         [Specify external dictionary dir.]),
1643 AC_ARG_WITH(external-hyph-dir,
1644     AS_HELP_STRING([--with-external-hyph-dir],
1645         [Specify external hyphenation pattern dir.]),
1648 AC_ARG_WITH(external-thes-dir,
1649     AS_HELP_STRING([--with-external-thes-dir],
1650         [Specify external thesaurus dir.]),
1653 AC_ARG_WITH(system-zlib,
1654     AS_HELP_STRING([--with-system-zlib],
1655         [Use zlib already on system.]),,
1656     [with_system_zlib=auto])
1658 AC_ARG_WITH(system-jpeg,
1659     AS_HELP_STRING([--with-system-jpeg],
1660         [Use jpeg already on system.]),,
1661     [with_system_jpeg="$with_system_libs"])
1663 AC_ARG_WITH(system-libgltf,
1664     AS_HELP_STRING([--with-system-libgltf],
1665         [Use libgltf already on system.]),,
1666     [with_system_libgltf="$with_system_libs"])
1668 AC_ARG_WITH(system-clucene,
1669     AS_HELP_STRING([--with-system-clucene],
1670         [Use clucene already on system.]),,
1671     [with_system_clucene="$with_system_libs"])
1673 AC_ARG_WITH(system-expat,
1674     AS_HELP_STRING([--with-system-expat],
1675         [Use expat already on system.]),,
1676     [with_system_expat="$with_system_libs"])
1678 AC_ARG_WITH(system-libxml,
1679     AS_HELP_STRING([--with-system-libxml],
1680         [Use libxml/libxslt already on system.]),,
1681     [with_system_libxml=auto])
1683 AC_ARG_WITH(system-icu,
1684     AS_HELP_STRING([--with-system-icu],
1685         [Use icu already on system.]),,
1686     [with_system_icu="$with_system_libs"])
1688 AC_ARG_WITH(system-ucpp,
1689     AS_HELP_STRING([--with-system-ucpp],
1690         [Use ucpp already on system.]),,
1691     [])
1693 AC_ARG_WITH(system-opencollada,
1694     AS_HELP_STRING([--with-system-opencollada],
1695         [Use openCOLLADA already on system.]),,
1696     [with_system_opencollada=no])
1698 AC_ARG_WITH(system-collada2gltf,
1699     AS_HELP_STRING([--with-system-collada2gltf],
1700         [Use collada2gltf already on system.]),,
1701     [with_system_collada2gltf=no])
1703 AC_ARG_WITH(system-openldap,
1704     AS_HELP_STRING([--with-system-openldap],
1705         [Use the OpenLDAP LDAP SDK already on system.]),,
1706     [with_system_openldap="$with_system_libs"])
1708 AC_ARG_WITH(system-poppler,
1709     AS_HELP_STRING([--with-system-poppler],
1710         [Use system poppler (only needed for PDF import).]),,
1711     [with_system_poppler="$with_system_libs"])
1713 AC_ARG_WITH(system-apache-commons,
1714     AS_HELP_STRING([--with-system-apache-commons],
1715         [Use Apache commons libraries already on system.]),,
1716     [with_system_apache_commons="$with_system_jars"])
1718 AC_ARG_WITH(system-mariadb,
1719     AS_HELP_STRING([--with-system-mariadb],
1720         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1721          extension.]),,
1722     [with_system_mariadb="$with_system_libs"])
1724 AC_ARG_ENABLE(bundle-mariadb,
1725     AS_HELP_STRING([--enable-bundle-mariadb],
1726         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1729 AC_ARG_WITH(system-mysql-cppconn,
1730     AS_HELP_STRING([--with-system-mysql-cppconn],
1731         [Use MySQL C++ Connector libraries already on system.]),,
1732     [with_system_mysql_cppconn="$with_system_libs"])
1734 AC_ARG_WITH(system-postgresql,
1735     AS_HELP_STRING([--with-system-postgresql],
1736         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1737          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1738     [with_system_postgresql="$with_system_libs"])
1740 AC_ARG_WITH(libpq-path,
1741     AS_HELP_STRING([--with-libpq-path],
1742         [Use this PostgreSQL C interface (libpq) installation for building
1743          the PostgreSQL-SDBC extension.])
1744     [
1745                           Usage:     --with-libpq-path=<absolute path to
1746                                                   your libpq installation>
1747     ],
1750 AC_ARG_WITH(system-firebird,
1751     AS_HELP_STRING([--with-system-firebird],
1752         [Use Firebird libraries already on system, for building the Firebird-SDBC
1753          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1754     [with_system_firebird="$with_system_libs"])
1756 AC_ARG_WITH(system-hsqldb,
1757     AS_HELP_STRING([--with-system-hsqldb],
1758         [Use hsqldb already on system.]))
1760 AC_ARG_WITH(hsqldb-jar,
1761     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1762         [Specify path to jarfile manually.]),
1763     HSQLDB_JAR=$withval)
1765 AC_ARG_ENABLE(scripting-beanshell,
1766     AS_HELP_STRING([--disable-scripting-beanshell],
1767         [Disable support for scripts in BeanShell.]),
1771 AC_ARG_WITH(system-beanshell,
1772     AS_HELP_STRING([--with-system-beanshell],
1773         [Use beanshell already on system.]),,
1774     [with_system_beanshell="$with_system_jars"])
1776 AC_ARG_WITH(beanshell-jar,
1777     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1778         [Specify path to jarfile manually.]),
1779     BSH_JAR=$withval)
1781 AC_ARG_ENABLE(scripting-javascript,
1782     AS_HELP_STRING([--disable-scripting-javascript],
1783         [Disable support for scripts in JavaScript.]),
1787 AC_ARG_WITH(system-rhino,
1788     AS_HELP_STRING([--with-system-rhino],
1789         [Use rhino already on system.]),,)
1790 #    [with_system_rhino="$with_system_jars"])
1791 # Above is not used as we have different debug interface
1792 # patched into internal rhino. This code needs to be fixed
1793 # before we can enable it by default.
1795 AC_ARG_WITH(rhino-jar,
1796     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1797         [Specify path to jarfile manually.]),
1798     RHINO_JAR=$withval)
1800 AC_ARG_WITH(commons-codec-jar,
1801     AS_HELP_STRING([--with-commons-codec-jar=JARFILE],
1802         [Specify path to jarfile manually.]),
1803     COMMONS_CODEC_JAR=$withval)
1805 AC_ARG_WITH(commons-lang-jar,
1806     AS_HELP_STRING([--with-commons-lang-jar=JARFILE],
1807         [Specify path to jarfile manually.]),
1808     COMMONS_LANG_JAR=$withval)
1810 AC_ARG_WITH(commons-httpclient-jar,
1811     AS_HELP_STRING([--with-commons-httpclient-jar=JARFILE],
1812         [Specify path to jarfile manually.]),
1813     COMMONS_HTTPCLIENT_JAR=$withval)
1815 AC_ARG_WITH(commons-logging-jar,
1816     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1817         [Specify path to jarfile manually.]),
1818     COMMONS_LOGGING_JAR=$withval)
1820 AC_ARG_WITH(system-jfreereport,
1821     AS_HELP_STRING([--with-system-jfreereport],
1822         [Use JFreeReport already on system.]),,
1823     [with_system_jfreereport="$with_system_jars"])
1825 AC_ARG_WITH(sac-jar,
1826     AS_HELP_STRING([--with-sac-jar=JARFILE],
1827         [Specify path to jarfile manually.]),
1828     SAC_JAR=$withval)
1830 AC_ARG_WITH(libxml-jar,
1831     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1832         [Specify path to jarfile manually.]),
1833     LIBXML_JAR=$withval)
1835 AC_ARG_WITH(flute-jar,
1836     AS_HELP_STRING([--with-flute-jar=JARFILE],
1837         [Specify path to jarfile manually.]),
1838     FLUTE_JAR=$withval)
1840 AC_ARG_WITH(jfreereport-jar,
1841     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1842         [Specify path to jarfile manually.]),
1843     JFREEREPORT_JAR=$withval)
1845 AC_ARG_WITH(liblayout-jar,
1846     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1847         [Specify path to jarfile manually.]),
1848     LIBLAYOUT_JAR=$withval)
1850 AC_ARG_WITH(libloader-jar,
1851     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1852         [Specify path to jarfile manually.]),
1853     LIBLOADER_JAR=$withval)
1855 AC_ARG_WITH(libloader-jar,
1856     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1857         [Specify path to jarfile manually.]),
1858     LIBLOADER_JAR=$withval)
1860 AC_ARG_WITH(libformula-jar,
1861     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1862         [Specify path to jarfile manually.]),
1863     LIBFORMULA_JAR=$withval)
1865 AC_ARG_WITH(librepository-jar,
1866     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1867         [Specify path to jarfile manually.]),
1868     LIBREPOSITORY_JAR=$withval)
1870 AC_ARG_WITH(libfonts-jar,
1871     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1872         [Specify path to jarfile manually.]),
1873     LIBFONTS_JAR=$withval)
1875 AC_ARG_WITH(libserializer-jar,
1876     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1877         [Specify path to jarfile manually.]),
1878     LIBSERIALIZER_JAR=$withval)
1880 AC_ARG_WITH(libbase-jar,
1881     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1882         [Specify path to jarfile manually.]),
1883     LIBBASE_JAR=$withval)
1885 AC_ARG_WITH(system-odbc,
1886     AS_HELP_STRING([--with-system-odbc],
1887         [Use the odbc headers already on system.]),,
1888     [with_system_odbc="auto"])
1890 AC_ARG_WITH(system-sane,
1891     AS_HELP_STRING([--with-system-sane],
1892         [Use sane.h already on system.]),,
1893     [with_system_sane="$with_system_headers"])
1895 AC_ARG_WITH(system-bluez,
1896     AS_HELP_STRING([--with-system-bluez],
1897         [Use bluetooth.h already on system.]),,
1898     [with_system_bluez="$with_system_headers"])
1900 AC_ARG_WITH(system-curl,
1901     AS_HELP_STRING([--with-system-curl],
1902         [Use curl already on system.]),,
1903     [with_system_curl=auto])
1905 AC_ARG_WITH(system-boost,
1906     AS_HELP_STRING([--with-system-boost],
1907         [Use boost already on system.]),,
1908     [with_system_boost="$with_system_headers"])
1910 AC_ARG_WITH(system-glm,
1911     AS_HELP_STRING([--with-system-glm],
1912         [Use glm already on system.]),,
1913     [with_system_glm="$with_system_headers"])
1915 AC_ARG_WITH(system-vigra,
1916     AS_HELP_STRING([--with-system-vigra],
1917         [Use vigra already on system.]),,
1918     [with_system_vigra="$with_system_headers"])
1920 AC_ARG_WITH(system-hunspell,
1921     AS_HELP_STRING([--with-system-hunspell],
1922         [Use libhunspell already on system.]),,
1923     [with_system_hunspell="$with_system_libs"])
1925 AC_ARG_WITH(system-mythes,
1926     AS_HELP_STRING([--with-system-mythes],
1927         [Use mythes already on system.]),,
1928     [with_system_mythes="$with_system_libs"])
1930 AC_ARG_WITH(system-altlinuxhyph,
1931     AS_HELP_STRING([--with-system-altlinuxhyph],
1932         [Use ALTLinuxhyph already on system.]),,
1933     [with_system_altlinuxhyph="$with_system_libs"])
1935 AC_ARG_WITH(system-lpsolve,
1936     AS_HELP_STRING([--with-system-lpsolve],
1937         [Use lpsolve already on system.]),,
1938     [with_system_lpsolve="$with_system_libs"])
1940 AC_ARG_WITH(system-coinmp,
1941     AS_HELP_STRING([--with-system-coinmp],
1942         [Use CoinMP already on system.]),,
1943     [with_system_coinmp="$with_system_libs"])
1945 AC_ARG_WITH(system-liblangtag,
1946     AS_HELP_STRING([--with-system-liblangtag],
1947         [Use liblangtag library already on system.]),,
1948     [with_system_liblangtag="$with_system_libs"])
1950 AC_ARG_WITH(system-npapi-headers,
1951     AS_HELP_STRING([--with-system-npapi-headers],
1952         [Use NPAPI headers provided by system instead of bundled ones. Used in
1953          extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),,
1954     [with_system_npapi_headers="$with_system_headers"]
1957 AC_ARG_WITH(jpeg-turbo,
1958     AS_HELP_STRING([--with-jpeg-turbo],
1959         [Use internal libjpeg-turbo library.]),,
1960     [with_jpeg_turbo=auto])
1962 AC_ARG_WITH(webdav,
1963     AS_HELP_STRING([--with-webdav],
1964         [Specify which library to use for webdav implementation.
1965          Possible values: "neon", "serf", "no". The default value is "neon".
1966          Example: --with-webdav="serf"]),
1967     WITH_WEBDAV=$withval,
1968     WITH_WEBDAV="neon")
1970 AC_ARG_WITH(linker-hash-style,
1971     AS_HELP_STRING([--with-linker-hash-style],
1972         [Use linker with --hash-style=<style> when linking shared objects.
1973          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1974          if supported on the build system, and "sysv" otherwise.]))
1976 AC_ARG_WITH(jdk-home,
1977     AS_HELP_STRING([--with-jdk-home],
1978         [If you have installed JDK 1.3 or later on your system please supply the
1979          path here. Note that this is not the location of the java command but the
1980          location of the entire distribution.])
1981     [
1982                           Usage:     --with-jdk-home=<absolute path to JDK home>
1983     ],
1986 AC_ARG_WITH(help,
1987     AS_HELP_STRING([--with-help],
1988         [Enable the build of help. There is a special parameter "common" that
1989          can be used to bundle only the common part, .e.g help-specific icons.
1990          This is useful when you build the helpcontent separately.])
1991     [
1992                           Usage:     --with-help    build the entire local help
1993                                  --without-help     no local help (default)
1994                                  --with-help=common bundle common files for the local
1995                                                     help but do not build the whole help
1996     ],
1999 AC_ARG_WITH(java,
2000     AS_HELP_STRING([--with-java],
2001         [Specify the name of the Java interpreter command. Typically "java"
2002          which is the default.
2004          To build without support for Java components, applets, accessibility
2005          or the XML filters written in Java, use --without-java or --with-java=no.])
2006     [
2007                           Usage:     --with-java==<java command>
2008                                      --without-java
2009     ],
2010     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2011     [ with_java=java ]
2014 AC_ARG_WITH(jvm-path,
2015     AS_HELP_STRING([--with-jvm-path],
2016         [Use a specific JVM search path at runtime.])
2017     [
2018                           Usage:     --with-jvm-path=<absolute path to parent of jvm home>
2020                           e. g.: --with-jvm-path=/usr/lib/
2021                                  to find JRE/JDK in /usr/lib/jvm/
2022     ],
2025 AC_ARG_WITH(ant-home,
2026     AS_HELP_STRING([--with-ant-home],
2027         [If you have installed Jakarta Ant on your system, please supply the path here.
2028          Note that this is not the location of the Ant binary but the location
2029          of the entire distribution.])
2030     [
2031                           Usage:     --with-ant-home=<absolute path to Ant home>
2032     ],
2035 AC_ARG_WITH(export-validation,
2036     AS_HELP_STRING([--with-export-validation],
2037         [If you want the exported files to be validated. Right now limited to OOXML files in calc export tests.
2038          Note: You need an executable script officeotron that takes the path to the file.])
2039     [
2040                             Usage: --with-export-validation
2041     ],
2044 AC_ARG_WITH(junit,
2045     AS_HELP_STRING([--with-junit],
2046         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2047          --without-junit disables those tests. Not relevant in the --without-java case.])
2048     [
2049                           Usage:     --with-junit=<absolute path to JUnit 4 jar>
2050     ],
2051 ,with_junit=yes)
2053 AC_ARG_WITH(hamcrest,
2054     AS_HELP_STRING([--with-hamcrest],
2055         [Specifies the hamcrest jar file to use for JUnit-based tests.
2056          --without-junit disables those tests. Not relevant in the --without-java case.])
2057     [
2058                           Usage:     --with-hamcrest=<absolute path to hamcrest jar>
2059     ],
2060 ,with_hamcrest=yes)
2062 AC_ARG_WITH(perl-home,
2063     AS_HELP_STRING([--with-perl-home],
2064         [If you have installed Perl 5 Distribution, on your system, please
2065          supply the path here. Note that this is not the location of the Perl
2066          binary but the location of the entire distribution.])
2067     [
2068                           Usage:     --with-perl-home=<abs. path to Perl 5 home>
2069     ],
2072 AC_ARG_WITH(
2073     [doxygen],
2074     AS_HELP_STRING(
2075         [--with-doxygen],
2076         [Specifies the doxygen executable to use when generating ODK C/C++
2077          documentation. --without-doxygen disables generation of ODK C/C++
2078          documentation. Not relevant in the --disable-odk case.])
2079     [
2080                           Usage:     --with-doxygen=<absolute path to doxygen executable>
2081     ],,
2082     [with_doxygen=yes])
2084 AC_ARG_WITH(visual-studio,
2085     AS_HELP_STRING([--with-visual-studio=<2013/2015>],
2086         [Specify which Visual Studio version to use in case several are
2087          installed. If not specified, only 2013 is detected automatically
2088          because 2015 support is currently experimental.])
2089     [
2090                           Usage:     --with-visual-studio=<2013/2015>
2091     ],
2094 AC_ARG_WITH(windows-sdk,
2095     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2096         [Specify which Windows SDK, or "Windows Kit", version to use
2097          in case the one that came with the selected Visual Studio
2098          is not what you want for some reason. Note that not all compiler/SDK
2099          combinations are supported. The intent is that this option should not
2100          be needed.])
2101     [
2102                           Usage:     --with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>
2103     ],
2106 AC_ARG_WITH(lang,
2107     AS_HELP_STRING([--with-lang],
2108         [Use this option to build LibreOffice with additional UI language support.
2109          English (US) is always included by default.
2110          Separate multiple languages with space.
2111          For all languages, use --with-lang=ALL.])
2112     [
2113                           Usage:     --with-lang="es sw tu cs sk"
2114     ],
2117 AC_ARG_WITH(locales,
2118     AS_HELP_STRING([--with-locales],
2119         [Use this option to limit the locale information built in.
2120          Separate multiple locales with space.
2121          Very experimental and might well break stuff.
2122          Just a desperate measure to shrink code and data size.
2123          By default all the locales available is included.
2124          This option is completely unrelated to --with-lang.])
2125     [
2126                           Affects also our character encoding conversion
2127                           tables for encodings mainly targeted for a
2128                           particular locale, like EUC-CN and EUC-TW for
2129                           zh, ISO-2022-JP for ja.
2131                           Affects also our add-on break iterator data for
2132                           some languages.
2134                           For the default, all locales, don't use this switch at all.
2135                           Specifying just the language part of a locale means all matching
2136                           locales will be included.
2138                           Usage:     --with-locales="en es pt fr zh kr ja"
2139     ],
2142 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2143 AC_ARG_WITH(krb5,
2144     AS_HELP_STRING([--with-krb5],
2145         [Enable MIT Kerberos 5 support in modules that support it.
2146          By default automatically enabled on platforms
2147          where a good system Kerberos 5 is available.]),
2150 AC_ARG_WITH(gssapi,
2151     AS_HELP_STRING([--with-gssapi],
2152         [Enable GSSAPI support in modules that support it.
2153          By default automatically enabled on platforms
2154          where a good system GSSAPI is available.]),
2157 AC_ARG_WITH(iwyu,
2158     AS_HELP_STRING([--with-iwyu],
2159         [Use given IWYU binary path to check unneeded includes instead of building.
2160          Use only if you are hacking on it.]),
2163 dnl ===================================================================
2164 dnl Branding
2165 dnl ===================================================================
2167 AC_ARG_WITH(branding,
2168     AS_HELP_STRING([--with-branding],
2169         [Use given path to retrieve branding images set.])
2170     [
2171                           Search for intro.png about.svg and flat_logo.svg.
2172                           If any is missing, default ones will be used instead.
2174                           Search also progress.conf for progress
2175                           settings on intro screen :
2177                           PROGRESSBARCOLOR="255,255,255" Set color of
2178                           progress bar. Comma separated RGB decimal values.
2179                           PROGRESSSIZE="407,6" Set size of progress bar.
2180                           Comma separated decimal values (width, height).
2181                           PROGRESSPOSITION="61,317" Set position of progress
2182                           bar from left,top. Comma separated decimal values.
2183                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2184                           bar frame. Comma separated RGB decimal values.
2185                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2186                           bar text. Comma separated RGB decimal values.
2187                           PROGRESSTEXTBASELINE="287" Set vertical position of
2188                           progress bar text from top. Decimal value.
2190                           Default values will be used if not found.
2192                           Usage:     --with-branding=/path/to/images
2193     ],
2197 AC_ARG_WITH(extra-buildid,
2198     AS_HELP_STRING([--with-extra-buildid],
2199         [Show addition build identification in about dialog.])
2200     [
2201                           Usage:     --with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"
2202     ],
2206 AC_ARG_WITH(vendor,
2207     AS_HELP_STRING([--with-vendor],
2208         [Set vendor of the build.])
2209     [
2210                           Usage:     --with-vendor="John the Builder"
2211     ],
2214 AC_ARG_WITH(android-package-name,
2215     AS_HELP_STRING([--with-android-package-name],
2216         [Set Android package name of the build.])
2217     [
2218                           Usage:     --with-android-package-name="org.libreoffice"
2219     ],
2222 AC_ARG_WITH(compat-oowrappers,
2223     AS_HELP_STRING([--with-compat-oowrappers],
2224         [Install oo* wrappers in parallel with
2225          lo* ones to keep backward compatibility.
2226          Has effect only with make distro-pack-install]),
2229 AC_ARG_WITH(os-version,
2230     AS_HELP_STRING([--with-os-version],
2231         [For FreeBSD users, use this option option to override the detected OSVERSION.])
2232     [
2233                           Usage:     --with-os-version=<OSVERSION>
2234     ],
2237 AC_ARG_WITH(mingw-cross-compiler,
2238     AS_HELP_STRING([--with-mingw-cross-compiler],
2239         [Specify the MinGW cross-compiler to use.])
2240     [
2241                           Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
2243                           When building on the ODK on Unix and building unowinreg.dll,
2244                           specify the MinGW C++ cross-compiler.
2245     ],
2248 AC_ARG_WITH(idlc-cpp,
2249     AS_HELP_STRING([--with-idlc-cpp],
2250         [Specify the C Preprocessor to use for idlc.])
2251     [
2252                           Usage:     --with-idlc-cpp=cpp
2254                           Default is ucpp.
2255     ]
2258 AC_ARG_WITH(build-version,
2259     AS_HELP_STRING([--with-build-version],
2260         [Allows the builder to add a custom version tag that will appear in the
2261          Help/About box for QA purposes.])
2262     [
2263                           Usage:     --with-build-version="Built by Jim"
2264     ],
2265     with_build_version=$withval ,
2268 AC_ARG_WITH(alloc,
2269     AS_HELP_STRING([--with-alloc],
2270         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2271          Note that on FreeBSD/NetBSD system==jemalloc]),
2274 AC_ARG_WITH(sun-templates,
2275     AS_HELP_STRING([--with-sun-templates],
2276         [Integrate Sun template packages.]),
2279 AC_ARG_WITH(parallelism,
2280     AS_HELP_STRING([--with-parallelism],
2281         [Number of jobs to run simultaneously during build. Parallel builds can
2282         save a lot of time on multi-cpu machines. Defaults to the number of
2283         CPUs on the machine, unless you configure --enable-icecream - then to
2284         10.]),
2287 AC_ARG_WITH(all-tarballs,
2288     AS_HELP_STRING([--with-all-tarballs],
2289         [Download all external tarballs unconditionally]))
2291 AC_ARG_WITH(gdrive-client-id,
2292     AS_HELP_STRING([--with-gdrive-client-id],
2293         [Provides the client id of the application for OAuth2 authentication
2294         on Google Drive. If either this or --with-gdrive-client-secret is
2295         empty, the feature will be disabled]),
2298 AC_ARG_WITH(gdrive-client-secret,
2299     AS_HELP_STRING([--with-gdrive-client-secret],
2300         [Provides the client secret of the application for OAuth2
2301         authentication on Google Drive. If either this or
2302         --with-gdrive-client-id is empty, the feature will be disabled]),
2305 AC_ARG_WITH(alfresco-cloud-client-id,
2306     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2307         [Provides the client id of the application for OAuth2 authentication
2308         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2309         empty, the feature will be disabled]),
2312 AC_ARG_WITH(alfresco-cloud-client-secret,
2313     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2314         [Provides the client secret of the application for OAuth2
2315         authentication on Alfresco Cloud. If either this or
2316         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2319 AC_ARG_WITH(onedrive-client-id,
2320     AS_HELP_STRING([--with-onedrive-client-id],
2321         [Provides the client id of the application for OAuth2 authentication
2322         on OneDrive. If either this or --with-onedrive-client-secret is
2323         empty, the feature will be disabled]),
2326 AC_ARG_WITH(onedrive-client-secret,
2327     AS_HELP_STRING([--with-onedrive-client-secret],
2328         [Provides the client secret of the application for OAuth2
2329         authentication on OneDrive. If either this or
2330         --with-onedrive-client-id is empty, the feature will be disabled]),
2332 dnl ===================================================================
2333 dnl Do we want to use pre-build binary tarball for recompile
2334 dnl ===================================================================
2336 if test "$enable_library_bin_tar" = "yes" ; then
2337     USE_LIBRARY_BIN_TAR=TRUE
2338 else
2339     USE_LIBRARY_BIN_TAR=
2341 AC_SUBST(USE_LIBRARY_BIN_TAR)
2343 dnl ===================================================================
2344 dnl Test whether build target is Release Build
2345 dnl ===================================================================
2346 AC_MSG_CHECKING([whether build target is Release Build])
2347 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2348     AC_MSG_RESULT([no])
2349     ENABLE_RELEASE_BUILD=
2350 else
2351     AC_MSG_RESULT([yes])
2352     ENABLE_RELEASE_BUILD=TRUE
2354 AC_SUBST(ENABLE_RELEASE_BUILD)
2356 dnl ===================================================================
2357 dnl Test whether to sign Windows Build
2358 dnl ===================================================================
2359 AC_MSG_CHECKING([whether to sign windows build])
2360 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2361     AC_MSG_RESULT([yes])
2362     WINDOWS_BUILD_SIGNING="TRUE"
2363 else
2364     AC_MSG_RESULT([no])
2365     WINDOWS_BUILD_SIGNING="FALSE"
2367 AC_SUBST(WINDOWS_BUILD_SIGNING)
2369 dnl ===================================================================
2370 dnl MacOSX build and runtime environment options
2371 dnl ===================================================================
2373 AC_ARG_WITH(macosx-sdk,
2374     AS_HELP_STRING([--with-macosx-sdk],
2375         [Use a specific SDK for building.])
2376     [
2377                           Usage:     --with-macosx-sdk=<version>
2379                           e. g.: --with-macosx-sdk=10.8
2381                           there are 3 options to control the MacOSX build:
2382                           --with-macosx-sdk (referred as 'sdk' below)
2383                           --with-macosx-version-min-required (referred as 'min' below)
2384                           --with-macosx-version-max-allowed (referred as 'max' below)
2386                           the connection between these value and the default they take is as follow:
2387                           ( ? means not specified on the command line, s means the SDK version found,
2388                           constraint: 8 <= x <= y <= z)
2390                           ==========================================
2391                            command line      || config result
2392                           ==========================================
2393                           min  | max  | sdk  || min  | max  | sdk  |
2394                           ?    | ?    | ?    || 10.8 | 10.s | 10.s |
2395                           ?    | ?    | 10.x || 10.8 | 10.x | 10.x |
2396                           ?    | 10.x | ?    || 10.8 | 10.s | 10.s |
2397                           ?    | 10.x | 10.y || 10.8 | 10.x | 10.y |
2398                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2399                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2400                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2401                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2404                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2405                           for a detailed technical explanation of these variables
2407                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2408     ],
2411 AC_ARG_WITH(macosx-version-min-required,
2412     AS_HELP_STRING([--with-macosx-version-min-required],
2413         [set the minimum OS version needed to run the built LibreOffice])
2414     [
2415                           Usage:     --with-macosx-version-min-required=<version>
2417                           e. g.: --with-macos-version-min-required=10.8
2418                           see --with-macosx-sdk for more info
2419     ],
2422 AC_ARG_WITH(macosx-version-max-allowed,
2423     AS_HELP_STRING([--with-macosx-version-max-allowed],
2424         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2425     [
2426                           Usage:     --with-macosx-version-max-allowed=<version>
2428                           e. g.: --with-macos-version-max-allowed=10.8
2429                           see --with-macosx-sdk for more info
2430     ],
2434 dnl ===================================================================
2435 dnl options for stuff used during cross-compilation build
2436 dnl Not quite superseded by --with-build-platform-configure-options.
2437 dnl TODO: check, if the "force" option is still needed anywhere.
2438 dnl ===================================================================
2440 AC_ARG_WITH(system-icu-for-build,
2441     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2442         [Use icu already on system for build tools (cross-compilation only).]))
2445 dnl ===================================================================
2446 dnl check for required programs (grep, awk, sed, bash)
2447 dnl ===================================================================
2449 pathmunge ()
2451     if test -n "$1"; then
2452         if test "$build_os" = "cygwin"; then
2453             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2454                 PathFormat "$1"
2455                 new_path=`cygpath -sm "$formatted_path"`
2456             else
2457                 PathFormat "$1"
2458                 new_path=`cygpath -u "$formatted_path"`
2459             fi
2460         else
2461             new_path="$1"
2462         fi
2463         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2464             if test "$2" = "after"; then
2465                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2466             else
2467                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2468             fi
2469         fi
2470         unset new_path
2471     fi
2474 AC_PROG_AWK
2475 AC_PATH_PROG( AWK, $AWK)
2476 if test -z "$AWK"; then
2477     AC_MSG_ERROR([install awk to run this script])
2480 AC_PATH_PROG(BASH, bash)
2481 if test -z "$BASH"; then
2482     AC_MSG_ERROR([bash not found in \$PATH])
2484 AC_SUBST(BASH)
2486 AC_MSG_CHECKING([for GNU or BSD tar])
2487 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2488     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2489     if test $? -eq 0;  then
2490         GNUTAR=$a
2491         break
2492     fi
2493 done
2494 AC_MSG_RESULT($GNUTAR)
2495 if test -z "$GNUTAR"; then
2496     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2498 AC_SUBST(GNUTAR)
2500 AC_MSG_CHECKING([for tar's option to strip components])
2501 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2502 if test $? -eq 0; then
2503     STRIP_COMPONENTS="--strip-components"
2504 else
2505     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2506     if test $? -eq 0; then
2507         STRIP_COMPONENTS="--strip-path"
2508     else
2509         STRIP_COMPONENTS="unsupported"
2510     fi
2512 AC_MSG_RESULT($STRIP_COMPONENTS)
2513 if test x$STRIP_COMPONENTS = xunsupported; then
2514     AC_MSG_ERROR([you need a tar that is able to strip components.])
2516 AC_SUBST(STRIP_COMPONENTS)
2518 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2519 dnl desktop OSes from "mobile" ones.
2521 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2522 dnl In other words, that when building for an OS that is not a
2523 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2525 dnl Note the direction of the implication; there is no assumption that
2526 dnl cross-compiling would imply a non-desktop OS.
2528 if test $_os != iOS -a $_os != Android; then
2529     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2530     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2531     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2534 DISABLE_EXPORT=''
2535 if test "$enable_export" != no; then
2536     BUILD_TYPE="$BUILD_TYPE EXPORT"
2537 else
2538     DISABLE_EXPORT='TRUE'
2539     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2541 AC_SUBST(DISABLE_EXPORT)
2543 # Whether to build "avmedia" functionality or not.
2545 if test -z "$enable_avmedia"; then
2546     enable_avmedia=yes
2549 if test "$enable_avmedia" = yes; then
2550     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2551     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2552 else
2553     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2556 # Decide whether to build database connectivity stuff (including
2557 # Base) or not. We probably don't want to on non-desktop OSes.
2559 if test -z "$enable_database_connectivity"; then
2560     # --disable-database-connectivity is unfinished work in progress
2561     # and the iOS test app doesn't link if we actually try to use it.
2562     # if test $_os != iOS -a $_os != Android; then
2563         enable_database_connectivity=yes
2564     # fi
2567 if test "$enable_database_connectivity" = yes; then
2568     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2569     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2572 if test -z "$enable_extensions"; then
2573     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2574     if test $_os != iOS -a $_os != Android; then
2575         enable_extensions=yes
2576     fi
2579 if test "$enable_extensions" = yes; then
2580     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2581     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2584 if test -z "$enable_scripting"; then
2585     # Disable scripting for iOS unless specifically overridden
2586     # with --enable-scripting.
2587     if test $_os != iOS; then
2588         enable_scripting=yes
2589     fi
2592 DISABLE_SCRIPTING=''
2593 if test "$enable_scripting" = yes; then
2594     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2595     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2596 else
2597     DISABLE_SCRIPTING='TRUE'
2598     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2601 if test $_os = iOS -o $_os = Android; then
2602     # Disable dynamic_loading always for iOS and Android
2603     enable_dynamic_loading=no
2604 elif test -z "$enable_dynamic_loading"; then
2605     # Otherwise enable it unless speficically disabled
2606     enable_dynamic_loading=yes
2609 DISABLE_DYNLOADING=''
2610 if test "$enable_dynamic_loading" = yes; then
2611     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2612 else
2613     DISABLE_DYNLOADING='TRUE'
2614     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2616 AC_SUBST(DISABLE_DYNLOADING)
2618 # remenber SYSBASE value
2619 AC_SUBST(SYSBASE)
2621 dnl ===================================================================
2622 dnl  Sort out various gallery compilation options
2623 dnl ===================================================================
2624 AC_MSG_CHECKING([how to build and package galleries])
2625 if test -n "${with_galleries}"; then
2626     if test "$with_galleries" = "build"; then
2627         WITH_GALLERY_BUILD=TRUE
2628         AC_MSG_RESULT([build from source images internally])
2629     elif test "$with_galleries" = "no"; then
2630         WITH_GALLERY_BUILD=
2631         AC_MSG_RESULT([disable non-internal gallery build])
2632     else
2633         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2634     fi
2635 else
2636     if test $_os != iOS -a $_os != Android; then
2637         WITH_GALLERY_BUILD=TRUE
2638         AC_MSG_RESULT([internal src images for desktop])
2639     else
2640         WITH_GALLERY_BUILD=
2641         AC_MSG_RESULT([disable src imgage build])
2642     fi
2644 AC_SUBST(WITH_GALLERY_BUILD)
2646 dnl ===================================================================
2647 dnl  Checks if ccache is available
2648 dnl ===================================================================
2649 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
2650     # on windows/VC build do not use ccache
2651     CCACHE=""
2652 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2653     case "%$CC%$CXX%" in
2654     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2655     # assume that's good then
2656     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2657         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2658         ;;
2659     *)
2660         AC_PATH_PROG([CCACHE],[ccache],[not found])
2661         if test "$CCACHE" = "not found"; then
2662             CCACHE=""
2663         else
2664             # Need to check for ccache version: otherwise prevents
2665             # caching of the results (like "-x objective-c++" for Mac)
2666             if test $_os = Darwin -o $_os = iOS; then
2667                 # Check ccache version
2668                 AC_MSG_CHECKING([whether version of ccache is suitable])
2669                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2670                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2671                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2672                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2673                 else
2674                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2675                     CCACHE=""
2676                 fi
2677             fi
2678         fi
2679         ;;
2680     esac
2681 else
2682     CCACHE=""
2685 if test "$CCACHE" != ""; then
2686     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2687     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2688     if test "$ccache_size" = ""; then
2689         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2690         if test "$ccache_size" = ""; then
2691             ccache_size=0
2692         fi
2693         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2694         if test $ccache_size -lt 1024; then
2695             CCACHE=""
2696             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2697             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2698         else
2699             # warn that ccache may be too small for debug build
2700             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2701             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2702         fi
2703     else
2704         if test $ccache_size -lt 5; then
2705             #warn that ccache may be too small for debug build
2706             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2707             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2708         fi
2709     fi
2712 dnl ===================================================================
2713 dnl  Checks for C compiler,
2714 dnl  The check for the C++ compiler is later on.
2715 dnl ===================================================================
2716 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2717     GCC_HOME_SET="true"
2718     AC_MSG_CHECKING([gcc home])
2719     if test -z "$with_gcc_home"; then
2720         if test "$enable_icecream" = "yes"; then
2721             if test -d "/usr/lib/icecc/bin"; then
2722                 GCC_HOME="/usr/lib/icecc/"
2723             else
2724                 GCC_HOME="/opt/icecream/"
2725             fi
2726         else
2727             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2728             GCC_HOME_SET="false"
2729         fi
2730     else
2731         GCC_HOME="$with_gcc_home"
2732     fi
2733     AC_MSG_RESULT($GCC_HOME)
2734     AC_SUBST(GCC_HOME)
2736     if test "$GCC_HOME_SET" = "true"; then
2737         if test -z "$CC"; then
2738             CC="$GCC_HOME/bin/gcc"
2739         fi
2740         if test -z "$CXX"; then
2741             CXX="$GCC_HOME/bin/g++"
2742         fi
2743     fi
2746 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
2747 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
2748     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
2749     save_CFLAGS=$CFLAGS
2750     AC_PROG_CC
2751     CFLAGS=$save_CFLAGS
2754 COMPATH=`dirname "$CC"`
2755 if test "$COMPATH" = "."; then
2756     AC_PATH_PROGS(COMPATH, $CC)
2757     dnl double square bracket to get single because of M4 quote...
2758     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2760 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2762 dnl ===================================================================
2763 dnl Java support
2764 dnl ===================================================================
2765 AC_MSG_CHECKING([whether to build with Java support])
2766 if test "$with_java" != "no"; then
2767     if test "$DISABLE_SCRIPTING" = TRUE; then
2768         AC_MSG_RESULT([no, overridden by --disable-scripting])
2769         ENABLE_JAVA=""
2770         with_java=no
2771     else
2772         AC_MSG_RESULT([yes])
2773         ENABLE_JAVA="TRUE"
2774         AC_DEFINE(HAVE_FEATURE_JAVA)
2775     fi
2776 else
2777     AC_MSG_RESULT([no])
2778     ENABLE_JAVA=""
2781 AC_SUBST(ENABLE_JAVA)
2783 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2785 dnl ENABLE_JAVA="" indicate no Java support at all
2787 dnl ===================================================================
2788 dnl Export file validation
2789 dnl ===================================================================
2790 AC_MSG_CHECKING([whether to enable export file validation])
2791 if test "$with_export_validation" = yes; then
2792     AC_MSG_RESULT([yes])
2793     AC_DEFINE(HAVE_EXPORT_VALIDATION)
2795     AC_CHECK_PROGS(ODFVALIDATOR, odfvalidator)
2796     if test -z "$ODFVALIDATOR"; then
2797         AC_MSG_ERROR([odfvalidator not found, but required by --with-export-validation])
2798     fi
2799     AC_SUBST(ODFVALIDATOR)
2800     AC_CHECK_PROGS(OFFICEOTRON, officeotron)
2801     if test -z "$OFFICEOTRON"; then
2802         AC_MSG_ERROR([officeotron not found, but required by --with-export-validation])
2803     fi
2804     AC_SUBST(OFFICEOTRON)
2805 else
2806     AC_MSG_RESULT([no])
2810 dnl ===================================================================
2811 dnl Check OS X SDK and compiler
2812 dnl ===================================================================
2814 if test $_os = Darwin; then
2816     # If no --with-macosx-sdk option is given, look for one
2818     # The intent is that for "most" Mac-based developers, a suitable
2819     # SDK will be found automatically without any configure options.
2821     # For developers with a current Xcode, the lowest-numbered SDK
2822     # higher than or equal to the minimum required should be found.
2824     AC_MSG_CHECKING([what Mac OS X SDK to use])
2826     for _macosx_sdk in $with_macosx_sdk 10.8 10.9 10.10 10.11; do
2827         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2828         if test -d "$MACOSX_SDK_PATH"; then
2829             with_macosx_sdk="${_macosx_sdk}"
2830             break
2831         else
2832             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2833             if test -d "$MACOSX_SDK_PATH"; then
2834                 with_macosx_sdk="${_macosx_sdk}"
2835                 break
2836             fi
2837         fi
2838     done
2839     if test ! -d "$MACOSX_SDK_PATH"; then
2840         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2841     fi
2842     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2844     case $with_macosx_sdk in
2845     10.8)
2846         MACOSX_SDK_VERSION=1080
2847         ;;
2848     10.9)
2849         MACOSX_SDK_VERSION=1090
2850         ;;
2851     10.10)
2852         MACOSX_SDK_VERSION=101000
2853         ;;
2854     10.11)
2855         MACOSX_SDK_VERSION=101100
2856         ;;
2857     *)
2858         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.8--11])
2859         ;;
2860     esac
2862     if test "$with_macosx_version_min_required" = "" ; then
2863         with_macosx_version_min_required="10.8";
2864     fi
2866     if test "$with_macosx_version_max_allowed" = "" ; then
2867         with_macosx_version_max_allowed="$with_macosx_sdk"
2868     fi
2870     # export this so that "xcrun" invocations later return matching values
2871     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2872     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2873     export DEVELOPER_DIR
2874     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2875     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2877     case "$with_macosx_version_min_required" in
2878     10.8)
2879         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2880         ;;
2881     10.9)
2882         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2883         ;;
2884     10.10)
2885         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2886         ;;
2887     10.11)
2888         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2889         ;;
2890     *)
2891         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.8--11])
2892         ;;
2893     esac
2895     LIBTOOL=libtool
2896     INSTALL_NAME_TOOL=install_name_tool
2897     if test -z "$save_CC"; then
2898         AC_MSG_CHECKING([what compiler to use])
2899         stdlib=-stdlib=libc++
2900         if test "$ENABLE_LTO" = TRUE; then
2901             lto=-flto
2902         fi
2903         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2904         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2905         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2906         AR=`xcrun -find ar`
2907         NM=`xcrun -find nm`
2908         STRIP=`xcrun -find strip`
2909         LIBTOOL=`xcrun -find libtool`
2910         RANLIB=`xcrun -find ranlib`
2911         AC_MSG_RESULT([$CC and $CXX])
2912     fi
2914     case "$with_macosx_version_max_allowed" in
2915     10.8)
2916         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2917         ;;
2918     10.9)
2919         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2920         ;;
2921     10.10)
2922         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2923         ;;
2924     10.11)
2925         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2926         ;;
2927     *)
2928         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.8--11])
2929         ;;
2930     esac
2932     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2933     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2934         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2935     else
2936         AC_MSG_RESULT([ok])
2937     fi
2939     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2940     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2941         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2942     else
2943         AC_MSG_RESULT([ok])
2944     fi
2945     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2946     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2948     AC_MSG_CHECKING([whether to do code signing])
2950     if test "$enable_macosx_code_signing" = yes; then
2951         # By default use the first suitable certificate (?).
2953         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2954         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2955         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2956         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2957         # "Developer ID Application" one.
2959         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2960         if test -n "$identity"; then
2961             MACOSX_CODESIGNING_IDENTITY=$identity
2962             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2963             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2964         else
2965             AC_MSG_ERROR([cannot determine identity to use])
2966         fi
2967     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2968         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2969         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2970         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2971     else
2972         AC_MSG_RESULT([no])
2973     fi
2975     AC_MSG_CHECKING([whether to create a Mac App Store package])
2977     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2978         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2979     elif test "$enable_macosx_package_signing" = yes; then
2980         # By default use the first suitable certificate.
2981         # It should be a "3rd Party Mac Developer Installer" one
2983         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2984         if test -n "$identity"; then
2985             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2986             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2987             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2988         else
2989             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2990         fi
2991     elif test -n "$enable_macosx_package_signing"; then
2992         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2993         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2994         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2995     else
2996         AC_MSG_RESULT([no])
2997     fi
2999     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3000         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3001     fi
3003     AC_MSG_CHECKING([whether to sandbox the application])
3005     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3006         AC_MSG_ERROR([OS X sandboxing requires code signing])
3007     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3008         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
3009     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
3010         ENABLE_MACOSX_SANDBOX=TRUE
3011         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3012         AC_MSG_RESULT([yes])
3013     else
3014         AC_MSG_RESULT([no])
3015     fi
3017     AC_MSG_CHECKING([what OS X app bundle identifier to use])
3018     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3019     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3021     AC_MSG_CHECKING([what OS X app name to use])
3022     MACOSX_APP_NAME="$with_macosx_app_name"
3023     AC_MSG_RESULT([$MACOSX_APP_NAME])
3026 AC_SUBST(MACOSX_SDK_PATH)
3027 AC_SUBST(MACOSX_SDK_VERSION)
3028 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3029 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3030 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3031 AC_SUBST(INSTALL_NAME_TOOL)
3032 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
3033 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3034 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3035 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3036 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3037 AC_SUBST(MACOSX_APP_NAME)
3039 dnl ===================================================================
3040 dnl Check iOS SDK and compiler
3041 dnl ===================================================================
3043 if test $_os = iOS; then
3045     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3046         :
3047     else
3048         BITNESS_OVERRIDE=64
3049     fi
3051     AC_MSG_CHECKING([what iOS SDK to use])
3053     if test "$enable_ios_simulator" = yes; then
3054         platform=iPhoneSimulator
3055     else
3056         platform=iPhoneOS
3057     fi
3059     xcode_developer=`xcode-select -print-path`
3061     current_sdk_ver=8.3
3062     for sdkver in 9.1 9.0 8.4 8.3 8.2 8.1 8.0; do
3063         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3064         if test -d $t; then
3065             ios_sdk=$sdkver
3066             sysroot=$t
3067             break
3068         fi
3069     done
3071     if test -z "$sysroot"; then
3072         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}])
3073     fi
3075     AC_MSG_RESULT($sysroot)
3077     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
3079     if test "$enable_ios_simulator" = yes; then
3080         if test "$BITNESS_OVERRIDE" = 64; then
3081             XCODE_ARCHS=x86_64
3082             versionmin=-mios-simulator-version-min=7.0
3083         else
3084             XCODE_ARCHS=i386
3085             versionmin=-mios-simulator-version-min=7.0
3086         fi
3087     else
3088         platform=iPhoneOS
3089         if test "$BITNESS_OVERRIDE" = 64; then
3090             XCODE_ARCHS=arm64
3091         else
3092             XCODE_ARCHS=armv7
3093         fi
3094         versionmin=-miphoneos-version-min=7.0
3095     fi
3097     # LTO is not really recommended for iOS builds,
3098     # the link time will be astronomical
3099     if test "$ENABLE_LTO" = TRUE; then
3100         lto=-flto
3101     fi
3102     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
3103     # get compiled with it, to avoid ld warnings when linking all that together into one
3104     # executable.
3106     XCODE_CLANG_CXX_LIBRARY=libc++
3107     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3109     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3110     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3112     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3113     AR=`xcrun -find ar`
3114     NM=`xcrun -find nm`
3115     STRIP=`xcrun -find strip`
3116     LIBTOOL=`xcrun -find libtool`
3117     RANLIB=`xcrun -find ranlib`
3120 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3121 AC_SUBST(XCODE_ARCHS)
3122 AC_SUBST(XCODEBUILD_SDK)
3124 AC_MSG_CHECKING([whether to treat the installation as read-only])
3126 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3127         "$enable_extensions" != yes; then
3128     enable_readonly_installset=yes
3130 if test "$enable_readonly_installset" = yes; then
3131     AC_MSG_RESULT([yes])
3132     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3133 else
3134     AC_MSG_RESULT([no])
3137 dnl ===================================================================
3138 dnl Structure of install set
3139 dnl ===================================================================
3141 if test $_os = Darwin; then
3142     LIBO_BIN_FOLDER=MacOS
3143     LIBO_ETC_FOLDER=Resources
3144     LIBO_LIBEXEC_FOLDER=MacOS
3145     LIBO_LIB_FOLDER=Frameworks
3146     LIBO_SHARE_FOLDER=Resources
3147     LIBO_SHARE_HELP_FOLDER=Resources/help
3148     LIBO_SHARE_JAVA_FOLDER=Resources/java
3149     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3150     LIBO_LIB_PYUNO_FOLDER=Resources
3151     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3152     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3153     LIBO_URE_BIN_FOLDER=MacOS
3154     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3155     LIBO_URE_LIB_FOLDER=Frameworks
3156     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3157     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3158 elif test $_os = WINNT; then
3159     LIBO_BIN_FOLDER=program
3160     LIBO_ETC_FOLDER=program
3161     LIBO_LIBEXEC_FOLDER=program
3162     LIBO_LIB_FOLDER=program
3163     LIBO_LIB_PYUNO_FOLDER=program
3164     LIBO_SHARE_FOLDER=share
3165     LIBO_SHARE_HELP_FOLDER=help
3166     LIBO_SHARE_JAVA_FOLDER=program/classes
3167     LIBO_SHARE_PRESETS_FOLDER=presets
3168     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3169     LIBO_SHARE_SHELL_FOLDER=program/shell
3170     LIBO_URE_BIN_FOLDER=program
3171     LIBO_URE_ETC_FOLDER=program
3172     LIBO_URE_LIB_FOLDER=program
3173     LIBO_URE_MISC_FOLDER=program
3174     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3175 else
3176     LIBO_BIN_FOLDER=program
3177     LIBO_ETC_FOLDER=program
3178     LIBO_LIBEXEC_FOLDER=program
3179     LIBO_LIB_FOLDER=program
3180     LIBO_LIB_PYUNO_FOLDER=program
3181     LIBO_SHARE_FOLDER=share
3182     LIBO_SHARE_HELP_FOLDER=help
3183     LIBO_SHARE_JAVA_FOLDER=program/classes
3184     LIBO_SHARE_PRESETS_FOLDER=presets
3185     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3186     LIBO_SHARE_SHELL_FOLDER=program/shell
3187     LIBO_URE_BIN_FOLDER=program
3188     LIBO_URE_ETC_FOLDER=program
3189     LIBO_URE_LIB_FOLDER=program
3190     LIBO_URE_MISC_FOLDER=program
3191     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3193 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3194 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3195 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3196 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3197 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3198 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3199 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3200 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3201 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3202 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3203 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3204 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3205 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3206 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3207 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3208 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3210 # Not all of them needed in config_host.mk, add more if need arises
3211 AC_SUBST(LIBO_BIN_FOLDER)
3212 AC_SUBST(LIBO_ETC_FOLDER)
3213 AC_SUBST(LIBO_LIB_FOLDER)
3214 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3215 AC_SUBST(LIBO_SHARE_FOLDER)
3216 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3217 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3218 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3219 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3220 AC_SUBST(LIBO_URE_BIN_FOLDER)
3221 AC_SUBST(LIBO_URE_ETC_FOLDER)
3222 AC_SUBST(LIBO_URE_LIB_FOLDER)
3223 AC_SUBST(LIBO_URE_MISC_FOLDER)
3224 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3226 dnl ===================================================================
3227 dnl Windows specific tests and stuff
3228 dnl ===================================================================
3230 # Get a value from the 32-bit side of the Registry
3231 reg_get_value_32()
3233     # Return value: $regvalue
3234     unset regvalue
3235     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3237     if test $? -eq 0; then
3238         regvalue=$_regvalue
3239     fi
3242 # Get a value from the 64-bit side of the Registry
3243 reg_get_value_64()
3245     # Return value: $regvalue
3246     unset regvalue
3247     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3249     if test $? -eq 0; then
3250         regvalue=$_regvalue
3251     fi
3254 if test "$_os" = "WINNT"; then
3255     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3256     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3257         AC_MSG_RESULT([no])
3258         WINDOWS_SDK_ARCH="x86"
3259     else
3260         AC_MSG_RESULT([yes])
3261         WINDOWS_SDK_ARCH="x64"
3262         BITNESS_OVERRIDE=64
3263     fi
3266 if test "$cross_compiling" = "yes"; then
3267     export CROSS_COMPILING=TRUE
3268     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3269 else
3270     CROSS_COMPILING=
3271     BUILD_TYPE="$BUILD_TYPE NATIVE"
3273 AC_SUBST(CROSS_COMPILING)
3275 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3276 if test "$GCC" = "yes"; then
3277     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3278     bsymbolic_functions_ldflags_save=$LDFLAGS
3279     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3280     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3281 #include <stdio.h>
3282         ],[
3283 printf ("hello world\n");
3284         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3285     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3286         AC_MSG_RESULT( found )
3287     else
3288         AC_MSG_RESULT( not found )
3289     fi
3290     LDFLAGS=$bsymbolic_functions_ldflags_save
3292 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3294 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3295 # NOTE: must _not_ be used for bundled external libraries!
3296 ISYSTEM=
3297 if test "$GCC" = "yes"; then
3298     AC_MSG_CHECKING( for -isystem )
3299     save_CFLAGS=$CFLAGS
3300     CFLAGS="$CFLAGS -Werror"
3301     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3302     CFLAGS=$save_CFLAGS
3303     if test -n "$ISYSTEM"; then
3304         AC_MSG_RESULT(yes)
3305     else
3306         AC_MSG_RESULT(no)
3307     fi
3309 if test -z "$ISYSTEM"; then
3310     # fall back to using -I
3311     ISYSTEM=-I
3313 AC_SUBST(ISYSTEM)
3315 dnl ===================================================================
3316 dnl  Check which Visual Studio or MinGW compiler is used
3317 dnl ===================================================================
3319 map_vs_year_to_version()
3321     # Return value: $vsversion
3323     unset vsversion
3325     case $1 in
3326     2013)
3327         vsversion=12.0;;
3328     2015)
3329         vsversion=14.0;;
3330     *)
3331         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3332     esac
3335 vs_versions_to_check()
3337     # Args: $1 (optional) : versions to check, in the order of preference
3338     # Return value: $vsversions
3340     unset vsversions
3342     if test -n "$1"; then
3343         map_vs_year_to_version "$1"
3344         vsversions=$vsversion
3345     else
3346         # By default we prefer 2013/2015, in this order
3347         vsversions="12.0 14.0"
3348     fi
3351 find_msvs()
3353     # Find Visual Studio 2013/2015
3354     # Args: $1 (optional) : versions to check, in the order of preference
3355     # Return value: $vstest
3357     unset vstest
3359     vs_versions_to_check "$1"
3361     for ver in $vsversions; do
3362         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3363         if test -n "$regvalue"; then
3364             vstest=$regvalue
3365             break
3366         fi
3367         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3368         if test -n "$regvalue"; then
3369             vstest=$regvalue
3370             break
3371         fi
3372     done
3375 find_ucrt()
3377     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3378     if test -n "$regvalue"; then
3379         ucrttest=$regvalue
3380         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3381         ucrtdir=$regvalue
3382     fi
3385 find_msvc()
3387     # Find Visual C++ 2013/2015
3388     # Args: $1 (optional) : The VS version year
3389     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3391     unset vctest vcnum vcnumwithdot vcexpress
3393     vs_versions_to_check "$1"
3395     for ver in $vsversions; do
3396         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3397         if test -n "$regvalue"; then
3398             vctest=$regvalue
3399             break
3400         fi
3401         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3402         if test -n "$regvalue"; then
3403             vctest=$regvalue
3404             break
3405         fi
3406     done
3407     if test -n "$vctest"; then
3408         vcnumwithdot=$ver
3409         case "$vcnumwithdot" in
3410         12.0)
3411             vcyear=2013
3412             vcnum=120
3413             ;;
3414         14.0)
3415             vcyear=2015
3416             vcnum=140
3417             ;;
3418         esac
3419         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$vcnumwithdot/Setup/VC/ProductDir
3420         if test -n "$regvalue" -a "$regvalue" = "$vctest" ; then
3421             vcexpress=Express
3422         fi
3423     fi
3426 SOLARINC=
3427 SHOWINCLUDES_PREFIX=
3428 MSBUILD_PATH=
3429 DEVENV=
3430 if test "$_os" = "WINNT"; then
3431     if test "$WITH_MINGW" != "yes"; then
3432         AC_MSG_CHECKING([Visual C++])
3434         find_msvc "$with_visual_studio"
3435         if test -z "$vctest"; then
3436             if test -n "$with_visual_studio"; then
3437                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3438             else
3439                 AC_MSG_ERROR([No Visual Studio 2013/2015 installation found])
3440             fi
3441         fi
3443         if test "$BITNESS_OVERRIDE" = ""; then
3444             if test -f "$vctest/bin/cl.exe"; then
3445                 VC_PRODUCT_DIR=$vctest
3446             else
3447                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3448             fi
3449         else
3450             if test -f "$vctest/bin/amd64/cl.exe"; then
3451                 VC_PRODUCT_DIR=$vctest
3452             else
3453                 if test -f "$vctest/bin/x86_amd64/cl.exe" -a "$vcexpress" = "Express"; then
3454                     VC_PRODUCT_DIR=$vctest
3455                 else
3456                     AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3457                 fi
3458             fi
3459         fi
3461         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3462         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3464         AC_MSG_CHECKING([Is Visual C++ Express])
3465         if test "$vcexpress" = "Express" ; then
3466             AC_MSG_RESULT([Yes])
3467         else
3468             AC_MSG_RESULT([No])
3469         fi
3471         AC_MSG_CHECKING([whether UCRT is needed for this compiler version])
3472         if test "$vcnum" = "120"; then
3473             AC_MSG_RESULT([No])
3474         else
3475             AC_MSG_RESULT([Yes])
3476             AC_MSG_CHECKING([for UCRT location])
3477             find_ucrt
3478             if test -n "$ucrttest"; then
3479                 AC_MSG_RESULT([found])
3480                 PathFormat "$ucrttest"
3481                 ucrtincpath_formatted="${formatted_path}Include/$ucrtdir/ucrt"
3482                 # SOLARINC is used for external modules and must be set too.
3483                 # And no, it's not sufficient to set SOLARINC only, as configure
3484                 # itself doesn't honour it.
3485                 SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3486                 CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3487                 CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3488                 CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3489             else
3490                 AC_MSG_ERROR([not found])
3491             fi
3492         fi
3494         # Find the proper version of MSBuild.exe to use based on the VS version
3495         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3496         if test -n "$regvalue" ; then
3497             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3498         fi
3500         # Find the version of devenv.exe
3501         DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
3502         if test ! -e "$DEVENV" -a "$vcnum" = "120"; then
3503             # for Visual Studio 2013 Express, fall back
3504             DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/WDExpress.exe"
3505         fi
3506         if test ! -e "$DEVENV"; then
3507             AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3508         fi
3510         dnl ===========================================================
3511         dnl  Check for the corresponding mspdb*.dll
3512         dnl ===========================================================
3514         MSPDB_PATH=
3516         if test "$BITNESS_OVERRIDE" = ""; then
3517             if test "$vcnum" = "120"; then
3518                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3519             else
3520                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3521             fi
3522         else
3523             if test "$vcexpress" = "Express"; then
3524                 MSPDB_PATH="$VC_PRODUCT_DIR/bin"
3525             else
3526                 MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3527             fi
3528         fi
3530         mspdbnum=$vcnum
3532         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3533             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3534         fi
3536         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3537         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3539         dnl The path needs to be added before cl is called
3540         PATH="$MSPDB_PATH:$PATH"
3542         AC_MSG_CHECKING([cl.exe])
3544         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3545         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3546         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3547         # is not enough?
3549         if test -z "$CC"; then
3550             if test "$BITNESS_OVERRIDE" = ""; then
3551                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3552                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3553                 fi
3554             else
3555                 if test "$vcexpress" = "Express"; then
3556                    if test -f "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"; then
3557                         CC="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3558                    fi
3559                 else
3560                    if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3561                         CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3562                    fi
3563                 fi
3564             fi
3566             # This gives us a posix path with 8.3 filename restrictions
3567             CC=`win_short_path_for_make "$CC"`
3568         fi
3570         if test -n "$CC"; then
3571             # Remove /cl.exe from CC case insensitive
3572             AC_MSG_RESULT([found Visual C++ $vcyear $vcexpress ($CC)])
3573             if test "$BITNESS_OVERRIDE" = ""; then
3574                 COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3575             else
3576                 if test -n "$VC_PRODUCT_DIR"; then
3577                     COMPATH=$VC_PRODUCT_DIR
3578                 fi
3579             fi
3580             if test "$BITNESS_OVERRIDE" = ""; then
3581                 dnl since MSVC 2012, default for x86 is -arch:SSE2:
3582                 CC="$CC -arch:SSE"
3583             fi
3584             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3586             PathFormat "$COMPATH"
3587             COMPATH="$formatted_path"
3589             VCVER=$vcnum
3590             MSVSVER=$vcyear
3592             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3593             # are always "better", we list them in reverse chronological order.
3595             case $vcnum in
3596             120)
3597                 COMEX=15
3598                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0 7.1A"
3599                 ;;
3600             140)
3601                 COMEX=19
3602                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0A 10.0 8.1A 8.1 8.0 7.1A"
3603                 ;;
3604             esac
3606             # The expectation is that --with-windows-sdk should not need to be used
3607             if test -n "$with_windows_sdk"; then
3608                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3609                 *" "$with_windows_sdk" "*)
3610                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3611                     ;;
3612                 *)
3613                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3614                     ;;
3615                 esac
3616             fi
3618             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3619             ac_objext=obj
3620             ac_exeext=exe
3622         else
3623             AC_MSG_ERROR([Visual C++ not found after all, huh])
3624         fi
3626         dnl We need to guess the prefix of the -showIncludes output, it can be
3627         dnl localized
3628         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3629         echo "#include <stdlib.h>" > conftest.c
3630         dnl Filter out -FIIntrin.h when CC points at clang-cl.exe and needs to
3631         dnl explicitly state that argument:
3632         my_CC=
3633         for i in $CC; do
3634             case $i in
3635             -FIIntrin.h)
3636                 ;;
3637             *)
3638                 my_CC="$my_CC $i"
3639                 ;;
3640             esac
3641         done
3642         SHOWINCLUDES_PREFIX=`$my_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3643             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3644         rm -f conftest.c conftest.obj
3645         if test -z "$SHOWINCLUDES_PREFIX"; then
3646             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3647         else
3648             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3649         fi
3651         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3652         # version of the Explorer extension (and maybe other small
3653         # bits, too) needed when installing a 32-bit LibreOffice on a
3654         # 64-bit OS. The 64-bit Explorer extension is a feature that
3655         # has been present since long in OOo. Don't confuse it with
3656         # building LibreOffice itself as 64-bit code, which is
3657         # unfinished work and highly experimental.
3659         BUILD_X64=
3660         CXX_X64_BINARY=
3661         LINK_X64_BINARY=
3663         if test "$BITNESS_OVERRIDE" = ""; then
3664             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3665             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3666                 # Prefer native x64 compiler to cross-compiler, in case we are running
3667                 # the build on a 64-bit OS.
3668                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3669                     BUILD_X64=TRUE
3670                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3671                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3672                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3673                     BUILD_X64=TRUE
3674                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3675                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3676                 fi
3677             fi
3678             if test "$BUILD_X64" = TRUE; then
3679                 AC_MSG_RESULT([found])
3680             else
3681                 AC_MSG_RESULT([not found])
3682                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3683             fi
3684         fi
3685         AC_SUBST(BUILD_X64)
3687         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3688         AC_SUBST(CXX_X64_BINARY)
3689         AC_SUBST(LINK_X64_BINARY)
3690     else
3691         AC_MSG_CHECKING([the compiler is MinGW])
3692         MACHINE_PREFIX=`$CC -dumpmachine`
3693         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3694             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3695             AC_MSG_RESULT([yes])
3696         else
3697             AC_MSG_ERROR([Compiler is not MinGW.])
3698         fi
3699     fi
3701 AC_SUBST(VCVER)
3702 AC_SUBST(DEVENV)
3703 PathFormat "$MSPDB_PATH"
3704 MSPDB_PATH="$formatted_path"
3705 AC_SUBST(SHOWINCLUDES_PREFIX)
3707 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3708     AC_MSG_CHECKING([whether to use DirectX])
3709     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3710         ENABLE_DIRECTX="TRUE"
3711         AC_MSG_RESULT([yes])
3712     else
3713         ENABLE_DIRECTX=""
3714         AC_MSG_RESULT([no])
3715     fi
3717     AC_MSG_CHECKING([whether to use ActiveX])
3718     if test "$enable_activex" = "yes" -o "$enable_activex" = "" -a "$vcexpress" != Express; then
3719         DISABLE_ACTIVEX=""
3720         AC_MSG_RESULT([yes])
3721     else
3722         DISABLE_ACTIVEX="TRUE"
3723         AC_MSG_RESULT([no])
3724     fi
3726     AC_MSG_CHECKING([whether to use ATL])
3727     if test "$enable_atl" = "yes" -o "$enable_atl" = "" -a "$vcexpress" != Express; then
3728         DISABLE_ATL=""
3729         AC_MSG_RESULT([yes])
3730     else
3731         DISABLE_ATL="TRUE"
3732         AC_MSG_RESULT([no])
3733     fi
3734 else
3735     ENABLE_DIRECTX=""
3736     DISABLE_ACTIVEX="TRUE"
3737     DISABLE_ATL="TRUE"
3740 AC_SUBST(ENABLE_DIRECTX)
3741 AC_SUBST(DISABLE_ACTIVEX)
3742 AC_SUBST(DISABLE_ATL)
3745 # dbghelp.dll
3747 if test "$_os" = "WINNT"; then
3748     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3752 # unowinreg.dll
3754 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3755 AC_SUBST(UNOWINREG_DLL)
3757 COM_IS_CLANG=
3758 AC_MSG_CHECKING([whether the compiler is actually Clang])
3759 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3760     #ifndef __clang__
3761     you lose
3762     #endif
3763     int foo=42;
3764     ]])],
3765     [AC_MSG_RESULT([yes])
3766      COM_IS_CLANG=TRUE],
3767     [AC_MSG_RESULT([no])])
3769 if test "$COM_IS_CLANG" = TRUE; then
3770     AC_MSG_CHECKING([the Clang version])
3771     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P -`
3772     CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P -`
3773     CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3774     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3775     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3777 AC_SUBST(COM_IS_CLANG)
3779 if test "$CCACHE" != "" -a "$COM_IS_CLANG" = TRUE; then
3780     if test -z "$CCACHE_CPP2"; then
3781         AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
3782         add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
3783     fi
3787 # prefix C with ccache if needed
3789 if test "$CCACHE" != ""; then
3790     AC_MSG_CHECKING([whether $CC is already ccached])
3792     AC_LANG_PUSH([C])
3793     save_CFLAGS=$CFLAGS
3794     CFLAGS="$CFLAGS --ccache-skip -O2"
3795     dnl an empty program will do, we're checking the compiler flags
3796     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3797                       [use_ccache=yes], [use_ccache=no])
3798     if test $use_ccache = yes; then
3799         AC_MSG_RESULT([yes])
3800     else
3801         CC="$CCACHE $CC"
3802         AC_MSG_RESULT([no])
3803     fi
3804     CFLAGS=$save_CFLAGS
3805     AC_LANG_POP([C])
3808 # ===================================================================
3809 # check various GCC options that Clang does not support now but maybe
3810 # will somewhen in the future, check them even for GCC, so that the
3811 # flags are set
3812 # ===================================================================
3814 HAVE_GCC_GGDB2=
3815 HAVE_GCC_FINLINE_LIMIT=
3816 HAVE_GCC_FNO_INLINE=
3817 if test "$GCC" = "yes"; then
3818     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3819     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3820         # Option just ignored and silly warning that isn't a real
3821         # warning printed
3822         :
3823     else
3824         save_CFLAGS=$CFLAGS
3825         CFLAGS="$CFLAGS -Werror -ggdb2"
3826         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3827         CFLAGS=$save_CFLAGS
3828     fi
3829     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3830         AC_MSG_RESULT([yes])
3831     else
3832         AC_MSG_RESULT([no])
3833     fi
3835     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3836     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3837         # As above
3838         :
3839     else
3840         save_CFLAGS=$CFLAGS
3841         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3842         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3843         CFLAGS=$save_CFLAGS
3844     fi
3845     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3846         AC_MSG_RESULT([yes])
3847     else
3848         AC_MSG_RESULT([no])
3849     fi
3851     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3852     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3853         # Ditto
3854         :
3855     else
3856         save_CFLAGS=$CFLAGS
3857         CFLAGS="$CFLAGS -Werror -fno-inline"
3858         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3859         CFLAGS=$save_CFLAGS
3860     fi
3861     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3862         AC_MSG_RESULT([yes])
3863     else
3864         AC_MSG_RESULT([no])
3865     fi
3867 AC_SUBST(HAVE_GCC_GGDB2)
3868 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3869 AC_SUBST(HAVE_GCC_FNO_INLINE)
3871 dnl ===================================================================
3872 dnl  Test the gcc version
3873 dnl ===================================================================
3874 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3875     AC_MSG_CHECKING([the GCC version])
3876     _gcc_version=`$CC -dumpversion`
3877     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3879     AC_MSG_RESULT([gcc $_gcc_version])
3881     if test "$GCC_VERSION" -lt 0407; then
3882         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.7.0])
3883     fi
3884 else
3885     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3886     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3887     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3888     # (which reports itself as GCC 4.2.1).
3889     GCC_VERSION=
3891 AC_SUBST(GCC_VERSION)
3893 dnl Set the ENABLE_DBGUTIL variable
3894 dnl ===================================================================
3895 AC_MSG_CHECKING([whether to build with additional debug utilities])
3896 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3897     ENABLE_DBGUTIL="TRUE"
3898     # this is an extra var so it can have different default on different MSVC
3899     # versions (in case there are version specific problems with it)
3900     MSVC_USE_DEBUG_RUNTIME="TRUE"
3902     AC_MSG_RESULT([yes])
3903     # cppunit and graphite expose STL in public headers
3904     if test "$with_system_cppunit" = "yes"; then
3905         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3906     else
3907         with_system_cppunit=no
3908     fi
3909     if test "$with_system_graphite" = "yes"; then
3910         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3911     else
3912         with_system_graphite=no
3913     fi
3914     if test "$with_system_mysql_cppconn" = "yes"; then
3915         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3916     else
3917         with_system_mysql_cppconn=no
3918     fi
3919     if test "$with_system_orcus" = "yes"; then
3920         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3921     else
3922         with_system_orcus=no
3923     fi
3924     if test "$with_system_libcmis" = "yes"; then
3925         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3926     else
3927         with_system_libcmis=no
3928     fi
3929     if test "$with_system_libgltf" = "yes"; then
3930         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3931     else
3932         with_system_libgltf=no
3933     fi
3934 else
3935     ENABLE_DBGUTIL=""
3936     MSVC_USE_DEBUG_RUNTIME=""
3937     AC_MSG_RESULT([no])
3939 AC_SUBST(ENABLE_DBGUTIL)
3940 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3942 dnl Set the ENABLE_DEBUG variable.
3943 dnl ===================================================================
3944 AC_MSG_CHECKING([whether to do a debug build])
3945 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3946     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3948 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3949     AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3952 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3953     ENABLE_DEBUG="TRUE"
3954     if test -n "$ENABLE_DBGUTIL" ; then
3955         AC_MSG_RESULT([yes (dbgutil)])
3956     else
3957         AC_MSG_RESULT([yes])
3958     fi
3959 else
3960     ENABLE_DEBUG=""
3961     AC_MSG_RESULT([no])
3963 AC_SUBST(ENABLE_DEBUG)
3965 if test "$enable_sal_log" = yes; then
3966     ENABLE_SAL_LOG=TRUE
3968 AC_SUBST(ENABLE_SAL_LOG)
3970 dnl Selective debuginfo
3971 ENABLE_DEBUGINFO_FOR=
3972 if test -n "$ENABLE_DEBUG"; then
3973     AC_MSG_CHECKING([whether to use selective debuginfo])
3974     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3975         if test "$enable_selective_debuginfo" = "yes"; then
3976             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3977         fi
3978         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3979         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3980     else
3981         ENABLE_DEBUGINFO_FOR=all
3982         AC_MSG_RESULT([no, for all])
3983     fi
3984 else
3985     if test -n "$enable_selective_debuginfo"; then
3986         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3987     fi
3989 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3991 dnl Check for enable symbols option
3992 dnl ===================================================================
3993 AC_MSG_CHECKING([whether to include symbols while preserve optimization])
3994 if test -n "$enable_symbols" -a "$enable_symbols" != "no"; then
3995     ENABLE_SYMBOLS="TRUE"
3996     if test -n "$ENABLE_DBGUTIL"; then
3997         AC_MSG_ERROR([--enable-dbgutil cannot be used with --enable-symbols])
3998     elif test -n "$ENABLE_DEBUG"; then
3999         AC_MSG_ERROR([--enable-debug cannot be used with --enable-symbols])
4000     fi
4001     AC_MSG_RESULT([yes])
4002 else
4003     if test -n "$enable_symbols" -a "$enable_symbols" = "no"; then
4004         ENABLE_SYMBOLS="FALSE"
4005     else
4006         ENABLE_SYMBOLS=
4007     fi
4008     AC_MSG_RESULT([no])
4010 AC_SUBST(ENABLE_SYMBOLS)
4012 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4013     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4014     AC_MSG_CHECKING([whether enough memory is available for linking])
4015     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4016     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4017     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4018         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4019     else
4020         AC_MSG_RESULT([yes])
4021     fi
4024 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
4025 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
4026 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
4027 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
4028 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
4029     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
4031 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
4033 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
4034 # By default use the ones specified by our build system,
4035 # but explicit override is possible.
4036 AC_MSG_CHECKING(for explicit AFLAGS)
4037 if test -n "$AFLAGS"; then
4038     AC_MSG_RESULT([$AFLAGS])
4039     x_AFLAGS=
4040 else
4041     AC_MSG_RESULT(no)
4042     x_AFLAGS=[\#]
4044 AC_MSG_CHECKING(for explicit CFLAGS)
4045 if test -n "$CFLAGS"; then
4046     AC_MSG_RESULT([$CFLAGS])
4047     x_CFLAGS=
4048 else
4049     AC_MSG_RESULT(no)
4050     x_CFLAGS=[\#]
4052 AC_MSG_CHECKING(for explicit CXXFLAGS)
4053 if test -n "$CXXFLAGS"; then
4054     AC_MSG_RESULT([$CXXFLAGS])
4055     x_CXXFLAGS=
4056 else
4057     AC_MSG_RESULT(no)
4058     x_CXXFLAGS=[\#]
4060 AC_MSG_CHECKING(for explicit OBJCFLAGS)
4061 if test -n "$OBJCFLAGS"; then
4062     AC_MSG_RESULT([$OBJCFLAGS])
4063     x_OBJCFLAGS=
4064 else
4065     AC_MSG_RESULT(no)
4066     x_OBJCFLAGS=[\#]
4068 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
4069 if test -n "$OBJCXXFLAGS"; then
4070     AC_MSG_RESULT([$OBJCXXFLAGS])
4071     x_OBJCXXFLAGS=
4072 else
4073     AC_MSG_RESULT(no)
4074     x_OBJCXXFLAGS=[\#]
4076 AC_MSG_CHECKING(for explicit LDFLAGS)
4077 if test -n "$LDFLAGS"; then
4078     AC_MSG_RESULT([$LDFLAGS])
4079     x_LDFLAGS=
4080 else
4081     AC_MSG_RESULT(no)
4082     x_LDFLAGS=[\#]
4084 AC_SUBST(AFLAGS)
4085 AC_SUBST(CFLAGS)
4086 AC_SUBST(CXXFLAGS)
4087 AC_SUBST(OBJCFLAGS)
4088 AC_SUBST(OBJCXXFLAGS)
4089 AC_SUBST(LDFLAGS)
4090 AC_SUBST(x_AFLAGS)
4091 AC_SUBST(x_CFLAGS)
4092 AC_SUBST(x_CXXFLAGS)
4093 AC_SUBST(x_OBJCFLAGS)
4094 AC_SUBST(x_OBJCXXFLAGS)
4095 AC_SUBST(x_LDFLAGS)
4098 # determine CPUNAME, OS, ...
4099 # The USING_X11 flag tells whether the host os uses X by default. Can be overriden with the --without-x option.
4101 case "$host_os" in
4103 aix*)
4104     COM=GCC
4105     CPUNAME=POWERPC
4106     USING_X11=TRUE
4107     OS=AIX
4108     RTL_OS=AIX
4109     RTL_ARCH=PowerPC
4110     PLATFORMID=aix_powerpc
4111     P_SEP=:
4112     ;;
4114 cygwin*)
4115     COM=MSC
4116     USING_X11=
4117     OS=WNT
4118     RTL_OS=Windows
4119     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4120         P_SEP=";"
4121     else
4122         P_SEP=:
4123     fi
4124     case "$host_cpu" in
4125     i*86|x86_64)
4126         if test "$BITNESS_OVERRIDE" = 64; then
4127             CPUNAME=X86_64
4128             RTL_ARCH=X86_64
4129             PLATFORMID=windows_x86_64
4130             WINDOWS_X64=1
4131             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4132         else
4133             CPUNAME=INTEL
4134             RTL_ARCH=x86
4135             PLATFORMID=windows_x86
4136         fi
4137         ;;
4138     *)
4139         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4140         ;;
4141     esac
4142     SCPDEFS="$SCPDEFS -D_MSC_VER"
4143     ;;
4145 darwin*)
4146     COM=GCC
4147     USING_X11=
4148     OS=MACOSX
4149     RTL_OS=MacOSX
4150     P_SEP=:
4152     case "$host_cpu" in
4153     arm*)
4154         CPUNAME=ARM
4155         RTL_ARCH=ARM_EABI
4156         PLATFORMID=ios_arm
4157         OS=IOS
4158         ;;
4159     i*86)
4160         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4161         ;;
4162     x86_64)
4163         CPUNAME=X86_64
4164         RTL_ARCH=X86_64
4165         PLATFORMID=macosx_x86_64
4166         ;;
4167     *)
4168         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4169         ;;
4170     esac
4171     ;;
4173 dragonfly*)
4174     COM=GCC
4175     USING_X11=TRUE
4176     OS=DRAGONFLY
4177     RTL_OS=DragonFly
4178     P_SEP=:
4180     case "$host_cpu" in
4181     i*86)
4182         CPUNAME=INTEL
4183         RTL_ARCH=x86
4184         PLATFORMID=dragonfly_x86
4185         ;;
4186     x86_64)
4187         CPUNAME=X86_64
4188         RTL_ARCH=X86_64
4189         PLATFORMID=dragonfly_x86_64
4190         ;;
4191     *)
4192         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4193         ;;
4194     esac
4195     ;;
4197 freebsd*)
4198     COM=GCC
4199     USING_X11=TRUE
4200     RTL_OS=FreeBSD
4201     OS=FREEBSD
4202     P_SEP=:
4204     case "$host_cpu" in
4205     i*86)
4206         CPUNAME=INTEL
4207         RTL_ARCH=x86
4208         PLATFORMID=freebsd_x86
4209         ;;
4210     x86_64|amd64)
4211         CPUNAME=X86_64
4212         RTL_ARCH=X86_64
4213         PLATFORMID=freebsd_x86_64
4214         ;;
4215     *)
4216         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4217         ;;
4218     esac
4219     ;;
4221 kfreebsd*)
4222     COM=GCC
4223     USING_X11=TRUE
4224     OS=LINUX
4225     RTL_OS=kFreeBSD
4226     P_SEP=:
4228     case "$host_cpu" in
4230     i*86)
4231         CPUNAME=INTEL
4232         RTL_ARCH=x86
4233         PLATFORMID=kfreebsd_x86
4234         ;;
4235     x86_64)
4236         CPUNAME=X86_64
4237         RTL_ARCH=X86_64
4238         PLATFORMID=kfreebsd_x86_64
4239         ;;
4240     *)
4241         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4242         ;;
4243     esac
4244     ;;
4246 linux-gnu*)
4247     COM=GCC
4248     USING_X11=TRUE
4249     OS=LINUX
4250     RTL_OS=Linux
4251     P_SEP=:
4253     case "$host_cpu" in
4255     aarch64)
4256         CPUNAME=AARCH64
4257         PLATFORMID=linux_aarch64
4258         RTL_ARCH=AARCH64
4259         ;;
4260     alpha)
4261         CPUNAME=AXP
4262         RTL_ARCH=ALPHA
4263         PLATFORMID=linux_alpha
4264         ;;
4265     arm*)
4266         CPUNAME=ARM
4267         EPM_FLAGS="-a arm"
4268         RTL_ARCH=ARM_EABI
4269         PLATFORMID=linux_arm_eabi
4270         case "$host_cpu" in
4271         arm*-linux)
4272             RTL_ARCH=ARM_OABI
4273             PLATFORMID=linux_arm_oabi
4274             ;;
4275         esac
4276         ;;
4277     hppa)
4278         CPUNAME=HPPA
4279         RTL_ARCH=HPPA
4280         EPM_FLAGS="-a hppa"
4281         PLATFORMID=linux_hppa
4282         ;;
4283     i*86)
4284         CPUNAME=INTEL
4285         RTL_ARCH=x86
4286         PLATFORMID=linux_x86
4287         ;;
4288     ia64)
4289         CPUNAME=IA64
4290         RTL_ARCH=IA64
4291         PLATFORMID=linux_ia64
4292         ;;
4293     mips)
4294         CPUNAME=GODSON
4295         RTL_ARCH=MIPS_EB
4296         EPM_FLAGS="-a mips"
4297         PLATFORMID=linux_mips_eb
4298         ;;
4299     mips64)
4300         CPUNAME=GODSON64
4301         RTL_ARCH=MIPS64_EB
4302         EPM_FLAGS="-a mips64"
4303         PLATFORMID=linux_mips64_eb
4304         ;;
4305     mips64el)
4306         CPUNAME=GODSON64
4307         RTL_ARCH=MIPS64_EL
4308         EPM_FLAGS="-a mips64el"
4309         PLATFORMID=linux_mips64_el
4310         ;;
4311     mipsel)
4312         CPUNAME=GODSON
4313         RTL_ARCH=MIPS_EL
4314         EPM_FLAGS="-a mipsel"
4315         PLATFORMID=linux_mips_el
4316         ;;
4317     m68k)
4318         CPUNAME=M68K
4319         RTL_ARCH=M68K
4320         PLATFORMID=linux_m68k
4321         ;;
4322     powerpc)
4323         CPUNAME=POWERPC
4324         RTL_ARCH=PowerPC
4325         PLATFORMID=linux_powerpc
4326         ;;
4327     powerpc64)
4328         CPUNAME=POWERPC64
4329         RTL_ARCH=PowerPC_64
4330         PLATFORMID=linux_powerpc64
4331         ;;
4332     powerpc64le)
4333         CPUNAME=POWERPC64
4334         RTL_ARCH=PowerPC_64_LE
4335         PLATFORMID=linux_powerpc64_le
4336         ;;
4337     sparc)
4338         CPUNAME=SPARC
4339         RTL_ARCH=SPARC
4340         PLATFORMID=linux_sparc
4341         ;;
4342     s390)
4343         CPUNAME=S390
4344         RTL_ARCH=S390
4345         PLATFORMID=linux_s390
4346         ;;
4347     s390x)
4348         CPUNAME=S390X
4349         RTL_ARCH=S390x
4350         PLATFORMID=linux_s390x
4351         ;;
4352     x86_64)
4353         CPUNAME=X86_64
4354         RTL_ARCH=X86_64
4355         PLATFORMID=linux_x86_64
4356         ;;
4357     *)
4358         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4359         ;;
4360     esac
4361     ;;
4363 linux-android*)
4364     COM=GCC
4365     USING_X11=
4366     OS=ANDROID
4367     RTL_OS=Android
4368     P_SEP=:
4370     case "$host_cpu" in
4372     arm|armel)
4373         CPUNAME=ARM
4374         RTL_ARCH=ARM_EABI
4375         PLATFORMID=android_arm_eabi
4376         ;;
4377     aarch64)
4378         CPUNAME=AARCH64
4379         RTL_ARCH=AARCH64
4380         PLATFORMID=android_aarch64
4381         ;;
4382     mips|mipsel)
4383         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4384         RTL_ARCH=MIPS_EL
4385         PLATFORMID=android_mips_el
4386         ;;
4387     i*86)
4388         CPUNAME=INTEL
4389         RTL_ARCH=x86
4390         PLATFORMID=android_x86
4391         ;;
4392     *)
4393         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4394         ;;
4395     esac
4396     ;;
4398 emscripten*)
4399     COM=emcc
4400     USING_X11=
4401     OS=EMSCRIPTEN
4402     RTL_OS=Emscripten
4403     P_SEP=:
4404     CPUNAME=INTEL
4405     RTL_ARCH=x86
4406     PLATFORMID=linux_x86
4407     ;;
4409 mingw*)
4410     COM=GCC
4411     USING_X11=
4412     OS=WNT
4413     RTL_OS=Windows
4414     P_SEP=:
4416     case "$host_cpu" in
4417     i*86|x86_64)
4418         if test "$BITNESS_OVERRIDE" = 64; then
4419             CPUNAME=X86_64
4420             RTL_ARCH=X86_84
4421             PLATFORMID=windows_x86_64
4422             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4423         else
4424             CPUNAME=INTEL
4425             RTL_ARCH=x86
4426             PLATFORMID=windows_x86
4427             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4428         fi
4429         ;;
4430     *)
4431         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4432         ;;
4433     esac
4434     ;;
4436 *netbsd*)
4437     COM=GCC
4438     USING_X11=TRUE
4439     OS=NETBSD
4440     RTL_OS=NetBSD
4441     P_SEP=:
4443     case "$host_cpu" in
4444     i*86)
4445         CPUNAME=INTEL
4446         RTL_ARCH=x86
4447         PLATFORMID=netbsd_x86
4448         ;;
4449     powerpc)
4450         CPUNAME=POWERPC
4451         RTL_ARCH=PowerPC
4452         PLATFORMID=netbsd_powerpc
4453         ;;
4454     sparc)
4455         CPUNAME=SPARC
4456         RTL_ARCH=SPARC
4457         PLATFORMID=netbsd_sparc
4458         ;;
4459     x86_64)
4460         CPUNAME=X86_64
4461         RTL_ARCH=X86_64
4462         PLATFORMID=netbsd_x86_64
4463         ;;
4464     *)
4465         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4466         ;;
4467     esac
4468     ;;
4470 openbsd*)
4471     COM=GCC
4472     USING_X11=TRUE
4473     OS=OPENBSD
4474     RTL_OS=OpenBSD
4475     P_SEP=:
4477     case "$host_cpu" in
4478     i*86)
4479         CPUNAME=INTEL
4480         RTL_ARCH=x86
4481         PLATFORMID=openbsd_x86
4482         ;;
4483     x86_64)
4484         CPUNAME=X86_64
4485         RTL_ARCH=X86_64
4486         PLATFORMID=openbsd_x86_64
4487         ;;
4488     *)
4489         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4490         ;;
4491     esac
4492     SOLARINC="$SOLARINC -I/usr/local/include"
4493     ;;
4495 solaris*)
4496     COM=GCC
4497     USING_X11=TRUE
4498     OS=SOLARIS
4499     RTL_OS=Solaris
4500     P_SEP=:
4502     case "$host_cpu" in
4503     i*86)
4504         CPUNAME=INTEL
4505         RTL_ARCH=x86
4506         PLATFORMID=solaris_x86
4507         ;;
4508     sparc)
4509         CPUNAME=SPARC
4510         RTL_ARCH=SPARC
4511         PLATFORMID=solaris_sparc
4512         ;;
4513     sparc64)
4514         CPUNAME=SPARC64
4515         RTL_ARCH=SPARC64
4516         PLATFORMID=solaris_sparc64
4517         ;;
4518     *)
4519         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4520         ;;
4521     esac
4522     SOLARINC="$SOLARINC -I/usr/local/include"
4523     ;;
4526     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4527     ;;
4528 esac
4530 if test "$with_x" = "no"; then
4531     if test "$USING_X11" != TRUE; then
4532         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --without-x])
4533     fi
4534     USING_X11=
4537 WORKDIR="${BUILDDIR}/workdir"
4538 INSTDIR="${BUILDDIR}/instdir"
4539 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4540 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4541 AC_SUBST(COM)
4542 AC_SUBST(CPUNAME)
4543 AC_SUBST(RTL_OS)
4544 AC_SUBST(RTL_ARCH)
4545 AC_SUBST(EPM_FLAGS)
4546 AC_SUBST(USING_X11)
4547 AC_SUBST([INSTDIR])
4548 AC_SUBST([INSTROOT])
4549 AC_SUBST(OS)
4550 AC_SUBST(P_SEP)
4551 AC_SUBST(WORKDIR)
4552 AC_SUBST(PLATFORMID)
4553 AC_SUBST(WINDOWS_X64)
4554 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4556 dnl ===================================================================
4557 dnl Test which package format to use
4558 dnl ===================================================================
4559 AC_MSG_CHECKING([which package format to use])
4560 if test -n "$with_package_format" -a "$with_package_format" != no; then
4561     for i in $with_package_format; do
4562         case "$i" in
4563         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4564             ;;
4565         *)
4566             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4567 aix - AIX software distribution
4568 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4569 deb - Debian software distribution
4570 pkg - Solaris software distribution
4571 rpm - RedHat software distribution
4573 LibreOffice additionally supports:
4574 archive - .tar.gz or .zip
4575 dmg - Mac OS X .dmg
4576 installed - installation tree
4577 msi - Windows .msi
4578         ])
4579             ;;
4580         esac
4581     done
4582     PKGFORMAT="$with_package_format"
4583     AC_MSG_RESULT([$PKGFORMAT])
4584 else
4585     PKGFORMAT=
4586     AC_MSG_RESULT([none])
4588 AC_SUBST(PKGFORMAT)
4590 dnl ===================================================================
4591 dnl Set up a different compiler to produce tools to run on the build
4592 dnl machine when doing cross-compilation
4593 dnl ===================================================================
4595 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4596 if test "$cross_compiling" = "yes"; then
4597     AC_MSG_CHECKING([for BUILD platform configuration])
4598     echo
4599     rm -rf CONF-FOR-BUILD config_build.mk
4600     mkdir CONF-FOR-BUILD
4601     # Here must be listed all files needed when running the configure script. In particular, also
4602     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4603     # keep them in the same order as there.
4604     (cd $SRC_ROOT && tar cf - \
4605         config.guess \
4606         bin/get_config_variables \
4607         solenv/bin/getcompver.awk \
4608         solenv/inc/langlist.mk \
4609         config_host.mk.in \
4610         config_host_lang.mk.in \
4611         Makefile.in \
4612         lo.xcent.in \
4613         instsetoo_native/util/openoffice.lst.in \
4614         config_host/*.in \
4615         sysui/desktop/macosx/Info.plist.in \
4616         ios/lo.xcconfig.in) \
4617     | (cd CONF-FOR-BUILD && tar xf -)
4618     cp configure CONF-FOR-BUILD
4619     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4620     (
4621     unset COM USING_X11 OS CPUNAME
4622     unset CC CXX SYSBASE CFLAGS
4623     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4624     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4625     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
4626     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4627     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4628     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4629     cd CONF-FOR-BUILD
4630     sub_conf_opts=""
4631     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4632     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4633     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4634     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4635     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4636     # we need the msi build tools on mingw if we are creating the
4637     # installation set
4638     if test "$WITH_MINGW" = "yes"; then
4639         enable_winegcc_for_build=
4640         for pkgformat in $PKGFORMAT; do
4641             case "$pkgformat" in
4642             msi|native) enable_winegcc_for_build=yes ;;
4643             esac
4644         done
4645         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4646     fi
4647     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4648     # Don't bother having configure look for stuff not needed for the build platform anyway
4649     ./configure \
4650         --disable-cups \
4651         --disable-graphite \
4652         --disable-gtk3 \
4653         --disable-pdfimport \
4654         --disable-postgresql-sdbc \
4655         --with-parallelism="$with_parallelism" \
4656         --without-doxygen \
4657         --without-java \
4658         $sub_conf_opts \
4659         --srcdir=$srcdir \
4660         2>&1 | sed -e 's/^/    /'
4661     test -f ./config_host.mk 2>/dev/null || exit
4662     cp config_host.mk ../config_build.mk
4663     cp config_host_lang.mk ../config_build_lang.mk
4664     mv config.log ../config.Build.log
4665     mkdir -p ../config_build
4666     mv config_host/*.h ../config_build
4667     . ./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
4669     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
4670         VV='$'$V
4671         VV=`eval "echo $VV"`
4672         if test -n "$VV"; then
4673             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4674             echo "$line" >>build-config
4675         fi
4676     done
4678     for V in INSTDIR INSTROOT WORKDIR; do
4679         VV='$'$V
4680         VV=`eval "echo $VV"`
4681         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4682         if test -n "$VV"; then
4683             line="${V}_FOR_BUILD='$VV'"
4684             echo "$line" >>build-config
4685         fi
4686     done
4688     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4689     echo "$line" >>build-config
4691     )
4692     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4693     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])
4694     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4695              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4697     eval `cat CONF-FOR-BUILD/build-config`
4699     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4701     rm -rf CONF-FOR-BUILD
4702 else
4703     OS_FOR_BUILD="$OS"
4704     CC_FOR_BUILD="$CC"
4705     CXX_FOR_BUILD="$CXX"
4706     INSTDIR_FOR_BUILD="$INSTDIR"
4707     INSTROOT_FOR_BUILD="$INSTROOT"
4708     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4709     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4710     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4711     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4712     WORKDIR_FOR_BUILD="$WORKDIR"
4714 AC_SUBST(OS_FOR_BUILD)
4715 AC_SUBST(INSTDIR_FOR_BUILD)
4716 AC_SUBST(INSTROOT_FOR_BUILD)
4717 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4718 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4719 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4720 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4721 AC_SUBST(WORKDIR_FOR_BUILD)
4723 dnl ===================================================================
4724 dnl Check for syslog header
4725 dnl ===================================================================
4726 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4728 # placeholder for future crash reporter feature
4729 ENABLE_CRASHDUMP=""
4730 AC_SUBST(ENABLE_CRASHDUMP)
4732 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4733 dnl ===================================================================
4734 AC_MSG_CHECKING([whether to turn warnings to errors])
4735 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4736     ENABLE_WERROR="TRUE"
4737     AC_MSG_RESULT([yes])
4738 else
4739     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4740         ENABLE_WERROR="TRUE"
4741         AC_MSG_RESULT([yes])
4742     else
4743         AC_MSG_RESULT([no])
4744     fi
4746 AC_SUBST(ENABLE_WERROR)
4748 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4749 dnl ===================================================================
4750 AC_MSG_CHECKING([whether to have assert to abort in release code])
4751 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4752     ASSERT_ALWAYS_ABORT="TRUE"
4753     AC_MSG_RESULT([yes])
4754 else
4755     ASSERT_ALWAYS_ABORT="FALSE"
4756     AC_MSG_RESULT([no])
4758 AC_SUBST(ASSERT_ALWAYS_ABORT)
4760 # Determine whether to use ooenv for the instdir installation
4761 # ===================================================================
4762 if test $_os != "WINNT" -a $_os != "Darwin"; then
4763     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4764     if test "$enable_ooenv" = "no"; then
4765         AC_MSG_RESULT([no])
4766     else
4767         ENABLE_OOENV="TRUE"
4768         AC_MSG_RESULT([yes])
4769     fi
4771 AC_SUBST(ENABLE_OOENV)
4773 if test "$USING_X11" != TRUE; then
4774     # be sure to do not mess with unneeded stuff
4775     test_randr=no
4776     test_xrender=no
4777     test_cups=no
4778     test_dbus=no
4779     test_gtk=no
4780     build_gstreamer_1_0=no
4781     build_gstreamer_0_10=no
4782     test_tde=no
4783     test_kde4=no
4784     enable_cairo_canvas=no
4785     enable_gnome_vfs=no
4788 dnl ===================================================================
4789 dnl check for cups support
4790 dnl ===================================================================
4791 ENABLE_CUPS=""
4793 if test "$enable_cups" = "no"; then
4794     test_cups=no
4797 AC_MSG_CHECKING([whether to enable CUPS support])
4798 if test "$test_cups" = "yes"; then
4799     ENABLE_CUPS="TRUE"
4800     AC_MSG_RESULT([yes])
4802     AC_MSG_CHECKING([whether cups support is present])
4803     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4804     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4805     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4806         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4807     fi
4808     AC_DEFINE(ENABLE_CUPS)
4809 else
4810     AC_MSG_RESULT([no])
4813 AC_SUBST(ENABLE_CUPS)
4815 # fontconfig checks
4816 if test "$test_fontconfig" = "yes"; then
4817     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4818     SYSTEM_FONTCONFIG=TRUE
4819     FilterLibs "${FONTCONFIG_LIBS}"
4820     FONTCONFIG_LIBS="${filteredlibs}"
4822 AC_SUBST(FONTCONFIG_CFLAGS)
4823 AC_SUBST(FONTCONFIG_LIBS)
4824 AC_SUBST([SYSTEM_FONTCONFIG])
4826 dnl whether to find & fetch external tarballs?
4827 dnl ===================================================================
4828 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4829    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4830        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4831    else
4832        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4833    fi
4835 if test -z "$TARFILE_LOCATION"; then
4836     if test -d "$SRC_ROOT/src" ; then
4837         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4838         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4839     fi
4840     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4841 else
4842     AbsolutePath "$TARFILE_LOCATION"
4843     PathFormat "${absolute_path}"
4844     TARFILE_LOCATION="${formatted_path}"
4846 AC_SUBST(TARFILE_LOCATION)
4848 AC_MSG_CHECKING([whether we want to fetch tarballs])
4849 if test "$enable_fetch_external" != "no"; then
4850     if test "$with_all_tarballs" = "yes"; then
4851         AC_MSG_RESULT(["yes, all of them"])
4852         DO_FETCH_TARBALLS="ALL"
4853     else
4854         AC_MSG_RESULT(["yes, if we use them"])
4855         DO_FETCH_TARBALLS="TRUE"
4856     fi
4857 else
4858     AC_MSG_RESULT([no])
4859     DO_FETCH_TARBALLS=
4861 AC_SUBST(DO_FETCH_TARBALLS)
4863 AC_MSG_CHECKING([whether to build help])
4864 HELP_COMMON_ONLY=FALSE
4865 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4866     BUILD_TYPE="$BUILD_TYPE HELP"
4867     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4868     if test "$with_help" = "common" ; then
4869         HELP_COMMON_ONLY=TRUE
4870         AC_MSG_RESULT([common only])
4871     else
4872         SCPDEFS="$SCPDEFS -DWITH_HELP"
4873         AC_MSG_RESULT([yes])
4874     fi
4875 else
4876     AC_MSG_RESULT([no])
4878 AC_SUBST(HELP_COMMON_ONLY)
4880 dnl Test whether to include MySpell dictionaries
4881 dnl ===================================================================
4882 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4883 if test "$with_myspell_dicts" = "yes"; then
4884     AC_MSG_RESULT([yes])
4885     WITH_MYSPELL_DICTS=TRUE
4886     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4887     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4888 else
4889     AC_MSG_RESULT([no])
4890     WITH_MYSPELL_DICTS=
4892 AC_SUBST(WITH_MYSPELL_DICTS)
4894 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4895 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4896     if test "$with_system_dicts" = yes; then
4897         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4898     fi
4899     with_system_dicts=no
4902 AC_MSG_CHECKING([whether to use dicts from external paths])
4903 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4904     AC_MSG_RESULT([yes])
4905     SYSTEM_DICTS=TRUE
4906     AC_MSG_CHECKING([for spelling dictionary directory])
4907     if test -n "$with_external_dict_dir"; then
4908         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4909     else
4910         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4911         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4912             DICT_SYSTEM_DIR=file:///usr/share/myspell
4913         fi
4914     fi
4915     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4916     AC_MSG_CHECKING([for hyphenation patterns directory])
4917     if test -n "$with_external_hyph_dir"; then
4918         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4919     else
4920         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4921     fi
4922     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4923     AC_MSG_CHECKING([for thesaurus directory])
4924     if test -n "$with_external_thes_dir"; then
4925         THES_SYSTEM_DIR=file://$with_external_thes_dir
4926     else
4927         THES_SYSTEM_DIR=file:///usr/share/mythes
4928     fi
4929     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4930 else
4931     AC_MSG_RESULT([no])
4932     SYSTEM_DICTS=
4934 AC_SUBST(SYSTEM_DICTS)
4935 AC_SUBST(DICT_SYSTEM_DIR)
4936 AC_SUBST(HYPH_SYSTEM_DIR)
4937 AC_SUBST(THES_SYSTEM_DIR)
4939 dnl ===================================================================
4940 dnl enable pch by default on windows
4941 dnl enable it explicitely otherwise
4942 AC_MSG_CHECKING([whether to enable pch feature])
4943 ENABLE_PCH=""
4944 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4945     ENABLE_PCH="TRUE"
4946     AC_MSG_RESULT([yes])
4947 elif test "$enable_pch" != "no"; then
4948     if test -n "$enable_pch" && test "$GCC" = "yes"; then
4949         ENABLE_PCH="TRUE"
4950         AC_MSG_RESULT([yes])
4951     elif test -n "$enable_pch"; then
4952         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4953     else
4954         AC_MSG_RESULT([no])
4955     fi
4956 else
4957     AC_MSG_RESULT([no])
4959 AC_SUBST(ENABLE_PCH)
4961 TAB=`printf '\t'`
4963 AC_MSG_CHECKING([the GNU Make version])
4964 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4965 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4966 if test "$_make_longver" -ge "038200"; then
4967     AC_MSG_RESULT([$GNUMAKE $_make_version])
4969 elif test "$_make_longver" -ge "038100"; then
4970     if test "$build_os" = "cygwin"; then
4971         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4972     fi
4973     AC_MSG_RESULT([$GNUMAKE $_make_version])
4975     dnl ===================================================================
4976     dnl Search all the common names for sha1sum
4977     dnl ===================================================================
4978     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4979     if test -z "$SHA1SUM"; then
4980         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4981     elif test "$SHA1SUM" = "openssl"; then
4982         SHA1SUM="openssl sha1"
4983     fi
4984     AC_MSG_CHECKING([for GNU Make bug 20033])
4985     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4986     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4987 A := \$(wildcard *.a)
4989 .PHONY: all
4990 all: \$(A:.a=.b)
4991 <TAB>@echo survived bug20033.
4993 .PHONY: setup
4994 setup:
4995 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4997 define d1
4998 @echo lala \$(1)
4999 @sleep 1
5000 endef
5002 define d2
5003 @echo tyty \$(1)
5004 @sleep 1
5005 endef
5007 %.b : %.a
5008 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5009 <TAB>\$(call d1,\$(CHECKSUM)),\
5010 <TAB>\$(call d2,\$(CHECKSUM)))
5012     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5013         no_parallelism_make="YES"
5014         AC_MSG_RESULT([yes, disable parallelism])
5015     else
5016         AC_MSG_RESULT([no, keep parallelism enabled])
5017     fi
5018     rm -rf $TESTGMAKEBUG20033
5019 else
5020     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5023 # find if gnumake support file function
5024 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5025 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5026 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5027     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5029 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5030 \$(file >test.txt,Success )
5032 .PHONY: all
5033 all:
5034 <TAB>@cat test.txt
5037 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5038 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5039     HAVE_GNUMAKE_FILE_FUNC=TRUE
5040     AC_MSG_RESULT([yes])
5041 else
5042     AC_MSG_RESULT([no])
5044 rm -rf $TESTGMAKEFILEFUNC
5045 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5046 AC_SUBST(GNUMAKE_WIN_NATIVE)
5048 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5049 STALE_MAKE=
5050 if test "$_make_ver_check" = ""; then
5051    STALE_MAKE=TRUE
5054 HAVE_LD_HASH_STYLE=FALSE
5055 WITH_LINKER_HASH_STYLE=
5056 AC_MSG_CHECKING( for --hash-style gcc linker support )
5057 if test "$GCC" = "yes"; then
5058     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5059         hash_styles="gnu sysv"
5060     elif test "$with_linker_hash_style" = "no"; then
5061         hash_styles=
5062     else
5063         hash_styles="$with_linker_hash_style"
5064     fi
5066     for hash_style in $hash_styles; do
5067         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5068         hash_style_ldflags_save=$LDFLAGS
5069         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5071         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5072             [
5073 #include <stdio.h>
5074             ],[
5075 printf ("");
5076             ])],
5077             [
5078                   HAVE_LD_HASH_STYLE=TRUE
5079                   WITH_LINKER_HASH_STYLE=$hash_style
5080             ],
5081             [HAVE_LD_HASH_STYLE=FALSE],
5082             [HAVE_LD_HASH_STYLE=FALSE])
5083         LDFLAGS=$hash_style_ldflags_save
5084     done
5086     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5087         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5088     else
5089         AC_MSG_RESULT( no )
5090     fi
5091     LDFLAGS=$hash_style_ldflags_save
5092 else
5093     AC_MSG_RESULT( no )
5095 AC_SUBST(HAVE_LD_HASH_STYLE)
5096 AC_SUBST(WITH_LINKER_HASH_STYLE)
5098 dnl ===================================================================
5099 dnl Check whether there's a Perl version available.
5100 dnl ===================================================================
5101 if test -z "$with_perl_home"; then
5102     AC_PATH_PROG(PERL, perl)
5103 else
5104     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5105     _perl_path="$with_perl_home/bin/perl"
5106     if test -x "$_perl_path"; then
5107         PERL=$_perl_path
5108     else
5109         AC_MSG_ERROR([$_perl_path not found])
5110     fi
5113 dnl ===================================================================
5114 dnl Testing for Perl version 5 or greater.
5115 dnl $] is the Perl version variable, it is returned as an integer
5116 dnl ===================================================================
5117 if test "$PERL"; then
5118     AC_MSG_CHECKING([the Perl version])
5119     ${PERL} -e "exit($]);"
5120     _perl_version=$?
5121     if test "$_perl_version" -lt 5; then
5122         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5123     fi
5124     AC_MSG_RESULT([checked (perl $_perl_version)])
5125 else
5126     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5129 dnl ===================================================================
5130 dnl Testing for required Perl modules
5131 dnl ===================================================================
5133 AC_MSG_CHECKING([for required Perl modules])
5134 if `$PERL -e 'use Archive::Zip; use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5135     AC_MSG_RESULT([all modules found])
5136 else
5137     AC_MSG_RESULT([failed to find some modules])
5138     # Find out which modules are missing.
5139     missing_perl_modules=
5140     if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
5141         missing_perl_modules=Archive::Zip
5142     fi
5143     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5144         missing_perl_modules="$missing_perl_modules Cwd"
5145     fi
5146     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5147         missing_perl_modules="$missing_perl_modules Digest::MD5"
5148     fi
5149        AC_MSG_ERROR([
5150     The missing Perl modules are: $missing_perl_modules
5151     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5154 dnl ===================================================================
5155 dnl Check for pkg-config
5156 dnl ===================================================================
5157 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5158     PKG_PROG_PKG_CONFIG
5161 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5163     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5164     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5165     # explicitly. Or put /path/to/compiler in PATH yourself.
5167     AC_CHECK_TOOL(AR,ar)
5168     AC_CHECK_TOOL(NM,nm)
5169     AC_CHECK_TOOL(OBJDUMP,objdump)
5170     AC_CHECK_TOOL(RANLIB,ranlib)
5171     AC_CHECK_TOOL(READELF,readelf)
5172     AC_CHECK_TOOL(STRIP,strip)
5173     if test "$_os" = "WINNT"; then
5174         AC_CHECK_TOOL(DLLTOOL,dlltool)
5175         AC_CHECK_TOOL(WINDRES,windres)
5176     fi
5178 AC_SUBST(AR)
5179 AC_SUBST(DLLTOOL)
5180 AC_SUBST(NM)
5181 AC_SUBST(OBJDUMP)
5182 AC_SUBST(PKG_CONFIG)
5183 AC_SUBST(RANLIB)
5184 AC_SUBST(READELF)
5185 AC_SUBST(STRIP)
5186 AC_SUBST(WINDRES)
5188 dnl ===================================================================
5189 dnl pkg-config checks on Mac OS X
5190 dnl ===================================================================
5192 if test $_os = Darwin; then
5193     AC_MSG_CHECKING([for bogus pkg-config])
5194     if test -n "$PKG_CONFIG"; then
5195         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5196             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5197         else
5198             if test "$enable_bogus_pkg_config" = "yes"; then
5199                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5200             else
5201                 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.])
5202             fi
5203         fi
5204     else
5205         AC_MSG_RESULT([no, good])
5206     fi
5209 find_csc()
5211     # Return value: $csctest
5213     unset csctest
5215     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5216     if test -n "$regvalue"; then
5217         csctest=$regvalue
5218         return
5219     fi
5222 find_al()
5224     # Return value: $altest
5226     unset altest
5228     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5229         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5230         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5231             altest=$regvalue
5232             return
5233         fi
5234     done
5237 find_dotnetsdk()
5239     # Return value: $frametest (that's a silly name...)
5241     unset frametest
5243     for ver in 1.1 2.0; do
5244         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5245         if test -n "$regvalue"; then
5246             frametest=$regvalue
5247             return
5248         fi
5249     done
5252 find_dotnetsdk46()
5254     unset frametest
5256     for ver in 4.6; do
5257         # TODO(davido): Do we need to take care about 32bit?
5258         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5259         if test -n "$regvalue"; then
5260             frametest=$regvalue
5261             return
5262         fi
5263     done
5266 find_winsdk_version()
5268     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5269     # Return values: $winsdktest, $winsdklibsubdir
5271     unset winsdktest winsdklibsubdir
5273     # Why we look for them in this particular order I don't know. But OTOH I
5274     case "$1" in
5275     7.*)
5276         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5277         if test -n "$regvalue"; then
5278             winsdktest=$regvalue
5279             winsdklibsubdir=.
5280             return
5281         fi
5282         ;;
5283     8.1|8.1A)
5284         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5285         if test -n "$regvalue"; then
5286             winsdktest=$regvalue
5287             winsdklibsubdir=winv6.3
5288             return
5289         fi
5290         ;;
5291     8.0|8.0A)
5292         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5293         if test -n "$regvalue"; then
5294             winsdktest=$regvalue
5295             winsdklibsubdir=win8
5296             return
5297         fi
5298         ;;
5299     10.0)
5300         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5301         if test -n "$regvalue"; then
5302             winsdktest=$regvalue
5303             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5304             winsdklibsubdir=$regvalue
5305             return
5306         fi
5307         ;;
5308     esac
5311 find_winsdk()
5313     # Args: $1 (optional) : list of acceptable SDK versions
5314     # Return value: $winsdktest
5316     unset winsdktest
5318     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5319         find_winsdk_version $ver
5320         if test -n "$winsdktest"; then
5321             return
5322         fi
5323     done
5326 find_msms()
5328     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5329     AC_MSG_CHECKING([for $my_msm_file])
5330     msmdir=
5331     for ver in 12.0 14.0; do
5332         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5333         if test -n "$regvalue"; then
5334             if test -e "$regvalue/$my_msm_file"; then
5335                 msmdir=$regvalue
5336                 break
5337             fi
5338         fi
5339     done
5340     dnl Is the following fallback really necessary, or was it added in response
5341     dnl to never having started Visual Studio on a given machine, so the
5342     dnl registry keys checked above had presumably not yet been created?
5343     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5344     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5345     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5346     dnl expanding to "C:\Program Files\Common Files"), which would need
5347     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5348     dnl obtain its value from cygwin:
5349     if test -z "$msmdir"; then
5350         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5351         if test -e "$my_msm_dir/$my_msm_file"; then
5352             msmdir=$my_msm_dir
5353         fi
5354     fi
5355     if test -n "$msmdir"; then
5356         msmdir=`cygpath -m "$msmdir"`
5357         AC_MSG_RESULT([$msmdir])
5358     else
5359         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5360             AC_MSG_ERROR([not found])
5361         else
5362             AC_MSG_WARN([not found])
5363         fi
5364     fi
5367 find_msvc_x64_dlls()
5369     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5370     # http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
5371     # Refactored C Runtime (CRT): This CTP contains the first preview of the substantially refactored CRT.
5372     # msvcr140.dll no longer exists. It is replaced by a trio of DLLs: vcruntime140.dll, appcrt140.dll,
5373     # and desktopcrt140.dll.
5374     if test "$VCVER" = 140; then
5375        msvcdlls="msvcp${VCVER}.dll vcruntime${VCVER}.dll"
5376     else
5377        msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5378     fi
5379     for dll in $msvcdlls; do
5380         if ! test -f "$msvcdllpath/$dll"; then
5381             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5382         fi
5383     done
5386 if test "$build_os" = "cygwin"; then
5387     dnl Check midl.exe
5388     AC_MSG_CHECKING([for midl.exe])
5390     find_winsdk
5391     if test -f "$winsdktest/Bin/midl.exe"; then
5392         MIDL_PATH="$winsdktest/Bin"
5393     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5394         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5395     fi
5396     if test ! -f "$MIDL_PATH/midl.exe"; then
5397         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5398     else
5399         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5400     fi
5402     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5403     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5405     dnl Check csc.exe
5406     AC_MSG_CHECKING([for csc.exe])
5407     find_csc
5408     if test -f "$csctest/csc.exe"; then
5409         CSC_PATH="$csctest"
5410     fi
5411     if test ! -f "$CSC_PATH/csc.exe"; then
5412         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5413     else
5414         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5415     fi
5417     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5419     dnl Check al.exe
5420     AC_MSG_CHECKING([for al.exe])
5421     find_winsdk
5422     if test -f "$winsdktest/Bin/al.exe"; then
5423         AL_PATH="$winsdktest/Bin"
5424     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5425         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5426     fi
5428     if test -z "$AL_PATH"; then
5429         find_al
5430         if test -f "$altest/bin/al.exe"; then
5431             AL_PATH="$altest/bin"
5432         elif test -f "$altest/al.exe"; then
5433             AL_PATH="$altest"
5434         fi
5435     fi
5436     if test ! -f "$AL_PATH/al.exe"; then
5437         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5438     else
5439         AC_MSG_RESULT([$AL_PATH/al.exe])
5440     fi
5442     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5444     dnl Check mscoree.lib / .NET Framework dir
5445     AC_MSG_CHECKING(.NET Framework find_dotnetsdk)
5446     find_dotnetsdk
5447     if test -f "$frametest/lib/mscoree.lib"; then
5448         DOTNET_FRAMEWORK_HOME="$frametest"
5449     else
5450         AC_MSG_CHECKING(.NET Framework find_winsdk)
5451         find_winsdk
5452         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5453             DOTNET_FRAMEWORK_HOME="$winsdktest"
5454         else
5455             AC_MSG_CHECKING(.NET Framework find_dotnetsdk46)
5456             find_dotnetsdk46
5457             PathFormat "$frametest"
5458             frametest="$formatted_path"
5459             AC_MSG_CHECKING(found: $frametest/um/$WINDOWS_SDK_ARCH/mscoree.lib)
5460             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5461                  DOTNET_FRAMEWORK_HOME="$frametest"
5462             fi
5463         fi
5464     fi
5466     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
5467         AC_MSG_ERROR([mscoree.lib not found])
5468     fi
5469     AC_MSG_RESULT(found)
5471     PathFormat "$MIDL_PATH"
5472     MIDL_PATH="$formatted_path"
5474     PathFormat "$AL_PATH"
5475     AL_PATH="$formatted_path"
5477     PathFormat "$DOTNET_FRAMEWORK_HOME"
5478     DOTNET_FRAMEWORK_HOME="$formatted_path"
5480     PathFormat "$CSC_PATH"
5481     CSC_PATH="$formatted_path"
5484 dnl ===================================================================
5485 dnl Check if stdc headers are available excluding MSVC.
5486 dnl ===================================================================
5487 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5488     AC_HEADER_STDC
5491 dnl ===================================================================
5492 dnl Testing for C++ compiler and version...
5493 dnl ===================================================================
5495 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5496     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5497     save_CXXFLAGS=$CXXFLAGS
5498     AC_PROG_CXX
5499     CXXFLAGS=$save_CXXFLAGS
5500 else
5501     if test -n "$CC" -a -z "$CXX"; then
5502         CXX="$CC"
5503     fi
5506 dnl check for GNU C++ compiler version
5507 if test "$GXX" = "yes" -a "$CXX" != "emcc"; then
5508     AC_MSG_CHECKING([the GNU C++ compiler version])
5510     _gpp_version=`$CXX -dumpversion`
5511     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5513     if test "$_gpp_majmin" -lt "401"; then
5514         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5515     else
5516         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5517     fi
5519     dnl see https://code.google.com/p/android/issues/detail?id=41770
5520     if test "$_gpp_majmin" -ge "401"; then
5521         glibcxx_threads=no
5522         AC_LANG_PUSH([C++])
5523         AC_REQUIRE_CPP
5524         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5525         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5526             #include <bits/c++config.h>]],[[
5527             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5528             && !defined(_GLIBCXX__PTHREADS) \
5529             && !defined(_GLIBCXX_HAS_GTHREADS)
5530             choke me
5531             #endif
5532         ]])],[AC_MSG_RESULT([yes])
5533         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5534         AC_LANG_POP([C++])
5535         if test $glibcxx_threads = yes; then
5536             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5537         fi
5538      fi
5540 AC_SUBST(BOOST_CXXFLAGS)
5543 # prefx CXX with ccache if needed
5545 if test "$CCACHE" != ""; then
5546     AC_MSG_CHECKING([whether $CXX is already ccached])
5547     AC_LANG_PUSH([C++])
5548     save_CXXFLAGS=$CXXFLAGS
5549     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5550     dnl an empty program will do, we're checking the compiler flags
5551     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5552                       [use_ccache=yes], [use_ccache=no])
5553     if test $use_ccache = yes; then
5554         AC_MSG_RESULT([yes])
5555     else
5556         CXX="$CCACHE $CXX"
5557         AC_MSG_RESULT([no])
5558     fi
5559     CXXFLAGS=$save_CXXFLAGS
5560     AC_LANG_POP([C++])
5563 dnl ===================================================================
5564 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5565 dnl ===================================================================
5567 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5568     AC_PROG_CXXCPP
5570     dnl Check whether there's a C pre-processor.
5571     AC_PROG_CPP
5575 dnl ===================================================================
5576 dnl Find integral type sizes and alignments
5577 dnl ===================================================================
5579 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5581     AC_CHECK_SIZEOF(long)
5582     AC_CHECK_SIZEOF(short)
5583     AC_CHECK_SIZEOF(int)
5584     AC_CHECK_SIZEOF(long long)
5585     AC_CHECK_SIZEOF(double)
5586     AC_CHECK_SIZEOF(void*)
5588     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5589     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5590     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5591     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5592     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5594     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5595     m4_pattern_allow([AC_CHECK_ALIGNOF])
5596     m4_ifdef([AC_CHECK_ALIGNOF],
5597         [
5598             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5599             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5600             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5601             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5602         ],
5603         [
5604             case "$_os-$host_cpu" in
5605             Linux-i686)
5606                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5607                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5608                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5609                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5610                 ;;
5611             Linux-x86_64)
5612                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5613                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5614                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5615                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5616                 ;;
5617             *)
5618                 if test -z "$ac_cv_alignof_short" -o \
5619                         -z "$ac_cv_alignof_int" -o \
5620                         -z "$ac_cv_alignof_long" -o \
5621                         -z "$ac_cv_alignof_double"; then
5622                    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.])
5623                 fi
5624                 ;;
5625             esac
5626         ])
5628     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5629     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5630     if test $ac_cv_sizeof_long -eq 8; then
5631         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5632     elif test $ac_cv_sizeof_double -eq 8; then
5633         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5634     else
5635         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5636     fi
5638     dnl Check for large file support
5639     AC_SYS_LARGEFILE
5640     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5641         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5642     fi
5643     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5644         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5645     fi
5646 else
5647     # Hardcode for MSVC
5648     SAL_TYPES_SIZEOFSHORT=2
5649     SAL_TYPES_SIZEOFINT=4
5650     SAL_TYPES_SIZEOFLONG=4
5651     SAL_TYPES_SIZEOFLONGLONG=8
5652     if test "$BITNESS_OVERRIDE" = ""; then
5653         SAL_TYPES_SIZEOFPOINTER=4
5654     else
5655         SAL_TYPES_SIZEOFPOINTER=8
5656     fi
5657     SAL_TYPES_ALIGNMENT2=2
5658     SAL_TYPES_ALIGNMENT4=4
5659     SAL_TYPES_ALIGNMENT8=8
5660     LFS_CFLAGS=''
5662 AC_SUBST(LFS_CFLAGS)
5664 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5665 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5666 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5667 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5668 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5669 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5670 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5671 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5673 dnl ===================================================================
5674 dnl Check whether to enable runtime optimizations
5675 dnl ===================================================================
5676 ENABLE_RUNTIME_OPTIMIZATIONS=
5677 AC_MSG_CHECKING([whether to enable runtime optimizations])
5678 if test -z "$enable_runtime_optimizations"; then
5679     for i in $CC; do
5680         case $i in
5681         -fsanitize=*)
5682             enable_runtime_optimizations=no
5683             break
5684             ;;
5685         esac
5686     done
5688 if test "$enable_runtime_optimizations" != no; then
5689     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5690     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5691     AC_MSG_RESULT([yes])
5692 else
5693     AC_MSG_RESULT([no])
5695 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5697 dnl ===================================================================
5698 dnl Check if valgrind headers are available
5699 dnl ===================================================================
5700 ENABLE_VALGRIND=
5701 if test "$cross_compiling" != yes; then
5702     prev_cppflags=$CPPFLAGS
5703     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5704     # or where does it come from?
5705     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5706     AC_CHECK_HEADER([valgrind/valgrind.h],
5707         [ENABLE_VALGRIND=TRUE])
5708     CPPFLAGS=$prev_cppflags
5710 AC_SUBST([ENABLE_VALGRIND])
5711 if test -z "$ENABLE_VALGRIND"; then
5712     VALGRIND_CFLAGS=
5714 AC_SUBST([VALGRIND_CFLAGS])
5717 dnl ===================================================================
5718 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5719 dnl ===================================================================
5721 # We need at least the sys/sdt.h include header.
5722 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5723 if test "$SDT_H_FOUND" = "TRUE"; then
5724     # Found sys/sdt.h header, now make sure the c++ compiler works.
5725     # Old g++ versions had problems with probes in constructors/destructors.
5726     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5727     AC_LANG_PUSH([C++])
5728     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5729     #include <sys/sdt.h>
5730     class ProbeClass
5731     {
5732     private:
5733       int& ref;
5734       const char *name;
5736     public:
5737       ProbeClass(int& v, const char *n) : ref(v), name(n)
5738       {
5739         DTRACE_PROBE2(_test_, cons, name, ref);
5740       }
5742       void method(int min)
5743       {
5744         DTRACE_PROBE3(_test_, meth, name, ref, min);
5745         ref -= min;
5746       }
5748       ~ProbeClass()
5749       {
5750         DTRACE_PROBE2(_test_, dest, name, ref);
5751       }
5752     };
5753     ]],[[
5754     int i = 64;
5755     DTRACE_PROBE1(_test_, call, i);
5756     ProbeClass inst = ProbeClass(i, "call");
5757     inst.method(24);
5758     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5759           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5760     AC_LANG_POP([C++])
5762 AC_CONFIG_HEADERS([config_host/config_probes.h])
5764 dnl ===================================================================
5765 dnl Set the MinGW sys-root
5766 dnl ===================================================================
5767 if test "$WITH_MINGW" = "yes"; then
5768     AC_MSG_CHECKING([for MinGW sysroot])
5769     sysroot=`$CC -print-sysroot`
5770     AS_IF([test -d "$sysroot"/mingw],
5771           [MINGW_SYSROOT="$sysroot"/mingw
5772            AC_MSG_RESULT([$MINGW_SYSROOT])],
5773           [AC_MSG_RESULT([not found])
5774            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5776 AC_SUBST([MINGW_DLLS])
5777 AC_SUBST([MINGW_SYSROOT])
5779 dnl ===================================================================
5780 dnl Set the MinGW include directories
5781 dnl ===================================================================
5782 if test "$WITH_MINGW" = "yes"; then
5783     AC_MSG_CHECKING([for MinGW include path])
5784     cat >conftest.$ac_ext <<_ACEOF
5785 #include <stddef.h>
5786 #include <bits/c++config.h>
5787 _ACEOF
5788     _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`
5789     rm conftest.$ac_ext
5790     if test -z "$_mingw_lib_include_path"; then
5791         _mingw_lib_include_path="NO_LIB_INCLUDE"
5792         AC_MSG_RESULT([no MinGW include path])
5793     else
5794         AC_MSG_RESULT([$_mingw_lib_include_path])
5795     fi
5796     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5797     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5799     AC_LANG_PUSH([C++])
5801     AC_MSG_CHECKING([for dynamic libgcc])
5802     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5803 #include <iostream>
5804 using namespace std;
5805 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5806             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5807             if test -n "$MINGW_GCCDLL"; then
5808                 MINGW_SHARED_GCCLIB=TRUE
5809                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5810             else
5811                 MINGW_SHARED_GCCLIB=
5812                 AC_MSG_RESULT([no])
5813             fi
5814        ],[ AC_MSG_RESULT([no])
5816     ])
5818     AC_MSG_CHECKING([for dynamic libstdc++])
5819     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5820 #include <iostream>
5821 using namespace std;
5822 ]], [[ cout << "Hello there." << endl; ]])],[
5823             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5824             if test -n "$MINGW_GXXDLL"; then
5825                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5826                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5827                 if test "$CROSS_COMPILING" = "TRUE"; then
5828                     dnl m4 escaping!
5829                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5830                 fi
5831                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5832                 MINGW_SHARED_GXXLIB=TRUE
5833                 AC_MSG_RESULT([$MINGW_GXXDLL])
5834             else
5835                 MINGW_SHARED_GXXLIB=
5836                 AC_MSG_RESULT([no])
5837             fi
5838        ],[ AC_MSG_RESULT([no])
5840     ])
5842     AC_LANG_POP([C++])
5844     AC_SUBST(MINGW_SHARED_GCCLIB)
5845     AC_SUBST(MINGW_SHARED_GXXLIB)
5846     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5847     AC_SUBST(MINGW_GCCDLL)
5848     AC_SUBST(MINGW_GXXDLL)
5851 dnl *************************************************************
5852 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5853 dnl *************************************************************
5854 if test "$WITH_MINGW" = "yes"; then
5855     AC_MSG_CHECKING([exception type])
5856     AC_LANG_PUSH([C++])
5857     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5859         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5861         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5862     ])
5863     AC_MSG_RESULT($exceptions_type)
5864     AC_LANG_POP([C++])
5867 EXCEPTIONS="$exceptions_type"
5868 AC_SUBST(EXCEPTIONS)
5870 dnl ===================================================================
5871 dnl thread-safe statics
5872 dnl ===================================================================
5873 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5874 unset HAVE_THREADSAFE_STATICS
5875 if test "$GCC" = "yes"; then
5876     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5877     dnl us.  However, some C++ runtimes use a single lock for all static
5878     dnl variables, which can cause deadlock in multi-threaded applications.
5879     dnl This is not easily tested here; for POSIX-based systems, if executing
5880     dnl the following C++ program does not terminate then the tool chain
5881     dnl apparently has this problem:
5882     dnl
5883     dnl   #include <pthread.h>
5884     dnl   int h() { return 0; }
5885     dnl   void * g(void * unused) {
5886     dnl     static int n = h();
5887     dnl     return &n;
5888     dnl   }
5889     dnl   int f() {
5890     dnl     pthread_t t;
5891     dnl     pthread_create(&t, 0, g, 0);
5892     dnl     pthread_join(t, 0);
5893     dnl     return 0;
5894     dnl   }
5895     dnl   int main() {
5896     dnl     static int n = f();
5897     dnl     return n;
5898     dnl   }
5899     dnl
5900     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5901     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5902     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5903     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5904     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5905     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5906     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5907     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5908     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5909     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5910     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5911     dnl "too old"):
5912     if test "$_os" = Darwin; then
5913         dnl On Mac OS X, both /usr/lib/libstdc++.6.dylib and
5914         dnl /usr/lib/libc++1.dylib delegate to /usr/lib/libc++abi.dylib for the
5915         dnl __cxa_guard_* functionality; up to 10.8, libc++abi.dylib is
5916         dnl apparently provided by a libcppabi project that has broken semantics
5917         dnl (cf. <http://www.opensource.apple.com/source/libcppabi/libcppabi-26/
5918         dnl src/cxa_guard.cxx>), while in 10.9 (verified at least on 10.9.4) it
5919         dnl is apparently provided by LLVM's libcxxabi project, which has good
5920         dnl semantics (cf. <http://llvm.org/svn/llvm-project/libcxxabi/trunk/
5921         dnl src/cxa_guard.cpp>):
5922         if test "$MAC_OS_X_VERSION_MIN_REQUIRED" -ge 1090; then
5923             HAVE_THREADSAFE_STATICS=TRUE
5924         fi
5925     elif test "$_os" != Android; then
5926         if test "$COM_IS_CLANG" = TRUE; then
5927             AC_LANG_PUSH([C++])
5928             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5929 #include <list>
5930 #if !defined __GLIBCXX__ ||(__GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306)
5931 #error
5932 #endif
5933                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5934             AC_LANG_POP([C++])
5935         else # known to work in GCC since version 4.3
5936             HAVE_THREADSAFE_STATICS=TRUE
5937         fi
5938     fi
5939     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5940         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5941         AC_MSG_RESULT([yes])
5942     else
5943         AC_MSG_RESULT([broken (i.e., no)])
5944     fi
5945 else
5946     # MSVC has sprouted C++11 thread-safe statics in 2015
5947     # http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
5948     if test "$COM" = "MSC" -a "$VCVER" -ge "140"; then
5949         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5950         AC_MSG_RESULT([yes])
5951     else
5952         AC_MSG_RESULT([no])
5953     fi
5955 AC_SUBST(HAVE_THREADSAFE_STATICS)
5957 dnl ===================================================================
5958 dnl visibility and other gcc features
5959 dnl ===================================================================
5960 if test "$GCC" = "yes"; then
5961     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5962     save_CFLAGS=$CFLAGS
5963     CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5964     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5965     CFLAGS=$save_CFLAGS
5967     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5968         AC_MSG_RESULT([yes])
5969     else
5970         AC_MSG_RESULT([no])
5971     fi
5973     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5974     save_CFLAGS=$CFLAGS
5975     CFLAGS="$CFLAGS -Werror -mno-avx"
5976     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5977     CFLAGS=$save_CFLAGS
5978     if test "$HAVE_GCC_AVX" = "TRUE"; then
5979         AC_MSG_RESULT([yes])
5980     else
5981         AC_MSG_RESULT([no])
5982     fi
5984     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5985     save_CFLAGS=$CFLAGS
5986     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5987     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5988     CFLAGS=$save_CFLAGS
5989     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5990         AC_MSG_RESULT([yes])
5991     else
5992         AC_MSG_RESULT([no])
5993     fi
5995     AC_MSG_CHECKING([whether $CC supports atomic functions])
5996     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5997     int v = 0;
5998     if (__sync_add_and_fetch(&v, 1) != 1 ||
5999         __sync_sub_and_fetch(&v, 1) != 0)
6000         return 1;
6001     __sync_synchronize();
6002     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6003         v != 1)
6004         return 1;
6005     return 0;
6006 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6007     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6008         AC_MSG_RESULT([yes])
6009         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6010     else
6011         AC_MSG_RESULT([no])
6012     fi
6014     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
6015     save_CFLAGS=$CFLAGS
6016     CFLAGS="$CFLAGS -Werror"
6017     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6018             __attribute__((deprecated("test"))) void f();
6019         ])], [
6020             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6021             AC_MSG_RESULT([yes])
6022         ], [AC_MSG_RESULT([no])])
6023     CFLAGS=$save_CFLAGS
6025     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6026     AC_LANG_PUSH([C++])
6027     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6028             #include <cxxabi.h>
6029             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6030         ])], [
6031             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6032             AC_MSG_RESULT([yes])
6033         ], [AC_MSG_RESULT([no])])
6034     AC_LANG_POP([C++])
6036     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6037     AC_LANG_PUSH([C++])
6038     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6039             #include <cxxabi.h>
6040             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6041         ])], [
6042             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
6043             AC_MSG_RESULT([yes])
6044         ], [AC_MSG_RESULT([no])])
6045     AC_LANG_POP([C++])
6047     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6048     AC_LANG_PUSH([C++])
6049     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6050             #include <cxxabi.h>
6051             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6052         ])], [
6053             AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
6054             AC_MSG_RESULT([yes])
6055         ], [AC_MSG_RESULT([no])])
6056     AC_LANG_POP([C++])
6058     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6059     AC_LANG_PUSH([C++])
6060     save_CXXFLAGS=$CXXFLAGS
6061     CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
6062     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6063             struct __attribute__((warn_unused)) dummy {};
6064         ])], [
6065             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6066             AC_MSG_RESULT([yes])
6067         ], [AC_MSG_RESULT([no])])
6068     CXXFLAGS=$save_CXXFLAGS
6069     AC_LANG_POP([C++])
6071     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6072     AC_LANG_PUSH([C++])
6073     save_CXXFLAGS=$CXXFLAGS
6074     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
6075     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6076             #include <string>
6077             void f() { std::string s; }
6078         ])], [
6079             AC_MSG_RESULT([no])
6080         ], [
6081             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6082             AC_MSG_RESULT([yes])])
6083     CXXFLAGS=$save_CXXFLAGS
6084     AC_LANG_POP([C++])
6087 AC_SUBST(HAVE_GCC_AVX)
6088 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6089 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6091 dnl ===================================================================
6092 dnl Identify the C++ library
6093 dnl ===================================================================
6095 AC_MSG_CHECKING([What the C++ library is])
6096 AC_LANG_PUSH([C++])
6097 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6098 #include <utility>
6099 #ifndef __GLIBCXX__
6100 foo bar
6101 #endif
6102 ]])],
6103     [CPP_LIBRARY=GLIBCXX
6104      cpp_library_name="GNU libstdc++"
6105     ],
6106     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6107 #include <utility>
6108 #ifndef _LIBCPP_VERSION
6109 foo bar
6110 #endif
6111 ]])],
6112     [CPP_LIBRARY=LIBCPP
6113      cpp_library_name="LLVM libc++"
6114     ],
6115     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6116 #include <utility>
6117 #ifndef _MSC_VER
6118 foo bar
6119 #endif
6120 ]])],
6121     [CPP_LIBRARY=MSVCRT
6122      cpp_library_name="Microsoft"
6123     ],
6124     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6125 AC_MSG_RESULT([$cpp_library_name])
6126 AC_LANG_POP([C++])
6128 dnl ===================================================================
6129 dnl C++11
6130 dnl ===================================================================
6132 CXXFLAGS_CXX11=
6133 if test "$COM" = MSC; then
6134     AC_MSG_CHECKING([whether $CXX supports C++11])
6135     AC_MSG_RESULT(yes)
6136     # MSVC supports (a subset of) CXX11 without any switch
6137 elif test "$GCC" = "yes"; then
6138     HAVE_CXX11=
6139     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
6140     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
6141         save_CXXFLAGS=$CXXFLAGS
6142         CXXFLAGS="$CXXFLAGS $flag -Werror"
6143         AC_LANG_PUSH([C++])
6144         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6145             #include <algorithm>
6146             #include <functional>
6147             #include <vector>
6148             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6149                 std::sort(v.begin(), v.end(), fn);
6150             }
6151             ]])],[CXXFLAGS_CXX11=$flag])
6152         AC_LANG_POP([C++])
6153         CXXFLAGS=$save_CXXFLAGS
6154         if test -n "$CXXFLAGS_CXX11"; then
6155             HAVE_CXX11=TRUE
6156             break
6157         fi
6158     done
6159     if test "$HAVE_CXX11" = TRUE; then
6160         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6161     else
6162         AC_MSG_ERROR(no)
6163     fi
6166 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6167 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6168 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6169 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6170 dnl again towards 4.7.2:
6171 if test $CPP_LIBRARY = GLIBCXX; then
6172     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6173     AC_LANG_PUSH([C++])
6174     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6175 #include <list>
6176 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6177     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6178     //   GCC 4.7.0: 20120322
6179     //   GCC 4.7.1: 20120614
6180     // and using a range check is not possible as the mapping between
6181     // __GLIBCXX__ values and GCC versions is not monotonic
6182 /* ok */
6183 #else
6184 abi broken
6185 #endif
6186         ]])], [AC_MSG_RESULT(no, ok)],
6187         [AC_MSG_ERROR(yes)])
6188     AC_LANG_POP([C++])
6191 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6192 save_CXXFLAGS=$CXXFLAGS
6193 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6194 AC_LANG_PUSH([C++])
6196 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6197 #include <stddef.h>
6199 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6201 namespace
6203         struct b
6204         {
6205                 int i;
6206                 int j;
6207         };
6209 ]], [[
6210 struct a
6212         int i;
6213         int j;
6215 a thinga[]={{0,0}, {1,1}};
6216 b thingb[]={{0,0}, {1,1}};
6217 size_t i = sizeof(sal_n_array_size(thinga));
6218 size_t j = sizeof(sal_n_array_size(thingb));
6219 return !(i != 0 && j != 0);
6221     ], [ AC_MSG_RESULT(yes) ],
6222     [ AC_MSG_ERROR(no)])
6223 AC_LANG_POP([C++])
6224 CXXFLAGS=$save_CXXFLAGS
6226 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6227 save_CXXFLAGS=$CXXFLAGS
6228 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6229 AC_LANG_PUSH([C++])
6231 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6232 #include <vector>
6233     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6234     // (__float128)
6236     ],[ AC_MSG_RESULT(yes) ],
6237     [
6238         AC_MSG_RESULT(no)
6239         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6240         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6241         # __float128 is available during its build, but it's usually built using GCC,
6242         # and so c++config.h hardcodes __float128 being supported). As the only place
6243         # where __float128 is actually used is in a template specialization,
6244         # -D__float128=void will avoid the problem there while still causing a problem
6245         # if somebody actually uses the type.
6246         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6247         CXXFLAGS="$CXXFLAGS -D__float128=void"
6248         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6249 #include <vector>
6250     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6251     // (__float128)
6253     ],
6254     [
6255      AC_MSG_RESULT(yes)
6256      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6257     ],
6258     [
6259      AC_MSG_ERROR(no)
6260     ])
6263 AC_LANG_POP([C++])
6264 CXXFLAGS=$save_CXXFLAGS
6266 AC_SUBST(CXXFLAGS_CXX11)
6268 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6269 save_CXXFLAGS=$CXXFLAGS
6270 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6271 AC_LANG_PUSH([C++])
6272 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6273     struct S {
6274         int n_;
6275         constexpr S(int n): n_(n) {}
6276     };
6277     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6278 AC_LANG_POP([C++])
6279 CXXFLAGS=$save_CXXFLAGS
6280 AC_MSG_RESULT([$cxx11_constexpr])
6281 if test "$cxx11_constexpr" = yes; then
6282     AC_DEFINE([HAVE_CXX11_CONSTEXPR])
6285 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6286 save_CXXFLAGS=$CXXFLAGS
6287 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6288 if test "$ENABLE_DEBUG" != TRUE -a "$ENABLE_DBGUTIL" != TRUE \
6289     -a "$ASSERT_ALWAYS_ABORT" != TRUE
6290 then
6291     CXXFLAGS="$CXXFLAGS -DNDEBUG"
6293 AC_LANG_PUSH([C++])
6294 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6295     // A somewhat over-complicated way of checking for
6296     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6297     // in constexpr function":
6298     #include <cassert>
6299     template<typename T> inline constexpr T f(T x) { return x; }
6300     template<typename T> inline constexpr T g(T x) {
6301         assert(f(static_cast<int>(x)));
6302         return x;
6303     }
6304     enum E { e };
6305     auto v = g(E::e);
6307     struct S {
6308         int n_;
6309         constexpr bool f() {
6310             int n = n_;
6311             int i = 0;
6312             while (n > 0) { --n; ++i; }
6313             return i == 0;
6314         }
6315     };
6316     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6317 AC_LANG_POP([C++])
6318 CXXFLAGS=$save_CXXFLAGS
6319 AC_MSG_RESULT([$cxx14_constexpr])
6320 if test "$cxx14_constexpr" = yes; then
6321     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6324 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6325 save_CXXFLAGS=$CXXFLAGS
6326 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6327 AC_LANG_PUSH([C++])
6328 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6329     struct S {
6330         void f() &;
6331         void f() &&;
6332     };
6333     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6334 AC_LANG_POP([C++])
6335 CXXFLAGS=$save_CXXFLAGS
6336 AC_MSG_RESULT([$cxx11_ref_qualifier])
6337 if test "$cxx11_ref_qualifier" = yes; then
6338     AC_DEFINE([HAVE_CXX11_REF_QUALIFIER])
6341 AC_MSG_CHECKING([whether $CXX supports C++14 sized deallocation])
6342 if test "$CROSS_COMPILING" = TRUE; then
6343     cxx14_sized_deallocation=no
6344     AC_MSG_RESULT([$cxx14_sized_deallocation (assumed; cross compiling)])
6345 else
6346     save_CXXFLAGS=$CXXFLAGS
6347     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6348     AC_LANG_PUSH([C++])
6349     AC_RUN_IFELSE([AC_LANG_PROGRAM([[
6350         #include <cstddef>
6351         #include <cstdlib>
6352         void operator delete(void *) throw () { std::exit(1); }
6353         void operator delete(void *, std::size_t) throw () { std::exit(0); }
6354         struct S { S() { throw 0; } };
6355         ]],[[
6356         try { new S; } catch (...) {}
6357         return 1;
6358         ]])], [cxx14_sized_deallocation=yes], [cxx14_sized_deallocation=no])
6359     AC_LANG_POP([C++])
6360     CXXFLAGS=$save_CXXFLAGS
6361     AC_MSG_RESULT([$cxx14_sized_deallocation])
6363 if test "$cxx14_sized_deallocation" = yes; then
6364     AC_DEFINE([HAVE_CXX14_SIZED_DEALLOCATION])
6367 HAVE_GCC_PRAGMA_OPERATOR=
6368 dnl _Pragma support (may require C++11)
6369 if test "$GCC" = "yes"; then
6370     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6371     AC_LANG_PUSH([C++])
6372     save_CXXFLAGS=$CXXFLAGS
6373     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6374     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6375             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6376         ])], [
6377             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6378             HAVE_GCC_PRAGMA_OPERATOR=1
6379             AC_MSG_RESULT([yes])
6380         ], [AC_MSG_RESULT([no])])
6381     AC_LANG_POP([C++])
6382     CXXFLAGS=$save_CXXFLAGS
6384 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6386 dnl ===================================================================
6387 dnl system stl sanity tests
6388 dnl ===================================================================
6389 HAVE_GCC_VISIBILITY_BROKEN=
6390 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6392     AC_LANG_PUSH([C++])
6394     save_CPPFLAGS="$CPPFLAGS"
6395     if test -n "$MACOSX_SDK_PATH"; then
6396         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6397     fi
6399     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6400     # only.
6401     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$CPP_LIBRARY" = GLIBCXX; then
6402         dnl gcc#19664, gcc#22482, rhbz#162935
6403         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6404         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6405         AC_MSG_RESULT([$stlvisok])
6406         if test "$stlvisok" = "no"; then
6407             AC_MSG_WARN([Your libstdc++ headers are not visibility safe. Disabling visibility])
6408             add_warning "Your libstdc++ headers are not visibility safe. Disabling visibility"
6409             unset HAVE_GCC_VISIBILITY_FEATURE
6410         fi
6411     fi
6413     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6414         sharedlink_ldflags_save=$LDFLAGS
6415         LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6417         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6418         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6419 #include <sstream>
6420 using namespace std;
6421             ]], [[
6422 istringstream strm( "test" ); return 0;
6423             ]])],
6424             # Ugh, surely bad to assume an error message will contain
6425             # the word "unresolvable", a problem with
6426             # -fvisibility-inlines-hidden and STL headers might cause
6427             # some more obscure message on some platform, and anway,
6428             # the error message could be localised.
6429             [$EGREP -q unresolvable conftest.err;
6430             if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6431         ])
6432         AC_MSG_RESULT([$gccvisok])
6433         if test "$gccvisok" = "no"; then
6434             AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe, disabling that.])
6435             add_warning "Your gcc is not -fvisibility-inlines-hidden safe, disabling that."
6436             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6437         fi
6439         LDFLAGS=$sharedlink_ldflags_save
6440     fi
6442     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6443     # when we don't make any dynamic libraries?
6444     if test "$DISABLE_DYNLOADING" = "" -a "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE" -a "$HAVE_GCC_VISIBILITY_BROKEN" != "TRUE"; then
6445         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6446         cat > conftestlib1.cc <<_ACEOF
6447 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6448 struct S2: S1<int> { virtual ~S2(); };
6449 S2::~S2() {}
6450 _ACEOF
6451         cat > conftestlib2.cc <<_ACEOF
6452 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6453 struct S2: S1<int> { virtual ~S2(); };
6454 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6455 _ACEOF
6456         gccvisinlineshiddenok=yes
6457         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6458             gccvisinlineshiddenok=no
6459         else
6460             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6461             dnl known to not work with -z defs (unsetting which makes the test
6462             dnl moot, though):
6463             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6464             if test "$COM_IS_CLANG" = TRUE; then
6465                 for i in $CXX; do
6466                     case $i in
6467                     -fsanitize=*)
6468                         my_linkflagsnoundefs=
6469                         break
6470                         ;;
6471                     esac
6472                 done
6473             fi
6474             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6475                 gccvisinlineshiddenok=no
6476             fi
6477         fi
6479         rm -fr libconftest*
6480         AC_MSG_RESULT([$gccvisinlineshiddenok])
6481         if test "$gccvisinlineshiddenok" = "no"; then
6482             AC_MSG_WARN([Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that.])
6483             add_warning "Your gcc/clang is not -fvisibility-inlines-hidden safe, disabling that."
6484             HAVE_GCC_VISIBILITY_BROKEN="TRUE"
6485         fi
6486     fi
6488     if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
6489         AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6490         cat >visibility.cxx <<_ACEOF
6491 #pragma GCC visibility push(hidden)
6492 struct __attribute__ ((visibility ("default"))) TestStruct {
6493   static void Init();
6495 __attribute__ ((visibility ("default"))) void TestFunc() {
6496   TestStruct::Init();
6498 _ACEOF
6499         if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
6500             gccvisbroken=yes
6501         else
6502             case "$host_cpu" in
6503             i?86|x86_64)
6504                 if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6505                     gccvisbroken=no
6506                 else
6507                     if $EGREP -q '@PLT|@GOT' visibility.s; then
6508                         gccvisbroken=no
6509                     else
6510                         gccvisbroken=yes
6511                     fi
6512                 fi
6513                 ;;
6514             *)
6515                 gccvisbroken=no
6516                 ;;
6517             esac
6518         fi
6519         rm -f visibility.s visibility.cxx
6521         AC_MSG_RESULT([$gccvisbroken])
6522         if test "$gccvisbroken" = "yes"; then
6523             AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
6524             add_warning "Your gcc is not -fvisibility=hidden safe. Disabling visibility"
6525             unset HAVE_GCC_VISIBILITY_FEATURE
6526         fi
6527     fi
6529     CPPFLAGS="$save_CPPFLAGS"
6531     AC_LANG_POP([C++])
6534 AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
6535 AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
6537 dnl ===================================================================
6538 dnl  Clang++ tests
6539 dnl ===================================================================
6541 HAVE_GCC_FNO_DEFAULT_INLINE=
6542 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6543 if test "$GCC" = "yes"; then
6544     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6545     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6546         # Option just ignored and silly warning that isn't a real
6547         # warning printed
6548         :
6549     else
6550         AC_LANG_PUSH([C++])
6551         save_CXXFLAGS=$CXXFLAGS
6552         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6553         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6554         CXXFLAGS=$save_CXXFLAGS
6555         AC_LANG_POP([C++])
6556     fi
6557     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6558         AC_MSG_RESULT([yes])
6559     else
6560         AC_MSG_RESULT([no])
6561     fi
6563     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6564     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6565         # As above
6566         :
6567     else
6568         AC_LANG_PUSH([C++])
6569         save_CXXFLAGS=$CXXFLAGS
6570         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6571         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6572         CXXFLAGS=$save_CXXFLAGS
6573         AC_LANG_POP([C++])
6574     fi
6575     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6576         AC_MSG_RESULT([yes])
6577     else
6578         AC_MSG_RESULT([no])
6579     fi
6581 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6582 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6584 dnl ===================================================================
6585 dnl Compiler plugins
6586 dnl ===================================================================
6588 COMPILER_PLUGINS=
6589 # currently only Clang
6590 if test "$COM_IS_CLANG" = "TRUE"; then
6591     if test -n "$enable_compiler_plugins"; then
6592         compiler_plugins="$enable_compiler_plugins"
6593     elif test -n "$ENABLE_DBGUTIL"; then
6594         compiler_plugins=test
6595     else
6596         compiler_plugins=no
6597     fi
6598     if test "$compiler_plugins" != "no"; then
6599         dnl The prefix where Clang resides, override to where Clang resides if
6600         dnl using a source build:
6601         if test -z "$CLANGDIR"; then
6602             CLANGDIR=/usr
6603         fi
6604         AC_LANG_PUSH([C++])
6605         save_CPPFLAGS=$CPPFLAGS
6606         save_CXX=$CXX
6607         # compiler plugins must be built with "native" bitness of clang
6608         # because they link against clang libraries
6609         CXX=`echo $CXX | sed -e s/-m64// -e s/-m32//`
6610         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -I$CLANGDIR/tools/clang/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6611         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6612             [COMPILER_PLUGINS=TRUE],
6613             [
6614             if test "$compiler_plugins" = "yes"; then
6615                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6616             else
6617                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6618                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6619             fi
6620             ])
6621         CXX=$save_CXX
6622         CPPFLAGS=$save_CPPFLAGS
6623         AC_LANG_POP([C++])
6624     fi
6625 else
6626     if test "$enable_compiler_plugins" = "yes"; then
6627         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6628     fi
6630 AC_SUBST(COMPILER_PLUGINS)
6631 AC_SUBST(CLANGDIR)
6633 # Plugin to help linker.
6634 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6635 # This makes --enable-lto build with clang work.
6636 AC_SUBST(LD_PLUGIN)
6638 dnl ===================================================================
6639 dnl allocator
6640 dnl ===================================================================
6641 AC_MSG_CHECKING([which memory allocator to use])
6642 if test "$with_alloc" = "system"; then
6643     AC_MSG_RESULT([system])
6644     ALLOC="SYS_ALLOC"
6646 if test "$with_alloc" = "tcmalloc"; then
6647     AC_MSG_RESULT(tcmalloc)
6648     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6649         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6650     fi
6651     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6652         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6653     ALLOC="TCMALLOC"
6655 if test "$with_alloc" = "jemalloc"; then
6656     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6657         AC_MSG_RESULT(jemalloc)
6658         save_CFLAGS=$CFLAGS
6659         CFLAGS="$CFLAGS -pthread"
6660         AC_CHECK_LIB([jemalloc], [malloc], [:],
6661             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6662         ALLOC="JEMALLOC"
6663         CFLAGS=$save_CFLAGS
6664     else
6665         AC_MSG_RESULT([system])
6666         ALLOC="SYS_ALLOC"
6667     fi
6669 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6670     AC_MSG_RESULT([internal])
6672 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6673 AC_SUBST(HAVE_POSIX_FALLOCATE)
6674 AC_SUBST(ALLOC)
6676 dnl ===================================================================
6677 dnl Custom build version
6678 dnl ===================================================================
6680 AC_MSG_CHECKING([whether to add custom build version])
6681 if test "$with_build_version" != ""; then
6682     BUILD_VER_STRING=$with_build_version
6683     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6684 else
6685     BUILD_VER_STRING=
6686     AC_MSG_RESULT([no])
6688 AC_SUBST(BUILD_VER_STRING)
6690 JITC_PROCESSOR_TYPE=""
6691 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6692     # IBMs JDK needs this...
6693     JITC_PROCESSOR_TYPE=6
6694     export JITC_PROCESSOR_TYPE
6696 AC_SUBST([JITC_PROCESSOR_TYPE])
6698 # Misc Windows Stuff
6699 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6700     find_msvc_x64_dlls
6701     find_msms
6702     MSVC_DLL_PATH="$msvcdllpath"
6703     MSVC_DLLS="$msvcdlls"
6704     MSM_PATH="$msmdir"
6705     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6708 AC_SUBST(MSVC_DLL_PATH)
6709 AC_SUBST(MSVC_DLLS)
6710 AC_SUBST(MSM_PATH)
6712 dnl ===================================================================
6713 dnl Checks for Java
6714 dnl ===================================================================
6715 if test "$ENABLE_JAVA" != ""; then
6717     # Windows-specific tests
6718     if test "$build_os" = "cygwin"; then
6719         if test "$BITNESS_OVERRIDE" = 64; then
6720             bitness=64
6721         else
6722             bitness=32
6723         fi
6725         if test -z "$with_jdk_home"; then
6726             for ver in 1.8 1.7 1.6; do
6727                 reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6728                 if test -n "$regvalue"; then
6729                     _jdk_home=$regvalue
6730                     break
6731                 fi
6732             done
6733             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6734                 with_jdk_home="$_jdk_home"
6735                 howfound="found automatically"
6736             else
6737                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6738             fi
6739         else
6740             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6741             howfound="you passed"
6742         fi
6743     fi
6745     # 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.
6746     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6747     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6748         with_jdk_home=`/usr/libexec/java_home`
6749     fi
6751     JAVA_HOME=; export JAVA_HOME
6752     if test -z "$with_jdk_home"; then
6753         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6754     else
6755         _java_path="$with_jdk_home/bin/$with_java"
6756         dnl Check if there is a Java interpreter at all.
6757         if test -x "$_java_path"; then
6758             JAVAINTERPRETER=$_java_path
6759         else
6760             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6761         fi
6762     fi
6764     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6765     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6766     dnl loaded by java to run JunitTests:
6767     if test "$build_os" = "cygwin"; then
6768         shortjdkhome=`cygpath -d "$with_jdk_home"`
6769         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
6770             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6771             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6772         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
6773             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6774             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6775         fi
6777         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6778             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6779         fi
6780         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6781     elif test "$cross_compiling" != "yes"; then
6782         case $CPUNAME in
6783             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6784                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6785                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6786                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6787                 fi
6788                 ;;
6789             *) # assumption: everything else 32-bit
6790                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6791                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6792                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6793                 fi
6794                 ;;
6795         esac
6796     fi
6799 HAVE_JAVA6=
6800 HAVE_JAVA9=
6801 dnl ===================================================================
6802 dnl Checks for JDK.
6803 dnl ===================================================================
6805 # Note that JAVA_HOME as for now always means the *build* platform's
6806 # JAVA_HOME. Whether all the complexity here actually is needed any
6807 # more or not, no idea.
6809 if test "$ENABLE_JAVA" != ""; then
6810     _gij_longver=0
6811     AC_MSG_CHECKING([the installed JDK])
6812     if test -n "$JAVAINTERPRETER"; then
6813         dnl java -version sends output to stderr!
6814         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6815             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6816         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6817             JDK=gcj
6818             AC_MSG_RESULT([checked (gcj)])
6819             _gij_version=`$JAVAINTERPRETER --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6820             _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6822         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6823             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6824         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6825             JDK=ibm
6827             dnl IBM JDK specific tests
6828             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6829             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6831             if test "$_jdk_ver" -lt 10500; then
6832                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
6833             fi
6834             if test "$_jdk_ver" -ge 10600; then
6835                 HAVE_JAVA6=TRUE
6836             fi
6838             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6840             if test "$with_jdk_home" = ""; then
6841                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6842 you must use the "--with-jdk-home" configure option explicitly])
6843             fi
6845             JAVA_HOME=$with_jdk_home
6846         else
6847             JDK=sun
6849             dnl Sun JDK specific tests
6850             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6851             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6853             if test "$_jdk_ver" -lt 10500; then
6854                 AC_MSG_ERROR([JDK is too old, you need at least 1.5])
6855             fi
6856             if test "$_jdk_ver" -gt 10600; then
6857                 JAVA_CLASSPATH_NOT_SET="1"
6858             fi
6859             if test "$_jdk_ver" -ge 10600; then
6860                 HAVE_JAVA6=TRUE
6861             fi
6862             if test "$_jdk_ver" -ge 10900; then
6863                 HAVE_JAVA9=TRUE
6864             fi
6866             AC_MSG_RESULT([checked (JDK $_jdk)])
6867             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6868             if test "$_os" = "WINNT"; then
6869                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6870             fi
6872             # set to limit VM usage for JunitTests
6873             JAVAIFLAGS=-Xmx64M
6874             # set to limit VM usage for javac
6875             JAVAFLAGS=-J-Xmx128M
6876         fi
6877     else
6878         AC_MSG_ERROR([Java not found. You need at least jdk-1.5, or gcj-4])
6879     fi
6880 else
6881     dnl Java disabled
6882     JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
6884 AC_SUBST([HAVE_JAVA6])
6885 AC_SUBST([HAVE_JAVA9])
6887 dnl ===================================================================
6888 dnl Set target Java bytecode version
6889 dnl ===================================================================
6890 if test "$ENABLE_JAVA" != ""; then
6891     if test "$HAVE_JAVA9" == "TRUE"; then
6892         _java_target_ver="1.6"
6893     else
6894         _java_target_ver="1.5"
6895     fi
6896     JAVA_SOURCE_VER="$_java_target_ver"
6897     JAVA_TARGET_VER="$_java_target_ver"
6900 dnl ===================================================================
6901 dnl Checks for javac
6902 dnl ===================================================================
6903 if test "$ENABLE_JAVA" != ""; then
6904     if test "$JDK" = "gcj"; then
6905         javacompiler=`echo $with_java | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
6906     else
6907         javacompiler="javac"
6908     fi
6909     if test -z "$with_jdk_home"; then
6910         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6911     else
6912         _javac_path="$with_jdk_home/bin/$javacompiler"
6913         dnl Check if there is a Java compiler at all.
6914         if test -x "$_javac_path"; then
6915             JAVACOMPILER=$_javac_path
6916         fi
6917     fi
6918     if test -z "$JAVACOMPILER"; then
6919         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6920     fi
6921     if test "$build_os" = "cygwin"; then
6922         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6923             JAVACOMPILER="${JAVACOMPILER}.exe"
6924         fi
6925         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6926     fi
6928     if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
6929         AC_MSG_CHECKING([re-checking JDK])
6930         JDK=gcj
6931         AC_MSG_RESULT([checked (ecj)])
6932         _gij_longver="40200"
6933     fi
6936 JAVACISGCJ=""
6937 dnl ===================================================================
6938 dnl Checks that javac is gcj
6939 dnl ===================================================================
6940 if test "$ENABLE_JAVA" != ""; then
6941     if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
6942         JAVACISGCJ="yes"
6943     fi
6945 AC_SUBST(JAVACISGCJ)
6947 dnl ===================================================================
6948 dnl Checks for javadoc
6949 dnl ===================================================================
6950 if test "$ENABLE_JAVA" != ""; then
6951     if test -z "$with_jdk_home"; then
6952         AC_PATH_PROG(JAVADOC, javadoc)
6953     else
6954         _javadoc_path="$with_jdk_home/bin/javadoc"
6955         dnl Check if there is a javadoc at all.
6956         if test -x "$_javadoc_path"; then
6957             JAVADOC=$_javadoc_path
6958         else
6959             AC_PATH_PROG(JAVADOC, javadoc)
6960         fi
6961     fi
6962     if test -z "$JAVADOC"; then
6963         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6964     fi
6965     if test "$build_os" = "cygwin"; then
6966         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6967             JAVADOC="${JAVADOC}.exe"
6968         fi
6969         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6970     fi
6972     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6973     JAVADOCISGJDOC="yes"
6974     fi
6976 AC_SUBST(JAVADOCISGJDOC)
6978 if test "$ENABLE_JAVA" != ""; then
6979     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6980     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6981         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6982            # try to recover first by looking whether we have a alternatives
6983            # system as in Debian or newer SuSEs where following /usr/bin/javac
6984            # over /etc/alternatives/javac leads to the right bindir where we
6985            # just need to strip a bit away to get a valid JAVA_HOME
6986            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6987         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6988             # maybe only one level of symlink (e.g. on Mac)
6989             JAVA_HOME=$(readlink $JAVACOMPILER)
6990             if test "$(dirname $JAVA_HOME)" = "."; then
6991                 # we've got no path to trim back
6992                 JAVA_HOME=""
6993             fi
6994         else
6995             # else warn
6996             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6997             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6998             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6999             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7000         fi
7001         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
7002         if test "$JAVA_HOME" != "/usr"; then
7003             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7004                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7005                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7006                 dnl Tiger already returns a JDK path..
7007                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7008             else
7009                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7010             fi
7011         fi
7012     fi
7013     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7015     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7016     if test -z "$JAVA_HOME"; then
7017         if test "x$with_jdk_home" = "x"; then
7018             cat > findhome.java <<_ACEOF
7019 [import java.io.File;
7021 class findhome
7023     public static void main(String args[])
7024     {
7025         String jrelocation = System.getProperty("java.home");
7026         File jre = new File(jrelocation);
7027         System.out.println(jre.getParent());
7028     }
7030 _ACEOF
7031             AC_MSG_CHECKING([if javac works])
7032             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7033             AC_TRY_EVAL(javac_cmd)
7034             if test $? = 0 -a -f ./findhome.class; then
7035                 AC_MSG_RESULT([javac works])
7036             else
7037                 echo "configure: javac test failed" >&5
7038                 cat findhome.java >&5
7039                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7040             fi
7041             AC_MSG_CHECKING([if gij knows its java.home])
7042             JAVA_HOME=`$JAVAINTERPRETER findhome`
7043             if test $? = 0 -a "$JAVA_HOME" != ""; then
7044                 AC_MSG_RESULT([$JAVA_HOME])
7045             else
7046                 echo "configure: java test failed" >&5
7047                 cat findhome.java >&5
7048                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7049             fi
7050             # clean-up after ourselves
7051             rm -f ./findhome.java ./findhome.class
7052         else
7053             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7054         fi
7055     fi
7057     dnl second sanity check JAVA_HOME if possible
7058     if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
7059         # now check if $JAVA_HOME is really valid
7060         if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7061             if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7062                 JAVA_HOME_OK="NO"
7063             fi
7064         elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7065             JAVA_HOME_OK="NO"
7066         fi
7067         if test "$JAVA_HOME_OK" = "NO"; then
7068             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7069             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7070             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7071             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7072             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7073             add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7074         fi
7075     fi
7076     PathFormat "$JAVA_HOME"
7077     JAVA_HOME="$formatted_path"
7080 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7081     "$_os" != Darwin
7082 then
7083     AC_MSG_CHECKING([for JAWT lib])
7084     if test "$_os" = WINNT; then
7085         if test "$WITH_MINGW" = yes; then
7086             # The path is taken care of in gb_LinkTarget__use_jawt
7087             # in RepositoryExternal.mk:
7088             JAWTLIB=-ljawt
7089         else
7090             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7091             JAWTLIB=jawt.lib
7092         fi
7093     else
7094         case "$host_cpu" in
7095         arm*)
7096             my_java_arch=arm
7097             ;;
7098         i*86)
7099             my_java_arch=i386
7100             ;;
7101         m68k)
7102             my_java_arch=mk68
7103             ;;
7104         powerpc)
7105             my_java_arch=ppc
7106             ;;
7107         powerpc64)
7108             my_java_arch=ppc64
7109             ;;
7110         powerpc64le)
7111             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7112             JAVA_ARCH=$my_java_arch
7113             ;;
7114         x86_64)
7115             my_java_arch=amd64
7116             ;;
7117         *)
7118             my_java_arch=$host_cpu
7119             ;;
7120         esac
7121         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7122         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7123     fi
7124     AC_MSG_RESULT([$JAWTLIB])
7126 AC_SUBST(JAWTLIB)
7128 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7129     case "$host_os" in
7131     aix*)
7132         JAVAINC="-I$JAVA_HOME/include"
7133         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7134         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7135         ;;
7137     cygwin*)
7138         JAVAINC="-I$JAVA_HOME/include/win32"
7139         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7140         ;;
7142     darwin*)
7143         if test -d "$JAVA_HOME/include/darwin"; then
7144             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7145         else
7146             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7147         fi
7148         ;;
7150     dragonfly*)
7151         JAVAINC="-I$JAVA_HOME/include"
7152         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7153         ;;
7155     freebsd*)
7156         JAVAINC="-I$JAVA_HOME/include"
7157         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7158         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7159         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7160         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7161         ;;
7163     k*bsd*-gnu*)
7164         JAVAINC="-I$JAVA_HOME/include"
7165         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7166         ;;
7168     linux-gnu*)
7169         JAVAINC="-I$JAVA_HOME/include"
7170         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7171         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7172         ;;
7174     mingw*)
7175         JAVAINC="-I$JAVA_HOME/include"
7176         ;;
7178     *netbsd*)
7179         JAVAINC="-I$JAVA_HOME/include"
7180         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7181         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7182        ;;
7184     openbsd*)
7185         JAVAINC="-I$JAVA_HOME/include"
7186         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7187         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7188         ;;
7190     solaris*)
7191         JAVAINC="-I$JAVA_HOME/include"
7192         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7193         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7194         ;;
7195     esac
7197 SOLARINC="$SOLARINC $JAVAINC"
7199 AC_SUBST(JAVACOMPILER)
7200 AC_SUBST(JAVADOC)
7201 AC_SUBST(JAVAINTERPRETER)
7202 AC_SUBST(JAVAIFLAGS)
7203 AC_SUBST(JAVAFLAGS)
7204 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7205 AC_SUBST(JAVA_HOME)
7206 AC_SUBST(JAVA_SOURCE_VER)
7207 AC_SUBST(JAVA_TARGET_VER)
7208 AC_SUBST(JDK)
7210 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7211 if test -n "$with_idlc_cpp"; then
7212     AC_MSG_RESULT([$with_idlc_cpp])
7213     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7214 else
7215     AC_MSG_RESULT([ucpp])
7216     AC_MSG_CHECKING([which ucpp tp use])
7217     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7218         AC_MSG_RESULT([external])
7219         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7220     else
7221         AC_MSG_RESULT([internal])
7222         BUILD_TYPE="$BUILD_TYPE UCPP"
7223     fi
7225 AC_SUBST(SYSTEM_UCPP)
7227 dnl ===================================================================
7228 dnl Check for epm (not needed for Windows)
7229 dnl ===================================================================
7230 AC_MSG_CHECKING([whether to enable EPM for packing])
7231 if test "$enable_epm" = "yes"; then
7232     AC_MSG_RESULT([yes])
7233     if test "$_os" != "WINNT"; then
7234         if test $_os = Darwin; then
7235             EPM=internal
7236         elif test -n "$with_epm"; then
7237             EPM=$with_epm
7238         else
7239             AC_PATH_PROG(EPM, epm, no)
7240         fi
7241         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7242             AC_MSG_NOTICE([EPM will be built.])
7243             BUILD_TYPE="$BUILD_TYPE EPM"
7244             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7245         else
7246             # Gentoo has some epm which is something different...
7247             AC_MSG_CHECKING([whether the found epm is the right epm])
7248             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7249                 AC_MSG_RESULT([yes])
7250             else
7251                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7252             fi
7253             AC_MSG_CHECKING([epm version])
7254             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7255             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7256                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7257                 AC_MSG_RESULT([OK, >= 3.7])
7258             else
7259                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7260                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7261             fi
7262         fi
7263     fi
7265     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7266         AC_MSG_CHECKING([for rpm])
7267         for a in "$RPM" rpmbuild rpm; do
7268             $a --usage >/dev/null 2> /dev/null
7269             if test $? -eq 0; then
7270                 RPM=$a
7271                 break
7272             else
7273                 $a --version >/dev/null 2> /dev/null
7274                 if test $? -eq 0; then
7275                     RPM=$a
7276                     break
7277                 fi
7278             fi
7279         done
7280         if test -z "$RPM"; then
7281             AC_MSG_ERROR([not found])
7282         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7283             RPM_PATH=`which $RPM`
7284             AC_MSG_RESULT([$RPM_PATH])
7285             SCPDEFS="$SCPDEFS -DWITH_RPM"
7286         else
7287             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7288         fi
7289     fi
7290     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7291         AC_PATH_PROG(DPKG, dpkg, no)
7292         if test "$DPKG" = "no"; then
7293             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7294         fi
7295     fi
7296     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7297        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7298         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7299             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7300                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7301                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7302                     AC_MSG_RESULT([yes])
7303                 else
7304                     AC_MSG_RESULT([no])
7305                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7306                         _pt="rpm"
7307                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7308                         add_warning "the rpms will need to be installed with --nodeps"
7309                     else
7310                         _pt="pkg"
7311                     fi
7312                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7313                     add_warning "the ${_pt}s will not be relocateable"
7314                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7315                                  relocation will work, you need to patch your epm with the
7316                                  patch in epm/epm-3.7.patch or build with
7317                                  --with-epm=internal which will build a suitable epm])
7318                 fi
7319             fi
7320         fi
7321     fi
7322     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7323         AC_PATH_PROG(PKGMK, pkgmk, no)
7324         if test "$PKGMK" = "no"; then
7325             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7326         fi
7327     fi
7328     AC_SUBST(RPM)
7329     AC_SUBST(DPKG)
7330     AC_SUBST(PKGMK)
7331 else
7332     for i in $PKGFORMAT; do
7333         case "$i" in
7334         aix | bsd | deb | pkg | rpm | native | portable)
7335             AC_MSG_ERROR(
7336                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7337             ;;
7338         esac
7339     done
7340     AC_MSG_RESULT([no])
7341     EPM=NO
7343 AC_SUBST(EPM)
7345 dnl ===================================================================
7346 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7347 dnl ===================================================================
7348 WINEGCC=
7349 if test "$enable_winegcc" = "yes"; then
7350     AC_PATH_PROG(WINEGCC, winegcc)
7351     if test "$WINEGCC" = ""; then
7352         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7353     fi
7354     CC_save="$CC"
7355     ac_exeext_save="$ac_exeext"
7356     CC="$WINEGCC -m32"
7357     ac_exeext=".exe"
7358     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7359 #include <stdio.h>
7360         ],[
7361 printf ("hello world\n");
7362         ])],,
7363         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7364     )
7365     CC="$CC_save"
7366     ac_exeext="$ac_exeext_save"
7368 AC_SUBST(WINEGCC)
7370 if test $_os = iOS; then
7371     enable_mpl_subset=yes
7372     enable_lotuswordpro=no
7373     enable_coinmp=yes
7374     enable_lpsolve=no
7375     enable_postgresql_sdbc=no
7376     enable_extension_integration=no
7377     enable_report_builder=no
7378     with_theme="tango"
7379     with_ppds=no
7382 ENABLE_LWP=
7383 if test "$enable_lotuswordpro" = "yes"; then
7384     ENABLE_LWP="TRUE"
7385     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7387 AC_SUBST(ENABLE_LWP)
7389 dnl ===================================================================
7390 dnl Check for gperf
7391 dnl ===================================================================
7392 AC_PATH_PROG(GPERF, gperf)
7393 if test -z "$GPERF"; then
7394     AC_MSG_ERROR([gperf not found but needed. Install it.])
7396 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7397     GPERF=`cygpath -m $GPERF`
7399 AC_MSG_CHECKING([gperf version])
7400 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7401     AC_MSG_RESULT([OK])
7402 else
7403     AC_MSG_ERROR([too old, you need at least 3.0.0])
7405 AC_SUBST(GPERF)
7407 dnl ===================================================================
7408 dnl Check for building ODK
7409 dnl ===================================================================
7410 if test "$enable_odk" = no; then
7411     unset DOXYGEN
7412 else
7413     if test "$with_doxygen" = no; then
7414         AC_MSG_CHECKING([for doxygen])
7415         unset DOXYGEN
7416         AC_MSG_RESULT([no])
7417     else
7418         if test "$with_doxygen" = yes; then
7419             AC_PATH_PROG([DOXYGEN], [doxygen])
7420             if test -z "$DOXYGEN"; then
7421                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7422             fi
7423         else
7424             AC_MSG_CHECKING([for doxygen])
7425             DOXYGEN=$with_doxygen
7426             AC_MSG_RESULT([$DOXYGEN])
7427         fi
7428         if test -n "$DOXYGEN"; then
7429             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7430             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7431             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7432                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7433             fi
7434         fi
7435     fi
7437 AC_SUBST([DOXYGEN])
7439 AC_MSG_CHECKING([whether to build the ODK])
7440 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7441     AC_MSG_RESULT([yes])
7443     if test "$with_java" != "no"; then
7444         AC_MSG_CHECKING([whether to build unowinreg.dll])
7445         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7446             # build on Win by default
7447             enable_build_unowinreg=yes
7448         fi
7449         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7450             AC_MSG_RESULT([no])
7451             BUILD_UNOWINREG=
7452         else
7453             AC_MSG_RESULT([yes])
7454             BUILD_UNOWINREG=TRUE
7455         fi
7456         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7457             if test -z "$with_mingw_cross_compiler"; then
7458                 dnl Guess...
7459                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7460             elif test -x "$with_mingw_cross_compiler"; then
7461                  MINGWCXX="$with_mingw_cross_compiler"
7462             else
7463                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7464             fi
7466             if test "$MINGWCXX" = "false"; then
7467                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7468             fi
7470             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7471             if test -x "$mingwstrip_test"; then
7472                 MINGWSTRIP="$mingwstrip_test"
7473             else
7474                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7475             fi
7477             if test "$MINGWSTRIP" = "false"; then
7478                 AC_MSG_ERROR(MinGW32 binutils not found.)
7479             fi
7480         fi
7481     fi
7482     BUILD_TYPE="$BUILD_TYPE ODK"
7483 else
7484     AC_MSG_RESULT([no])
7485     BUILD_UNOWINREG=
7487 AC_SUBST(BUILD_UNOWINREG)
7488 AC_SUBST(MINGWCXX)
7489 AC_SUBST(MINGWSTRIP)
7491 dnl ===================================================================
7492 dnl Check for system zlib
7493 dnl ===================================================================
7494 if test "$with_system_zlib" = "auto"; then
7495     case "$_os" in
7496     WINNT)
7497         with_system_zlib="$with_system_libs"
7498         ;;
7499     *)
7500         with_system_zlib=yes
7501         ;;
7502     esac
7505 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7506 dnl and has no pkg-config for it at least on some tinderboxes,
7507 dnl so leaving that out for now
7508 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7509 AC_MSG_CHECKING([which zlib to use])
7510 if test "$with_system_zlib" = "yes"; then
7511     AC_MSG_RESULT([external])
7512     SYSTEM_ZLIB=TRUE
7513     if test "$_os" != "Emscripten"; then
7514         # Emscripten provides its own zlib, don't check for that
7515         AC_CHECK_HEADER(zlib.h, [],
7516             [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7517         AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
7518             [AC_MSG_ERROR(zlib not found or functional)], [])
7519     fi
7520 else
7521     AC_MSG_RESULT([internal])
7522     SYSTEM_ZLIB=
7523     BUILD_TYPE="$BUILD_TYPE ZLIB"
7524     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7525     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7527 AC_SUBST(ZLIB_CFLAGS)
7528 AC_SUBST(ZLIB_LIBS)
7529 AC_SUBST(SYSTEM_ZLIB)
7531 dnl ===================================================================
7532 dnl Check for system jpeg
7533 dnl ===================================================================
7534 AC_MSG_CHECKING([which libjpeg to use])
7535 if test "$with_jpeg_turbo" = "auto"; then
7536     # TODO use jpeg-turbo on Darwin too
7537     case "$_os" in
7538     WINNT)
7539         with_jpeg_turbo=yes
7540         ;;
7541     *)
7542         with_jpeg_turbo=no
7543         ;;
7544     esac
7547 if test "$with_system_jpeg" = "yes"; then
7548     AC_MSG_RESULT([external])
7549     SYSTEM_JPEG=TRUE
7550     AC_CHECK_HEADER(jpeglib.h, [],
7551         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7552     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
7553     [AC_MSG_CHECKING(jpeg library not found or fuctional)], [])
7554     libo_MINGW_CHECK_DLL([libjpeg])
7555 else
7556     SYSTEM_JPEG=
7557     if test "$with_jpeg_turbo" = "yes"; then
7558         AC_MSG_RESULT([internal, jpeg-turbo])
7559         BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7560         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7562         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7563             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7564                 NASM="$LODE_HOME/opt/bin/nasm"
7565             elif test -x "/opt/lo/bin/nasm"; then
7566                 NASM="/opt/lo/bin/nasm"
7567             fi
7568         fi
7569         if test -z "$NASM"; then
7570 cat << _EOS
7571 ****************************************************************************
7572 You need nasm (Netwide Assembler) to build internal jpeg library.
7573 To get one please do:
7575 _EOS
7576         if test "$build_os" = "cygwin"; then
7577 cat << _EOS
7578 install a pre-compiled binary for Win32
7580  mkdir -p /opt/lo/bin
7581  cd /opt/lo/bin
7582  wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7583  chmod +x nasm
7584 _EOS
7585             else
7586 cat << _EOS
7587 consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
7588 _EOS
7589             fi
7590 cat << _EOS
7592 or get and install one from http://www.nasm.us/
7594 Then re-run autogen.sh
7596 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7597 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7599 _EOS
7600         AC_MSG_ERROR([no nasm (Netwide Assembler) found])
7601         fi
7602     else
7603         AC_MSG_RESULT([internal, jpeg])
7604         BUILD_TYPE="$BUILD_TYPE JPEG"
7605     fi
7607 AC_SUBST(NASM)
7608 AC_SUBST(SYSTEM_JPEG)
7610 dnl ===================================================================
7611 dnl Check for system clucene
7612 dnl ===================================================================
7613 dnl we should rather be using
7614 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7615 dnl but the contribs-lib check seems tricky
7616 AC_MSG_CHECKING([which clucene to use])
7617 if test "$with_system_clucene" = "yes"; then
7618     AC_MSG_RESULT([external])
7619     SYSTEM_CLUCENE=TRUE
7620     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7621     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7622     FilterLibs "${CLUCENE_LIBS}"
7623     CLUCENE_LIBS="${filteredlibs}"
7624     AC_LANG_PUSH([C++])
7625     save_CXXFLAGS=$CXXFLAGS
7626     save_CPPFLAGS=$CPPFLAGS
7627     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7628     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7629     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7630     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7631     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7632                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7633     CXXFLAGS=$save_CXXFLAGS
7634     CPPFLAGS=$save_CPPFLAGS
7635     AC_LANG_POP([C++])
7637     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7638 else
7639     AC_MSG_RESULT([internal])
7640     SYSTEM_CLUCENE=
7641     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7643 AC_SUBST(SYSTEM_CLUCENE)
7644 AC_SUBST(CLUCENE_CFLAGS)
7645 AC_SUBST(CLUCENE_LIBS)
7647 dnl ===================================================================
7648 dnl Check for system expat
7649 dnl ===================================================================
7650 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7651 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7652 AC_MSG_CHECKING([which expat to use])
7653 if test "$with_system_expat" = "yes"; then
7654     AC_MSG_RESULT([external])
7655     SYSTEM_EXPAT=TRUE
7656     AC_CHECK_HEADER(expat.h, [],
7657         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7658     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7659         [AC_MSG_RESULT(expat library not found or functional.)], [])
7660     libo_MINGW_CHECK_DLL([libexpat])
7661 else
7662     AC_MSG_RESULT([internal])
7663     SYSTEM_EXPAT=
7664     BUILD_TYPE="$BUILD_TYPE EXPAT"
7666 AC_SUBST(SYSTEM_EXPAT)
7668 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7669 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7670     ENABLE_EOT="TRUE"
7671     AC_DEFINE([ENABLE_EOT])
7672     AC_MSG_RESULT([yes])
7674     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7675 else
7676     ENABLE_EOT=
7677     AC_MSG_RESULT([no])
7679 AC_SUBST([ENABLE_EOT])
7681 dnl ===================================================================
7682 dnl Check for system librevenge
7683 dnl ===================================================================
7684 AS_IF([test "$COM" = "MSC"],
7685       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7686       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7688 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7690 dnl ===================================================================
7691 dnl Check for system libe-book
7692 dnl ===================================================================
7693 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7694 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7696 dnl ===================================================================
7697 dnl Check for system libetonyek
7698 dnl ===================================================================
7699 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7700 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
7702 dnl ===================================================================
7703 dnl Check for system libfreehand
7704 dnl ===================================================================
7705 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7707 dnl ===================================================================
7708 dnl Check for system libodfgen
7709 dnl ===================================================================
7710 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7712 dnl ===================================================================
7713 dnl Check for system libcdr
7714 dnl ===================================================================
7715 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7717 dnl ===================================================================
7718 dnl Check for system libmspub
7719 dnl ===================================================================
7720 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7722 dnl ===================================================================
7723 dnl Check for system libmwaw
7724 dnl ===================================================================
7725 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7726 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.7])
7728 dnl ===================================================================
7729 dnl Check for system libpagemaker
7730 dnl ===================================================================
7731 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7733 dnl ===================================================================
7734 dnl Check for system libvisio
7735 dnl ===================================================================
7736 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7738 dnl ===================================================================
7739 dnl Check for system libcmis
7740 dnl ===================================================================
7741 # libcmis requires curl and we can't build curl for iOS
7742 if test $_os != iOS; then
7743     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7744     ENABLE_CMIS=TRUE
7745 else
7746     ENABLE_CMIS=
7748 AC_SUBST(ENABLE_CMIS)
7750 dnl ===================================================================
7751 dnl Check for system libwpd
7752 dnl ===================================================================
7753 AS_IF([test "$COM" = "MSC"],
7754       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7755       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7757 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7759 dnl ===================================================================
7760 dnl Check for system lcms2
7761 dnl ===================================================================
7762 if test "$with_system_lcms2" = "yes"; then
7763     libo_MINGW_CHECK_DLL([liblcms2])
7764 else
7765     SYSTEM_LCMS2=
7767 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7768 if test "$GCC" = "yes"; then
7769     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7771 if test "$COM" = "MSC"; then # override the above
7772     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7775 dnl ===================================================================
7776 dnl Check for system cppunit
7777 dnl ===================================================================
7778 if test "$cross_compiling" != "yes"; then
7779     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7782 dnl ===================================================================
7783 dnl Check whether freetype is available
7784 dnl ===================================================================
7785 if test  "$test_freetype" = "yes"; then
7786     AC_MSG_CHECKING([whether freetype is available])
7787     # FreeType has 3 different kinds of versions
7788     # * release, like 2.4.10
7789     # * libtool, like 13.0.7 (this what pkg-config returns)
7790     # * soname
7791     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7792     #
7793     # 9.9.3 is 2.2.0
7794     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7795     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7796     FilterLibs "${FREETYPE_LIBS}"
7797     FREETYPE_LIBS="${filteredlibs}"
7798     SYSTEM_FREETYPE=TRUE
7799     _save_libs="$LIBS"
7800     _save_cflags="$CFLAGS"
7801     LIBS="$LIBS $FREETYPE_LIBS"
7802     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7803     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7804     LIBS="$_save_libs"
7805     CFLAGS="$_save_cflags"
7807 AC_SUBST(FREETYPE_CFLAGS)
7808 AC_SUBST(FREETYPE_LIBS)
7809 AC_SUBST([SYSTEM_FREETYPE])
7811 dnl ===================================================================
7812 dnl Check for system libabw
7813 dnl ===================================================================
7814 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7816 dnl ===================================================================
7817 dnl Check for system libwps
7818 dnl ===================================================================
7819 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7820 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.2])
7822 dnl ===================================================================
7823 dnl Check for system libwpg
7824 dnl ===================================================================
7825 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7827 # ===================================================================
7828 # Check for system libxslt
7829 # to prevent incompatibilities between internal libxml2 and external libxslt,
7830 # or vice versa, use with_system_libxml here
7831 # ===================================================================
7832 if test "$with_system_libxml" = "auto"; then
7833     case "$_os" in
7834     WINNT|iOS|Android)
7835         with_system_libxml="$with_system_libs"
7836         ;;
7837     *)
7838         with_system_libxml=yes
7839         ;;
7840     esac
7843 AC_MSG_CHECKING([which libxslt to use])
7844 if test "$with_system_libxml" = "yes"; then
7845     AC_MSG_RESULT([external])
7846     SYSTEM_LIBXSLT=TRUE
7847     if test "$_os" = "Darwin"; then
7848         dnl make sure to use SDK path
7849         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7850         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7851         dnl omit -L/usr/lib
7852         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7853         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7854     else
7855         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7856         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7857         FilterLibs "${LIBXSLT_LIBS}"
7858         LIBXSLT_LIBS="${filteredlibs}"
7859         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7860         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7861         FilterLibs "${LIBEXSLT_LIBS}"
7862         LIBEXSLT_LIBS="${filteredlibs}"
7863     fi
7865     dnl Check for xsltproc
7866     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7867     if test "$XSLTPROC" = "no"; then
7868         AC_MSG_ERROR([xsltproc is required])
7869     fi
7871     libo_MINGW_CHECK_DLL([libxslt])
7872     libo_MINGW_CHECK_DLL([libexslt])
7873     libo_MINGW_TRY_DLL([iconv])
7874 else
7875     AC_MSG_RESULT([internal])
7876     SYSTEM_LIBXSLT=
7877     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7879     if test "$cross_compiling" = "yes"; then
7880         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7881         if test "$XSLTPROC" = "no"; then
7882             AC_MSG_ERROR([xsltproc is required])
7883         fi
7884     fi
7886 AC_SUBST(SYSTEM_LIBXSLT)
7887 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7888     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7890 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7892 AC_SUBST(LIBEXSLT_CFLAGS)
7893 AC_SUBST(LIBEXSLT_LIBS)
7894 AC_SUBST(LIBXSLT_CFLAGS)
7895 AC_SUBST(LIBXSLT_LIBS)
7896 AC_SUBST(XSLTPROC)
7898 # ===================================================================
7899 # Check for system libxml
7900 # ===================================================================
7901 AC_MSG_CHECKING([which libxml to use])
7902 if test "$with_system_libxml" = "yes"; then
7903     AC_MSG_RESULT([external])
7904     SYSTEM_LIBXML=TRUE
7905     if test "$_os" = "Darwin"; then
7906         dnl make sure to use SDK path
7907         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7908         dnl omit -L/usr/lib
7909         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
7910     elif test $_os = iOS; then
7911         dnl make sure to use SDK path
7912         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
7913         LIBXML_CFLAGS="-I$usr/include/libxml2"
7914         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
7915     else
7916         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
7917         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7918         FilterLibs "${LIBXML_LIBS}"
7919         LIBXML_LIBS="${filteredlibs}"
7920     fi
7922     dnl Check for xmllint
7923     AC_PATH_PROG(XMLLINT, xmllint, no)
7924     if test "$XMLLINT" = "no"; then
7925         AC_MSG_ERROR([xmllint is required])
7926     fi
7928     libo_MINGW_CHECK_DLL([libxml2])
7929     libo_MINGW_TRY_DLL([zlib1])
7930 else
7931     AC_MSG_RESULT([internal])
7932     SYSTEM_LIBXML=
7933     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
7934     if test "$COM" = "MSC"; then
7935         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
7936     fi
7937     if test "$COM" = "MSC"; then
7938         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
7939     else
7940         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
7941     fi
7942     BUILD_TYPE="$BUILD_TYPE LIBXML2"
7944 AC_SUBST(SYSTEM_LIBXML)
7945 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
7946     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
7948 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
7949 AC_SUBST(LIBXML_CFLAGS)
7950 AC_SUBST(LIBXML_LIBS)
7951 AC_SUBST(XMLLINT)
7953 # =====================================================================
7954 # Checking for a Python interpreter with version >= 2.6.
7955 # Build and runtime requires Python 3 compatible version (>= 2.6).
7956 # Optionally user can pass an option to configure, i. e.
7957 # ./configure PYTHON=/usr/bin/python
7958 # =====================================================================
7959 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
7960     # This allows a lack of system python with no error, we use internal one in that case.
7961     AM_PATH_PYTHON([2.6],, [:])
7962     # Clean PYTHON_VERSION checked below if cross-compiling
7963     PYTHON_VERSION=""
7964     if test "$PYTHON" != ":"; then
7965         PYTHON_FOR_BUILD=$PYTHON
7966     fi
7968 AC_SUBST(PYTHON_FOR_BUILD)
7970 # Checks for Python to use for Pyuno
7971 AC_MSG_CHECKING([which Python to use for Pyuno])
7972 case "$enable_python" in
7973 no|disable)
7974     if test -z $PYTHON_FOR_BUILD; then
7975         # Python is required to build LibreOffice. In theory we could separate the build-time Python
7976         # requirement from the choice whether to include Python stuff in the installer, but why
7977         # bother?
7978         AC_MSG_ERROR([Python is required at build time.])
7979     fi
7980     enable_python=no
7981     AC_MSG_RESULT([none])
7982     ;;
7983 ""|yes|auto)
7984     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
7985         AC_MSG_RESULT([no, overridden by --disable-scripting])
7986         enable_python=no
7987     elif test $build_os = cygwin; then
7988         dnl When building on Windows we don't attempt to use any installed
7989         dnl "system"  Python.
7990         dnl
7991         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
7992         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
7993         dnl MinGW cross-compilation setups.)
7994         AC_MSG_RESULT([fully internal])
7995         enable_python=internal
7996     elif test "$cross_compiling" = yes; then
7997         AC_MSG_RESULT([system])
7998         enable_python=system
7999     else
8000         # Unset variables set by the above AM_PATH_PYTHON so that
8001         # we actually do check anew.
8002         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
8003         AM_PATH_PYTHON([3.3],, [:])
8004         if test "$PYTHON" = ":"; then
8005             if test -z "$PYTHON_FOR_BUILD"; then
8006                 AC_MSG_RESULT([fully internal])
8007             else
8008                 AC_MSG_RESULT([internal])
8009             fi
8010             enable_python=internal
8011         else
8012             AC_MSG_RESULT([system])
8013             enable_python=system
8014         fi
8015     fi
8016     ;;
8017 internal)
8018     AC_MSG_RESULT([internal])
8019     ;;
8020 fully-internal)
8021     AC_MSG_RESULT([fully internal])
8022     enable_python=internal
8023     ;;
8024 system)
8025     AC_MSG_RESULT([system])
8026     ;;
8028     AC_MSG_ERROR([Incorrect --enable-python option])
8029     ;;
8030 esac
8032 if test $enable_python != no; then
8033     BUILD_TYPE="$BUILD_TYPE PYUNO"
8036 if test $enable_python = system; then
8037     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8038         python_version=2.7
8039         PYTHON=python$python_version
8040         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8041             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8042             PYTHON_LIBS="-framework Python"
8043         else
8044             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8045             PYTHON_LIBS="`$PYTHON-config --libs`"
8046         fi
8047     fi
8048     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8049         # Fallback: Accept these in the environment, or as set above
8050         # for MacOSX.
8051         :
8052     elif test "$cross_compiling" != yes; then
8053         # Unset variables set by the above AM_PATH_PYTHON so that
8054         # we actually do check anew.
8055         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
8056         # This causes an error if no python command is found
8057         AM_PATH_PYTHON([3.3])
8058         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8059         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8060         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8061         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8062         if test -z "$PKG_CONFIG"; then
8063             PYTHON_CFLAGS="-I$python_include"
8064             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8065         elif $PKG_CONFIG --exists python-$python_version; then
8066             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8067             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8068         else
8069             PYTHON_CFLAGS="-I$python_include"
8070             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8071         fi
8072         FilterLibs "${PYTHON_LIBS}"
8073         PYTHON_LIBS="${filteredlibs}"
8074     else
8075         dnl How to find out the cross-compilation Python installation path?
8076         dnl Let's hardocode what we know for different distributions for now...
8077         for python_version in 2.6; do
8078             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8079                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8080                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8081                 AC_MSG_CHECKING([for python.exe])
8082                 libo_MINGW_CHECK_DLL([libpython$python_version])
8083                 libo_MINGW_CHECK_DLL([libreadline6])
8084                 libo_MINGW_CHECK_DLL([libtermcap])
8085                 # could we somehow extract the really mingw python version from
8086                 # actual distro package?
8087                 # 2.6.2 currently on OpenSUSE 12.1?
8088                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8089                 PYTHON_VERSION=$python_version.2
8090                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8091                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8092                 break
8093             fi
8094         done
8095         AC_MSG_CHECKING([for python version])
8096         AS_IF([test -n "$PYTHON_VERSION"],
8097               [AC_MSG_RESULT([$PYTHON_VERSION])],
8098               [AC_MSG_RESULT([not found])
8099                AC_MSG_ERROR([no usable python found])])
8100         test -n "$PYTHON_CFLAGS" && break
8101     fi
8102     # let the PYTHON_FOR_BUILD match the same python installation that
8103     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8104     # better for PythonTests.
8105     PYTHON_FOR_BUILD=$PYTHON
8108 dnl By now enable_python should be "system", "internal" or "no"
8109 case $enable_python in
8110 system)
8111     SYSTEM_PYTHON=TRUE
8113     if test "$CROSS_COMPILING" != TRUE; then
8114         dnl Check if the headers really work
8115         save_CPPFLAGS="$CPPFLAGS"
8116         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8117         AC_CHECK_HEADER(Python.h, [],
8118            [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8119            [])
8120         CPPFLAGS="$save_CPPFLAGS"
8122         AC_LANG_PUSH(C)
8123         CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8124         AC_MSG_CHECKING([for correct python library version])
8125            AC_RUN_IFELSE([AC_LANG_SOURCE([[
8126 #include <Python.h>
8128 int main(int argc, char **argv) {
8129        if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8130            (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8131        else return 1;
8133            ]])],[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])],[])
8134         CFLAGS=$save_CFLAGS
8135         AC_LANG_POP(C)
8137         dnl FIXME Check if the Python library can be linked with, too?
8138     fi
8139     ;;
8141 internal)
8142     SYSTEM_PYTHON=
8143     PYTHON_VERSION_MAJOR=3
8144     # On windows we are supporting two different python versions: 3.3 and 3.5.
8145     # We msut do it as long as we support MSVC 2013. Python 3.3 can be removed
8146     # when MSVC 2013 support was dropped.
8147     if test "$COM" = "MSC" -a "$VCVER" = "120"; then
8148         PYTHON_VERSION_MINOR=3
8149     else
8150         PYTHON_VERSION_MINOR=5
8151     fi
8152     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
8153     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8154     BUILD_TYPE="$BUILD_TYPE PYTHON"
8155     # Embedded Python dies without Home set
8156     if test "$HOME" = ""; then
8157         export HOME=""
8158     fi
8159     # bz2 tarball and bzip2 is not standard
8160     if test -z "$BZIP2"; then
8161         AC_PATH_PROG( BZIP2, bzip2)
8162         if test -z "$BZIP2"; then
8163             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8164         fi
8165     fi
8166     ;;
8168     DISABLE_PYTHON=TRUE
8169     SYSTEM_PYTHON=
8170     ;;
8172     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8173     ;;
8174 esac
8176 AC_SUBST(DISABLE_PYTHON)
8177 AC_SUBST(SYSTEM_PYTHON)
8178 AC_SUBST(PYTHON_CFLAGS)
8179 AC_SUBST(PYTHON_LIBS)
8180 AC_SUBST(PYTHON_VERSION)
8181 AC_SUBST(PYTHON_VERSION_MAJOR)
8182 AC_SUBST(PYTHON_VERSION_MINOR)
8184 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8185 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8186     AC_MSG_RESULT([yes])
8187     ENABLE_MARIADBC=TRUE
8188     MARIADBC_MAJOR=1
8189     MARIADBC_MINOR=0
8190     MARIADBC_MICRO=2
8191     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8192 else
8193     AC_MSG_RESULT([no])
8194     ENABLE_MARIADBC=
8196 AC_SUBST(ENABLE_MARIADBC)
8197 AC_SUBST(MARIADBC_MAJOR)
8198 AC_SUBST(MARIADBC_MINOR)
8199 AC_SUBST(MARIADBC_MICRO)
8201 if test "$ENABLE_MARIADBC" = "TRUE"; then
8203     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8205     dnl ===================================================================
8206     dnl Check for system MariaDB
8207     dnl ===================================================================
8208     AC_MSG_CHECKING([which MariaDB to use])
8209     if test "$with_system_mariadb" = "yes"; then
8210         AC_MSG_RESULT([external])
8211         SYSTEM_MARIADB=TRUE
8212         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8213         if test -z "$MARIADBCONFIG"; then
8214             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8215             if test -z "$MARIADBCONFIG"; then
8216                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8217                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8218             fi
8219         fi
8220         AC_MSG_CHECKING([MariaDB version])
8221         MARIADB_VERSION=`$MARIADBCONFIG --version`
8222         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8223         if test "$MARIADB_MAJOR" -ge "5"; then
8224             AC_MSG_RESULT([OK])
8225         else
8226             AC_MSG_ERROR([too old, use 5.0.x or later])
8227         fi
8228         AC_MSG_CHECKING([for MariaDB Client library])
8229         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8230         if test "$COM_IS_CLANG" = TRUE; then
8231             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8232         fi
8233         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8234         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8235         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8236         dnl linux32:
8237         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8238             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8239             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8240                 | sed -e 's|/lib64/|/lib/|')
8241         fi
8242         FilterLibs "${MARIADB_LIBS}"
8243         MARIADB_LIBS="${filteredlibs}"
8244         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8245         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8246         if test "$enable_bundle_mariadb" = "yes"; then
8247             AC_MSG_RESULT([yes])
8248             BUNDLE_MARIADB=TRUE
8249             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8251 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8253 /g' | grep -E '(mysqlclient|mariadb)')
8254             if test "$_os" = "Darwin"; then
8255                 LIBMARIADB=${LIBMARIADB}.dylib
8256             elif test "$_os" = "WINNT"; then
8257                 LIBMARIADB=${LIBMARIADB}.dll
8258             else
8259                 LIBMARIADB=${LIBMARIADB}.so
8260             fi
8261             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8262             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8263             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8264                 AC_MSG_RESULT([found.])
8265                 PathFormat "$LIBMARIADB_PATH"
8266                 LIBMARIADB_PATH="$formatted_path"
8267             else
8268                 AC_MSG_ERROR([not found.])
8269             fi
8270         else
8271             AC_MSG_RESULT([no])
8272             BUNDLE_MARIADB=
8273         fi
8274     else
8275         AC_MSG_RESULT([internal])
8276         SYSTEM_MARIADB=
8277         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8278         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8279         BUILD_TYPE="$BUILD_TYPE MARIADB"
8280     fi
8282     AC_SUBST(SYSTEM_MARIADB)
8283     AC_SUBST(MARIADB_CFLAGS)
8284     AC_SUBST(MARIADB_LIBS)
8285     AC_SUBST(LIBMARIADB)
8286     AC_SUBST(LIBMARIADB_PATH)
8287     AC_SUBST(BUNDLE_MARIADB)
8289     AC_LANG_PUSH([C++])
8290     dnl ===================================================================
8291     dnl Check for system MySQL C++ Connector
8292     dnl ===================================================================
8293     # FIXME!
8294     # who thought this too-generic cppconn dir was a good idea?
8295     AC_MSG_CHECKING([MySQL Connector/C++])
8296     if test "$with_system_mysql_cppconn" = "yes"; then
8297         AC_MSG_RESULT([external])
8298         SYSTEM_MYSQL_CPPCONN=TRUE
8299         AC_LANG_PUSH([C++])
8300         AC_CHECK_HEADER(mysql_driver.h, [],
8301                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8302         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8303                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8304         save_LIBS=$LIBS
8305         LIBS="$LIBS -lmysqlcppconn"
8306         AC_MSG_CHECKING([version])
8307         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8308 #include <mysql_driver.h>
8310 int main(int argc, char **argv) {
8311     sql::Driver *driver;
8312     driver = get_driver_instance();
8313     if (driver->getMajorVersion() > 1 || \
8314        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8315        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8316         return 0;
8317       else
8318         return 1;
8320       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
8322         AC_LANG_POP([C++])
8323         LIBS=$save_LIBS
8324     else
8325         AC_MSG_RESULT([internal])
8326         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8327         SYSTEM_MYSQL_CPPCONN=
8328     fi
8329     AC_LANG_POP([C++])
8331 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8333 dnl ===================================================================
8334 dnl Check for system hsqldb
8335 dnl ===================================================================
8336 if test "$with_java" != "no"; then
8337     HSQLDB_USE_JDBC_4_1=
8338     AC_MSG_CHECKING([which hsqldb to use])
8339     if test "$with_system_hsqldb" = "yes"; then
8340         AC_MSG_RESULT([external])
8341         SYSTEM_HSQLDB=TRUE
8342         if test -z $HSQLDB_JAR; then
8343             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8344         fi
8345         AC_CHECK_FILE($HSQLDB_JAR, [],
8346                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
8347         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8348         export HSQLDB_JAR
8349         if $PERL -e \
8350            'use Archive::Zip;
8351             my $file = "$ENV{'HSQLDB_JAR'}";
8352             my $zip = Archive::Zip->new( $file );
8353             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8354             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8355             {
8356                 push @l, split(/\n/, $mf);
8357                 foreach my $line (@l)
8358                 {
8359                     if ($line =~ m/Specification-Version:/)
8360                     {
8361                         ($t, $version) = split (/:/,$line);
8362                         $version =~ s/^\s//;
8363                         ($a, $b, $c, $d) = split (/\./,$version);
8364                         if ($c == "0" && $d > "8")
8365                         {
8366                             exit 0;
8367                         }
8368                         else
8369                         {
8370                             exit 1;
8371                         }
8372                     }
8373                 }
8374             }
8375             else
8376             {
8377                 exit 1;
8378             }'; then
8379             AC_MSG_RESULT([yes])
8380         else
8381             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8382         fi
8383     else
8384         AC_MSG_RESULT([internal])
8385         SYSTEM_HSQLDB=
8386         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8387         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8388         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8389         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8390             AC_MSG_RESULT([yes])
8391             HSQLDB_USE_JDBC_4_1=TRUE
8392         else
8393             AC_MSG_RESULT([no])
8394         fi
8395     fi
8396     AC_SUBST(SYSTEM_HSQLDB)
8397     AC_SUBST(HSQLDB_JAR)
8398     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8401 dnl ===================================================================
8402 dnl Check for PostgreSQL stuff
8403 dnl ===================================================================
8404 if test "x$enable_postgresql_sdbc" != "xno"; then
8405     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8407     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8408         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8409     fi
8410     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8411         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8412     fi
8414     postgres_interface=""
8415     if test "$with_system_postgresql" = "yes"; then
8416         postgres_interface="external PostgreSQL"
8417         SYSTEM_POSTGRESQL=TRUE
8418         if test "$_os" = Darwin; then
8419             supp_path=''
8420             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8421                 pg_supp_path="$P_SEP$d$pg_supp_path"
8422             done
8423         fi
8424         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8425         if test -z "$PGCONFIG"; then
8426             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8427         fi
8428         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8429         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8430         FilterLibs "${POSTGRESQL_LIB}"
8431         POSTGRESQL_LIB="${filteredlibs}"
8432     else
8433         # if/when anything else than PostgreSQL uses Kerberos,
8434         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8435         WITH_KRB5=
8436         WITH_GSSAPI=
8437         case "$_os" in
8438         Darwin)
8439             # MacOS X has system MIT Kerberos 5 since 10.4
8440             if test "$with_krb5" != "no"; then
8441                 WITH_KRB5=TRUE
8442                 save_LIBS=$LIBS
8443                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8444                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8445                 KRB5_LIBS=$LIBS
8446                 LIBS=$save_LIBS
8447                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8448                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8449                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8450                 LIBS=$save_LIBS
8451             fi
8452             if test "$with_gssapi" != "no"; then
8453                 WITH_GSSAPI=TRUE
8454                 save_LIBS=$LIBS
8455                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8456                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8457                 GSSAPI_LIBS=$LIBS
8458                 LIBS=$save_LIBS
8459             fi
8460             ;;
8461         WINNT)
8462             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8463                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8464             fi
8465             ;;
8466         Linux|GNU|*BSD|DragonFly)
8467             if test "$with_krb5" != "no"; then
8468                 WITH_KRB5=TRUE
8469                 save_LIBS=$LIBS
8470                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8471                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8472                 KRB5_LIBS=$LIBS
8473                 LIBS=$save_LIBS
8474                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8475                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8476                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8477                 LIBS=$save_LIBS
8478             fi
8479             if test "$with_gssapi" != "no"; then
8480                 WITH_GSSAPI=TRUE
8481                 save_LIBS=$LIBS
8482                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8483                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8484                 GSSAPI_LIBS=$LIBS
8485                 LIBS=$save_LIBS
8486             fi
8487             ;;
8488         *)
8489             if test "$with_krb5" = "yes"; then
8490                 WITH_KRB5=TRUE
8491                 save_LIBS=$LIBS
8492                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8493                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8494                 KRB5_LIBS=$LIBS
8495                 LIBS=$save_LIBS
8496                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8497                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8498                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8499                 LIBS=$save_LIBS
8500             fi
8501             if test "$with_gssapi" = "yes"; then
8502                 WITH_GSSAPI=TRUE
8503                 save_LIBS=$LIBS
8504                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8505                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8506                 LIBS=$save_LIBS
8507                 GSSAPI_LIBS=$LIBS
8508             fi
8509         esac
8511         if test -n "$with_libpq_path"; then
8512             SYSTEM_POSTGRESQL=TRUE
8513             postgres_interface="external libpq"
8514             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8515             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8516         else
8517             SYSTEM_POSTGRESQL=
8518             postgres_interface="internal"
8519             POSTGRESQL_LIB=""
8520             POSTGRESQL_INC="%OVERRIDE_ME%"
8521             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8522         fi
8523     fi
8525     AC_MSG_CHECKING([PostgreSQL C interface])
8526     AC_MSG_RESULT([$postgres_interface])
8528     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8529         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8530         save_CFLAGS=$CFLAGS
8531         save_CPPFLAGS=$CPPFLAGS
8532         save_LIBS=$LIBS
8533         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8534         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8535         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8536         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8537             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8538         CFLAGS=$save_CFLAGS
8539         CPPFLAGS=$save_CPPFLAGS
8540         LIBS=$save_LIBS
8541     fi
8542     BUILD_POSTGRESQL_SDBC=TRUE
8544 AC_SUBST(WITH_KRB5)
8545 AC_SUBST(WITH_GSSAPI)
8546 AC_SUBST(GSSAPI_LIBS)
8547 AC_SUBST(KRB5_LIBS)
8548 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8549 AC_SUBST(SYSTEM_POSTGRESQL)
8550 AC_SUBST(POSTGRESQL_INC)
8551 AC_SUBST(POSTGRESQL_LIB)
8553 dnl ===================================================================
8554 dnl Check for Firebird stuff
8555 dnl ===================================================================
8556 ENABLE_FIREBIRD_SDBC=""
8557 if test -z "$enable_firebird_sdbc" ; then
8558     if test "$_os" = "Darwin" -a ${MACOSX_SDK_VERSION:-0} -ge 101100 ; then
8559         AC_MSG_NOTICE([firebird does not build on 10.11.. default to --disable-firebird-sdbc ])
8560         enable_firebird_sdbc="no"
8561     else
8562         enable_firebird_sdbc="yes"
8563     fi
8565 if test "$enable_firebird_sdbc" = "yes" ; then
8566     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8568     dnl ===================================================================
8569     dnl Check for system Firebird
8570     dnl ===================================================================
8571     AC_MSG_CHECKING([which Firebird to use])
8572     if test "$with_system_firebird" = "yes"; then
8573         AC_MSG_RESULT([external])
8574         SYSTEM_FIREBIRD=TRUE
8575         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8576         if test -z "$FIREBIRDCONFIG"; then
8577             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8578             PKG_CHECK_MODULES(FIREBIRD, fbembed)
8579             FIREBIRD_VERSION=`pkg-config --modversion fbembed`
8580         else
8581             AC_MSG_NOTICE([fb_config found])
8582             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8583             AC_MSG_CHECKING([for Firebird Client library])
8584             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8585             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8586             FilterLibs "${FIREBIRD_LIBS}"
8587             FIREBIRD_LIBS="${filteredlibs}"
8588         fi
8589         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8590         AC_MSG_CHECKING([Firebird version])
8591         if test -n "${FIREBIRD_VERSION}"; then
8592             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8593             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8594             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8595                 AC_MSG_RESULT([OK])
8596             else
8597                 AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
8598             fi
8599         else
8600             __save_CFLAGS="${CFLAGS}"
8601             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8602             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8603 #if defined(FB_API_VER) && FB_API_VER == 25
8604 #else
8605 #error "Wrong Firebird API version"
8606 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is installed]))
8607             CFLAGS="${__save_CFLAGS}"
8608         fi
8609         ENABLE_FIREBIRD_SDBC="TRUE"
8610     elif test "$enable_database_connectivity" != yes; then
8611         AC_MSG_RESULT([none])
8612     elif test "$cross_compiling" = "yes"; then
8613         AC_MSG_RESULT([none])
8614     else
8615         dnl We need libatomic-ops for any non X86/X64 system
8616         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8617             dnl ===================================================================
8618             dnl Check for system libatomic-ops
8619             dnl ===================================================================
8620             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8621             if test "$with_system_libatomic_ops" = "yes"; then
8622                 SYSTEM_LIBATOMIC_OPS=TRUE
8623                 AC_CHECK_HEADERS(atomic_ops.h, [],
8624                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8625             else
8626                 SYSTEM_LIBATOMIC_OPS=
8627                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8628                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8629                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8630             fi
8631         fi
8633         AC_MSG_RESULT([internal])
8634         SYSTEM_FIREBIRD=
8635         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include"
8636         FIREBIRD_LIBS="-lfbembed"
8638         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8639         ENABLE_FIREBIRD_SDBC="TRUE"
8640     fi
8642 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8643 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8644 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8645 AC_SUBST(LIBATOMIC_OPS_LIBS)
8646 AC_SUBST(SYSTEM_FIREBIRD)
8647 AC_SUBST(FIREBIRD_CFLAGS)
8648 AC_SUBST(FIREBIRD_LIBS)
8649 dnl AC_SUBST([TOMMATH_CFLAGS])
8650 dnl AC_SUBST([TOMMATH_LIBS])
8652 dnl ===================================================================
8653 dnl Check for system curl
8654 dnl ===================================================================
8655 AC_MSG_CHECKING([which libcurl to use])
8656 if test "$with_system_curl" = "auto"; then
8657     with_system_curl="$with_system_libs"
8660 if test "$with_system_curl" = "yes"; then
8661     AC_MSG_RESULT([external])
8662     SYSTEM_CURL=TRUE
8664     # First try PKGCONFIG and then fall back
8665     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8667     if test -n "$CURL_PKG_ERRORS"; then
8668         AC_PATH_PROG(CURLCONFIG, curl-config)
8669         if test -z "$CURLCONFIG"; then
8670             AC_MSG_ERROR([curl development files not found])
8671         fi
8672         CURL_LIBS=`$CURLCONFIG --libs`
8673         FilterLibs "${CURL_LIBS}"
8674         CURL_LIBS="${filteredlibs}"
8675         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8676         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8678         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8679         case $curl_version in
8680         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8681         dnl so they need to be doubled to end up in the configure script
8682         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8683             AC_MSG_RESULT([yes])
8684             ;;
8685         *)
8686             AC_MSG_ERROR([no, you have $curl_version])
8687             ;;
8688         esac
8689     fi
8691     libo_MINGW_CHECK_DLL([libcurl])
8692     libo_MINGW_TRY_DLL([libintl])
8693     libo_MINGW_TRY_DLL([libidn])
8694     libo_MINGW_TRY_DLL([libnspr4])
8695     libo_MINGW_TRY_DLL([nssutil3])
8696     libo_MINGW_TRY_DLL([libplc4])
8697     libo_MINGW_TRY_DLL([libplds4])
8698     libo_MINGW_TRY_DLL([nss3])
8699     libo_MINGW_TRY_DLL([ssl3])
8700     libo_MINGW_TRY_DLL([libgpg-error])
8701     libo_MINGW_TRY_DLL([libgcrypt])
8702     libo_MINGW_TRY_DLL([libssh2])
8703     ENABLE_CURL=TRUE
8704 elif test $_os = iOS; then
8705     # Let's see if we need curl, I think not?
8706     AC_MSG_RESULT([none])
8707     ENABLE_CURL=
8708 else
8709     AC_MSG_RESULT([internal])
8710     SYSTEM_CURL=
8711     BUILD_TYPE="$BUILD_TYPE CURL"
8712     ENABLE_CURL=TRUE
8714 AC_SUBST(SYSTEM_CURL)
8715 AC_SUBST(CURL_CFLAGS)
8716 AC_SUBST(CURL_LIBS)
8717 AC_SUBST(ENABLE_CURL)
8719 dnl ===================================================================
8720 dnl Check for system boost
8721 dnl ===================================================================
8722 AC_MSG_CHECKING([which boost to use])
8723 if test "$with_system_boost" = "yes"; then
8724     AC_MSG_RESULT([external])
8725     SYSTEM_BOOST=TRUE
8726     AX_BOOST_BASE(1.47)
8727     AX_BOOST_DATE_TIME
8728     AX_BOOST_IOSTREAMS
8729     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8730     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8731     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8732         # if not found, try again with 'lib' prefix
8733         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8734     fi
8735     AC_LANG_PUSH([C++])
8736     save_CXXFLAGS=$CXXFLAGS
8737     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8738     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8739        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8740     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8741        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8742     AC_CHECK_HEADER(boost/function.hpp, [],
8743        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8744     AC_MSG_CHECKING([whether boost signals2 works])
8745     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/signals2/signal.hpp>]],
8746         [[ boost::signals2::signal<void()> s; s(); ]])],
8747         [AC_MSG_RESULT([yes])],
8748         [AC_MSG_ERROR([no, install boost >= 1.55 or use --without-system-boost])])
8749     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8750     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8751     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8752 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8753     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8754         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8755     else
8756         AC_MSG_RESULT([yes])
8757     fi
8758     CXXFLAGS=$save_CXXFLAGS
8759     AC_LANG_POP([C++])
8760     # this is in m4/ax_boost_base.m4
8761     FilterLibs "${BOOST_LDFLAGS}"
8762     BOOST_LDFLAGS="${filteredlibs}"
8763 else
8764     AC_MSG_RESULT([internal])
8765     BUILD_TYPE="$BUILD_TYPE BOOST"
8766     SYSTEM_BOOST=
8768 AC_SUBST(SYSTEM_BOOST)
8770 dnl ===================================================================
8771 dnl Check for system mdds
8772 dnl ===================================================================
8773 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds >= 0.12.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8775 dnl ===================================================================
8776 dnl Check for system glm
8777 dnl ===================================================================
8778 AC_MSG_CHECKING([which glm to use])
8779 if test "$with_system_glm" = "yes"; then
8780     AC_MSG_RESULT([external])
8781     SYSTEM_GLM=TRUE
8782     AC_LANG_PUSH([C++])
8783     AC_CHECK_HEADER([glm/glm.hpp], [],
8784        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8785     AC_LANG_POP([C++])
8786 else
8787     AC_MSG_RESULT([internal])
8788     BUILD_TYPE="$BUILD_TYPE GLM"
8789     SYSTEM_GLM=
8790     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8792 AC_SUBST([GLM_CFLAGS])
8793 AC_SUBST([SYSTEM_GLM])
8795 dnl ===================================================================
8796 dnl Check for system glew
8797 dnl ===================================================================
8798 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8799 AS_IF([test "$with_system_glew" = "yes"],
8800     [PKG_CHECK_EXISTS([glew >= 1.12.0], [AC_DEFINE([HAVE_GLEW_1_12])])],
8801     [AC_DEFINE([HAVE_GLEW_1_12])])
8803 dnl ===================================================================
8804 dnl Check for system glyphy
8805 dnl ===================================================================
8806 dnl We currently use GLyphy only on Windows
8807 if test $_os = WINNT; then
8808     libo_CHECK_SYSTEM_MODULE([glyphy], [GLYPHY], [glyphy >= 0.12.0], ["-I${WORKDIR}/UnpackedTarball/glyphy/src"])
8811 dnl ===================================================================
8812 dnl Check for system vigra
8813 dnl ===================================================================
8814 AC_MSG_CHECKING([which vigra to use])
8815 if test "$with_system_vigra" = "yes"; then
8816     AC_MSG_RESULT([external])
8817     SYSTEM_VIGRA=TRUE
8818     AC_LANG_PUSH([C++])
8819     AC_CHECK_HEADER(vigra/copyimage.hxx, [],
8820        [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
8821     AC_LANG_POP([C++])
8822 else
8823     AC_MSG_RESULT([internal])
8824     BUILD_TYPE="$BUILD_TYPE VIGRA"
8825     SYSTEM_VIGRA=
8827 AC_SUBST(SYSTEM_VIGRA)
8829 dnl ===================================================================
8830 dnl Check for system odbc
8831 dnl ===================================================================
8832 AC_MSG_CHECKING([which odbc headers to use])
8833 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
8834     AC_MSG_RESULT([external])
8835     SYSTEM_ODBC_HEADERS=TRUE
8837     if test "$build_os" = "cygwin"; then
8838         save_CPPFLAGS=$CPPFLAGS
8839         find_winsdk
8840         PathFormat "$winsdktest"
8841         CPPFLAGS="$CPPFLAGS -I$formatted_path/include/um -I$formatted_path/Include/$winsdklibsubdir/um -I$formatted_path/include -I$formatted_path/include/shared -I$formatted_path/include/$winsdklibsubdir/shared"
8842         AC_CHECK_HEADER(sqlext.h, [],
8843             [AC_MSG_ERROR(odbc not found. install odbc)],
8844             [#include <windows.h>])
8845         CPPFLAGS=$save_CPPFLAGS
8846     else
8847         AC_CHECK_HEADER(sqlext.h, [],
8848             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8849     fi
8850 elif test "$enable_database_connectivity" != yes; then
8851     AC_MSG_RESULT([none])
8852 else
8853     AC_MSG_RESULT([internal])
8854     SYSTEM_ODBC_HEADERS=
8856 AC_SUBST(SYSTEM_ODBC_HEADERS)
8859 dnl ===================================================================
8860 dnl Check for system openldap
8861 dnl ===================================================================
8863 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8864 AC_MSG_CHECKING([which openldap library to use])
8865 if test "$with_system_openldap" = "yes"; then
8866     AC_MSG_RESULT([external])
8867     SYSTEM_OPENLDAP=TRUE
8868     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8869     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8870     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8871 else
8872     AC_MSG_RESULT([internal])
8873     SYSTEM_OPENLDAP=
8874     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8877 AC_SUBST(SYSTEM_OPENLDAP)
8879 dnl ===================================================================
8880 dnl Check for TLS/SSL and cryptographic implementation to use
8881 dnl ===================================================================
8882 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8883 if test -n "$with_tls"; then
8884     case $with_tls in
8885     openssl)
8886         AC_DEFINE(USE_TLS_OPENSSL)
8887         TLS=OPENSSL
8889         if test "$enable_openssl" != "yes"; then
8890             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8891         fi
8893         # warn that OpenSSL has been selected but not all TLS code has this option
8894         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
8895         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
8896         ;;
8897     nss)
8898         AC_DEFINE(USE_TLS_NSS)
8899         TLS=NSS
8900         ;;
8901     *)
8902         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8903 openssl - OpenSSL
8904 nss - Mozilla's Network Security Services (NSS)
8905     ])
8906         ;;
8907     esac
8908 elif test $_os = iOS -o $_os = Android; then
8909     # We don't build NSS for iOS and Android
8910     AC_DEFINE(USE_TLS_OPENSSL)
8911     TLS=OPENSSL
8912 else
8913     # default to using NSS, it results in smaller oox lib
8914     AC_DEFINE(USE_TLS_NSS)
8915     TLS=NSS
8917 AC_MSG_RESULT([$TLS])
8918 AC_SUBST(TLS)
8920 dnl ===================================================================
8921 dnl Check for system NSS
8922 dnl ===================================================================
8923 if test $_os != iOS; then
8924     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8926 if test "$with_system_nss" = "yes"; then
8927     libo_MINGW_CHECK_DLL([libnspr4])
8928     libo_MINGW_CHECK_DLL([libplc4])
8929     libo_MINGW_CHECK_DLL([libplds4])
8930     libo_MINGW_CHECK_DLL([nss3])
8931     libo_MINGW_CHECK_DLL([nssutil3])
8932     libo_MINGW_CHECK_DLL([smime3])
8933     libo_MINGW_CHECK_DLL([ssl3])
8936 if test $_os = WINNT -a -z "$ENABLE_RELEASE_BUILD" -a "$with_prebuilt_openssl" = yes; then
8937     BUILD_TYPE="$BUILD_TYPE PREBUILT_OPENSSL"
8940 dnl ===================================================================
8941 dnl Check for system mozilla headers
8942 dnl ===================================================================
8943 HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
8944 AC_MSG_CHECKING([which NPAPI headers to use])
8946 if test "$with_system_npapi_headers" = "yes"; then
8947     AC_MSG_RESULT([external])
8948     SYSTEM_NPAPI_HEADERS=TRUE
8949     # First try npapi-sdk:
8950     PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no])
8951     # Then go with libxul:
8952     if test "x$LOCATED" != "xyes"; then
8953         PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no])
8954     fi
8955     if test "x$LOCATED" != "xyes"; then
8956         PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no])
8957     fi
8958     # if still not found bail out
8959     if test "x$LOCATED" != "xyes"; then
8960         AC_MSG_ERROR([npapi.h header file not found])
8961     fi
8963     AC_LANG_PUSH([C])
8964     save_CFLAGS=$CFLAGS
8965     CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS"
8966     AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
8967     AC_COMPILE_IFELSE(
8968         [AC_LANG_SOURCE([[
8969             #define XP_UNIX
8970             #include <npapi.h>
8971             const char* NPP_GetMIMEDescription(void) { return "foo"; }
8972             ]])],
8973         [AC_MSG_RESULT([const char*])],
8974         [
8975         AC_MSG_RESULT([char*])
8976         HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
8977         ])
8978     CFLAGS=$save_CFLAGS
8979     AC_LANG_POP([C])
8980     NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8981 else
8982     AC_MSG_RESULT([internal])
8983         dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER
8984     SYSTEM_NPAPI_HEADERS=
8986 AC_SUBST(NPAPI_HEADERS_CFLAGS)
8987 AC_SUBST(SYSTEM_NPAPI_HEADERS)
8988 AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
8990 dnl ===================================================================
8991 dnl Check for system sane
8992 dnl ===================================================================
8993 AC_MSG_CHECKING([which sane header to use])
8994 if test "$with_system_sane" = "yes"; then
8995     AC_MSG_RESULT([external])
8996     AC_CHECK_HEADER(sane/sane.h, [],
8997       [AC_MSG_ERROR(sane not found. install sane)], [])
8998 else
8999     AC_MSG_RESULT([internal])
9000     BUILD_TYPE="$BUILD_TYPE SANE"
9003 dnl ===================================================================
9004 dnl Check for system icu
9005 dnl ===================================================================
9006 SYSTEM_GENBRK=
9007 SYSTEM_GENCCODE=
9008 SYSTEM_GENCMN=
9010 ICU_MAJOR=56
9011 ICU_MINOR=1
9012 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9013 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9014 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9015 AC_MSG_CHECKING([which icu to use])
9016 if test "$with_system_icu" = "yes"; then
9017     AC_MSG_RESULT([external])
9018     SYSTEM_ICU=TRUE
9019     AC_LANG_PUSH([C++])
9020     AC_MSG_CHECKING([for unicode/rbbi.h])
9021     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9022     AC_LANG_POP([C++])
9024     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
9025         ICUPATH="$PATH"
9026         if test "$WITH_MINGW" = "yes"; then
9027             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
9028         fi
9029         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
9031         AC_MSG_CHECKING([ICU version])
9032         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9033         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9034         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9036         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "6" \); then
9037             AC_MSG_RESULT([OK, $ICU_VERSION])
9038         else
9039             AC_MSG_ERROR([not suitable, only >= 4.6 supported currently])
9040         fi
9041     fi
9043     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9044         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9045         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9046         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9047         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9048         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9049         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9050             AC_MSG_RESULT([yes])
9051         else
9052             AC_MSG_RESULT([no])
9053             if test "$with_system_icu_for_build" != "force"; then
9054                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9055 You can use --with-system-icu-for-build=force to use it anyway.])
9056             fi
9057         fi
9058     fi
9060     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9061         # using the system icu tools can lead to version confusion, use the
9062         # ones from the build environment when cross-compiling
9063         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9064         if test -z "$SYSTEM_GENBRK"; then
9065             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9066         fi
9067         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9068         if test -z "$SYSTEM_GENCCODE"; then
9069             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9070         fi
9071         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9072         if test -z "$SYSTEM_GENCMN"; then
9073             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9074         fi
9075         if test "$ICU_MAJOR" -ge "49"; then
9076             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9077             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9078             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9079         else
9080             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9081             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9082             ICU_RECLASSIFIED_HEBREW_LETTER=
9083         fi
9084     fi
9086     if test "$cross_compiling" = "yes"; then
9087         if test "$ICU_MAJOR" -ge "50"; then
9088             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9089             ICU_MINOR=""
9090         fi
9091     fi
9093     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9094     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9095     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9096 else
9097     AC_MSG_RESULT([internal])
9098     SYSTEM_ICU=
9099     BUILD_TYPE="$BUILD_TYPE ICU"
9100     # surprisingly set these only for "internal" (to be used by various other
9101     # external libs): the system icu-config is quite unhelpful and spits out
9102     # dozens of weird flags and also default path -I/usr/include
9103     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9104     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9106 AC_SUBST(SYSTEM_ICU)
9107 AC_SUBST(SYSTEM_GENBRK)
9108 AC_SUBST(SYSTEM_GENCCODE)
9109 AC_SUBST(SYSTEM_GENCMN)
9110 AC_SUBST(ICU_MAJOR)
9111 AC_SUBST(ICU_MINOR)
9112 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9113 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9114 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9115 AC_SUBST(ICU_CFLAGS)
9116 AC_SUBST(ICU_LIBS)
9118 dnl ===================================================================
9119 dnl Graphite
9120 dnl ===================================================================
9122 AC_MSG_CHECKING([whether to enable graphite support])
9123 if test $_os != Darwin -a $_os != Android -a $_os != iOS -a \( -z "$enable_graphite" -o "$enable_graphite" != no \); then
9124     AC_MSG_RESULT([yes])
9125     ENABLE_GRAPHITE="TRUE"
9126     AC_DEFINE(ENABLE_GRAPHITE)
9127     libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
9128     if test "$with_system_graphite" = "yes"; then
9129         libo_MINGW_CHECK_DLL([libgraphite2])
9130     fi
9131 else
9132     AC_MSG_RESULT([no])
9134 AC_SUBST(ENABLE_GRAPHITE)
9136 dnl ===================================================================
9137 dnl Orcus
9138 dnl ===================================================================
9140 AC_MSG_CHECKING([whether to enable orcus])
9141 if test -z "$enable_orcus" -o "$enable_orcus" != no; then
9142     AC_MSG_RESULT([yes])
9143     ENABLE_ORCUS="TRUE"
9144     AC_DEFINE(ENABLE_ORCUS)
9146     libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.10 >= 0.9.0])
9147     if test "$with_system_orcus" != "yes"; then
9148         if test "$SYSTEM_BOOST" = "TRUE"; then
9149             # ===========================================================
9150             # Determine if we are going to need to link with Boost.System
9151             # ===========================================================
9152             dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9153             dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9154             dnl in documentation has no effect.
9155             AC_MSG_CHECKING([if we need to link with Boost.System])
9156             AC_LANG_PUSH([C++])
9157             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9158                     @%:@include <boost/version.hpp>
9159                 ]],[[
9160                     #if BOOST_VERSION >= 105000
9161                     #   error yes, we need to link with Boost.System
9162                     #endif
9163                 ]])],[
9164                     AC_MSG_RESULT([no])
9165                 ],[
9166                     AC_MSG_RESULT([yes])
9167                     AX_BOOST_SYSTEM
9168             ])
9169             AC_LANG_POP([C++])
9170         fi
9171     fi
9172     dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9173     SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9174     AC_SUBST([BOOST_SYSTEM_LIB])
9175     AC_SUBST(SYSTEM_LIBORCUS)
9177 else
9178     AC_MSG_RESULT([no])
9180 AC_SUBST(ENABLE_ORCUS)
9182 dnl ===================================================================
9183 dnl HarfBuzz
9184 dnl ===================================================================
9185 AC_MSG_CHECKING([whether to enable HarfBuzz support])
9186 if test $_os != WINNT -a $_os != Darwin -a $_os != iOS; then
9187     AC_MSG_RESULT([yes])
9188     ENABLE_HARFBUZZ="TRUE"
9189     if $PKG_CONFIG --atleast-version 0.9.18 harfbuzz; then
9190         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"])
9191     else
9192         libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz >= 0.9.10],[-I${WORKDIR}/UnpackedTarball/harfbuzz/src],["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz -lharfbuzz-icu"])
9193     fi
9194 else
9195     AC_MSG_RESULT([no])
9197 AC_SUBST(ENABLE_HARFBUZZ)
9199 dnl ===================================================================
9200 dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents
9201 dnl ===================================================================
9202 AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents])
9203 # Obviously no such thing on iOS or Android. Also not possible when building
9204 # 64-bit OS X code as the plugin code uses QuickTime and Carbon.
9205 if test "$_os" != Android -a "$_os" != iOS -a $_os != Darwin -a \
9206         "$with_x" != "no" -a "$enable_mpl_subset" != yes
9207 then
9208     AC_MSG_RESULT([yes])
9209     ENABLE_NPAPI_FROM_BROWSER=TRUE
9210 else
9211     AC_MSG_RESULT([no])
9212     ENABLE_NPAPI_FROM_BROWSER=
9214 AC_SUBST(ENABLE_NPAPI_FROM_BROWSER)
9216 AC_MSG_CHECKING([whether to use X11])
9217 dnl ***************************************
9218 dnl testing for X libraries and includes...
9219 dnl ***************************************
9220 if test "$USING_X11" = TRUE; then
9221     AC_DEFINE(HAVE_FEATURE_X11)
9223 AC_MSG_RESULT([$USING_X11])
9225 if test "$USING_X11" = TRUE; then
9226     AC_PATH_X
9227     AC_PATH_XTRA
9228     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9230     if test -z "$x_includes"; then
9231         x_includes="default_x_includes"
9232     fi
9233     if test -z "$x_libraries"; then
9234         x_libraries="default_x_libraries"
9235     fi
9236     CFLAGS="$CFLAGS $X_CFLAGS"
9237     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9238     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9239 else
9240     x_includes="no_x_includes"
9241     x_libraries="no_x_libraries"
9244 if test "$USING_X11" = TRUE; then
9245     dnl ===================================================================
9246     dnl Check for Composite.h for Mozilla plugin
9247     dnl ===================================================================
9248     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9249      [#include <X11/Intrinsic.h>])
9251     # ENABLE_NPAPI_FROM_BROWSER requires Xt library
9252     AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:],
9253         [AC_MSG_ERROR(Xt library not found)])
9255     dnl ===================================================================
9256     dnl Check for extension headers
9257     dnl ===================================================================
9258     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9259      [#include <X11/extensions/shape.h>])
9261     # vcl needs ICE and SM
9262     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9263     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9264         [AC_MSG_ERROR(ICE library not found)])
9265     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9266     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9267         [AC_MSG_ERROR(SM library not found)])
9270 dnl ===================================================================
9271 dnl Check for system Xrender
9272 dnl ===================================================================
9273 AC_MSG_CHECKING([whether to use Xrender])
9274 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9275     AC_MSG_RESULT([yes])
9276     PKG_CHECK_MODULES(XRENDER, xrender)
9277     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9278     FilterLibs "${XRENDER_LIBS}"
9279     XRENDER_LIBS="${filteredlibs}"
9280     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9281       [AC_MSG_ERROR(libXrender not found or functional)], [])
9282     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9283       [AC_MSG_ERROR(Xrender not found. install X)], [])
9284 else
9285     AC_MSG_RESULT([no])
9287 AC_SUBST(XRENDER_CFLAGS)
9288 AC_SUBST(XRENDER_LIBS)
9290 dnl ===================================================================
9291 dnl Check for XRandr
9292 dnl ===================================================================
9293 AC_MSG_CHECKING([whether to enable RandR support])
9294 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9295     if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
9296         XRANDR_DLOPEN="TRUE"
9297         AC_MSG_RESULT([configured to dlopen libXrandr at runtime])
9298     else
9299         AC_MSG_RESULT([yes])
9300         XRANDR_DLOPEN="FALSE"
9301         PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9302         if test "$ENABLE_RANDR" != "TRUE"; then
9303             AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9304                         [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9305             XRANDR_CFLAGS=" "
9306             AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9307               [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9308             XRANDR_LIBS="-lXrandr "
9309             ENABLE_RANDR="TRUE"
9310         fi
9311         XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9312         FilterLibs "${XRANDR_LIBS}"
9313         XRANDR_LIBS="${filteredlibs}"
9314     fi
9315 else
9316     ENABLE_RANDR=""
9317     AC_MSG_RESULT([no])
9319 AC_SUBST(XRANDR_DLOPEN)
9320 AC_SUBST(XRANDR_CFLAGS)
9321 AC_SUBST(XRANDR_LIBS)
9322 AC_SUBST(ENABLE_RANDR)
9324 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9325     WITH_WEBDAV="serf"
9327 if test $_os = iOS -o $_os = Android; then
9328     WITH_WEBDAV="no"
9330 AC_MSG_CHECKING([for webdav library])
9331 case "$WITH_WEBDAV" in
9332 serf)
9333     AC_MSG_RESULT([serf])
9334     # Check for system apr-util
9335     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9336                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9337                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9338     if test "$COM" = "MSC"; then
9339         APR_LIB_DIR="LibR"
9340         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9341         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9342     fi
9344     # Check for system serf
9345     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9346                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9347     if test "$COM" = "MSC"; then
9348         SERF_LIB_DIR="Release"
9349         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9350         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9351     fi
9352     ;;
9353 neon)
9354     AC_MSG_RESULT([neon])
9355     # Check for system neon
9356     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9357     if test "$with_system_neon" = "yes"; then
9358         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9359         libo_MINGW_CHECK_DLL([libneon])
9360         libo_MINGW_TRY_DLL([libtasn1])
9361         libo_MINGW_TRY_DLL([libgnutls])
9362     else
9363         NEON_VERSION=0295
9364     fi
9365     AC_SUBST(NEON_VERSION)
9366     ;;
9368     AC_MSG_RESULT([none, disabled])
9369     WITH_WEBDAV=""
9370     ;;
9371 esac
9372 AC_SUBST(WITH_WEBDAV)
9374 dnl ===================================================================
9375 dnl Check for disabling cve_tests
9376 dnl ===================================================================
9377 AC_MSG_CHECKING([whether to execute CVE tests])
9378 # If not explicitly enabled or disabled, default
9379 if test -z "$enable_cve_tests"; then
9380     case "$OS" in
9381     WNT)
9382         # Default cves off for windows with its wild and wonderful
9383         # varienty of AV software kicking in and panicing
9384         enable_cve_tests=no
9385         ;;
9386     *)
9387         # otherwise yes
9388         enable_cve_tests=yes
9389         ;;
9390     esac
9392 if test "$enable_cve_tests" = "no"; then
9393     AC_MSG_RESULT([no])
9394     DISABLE_CVE_TESTS=TRUE
9395     AC_SUBST(DISABLE_CVE_TESTS)
9396 else
9397     AC_MSG_RESULT([yes])
9400 dnl ===================================================================
9401 dnl Check for enabling chart XShape tests
9402 dnl ===================================================================
9403 AC_MSG_CHECKING([whether to execute chart XShape tests])
9404 if test "$enable_chart_tests" = "yes"; then
9405     AC_MSG_RESULT([yes])
9406     ENABLE_CHART_TESTS=TRUE
9407     AC_SUBST(ENABLE_CHART_TESTS)
9408 else
9409     AC_MSG_RESULT([no])
9412 dnl ===================================================================
9413 dnl Check for system openssl
9414 dnl ===================================================================
9415 DISABLE_OPENSSL=
9416 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9417 if test "$enable_openssl" = "yes"; then
9418     AC_MSG_RESULT([no])
9419     if test "$_os" = Darwin ; then
9420         # OpenSSL is deprecated when building for 10.7 or later.
9421         #
9422         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9423         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9425         with_system_openssl=no
9426         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9427     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9428             && test "$with_system_openssl" != "no"; then
9429         with_system_openssl=yes
9430         SYSTEM_OPENSSL=TRUE
9431         OPENSSL_CFLAGS=
9432         OPENSSL_LIBS="-lssl -lcrypto"
9433     else
9434         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9435     fi
9436     if test "$with_system_openssl" = "yes"; then
9437         libo_MINGW_CHECK_DLL([libssl])
9438         libo_MINGW_CHECK_DLL([libcrypto])
9439         AC_MSG_CHECKING([whether openssl supports SHA512])
9440         AC_LANG_PUSH([C])
9441         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9442             SHA512_CTX context;
9443 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9444         AC_LANG_POP(C)
9445     fi
9446 else
9447     AC_MSG_RESULT([yes])
9448     DISABLE_OPENSSL=TRUE
9450     # warn that although OpenSSL is disabled, system libraries may be depending on it
9451     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9452     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9455 AC_SUBST([DISABLE_OPENSSL])
9457 dnl ===================================================================
9458 dnl Check for building gnutls
9459 dnl ===================================================================
9460 AC_MSG_CHECKING([whether to use gnutls])
9461 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9462     AC_MSG_RESULT([yes])
9463     AM_PATH_LIBGCRYPT()
9464     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9465         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9466                       available in the system to use as replacement.]]))
9467     FilterLibs "${LIBGCRYPT_LIBS}"
9468     LIBGCRYPT_LIBS="${filteredlibs}"
9469 else
9470     AC_MSG_RESULT([no])
9473 AC_SUBST([LIBGCRYPT_CFLAGS])
9474 AC_SUBST([LIBGCRYPT_LIBS])
9476 dnl ===================================================================
9477 dnl Check for system redland
9478 dnl ===================================================================
9479 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9480 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9481 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9482 if test "$with_system_redland" = "yes"; then
9483     libo_MINGW_CHECK_DLL([librdf])
9484     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9485             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9486     libo_MINGW_TRY_DLL([libraptor])
9487     libo_MINGW_TRY_DLL([librasqal])
9488     libo_MINGW_TRY_DLL([libsqlite3])
9489 else
9490     RAPTOR_MAJOR="0"
9491     RASQAL_MAJOR="3"
9492     REDLAND_MAJOR="0"
9494 AC_SUBST(RAPTOR_MAJOR)
9495 AC_SUBST(RASQAL_MAJOR)
9496 AC_SUBST(REDLAND_MAJOR)
9498 dnl ===================================================================
9499 dnl Check for system hunspell
9500 dnl ===================================================================
9501 AC_MSG_CHECKING([which libhunspell to use])
9502 if test "$with_system_hunspell" = "yes"; then
9503     AC_MSG_RESULT([external])
9504     SYSTEM_HUNSPELL=TRUE
9505     AC_LANG_PUSH([C++])
9506     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9507     if test "$HUNSPELL_PC" != "TRUE"; then
9508         AC_CHECK_HEADER(hunspell.hxx, [],
9509             [
9510             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9511             [AC_MSG_ERROR(hunspell headers not found.)], [])
9512             ], [])
9513         AC_CHECK_LIB([hunspell], [main], [:],
9514            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9515         HUNSPELL_LIBS=-lhunspell
9516     fi
9517     AC_LANG_POP([C++])
9518     libo_MINGW_CHECK_DLL([libhunspell-1.3])
9519     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9520     FilterLibs "${HUNSPELL_LIBS}"
9521     HUNSPELL_LIBS="${filteredlibs}"
9522 else
9523     AC_MSG_RESULT([internal])
9524     SYSTEM_HUNSPELL=
9525     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9526     if test "$COM" = "MSC"; then
9527         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9528     else
9529         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.3"
9530     fi
9531     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9533 AC_SUBST(SYSTEM_HUNSPELL)
9534 AC_SUBST(HUNSPELL_CFLAGS)
9535 AC_SUBST(HUNSPELL_LIBS)
9537 dnl ===================================================================
9538 dnl Checking for altlinuxhyph
9539 dnl ===================================================================
9540 AC_MSG_CHECKING([which altlinuxhyph to use])
9541 if test "$with_system_altlinuxhyph" = "yes"; then
9542     AC_MSG_RESULT([external])
9543     SYSTEM_HYPH=TRUE
9544     AC_CHECK_HEADER(hyphen.h, [],
9545        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9546     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9547        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9548        [#include <hyphen.h>])
9549     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9550         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9551     if test -z "$HYPHEN_LIB"; then
9552         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9553            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9554     fi
9555     if test -z "$HYPHEN_LIB"; then
9556         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9557            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9558     fi
9559     libo_MINGW_CHECK_DLL([libhyphen])
9560 else
9561     AC_MSG_RESULT([internal])
9562     SYSTEM_HYPH=
9563     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9564     if test "$COM" = "MSC"; then
9565         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9566     else
9567         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9568     fi
9570 AC_SUBST(SYSTEM_HYPH)
9571 AC_SUBST(HYPHEN_LIB)
9573 dnl ===================================================================
9574 dnl Checking for mythes
9575 dnl ===================================================================
9576 AC_MSG_CHECKING([which mythes to use])
9577 if test "$with_system_mythes" = "yes"; then
9578     AC_MSG_RESULT([external])
9579     SYSTEM_MYTHES=TRUE
9580     AC_LANG_PUSH([C++])
9581     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9582     if test "$MYTHES_PKGCONFIG" = "no"; then
9583         AC_CHECK_HEADER(mythes.hxx, [],
9584             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9585         AC_CHECK_LIB([mythes-1.2], [main], [:],
9586             [ MYTHES_FOUND=no], [])
9587     if test "$MYTHES_FOUND" = "no"; then
9588         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9589                 [ MYTHES_FOUND=no], [])
9590     fi
9591     if test "$MYTHES_FOUND" = "no"; then
9592         AC_MSG_ERROR([mythes library not found!.])
9593     fi
9594     fi
9595     AC_LANG_POP([C++])
9596     libo_MINGW_CHECK_DLL([libmythes-1.2])
9597     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9598     FilterLibs "${MYTHES_LIBS}"
9599     MYTHES_LIBS="${filteredlibs}"
9600 else
9601     AC_MSG_RESULT([internal])
9602     SYSTEM_MYTHES=
9603     BUILD_TYPE="$BUILD_TYPE MYTHES"
9604     if test "$COM" = "MSC"; then
9605         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9606     else
9607         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9608     fi
9610 AC_SUBST(SYSTEM_MYTHES)
9611 AC_SUBST(MYTHES_CFLAGS)
9612 AC_SUBST(MYTHES_LIBS)
9614 dnl ===================================================================
9615 dnl How should we build the linear programming solver ?
9616 dnl ===================================================================
9618 ENABLE_COINMP=
9619 AC_MSG_CHECKING([whether to build with CoinMP])
9620 if test "$enable_coinmp" != "no"; then
9621     ENABLE_COINMP=TRUE
9622     AC_MSG_RESULT([yes])
9623     if test "$with_system_coinmp" = "yes"; then
9624         SYSTEM_COINMP=TRUE
9625         PKG_CHECK_MODULES( COINMP, coinmp )
9626         FilterLibs "${COINMP_LIBS}"
9627         COINMP_LIBS="${filteredlibs}"
9628     else
9629         BUILD_TYPE="$BUILD_TYPE COINMP"
9630     fi
9631 else
9632     AC_MSG_RESULT([no])
9634 AC_SUBST(ENABLE_COINMP)
9635 AC_SUBST(SYSTEM_COINMP)
9636 AC_SUBST(COINMP_CFLAGS)
9637 AC_SUBST(COINMP_LIBS)
9639 ENABLE_LPSOLVE=
9640 AC_MSG_CHECKING([whether to build with lpsolve])
9641 if test "$enable_lpsolve" != "no"; then
9642     ENABLE_LPSOLVE=TRUE
9643     AC_MSG_RESULT([yes])
9644 else
9645     AC_MSG_RESULT([no])
9647 AC_SUBST(ENABLE_LPSOLVE)
9649 if test "$ENABLE_LPSOLVE" = TRUE; then
9650     AC_MSG_CHECKING([which lpsolve to use])
9651     if test "$with_system_lpsolve" = "yes"; then
9652         AC_MSG_RESULT([external])
9653         SYSTEM_LPSOLVE=TRUE
9654         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9655            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9656         save_LIBS=$LIBS
9657         # some systems need this. Like Ubuntu....
9658         AC_CHECK_LIB(m, floor)
9659         AC_CHECK_LIB(dl, dlopen)
9660         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9661             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9662         LIBS=$save_LIBS
9663         libo_MINGW_CHECK_DLL([lpsolve55])
9664     else
9665         AC_MSG_RESULT([internal])
9666         SYSTEM_LPSOLVE=
9667         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9668     fi
9670 AC_SUBST(SYSTEM_LPSOLVE)
9672 dnl ===================================================================
9673 dnl Checking for libexttextcat
9674 dnl ===================================================================
9675 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9676 if test "$with_system_libexttextcat" = "yes"; then
9677     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9679 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9681 dnl ***************************************
9682 dnl testing libc version for Linux...
9683 dnl ***************************************
9684 if test "$_os" = "Linux"; then
9685     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9686     exec 6>/dev/null # no output
9687     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9688     exec 6>&1 # output on again
9689     if test "$HAVE_LIBC"; then
9690         AC_MSG_RESULT([yes])
9691     else
9692         AC_MSG_ERROR([no, upgrade libc])
9693     fi
9696 dnl =========================================
9697 dnl Check for the Windows  SDK.
9698 dnl =========================================
9699 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9700 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9701 if test "$_os" = "WINNT"; then
9702     AC_MSG_CHECKING([for Windows SDK])
9703     if test "$build_os" = "cygwin"; then
9704         find_winsdk
9705         WINDOWS_SDK_HOME=$winsdktest
9707         # normalize if found
9708         if test -n "$WINDOWS_SDK_HOME"; then
9709             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9710             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9711         fi
9713         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
9714     fi
9716     if test -n "$WINDOWS_SDK_HOME"; then
9717         # Remove a possible trailing backslash
9718         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9720         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9721              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9722              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9723             have_windows_sdk_headers=yes
9724         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9725              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9726              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9727             have_windows_sdk_headers=yes
9728         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
9729              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
9730              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
9731             have_windows_sdk_headers=yes
9732         else
9733             have_windows_sdk_headers=no
9734         fi
9736         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9737             have_windows_sdk_libs=yes
9738         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9739             have_windows_sdk_libs=yes
9740         else
9741             have_windows_sdk_libs=no
9742         fi
9744         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9745             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9746 the  Windows SDK are installed.])
9747         fi
9749         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9750              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9751              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9752              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9753         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9754              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9755              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9756              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9757         else
9758             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9759         fi
9760     fi
9762     if test -z "$WINDOWS_SDK_HOME"; then
9763         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9764     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
9765         WINDOWS_SDK_VERSION=70
9766         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9767     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9768         WINDOWS_SDK_VERSION=80
9769         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9770         dnl compatibility warning if not explicitly choosing the 80 SDK:
9771         if test -z "$with_windows_sdk"; then
9772             AC_MSG_WARN([If a build should run on Windows XP,])
9773             AC_MSG_WARN([use --with-windows-sdk=7.1A])
9774             add_warning "If a build should run on Windows XP,"
9775             add_warning "use --with-windows-sdk=7.1A"
9776         fi
9777     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
9778         WINDOWS_SDK_VERSION=81
9779         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
9780     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
9781         WINDOWS_SDK_VERSION=10
9782         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
9783     else
9784         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9785     fi
9786     PathFormat "$WINDOWS_SDK_HOME"
9787     WINDOWS_SDK_HOME="$formatted_path"
9788     if test "$build_os" = "cygwin"; then
9789         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9790         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9791             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9792         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
9793             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
9794         fi
9795     fi
9797     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9798     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9799     dnl but not in v8.0), so allow this to be overridden with a
9800     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9801     dnl and configuration error if no WiLangId.vbs is found would arguably be
9802     dnl better, but I do not know under which conditions exactly it is needed by
9803     dnl msiglobal.pm:
9804     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9805         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9806         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9807             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9808         fi
9809         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9810             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9811         fi
9812         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9813             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9814             add_warning "WiLangId.vbs not found - building translated packages will fail"
9815         fi
9816     fi
9818 AC_SUBST(WINDOWS_SDK_HOME)
9819 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
9820 AC_SUBST(WINDOWS_SDK_VERSION)
9821 AC_SUBST(WINDOWS_SDK_WILANGID)
9823 dnl =========================================
9824 dnl Check for uuidgen
9825 dnl =========================================
9826 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9827     if test "$WITH_MINGW" = "yes"; then
9828         AC_PATH_PROG([UUIDGEN], [uuid])
9829         if test -z "$UUIDGEN"; then
9830             AC_MSG_WARN([uuid is needed for building installation sets])
9831         fi
9832     else
9833         # presence is already tested above in the WINDOWS_SDK_HOME check
9834         UUIDGEN=uuidgen.exe
9835         AC_SUBST(UUIDGEN)
9836     fi
9837 else
9838     AC_PATH_PROG([UUIDGEN], [uuidgen])
9839     if test -z "$UUIDGEN"; then
9840         AC_MSG_WARN([uuid is needed for building installation sets])
9841     fi
9844 dnl ***************************************
9845 dnl Checking for bison and flex
9846 dnl ***************************************
9847 AC_PATH_PROG(BISON, bison)
9848 if test -z "$BISON"; then
9849     AC_MSG_ERROR([no bison found in \$PATH, install it])
9850 else
9851     AC_MSG_CHECKING([the bison version])
9852     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9853     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9854     # Accept newer than 2.0
9855     if test "$_bison_longver" -lt 2000; then
9856         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9857     fi
9860 AC_PATH_PROG(FLEX, flex)
9861 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9862     FLEX=`cygpath -m $FLEX`
9864 if test -z "$FLEX"; then
9865     AC_MSG_ERROR([no flex found in \$PATH, install it])
9866 else
9867     AC_MSG_CHECKING([the flex version])
9868     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9869     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9870         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9871     fi
9873 AC_SUBST([FLEX])
9874 dnl ***************************************
9875 dnl Checking for patch
9876 dnl ***************************************
9877 AC_PATH_PROG(PATCH, patch)
9878 if test -z "$PATCH"; then
9879     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9882 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9883 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9884     if test -z "$with_gnu_patch"; then
9885         GNUPATCH=$PATCH
9886     else
9887         if test -x "$with_gnu_patch"; then
9888             GNUPATCH=$with_gnu_patch
9889         else
9890             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9891         fi
9892     fi
9894     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9895     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9896         AC_MSG_RESULT([yes])
9897     else
9898         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9899     fi
9900 else
9901     GNUPATCH=$PATCH
9904 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9905     GNUPATCH=`cygpath -m $GNUPATCH`
9908 dnl We also need to check for --with-gnu-cp
9910 if test -z "$with_gnu_cp"; then
9911     # check the place where the good stuff is hidden on Solaris...
9912     if test -x /usr/gnu/bin/cp; then
9913         GNUCP=/usr/gnu/bin/cp
9914     else
9915         AC_PATH_PROGS(GNUCP, gnucp cp)
9916     fi
9917     if test -z $GNUCP; then
9918         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9919     fi
9920 else
9921     if test -x "$with_gnu_cp"; then
9922         GNUCP=$with_gnu_cp
9923     else
9924         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9925     fi
9928 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9929     GNUCP=`cygpath -m $GNUCP`
9932 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9933 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9934     AC_MSG_RESULT([yes])
9935 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9936     AC_MSG_RESULT([yes])
9937 else
9938     case "$build_os" in
9939     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9940         x_GNUCP=[\#]
9941         GNUCP=''
9942         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9943         ;;
9944     *)
9945         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9946         ;;
9947     esac
9950 AC_SUBST(GNUPATCH)
9951 AC_SUBST(GNUCP)
9952 AC_SUBST(x_GNUCP)
9954 dnl ***************************************
9955 dnl testing assembler path
9956 dnl ***************************************
9957 ML_EXE=""
9958 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
9959     if test "$BITNESS_OVERRIDE" = ""; then
9960         assembler=ml.exe
9961         assembler_bin=bin
9962     else
9963         if test "$vcexpress" = "Express"; then
9964             assembler=ml64.exe
9965             assembler_bin=bin/x86_amd64
9966         else
9967             assembler=ml64.exe
9968             assembler_bin=bin/amd64
9969         fi
9970     fi
9972     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9973     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9974         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9975         AC_MSG_RESULT([found])
9976         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9977     else
9978         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9979     fi
9981     PathFormat "$ASM_HOME"
9982     ASM_HOME="$formatted_path"
9983 else
9984     ASM_HOME=""
9987 AC_SUBST(ML_EXE)
9989 dnl ===================================================================
9990 dnl We need zip and unzip
9991 dnl ===================================================================
9992 AC_PATH_PROG(ZIP, zip)
9993 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9994 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9995     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],,)
9998 AC_PATH_PROG(UNZIP, unzip)
9999 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10001 dnl ===================================================================
10002 dnl Zip must be a specific type for different build types.
10003 dnl ===================================================================
10004 if test $build_os = cygwin; then
10005     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10006         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10007     fi
10010 dnl ===================================================================
10011 dnl We need touch with -h option support.
10012 dnl ===================================================================
10013 AC_PATH_PROG(TOUCH, touch)
10014 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10015 touch warn
10016 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10017     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],,)
10020 dnl ===================================================================
10021 dnl Set vcl option: coordinate device in double or sal_Int32
10022 dnl ===================================================================
10024 AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10025 if test "$_os" = "Darwin" -o  $_os = iOS ; then
10026     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10027     AC_MSG_RESULT([double])
10028 else
10029     AC_MSG_RESULT([sal_Int32])
10032 dnl ===================================================================
10033 dnl Test which vclplugs have to be built.
10034 dnl ===================================================================
10035 R=""
10036 if test "$USING_X11" != TRUE; then
10037     enable_gtk=no
10038     enable_gtk3=no
10040 GTK3_CFLAGS=""
10041 GTK3_LIBS=""
10042 ENABLE_GTK3=""
10043 if test "x$enable_gtk3" = "xyes"; then
10044     if test "$with_system_cairo" = no; then
10045         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10046     fi
10047     : ${with_system_cairo:=yes}
10048     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="")
10049     if test "x$ENABLE_GTK3" = "xTRUE"; then
10050         R="gtk3"
10051         dnl Avoid installed by unpackaged files for now.
10052         if test -z "$PKGFORMAT"; then
10053             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10054         fi
10055     else
10056         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10057     fi
10058     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10059     FilterLibs "${GTK3_LIBS}"
10060     GTK3_LIBS="${filteredlibs}"
10062 AC_SUBST(GTK3_LIBS)
10063 AC_SUBST(GTK3_CFLAGS)
10064 AC_SUBST(ENABLE_GTK3)
10066 ENABLE_GTK=""
10067 if test "x$enable_gtk" = "xyes"; then
10068     if test "$with_system_cairo" = no; then
10069         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10070     fi
10071     : ${with_system_cairo:=yes}
10072     ENABLE_GTK="TRUE"
10073     AC_DEFINE(ENABLE_GTK)
10074     R="gtk $R"
10076 AC_SUBST(ENABLE_GTK)
10078 ENABLE_TDE=""
10079 if test "x$enable_tde" = "xyes"; then
10080     ENABLE_TDE="TRUE"
10081     AC_DEFINE(ENABLE_TDE)
10082     R="$R tde"
10084 AC_SUBST(ENABLE_TDE)
10086 ENABLE_KDE4=""
10087 if test "x$enable_kde4" = "xyes"; then
10088     ENABLE_KDE4="TRUE"
10089     AC_DEFINE(ENABLE_KDE4)
10090     R="$R kde4"
10092 AC_SUBST(ENABLE_KDE4)
10094 ENABLE_HEADLESS=""
10095 if test "x$with_x" = "xno" -o "$CXX" = "emcc"; then
10096     ENABLE_HEADLESS="TRUE"
10097     SCPDEFS="$SCPDEFS -DLIBO_HEADLESS"
10098     R="headless"
10100 AC_SUBST(ENABLE_HEADLESS)
10102 build_vcl_plugins="$R"
10103 if test -z "$build_vcl_plugins"; then
10104     build_vcl_plugins="none"
10106 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10108 dnl ===================================================================
10109 dnl check for dbus support
10110 dnl ===================================================================
10111 ENABLE_DBUS=""
10112 DBUS_CFLAGS=""
10113 DBUS_LIBS=""
10115 if test "$enable_dbus" = "no"; then
10116     test_dbus=no
10119 AC_MSG_CHECKING([whether to enable DBUS support])
10120 if test "$test_dbus" = "yes"; then
10121     ENABLE_DBUS="TRUE"
10122     AC_MSG_RESULT([yes])
10123     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10124     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10125     FilterLibs "${DBUS_LIBS}"
10126     DBUS_LIBS="${filteredlibs}"
10127 else
10128     AC_MSG_RESULT([no])
10131 AC_SUBST(ENABLE_DBUS)
10132 AC_SUBST(DBUS_CFLAGS)
10133 AC_SUBST(DBUS_LIBS)
10135 AC_MSG_CHECKING([whether to enable font install via packagekit])
10136 if test "$ENABLE_DBUS" = "TRUE"; then
10137     if test -n "$enable_packagekit" -a "$enable_packagekit" != "no"; then
10138         ENABLE_PACKAGEKIT=TRUE
10139         AC_MSG_RESULT([yes])
10140     else
10141         ENABLE_PACKAGEKIT=
10142         AC_MSG_RESULT([no])
10143     fi
10144 else
10145     AC_MSG_RESULT([no, dbus disabled.])
10147 AC_SUBST(ENABLE_PACKAGEKIT)
10149 AC_MSG_CHECKING([whether to enable Impress remote control])
10150 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10151     AC_MSG_RESULT([yes])
10152     ENABLE_SDREMOTE=TRUE
10153     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10155     # If not explicitly enabled or disabled, default
10156     if test -z "$enable_sdremote_bluetooth"; then
10157         case "$OS" in
10158         LINUX|MACOSX|WNT)
10159             # Default to yes for these
10160             enable_sdremote_bluetooth=yes
10161             ;;
10162         *)
10163             # otherwise no
10164             enable_sdremote_bluetooth=no
10165             ;;
10166         esac
10167     fi
10168     # $enable_sdremote_bluetooth is guaranteed non-empty now
10170     if test "$enable_sdremote_bluetooth" != "no"; then
10171         if test "$OS" = "LINUX"; then
10172             if test "$ENABLE_DBUS" = "TRUE"; then
10173                 AC_MSG_RESULT([yes])
10174                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10175                 dnl ===================================================================
10176                 dnl Check for system bluez
10177                 dnl ===================================================================
10178                 AC_MSG_CHECKING([which Bluetooth header to use])
10179                 if test "$with_system_bluez" = "yes"; then
10180                     AC_MSG_RESULT([external])
10181                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10182                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10183                     SYSTEM_BLUEZ=TRUE
10184                 else
10185                     AC_MSG_RESULT([internal])
10186                     SYSTEM_BLUEZ=
10187                 fi
10188             else
10189                 AC_MSG_RESULT([no, dbus disabled])
10190                 ENABLE_SDREMOTE_BLUETOOTH=
10191                 SYSTEM_BLUEZ=
10192             fi
10193         else
10194             AC_MSG_RESULT([yes])
10195             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10196             SYSTEM_BLUEZ=
10197         fi
10198     else
10199         AC_MSG_RESULT([no])
10200         ENABLE_SDREMOTE_BLUETOOTH=
10201         SYSTEM_BLUEZ=
10202     fi
10203 else
10204     ENABLE_SDREMOTE=
10205     SYSTEM_BLUEZ=
10206     AC_MSG_RESULT([no])
10208 AC_SUBST(ENABLE_SDREMOTE)
10209 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10210 AC_SUBST(SYSTEM_BLUEZ)
10212 dnl ===================================================================
10213 dnl Check whether the gtk 2.0 libraries are available.
10214 dnl ===================================================================
10216 GTK_CFLAGS=""
10217 GTK_LIBS=""
10218 ENABLE_SYSTRAY_GTK=""
10219 if test  "$test_gtk" = "yes"; then
10221     if test "$ENABLE_GTK" = "TRUE"; then
10222         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]))
10223         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10224         FilterLibs "${GTK_LIBS}"
10225         GTK_LIBS="${filteredlibs}"
10226         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]))
10227         BUILD_TYPE="$BUILD_TYPE GTK"
10228         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10229         FilterLibs "${GTHREAD_LIBS}"
10230         GTHREAD_LIBS="${filteredlibs}"
10232         if test "x$enable_systray" = "xyes"; then
10233             ENABLE_SYSTRAY_GTK="TRUE"
10234         fi
10236         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10237         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10238                           [ENABLE_GTK_PRINT="TRUE"],
10239                           [ENABLE_GTK_PRINT=""])
10240         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10241         FilterLibs "${GTK_PRINT_LIBS}"
10242         GTK_PRINT_LIBS="${filteredlibs}"
10244         AC_MSG_CHECKING([whether to enable GIO support])
10245         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10246             dnl Need at least 2.26 for the dbus support.
10247             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10248                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10249             if test "$ENABLE_GIO" = "TRUE"; then
10250                 AC_DEFINE(ENABLE_GIO)
10251                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10252                 FilterLibs "${GIO_LIBS}"
10253                 GIO_LIBS="${filteredlibs}"
10254             fi
10255         else
10256             AC_MSG_RESULT([no])
10257         fi
10258     fi
10260 AC_SUBST(ENABLE_GIO)
10261 AC_SUBST(GIO_CFLAGS)
10262 AC_SUBST(GIO_LIBS)
10263 AC_SUBST(ENABLE_SYSTRAY_GTK)
10264 AC_SUBST(GTK_CFLAGS)
10265 AC_SUBST(GTK_LIBS)
10266 AC_SUBST(GTHREAD_CFLAGS)
10267 AC_SUBST(GTHREAD_LIBS)
10268 AC_SUBST([ENABLE_GTK_PRINT])
10269 AC_SUBST([GTK_PRINT_CFLAGS])
10270 AC_SUBST([GTK_PRINT_LIBS])
10273 dnl ===================================================================
10274 dnl Check whether the Telepathy libraries are available.
10275 dnl ===================================================================
10277 ENABLE_TELEPATHY=""
10278 TELEPATHY_CFLAGS=""
10279 TELEPATHY_LIBS=""
10281 AC_MSG_CHECKING([whether to enable Telepathy support])
10282 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10283     ENABLE_TELEPATHY="TRUE"
10284     AC_DEFINE(ENABLE_TELEPATHY)
10285     AC_MSG_RESULT([yes])
10286     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 )
10287     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10288     FilterLibs "${TELEPATHY_LIBS}"
10289     TELEPATHY_LIBS="${filteredlibs}"
10290 else
10291     AC_MSG_RESULT([no])
10294 AC_SUBST(ENABLE_TELEPATHY)
10295 AC_SUBST(TELEPATHY_CFLAGS)
10296 AC_SUBST(TELEPATHY_LIBS)
10299 dnl ===================================================================
10301 SPLIT_APP_MODULES=""
10302 if test "$enable_split_app_modules" = "yes"; then
10303     SPLIT_APP_MODULES="TRUE"
10305 AC_SUBST(SPLIT_APP_MODULES)
10307 SPLIT_OPT_FEATURES=""
10308 if test "$enable_split_opt_features" = "yes"; then
10309     SPLIT_OPT_FEATURES="TRUE"
10311 AC_SUBST(SPLIT_OPT_FEATURES)
10313 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10314     if test "$enable_cairo_canvas" = yes; then
10315         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10316     fi
10317     enable_cairo_canvas=no
10318 elif test -z "$enable_cairo_canvas"; then
10319     enable_cairo_canvas=yes
10322 ENABLE_CAIRO_CANVAS=""
10323 if test "$enable_cairo_canvas" = "yes"; then
10324     test_cairo=yes
10325     ENABLE_CAIRO_CANVAS="TRUE"
10326     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10328 AC_SUBST(ENABLE_CAIRO_CANVAS)
10330 dnl ===================================================================
10331 dnl Check whether the GStreamer libraries are available.
10332 dnl It's possible to build avmedia with both GStreamer backends!
10333 dnl ===================================================================
10335 ENABLE_GSTREAMER_1_0=""
10337 if test "$build_gstreamer_1_0" = "yes"; then
10339     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10340     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10341         ENABLE_GSTREAMER_1_0="TRUE"
10342         AC_MSG_RESULT([yes])
10343         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10344         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10345         FilterLibs "${GSTREAMER_1_0_LIBS}"
10346         GSTREAMER_1_0_LIBS="${filteredlibs}"
10347     else
10348         AC_MSG_RESULT([no])
10349     fi
10351 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10352 AC_SUBST(GSTREAMER_1_0_LIBS)
10353 AC_SUBST(ENABLE_GSTREAMER_1_0)
10356 ENABLE_GSTREAMER_0_10=""
10357 if test "$build_gstreamer_0_10" = "yes"; then
10359     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10360     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10361         ENABLE_GSTREAMER_0_10="TRUE"
10362         AC_MSG_RESULT([yes])
10363         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10364             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10365         ])
10366         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10367         FilterLibs "${GSTREAMER_0_10_LIBS}"
10368         GSTREAMER_0_10_LIBS="${filteredlibs}"
10369     else
10370         AC_MSG_RESULT([no])
10371     fi
10374 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10375 AC_SUBST(GSTREAMER_0_10_LIBS)
10376 AC_SUBST(ENABLE_GSTREAMER_0_10)
10378 dnl ===================================================================
10379 dnl Check whether to build the VLC avmedia backend
10380 dnl ===================================================================
10382 ENABLE_VLC=""
10384 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10385 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10386     ENABLE_VLC="TRUE"
10387     AC_MSG_RESULT([yes])
10388 else
10389     AC_MSG_RESULT([no])
10391 AC_SUBST(ENABLE_VLC)
10393 # this is for opengl transitions in impress slideshow
10394 ENABLE_OPENGL=
10395 if test $_os = iOS -o $_os = Android; then
10396    : # disable
10397 elif test "$_os" = "Darwin"; then
10398     # We use frameworks on Mac OS X, no need for detail checks
10399     ENABLE_OPENGL=TRUE
10400     ENABLE_OPENGL_CANVAS=TRUE
10401 elif test $_os = WINNT; then
10402     ENABLE_OPENGL=TRUE
10403     ENABLE_OPENGL_CANVAS=TRUE
10404 else
10405     if test "$USING_X11" = TRUE; then
10406         ENABLE_OPENGL=TRUE
10407     fi
10408     ENABLE_OPENGL_CANVAS=TRUE
10411 AC_SUBST(ENABLE_OPENGL)
10412 AC_SUBST(ENABLE_OPENGL_CANVAS)
10414 dnl =================================================
10415 dnl Check whether to build with OpenCL support.
10416 dnl =================================================
10418 if test $_os != iOS -a $_os != Android; then
10419     # OPENCL in BUILD_TYPE tells that OpenCL is potentially available on the platform (optional at run-time,
10420     # used through clew).
10421     BUILD_TYPE="$BUILD_TYPE OPENCL"
10422     AC_DEFINE(HAVE_FEATURE_OPENCL)
10425 dnl ===================================================================
10426 dnl Check whether to enable glTF support
10427 dnl ===================================================================
10428 AC_MSG_CHECKING([whether to enable glTF support])
10429 ENABLE_GLTF=
10430 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android; then
10431     ENABLE_GLTF=TRUE
10432     AC_MSG_RESULT([yes])
10433     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10434     if test "$with_system_libgltf" = "yes"; then
10435         SYSTEM_LIBGLTF=TRUE
10436         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10437         FilterLibs "${LIBGLTF_LIBS}"
10438         LIBGLTF_LIBS="${filteredlibs}"
10439     else
10440         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10441     fi
10442 else
10443     AC_MSG_RESULT([no])
10445 AC_SUBST(ENABLE_GLTF)
10446 AC_SUBST(SYSTEM_LIBGLTF)
10447 AC_SUBST(LIBGLTF_CFLAGS)
10448 AC_SUBST(LIBGLTF_LIBS)
10450 dnl ===================================================================
10451 dnl Check whether to enable COLLADA support
10452 dnl ===================================================================
10453 AC_MSG_CHECKING([whether to enable COLLADA support])
10454 ENABLE_COLLADA=
10455 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10456     AC_MSG_RESULT([yes])
10457     ENABLE_COLLADA=TRUE
10458     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10460     AC_MSG_CHECKING([which OPENCOLLADA to use])
10461     if test "$with_system_opencollada" = "yes"; then
10462         AC_MSG_RESULT([external])
10463         SYSTEM_OPENCOLLADA=TRUE
10464         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10465         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10466         AC_LANG_PUSH([C++])
10467         save_CXXFLAGS=$CXXFLAGS
10468         save_CPPFLAGS=$CPPFLAGS
10469         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10470         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10471         AC_CHECK_HEADERS(
10472                 COLLADABU.h \
10473                 COLLADAFW.h \
10474                 COLLADASaxFWLLoader.h \
10475                 GeneratedSaxParser.h,
10476             [],
10477             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10478             [])
10479         CXXFLAGS=$save_CXXFLAGS
10480         CPPFLAGS=$save_CPPFLAGS
10481         AC_LANG_POP([C++])
10482         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10483         FilterLibs "${OPENCOLLADA_LIBS}"
10484         OPENCOLLADA_LIBS="${filteredlibs}"
10485     else
10486         AC_MSG_RESULT([internal])
10487         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10488     fi
10490     AC_MSG_CHECKING([which collada2gltf to use])
10491     if test "$with_system_collada2gltf" = "yes"; then
10492         if test "$with_system_opencollada" = "no"; then
10493             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10494         fi
10495         AC_MSG_RESULT([external])
10496         SYSTEM_COLLADA2GLTF=TRUE
10497         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10498         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10499         AC_LANG_PUSH([C++])
10500         save_CXXFLAGS=$CXXFLAGS
10501         save_CPPFLAGS=$CPPFLAGS
10502         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10503         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10504         AC_CHECK_HEADERS(
10505                 GLTF.h \
10506                 encodingHelpers.h,
10507             [],
10508             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10509             [])
10510         CXXFLAGS=$save_CXXFLAGS
10511         CPPFLAGS=$save_CPPFLAGS
10512         AC_LANG_POP([C++])
10513         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10514         FilterLibs "${COLLADA2GLTF_LIBS}"
10515         COLLADA2GLTF_LIBS="${filteredlibs}"
10516     else
10517         AC_MSG_RESULT([internal])
10518         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10519     fi
10520 else
10521     AC_MSG_RESULT([no])
10523 AC_SUBST(ENABLE_COLLADA)
10524 AC_SUBST([OPENCOLLADA_CFLAGS])
10525 AC_SUBST([OPENCOLLADA_LIBS])
10526 AC_SUBST([SYSTEM_OPENCOLLADA])
10528 AC_SUBST([COLLADA2GLTF_CFLAGS])
10529 AC_SUBST([COLLADA2GLTF_LIBS])
10530 AC_SUBST([SYSTEM_COLLADA2GLTF])
10532 if test "$enable_dconf" != no; then
10533     PKG_CHECK_MODULES([DCONF], [dconf], [], [
10534         if test "$enable_dconf" = yes; then
10535             AC_MSG_ERROR([dconf not found])
10536         else
10537             enable_dconf=no
10538         fi])
10540 AC_MSG_CHECKING([whether to enable dconf])
10541 if test "$enable_dconf" = no; then
10542     DCONF_CFLAGS=
10543     DCONF_LIBS=
10544     ENABLE_DCONF=
10545     AC_MSG_RESULT([no])
10546 else
10547     ENABLE_DCONF=TRUE
10548     AC_DEFINE(ENABLE_DCONF)
10549     AC_MSG_RESULT([yes])
10551 AC_SUBST([DCONF_CFLAGS])
10552 AC_SUBST([DCONF_LIBS])
10553 AC_SUBST([ENABLE_DCONF])
10555 # pdf import?
10556 AC_MSG_CHECKING([whether to build the PDF import feature])
10557 ENABLE_PDFIMPORT=
10558 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10559     AC_MSG_RESULT([yes])
10560     ENABLE_PDFIMPORT=TRUE
10562     dnl ===================================================================
10563     dnl Check for system poppler
10564     dnl ===================================================================
10565     AC_MSG_CHECKING([which PDF import backend to use])
10566     if test "$with_system_poppler" = "yes"; then
10567         AC_MSG_RESULT([external])
10568         SYSTEM_POPPLER=TRUE
10569         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10570         AC_LANG_PUSH([C++])
10571         save_CXXFLAGS=$CXXFLAGS
10572         save_CPPFLAGS=$CPPFLAGS
10573         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10574         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10575         AC_CHECK_HEADER([cpp/poppler-version.h],
10576             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10577             [])
10578         CXXFLAGS=$save_CXXFLAGS
10579         CPPFLAGS=$save_CPPFLAGS
10580         AC_LANG_POP([C++])
10581         libo_MINGW_CHECK_DLL([libpoppler])
10582         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10584         FilterLibs "${POPPLER_LIBS}"
10585         POPPLER_LIBS="${filteredlibs}"
10586     else
10587         AC_MSG_RESULT([internal])
10588         SYSTEM_POPPLER=
10589         BUILD_TYPE="$BUILD_TYPE POPPLER"
10590         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10591     fi
10592     AC_DEFINE([ENABLE_PDFIMPORT],1)
10593 else
10594     AC_MSG_RESULT([no])
10596 AC_SUBST(ENABLE_PDFIMPORT)
10597 AC_SUBST(SYSTEM_POPPLER)
10598 AC_SUBST(POPPLER_CFLAGS)
10599 AC_SUBST(POPPLER_LIBS)
10601 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10602 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10603     AC_MSG_RESULT([yes])
10604     ENABLE_MEDIAWIKI=TRUE
10605     BUILD_TYPE="$BUILD_TYPE XSLTML"
10606     if test  "x$with_java" = "xno"; then
10607         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10608     fi
10609 else
10610     AC_MSG_RESULT([no])
10611     ENABLE_MEDIAWIKI=
10612     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10614 AC_SUBST(ENABLE_MEDIAWIKI)
10616 AC_MSG_CHECKING([whether to build the Report Builder])
10617 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10618     AC_MSG_RESULT([yes])
10619     ENABLE_REPORTBUILDER=TRUE
10620     AC_MSG_CHECKING([which jfreereport libs to use])
10621     if test "$with_system_jfreereport" = "yes"; then
10622         SYSTEM_JFREEREPORT=TRUE
10623         AC_MSG_RESULT([external])
10624         if test -z $SAC_JAR; then
10625             SAC_JAR=/usr/share/java/sac.jar
10626         fi
10627         AC_CHECK_FILE($SAC_JAR, [],
10628              [AC_MSG_ERROR(sac.jar not found.)], [])
10630         if test -z $LIBXML_JAR; then
10631             AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
10632                 [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
10633                 [
10634                     AC_CHECK_FILE(/usr/share/java/libxml.jar,
10635                        [ LIBXML_JAR=/usr/share/java/libxml.jar ],
10636                        [AC_MSG_ERROR(libxml.jar replacement not found.)]
10637                     )
10638                 ]
10639             )
10640         else
10641             AC_CHECK_FILE($LIBXML_JAR, [],
10642                  [AC_MSG_ERROR(libxml.jar not found.)], [])
10643         fi
10645         if test -z $FLUTE_JAR; then
10646             AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
10647                 [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
10648                 [
10649                     AC_CHECK_FILE(/usr/share/java/flute.jar,
10650                         [ FLUTE_JAR=/usr/share/java/flute.jar ],
10651                         [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
10652                     )
10653                 ]
10654             )
10655         else
10656             AC_CHECK_FILE($FLUTE_JAR, [],
10657                  [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
10658         fi
10660         if test -z $JFREEREPORT_JAR; then
10661             AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
10662                 [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
10663                 [
10664                     AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
10665                         [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
10666                         [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
10667                     )
10668                 ]
10669             )
10670         else
10671             AC_CHECK_FILE($JFREEREPORT_JAR, [],
10672                  [AC_MSG_ERROR(jfreereport.jar not found.)], [])
10673         fi
10675         if test -z $LIBLAYOUT_JAR; then
10676             AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
10677                 [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
10678                 [
10679                     AC_CHECK_FILE(/usr/share/java/liblayout.jar,
10680                         [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
10681                         [AC_MSG_ERROR(liblayout.jar replacement not found.)]
10682                     )
10683                 ]
10684             )
10685         else
10686             AC_CHECK_FILE($LIBLAYOUT_JAR, [],
10687                  [AC_MSG_ERROR(liblayout.jar not found.)], [])
10688         fi
10690         if test -z $LIBLOADER_JAR; then
10691             AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
10692                 [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
10693                 [
10694                     AC_CHECK_FILE(/usr/share/java/libloader.jar,
10695                        [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
10696                        [AC_MSG_ERROR(libloader.jar replacement not found.)]
10697                     )
10698                 ]
10699             )
10700         else
10701             AC_CHECK_FILE($LIBLOADER_JAR, [],
10702                 [AC_MSG_ERROR(libloader.jar not found.)], [])
10703         fi
10705         if test -z $LIBFORMULA_JAR; then
10706             AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
10707                  [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
10708                  [
10709                      AC_CHECK_FILE(/usr/share/java/libformula.jar,
10710                          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
10711                          [AC_MSG_ERROR(libformula.jar replacement not found.)]
10712                      )
10713                  ]
10714             )
10715         else
10716             AC_CHECK_FILE($LIBFORMULA_JAR, [],
10717                 [AC_MSG_ERROR(libformula.jar not found.)], [])
10718         fi
10720         if test -z $LIBREPOSITORY_JAR; then
10721             AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
10722                 [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
10723                 [
10724                     AC_CHECK_FILE(/usr/share/java/librepository.jar,
10725                         [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
10726                         [AC_MSG_ERROR(librepository.jar replacement not found.)]
10727                     )
10728                 ]
10729             )
10730         else
10731             AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
10732                 [AC_MSG_ERROR(librepository.jar not found.)], [])
10733         fi
10735         if test -z $LIBFONTS_JAR; then
10736             AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
10737                 [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
10738                 [
10739                     AC_CHECK_FILE(/usr/share/java/libfonts.jar,
10740                         [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
10741                         [AC_MSG_ERROR(libfonts.jar replacement not found.)]
10742                     )
10743                 ]
10744             )
10745         else
10746             AC_CHECK_FILE($LIBFONTS_JAR, [],
10747                 [AC_MSG_ERROR(libfonts.jar not found.)], [])
10748         fi
10750         if test -z $LIBSERIALIZER_JAR; then
10751             AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
10752                 [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
10753                 [
10754                     AC_CHECK_FILE(/usr/share/java/libserializer.jar,
10755                         [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
10756                         [AC_MSG_ERROR(libserializer.jar replacement not found.)]
10757                     )
10758                 ]
10759             )
10760         else
10761             AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
10762                 [AC_MSG_ERROR(libserializer.jar not found.)], [])
10763         fi
10765         if test -z $LIBBASE_JAR; then
10766             AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
10767                 [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
10768                 [
10769                     AC_CHECK_FILE(/usr/share/java/libbase.jar,
10770                         [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
10771                         [AC_MSG_ERROR(libbase.jar replacement not found.)]
10772                     )
10773                 ]
10774             )
10775         else
10776             AC_CHECK_FILE($LIBBASE_JAR, [],
10777                 [AC_MSG_ERROR(libbase.jar not found.)], [])
10778         fi
10780     else
10781         AC_MSG_RESULT([internal])
10782         SYSTEM_JFREEREPORT=
10783         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10784     fi
10785 else
10786     AC_MSG_RESULT([no])
10787     ENABLE_REPORTBUILDER=
10788     SYSTEM_JFREEREPORT=
10790 AC_SUBST(ENABLE_REPORTBUILDER)
10791 AC_SUBST(SYSTEM_JFREEREPORT)
10792 AC_SUBST(SAC_JAR)
10793 AC_SUBST(LIBXML_JAR)
10794 AC_SUBST(FLUTE_JAR)
10795 AC_SUBST(JFREEREPORT_JAR)
10796 AC_SUBST(LIBBASE_JAR)
10797 AC_SUBST(LIBLAYOUT_JAR)
10798 AC_SUBST(LIBLOADER_JAR)
10799 AC_SUBST(LIBFORMULA_JAR)
10800 AC_SUBST(LIBREPOSITORY_JAR)
10801 AC_SUBST(LIBFONTS_JAR)
10802 AC_SUBST(LIBSERIALIZER_JAR)
10804 # this has to be here because both the Wiki Publisher and the SRB use
10805 # commons-logging
10806 COMMONS_LOGGING_VERSION=1.2
10807 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10808     AC_MSG_CHECKING([which Apache commons-* libs to use])
10809     if test "$with_system_apache_commons" = "yes"; then
10810         SYSTEM_APACHE_COMMONS=TRUE
10811         AC_MSG_RESULT([external])
10812         if test -z $COMMONS_LOGGING_JAR; then
10813             AC_CHECK_FILE(/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar,
10814                [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar ],
10815                [
10816                     AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
10817                         [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
10818                         [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
10819                     )
10820                 ]
10821             )
10822         else
10823             AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
10824                 [AC_MSG_ERROR(commons-logging.jar not found.)], [])
10825         fi
10826     else
10827         AC_MSG_RESULT([internal])
10828         SYSTEM_APACHE_COMMONS=
10829         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10830     fi
10832 AC_SUBST(SYSTEM_APACHE_COMMONS)
10833 AC_SUBST(COMMONS_LOGGING_JAR)
10834 AC_SUBST(COMMONS_LOGGING_VERSION)
10836 # scripting provider for BeanShell?
10837 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10838 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10839     AC_MSG_RESULT([yes])
10840     ENABLE_SCRIPTING_BEANSHELL=TRUE
10842     dnl ===================================================================
10843     dnl Check for system beanshell
10844     dnl ===================================================================
10845     AC_MSG_CHECKING([which beanshell to use])
10846     if test "$with_system_beanshell" = "yes"; then
10847         AC_MSG_RESULT([external])
10848         SYSTEM_BSH=TRUE
10849         if test -z $BSH_JAR; then
10850             BSH_JAR=/usr/share/java/bsh.jar
10851         fi
10852         AC_CHECK_FILE($BSH_JAR, [],
10853                    [AC_MSG_ERROR(bsh.jar not found.)], [])
10854     else
10855         AC_MSG_RESULT([internal])
10856         SYSTEM_BSH=
10857         BUILD_TYPE="$BUILD_TYPE BSH"
10858     fi
10859 else
10860     AC_MSG_RESULT([no])
10861     ENABLE_SCRIPTING_BEANSHELL=
10862     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10864 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10865 AC_SUBST(SYSTEM_BSH)
10866 AC_SUBST(BSH_JAR)
10868 # scripting provider for JavaScript?
10869 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10870 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10871     AC_MSG_RESULT([yes])
10872     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10874     dnl ===================================================================
10875     dnl Check for system rhino
10876     dnl ===================================================================
10877     AC_MSG_CHECKING([which rhino to use])
10878     if test "$with_system_rhino" = "yes"; then
10879         AC_MSG_RESULT([external])
10880         SYSTEM_RHINO=TRUE
10881         if test -z $RHINO_JAR; then
10882             RHINO_JAR=/usr/share/java/js.jar
10883         fi
10884         AC_CHECK_FILE($RHINO_JAR, [],
10885                    [AC_MSG_ERROR(js.jar not found.)], [])
10886     else
10887         AC_MSG_RESULT([internal])
10888         SYSTEM_RHINO=
10889         BUILD_TYPE="$BUILD_TYPE RHINO"
10890     fi
10891 else
10892     AC_MSG_RESULT([no])
10893     ENABLE_SCRIPTING_JAVASCRIPT=
10894     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10896 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10897 AC_SUBST(SYSTEM_RHINO)
10898 AC_SUBST(RHINO_JAR)
10900 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10901 # paths should be added to library search path. So lets put all 64-bit
10902 # platforms there.
10903 supports_multilib=
10904 case "$host_cpu" in
10905 x86_64 | powerpc64 | powerpc64le | s390x | aarch64)
10906     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10907         supports_multilib="yes"
10908     fi
10909     ;;
10911     ;;
10912 esac
10914 dnl ===================================================================
10915 dnl Check whether the TQt and TDE libraries are available.
10916 dnl ===================================================================
10918 TDE_CFLAGS=""
10919 TDE_LIBS=""
10920 if test "$_os" != "OpenBSD"; then
10921     MOC="moc"
10923 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10924     dnl Search paths for TQt and TDE
10925     if test -z "$supports_multilib"; then
10926         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"
10927         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"
10928     else
10929         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"
10930         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"
10931     fi
10932     if test -n "$TQTDIR"; then
10933         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10934         if test -z "$supports_multilib"; then
10935             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10936         else
10937             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10938         fi
10939     fi
10940     if test -z "$supports_multilib"; then
10941         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"
10942         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"
10943     else
10944         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"
10945         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"
10946     fi
10947     if test -n "$TDEDIR"; then
10948         tde_incdirs="$TDEDIR/include $tde_incdirs"
10949         if test -z "$supports_multilib"; then
10950             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10951         else
10952             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10953         fi
10954     fi
10956     dnl What to test
10957     tqt_test_include="ntqstyle.h"
10958     tde_test_include="kapp.h"
10960     if test "$_os" != "OpenBSD"; then
10961         tqt_test_library="libtqt-mt.so"
10962         tde_test_library="libDCOP.so"
10963     else
10964         tqt_test_library="libtqt-mt.so*"
10965         tde_test_library="libDCOP.so*"
10966     fi
10968     dnl Check for TQt headers
10969     AC_MSG_CHECKING([for TQt headers])
10970     tqt_incdir="no"
10971     for tde_check in $tqt_incdirs; do
10972         if test -r "$tde_check/$tqt_test_include"; then
10973             tqt_incdir="$tde_check"
10974             break
10975         fi
10976     done
10977     AC_MSG_RESULT([$tqt_incdir])
10978     if test "x$tqt_incdir" = "xno"; then
10979         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10980 your TQt installation by exporting TQTDIR before running "configure".])
10981     fi
10983     dnl Check for TQt libraries
10984     AC_MSG_CHECKING([for TQt libraries])
10985     tqt_libdir="no"
10986     for tqt_check in $tqt_libdirs; do
10987         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
10988             tqt_libdir="$tqt_check"
10989             break
10990         fi
10991     done
10992     AC_MSG_RESULT([$tqt_libdir])
10993     if test "x$tqt_libdir" = "xno"; then
10994         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
10995 your TQt installation by exporting TQTDIR before running "configure".])
10996     fi
10998     dnl Check for Meta Object Compiler
10999     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
11000     if test "$MOC" = "no"; then
11001         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
11002 the root of your TQt installation by exporting TQTDIR before running "configure".])
11003     fi
11005     dnl Check for TDE headers
11006     AC_MSG_CHECKING([for TDE headers])
11007     tde_incdir="no"
11008     for tde_check in $tde_incdirs; do
11009         if test -r "$tde_check/$tde_test_include"; then
11010             tde_incdir="$tde_check"
11011             break
11012         fi
11013     done
11014     AC_MSG_RESULT([$tde_incdir])
11015     if test "x$tde_incdir" = "xno"; then
11016         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
11017 your TDE installation by exporting TDEDIR before running "configure".])
11018     fi
11020     dnl Check for TDE libraries
11021     AC_MSG_CHECKING([for TDE libraries])
11022     tde_libdir="no"
11023     for tde_check in $tde_libdirs; do
11024         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
11025             tde_libdir="$tde_check"
11026             break
11027         fi
11028     done
11029     AC_MSG_RESULT([$tde_libdir])
11030     if test "x$tde_libdir" = "xno"; then
11031         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
11032 your TDE installation by exporting TDEDIR before running "configure".])
11033     fi
11035     dnl Set the variables
11036     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11037     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
11039 AC_SUBST(TDE_CFLAGS)
11040 AC_SUBST(TDE_LIBS)
11041 AC_SUBST(MOC)
11043 dnl ===================================================================
11044 dnl KDE4 Integration
11045 dnl ===================================================================
11047 KDE4_CFLAGS=""
11048 KDE4_LIBS=""
11049 QMAKE4="qmake"
11050 MOC4="moc"
11051 KDE_GLIB_CFLAGS=""
11052 KDE_GLIB_LIBS=""
11053 KDE_HAVE_GLIB=""
11054 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11055     qt_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11056     qt_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11058     kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
11059     kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11061     if test -n "$supports_multilib"; then
11062         qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11063         kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11064     fi
11066     if test -n "$QTDIR"; then
11067         qt_incdirs="$QTDIR/include $qt_incdirs"
11068         if test -z "$supports_multilib"; then
11069             qt_libdirs="$QTDIR/lib $qt_libdirs"
11070         else
11071             qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
11072         fi
11073     fi
11074     if test -n "$QT4DIR"; then
11075         qt_incdirs="$QT4DIR/include $qt_incdirs"
11076         if test -z "$supports_multilib"; then
11077             qt_libdirs="$QT4DIR/lib $qt_libdirs"
11078         else
11079             qt_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt_libdirs"
11080         fi
11081     fi
11083     if test -n "$KDEDIR"; then
11084         kde_incdirs="$KDEDIR/include $kde_incdirs"
11085         if test -z "$supports_multilib"; then
11086             kde_libdirs="$KDEDIR/lib $kde_libdirs"
11087         else
11088             kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
11089         fi
11090     fi
11091     if test -n "$KDE4DIR"; then
11092         kde_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde_incdirs"
11093         if test -z "$supports_multilib"; then
11094             kde_libdirs="$KDE4DIR/lib $kde_libdirs"
11095         else
11096             kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
11097         fi
11098     fi
11100     qt_test_include="Qt/qobject.h"
11101     qt_test_library="libQtNetwork.so"
11102     kde_test_include="kwindowsystem.h"
11103     kde_test_library="libsolid.so"
11105     AC_MSG_CHECKING([for Qt4 headers])
11106     qt_header_dir="no"
11107     for inc_dir in $qt_incdirs; do
11108         if test -r "$inc_dir/$qt_test_include"; then
11109             qt_header_dir="$inc_dir"
11110             break
11111         fi
11112     done
11114     AC_MSG_RESULT([$qt_header_dir])
11115     if test "x$qt_header_dir" = "xno"; then
11116         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11117     fi
11119     dnl Check for qmake
11120     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11121     QMAKE4="$QMAKEQT4"
11122     if test "$QMAKE4" = "no"; then
11123         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt_header_dir`/bin:$QT4DIR/bin:$PATH] )
11124         if test "$QMAKE4" = "no"; then
11125             AC_MSG_ERROR([Qmake not found.  Please specify
11126 the root of your Qt installation by exporting QT4DIR before running "configure".])
11127         fi
11128     fi
11130     qt_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt_libdirs"
11131     AC_MSG_CHECKING([for Qt4 libraries])
11132     qt_lib_dir="no"
11133     for lib_dir in $qt_libdirs; do
11134         if test -r "$lib_dir/$qt_test_library"; then
11135             qt_lib_dir="$lib_dir"
11136             PKG_CONFIG_PATH="$qt_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11137             break
11138         fi
11139     done
11141     AC_MSG_RESULT([$qt_lib_dir])
11143     if test "x$qt_lib_dir" = "xno"; then
11144         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11145     fi
11147     dnl Check for Meta Object Compiler
11149     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11150     MOC4="$MOCQT4"
11151     if test "$MOC4" = "no"; then
11152         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11153         if test "$MOC4" = "no"; then
11154             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11155 the root of your Qt installation by exporting QT4DIR before running "configure".])
11156         fi
11157     fi
11159     dnl Check for KDE4 headers
11160     AC_MSG_CHECKING([for KDE4 headers])
11161     kde_incdir="no"
11162     for kde_check in $kde_incdirs; do
11163         if test -r "$kde_check/$kde_test_include"; then
11164             kde_incdir="$kde_check"
11165             break
11166         fi
11167     done
11168     AC_MSG_RESULT([$kde_incdir])
11169     if test "x$kde_incdir" = "xno"; then
11170         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11171     fi
11173     dnl Check for KDE4 libraries
11174     AC_MSG_CHECKING([for KDE4 libraries])
11175     kde_libdir="no"
11176     for kde_check in $kde_libdirs; do
11177         if test -r "$kde_check/$kde_test_library"; then
11178             kde_libdir="$kde_check"
11179             break
11180         fi
11181     done
11183     AC_MSG_RESULT([$kde_libdir])
11184     if test "x$kde_libdir" = "xno"; then
11185         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11186     fi
11188     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11189     KDE4_CFLAGS="-I$kde_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11190     KDE4_LIBS="-L$kde_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt_lib_dir $QT4_LIBS"
11191     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11192     FilterLibs "$KDE4_LIBS"
11193     KDE4_LIBS="$filteredlibs"
11195     AC_LANG_PUSH([C++])
11196     save_CXXFLAGS=$CXXFLAGS
11197     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11198     AC_MSG_CHECKING([whether KDE is >= 4.2])
11199        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11200 #include <kdeversion.h>
11202 int main(int argc, char **argv) {
11203        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11204        else return 1;
11206        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11207     CXXFLAGS=$save_CXXFLAGS
11208     AC_LANG_POP([C++])
11210     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11211     # Sets also KDE_GLIB_CFLAGS/KDE_GLIB_LIBS if successful.
11212     PKG_CHECK_MODULES(KDE_GLIB,[glib-2.0 >= 2.4],
11213         [
11214             KDE_HAVE_GLIB=1
11215             AC_DEFINE(KDE_HAVE_GLIB,1)
11216             KDE_GLIB_CFLAGS=$(printf '%s' "$KDE_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11217             FilterLibs "${KDE_GLIB_LIBS}"
11218             KDE_GLIB_LIBS="${filteredlibs}"
11220             qt4_fix_warning=
11222             AC_LANG_PUSH([C++])
11223             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11224             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11225             #  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
11226             #               ^~~~~~~~~~~~~~~~~~~~~~~
11227             #               vptr for 'QObjectPrivate'
11228             save_CXX=$CXX
11229             CXX=$(printf %s "$CXX" \
11230                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11231             save_CXXFLAGS=$CXXFLAGS
11232             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11233             save_LIBS=$LIBS
11234             LIBS="$LIBS $KDE4_LIBS"
11235             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11237             # Prepare meta object data
11238             TSTBASE="tst_exclude_socket_notifiers"
11239             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11240             ln -fs "${TSTMOC}.hxx"
11241             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11243             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11244 #include <cstdlib>
11245 #include "tst_exclude_socket_notifiers.moc"
11247 int main(int argc, char *argv[])
11249     QCoreApplication app(argc, argv);
11250     exit(tst_processEventsExcludeSocket());
11251     return 0;
11253             ]])],[
11254                 AC_MSG_RESULT([yes])
11255             ],[
11256                 AC_MSG_RESULT([no])
11257                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11258                 if test -z "$qt4_fix_warning"; then
11259                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11260                 fi
11261                 qt4_fix_warning=1
11262                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11263             ])
11265             # Remove meta object data
11266             rm -f "${TSTBASE}."*
11268             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11270             # Prepare meta object data
11271             TSTBASE="tst_exclude_posted_events"
11272             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11273             ln -fs "${TSTMOC}.hxx"
11274             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11276             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11277 #include <cstdlib>
11278 #include "tst_exclude_posted_events.moc"
11280 int main(int argc, char *argv[])
11282     QCoreApplication app(argc, argv);
11283     exit(tst_excludePostedEvents());
11284     return 0;
11286             ]])],[
11287                 AC_MSG_RESULT([yes])
11288             ],[
11289                 AC_MSG_RESULT([no])
11290                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11291                 if test -z "$qt4_fix_warning"; then
11292                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11293                 fi
11294                 qt4_fix_warning=1
11295                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11296             ])
11298             # Remove meta object data
11299             rm -f "${TSTBASE}."*
11301             if test -n "$qt4_fix_warning"; then
11302                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11303             fi
11305             LIBS=$save_LIBS
11306             CXXFLAGS=$save_CXXFLAGS
11307             CXX=$save_CXX
11308             AC_LANG_POP([C++])
11309         ],
11310         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11312 AC_SUBST(KDE4_CFLAGS)
11313 AC_SUBST(KDE4_LIBS)
11314 AC_SUBST(MOC4)
11315 AC_SUBST(KDE_GLIB_CFLAGS)
11316 AC_SUBST(KDE_GLIB_LIBS)
11317 AC_SUBST(KDE_HAVE_GLIB)
11319 dnl ===================================================================
11320 dnl Test whether to include Evolution 2 support
11321 dnl ===================================================================
11322 AC_MSG_CHECKING([whether to enable evolution 2 support])
11323 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11324     AC_MSG_RESULT([yes])
11325     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11326     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11327     FilterLibs "${GOBJECT_LIBS}"
11328     GOBJECT_LIBS="${filteredlibs}"
11329     ENABLE_EVOAB2="TRUE"
11330 else
11331     ENABLE_EVOAB2=""
11332     AC_MSG_RESULT([no])
11334 AC_SUBST(ENABLE_EVOAB2)
11335 AC_SUBST(GOBJECT_CFLAGS)
11336 AC_SUBST(GOBJECT_LIBS)
11338 dnl ===================================================================
11339 dnl Test whether to include TDE AB support
11340 dnl ===================================================================
11341 AC_MSG_CHECKING([whether to enable TDE address book support])
11342 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11343     AC_MSG_RESULT([yes])
11344     AC_LANG_PUSH([C++])
11345     save_CXXFLAGS=$CXXFLAGS
11346     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11347     AC_MSG_CHECKING([whether TDE is at least R14.0])
11348        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11349 #include <tdeversion.h>
11351 int main(int argc, char **argv) {
11352        if (TDE_VERSION_MAJOR >= 14) return 0;
11353        else return 1;
11355        ]])],[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])],[])
11356     CXXFLAGS=$save_CXXFLAGS
11357     AC_LANG_POP([C++])
11358     ENABLE_TDEAB=TRUE
11359 else
11360     AC_MSG_RESULT([no])
11361     ENABLE_TDEAB=
11363 AC_SUBST(ENABLE_TDEAB)
11365 dnl ===================================================================
11366 dnl Test which themes to include
11367 dnl ===================================================================
11368 AC_MSG_CHECKING([which themes to include])
11369 # if none given use default subset of available themes
11370 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11371     with_theme="breeze galaxy hicontrast oxygen sifr tango"
11372     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11375 WITH_THEMES=""
11376 if test "x$with_theme" != "xno"; then
11377     for theme in $with_theme; do
11378         case $theme in
11379         breeze|crystal|elementary|galaxy|hicontrast|human|industrial|oxygen|sifr|tango|tango_testing) real_theme="$theme" ;;
11380         default) real_theme=galaxy ;;
11381         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11382         esac
11383         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11384     done
11386 AC_MSG_RESULT([$WITH_THEMES])
11387 AC_SUBST([WITH_THEMES])
11388 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11389 for theme in $with_theme; do
11390     case $theme in
11391     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11392     *) ;;
11393     esac
11394 done
11396 dnl ===================================================================
11397 dnl Test whether to integrate helppacks into the product's installer
11398 dnl ===================================================================
11399 AC_MSG_CHECKING([for helppack integration])
11400 if test "$with_helppack_integration" = "no"; then
11401     WITH_HELPPACK_INTEGRATION=
11402     AC_MSG_RESULT([no integration])
11403 else
11404     WITH_HELPPACK_INTEGRATION=TRUE
11405     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11406     AC_MSG_RESULT([integration])
11408 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11410 ###############################################################################
11411 # Extensions checking
11412 ###############################################################################
11413 AC_MSG_CHECKING([for extensions integration])
11414 if test "x$enable_extension_integration" != "xno"; then
11415     WITH_EXTENSION_INTEGRATION=TRUE
11416     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11417     AC_MSG_RESULT([yes, use integration])
11418 else
11419     WITH_EXTENSION_INTEGRATION=
11420     AC_MSG_RESULT([no, do not integrate])
11422 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11424 dnl Should any extra extensions be included?
11425 dnl There are standalone tests for each of these below.
11426 WITH_EXTRA_EXTENSIONS=
11427 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11429 libo_CHECK_EXTENSION([Watch Window],[WATCH_WINDOW],[watch_window],[watch-window],[23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt])
11430 libo_CHECK_EXTENSION([SmART Gallery (Diagram)],[DIAGRAM],[diagram],[diagram],[8d74685d41f8bffe8c3e71fe8deac09d-SmART_0.9.5.oxt])
11431 libo_CHECK_EXTENSION([Validator],[VALIDATOR],[validator],[validator],[bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt])
11432 libo_CHECK_EXTENSION([Barcode],[BARCODE],[barcode],[barcode],[3ed18025a766f1e955707b969c8113a5-Barcode_1.3.5.0.oxt])
11433 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11434 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11435 libo_CHECK_EXTENSION([Hungarian Cross-reference Toolbar],[HUNART],[hunart],[hunart],[b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt])
11436 libo_CHECK_EXTENSION([Typography Toolbar],[TYPO],[typo],[typo],[9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt])
11437 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11438 if test "x$with_java" != "xno"; then
11439     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11440     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11443 dnl ===================================================================
11444 dnl Test whether to include Sun Professional Template Pack
11445 dnl ===================================================================
11446 AC_MSG_CHECKING([for Sun Professional Template Pack integration (only supported languages displayed)])
11447 if test "$with_sun_templates" = "" -o "$with_sun_templates" = "no"; then
11448     AC_MSG_RESULT([no integration])
11449 else
11450     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_SUN_TEMPLATE_PACK"
11451     sun_supported_langs="en-US de it fr es hu"
11452     if test "$with_sun_templates" = "yes"; then
11453         wanted_sun_templates="$sun_supported_langs"
11454     else
11455         # check whether the langs are supported by Sun
11456         wanted_sun_templates=
11457         for lang in $with_sun_templates; do
11458             if test -n "`echo $sun_supported_langs | grep "$lang"`"; then
11459                 wanted_sun_templates="$wanted_sun_templates $lang"
11460             fi
11461         done
11462     fi
11463     SUNTEMPLATES_LANG=
11464     SUNTEMPLATES_DE_PACK=
11465     SUNTEMPLATES_EN_US_PACK=
11466     SUNTEMPLATES_ES_PACK=
11467     SUNTEMPLATES_FR_PACK=
11468     SUNTEMPLATES_HU_PACK=
11469     SUNTEMPLATES_IT_PACK=
11470     # check whether the langs are requested at all
11471     for lang in $wanted_sun_templates; do
11472     if test "$with_lang" = "ALL" -o -n "`echo $with_lang | grep "$lang"`"; then
11473         SUNTEMPLATES_LANG="$SUNTEMPLATES_LANG $lang"
11474         case $lang in
11475         "de") SUNTEMPLATES_DE_PACK="53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt";;
11476         "en-US") SUNTEMPLATES_EN_US_PACK="472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt";;
11477         "es") SUNTEMPLATES_ES_PACK="4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt";;
11478         "fr") SUNTEMPLATES_FR_PACK="a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt";;
11479         "hu") SUNTEMPLATES_HU_PACK="09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt";;
11480         "it") SUNTEMPLATES_IT_PACK="b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt";;
11481         esac
11482     fi
11483     done
11484     WITH_EXTRA_EXTENSIONS=TRUE
11485     AC_MSG_RESULT([$SUNTEMPLATES_LANG])
11487 AC_SUBST(SUNTEMPLATES_DE_PACK)
11488 AC_SUBST(SUNTEMPLATES_EN_US_PACK)
11489 AC_SUBST(SUNTEMPLATES_ES_PACK)
11490 AC_SUBST(SUNTEMPLATES_FR_PACK)
11491 AC_SUBST(SUNTEMPLATES_HU_PACK)
11492 AC_SUBST(SUNTEMPLATES_IT_PACK)
11494 TEST_FONTS_MISSING=0
11496 # $1  = font family
11497 # $2+ = accepted font mappings
11498 test_font_map()
11500     FONT="$1" ; shift
11501     AC_MSG_CHECKING([font mapping for '$FONT'])
11502     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11503     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11505     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11506     while test "$#" -ge 1 ; do
11507         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11508         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11509     done
11510     if test $TESTEXPR
11511     then
11512         AC_MSG_RESULT([ok])
11513     else
11514         AC_MSG_RESULT([unknown ($FONTFILE)])
11515         TEST_FONTS_MISSING=1
11516     fi
11519 dnl ===================================================================
11520 dnl Test whether to include fonts
11521 dnl ===================================================================
11522 AC_MSG_CHECKING([whether to include third-party fonts])
11523 if test "$with_fonts" != "no"; then
11524     AC_MSG_RESULT([yes])
11525     WITH_FONTS=TRUE
11526     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11527 else
11528     AC_MSG_RESULT([no])
11529     WITH_FONTS=
11530     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11531     if test "$test_fontconfig" = "yes"; then
11532         AC_PATH_PROG([FCMATCH], [fc-match])
11533         if test -z "$FCMATCH"; then
11534             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11535             TEST_FONTS_MISSING=1
11536         else
11537             test_font_map 'Calibri' 'Carlito'
11538             if test ${TEST_FONTS_MISSING} -eq 1
11539             then
11540                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11541             fi
11542         fi
11543     else
11544         TEST_FONTS_MISSING=0
11545     fi
11547 AC_SUBST(WITH_FONTS)
11548 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11550 dnl ===================================================================
11551 dnl Test whether to include extra galleries
11552 dnl ===================================================================
11553 AC_MSG_CHECKING([whether to include extra galleries])
11554 if test "$enable_extra_gallery" = "" -o "$enable_extra_gallery" = "no"; then
11555     AC_MSG_RESULT([no])
11556     WITH_EXTRA_GALLERY=
11557     OOOP_GALLERY_PACK=""
11558 else
11559     AC_MSG_RESULT([yes])
11560     WITH_EXTRA_GALLERY=TRUE
11561     BUILD_TYPE="$BUILD_TYPE EXTRA_GALLERY"
11562     SCPDEFS="$SCPDEFS -DWITH_EXTRA_GALLERY"
11563     OOOP_GALLERY_PACK="af9314c5972d95a5d6da23ffad818f68-OOOP-gallery-pack-2.8.0.0.zip"
11565 AC_SUBST(WITH_EXTRA_GALLERY)
11566 AC_SUBST(OOOP_GALLERY_PACK)
11568 dnl ===================================================================
11569 dnl Test whether to include extra templates
11570 dnl ===================================================================
11571 AC_MSG_CHECKING([whether to include extra templates])
11572 if test "$enable_extra_template" = "" -o "$enable_extra_template" = "no"; then
11573     AC_MSG_RESULT([no])
11574     WITH_EXTRA_TEMPLATE=
11575     OOOP_TEMPLATES_PACK=""
11576 else
11577     AC_MSG_RESULT([yes])
11578     WITH_EXTRA_TEMPLATE=TRUE
11579     BUILD_TYPE="$BUILD_TYPE EXTRA_TEMPLATE"
11580     SCPDEFS="$SCPDEFS -DWITH_EXTRA_TEMPLATE"
11581     OOOP_TEMPLATES_PACK="1be202fbbbc13f10592a98f70a4a87fb-OOOP-templates-pack-2.9.0.0.zip"
11583 AC_SUBST(WITH_EXTRA_TEMPLATE)
11584 AC_SUBST(OOOP_TEMPLATES_PACK)
11586 dnl ===================================================================
11587 dnl Test whether to include extra samples
11588 dnl ===================================================================
11589 AC_MSG_CHECKING([whether to include extra samples])
11590 if test "$enable_extra_sample" = "" -o "$enable_extra_sample" = "no"; then
11591     AC_MSG_RESULT([no])
11592     WITH_EXTRA_SAMPLE=
11593     OOOP_SAMPLES_PACK=""
11594 else
11595     AC_MSG_RESULT([yes])
11596     WITH_EXTRA_SAMPLE=TRUE
11597     BUILD_TYPE="$BUILD_TYPE EXTRA_SAMPLE"
11598     SCPDEFS="$SCPDEFS -DWITH_EXTRA_SAMPLE"
11599     OOOP_SAMPLES_PACK="a6bccacf44914969e6e7b2f8faf4132c-OOOP-samples-pack-2.7.0.0.zip"
11601 AC_SUBST(WITH_EXTRA_SAMPLE)
11602 AC_SUBST(OOOP_SAMPLES_PACK)
11604 dnl ===================================================================
11605 dnl Test whether to include extra fonts
11606 dnl ===================================================================
11607 AC_MSG_CHECKING([whether to include extra fonts])
11608 if test "$enable_extra_font" = "" -o "$enable_extra_font" = "no"; then
11609     AC_MSG_RESULT([no])
11610     WITH_EXTRA_FONT=
11611     OOOP_FONTS_PACK=""
11612 else
11613     AC_MSG_RESULT([yes])
11614     WITH_EXTRA_FONT=TRUE
11615     BUILD_TYPE="$BUILD_TYPE EXTRA_FONT"
11616     SCPDEFS="$SCPDEFS -DWITH_EXTRA_FONT"
11617     OOOP_FONTS_PACK="a10aa597411643326e27d7fc128af12d-OOOP-fonts-pack-2.9.0.0.zip"
11619 AC_SUBST(WITH_EXTRA_FONT)
11620 AC_SUBST(OOOP_FONTS_PACK)
11622 dnl ===================================================================
11623 dnl Test whether to enable online update service
11624 dnl ===================================================================
11625 AC_MSG_CHECKING([whether to enable online update])
11626 ENABLE_ONLINE_UPDATE=
11627 ENABLE_ONLINE_UPDATE_MAR=
11628 if test "$enable_online_update" = ""; then
11629     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11630         AC_MSG_RESULT([yes])
11631         ENABLE_ONLINE_UPDATE="TRUE"
11632     else
11633         AC_MSG_RESULT([no])
11634     fi
11635 else
11636     if test "$enable_online_update" = "mar"; then
11637         AC_MSG_RESULT([yes - MAR-based online update])
11638         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11639     elif test "$enable_online_update" = "yes"; then
11640         AC_MSG_RESULT([yes])
11641         ENABLE_ONLINE_UPDATE="TRUE"
11642     else
11643         AC_MSG_RESULT([no])
11644     fi
11646 AC_SUBST(ENABLE_ONLINE_UPDATE)
11647 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11649 dnl ===================================================================
11650 dnl Test whether we need bzip2
11651 dnl ===================================================================
11652 SYSTEM_BZIP2=
11653 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11654     AC_MSG_CHECKING([whether to use system bzip2])
11655     if test "$with_system_bzip2" = yes; then
11656         SYSTEM_BZIP2=TRUE
11657         AC_MSG_RESULT([yes])
11658         PKG_CHECK_MODULES(BZIP2, bzip2)
11659         FilterLibs "${BZIP2_LIBS}"
11660         BZIP2_LIBS="${filteredlibs}"
11661     else
11662         AC_MSG_RESULT([no])
11663         BUILD_TYPE="$BUILD_TYPE BZIP2"
11664     fi
11666 AC_SUBST(SYSTEM_BZIP2)
11667 AC_SUBST(BZIP2_CFLAGS)
11668 AC_SUBST(BZIP2_LIBS)
11670 dnl ===================================================================
11671 dnl Test whether to enable extension update
11672 dnl ===================================================================
11673 AC_MSG_CHECKING([whether to enable extension update])
11674 ENABLE_EXTENSION_UPDATE=
11675 if test "x$enable_extension_update" = "xno"; then
11676     AC_MSG_RESULT([no])
11677 else
11678     AC_MSG_RESULT([yes])
11679     ENABLE_EXTENSION_UPDATE="TRUE"
11680     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11681     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11683 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11686 dnl ===================================================================
11687 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11688 dnl ===================================================================
11689 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11690 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11691     AC_MSG_RESULT([no])
11692     ENABLE_SILENT_MSI=
11693 else
11694     AC_MSG_RESULT([yes])
11695     ENABLE_SILENT_MSI=TRUE
11696     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11698 AC_SUBST(ENABLE_SILENT_MSI)
11700 AC_MSG_CHECKING([whether and how to use Xinerama])
11701 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11702     if test "$x_libraries" = "default_x_libraries"; then
11703         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11704         if test "x$XINERAMALIB" = x; then
11705            XINERAMALIB="/usr/lib"
11706         fi
11707     else
11708         XINERAMALIB="$x_libraries"
11709     fi
11710     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11711         # we have both versions, let the user decide but use the dynamic one
11712         # per default
11713         USE_XINERAMA=TRUE
11714         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11715             XINERAMA_LINK=dynamic
11716         else
11717             XINERAMA_LINK=static
11718         fi
11719     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11720         # we have only the dynamic version
11721         USE_XINERAMA=TRUE
11722         XINERAMA_LINK=dynamic
11723     elif test -e "$XINERAMALIB/libXinerama.a"; then
11724         # static version
11725         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11726             USE_XINERAMA=TRUE
11727             XINERAMA_LINK=static
11728         else
11729             USE_XINERAMA=
11730             XINERAMA_LINK=none
11731         fi
11732     else
11733         # no Xinerama
11734         USE_XINERAMA=
11735         XINERAMA_LINK=none
11736     fi
11737     if test "$USE_XINERAMA" = "TRUE"; then
11738         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11739         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11740             [AC_MSG_ERROR(Xinerama header not found.)], [])
11741         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11742         if test "x$XEXTLIB" = x; then
11743            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11744         fi
11745         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11746         if test "$_os" = "FreeBSD"; then
11747             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11748         fi
11749         if test "$_os" = "Linux"; then
11750             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11751         fi
11752         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11753             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11754     else
11755         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11756     fi
11757 else
11758     USE_XINERAMA=
11759     XINERAMA_LINK=none
11760     AC_MSG_RESULT([no])
11762 AC_SUBST(USE_XINERAMA)
11763 AC_SUBST(XINERAMA_LINK)
11765 dnl ===================================================================
11766 dnl Test whether to build cairo or rely on the system version
11767 dnl ===================================================================
11769 if test "$USING_X11" = TRUE; then
11770     # Used in vcl/Library_vclplug_gen.mk
11771     test_cairo=yes
11774 if test "$test_cairo" = "yes"; then
11775     AC_MSG_CHECKING([whether to use the system cairo])
11777     : ${with_system_cairo:=$with_system_libs}
11778     if test "$with_system_cairo" = "yes"; then
11779         SYSTEM_CAIRO=TRUE
11780         AC_MSG_RESULT([yes])
11782         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11783         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11784         FilterLibs "${CAIRO_LIBS}"
11785         CAIRO_LIBS="${filteredlibs}"
11787         if test "$test_xrender" = "yes"; then
11788             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11789             AC_LANG_PUSH([C])
11790             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11791 #ifdef PictStandardA8
11792 #else
11793       return fail;
11794 #endif
11795 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11797             AC_LANG_POP([C])
11798         fi
11799         libo_MINGW_CHECK_DLL([libcairo])
11800         libo_MINGW_TRY_DLL([libfontconfig])
11801         libo_MINGW_TRY_DLL([libfreetype])
11802         libo_MINGW_TRY_DLL([libpixman])
11803         libo_MINGW_TRY_DLL([libpng15])
11804     else
11805         SYSTEM_CAIRO=
11806         AC_MSG_RESULT([no])
11808         BUILD_TYPE="$BUILD_TYPE CAIRO"
11809         SCPDEFS="$SCPDEFS -DNEED_CAIRO"
11810     fi
11813 AC_SUBST(SYSTEM_CAIRO)
11814 AC_SUBST(CAIRO_CFLAGS)
11815 AC_SUBST(CAIRO_LIBS)
11817 dnl ===================================================================
11818 dnl Test whether to use avahi
11819 dnl ===================================================================
11820 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11821     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11822                       [ENABLE_AVAHI="TRUE"])
11823     AC_DEFINE(HAVE_FEATURE_AVAHI)
11824     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11825     FilterLibs "${AVAHI_LIBS}"
11826     AVAHI_LIBS="${filteredlibs}"
11829 AC_SUBST(ENABLE_AVAHI)
11830 AC_SUBST(AVAHI_CFLAGS)
11831 AC_SUBST(AVAHI_LIBS)
11833 dnl ===================================================================
11834 dnl Test whether to use liblangtag
11835 dnl ===================================================================
11836 ENABLE_LIBLANGTAG=
11837 SYSTEM_LIBLANGTAG=
11838 AC_MSG_CHECKING([whether to use liblangtag])
11839 if test "$enable_liblangtag" = "yes" -o \
11840         \( "$enable_liblangtag" = "" -a $_os != Android -a $_os != iOS -a $_os != Emscripten \); then
11841     ENABLE_LIBLANGTAG=TRUE
11842     AC_MSG_RESULT([yes])
11843     AC_MSG_CHECKING([whether to use system liblangtag])
11844     if test "$with_system_liblangtag" = yes; then
11845         SYSTEM_LIBLANGTAG=TRUE
11846         AC_MSG_RESULT([yes])
11847         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11848         dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11849         PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11850         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11851         FilterLibs "${LIBLANGTAG_LIBS}"
11852         LIBLANGTAG_LIBS="${filteredlibs}"
11853         libo_MINGW_CHECK_DLL([liblangtag])
11854     else
11855         SYSTEM_LIBLANGTAG=
11856         AC_MSG_RESULT([no])
11857         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11858         LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/langtag"
11859         if test "$COM" = "MSC"; then
11860             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11861         else
11862             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11863         fi
11864     fi
11865     AC_DEFINE(ENABLE_LIBLANGTAG)
11866 else
11867     AC_MSG_RESULT([no])
11869 AC_SUBST(ENABLE_LIBLANGTAG)
11870 AC_SUBST(SYSTEM_LIBLANGTAG)
11871 AC_SUBST(LIBLANGTAG_CFLAGS)
11872 AC_SUBST(LIBLANGTAG_LIBS)
11874 dnl ===================================================================
11875 dnl Test whether to build libpng or rely on the system version
11876 dnl ===================================================================
11878 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11880 dnl ===================================================================
11881 dnl Check for runtime JVM search path
11882 dnl ===================================================================
11883 if test "$ENABLE_JAVA" != ""; then
11884     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11885     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11886         AC_MSG_RESULT([yes])
11887         if ! test -d "$with_jvm_path"; then
11888             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11889         fi
11890         if ! test -d "$with_jvm_path"jvm; then
11891             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11892         fi
11893         JVM_ONE_PATH_CHECK="$with_jvm_path"
11894         AC_SUBST(JVM_ONE_PATH_CHECK)
11895     else
11896         AC_MSG_RESULT([no])
11897     fi
11900 dnl ===================================================================
11901 dnl Test for the presence of Ant and that it works
11902 dnl ===================================================================
11904 if test "$ENABLE_JAVA" != ""; then
11905     ANT_HOME=; export ANT_HOME
11906     WITH_ANT_HOME=; export WITH_ANT_HOME
11907     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11908         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11909             if test "$_os" = "WINNT"; then
11910                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11911             else
11912                 with_ant_home="$LODE_HOME/opt/ant"
11913             fi
11914         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11915             with_ant_home="$LODE_HOME/opt/ant"
11916         fi
11917     fi
11918     if test -z "$with_ant_home"; then
11919         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11920     else
11921         if test "$_os" = "WINNT"; then
11922             # AC_PATH_PROGS needs unix path
11923             with_ant_home=`cygpath -u "$with_ant_home"`
11924         fi
11925         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11926         WITH_ANT_HOME=$with_ant_home
11927         ANT_HOME=$with_ant_home
11928     fi
11930     if test -z "$ANT"; then
11931         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11932     else
11933         # resolve relative or absolute symlink
11934         while test -h "$ANT"; do
11935             a_cwd=`pwd`
11936             a_basename=`basename "$ANT"`
11937             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11938             cd "`dirname "$ANT"`"
11939             cd "`dirname "$a_script"`"
11940             ANT="`pwd`"/"`basename "$a_script"`"
11941             cd "$a_cwd"
11942         done
11944         AC_MSG_CHECKING([if $ANT works])
11945         cat > conftest.java << EOF
11946         public class conftest {
11947             int testmethod(int a, int b) {
11948                     return a + b;
11949             }
11950         }
11953         cat > conftest.xml << EOF
11954         <project name="conftest" default="conftest">
11955         <target name="conftest">
11956             <javac srcdir="." includes="conftest.java">
11957             </javac>
11958         </target>
11959         </project>
11962         oldJAVA_HOME=$JAVA_HOME
11963         if test "$JAVACISGCJ" = "yes"; then
11964             JAVA_HOME=; export JAVA_HOME
11965             ant_gcj="-Dbuild.compiler=gcj"
11966         fi
11967         AC_TRY_COMMAND("$ANT" $ant_gcj -buildfile conftest.xml 1>&2)
11968         if test $? = 0 -a -f ./conftest.class; then
11969             AC_MSG_RESULT([Ant works])
11970             if test -z "$WITH_ANT_HOME"; then
11971                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11972                 if test -z "$ANT_HOME"; then
11973                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11974                 fi
11975             else
11976                 ANT_HOME="$WITH_ANT_HOME"
11977             fi
11978         else
11979             echo "configure: Ant test failed" >&5
11980             cat conftest.java >&5
11981             cat conftest.xml >&5
11982             AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
11983             ANT_HOME=""
11984             add_warning "Ant does not work - Some Java projects will not build!"
11985         fi
11986         JAVA_HOME=$oldJAVA_HOME
11987         rm -f conftest* core core.* *.core
11988     fi
11989     if test -z "$ANT_HOME"; then
11990         ANT_HOME="NO_ANT_HOME"
11991     else
11992         PathFormat "$ANT_HOME"
11993         ANT_HOME="$formatted_path"
11994         PathFormat "$ANT"
11995         ANT="$formatted_path"
11996     fi
11997     AC_SUBST(ANT_HOME)
11998     AC_SUBST(ANT)
12000     dnl Checking for ant.jar
12001     if test "$ANT_HOME" != "NO_ANT_HOME"; then
12002         AC_MSG_CHECKING([Ant lib directory])
12003         if test -f $ANT_HOME/lib/ant.jar; then
12004             ANT_LIB="$ANT_HOME/lib"
12005         else
12006             if test -f $ANT_HOME/ant.jar; then
12007                 ANT_LIB="$ANT_HOME"
12008             else
12009                 if test -f /usr/share/java/ant.jar; then
12010                     ANT_LIB=/usr/share/java
12011                 else
12012                     if test -f /usr/share/ant-core/lib/ant.jar; then
12013                         ANT_LIB=/usr/share/ant-core/lib
12014                     else
12015                         if test -f $ANT_HOME/lib/ant/ant.jar; then
12016                             ANT_LIB="$ANT_HOME/lib/ant"
12017                         else
12018                             if test -f /usr/share/lib/ant/ant.jar; then
12019                                 ANT_LIB=/usr/share/lib/ant
12020                             else
12021                                 AC_MSG_ERROR([Ant libraries not found!])
12022                             fi
12023                         fi
12024                     fi
12025                 fi
12026             fi
12027         fi
12028         PathFormat "$ANT_LIB"
12029         ANT_LIB="$formatted_path"
12030         AC_MSG_RESULT([Ant lib directory found.])
12031     fi
12032     AC_SUBST(ANT_LIB)
12034     ant_minver=1.6.0
12035     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
12037     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
12038     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
12039     ant_version_major=`echo $ant_version | cut -d. -f1`
12040     ant_version_minor=`echo $ant_version | cut -d. -f2`
12041     echo "configure: ant_version $ant_version " >&5
12042     echo "configure: ant_version_major $ant_version_major " >&5
12043     echo "configure: ant_version_minor $ant_version_minor " >&5
12044     if test "$ant_version_major" -ge "2"; then
12045         AC_MSG_RESULT([yes, $ant_version])
12046     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
12047         AC_MSG_RESULT([yes, $ant_version])
12048     else
12049         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
12050     fi
12052     rm -f conftest* core core.* *.core
12055 OOO_JUNIT_JAR=
12056 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12057     AC_MSG_CHECKING([for JUnit 4])
12058     if test "$with_junit" = "yes"; then
12059         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12060             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12061         elif test -e /usr/share/java/junit4.jar; then
12062             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12063         else
12064            if test -e /usr/share/lib/java/junit.jar; then
12065               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12066            else
12067               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12068            fi
12069         fi
12070     else
12071         OOO_JUNIT_JAR=$with_junit
12072     fi
12073     if test "$_os" = "WINNT"; then
12074         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12075     fi
12076     printf 'import org.junit.Before;' > conftest.java
12077     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12078         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12079     else
12080         AC_MSG_ERROR(
12081 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12082  specify its pathname via --with-junit=..., or disable it via --without-junit])
12083     fi
12084     rm -f conftest.class conftest.java
12085     if test $OOO_JUNIT_JAR != ""; then
12086     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12087     fi
12089 AC_SUBST(OOO_JUNIT_JAR)
12091 HAMCREST_JAR=
12092 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12093     AC_MSG_CHECKING([for included Hamcrest])
12094     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12095     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12096         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12097     else
12098         AC_MSG_RESULT([Not included])
12099         AC_MSG_CHECKING([for standalone hamcrest jar.])
12100         if test "$with_hamcrest" = "yes"; then
12101             if test -e /usr/share/lib/java/hamcrest.jar; then
12102                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12103             elif test -e /usr/share/java/hamcrest/core.jar; then
12104                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12105             else
12106                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12107             fi
12108         else
12109             HAMCREST_JAR=$with_hamcrest
12110         fi
12111         if test "$_os" = "WINNT"; then
12112             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12113         fi
12114         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12115             AC_MSG_RESULT([$HAMCREST_JAR])
12116         else
12117             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),
12118                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12119         fi
12120     fi
12121     rm -f conftest.class conftest.java
12123 AC_SUBST(HAMCREST_JAR)
12126 AC_SUBST(SCPDEFS)
12129 # check for wget and curl
12131 WGET=
12132 CURL=
12134 if test "$enable_fetch_external" != "no"; then
12136 CURL=`which curl 2>/dev/null`
12138 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12139     eval "$i --version" > /dev/null 2>&1
12140     ret=$?
12141     if test $ret -eq 0; then
12142         WGET=$i
12143         break
12144     fi
12145 done
12147 if test -z "$WGET" -a -z "$CURL"; then
12148     AC_MSG_ERROR([neither wget nor curl found!])
12153 AC_SUBST(WGET)
12154 AC_SUBST(CURL)
12157 # check for md5sum
12159 MD5SUM=
12161 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12162     if test "$i" = "md5"; then
12163         eval "$i -x" > /dev/null 2>&1
12164     else
12165         eval "$i --version" > /dev/null 2>&1
12166     fi
12167     ret=$?
12168     if test $ret -eq 0; then
12169         MD5SUM=$i
12170         break
12171     fi
12172 done
12174 if test "$MD5SUM" = "md5"; then
12175     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12176         MD5SUM="$MD5SUM -r"
12177     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12178         MD5SUM="$MD5SUM -n"
12179     fi
12182 if test -z "$MD5SUM"; then
12183     AC_MSG_ERROR([no md5sum found!])
12186 AC_SUBST(MD5SUM)
12188 dnl ===================================================================
12189 dnl Dealing with l10n options
12190 dnl ===================================================================
12191 AC_MSG_CHECKING([which languages to be built])
12192 # get list of all languages
12193 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12194 # the sed command does the following:
12195 #   + if a line ends with a backslash, append the next line to it
12196 #   + adds " on the beginning of the value (after =)
12197 #   + adds " at the end of the value
12198 #   + removes en-US; we want to put it on the beginning
12199 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12200 [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)]
12201 ALL_LANGS="en-US $completelangiso"
12202 # check the configured localizations
12203 WITH_LANG="$with_lang"
12204 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12205     AC_MSG_RESULT([en-US])
12206 else
12207     AC_MSG_RESULT([$WITH_LANG])
12208     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12210 # check that the list is valid
12211 for lang in $WITH_LANG; do
12212     test "$lang" = "ALL" && continue
12213     # need to check for the exact string, so add space before and after the list of all languages
12214     for vl in $ALL_LANGS; do
12215         if test "$vl" = "$lang"; then
12216            break
12217         fi
12218     done
12219     if test "$vl" != "$lang"; then
12220         # if you're reading this - you prolly quoted your languages remove the quotes ...
12221         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12222     fi
12223 done
12224 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12225     echo $WITH_LANG | grep -q en-US
12226     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12228 # list with substituted ALL
12229 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12230 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12231 test "$WITH_LANG" = "en-US" && WITH_LANG=
12232 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12233     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12234     ALL_LANGS=`echo $ALL_LANGS qtz`
12236 AC_SUBST(ALL_LANGS)
12237 AC_SUBST(WITH_LANG)
12238 AC_SUBST(WITH_LANG_LIST)
12239 AC_SUBST(GIT_NEEDED_SUBMODULES)
12241 WITH_POOR_HELP_LOCALIZATIONS=
12242 if test -d "$SRC_ROOT/translations/source"; then
12243     for l in `ls -1 $SRC_ROOT/translations/source`; do
12244         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12245             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12246         fi
12247     done
12249 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12251 if test -n "$with_locales"; then
12252     WITH_LOCALES="$with_locales"
12254     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12255     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12256     # config_host/config_locales.h.in
12257     for locale in $WITH_LOCALES; do
12258         lang=${locale%_*}
12260         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12262         case $lang in
12263         hi|mr*ne)
12264             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12265             ;;
12266         bg|ru)
12267             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12268             ;;
12269         esac
12270     done
12271 else
12272     AC_DEFINE(WITH_LOCALE_ALL)
12274 AC_SUBST(WITH_LOCALES)
12276 dnl git submodule update --reference
12277 dnl ===================================================================
12278 if test -n "${GIT_REFERENCE_SRC}"; then
12279     for repo in ${GIT_NEEDED_SUBMODULES}; do
12280         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12281             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12282         fi
12283     done
12285 AC_SUBST(GIT_REFERENCE_SRC)
12287 dnl git submodules linked dirs
12288 dnl ===================================================================
12289 if test -n "${GIT_LINK_SRC}"; then
12290     for repo in ${GIT_NEEDED_SUBMODULES}; do
12291         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12292             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12293         fi
12294     done
12296 AC_SUBST(GIT_LINK_SRC)
12298 dnl branding
12299 dnl ===================================================================
12300 AC_MSG_CHECKING([for alternative branding images directory])
12301 # initialize mapped arrays
12302 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12303 brand_files="$BRAND_INTRO_IMAGES about.svg"
12305 if test -z "$with_branding" -o "$with_branding" = "no"; then
12306     AC_MSG_RESULT([none])
12307     DEFAULT_BRAND_IMAGES="$brand_files"
12308 else
12309     if ! test -d $with_branding ; then
12310         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12311     else
12312         AC_MSG_RESULT([$with_branding])
12313         CUSTOM_BRAND_DIR="$with_branding"
12314         for lfile in $brand_files
12315         do
12316             if ! test -f $with_branding/$lfile ; then
12317                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12318                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12319             else
12320                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12321             fi
12322         done
12323         check_for_progress="yes"
12324     fi
12326 AC_SUBST([BRAND_INTRO_IMAGES])
12327 AC_SUBST([CUSTOM_BRAND_DIR])
12328 AC_SUBST([CUSTOM_BRAND_IMAGES])
12329 AC_SUBST([DEFAULT_BRAND_IMAGES])
12332 AC_MSG_CHECKING([for 'intro' progress settings])
12333 PROGRESSBARCOLOR=
12334 PROGRESSSIZE=
12335 PROGRESSPOSITION=
12336 PROGRESSFRAMECOLOR=
12337 PROGRESSTEXTCOLOR=
12338 PROGRESSTEXTBASELINE=
12340 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12341     source "$with_branding/progress.conf"
12342     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12343 else
12344     AC_MSG_RESULT([none])
12347 AC_SUBST(PROGRESSBARCOLOR)
12348 AC_SUBST(PROGRESSSIZE)
12349 AC_SUBST(PROGRESSPOSITION)
12350 AC_SUBST(PROGRESSFRAMECOLOR)
12351 AC_SUBST(PROGRESSTEXTCOLOR)
12352 AC_SUBST(PROGRESSTEXTBASELINE)
12355 AC_MSG_CHECKING([for extra build ID])
12356 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12357     EXTRA_BUILDID="$with_extra_buildid"
12359 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12360 if test -n "$EXTRA_BUILDID" ; then
12361     AC_MSG_RESULT([$EXTRA_BUILDID])
12362 else
12363     AC_MSG_RESULT([not set])
12365 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12367 OOO_VENDOR=
12368 AC_MSG_CHECKING([for vendor])
12369 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12370     OOO_VENDOR="$USERNAME"
12372     if test -z "$OOO_VENDOR"; then
12373         OOO_VENDOR="$USER"
12374     fi
12376     if test -z "$OOO_VENDOR"; then
12377         OOO_VENDOR="`id -u -n`"
12378     fi
12380     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12381 else
12382     OOO_VENDOR="$with_vendor"
12383     AC_MSG_RESULT([$OOO_VENDOR])
12385 AC_SUBST(OOO_VENDOR)
12387 if echo "$host_os" | grep -q linux-android ; then
12388     ANDROID_PACKAGE_NAME=
12389     AC_MSG_CHECKING([for Android package name])
12390     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12391         if test -n "$ENABLE_DEBUG"; then
12392             # Default to the package name that makes ndk-gdb happy.
12393             ANDROID_PACKAGE_NAME="org.libreoffice"
12394         else
12395             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12396         fi
12398         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12399     else
12400         ANDROID_PACKAGE_NAME="$with_android_package_name"
12401         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12402     fi
12403     AC_SUBST(ANDROID_PACKAGE_NAME)
12406 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12407 if test "$with_compat_oowrappers" = "yes"; then
12408     WITH_COMPAT_OOWRAPPERS=TRUE
12409     AC_MSG_RESULT(yes)
12410 else
12411     WITH_COMPAT_OOWRAPPERS=
12412     AC_MSG_RESULT(no)
12414 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12416 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12417 AC_MSG_CHECKING([for install dirname])
12418 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12419     INSTALLDIRNAME="$with_install_dirname"
12421 AC_MSG_RESULT([$INSTALLDIRNAME])
12422 AC_SUBST(INSTALLDIRNAME)
12424 AC_MSG_CHECKING([for prefix])
12425 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12426 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12427 PREFIXDIR="$prefix"
12428 AC_MSG_RESULT([$PREFIXDIR])
12429 AC_SUBST(PREFIXDIR)
12431 LIBDIR=[$(eval echo $(eval echo $libdir))]
12432 AC_SUBST(LIBDIR)
12434 DATADIR=[$(eval echo $(eval echo $datadir))]
12435 AC_SUBST(DATADIR)
12437 MANDIR=[$(eval echo $(eval echo $mandir))]
12438 AC_SUBST(MANDIR)
12440 DOCDIR=[$(eval echo $(eval echo $docdir))]
12441 AC_SUBST(DOCDIR)
12443 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12444 AC_SUBST(INSTALLDIR)
12446 TESTINSTALLDIR="${BUILDDIR}/test-install"
12447 AC_SUBST(TESTINSTALLDIR)
12450 # ===================================================================
12451 # OAuth2 id and secrets
12452 # ===================================================================
12454 AC_MSG_CHECKING([for Google Drive client id and secret])
12455 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12456 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12457 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12458     GDRIVE_CLIENT_ID="\"\""
12461 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12462     GDRIVE_CLIENT_SECRET="\"\""
12465 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12466     AC_MSG_RESULT([not set])
12467 else
12468     AC_MSG_RESULT([set])
12471 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12472 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12474 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12475 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12476 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12477 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12478     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12481 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12482     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12485 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12486     AC_MSG_RESULT([not set])
12487 else
12488     AC_MSG_RESULT([set])
12490 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12491 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12493 AC_MSG_CHECKING([for OneDrive client id and secret])
12494 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12495 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12496 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12497     ONEDRIVE_CLIENT_ID="\"\""
12500 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12501     ONEDRIVE_CLIENT_SECRET="\"\""
12504 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12505     AC_MSG_RESULT([not set])
12506 else
12507     AC_MSG_RESULT([set])
12509 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12510 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12513 dnl ===================================================================
12514 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12515 dnl --enable-dependency-tracking configure option
12516 dnl ===================================================================
12517 AC_MSG_CHECKING([whether to enable dependency tracking])
12518 if test "$enable_dependency_tracking" = "no"; then
12519     nodep=TRUE
12520     AC_MSG_RESULT([no])
12521 else
12522     AC_MSG_RESULT([yes])
12524 AC_SUBST(nodep)
12526 dnl ===================================================================
12527 dnl Number of CPUs to use during the build
12528 dnl ===================================================================
12529 AC_MSG_CHECKING([for number of processors to use])
12530 # plain --with-parallelism is just the default
12531 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12532     if test "$with_parallelism" = "no"; then
12533         PARALLELISM=0
12534     else
12535         PARALLELISM=$with_parallelism
12536     fi
12537 else
12538     if test "$enable_icecream" = "yes"; then
12539         PARALLELISM="10"
12540     else
12541         case `uname -s` in
12543         Darwin|FreeBSD|NetBSD|OpenBSD)
12544             PARALLELISM=`sysctl -n hw.ncpu`
12545             ;;
12547         Linux)
12548             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12549         ;;
12550         # what else than above does profit here *and* has /proc?
12551         *)
12552             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12553             ;;
12554         esac
12556         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12557         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12558     fi
12561 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12562     if test -z "$with_parallelism"; then
12563             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12564             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12565             PARALLELISM="1"
12566     else
12567         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."
12568     fi
12571 if test $PARALLELISM -eq 0; then
12572     AC_MSG_RESULT([explicit make -j option needed])
12573 else
12574     AC_MSG_RESULT([$PARALLELISM])
12576 AC_SUBST(PARALLELISM)
12578 IWYU_PATH="$with_iwyu"
12579 AC_SUBST(IWYU_PATH)
12580 if test ! -z "$IWYU_PATH"; then
12581     if test ! -f "$IWYU_PATH"; then
12582         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12583     fi
12587 # Set up ILIB for MSVC build
12589 ILIB1=
12590 if test "$build_os" = "cygwin"; then
12591     ILIB="."
12592     if test -n "$JAVA_HOME" -a "$JAVA_HOME" != "NO_JAVA_HOME"; then
12593         ILIB="$ILIB;$JAVA_HOME/lib"
12594     fi
12595     ILIB1=-link
12596     if test "$BITNESS_OVERRIDE" = 64; then
12597         ILIB="$ILIB;$COMPATH/lib/amd64"
12598         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12599         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12600         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12601         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12602             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12603             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12604         fi
12605         if test $VCVER = 140; then
12606             PathFormat "$ucrttest"
12607             ucrtlibpath_formatted="${formatted_path}lib/$ucrtdir/ucrt/x64"
12608             ILIB="$ILIB;$ucrtlibpath_formatted"
12609         fi
12610     else
12611         ILIB="$ILIB;$COMPATH/lib"
12612         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12613         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12614         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12615         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12616             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12617             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12618         fi
12619         if test $VCVER = 140; then
12620             PathFormat "$ucrttest"
12621             ucrtlibpath_formatted="${formatted_path}lib/$ucrtdir/ucrt/x86"
12622             ILIB="$ILIB;$ucrtlibpath_formatted"
12623         fi
12624     fi
12625     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12626         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12627     else
12628         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12629     fi
12631     AC_SUBST(ILIB)
12634 AC_MSG_CHECKING(
12635     [whether C++11 use of const_iterator in standard containers is broken])
12636 save_CXXFLAGS=$CXXFLAGS
12637 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12638 AC_LANG_PUSH([C++])
12639 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12640     #include <list>
12641     ]],[[
12642         std::list<int> l;
12643         l.erase(l.cbegin());
12644     ]])],
12645     [broken=no], [broken=yes])
12646 AC_LANG_POP([C++])
12647 LIBS=$save_LIBS
12648 CXXFLAGS=$save_CXXFLAGS
12649 AC_MSG_RESULT([$broken])
12650 if test "$broken" = yes; then
12651     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12655 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12656 if test "$CROSS_COMPILING" = "TRUE"; then
12657     broken='assuming not (cross-compiling)'
12658 else
12659     save_CXXFLAGS=$CXXFLAGS
12660     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12661     save_LIBS=$LIBS
12662     if test -n "$ILIB1"; then
12663         LIBS="$LIBS $ILIB1"
12664     fi
12665     AC_LANG_PUSH([C++])
12666     AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12667         // Exit with failure if the static initializer_list is stored on the
12668         // stack (as done by Clang < 3.4):
12669         #include <initializer_list>
12670         struct S {};
12671         bool g(void const * p1, void const * p2) {
12672             int n;
12673             return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12674         }
12675         bool f(void const * p1) {
12676             static std::initializer_list<S> s { S() };
12677             return g(p1, s.begin());
12678         }
12679         ]],[[
12680             int n;
12681             return f(&n) ? 0 : 1;
12682         ]])], [broken=no], [broken=yes])
12683     AC_LANG_POP([C++])
12684     LIBS=$save_LIBS
12685     CXXFLAGS=$save_CXXFLAGS
12687 AC_MSG_RESULT([$broken])
12688 if test "$broken" = yes; then
12689     AC_DEFINE([HAVE_BROKEN_STATIC_INITILIZER_LIST])
12693 # ===================================================================
12694 # Creating bigger shared library to link against
12695 # ===================================================================
12696 AC_MSG_CHECKING([whether to create huge library])
12697 MERGELIBS=
12699 if test $_os = iOS -o $_os = Android; then
12700     # Never any point in mergelibs for these as we build just static
12701     # libraries anyway...
12702     enable_mergelibs=no
12705 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12706     if test $_os != Linux -a $_os != WINNT; then
12707         add_warning "--enable-mergelibs is not tested for this platform"
12708     fi
12709     MERGELIBS="TRUE"
12710     AC_MSG_RESULT([yes])
12711 else
12712     AC_MSG_RESULT([no])
12714 AC_SUBST([MERGELIBS])
12716 # ===================================================================
12717 # Create hardlinks on deliver instead of copying for smaller size and speed up
12718 # ===================================================================
12719 AC_MSG_CHECKING([whether to create hardlinks for delivering files])
12720 HARDLINKDELIVER=
12721 if test "$enable_hardlink_deliver" = "yes"; then
12722     HARDLINKDELIVER="TRUE"
12723     AC_MSG_RESULT([yes])
12724 else
12725     AC_MSG_RESULT([no])
12727 AC_SUBST(HARDLINKDELIVER)
12729 dnl ===================================================================
12730 dnl icerun is a wrapper that stops us spawning tens of processes
12731 dnl locally - for tools that can't be executed on the compile cluster
12732 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12733 dnl ===================================================================
12734 AC_MSG_CHECKING([whether to use icerun wrapper])
12735 ICECREAM_RUN=
12736 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12737     ICECREAM_RUN=icerun
12738     AC_MSG_RESULT([yes])
12739 else
12740     AC_MSG_RESULT([no])
12742 AC_SUBST(ICECREAM_RUN)
12744 dnl ===================================================================
12745 dnl Setup the ICECC_VERSION for the build the same way it was set for
12746 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12747 dnl ===================================================================
12748 x_ICECC_VERSION=[\#]
12749 if test -n "$ICECC_VERSION" ; then
12750     x_ICECC_VERSION=
12752 AC_SUBST(x_ICECC_VERSION)
12753 AC_SUBST(ICECC_VERSION)
12755 dnl ===================================================================
12757 AC_MSG_CHECKING([MPL subset])
12758 MPL_SUBSET=
12760 if test "$enable_mpl_subset" = "yes"; then
12761     warn_report=false
12762     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12763         warn_report=true
12764     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12765         warn_report=true
12766     fi
12767     if test "$warn_report" = "true"; then
12768         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12769     fi
12770     if test "x$enable_postgresql_sdbc" != "xno"; then
12771         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12772     fi
12773     if test "$enable_lotuswordpro" = "yes"; then
12774         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12775     fi
12776     if test "$WITH_WEBDAV" = "neon"; then
12777         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12778     fi
12779     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12780         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12781     fi
12782     if test -n "$ENABLE_PDFIMPORT"; then
12783         if test "x$SYSTEM_POPPLER" = "x"; then
12784             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12785         fi
12786     fi
12787     # cf. m4/libo_check_extension.m4
12788     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12789         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12790     fi
12791     for theme in $WITH_THEMES; do
12792         case $theme in
12793         breeze|crystal|default|hicontrast|human|oxygen|sifr)
12794             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12795         *) : ;;
12796         esac
12797     done
12799     ENABLE_OPENGL=
12801     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12802         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12803     fi
12805     MPL_SUBSET="TRUE"
12806     AC_DEFINE(MPL_HAVE_SUBSET)
12807     AC_MSG_RESULT([only])
12808 else
12809     AC_MSG_RESULT([no restrictions])
12811 AC_SUBST(MPL_SUBSET)
12814 dnl ===================================================================
12815 dnl Setting up the environment.
12816 dnl ===================================================================
12817 AC_MSG_NOTICE([setting up the build environment variables...])
12819 AC_SUBST(COMPATH)
12821 if test "$build_os" = "cygwin"; then
12822     if test "$DISABLE_ACTIVEX" = "TRUE"; then
12823         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12824         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12825     else
12826         ATL_LIB="$COMPATH/atlmfc/lib"
12827         ATL_INCLUDE="$COMPATH/atlmfc/include"
12828     fi
12829     if test "$BITNESS_OVERRIDE" = 64; then
12830         ATL_LIB="$ATL_LIB/amd64"
12831     fi
12832     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12833     PathFormat "/usr/bin/find.exe"
12834     FIND="$formatted_path"
12835     PathFormat "/usr/bin/sort.exe"
12836     SORT="$formatted_path"
12837     PathFormat "/usr/bin/grep.exe"
12838     WIN_GREP="$formatted_path"
12839     PathFormat "/usr/bin/ls.exe"
12840     WIN_LS="$formatted_path"
12841     PathFormat "/usr/bin/touch.exe"
12842     WIN_TOUCH="$formatted_path"
12843 else
12844     FIND=find
12845     SORT=sort
12848 AC_SUBST(ATL_INCLUDE)
12849 AC_SUBST(ATL_LIB)
12850 AC_SUBST(FIND)
12851 AC_SUBST(SORT)
12852 AC_SUBST(WIN_GREP)
12853 AC_SUBST(WIN_LS)
12854 AC_SUBST(WIN_TOUCH)
12856 AC_SUBST(BUILD_TYPE)
12858 AC_SUBST(SOLARINC)
12860 PathFormat "$PERL"
12861 PERL="$formatted_path"
12862 AC_SUBST(PERL)
12864 if test -n "$TMPDIR"; then
12865     TEMP_DIRECTORY="$TMPDIR"
12866 else
12867     TEMP_DIRECTORY="/tmp"
12869 if test "$build_os" = "cygwin"; then
12870     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12872 AC_SUBST(TEMP_DIRECTORY)
12874 # setup the PATH for the environment
12875 if test -n "$LO_PATH_FOR_BUILD"; then
12876     LO_PATH="$LO_PATH_FOR_BUILD"
12877 else
12878     LO_PATH="$PATH"
12880     case "$host_os" in
12882     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12883         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12884             pathmunge "$JAVA_HOME/bin" "after"
12885         fi
12886         ;;
12888     cygwin*)
12889         # Win32 make needs native paths
12890         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12891             LO_PATH=`cygpath -p -m "$PATH"`
12892         fi
12893         if test "$BITNESS_OVERRIDE" = 64; then
12894             # needed for msi packaging
12895             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12896         fi
12897         pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12898         pathmunge "$ASM_HOME" "before"
12899         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12900         pathmunge "$CSC_PATH" "before"
12901         pathmunge "$MIDL_PATH" "before"
12902         pathmunge "$AL_PATH" "before"
12903         pathmunge "$MSPDB_PATH" "before"
12904         if test -n "$MSBUILD_PATH" ; then
12905             pathmunge "$MSBUILD_PATH" "before"
12906         fi
12907         if test "$BITNESS_OVERRIDE" = 64; then
12908             if test "$vcexpress" = "Express"; then
12909                 pathmunge "$COMPATH/bin/x86_amd64" "before"
12910                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12911             else
12912                 pathmunge "$COMPATH/bin/amd64" "before"
12913                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12914             fi
12915         else
12916             pathmunge "$COMPATH/bin" "before"
12917             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12918         fi
12919         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12920             if test -d "$JAVA_HOME/jre/bin/client"; then
12921                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12922             fi
12923             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12924                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12925             fi
12926             pathmunge "$JAVA_HOME/bin" "before"
12927         fi
12928         ;;
12930     solaris*)
12931         pathmunge "/usr/css/bin" "before"
12932         if test "$ENABLE_JAVA" != "" -a "$JDK"!="gcj"; then
12933             pathmunge "$JAVA_HOME/bin" "after"
12934         fi
12935         ;;
12936     esac
12939 AC_SUBST(LO_PATH)
12941 # Generate a configuration md5 we can use for deps
12942 if test -f config_host.mk; then
12943     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12945 if test -f config_host_lang.mk; then
12946     config_lang_md5=`$MD5SUM config_host_lang.mk | sed "s/ .*//"`
12949 AC_CONFIG_FILES([config_host.mk
12950                  config_host_lang.mk
12951                  Makefile
12952                  lo.xcent
12953                  instsetoo_native/util/openoffice.lst
12954                  sysui/desktop/macosx/Info.plist
12955                  ios/lo.xcconfig])
12956 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12957 AC_CONFIG_HEADERS([config_host/config_clang.h])
12958 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12959 AC_CONFIG_HEADERS([config_host/config_eot.h])
12960 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12961 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12962 AC_CONFIG_HEADERS([config_host/config_cups.h])
12963 AC_CONFIG_HEADERS([config_host/config_features.h])
12964 AC_CONFIG_HEADERS([config_host/config_folders.h])
12965 AC_CONFIG_HEADERS([config_host/config_gcc.h])
12966 AC_CONFIG_HEADERS([config_host/config_global.h])
12967 AC_CONFIG_HEADERS([config_host/config_graphite.h])
12968 AC_CONFIG_HEADERS([config_host/config_java.h])
12969 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12970 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12971 AC_CONFIG_HEADERS([config_host/config_locales.h])
12972 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12973 AC_CONFIG_HEADERS([config_host/config_orcus.h])
12974 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12975 AC_CONFIG_HEADERS([config_host/config_oox.h])
12976 AC_CONFIG_HEADERS([config_host/config_opengl.h])
12977 AC_CONFIG_HEADERS([config_host/config_options.h])
12978 AC_CONFIG_HEADERS([config_host/config_test.h])
12979 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12980 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12981 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12982 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12983 AC_CONFIG_HEADERS([config_host/config_version.h])
12984 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12985 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12986 AC_CONFIG_HEADERS([config_host/config_python.h])
12987 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12988 AC_OUTPUT
12990 if test "$CROSS_COMPILING" = TRUE; then
12991     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12994 # touch the config timestamp file
12995 if test ! -f config_host.mk.stamp; then
12996     echo > config_host.mk.stamp
12997 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12998     echo "Configuration unchanged - avoiding scp2 stamp update"
12999 else
13000     echo > config_host.mk.stamp
13003 # touch the config lang timestamp file
13004 if test ! -f config_host_lang.mk.stamp; then
13005     echo > config_host_lang.mk.stamp
13006 elif test "$config_lang_md5" = `$MD5SUM config_host_lang.mk | sed "s/ .*//"`; then
13007     echo "Configuration unchanged - avoiding scp2 stamp update"
13008 else
13009     echo > config_host_lang.mk.stamp
13013 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
13015 cat << _EOS
13016 ****************************************************************************
13017 WARNING:
13018 Your make version is known to be horribly slow, and hard to debug
13019 problems with. To get a reasonably functional make please do:
13021 to install a pre-compiled binary make for Win32
13023  mkdir -p /opt/lo/bin
13024  cd /opt/lo/bin
13025  wget http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
13026  cp make-85047eb-msvc.exe make
13027  chmod +x make
13029 to install from source:
13030 place yourself in a working directory of you choice.
13032  git clone git://git.savannah.gnu.org/make.git
13034  [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"]
13035  set PATH=%PATH%;C:\Cygwin\bin
13036  [or Cygwin64, if that is what you have]
13037  cd path-to-make-repo-you-cloned-above
13038  build_w32.bat --without-guile
13040 should result in a WinRel/gnumake.exe.
13041 Copy it to to the Cygwin /opt/lo/bin directory as make.exe
13043 Then re-run autogen.sh
13045 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
13046 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
13048 _EOS
13051 cat << _EOF
13052 ****************************************************************************
13054 To build, run:
13055 $GNUMAKE
13057 To view some help, run:
13058 $GNUMAKE help
13060 _EOF
13062 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
13063     cat << _EOF
13064 After the build has finished, you can immediately run it using:
13065 _EOF
13067     if test $_os = Darwin; then
13068         echo open instdir/$PRODUCTNAME.app
13069     else
13070         echo instdir/program/soffice
13071     fi
13072     cat << _EOF
13074 If you want to run the smoketest, run:
13075 $GNUMAKE check
13077 _EOF
13080 if test -f warn; then
13081     cat warn
13082     rm warn
13085 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: