tdf#104310: Accept also x14-style dataValidations
[LibreOffice.git] / configure.ac
blob082b311f063bb2cb946481ee6495ade881c53d98
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.4.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84     fi
87 AbsolutePath()
89     # There appears to be no simple and portable method to get an absolute and
90     # canonical path, so we try creating the directory if does not exist and
91     # utilizing the shell and pwd.
92     rel="$1"
93     absolute_path=""
94     test ! -e "$rel" && mkdir -p "$rel"
95     if test -d "$rel" ; then
96         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
97         absolute_path="$(pwd)"
98         cd - > /dev/null
99     else
100         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
101     fi
104 rm -f warn
105 have_WARNINGS="no"
106 add_warning()
108     if test "$have_WARNINGS" = "no"; then
109         echo "*************************************" > warn
110         have_WARNINGS="yes"
111         if which tput >/dev/null 2>/dev/null && test `tput colors` -ge 8; then
112             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
113             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
114         else
115             COLORWARN="* WARNING :"
116         fi
117     fi
118     echo "$COLORWARN $@" >> warn
121 dnl Some Mac User have the bad habbit of letting a lot fo crap
122 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
123 dnl that confuse the build.
124 dnl For the ones that use LODE, let's be nice and protect them
125 dnl from themselves
127 mac_sanitize_path()
129     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
130 dnl a common but nevertheless necessary thing that may be in a fancy
131 dnl path location is git, so make sure we have it
132     mac_git_path=`which git 2>/dev/null`
133     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
134         mac_path="$mac_path:`dirname $mac_git_path`"
135     fi
136     PATH="$mac_path"
137     unset mac_path
138     unset git_mac_path
141 echo "********************************************************************"
142 echo "*"
143 echo "*   Running ${PACKAGE_NAME} build configuration."
144 echo "*"
145 echo "********************************************************************"
146 echo ""
148 dnl ===================================================================
149 dnl checks build and host OSes
150 dnl do this before argument processing to allow for platform dependent defaults
151 dnl ===================================================================
152 AC_CANONICAL_HOST
154 AC_MSG_CHECKING([for product name])
155 PRODUCTNAME="AC_PACKAGE_NAME"
156 if test -n "$with_product_name" -a "$with_product_name" != no; then
157     PRODUCTNAME="$with_product_name"
159 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
160     PRODUCTNAME="${PRODUCTNAME}Dev"
162 AC_MSG_RESULT([$PRODUCTNAME])
163 AC_SUBST(PRODUCTNAME)
164 PRODUCTNAME_WITHOUT_SPACES=${PRODUCTNAME// /}
165 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
167 dnl ===================================================================
168 dnl Our version is defined by the AC_INIT() at the top of this script.
169 dnl ===================================================================
171 set `echo AC_PACKAGE_VERSION | sed "s/\./ /g"`
173 LIBO_VERSION_MAJOR=$1
174 LIBO_VERSION_MINOR=$2
175 LIBO_VERSION_MICRO=$3
176 LIBO_VERSION_PATCH=$4
178 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
179 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
180 # no way to encode that into an integer in general.
181 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
183 LIBO_VERSION_SUFFIX=$5
184 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
185 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
186 # they get undoubled before actually passed to sed.
187 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
188 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
189 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
190 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
192 AC_SUBST(LIBO_VERSION_MAJOR)
193 AC_SUBST(LIBO_VERSION_MINOR)
194 AC_SUBST(LIBO_VERSION_MICRO)
195 AC_SUBST(LIBO_VERSION_PATCH)
196 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
197 AC_SUBST(LIBO_VERSION_SUFFIX)
198 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
200 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
201 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
202 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
203 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
205 LIBO_THIS_YEAR=`date +%Y`
206 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
208 dnl ===================================================================
209 dnl Product version
210 dnl ===================================================================
211 AC_MSG_CHECKING([for product version])
212 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
213 AC_MSG_RESULT([$PRODUCTVERSION])
214 AC_SUBST(PRODUCTVERSION)
216 AC_PROG_EGREP
217 # AC_PROG_EGREP doesn't set GREP on all systems as well
218 AC_PATH_PROG(GREP, grep)
220 BUILDDIR=`pwd`
221 cd $srcdir
222 SRC_ROOT=`pwd`
223 cd $BUILDDIR
224 x_Cygwin=[\#]
226 dnl ======================================
227 dnl Required GObject introspection version
228 dnl ======================================
229 INTROSPECTION_REQUIRED_VERSION=1.32.0
231 dnl ===================================================================
232 dnl Search all the common names for GNU Make
233 dnl ===================================================================
234 AC_MSG_CHECKING([for GNU Make])
236 # try to use our own make if it is available and GNUMAKE was not already defined
237 if test -z "$GNUMAKE"; then
238     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
239         GNUMAKE="$LODE_HOME/opt/bin/make"
240     elif test -x "/opt/lo/bin/make"; then
241         GNUMAKE="/opt/lo/bin/make"
242     fi
245 GNUMAKE_WIN_NATIVE=
246 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
247     if test -n "$a"; then
248         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
249         if test $? -eq 0;  then
250             if test "$build_os" = "cygwin"; then
251                 if test -n "$($a -v | grep 'Built for Windows')" ; then
252                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
253                     GNUMAKE_WIN_NATIVE="TRUE"
254                 else
255                     GNUMAKE=`which $a`
256                 fi
257             else
258                 GNUMAKE=`which $a`
259             fi
260             break
261         fi
262     fi
263 done
264 AC_MSG_RESULT($GNUMAKE)
265 if test -z "$GNUMAKE"; then
266     AC_MSG_ERROR([not found. install GNU Make.])
267 else
268     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
269         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
270     fi
273 win_short_path_for_make()
275     local_short_path="$1"
276     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
277         cygpath -sm "$local_short_path"
278     else
279         cygpath -u "$(cygpath -d "$local_short_path")"
280     fi
284 if test "$build_os" = "cygwin"; then
285     PathFormat "$SRC_ROOT"
286     SRC_ROOT="$formatted_path"
287     PathFormat "$BUILDDIR"
288     BUILDDIR="$formatted_path"
289     x_Cygwin=
290     AC_MSG_CHECKING(for explicit COMSPEC)
291     if test -z "$COMSPEC"; then
292         AC_MSG_ERROR([COMSPEC not set in Environment, please set it an rerun])
293     fi
296 AC_SUBST(SRC_ROOT)
297 AC_SUBST(BUILDDIR)
298 AC_SUBST(x_Cygwin)
299 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
300 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
302 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
303     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
306 # need sed in os checks...
307 AC_PATH_PROGS(SED, sed)
308 if test -z "$SED"; then
309     AC_MSG_ERROR([install sed to run this script])
312 # Set the ENABLE_LTO variable
313 # ===================================================================
314 AC_MSG_CHECKING([whether to use link-time optimization])
315 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
316     ENABLE_LTO="TRUE"
317     AC_MSG_RESULT([yes])
318     AC_DEFINE(STATIC_LINKING)
319 else
320     ENABLE_LTO=""
321     AC_MSG_RESULT([no])
323 AC_SUBST(ENABLE_LTO)
325 dnl ===================================================================
326 dnl When building for Android, --with-android-ndk,
327 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
328 dnl mandatory
329 dnl ===================================================================
331 AC_ARG_WITH(android-ndk,
332     AS_HELP_STRING([--with-android-ndk],
333         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
336 AC_ARG_WITH(android-ndk-toolchain-version,
337     AS_HELP_STRING([--with-android-ndk-toolchain-version],
338         [Specify which toolchain version to use, of those present in the
339         Android NDK you are using. The default is 4.9 currently.]), ,)
341 AC_ARG_WITH(android-sdk,
342     AS_HELP_STRING([--with-android-sdk],
343         [Specify location of the Android SDK. Mandatory when building for Android,
344         or when building the Impress Remote Android app.]),
347 ANDROID_NDK_HOME=
348 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
349     with_android_ndk="$SRC_ROOT/external/android-ndk"
351 if test -n "$with_android_ndk"; then
352     ANDROID_NDK_HOME=$with_android_ndk
354     # Set up a lot of pre-canned defaults
356     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
357         if test ! -f $ANDROID_NDK_HOME/source.properties; then
358             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
359         fi
360         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
361     else
362         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
363     fi
364     if test -z "$ANDROID_NDK_VERSION";  then
365         AC_MSG_ERROR([Failed to determine android NDK version. Please check your installation.])
366     fi
367     case $ANDROID_NDK_VERSION in
368     r9*|r10*)
369         ;;
370     11.1.*|12.1.*|13.1.*)
371         ;;
372     *)
373         AC_MSG_WARN([Untested android NDK version $ANDROID_NDK_VERSION, only versions r9* til 13.1.* have been used successfully. Proceed at your own risk.])
374         add_warning "Untested android NDK version $ANDROID_NDK_VERSION, only versions r9* til 13.1.* have been used successfully. Proceed at your own risk."
375         ;;
376     esac
378     if test $host_cpu = arm; then
379         android_cpu=arm
380         android_platform_prefix=$android_cpu-linux-androideabi
381     elif test $host_cpu = aarch64; then
382         android_cpu=aarch64
383         android_platform_prefix=$android_cpu-linux-android
384     elif test $host_cpu = mips; then
385         android_cpu=mips
386         android_platform_prefix=$android_cpu-linux-androideabi
387     else
388         # host_cpu is something like "i386" or "i686" I guess, NDK uses
389         # "x86" in some contexts
390         android_cpu=x86
391         android_platform_prefix=$android_cpu
392     fi
394     if test -z "$with_android_ndk_toolchain_version"; then
395         # Default to gcc 4.9
396         with_android_ndk_toolchain_version=4.9
397     fi
399     case "$with_android_ndk_toolchain_version" in
400     4.6|4.7|4.8|4.9)
401         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$with_android_ndk_toolchain_version
402         ANDROID_COMPILER_DIR=$ANDROID_BINUTILS_DIR
403         ;;
404     clang3.3|clang3.4)
405         AC_MSG_WARN([Building with the Clang tool-chain is known to break in the bridges module, fix that please])
406         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-4.8
407         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm-${with_android_ndk_toolchain_version#clang}
408         ANDROID_USING_CLANG=true
409         ;;
410     *)
411         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option])
412     esac
414     if test ! -d $ANDROID_BINUTILS_DIR; then
415         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
416     elif test $ANDROID_COMPILER_DIR != $ANDROID_BINUTILS_DIR -a ! -d $ANDROID_COMPILER_DIR; then
417         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
418     fi
420     # Check if there is a 64-bit tool-chain. Google provides a NDK with 64-bit tool-chain binaries in
421     # NDK r8e and later, and for earlier NDKs it was possible to build one yourself. Using a 64-bit
422     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
423     # manage to link the (app-specific) single huge .so that is built for the app in
424     # android/source/ if there is debug information in a significant part of the object files.
425     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
426     # all objects have been built with debug information.)
427     toolchain_system='*'
428     case $build_os in
429     linux-gnu*)
430         ndk_build_os=linux
431         ;;
432     darwin*)
433         ndk_build_os=darwin
434         ;;
435     *)
436         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
437         ;;
438     esac
440     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86/bin
441     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86
442     if test $build_cpu = x86_64; then
443         if test -d $ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64; then
444             ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
445         fi
446         if test -d $ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64; then
447             ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
448         fi
449     fi
450     ANDROID_BINUTILS_BIN=$ANDROID_BINUTILS_PREBUILT_ROOT/bin
452     # This stays empty if there is just one version of the toolchain in the NDK
453     ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=
454     if test ! -d "$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/libs" ; then
455         # nope, won't work if empty...
456         # as is the case when using the ndk-bundle as installed with android studio
457         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
458         if test -n "$ANDROID_USING_CLANG"; then
459             ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR=4.8/
460         fi
461     fi
463     ANDROID_API_LEVEL=15
464     if test $host_cpu = arm; then
465         android_gnu_prefix=arm-linux-androideabi
466     elif test $host_cpu = aarch64; then
467         android_gnu_prefix=aarch64-linux-android
468         ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR="${with_android_ndk_toolchain_version}/"
469         ANDROID_API_LEVEL=L
470     elif test $host_cpu = mips; then
471         android_gnu_prefix=mipsel-linux-android
472     elif test $ANDROID_NDK_VERSION = r8; then
473         # The prefix used for the x86 tool-chain changed between NDK r8 and r8b
474         android_gnu_prefix=i686-android-linux
475     else
476         android_gnu_prefix=i686-linux-android
477     fi
479     ANDROID_ARCH=$android_cpu
480     if test $host_cpu = arm; then
481         ANDROID_APP_ABI=armeabi-v7a
482         if test -n "$ANDROID_USING_CLANG"; then
483             ANDROIDCFLAGS="-gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT"
484             ANDROIDCFLAGS="$ANDROIDCFLAGS -target armv7-none-linux-androideabi"
485             ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes"
486         else
487             :
488         fi
489         ANDROIDCFLAGS="$ANDROIDCFLAGS -mthumb"
490         ANDROIDCFLAGS="$ANDROIDCFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
491         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wl,--fix-cortex-a8"
492     elif test $host_cpu = aarch64; then
493         ANDROID_APP_ABI=arm64-v8a
494         ANDROID_ARCH=arm64
495     elif test $host_cpu = mips; then
496         ANDROID_APP_ABI=mips
497         ANDROIDCFLAGS=""
498     else # x86
499         ANDROID_APP_ABI=x86
500         ANDROIDCFLAGS="-march=atom"
501     fi
502     ANDROIDCFLAGS="$ANDROIDCFLAGS -ffunction-sections -fdata-sections"
503     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/${ANDROID_NDK_TOOLCHAIN_VERSION_SUBDIR}libs/$ANDROID_APP_ABI"
504     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}"
505     export PKG_CONFIG_LIBDIR="$ANDROID_BINUTILS_PREBUILT_ROOT/lib/pkgconfig"
507     if test -n "$ANDROID_USING_CLANG"; then
508         ANDROIDCFLAGS="$ANDROIDCFLAGS -Qunused-arguments"
509     else
510         ANDROIDCFLAGS="$ANDROIDCFLAGS -Wno-psabi"
511     fi
513     test -z "$SYSBASE" && export SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
514     test -z "$AR" && AR=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ar
515     test -z "$NM" && NM=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-nm
516     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-objdump
517     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-ranlib
518     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_BIN/$android_gnu_prefix-strip
520     # When using the 4.6 or newer toolchain, use the gold linker
521     case "$with_android_ndk_toolchain_version" in
522     4.[[6789]]*|[[56789]].*|clang*)
523         if test "$host_cpu" = arm -a "$ENABLE_LTO" != TRUE; then
524             ANDROIDCFLAGS="$ANDROIDCFLAGS -fuse-ld=gold"
525         fi
526         ;;
527     esac
529     if test "$ENABLE_LTO" = TRUE; then
530         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
531         # $CC and $CXX when building external libraries
532          if test "$COM_IS_CLANG" = TRUE; then
533             ANDROIDCFLAGS="$ANDROIDCFLAGS -flto"
534         else
535             ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
536         fi
537     fi
539     # gdbserver can be in different locations
540     if test -f $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver; then
541         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver
542     elif test -f $ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver; then
543         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-$android_cpu/gdbserver/gdbserver
544     elif test $android_cpu = aarch64; then
545         ANDROID_NDK_GDBSERVER=$ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver
546     else
547         AC_MSG_ERROR([Can't find gdbserver for your Android target])
548     fi
550     if test $host_cpu = arm; then
551         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"
552     elif test $host_cpu = mips; then
553         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"
554     else # x86
555         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"
556     fi
558     if test -z "$CC"; then
559         case "$with_android_ndk_toolchain_version" in
560         4.*)
561             CC="$ANDROID_COMPILER_BIN/$android_gnu_prefix-gcc $ANDROIDCFLAGS"
562             ;;
563         clang*)
564             CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
565         esac
566     fi
567     if test -z "$CXX"; then
568         case "$with_android_ndk_toolchain_version" in
569         4.*)
570             CXX="$ANDROID_COMPILER_BIN/$android_gnu_prefix-g++ $ANDROIDCXXFLAGS"
571             ;;
572         clang*)
573             CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
574             ;;
575         esac
576     fi
578     # remember to download the ownCloud Android library later
579     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
581 AC_SUBST(ANDROID_NDK_GDBSERVER)
582 AC_SUBST(ANDROID_APP_ABI)
584 dnl ===================================================================
585 dnl --with-android-sdk
586 dnl ===================================================================
587 ANDROID_SDK_HOME=
588 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
589     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
591 if test -n "$with_android_sdk"; then
592     ANDROID_SDK_HOME=$with_android_sdk
593     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
595 AC_SUBST(ANDROID_SDK_HOME)
597 dnl ===================================================================
598 dnl The following is a list of supported systems.
599 dnl Sequential to keep the logic very simple
600 dnl These values may be checked and reset later.
601 dnl ===================================================================
602 #defaults unless the os test overrides this:
603 test_randr=yes
604 test_xrender=yes
605 test_cups=yes
606 test_dbus=yes
607 test_fontconfig=yes
608 test_cairo=no
610 # Default values, as such probably valid just for Linux, set
611 # differently below just for Mac OSX,but at least better than
612 # hardcoding these as we used to do. Much of this is duplicated also
613 # in solenv for old build system and for gbuild, ideally we should
614 # perhaps define stuff like this only here in configure.ac?
616 LINKFLAGSSHL="-shared"
617 PICSWITCH="-fpic"
618 DLLPOST=".so"
620 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
622 INSTROOTSUFFIX=
623 SDKDIRNAME=sdk
625 case "$host_os" in
627 solaris*)
628     test_gtk=yes
629     build_gstreamer_1_0=yes
630     build_gstreamer_0_10=yes
631     test_tde=yes
632     test_freetype=yes
633     _os=SunOS
635     dnl ===========================================================
636     dnl Check whether we're using Solaris 10 - SPARC or Intel.
637     dnl ===========================================================
638     AC_MSG_CHECKING([the Solaris operating system release])
639     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
640     if test "$_os_release" -lt "10"; then
641         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
642     else
643         AC_MSG_RESULT([ok ($_os_release)])
644     fi
646     dnl Check whether we're using a SPARC or i386 processor
647     AC_MSG_CHECKING([the processor type])
648     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
649         AC_MSG_RESULT([ok ($host_cpu)])
650     else
651         AC_MSG_ERROR([only SPARC and i386 processors are supported])
652     fi
653     ;;
655 linux-gnu*|k*bsd*-gnu*)
656     test_gtk=yes
657     build_gstreamer_1_0=yes
658     build_gstreamer_0_10=yes
659     test_tde=yes
660     test_kde4=yes
661     test_freetype=yes
662     _os=Linux
663     ;;
665 gnu)
666     test_randr=no
667     test_xrender=no
668     _os=GNU
669      ;;
671 cygwin*|interix*|mingw32*)
673     # When building on Windows normally with MSVC under Cygwin,
674     # configure thinks that the host platform (the platform the
675     # built code will run on) is Cygwin, even if it obviously is
676     # Windows, which in Autoconf terminology is called
677     # "mingw32". (Which is misleading as MinGW is the name of the
678     # tool-chain, not an operating system.)
680     # Somewhat confusing, yes. But this configure script doesn't
681     # look at $host etc that much, it mostly uses its own $_os
682     # variable, set here in this case statement.
684     # When cross-compiling to Windows from Unix, the host platform
685     # is "mingw32" (because in that case it is the MinGW
686     # tool-chain that is used).
688     test_cups=no
689     test_dbus=no
690     test_randr=no
691     test_xrender=no
692     test_freetype=no
693     test_fontconfig=no
694     _os=WINNT
696     DLLPOST=".dll"
697     LINKFLAGSNOUNDEFS=
699     # If the host OS matches "mingw32*", that means we are using the
700     # MinGW cross-compiler, because we don't see the point in building
701     # LibreOffice using MinGW on Windows. If you want to build on
702     # Windows, use MSVC. If you want to use MinGW, surely you want to
703     # cross-compile (from Linux or some other Unix).
705     case "$host_os" in
706     mingw32*)
707         WITH_MINGW=yes
708         if test -z "$CC"; then
709             CC="$host_cpu-$host_vendor-$host_os-gcc"
710         fi
711         if test -z "$CXX"; then
712             CXX="$host_cpu-$host_vendor-$host_os-g++"
713         fi
714         ;;
715     esac
716     ;;
718 darwin*) # Mac OS X or iOS
719     test_gtk=yes
720     test_randr=no
721     test_xrender=no
722     test_freetype=no
723     test_fontconfig=no
724     test_dbus=no
725     if test "$host_cpu" = "arm"; then
726         _os=iOS
727         test_gtk=no
728         test_cups=no
729     else
730         _os=Darwin
731         if test -n "$LODE_HOME" ; then
732             mac_sanitize_path
733             AC_MSG_NOTICE([sanitized the PATH to $PATH])
734         fi
735         INSTROOTSUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app/Contents
736         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
737     fi
738     enable_systray=no
739     # See comment above the case "$host_os"
740     LINKFLAGSSHL="-dynamiclib -single_module"
742     # -fPIC is default
743     PICSWITCH=""
745     DLLPOST=".dylib"
747     # -undefined error is the default
748     LINKFLAGSNOUNDEFS=""
751 freebsd*)
752     test_gtk=yes
753     build_gstreamer_1_0=yes
754     build_gstreamer_0_10=yes
755     test_tde=yes
756     test_kde4=yes
757     test_freetype=yes
758     AC_MSG_CHECKING([the FreeBSD operating system release])
759     if test -n "$with_os_version"; then
760         OSVERSION="$with_os_version"
761     else
762         OSVERSION=`/sbin/sysctl -n kern.osreldate`
763     fi
764     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
765     AC_MSG_CHECKING([which thread library to use])
766     if test "$OSVERSION" -lt "500016"; then
767         PTHREAD_CFLAGS="-D_THREAD_SAFE"
768         PTHREAD_LIBS="-pthread"
769     elif test "$OSVERSION" -lt "502102"; then
770         PTHREAD_CFLAGS="-D_THREAD_SAFE"
771         PTHREAD_LIBS="-lc_r"
772     else
773         PTHREAD_CFLAGS=""
774         PTHREAD_LIBS="-pthread"
775     fi
776     AC_MSG_RESULT([$PTHREAD_LIBS])
777     _os=FreeBSD
778     ;;
780 *netbsd*)
781     test_gtk=yes
782     build_gstreamer_1_0=yes
783     build_gstreamer_0_10=yes
784     test_tde=no
785     test_kde4=yes
786     test_freetype=yes
787     PTHREAD_LIBS="-pthread -lpthread"
788     _os=NetBSD
789     ;;
791 aix*)
792     test_randr=no
793     test_freetype=yes
794     PTHREAD_LIBS=-pthread
795     _os=AIX
796     ;;
798 openbsd*)
799     test_gtk=yes
800     test_tde=yes
801     test_freetype=yes
802     PTHREAD_CFLAGS="-D_THREAD_SAFE"
803     PTHREAD_LIBS="-pthread"
804     _os=OpenBSD
805     ;;
807 dragonfly*)
808     test_gtk=yes
809     build_gstreamer_1_0=yes
810     build_gstreamer_0_10=yes
811     test_tde=yes
812     test_kde4=yes
813     test_freetype=yes
814     PTHREAD_LIBS="-pthread"
815     _os=DragonFly
816     ;;
818 linux-android*)
819     build_gstreamer_1_0=no
820     build_gstreamer_0_10=no
821     enable_lotuswordpro=no
822     enable_mpl_subset=yes
823     enable_coinmp=yes
824     enable_lpsolve=no
825     enable_report_builder=no
826     enable_odk=no
827     enable_postgresql_sdbc=no
828     enable_python=no
829     with_theme="tango"
830     test_cups=no
831     test_dbus=no
832     test_fontconfig=no
833     test_freetype=no
834     test_gtk=no
835     test_tde=no
836     test_kde4=no
837     test_randr=no
838     test_xrender=no
839     _os=Android
841     if test -z "$with_android_ndk"; then
842         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
843     fi
845     if test -z "$with_android_ndk_toolchain_version"; then
846         AC_MSG_ERROR([the --with-android-ndk-toolchain-version option is mandatory])
847     fi
849     # Verify that the NDK and SDK options are proper
850     if test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
851         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
852     fi
854     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
855     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
856     ;;
858 emscripten*)
859     build_gstreamer_1_0=no
860     build_gstreamer_0_10=no
861     enable_lotuswordpro=no
862     enable_mpl_subset=yes
863     enable_coinmp=yes
864     enable_lpsolve=no
865     enable_report_builder=no
866     with_theme="tango"
867     test_cups=no
868     test_dbus=no
869     test_fontconfig=no
870     test_freetype=no
871     test_gtk=no
872     test_tde=no
873     test_kde4=no
874     test_randr=no
875     test_xrender=no
876     _os=Emscripten
877     ;;
880     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
881     ;;
882 esac
884 if echo "$host_os" | grep -q linux-android ; then
885     if test -z "$with_android_sdk"; then
886         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
887     fi
889     if test ! -d "$ANDROID_SDK_HOME/platforms"; then
890         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
891     fi
893     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
894     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
895         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
896                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
897                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
898         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
899         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
900         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
901     fi
902     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
903         AC_MSG_WARN([android support repository not found - install with
904                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
905                      to allow the build to download the specified version of the android support libraries])
906         add_warning "android support repository not found - install with"
907         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
908         add_warning "to allow the build to download the specified version of the android support libraries"
909     fi
912 if test "$_os" = "AIX"; then
913     AC_PATH_PROG(GAWK, gawk)
914     if test -z "$GAWK"; then
915         AC_MSG_ERROR([gawk not found in \$PATH])
916     fi
919 AC_SUBST(SDKDIRNAME)
921 AC_SUBST(WITH_MINGW)
922 AC_SUBST(PTHREAD_CFLAGS)
923 AC_SUBST(PTHREAD_LIBS)
925 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
926 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
927 dnl AC_PROG_CC internally.
928 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
929     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
930     save_CFLAGS=$CFLAGS
931     AC_PROG_CC
932     CFLAGS=$save_CFLAGS
935 if test $_os != "WINNT"; then
936     save_LIBS="$LIBS"
937     AC_SEARCH_LIBS([dlsym], [dl],
938         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
939         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
940     LIBS="$save_LIBS"
942 AC_SUBST(DLOPEN_LIBS)
944 ###############################################################################
945 # Extensions switches --enable/--disable
946 ###############################################################################
947 # By default these should be enabled unless having extra dependencies.
948 # If there is extra dependency over configure options then the enable should
949 # be automagic based on whether the requiring feature is enabled or not.
950 # All this options change anything only with --enable-extension-integration.
952 # The name of this option and its help string makes it sound as if
953 # extensions are built anyway, just not integrated in the installer,
954 # if you use --disable-extension-integration. Is that really the
955 # case?
957 AC_ARG_ENABLE(extension-integration,
958     AS_HELP_STRING([--disable-extension-integration],
959         [Disable integration of the built extensions in the installer of the
960          product. Use this switch to disable the integration.])
963 AC_ARG_ENABLE(export,
964     AS_HELP_STRING([--disable-export],
965         [Disable (some) code for document export. Useful when building viewer-only apps that lack
966          save/export functionality, to avoid having an excessive amount of code and data used
967          only for exporrt linked in. Work in progress, use only if you are hacking on it.])
970 AC_ARG_ENABLE(avmedia,
971     AS_HELP_STRING([--disable-avmedia],
972         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
975 AC_ARG_ENABLE(database-connectivity,
976     AS_HELP_STRING([--disable-database-connectivity],
977         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
980 # This doesn't mean not building (or "integrating") extensions
981 # (although it probably should; i.e. it should imply
982 # --disable-extension-integration I guess), it means not supporting
983 # any extension mechanism at all
984 AC_ARG_ENABLE(extensions,
985     AS_HELP_STRING([--disable-extensions],
986         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
989 AC_ARG_ENABLE(scripting,
990     AS_HELP_STRING([--disable-scripting],
991         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
994 # This is mainly for Android and iOS, but could potentially be used in some
995 # special case otherwise, too, so factored out as a separate setting
997 AC_ARG_ENABLE(dynamic-loading,
998     AS_HELP_STRING([--disable-dynamic-loading],
999         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1002 AC_ARG_ENABLE(ext-mariadb-connector,
1003     AS_HELP_STRING([--enable-ext-mariadb-connector],
1004         [Enable the build of the MariaDB/MySQL Connector extension.])
1007 AC_ARG_ENABLE(report-builder,
1008     AS_HELP_STRING([--disable-report-builder],
1009         [Disable the Report Builder.])
1012 AC_ARG_ENABLE(ext-wiki-publisher,
1013     AS_HELP_STRING([--enable-ext-wiki-publisher],
1014         [Enable the Wiki Publisher extension.])
1017 AC_ARG_ENABLE(lpsolve,
1018     AS_HELP_STRING([--disable-lpsolve],
1019         [Disable compilation of the lp solve solver ])
1021 AC_ARG_ENABLE(coinmp,
1022     AS_HELP_STRING([--disable-coinmp],
1023         [Disable compilation of the CoinMP solver ])
1026 AC_ARG_ENABLE(pdfimport,
1027     AS_HELP_STRING([--disable-pdfimport],
1028         [Disable building the PDF import feature.])
1031 ###############################################################################
1033 dnl ---------- *** ----------
1035 AC_ARG_ENABLE(mergelibs,
1036     AS_HELP_STRING([--enable-mergelibs],
1037         [Enables linking of big, merged, library. Experimental feature, tested
1038         only for Linux at some stage in history, but possibly does not work even
1039         for Linux any more. This will link a core set of libraries into libmerged.])
1042 AC_ARG_ENABLE(breakpad,
1043     AS_HELP_STRING([--enable-breakpad],
1044         [Enables breakpad for crash reporting.])
1047 AC_ARG_ENABLE(fetch-external,
1048     AS_HELP_STRING([--disable-fetch-external],
1049         [Disables fetching external tarballs from web sources.])
1052 AC_ARG_ENABLE(pch,
1053     AS_HELP_STRING([--enable-pch],
1054         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1057 AC_ARG_ENABLE(epm,
1058     AS_HELP_STRING([--enable-epm],
1059         [LibreOffice includes self-packaging code, that requires epm, however epm is
1060          useless for large scale package building.])
1063 AC_ARG_ENABLE(odk,
1064     AS_HELP_STRING([--disable-odk],
1065         [LibreOffice includes an ODK, office development kit which some packagers may
1066          wish to build without.])
1069 AC_ARG_ENABLE(mpl-subset,
1070     AS_HELP_STRING([--enable-mpl-subset],
1071         [Don't compile any pieces which are not MPL or more liberally licensed])
1074 AC_ARG_ENABLE(evolution2,
1075     AS_HELP_STRING([--enable-evolution2],
1076         [Allows the built-in evolution 2 addressbook connectivity build to be
1077          enabled.])
1080 AC_ARG_ENABLE(directx,
1081     AS_HELP_STRING([--disable-directx],
1082         [Remove DirectX implementation for the new XCanvas interface.
1083          The DirectX support requires more stuff installed on Windows to
1084          compile. (DirectX SDK, GDI+ libs)])
1087 AC_ARG_ENABLE(activex,
1088     AS_HELP_STRING([--disable-activex],
1089         [Disable the use of ActiveX for a Windows build.
1090         This switch is mandatory when using an Express edition of Visual Studio.])
1093 AC_ARG_ENABLE(atl,
1094     AS_HELP_STRING([--disable-atl],
1095         [Disable the use of ATL for a Windows build.])
1096     [
1097         This switch is mandatory when using an Express edition of Visual Studio.
1098     ],
1101 AC_ARG_ENABLE(avahi,
1102     AS_HELP_STRING([--enable-avahi],
1103         [Determines whether to use Avahi to advertise Impress to remote controls.]),
1106 AC_ARG_ENABLE(werror,
1107     AS_HELP_STRING([--enable-werror],
1108         [Turn warnings to errors. (Has no effect in modules where the treating
1109          of warnings as errors is disabled explicitly.)]),
1112 AC_ARG_ENABLE(assert-always-abort,
1113     AS_HELP_STRING([--enable-assert-always-abort],
1114         [make assert() abort even in release code.]),
1117 AC_ARG_ENABLE(dbgutil,
1118     AS_HELP_STRING([--enable-dbgutil],
1119         [Provide debugging support from --enable-debug and include additional debugging
1120          utilities such as object counting or more expensive checks.
1121          This is the recommended option for developers.
1122          Note that this makes the build ABI incompatible, it is not possible to mix object
1123          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1125 AC_ARG_ENABLE(debug,
1126     AS_HELP_STRING([--enable-debug],
1127         [Include debugging information, disable compiler optimization and inlining plus
1128          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1130 AC_ARG_ENABLE(sal-log,
1131     AS_HELP_STRING([--enable-sal-log],
1132         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1134 AC_ARG_ENABLE(selective-debuginfo,
1135     AS_HELP_STRING([--enable-selective-debuginfo],
1136         [If --enable-debug or --enable-dbgutil is used, build debugging information
1137          (-g compiler flag) only for the specified gbuild build targets
1138          (where all means everything, - prepended means not to enable, / appended means
1139          everything in the directory; there is no ordering, more specific overrides
1140          more general, and disabling takes precedence).
1141          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1143 AC_ARG_ENABLE(symbols,
1144     AS_HELP_STRING([--enable-symbols],
1145         [Generate debug information.
1146          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1147          otherwise.]))
1149 AC_ARG_ENABLE(runtime-optimizations,
1150     AS_HELP_STRING([--disable-runtime-optimizations],
1151         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1152          JVM JIT) that are known to interact badly with certain dynamic analysis
1153          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1154          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1155          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1157 AC_ARG_ENABLE(compiler-plugins,
1158     AS_HELP_STRING([--enable-compiler-plugins],
1159         [Enable compiler plugins that will perform additional checks during
1160          building. Enabled automatically by --enable-dbgutil.]))
1162 AC_ARG_ENABLE(ooenv,
1163     AS_HELP_STRING([--disable-ooenv],
1164         [Disable ooenv for the instdir installation.]))
1166 AC_ARG_ENABLE(lto,
1167     AS_HELP_STRING([--enable-lto],
1168         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1169          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1170          linker. For MSVC, this option is broken at the moment. This is experimental work
1171          in progress that shouldn't be used unless you are working on it.)]))
1173 AC_ARG_ENABLE(python,
1174     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1175         [Enables or disables Python support at run-time and build-time.
1176          Also specifies what Python to use. 'auto' is the default.
1177          'fully-internal' even forces the internal version for uses of Python
1178          during the build.]))
1180 AC_ARG_ENABLE(gtk,
1181     AS_HELP_STRING([--disable-gtk],
1182         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1183 ,enable_gtk=yes)
1185 AC_ARG_ENABLE(gtk3,
1186     AS_HELP_STRING([--disable-gtk3],
1187         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.
1188          This is experimental and may not work.]),
1189 ,enable_gtk3=yes)
1191 AC_ARG_ENABLE(systray,
1192     AS_HELP_STRING([--disable-systray],
1193         [Determines whether to build the systray quickstarter.]),
1194 ,enable_systray=yes)
1196 AC_ARG_ENABLE(split-app-modules,
1197     AS_HELP_STRING([--enable-split-app-modules],
1198         [Split file lists for app modules, e.g. base, calc.
1199          Has effect only with make distro-pack-install]),
1202 AC_ARG_ENABLE(split-opt-features,
1203     AS_HELP_STRING([--enable-split-opt-features],
1204         [Split file lists for some optional features, e.g. pyuno, testtool.
1205          Has effect only with make distro-pack-install]),
1208 AC_ARG_ENABLE(cairo-canvas,
1209     AS_HELP_STRING([--disable-cairo-canvas],
1210         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1213 AC_ARG_ENABLE(dbus,
1214     AS_HELP_STRING([--disable-dbus],
1215         [Determines whether to enable features that depend on dbus.
1216          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1217 ,enable_dbus=yes)
1219 AC_ARG_ENABLE(sdremote,
1220     AS_HELP_STRING([--disable-sdremote],
1221         [Determines whether to enable Impress remote control (i.e. the server component).]),
1222 ,enable_sdremote=yes)
1224 AC_ARG_ENABLE(sdremote-bluetooth,
1225     AS_HELP_STRING([--disable-sdremote-bluetooth],
1226         [Determines whether to build sdremote with bluetooth support.
1227          Requires dbus on Linux.]))
1229 AC_ARG_ENABLE(gio,
1230     AS_HELP_STRING([--disable-gio],
1231         [Determines whether to use the GIO support.]),
1232 ,enable_gio=yes)
1234 AC_ARG_ENABLE(telepathy,
1235     AS_HELP_STRING([--enable-telepathy],
1236         [Determines whether to enable Telepathy for collaboration.]),
1237 ,enable_telepathy=no)
1239 AC_ARG_ENABLE(tde,
1240     AS_HELP_STRING([--enable-tde],
1241         [Determines whether to use TQt/TDE vclplug on platforms where TQt and
1242          TDE are available.]),
1245 AC_ARG_ENABLE(tdeab,
1246     AS_HELP_STRING([--disable-tdeab],
1247         [Disable the TDE address book support.]),
1249     if test "$enable_tde" = "yes"; then
1250         enable_tdeab=yes
1251     fi
1254 AC_ARG_ENABLE(kde4,
1255     AS_HELP_STRING([--enable-kde4],
1256         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1257          KDE4 are available.]),
1260 AC_ARG_ENABLE(gui,
1261     AS_HELP_STRING([--disable-gui],
1262         [Disable X11/Wayland support to reduce dependencies. Maybe useful for
1263          headless servers, but soffice --headless works just fine without it.
1264          Work in progress, use only if you are hacking on it.]),
1265 ,enable_gui=yes)
1267 AC_ARG_ENABLE(randr,
1268     AS_HELP_STRING([--disable-randr],
1269         [Disable RandR support in the vcl project.]),
1270 ,enable_randr=yes)
1272 AC_ARG_ENABLE(gstreamer-1-0,
1273     AS_HELP_STRING([--disable-gstreamer-1-0],
1274         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1275 ,enable_gstreamer_1_0=yes)
1277 AC_ARG_ENABLE(gstreamer-0-10,
1278     AS_HELP_STRING([--enable-gstreamer-0-10],
1279         [Enable building with the gstreamer 0.10 avmedia backend.]),
1280 ,enable_gstreamer_0_10=no)
1282 AC_ARG_ENABLE(vlc,
1283     AS_HELP_STRING([--enable-vlc],
1284         [Enable building with the (experimental) VLC avmedia backend.]),
1285 ,enable_vlc=no)
1287 AC_ARG_ENABLE(neon,
1288     AS_HELP_STRING([--disable-neon],
1289         [Disable neon and the compilation of webdav binding.]),
1292 AC_ARG_ENABLE([eot],
1293     [AS_HELP_STRING([--enable-eot],
1294         [Enable support for Embedded OpenType fonts.])],
1295 , [enable_eot=no])
1297 AC_ARG_ENABLE(cve-tests,
1298     AS_HELP_STRING([--disable-cve-tests],
1299         [Prevent CVE tests to be executed]),
1302 AC_ARG_ENABLE(chart-tests,
1303     AS_HELP_STRING([--enable-chart-tests],
1304         [Executes chart XShape tests. In a perfect world these tests would be
1305          stable and everyone could run them, in reality it is best to run them
1306          only on a few machines that are known to work and maintained by people
1307          who can judge if a test failure is a regression or not.]),
1310 AC_ARG_ENABLE(build-unowinreg,
1311     AS_HELP_STRING([--enable-build-unowinreg],
1312         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1313          compiler is needed on Linux.]),
1316 AC_ARG_ENABLE(dependency-tracking,
1317     AS_HELP_STRING([--enable-dependency-tracking],
1318         [Do not reject slow dependency extractors.])[
1319   --disable-dependency-tracking
1320                           Disables generation of dependency information.
1321                           Speed up one-time builds.],
1324 AC_ARG_ENABLE(icecream,
1325     AS_HELP_STRING([--enable-icecream],
1326         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1327          It defaults to /opt/icecream for the location of the icecream gcc/g++
1328          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1331 AC_ARG_ENABLE(cups,
1332     AS_HELP_STRING([--disable-cups],
1333         [Do not build cups support.])
1336 AC_ARG_ENABLE(ccache,
1337     AS_HELP_STRING([--disable-ccache],
1338         [Do not try to use ccache automatically.
1339          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1340          CC/CXX are not yet set, and --enable-icecream is not given, we
1341          attempt to use ccache. --disable-ccache disables ccache completely.
1345 AC_ARG_ENABLE(64-bit,
1346     AS_HELP_STRING([--enable-64-bit],
1347         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1348          At the moment meaningful only for iOS and Windows.]), ,)
1350 AC_ARG_ENABLE(online-update,
1351     AS_HELP_STRING([--enable-online-update],
1352         [Enable the online update service that will check for new versions of
1353          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1354          If the value is "mar", the experimental Mozilla-like update will be
1355          enabled instead of the traditional update mechanism.]),
1358 AC_ARG_ENABLE(extension-update,
1359     AS_HELP_STRING([--disable-extension-update],
1360         [Disable possibility to update installed extensions.]),
1363 AC_ARG_ENABLE(release-build,
1364     AS_HELP_STRING([--enable-release-build],
1365         [Enable release build.
1366          See http://wiki.documentfoundation.org/Development/DevBuild]),
1369 AC_ARG_ENABLE(windows-build-signing,
1370     AS_HELP_STRING([--enable-windows-build-signing],
1371         [Enable signing of windows binaries (*.exe, *.dll)]),
1374 AC_ARG_ENABLE(silent-msi,
1375     AS_HELP_STRING([--enable-silent-msi],
1376         [Enable MSI with LIMITUI=1 (silent install).]),
1379 AC_ARG_ENABLE(macosx-code-signing,
1380     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1381         [Sign executables, dylibs, frameworks and the app bundle. If you
1382          don't provide an identity the first suitable certificate
1383          in your keychain is used.]),
1386 AC_ARG_ENABLE(macosx-package-signing,
1387     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1388         [Create a .pkg suitable for uploading to the Mac App Store and sign
1389          it. If you don't provide an identity the first suitable certificate
1390          in your keychain is used.]),
1393 AC_ARG_ENABLE(macosx-sandbox,
1394     AS_HELP_STRING([--enable-macosx-sandbox],
1395         [Make the app bundle run in a sandbox. Requires code signing.
1396          Is required by apps distributed in the Mac App Store, and implies
1397          adherence to App Store rules.]),
1400 AC_ARG_WITH(macosx-bundle-identifier,
1401     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1402         [Define the OS X bundle identifier. Default is the somewhat weird
1403          org.libreoffice.script ("script", huh?).]),
1404 ,with_macosx_bundle_identifier=org.libreoffice.script)
1406 AC_ARG_WITH(product-name,
1407     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1408         [Define the product name. Default is AC_PACKAGE_NAME.]),
1409 ,with_product_name=$PRODUCTNAME)
1411 AC_ARG_ENABLE(ios-simulator,
1412     AS_HELP_STRING([--enable-ios-simulator],
1413         [Build for the iOS Simulator, not iOS device.]),
1416 AC_ARG_ENABLE(readonly-installset,
1417     AS_HELP_STRING([--enable-readonly-installset],
1418         [Prevents any attempts by LibreOffice to write into its installation. That means
1419          at least that no "system-wide" extensions can be added. Experimental work in
1420          progress.]),
1423 AC_ARG_ENABLE(postgresql-sdbc,
1424     AS_HELP_STRING([--disable-postgresql-sdbc],
1425         [Disable the build of the PostgreSQL-SDBC driver.])
1428 AC_ARG_ENABLE(lotuswordpro,
1429     AS_HELP_STRING([--disable-lotuswordpro],
1430         [Disable the build of the Lotus Word Pro filter.]),
1431 ,enable_lotuswordpro=yes)
1433 AC_ARG_ENABLE(firebird-sdbc,
1434     AS_HELP_STRING([--disable-firebird-sdbc],
1435         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1436 ,enable_firebird_sdbc=yes)
1438 AC_ARG_ENABLE(winegcc,
1439     AS_HELP_STRING([--enable-winegcc],
1440         [Enable use of winegcc during the build, in order to create msi* tools
1441          needed for MinGW cross-compilation.]),
1444 AC_ARG_ENABLE(liblangtag,
1445     AS_HELP_STRING([--disable-liblangtag],
1446         [Disable use of liblangtag, and instead use an own simple
1447          implementation.]),
1450 AC_ARG_ENABLE(bogus-pkg-config,
1451     AS_HELP_STRING([--enable-bogus-pkg-config],
1452         [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.]),
1455 AC_ARG_ENABLE(openssl,
1456     AS_HELP_STRING([--disable-openssl],
1457         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1458          components will either use GNUTLS or NSS. Work in progress,
1459          use only if you are hacking on it.]),
1460 ,enable_openssl=yes)
1462 AC_ARG_ENABLE(library-bin-tar,
1463     AS_HELP_STRING([--enable-library-bin-tar],
1464         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1465         Some libraries can save their build result in a tarball
1466         stored in TARFILE_LOCATION. That binary tarball is
1467         uniquely identified by the source tarball,
1468         the content of the config_host.mk file and the content
1469         of the top-level directory in core for that library
1470         If this option is enabled, then if such a tarfile exist, it will be untarred
1471         instead of the source tarfile, and the build step will be skipped for that
1472         library.
1473         If a proper tarfile does not exist, then the normal source-based
1474         build is done for that library and a proper binary tarfile is created
1475         for the next time.]),
1478 AC_ARG_ENABLE(gltf,
1479     AS_HELP_STRING([--disable-gltf],
1480         [Determines whether to build libraries related to glTF 3D model rendering.]))
1482 AC_ARG_ENABLE(collada,
1483     AS_HELP_STRING([--disable-collada],
1484         [Disable collada support (Rendering 3D models stored in *.dae and *.kmz format).]))
1486 AC_ARG_ENABLE(dconf,
1487     AS_HELP_STRING([--disable-dconf],
1488         [Disable the dconf configuration backend (enabled by default where
1489          available).]))
1491 AC_ARG_ENABLE(formula-logger,
1492     AS_HELP_STRING(
1493         [--enable-formula-logger],
1494         [Enable formula logger for logging formula calculation flow in Calc.]
1495     )
1498 dnl ===================================================================
1499 dnl Optional Packages (--with/without-)
1500 dnl ===================================================================
1502 AC_ARG_WITH(gcc-home,
1503     AS_HELP_STRING([--with-gcc-home],
1504         [Specify the location of gcc/g++ manually. This can be used in conjunction
1505          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1506          non-default path.]),
1509 AC_ARG_WITH(gnu-patch,
1510     AS_HELP_STRING([--with-gnu-patch],
1511         [Specify location of GNU patch on Solaris or FreeBSD.]),
1514 AC_ARG_WITH(build-platform-configure-options,
1515     AS_HELP_STRING([--with-build-platform-configure-options],
1516         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1519 AC_ARG_WITH(gnu-cp,
1520     AS_HELP_STRING([--with-gnu-cp],
1521         [Specify location of GNU cp on Solaris or FreeBSD.]),
1524 AC_ARG_WITH(external-tar,
1525     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1526         [Specify an absolute path of where to find (and store) tarfiles.]),
1527     TARFILE_LOCATION=$withval ,
1530 AC_ARG_WITH(referenced-git,
1531     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1532         [Specify another checkout directory to reference. This makes use of
1533                  git submodule update --reference, and saves a lot of diskspace
1534                  when having multiple trees side-by-side.]),
1535     GIT_REFERENCE_SRC=$withval ,
1538 AC_ARG_WITH(linked-git,
1539     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1540         [Specify a directory where the repositories of submodules are located.
1541          This uses a method similar to git-new-workdir to get submodules.]),
1542     GIT_LINK_SRC=$withval ,
1545 AC_ARG_WITH(galleries,
1546     AS_HELP_STRING([--with-galleries],
1547         [Specify how galleries should be built. It is possible either to
1548          build these internally from source ("build"),
1549          or to disable them ("no")]),
1552 AC_ARG_WITH(theme,
1553     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1554         [Choose which themes to include. By default those themes with an '*' are included.
1555          Possible choices: *breeze, *breeze_dark, crystal, *galaxy, *hicontrast, *oxygen, *sifr, *tango, *tango_testing.]),
1558 AC_ARG_WITH(helppack-integration,
1559     AS_HELP_STRING([--without-helppack-integration],
1560         [It will not integrate the helppacks to the installer
1561          of the product. Please use this switch to use the online help
1562          or separate help packages.]),
1565 AC_ARG_WITH(fonts,
1566     AS_HELP_STRING([--without-fonts],
1567         [LibreOffice includes some third-party fonts to provide a reliable basis for
1568          help content, templates, samples, etc. When these fonts are already
1569          known to be available on the system then you should use this option.]),
1572 AC_ARG_WITH(epm,
1573     AS_HELP_STRING([--with-epm],
1574         [Decides which epm to use. Default is to use the one from the system if
1575          one is built. When either this is not there or you say =internal epm
1576          will be built.]),
1579 AC_ARG_WITH(package-format,
1580     AS_HELP_STRING([--with-package-format],
1581         [Specify package format(s) for LibreOffice installation sets. The
1582          implicit --without-package-format leads to no installation sets being
1583          generated. Possible values: aix, archive, bsd, deb, dmg,
1584          installed, msi, pkg, and rpm.
1585          Example: --with-package-format='deb rpm']),
1588 AC_ARG_WITH(tls,
1589     AS_HELP_STRING([--with-tls],
1590         [Decides which TLS/SSL and cryptographic implementations to use for
1591          LibreOffice's code. Notice that this doesn't apply for depending
1592          libraries like "neon", for example. Default is to use OpenSSL
1593          although NSS is also possible. Notice that selecting NSS restricts
1594          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1595          restrict by now the usage of NSS in LO's code. Possible values:
1596          openssl, nss. Example: --with-tls="nss"]),
1599 AC_ARG_WITH(system-libs,
1600     AS_HELP_STRING([--with-system-libs],
1601         [Use libraries already on system -- enables all --with-system-* flags.]),
1604 AC_ARG_WITH(system-bzip2,
1605     AS_HELP_STRING([--with-system-bzip2],
1606         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1607     [with_system_bzip2="$with_system_libs"])
1609 AC_ARG_WITH(system-headers,
1610     AS_HELP_STRING([--with-system-headers],
1611         [Use headers already on system -- enables all --with-system-* flags for
1612          external packages whose headers are the only entities used i.e.
1613          boost/odbc/sane-header(s).]),,
1614     [with_system_headers="$with_system_libs"])
1616 AC_ARG_WITH(system-jars,
1617     AS_HELP_STRING([--without-system-jars],
1618         [When building with --with-system-libs, also the needed jars are expected
1619          on the system. Use this to disable that]),,
1620     [with_system_jars="$with_system_libs"])
1622 AC_ARG_WITH(system-cairo,
1623     AS_HELP_STRING([--with-system-cairo],
1624         [Use cairo libraries already on system.  Happens automatically for
1625          (implicit) --enable-gtk and for --enable-gtk3.]))
1627 AC_ARG_WITH(myspell-dicts,
1628     AS_HELP_STRING([--with-myspell-dicts],
1629         [Adds myspell dictionaries to the LibreOffice installation set]),
1632 AC_ARG_WITH(system-dicts,
1633     AS_HELP_STRING([--without-system-dicts],
1634         [Do not use dictionaries from system paths.]),
1637 AC_ARG_WITH(external-dict-dir,
1638     AS_HELP_STRING([--with-external-dict-dir],
1639         [Specify external dictionary dir.]),
1642 AC_ARG_WITH(external-hyph-dir,
1643     AS_HELP_STRING([--with-external-hyph-dir],
1644         [Specify external hyphenation pattern dir.]),
1647 AC_ARG_WITH(external-thes-dir,
1648     AS_HELP_STRING([--with-external-thes-dir],
1649         [Specify external thesaurus dir.]),
1652 AC_ARG_WITH(system-zlib,
1653     AS_HELP_STRING([--with-system-zlib],
1654         [Use zlib already on system.]),,
1655     [with_system_zlib=auto])
1657 AC_ARG_WITH(system-jpeg,
1658     AS_HELP_STRING([--with-system-jpeg],
1659         [Use jpeg already on system.]),,
1660     [with_system_jpeg="$with_system_libs"])
1662 AC_ARG_WITH(system-libgltf,
1663     AS_HELP_STRING([--with-system-libgltf],
1664         [Use libgltf already on system.]),,
1665     [with_system_libgltf="$with_system_libs"])
1667 AC_ARG_WITH(system-clucene,
1668     AS_HELP_STRING([--with-system-clucene],
1669         [Use clucene already on system.]),,
1670     [with_system_clucene="$with_system_libs"])
1672 AC_ARG_WITH(system-expat,
1673     AS_HELP_STRING([--with-system-expat],
1674         [Use expat already on system.]),,
1675     [with_system_expat="$with_system_libs"])
1677 AC_ARG_WITH(system-libxml,
1678     AS_HELP_STRING([--with-system-libxml],
1679         [Use libxml/libxslt already on system.]),,
1680     [with_system_libxml=auto])
1682 AC_ARG_WITH(system-icu,
1683     AS_HELP_STRING([--with-system-icu],
1684         [Use icu already on system.]),,
1685     [with_system_icu="$with_system_libs"])
1687 AC_ARG_WITH(system-ucpp,
1688     AS_HELP_STRING([--with-system-ucpp],
1689         [Use ucpp already on system.]),,
1690     [])
1692 AC_ARG_WITH(system-opencollada,
1693     AS_HELP_STRING([--with-system-opencollada],
1694         [Use openCOLLADA already on system.]),,
1695     [with_system_opencollada=no])
1697 AC_ARG_WITH(system-collada2gltf,
1698     AS_HELP_STRING([--with-system-collada2gltf],
1699         [Use collada2gltf already on system.]),,
1700     [with_system_collada2gltf=no])
1702 AC_ARG_WITH(system-openldap,
1703     AS_HELP_STRING([--with-system-openldap],
1704         [Use the OpenLDAP LDAP SDK already on system.]),,
1705     [with_system_openldap="$with_system_libs"])
1707 AC_ARG_WITH(system-poppler,
1708     AS_HELP_STRING([--with-system-poppler],
1709         [Use system poppler (only needed for PDF import).]),,
1710     [with_system_poppler="$with_system_libs"])
1712 AC_ARG_WITH(system-apache-commons,
1713     AS_HELP_STRING([--with-system-apache-commons],
1714         [Use Apache commons libraries already on system.]),,
1715     [with_system_apache_commons="$with_system_jars"])
1717 AC_ARG_WITH(system-mariadb,
1718     AS_HELP_STRING([--with-system-mariadb],
1719         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1720          extension.]),,
1721     [with_system_mariadb="$with_system_libs"])
1723 AC_ARG_ENABLE(bundle-mariadb,
1724     AS_HELP_STRING([--enable-bundle-mariadb],
1725         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1728 AC_ARG_WITH(system-mysql-cppconn,
1729     AS_HELP_STRING([--with-system-mysql-cppconn],
1730         [Use MySQL C++ Connector libraries already on system.]),,
1731     [with_system_mysql_cppconn="$with_system_libs"])
1733 AC_ARG_WITH(system-postgresql,
1734     AS_HELP_STRING([--with-system-postgresql],
1735         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1736          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1737     [with_system_postgresql="$with_system_libs"])
1739 AC_ARG_WITH(libpq-path,
1740     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1741         [Use this PostgreSQL C interface (libpq) installation for building
1742          the PostgreSQL-SDBC extension.]),
1745 AC_ARG_WITH(system-firebird,
1746     AS_HELP_STRING([--with-system-firebird],
1747         [Use Firebird libraries already on system, for building the Firebird-SDBC
1748          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1749     [with_system_firebird="$with_system_libs"])
1751 AC_ARG_WITH(system-libtommath,
1752             AS_HELP_STRING([--with-system-libtommath],
1753                            [Use libtommath already on system]),,
1754             [with_system_libtommath="$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(libformula-jar,
1856     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1857         [Specify path to jarfile manually.]),
1858     LIBFORMULA_JAR=$withval)
1860 AC_ARG_WITH(librepository-jar,
1861     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1862         [Specify path to jarfile manually.]),
1863     LIBREPOSITORY_JAR=$withval)
1865 AC_ARG_WITH(libfonts-jar,
1866     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1867         [Specify path to jarfile manually.]),
1868     LIBFONTS_JAR=$withval)
1870 AC_ARG_WITH(libserializer-jar,
1871     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1872         [Specify path to jarfile manually.]),
1873     LIBSERIALIZER_JAR=$withval)
1875 AC_ARG_WITH(libbase-jar,
1876     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1877         [Specify path to jarfile manually.]),
1878     LIBBASE_JAR=$withval)
1880 AC_ARG_WITH(system-odbc,
1881     AS_HELP_STRING([--with-system-odbc],
1882         [Use the odbc headers already on system.]),,
1883     [with_system_odbc="auto"])
1885 AC_ARG_WITH(system-sane,
1886     AS_HELP_STRING([--with-system-sane],
1887         [Use sane.h already on system.]),,
1888     [with_system_sane="$with_system_headers"])
1890 AC_ARG_WITH(system-bluez,
1891     AS_HELP_STRING([--with-system-bluez],
1892         [Use bluetooth.h already on system.]),,
1893     [with_system_bluez="$with_system_headers"])
1895 AC_ARG_WITH(system-curl,
1896     AS_HELP_STRING([--with-system-curl],
1897         [Use curl already on system.]),,
1898     [with_system_curl=auto])
1900 AC_ARG_WITH(system-boost,
1901     AS_HELP_STRING([--with-system-boost],
1902         [Use boost already on system.]),,
1903     [with_system_boost="$with_system_headers"])
1905 AC_ARG_WITH(system-glm,
1906     AS_HELP_STRING([--with-system-glm],
1907         [Use glm already on system.]),,
1908     [with_system_glm="$with_system_headers"])
1910 AC_ARG_WITH(system-hunspell,
1911     AS_HELP_STRING([--with-system-hunspell],
1912         [Use libhunspell already on system.]),,
1913     [with_system_hunspell="$with_system_libs"])
1915 AC_ARG_WITH(system-mythes,
1916     AS_HELP_STRING([--with-system-mythes],
1917         [Use mythes already on system.]),,
1918     [with_system_mythes="$with_system_libs"])
1920 AC_ARG_WITH(system-altlinuxhyph,
1921     AS_HELP_STRING([--with-system-altlinuxhyph],
1922         [Use ALTLinuxhyph already on system.]),,
1923     [with_system_altlinuxhyph="$with_system_libs"])
1925 AC_ARG_WITH(system-lpsolve,
1926     AS_HELP_STRING([--with-system-lpsolve],
1927         [Use lpsolve already on system.]),,
1928     [with_system_lpsolve="$with_system_libs"])
1930 AC_ARG_WITH(system-coinmp,
1931     AS_HELP_STRING([--with-system-coinmp],
1932         [Use CoinMP already on system.]),,
1933     [with_system_coinmp="$with_system_libs"])
1935 AC_ARG_WITH(system-liblangtag,
1936     AS_HELP_STRING([--with-system-liblangtag],
1937         [Use liblangtag library already on system.]),,
1938     [with_system_liblangtag="$with_system_libs"])
1940 AC_ARG_WITH(jpeg-turbo,
1941     AS_HELP_STRING([--with-jpeg-turbo],
1942         [Use internal libjpeg-turbo library.]),,
1943     [with_jpeg_turbo=auto])
1945 AC_ARG_WITH(webdav,
1946     AS_HELP_STRING([--with-webdav],
1947         [Specify which library to use for webdav implementation.
1948          Possible values: "neon", "serf", "no". The default value is "neon".
1949          Example: --with-webdav="serf"]),
1950     WITH_WEBDAV=$withval,
1951     WITH_WEBDAV="neon")
1953 AC_ARG_WITH(linker-hash-style,
1954     AS_HELP_STRING([--with-linker-hash-style],
1955         [Use linker with --hash-style=<style> when linking shared objects.
1956          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1957          if supported on the build system, and "sysv" otherwise.]))
1959 AC_ARG_WITH(jdk-home,
1960     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1961         [If you have installed JDK 1.3 or later on your system please supply the
1962          path here. Note that this is not the location of the java command but the
1963          location of the entire distribution.]),
1966 AC_ARG_WITH(help,
1967     AS_HELP_STRING([--with-help],
1968         [Enable the build of help. There is a special parameter "common" that
1969          can be used to bundle only the common part, .e.g help-specific icons.
1970          This is useful when you build the helpcontent separately.])
1971     [
1972                           Usage:     --with-help    build the entire local help
1973                                  --without-help     no local help (default)
1974                                  --with-help=common bundle common files for the local
1975                                                     help but do not build the whole help
1976     ],
1979 AC_ARG_WITH(java,
1980     AS_HELP_STRING([--with-java=<java command>],
1981         [Specify the name of the Java interpreter command. Typically "java"
1982          which is the default.
1984          To build without support for Java components, applets, accessibility
1985          or the XML filters written in Java, use --without-java or --with-java=no.]),
1986     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1987     [ with_java=java ]
1990 AC_ARG_WITH(jvm-path,
1991     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1992         [Use a specific JVM search path at runtime.
1993          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1996 AC_ARG_WITH(ant-home,
1997     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1998         [If you have installed Jakarta Ant on your system, please supply the path here.
1999          Note that this is not the location of the Ant binary but the location
2000          of the entire distribution.]),
2003 AC_ARG_WITH(symbol-config,
2004     AS_HELP_STRING([--with-symbol-config],
2005         [Configuration for the crashreport symbol upload]),
2006         [],
2007         [with_symbol_config=no])
2009 AC_ARG_WITH(export-validation,
2010     AS_HELP_STRING([--without-export-validation],
2011         [Disable validating OOXML and ODF files as exported from in-tree tests.
2012          Use this option e.g. if your system only provides Java 5.]),
2013 ,with_export_validation=yes)
2015 AC_ARG_WITH(bffvalidator,
2016     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2017         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2018          Requires installed Microsoft Office Binary File Format Validator.
2019          Note: export-validation (--with-export-validation) is required to be turned on.
2020          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2021 ,with_bffvalidator=no)
2023 AC_ARG_WITH(junit,
2024     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2025         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2026          --without-junit disables those tests. Not relevant in the --without-java case.]),
2027 ,with_junit=yes)
2029 AC_ARG_WITH(hamcrest,
2030     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2031         [Specifies the hamcrest jar file to use for JUnit-based tests.
2032          --without-junit disables those tests. Not relevant in the --without-java case.]),
2033 ,with_hamcrest=yes)
2035 AC_ARG_WITH(perl-home,
2036     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2037         [If you have installed Perl 5 Distribution, on your system, please
2038          supply the path here. Note that this is not the location of the Perl
2039          binary but the location of the entire distribution.]),
2042 AC_ARG_WITH(doxygen,
2043     AS_HELP_STRING(
2044         [--with-doxygen=<absolute path to doxygen executable>],
2045         [Specifies the doxygen executable to use when generating ODK C/C++
2046          documentation. --without-doxygen disables generation of ODK C/C++
2047          documentation. Not relevant in the --disable-odk case.]),
2048 ,with_doxygen=yes)
2050 AC_ARG_WITH(visual-studio,
2051     AS_HELP_STRING([--with-visual-studio=<2013/2015>],
2052         [Specify which Visual Studio version to use in case several are
2053          installed. If not specified, only 2013 is detected automatically
2054          because 2015 support is currently experimental.]),
2057 AC_ARG_WITH(windows-sdk,
2058     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2059         [Specify which Windows SDK, or "Windows Kit", version to use
2060          in case the one that came with the selected Visual Studio
2061          is not what you want for some reason. Note that not all compiler/SDK
2062          combinations are supported. The intent is that this option should not
2063          be needed.]),
2066 AC_ARG_WITH(lang,
2067     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2068         [Use this option to build LibreOffice with additional UI language support.
2069          English (US) is always included by default.
2070          Separate multiple languages with space.
2071          For all languages, use --with-lang=ALL.]),
2074 AC_ARG_WITH(locales,
2075     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2076         [Use this option to limit the locale information built in.
2077          Separate multiple locales with space.
2078          Very experimental and might well break stuff.
2079          Just a desperate measure to shrink code and data size.
2080          By default all the locales available is included.
2081          This option is completely unrelated to --with-lang.])
2082     [
2083                           Affects also our character encoding conversion
2084                           tables for encodings mainly targeted for a
2085                           particular locale, like EUC-CN and EUC-TW for
2086                           zh, ISO-2022-JP for ja.
2088                           Affects also our add-on break iterator data for
2089                           some languages.
2091                           For the default, all locales, don't use this switch at all.
2092                           Specifying just the language part of a locale means all matching
2093                           locales will be included.
2094     ],
2097 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2098 AC_ARG_WITH(krb5,
2099     AS_HELP_STRING([--with-krb5],
2100         [Enable MIT Kerberos 5 support in modules that support it.
2101          By default automatically enabled on platforms
2102          where a good system Kerberos 5 is available.]),
2105 AC_ARG_WITH(gssapi,
2106     AS_HELP_STRING([--with-gssapi],
2107         [Enable GSSAPI support in modules that support it.
2108          By default automatically enabled on platforms
2109          where a good system GSSAPI is available.]),
2112 AC_ARG_WITH(iwyu,
2113     AS_HELP_STRING([--with-iwyu],
2114         [Use given IWYU binary path to check unneeded includes instead of building.
2115          Use only if you are hacking on it.]),
2118 dnl ===================================================================
2119 dnl Branding
2120 dnl ===================================================================
2122 AC_ARG_WITH(branding,
2123     AS_HELP_STRING([--with-branding=/path/to/images],
2124         [Use given path to retrieve branding images set.])
2125     [
2126                           Search for intro.png about.svg and flat_logo.svg.
2127                           If any is missing, default ones will be used instead.
2129                           Search also progress.conf for progress
2130                           settings on intro screen :
2132                           PROGRESSBARCOLOR="255,255,255" Set color of
2133                           progress bar. Comma separated RGB decimal values.
2134                           PROGRESSSIZE="407,6" Set size of progress bar.
2135                           Comma separated decimal values (width, height).
2136                           PROGRESSPOSITION="61,317" Set position of progress
2137                           bar from left,top. Comma separated decimal values.
2138                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2139                           bar frame. Comma separated RGB decimal values.
2140                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2141                           bar text. Comma separated RGB decimal values.
2142                           PROGRESSTEXTBASELINE="287" Set vertical position of
2143                           progress bar text from top. Decimal value.
2145                           Default values will be used if not found.
2146     ],
2150 AC_ARG_WITH(extra-buildid,
2151     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2152         [Show addition build identification in about dialog.]),
2156 AC_ARG_WITH(vendor,
2157     AS_HELP_STRING([--with-vendor="John the Builder"],
2158         [Set vendor of the build.]),
2161 AC_ARG_WITH(android-package-name,
2162     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2163         [Set Android package name of the build.]),
2166 AC_ARG_WITH(compat-oowrappers,
2167     AS_HELP_STRING([--with-compat-oowrappers],
2168         [Install oo* wrappers in parallel with
2169          lo* ones to keep backward compatibility.
2170          Has effect only with make distro-pack-install]),
2173 AC_ARG_WITH(os-version,
2174     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2175         [For FreeBSD users, use this option option to override the detected OSVERSION.]),
2178 AC_ARG_WITH(mingw-cross-compiler,
2179     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2180         [Specify the MinGW cross-compiler to use.
2181          When building on the ODK on Unix and building unowinreg.dll,
2182          specify the MinGW C++ cross-compiler.]),
2185 AC_ARG_WITH(idlc-cpp,
2186     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2187         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2190 AC_ARG_WITH(build-version,
2191     AS_HELP_STRING([--with-build-version="Built by Jim"],
2192         [Allows the builder to add a custom version tag that will appear in the
2193          Help/About box for QA purposes.]),
2194 with_build_version=$withval,
2197 AC_ARG_WITH(alloc,
2198     AS_HELP_STRING([--with-alloc],
2199         [Define which allocator to build with (choices are oo, system, tcmalloc, jemalloc).
2200          Note that on FreeBSD/NetBSD system==jemalloc]),
2203 AC_ARG_WITH(parallelism,
2204     AS_HELP_STRING([--with-parallelism],
2205         [Number of jobs to run simultaneously during build. Parallel builds can
2206         save a lot of time on multi-cpu machines. Defaults to the number of
2207         CPUs on the machine, unless you configure --enable-icecream - then to
2208         10.]),
2211 AC_ARG_WITH(all-tarballs,
2212     AS_HELP_STRING([--with-all-tarballs],
2213         [Download all external tarballs unconditionally]))
2215 AC_ARG_WITH(gdrive-client-id,
2216     AS_HELP_STRING([--with-gdrive-client-id],
2217         [Provides the client id of the application for OAuth2 authentication
2218         on Google Drive. If either this or --with-gdrive-client-secret is
2219         empty, the feature will be disabled]),
2222 AC_ARG_WITH(gdrive-client-secret,
2223     AS_HELP_STRING([--with-gdrive-client-secret],
2224         [Provides the client secret of the application for OAuth2
2225         authentication on Google Drive. If either this or
2226         --with-gdrive-client-id is empty, the feature will be disabled]),
2229 AC_ARG_WITH(alfresco-cloud-client-id,
2230     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2231         [Provides the client id of the application for OAuth2 authentication
2232         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2233         empty, the feature will be disabled]),
2236 AC_ARG_WITH(alfresco-cloud-client-secret,
2237     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2238         [Provides the client secret of the application for OAuth2
2239         authentication on Alfresco Cloud. If either this or
2240         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2243 AC_ARG_WITH(onedrive-client-id,
2244     AS_HELP_STRING([--with-onedrive-client-id],
2245         [Provides the client id of the application for OAuth2 authentication
2246         on OneDrive. If either this or --with-onedrive-client-secret is
2247         empty, the feature will be disabled]),
2250 AC_ARG_WITH(onedrive-client-secret,
2251     AS_HELP_STRING([--with-onedrive-client-secret],
2252         [Provides the client secret of the application for OAuth2
2253         authentication on OneDrive. If either this or
2254         --with-onedrive-client-id is empty, the feature will be disabled]),
2256 dnl ===================================================================
2257 dnl Do we want to use pre-build binary tarball for recompile
2258 dnl ===================================================================
2260 if test "$enable_library_bin_tar" = "yes" ; then
2261     USE_LIBRARY_BIN_TAR=TRUE
2262 else
2263     USE_LIBRARY_BIN_TAR=
2265 AC_SUBST(USE_LIBRARY_BIN_TAR)
2267 dnl ===================================================================
2268 dnl Test whether build target is Release Build
2269 dnl ===================================================================
2270 AC_MSG_CHECKING([whether build target is Release Build])
2271 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2272     AC_MSG_RESULT([no])
2273     ENABLE_RELEASE_BUILD=
2274 else
2275     AC_MSG_RESULT([yes])
2276     ENABLE_RELEASE_BUILD=TRUE
2278 AC_SUBST(ENABLE_RELEASE_BUILD)
2280 dnl ===================================================================
2281 dnl Test whether to sign Windows Build
2282 dnl ===================================================================
2283 AC_MSG_CHECKING([whether to sign windows build])
2284 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT" -a "$WITH_MINGW" != "YES" ; then
2285     AC_MSG_RESULT([yes])
2286     WINDOWS_BUILD_SIGNING="TRUE"
2287 else
2288     AC_MSG_RESULT([no])
2289     WINDOWS_BUILD_SIGNING="FALSE"
2291 AC_SUBST(WINDOWS_BUILD_SIGNING)
2293 dnl ===================================================================
2294 dnl MacOSX build and runtime environment options
2295 dnl ===================================================================
2297 AC_ARG_WITH(macosx-sdk,
2298     AS_HELP_STRING([--with-macosx-sdk=<version>],
2299         [Prefer a specific SDK for building.])
2300     [
2301                           If the requested SDK is not available, a search for the oldest one will be done.
2302                           With current Xcode versions, only the latest SDK is included, so this option is
2303                           not terribly useful. It works fine to build with a new SDK and run the result
2304                           on an older OS.
2306                           e. g.: --with-macosx-sdk=10.8
2308                           there are 3 options to control the MacOSX build:
2309                           --with-macosx-sdk (referred as 'sdk' below)
2310                           --with-macosx-version-min-required (referred as 'min' below)
2311                           --with-macosx-version-max-allowed (referred as 'max' below)
2313                           the connection between these value and the default they take is as follow:
2314                           ( ? means not specified on the command line, s means the SDK version found,
2315                           constraint: 8 <= x <= y <= z)
2317                           ==========================================
2318                            command line      || config result
2319                           ==========================================
2320                           min  | max  | sdk  || min  | max  | sdk  |
2321                           ?    | ?    | ?    || 10.8 | 10.s | 10.s |
2322                           ?    | ?    | 10.x || 10.8 | 10.x | 10.x |
2323                           ?    | 10.x | ?    || 10.8 | 10.s | 10.s |
2324                           ?    | 10.x | 10.y || 10.8 | 10.x | 10.y |
2325                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2326                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2327                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2328                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2331                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2332                           for a detailed technical explanation of these variables
2334                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2335     ],
2338 AC_ARG_WITH(macosx-version-min-required,
2339     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2340         [set the minimum OS version needed to run the built LibreOffice])
2341     [
2342                           e. g.: --with-macos-version-min-required=10.8
2343                           see --with-macosx-sdk for more info
2344     ],
2347 AC_ARG_WITH(macosx-version-max-allowed,
2348     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2349         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2350     [
2351                           e. g.: --with-macos-version-max-allowed=10.8
2352                           see --with-macosx-sdk for more info
2353     ],
2357 dnl ===================================================================
2358 dnl options for stuff used during cross-compilation build
2359 dnl Not quite superseded by --with-build-platform-configure-options.
2360 dnl TODO: check, if the "force" option is still needed anywhere.
2361 dnl ===================================================================
2363 AC_ARG_WITH(system-icu-for-build,
2364     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2365         [Use icu already on system for build tools (cross-compilation only).]))
2368 dnl ===================================================================
2369 dnl check for required programs (grep, awk, sed, bash)
2370 dnl ===================================================================
2372 pathmunge ()
2374     if test -n "$1"; then
2375         if test "$build_os" = "cygwin"; then
2376             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2377                 PathFormat "$1"
2378                 new_path=`cygpath -sm "$formatted_path"`
2379             else
2380                 PathFormat "$1"
2381                 new_path=`cygpath -u "$formatted_path"`
2382             fi
2383         else
2384             new_path="$1"
2385         fi
2386         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2387             if test "$2" = "after"; then
2388                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2389             else
2390                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2391             fi
2392         fi
2393         unset new_path
2394     fi
2397 AC_PROG_AWK
2398 AC_PATH_PROG( AWK, $AWK)
2399 if test -z "$AWK"; then
2400     AC_MSG_ERROR([install awk to run this script])
2403 AC_PATH_PROG(BASH, bash)
2404 if test -z "$BASH"; then
2405     AC_MSG_ERROR([bash not found in \$PATH])
2407 AC_SUBST(BASH)
2409 AC_MSG_CHECKING([for GNU or BSD tar])
2410 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2411     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2412     if test $? -eq 0;  then
2413         GNUTAR=$a
2414         break
2415     fi
2416 done
2417 AC_MSG_RESULT($GNUTAR)
2418 if test -z "$GNUTAR"; then
2419     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2421 AC_SUBST(GNUTAR)
2423 AC_MSG_CHECKING([for tar's option to strip components])
2424 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2425 if test $? -eq 0; then
2426     STRIP_COMPONENTS="--strip-components"
2427 else
2428     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2429     if test $? -eq 0; then
2430         STRIP_COMPONENTS="--strip-path"
2431     else
2432         STRIP_COMPONENTS="unsupported"
2433     fi
2435 AC_MSG_RESULT($STRIP_COMPONENTS)
2436 if test x$STRIP_COMPONENTS = xunsupported; then
2437     AC_MSG_ERROR([you need a tar that is able to strip components.])
2439 AC_SUBST(STRIP_COMPONENTS)
2441 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2442 dnl desktop OSes from "mobile" ones.
2444 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2445 dnl In other words, that when building for an OS that is not a
2446 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2448 dnl Note the direction of the implication; there is no assumption that
2449 dnl cross-compiling would imply a non-desktop OS.
2451 if test $_os != iOS -a $_os != Android; then
2452     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2453     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2454     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2457 DISABLE_EXPORT=''
2458 if test "$enable_export" != no; then
2459     BUILD_TYPE="$BUILD_TYPE EXPORT"
2460 else
2461     DISABLE_EXPORT='TRUE'
2462     SCPDEFS="$SCPDES -DDISABLE_EXPORT"
2464 AC_SUBST(DISABLE_EXPORT)
2466 # Whether to build "avmedia" functionality or not.
2468 if test -z "$enable_avmedia"; then
2469     enable_avmedia=yes
2472 if test "$enable_avmedia" = yes; then
2473     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2474     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2475 else
2476     SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA"
2479 # Decide whether to build database connectivity stuff (including
2480 # Base) or not. We probably don't want to on non-desktop OSes.
2482 if test -z "$enable_database_connectivity"; then
2483     # --disable-database-connectivity is unfinished work in progress
2484     # and the iOS test app doesn't link if we actually try to use it.
2485     # if test $_os != iOS -a $_os != Android; then
2486         enable_database_connectivity=yes
2487     # fi
2490 if test "$enable_database_connectivity" = yes; then
2491     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2492     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2495 if test -z "$enable_extensions"; then
2496     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2497     if test $_os != iOS -a $_os != Android; then
2498         enable_extensions=yes
2499     fi
2502 if test "$enable_extensions" = yes; then
2503     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2504     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2507 if test -z "$enable_scripting"; then
2508     # Disable scripting for iOS unless specifically overridden
2509     # with --enable-scripting.
2510     if test $_os != iOS; then
2511         enable_scripting=yes
2512     fi
2515 DISABLE_SCRIPTING=''
2516 if test "$enable_scripting" = yes; then
2517     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2518     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2519 else
2520     DISABLE_SCRIPTING='TRUE'
2521     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2524 if test $_os = iOS -o $_os = Android; then
2525     # Disable dynamic_loading always for iOS and Android
2526     enable_dynamic_loading=no
2527 elif test -z "$enable_dynamic_loading"; then
2528     # Otherwise enable it unless speficically disabled
2529     enable_dynamic_loading=yes
2532 DISABLE_DYNLOADING=''
2533 if test "$enable_dynamic_loading" = yes; then
2534     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2535 else
2536     DISABLE_DYNLOADING='TRUE'
2537     SCPDEFS="$SCPDEFS -DDISABLE_DYNLOADING"
2539 AC_SUBST(DISABLE_DYNLOADING)
2541 # remenber SYSBASE value
2542 AC_SUBST(SYSBASE)
2544 dnl ===================================================================
2545 dnl  Sort out various gallery compilation options
2546 dnl ===================================================================
2547 AC_MSG_CHECKING([how to build and package galleries])
2548 if test -n "${with_galleries}"; then
2549     if test "$with_galleries" = "build"; then
2550         WITH_GALLERY_BUILD=TRUE
2551         AC_MSG_RESULT([build from source images internally])
2552     elif test "$with_galleries" = "no"; then
2553         WITH_GALLERY_BUILD=
2554         AC_MSG_RESULT([disable non-internal gallery build])
2555     else
2556         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2557     fi
2558 else
2559     if test $_os != iOS -a $_os != Android; then
2560         WITH_GALLERY_BUILD=TRUE
2561         AC_MSG_RESULT([internal src images for desktop])
2562     else
2563         WITH_GALLERY_BUILD=
2564         AC_MSG_RESULT([disable src image build])
2565     fi
2567 AC_SUBST(WITH_GALLERY_BUILD)
2569 dnl ===================================================================
2570 dnl  Checks if ccache is available
2571 dnl ===================================================================
2572 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
2573     # on windows/VC build do not use ccache
2574     CCACHE=""
2575 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2576     case "%$CC%$CXX%" in
2577     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2578     # assume that's good then
2579     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2580         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2581         ;;
2582     *)
2583         AC_PATH_PROG([CCACHE],[ccache],[not found])
2584         if test "$CCACHE" = "not found"; then
2585             CCACHE=""
2586         else
2587             # Need to check for ccache version: otherwise prevents
2588             # caching of the results (like "-x objective-c++" for Mac)
2589             if test $_os = Darwin -o $_os = iOS; then
2590                 # Check ccache version
2591                 AC_MSG_CHECKING([whether version of ccache is suitable])
2592                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2593                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2594                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2595                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2596                 else
2597                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2598                     CCACHE=""
2599                 fi
2600             fi
2601         fi
2602         ;;
2603     esac
2604 else
2605     CCACHE=""
2608 if test "$CCACHE" != ""; then
2609     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2610     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2611     if test "$ccache_size" = ""; then
2612         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2613         if test "$ccache_size" = ""; then
2614             ccache_size=0
2615         fi
2616         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2617         if test $ccache_size -lt 1024; then
2618             CCACHE=""
2619             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2620             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2621         else
2622             # warn that ccache may be too small for debug build
2623             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2624             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2625         fi
2626     else
2627         if test $ccache_size -lt 5; then
2628             #warn that ccache may be too small for debug build
2629             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2630             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2631         fi
2632     fi
2635 dnl ===================================================================
2636 dnl  Checks for C compiler,
2637 dnl  The check for the C++ compiler is later on.
2638 dnl ===================================================================
2639 if test "$_os" != "WINNT" -a "$WITH_MINGW" != "yes"; then
2640     GCC_HOME_SET="true"
2641     AC_MSG_CHECKING([gcc home])
2642     if test -z "$with_gcc_home"; then
2643         if test "$enable_icecream" = "yes"; then
2644             if test -d "/usr/lib/icecc/bin"; then
2645                 GCC_HOME="/usr/lib/icecc/"
2646             else
2647                 GCC_HOME="/opt/icecream/"
2648             fi
2649         else
2650             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2651             GCC_HOME_SET="false"
2652         fi
2653     else
2654         GCC_HOME="$with_gcc_home"
2655     fi
2656     AC_MSG_RESULT($GCC_HOME)
2657     AC_SUBST(GCC_HOME)
2659     if test "$GCC_HOME_SET" = "true"; then
2660         if test -z "$CC"; then
2661             CC="$GCC_HOME/bin/gcc"
2662         fi
2663         if test -z "$CXX"; then
2664             CXX="$GCC_HOME/bin/g++"
2665         fi
2666     fi
2669 COMPATH=`dirname "$CC"`
2670 if test "$COMPATH" = "."; then
2671     AC_PATH_PROGS(COMPATH, $CC)
2672     dnl double square bracket to get single because of M4 quote...
2673     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2675 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2677 dnl ===================================================================
2678 dnl Java support
2679 dnl ===================================================================
2680 AC_MSG_CHECKING([whether to build with Java support])
2681 if test "$with_java" != "no"; then
2682     if test "$DISABLE_SCRIPTING" = TRUE; then
2683         AC_MSG_RESULT([no, overridden by --disable-scripting])
2684         ENABLE_JAVA=""
2685         with_java=no
2686     else
2687         AC_MSG_RESULT([yes])
2688         ENABLE_JAVA="TRUE"
2689         AC_DEFINE(HAVE_FEATURE_JAVA)
2690     fi
2691 else
2692     AC_MSG_RESULT([no])
2693     ENABLE_JAVA=""
2696 AC_SUBST(ENABLE_JAVA)
2698 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2700 dnl ENABLE_JAVA="" indicate no Java support at all
2702 dnl ===================================================================
2703 dnl Check OS X SDK and compiler
2704 dnl ===================================================================
2706 if test $_os = Darwin; then
2708     # If no --with-macosx-sdk option is given, look for one
2710     # The intent is that for "most" Mac-based developers, a suitable
2711     # SDK will be found automatically without any configure options.
2713     # For developers with a current Xcode, the lowest-numbered SDK
2714     # higher than or equal to the minimum required should be found.
2716     AC_MSG_CHECKING([what Mac OS X SDK to use])
2718     for _macosx_sdk in $with_macosx_sdk 10.8 10.9 10.10 10.11 10.12; do
2719         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2720         if test -d "$MACOSX_SDK_PATH"; then
2721             with_macosx_sdk="${_macosx_sdk}"
2722             break
2723         else
2724             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2725             if test -d "$MACOSX_SDK_PATH"; then
2726                 with_macosx_sdk="${_macosx_sdk}"
2727                 break
2728             fi
2729         fi
2730     done
2731     if test ! -d "$MACOSX_SDK_PATH"; then
2732         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2733     fi
2734     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2736     case $with_macosx_sdk in
2737     10.8)
2738         MACOSX_SDK_VERSION=1080
2739         ;;
2740     10.9)
2741         MACOSX_SDK_VERSION=1090
2742         ;;
2743     10.10)
2744         MACOSX_SDK_VERSION=101000
2745         ;;
2746     10.11)
2747         MACOSX_SDK_VERSION=101100
2748         ;;
2749     10.12)
2750         MACOSX_SDK_VERSION=101200
2751         ;;
2752     *)
2753         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.8--12])
2754         ;;
2755     esac
2757     if test "$with_macosx_version_min_required" = "" ; then
2758         with_macosx_version_min_required="10.8";
2759     fi
2761     if test "$with_macosx_version_max_allowed" = "" ; then
2762         with_macosx_version_max_allowed="$with_macosx_sdk"
2763     fi
2765     # export this so that "xcrun" invocations later return matching values
2766     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2767     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2768     export DEVELOPER_DIR
2769     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2770     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2772     case "$with_macosx_version_min_required" in
2773     10.8)
2774         MAC_OS_X_VERSION_MIN_REQUIRED="1080"
2775         ;;
2776     10.9)
2777         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2778         ;;
2779     10.10)
2780         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2781         ;;
2782     10.11)
2783         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2784         ;;
2785     10.12)
2786         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2787         ;;
2788     *)
2789         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.8--12])
2790         ;;
2791     esac
2793     LIBTOOL=/usr/bin/libtool
2794     INSTALL_NAME_TOOL=install_name_tool
2795     if test -z "$save_CC"; then
2796         AC_MSG_CHECKING([what compiler to use])
2797         stdlib=-stdlib=libc++
2798         if test "$ENABLE_LTO" = TRUE; then
2799             lto=-flto
2800         fi
2801         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2802         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2803         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2804         AR=`xcrun -find ar`
2805         NM=`xcrun -find nm`
2806         STRIP=`xcrun -find strip`
2807         LIBTOOL=`xcrun -find libtool`
2808         RANLIB=`xcrun -find ranlib`
2809         AC_MSG_RESULT([$CC and $CXX])
2810     fi
2812     case "$with_macosx_version_max_allowed" in
2813     10.8)
2814         MAC_OS_X_VERSION_MAX_ALLOWED="1080"
2815         ;;
2816     10.9)
2817         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2818         ;;
2819     10.10)
2820         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2821         ;;
2822     10.11)
2823         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2824         ;;
2825     10.12)
2826         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2827         ;;
2828     *)
2829         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.8--12])
2830         ;;
2831     esac
2833     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2834     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2835         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2836     else
2837         AC_MSG_RESULT([ok])
2838     fi
2840     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2841     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2842         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2843     else
2844         AC_MSG_RESULT([ok])
2845     fi
2846     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2847     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2849     AC_MSG_CHECKING([whether to do code signing])
2851     if test "$enable_macosx_code_signing" = yes; then
2852         # By default use the first suitable certificate (?).
2854         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2855         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2856         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2857         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2858         # "Developer ID Application" one.
2860         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2861         if test -n "$identity"; then
2862             MACOSX_CODESIGNING_IDENTITY=$identity
2863             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2864             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2865         else
2866             AC_MSG_ERROR([cannot determine identity to use])
2867         fi
2868     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2869         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2870         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2871         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2872     else
2873         AC_MSG_RESULT([no])
2874     fi
2876     AC_MSG_CHECKING([whether to create a Mac App Store package])
2878     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2879         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2880     elif test "$enable_macosx_package_signing" = yes; then
2881         # By default use the first suitable certificate.
2882         # It should be a "3rd Party Mac Developer Installer" one
2884         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2885         if test -n "$identity"; then
2886             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2887             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2888             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2889         else
2890             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2891         fi
2892     elif test -n "$enable_macosx_package_signing"; then
2893         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2894         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2895         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2896     else
2897         AC_MSG_RESULT([no])
2898     fi
2900     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2901         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2902     fi
2904     AC_MSG_CHECKING([whether to sandbox the application])
2906     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2907         AC_MSG_ERROR([OS X sandboxing requires code signing])
2908     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2909         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2910     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2911         ENABLE_MACOSX_SANDBOX=TRUE
2912         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2913         AC_MSG_RESULT([yes])
2914     else
2915         AC_MSG_RESULT([no])
2916     fi
2918     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2919     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2920     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2922 AC_SUBST(MACOSX_SDK_PATH)
2923 AC_SUBST(MACOSX_SDK_VERSION)
2924 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2925 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2926 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2927 AC_SUBST(INSTALL_NAME_TOOL)
2928 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2929 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2930 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2931 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2932 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2934 dnl ===================================================================
2935 dnl Check iOS SDK and compiler
2936 dnl ===================================================================
2938 if test $_os = iOS; then
2940     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
2941         :
2942     else
2943         BITNESS_OVERRIDE=64
2944     fi
2946     AC_MSG_CHECKING([what iOS SDK to use])
2948     if test "$enable_ios_simulator" = yes; then
2949         platform=iPhoneSimulator
2950     else
2951         platform=iPhoneOS
2952     fi
2954     xcode_developer=`xcode-select -print-path`
2956     current_sdk_ver=9.3
2957     for sdkver in 10.0 9.3 9.2; do
2958         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2959         if test -d $t; then
2960             ios_sdk=$sdkver
2961             sysroot=$t
2962             break
2963         fi
2964     done
2966     if test -z "$sysroot"; then
2967         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2968     fi
2970     AC_MSG_RESULT($sysroot)
2972     XCODEBUILD_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2974     if test "$enable_ios_simulator" = yes; then
2975         if test "$BITNESS_OVERRIDE" = 64; then
2976             XCODE_ARCHS=x86_64
2977             versionmin=-mios-simulator-version-min=9.0
2978         else
2979             XCODE_ARCHS=i386
2980             versionmin=-mios-simulator-version-min=9.0
2981         fi
2982     else
2983         platform=iPhoneOS
2984         if test "$BITNESS_OVERRIDE" = 64; then
2985             XCODE_ARCHS=arm64
2986         else
2987             XCODE_ARCHS=armv7
2988         fi
2989         versionmin=-miphoneos-version-min=9.0
2990     fi
2992     # LTO is not really recommended for iOS builds,
2993     # the link time will be astronomical
2994     if test "$ENABLE_LTO" = TRUE; then
2995         lto=-flto
2996     fi
2997     # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
2998     # get compiled with it, to avoid ld warnings when linking all that together into one
2999     # executable.
3001     XCODE_CLANG_CXX_LIBRARY=libc++
3002     stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
3004     CC="`xcrun -find clang` -arch $XCODE_ARCHS -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
3005     CXX="`xcrun -find clang++` -arch $XCODE_ARCHS -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
3007     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3008     AR=`xcrun -find ar`
3009     NM=`xcrun -find nm`
3010     STRIP=`xcrun -find strip`
3011     LIBTOOL=`xcrun -find libtool`
3012     RANLIB=`xcrun -find ranlib`
3015 AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
3016 AC_SUBST(XCODE_ARCHS)
3017 AC_SUBST(XCODEBUILD_SDK)
3019 AC_MSG_CHECKING([whether to treat the installation as read-only])
3021 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3022         "$enable_extensions" != yes; then
3023     enable_readonly_installset=yes
3025 if test "$enable_readonly_installset" = yes; then
3026     AC_MSG_RESULT([yes])
3027     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3028 else
3029     AC_MSG_RESULT([no])
3032 dnl ===================================================================
3033 dnl Structure of install set
3034 dnl ===================================================================
3036 if test $_os = Darwin; then
3037     LIBO_BIN_FOLDER=MacOS
3038     LIBO_ETC_FOLDER=Resources
3039     LIBO_LIBEXEC_FOLDER=MacOS
3040     LIBO_LIB_FOLDER=Frameworks
3041     LIBO_LIB_PYUNO_FOLDER=Resources
3042     LIBO_SHARE_FOLDER=Resources
3043     LIBO_SHARE_HELP_FOLDER=Resources/help
3044     LIBO_SHARE_JAVA_FOLDER=Resources/java
3045     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3046     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3047     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3048     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3049     LIBO_URE_BIN_FOLDER=MacOS
3050     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3051     LIBO_URE_LIB_FOLDER=Frameworks
3052     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3053     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3054 elif test $_os = WINNT; then
3055     LIBO_BIN_FOLDER=program
3056     LIBO_ETC_FOLDER=program
3057     LIBO_LIBEXEC_FOLDER=program
3058     LIBO_LIB_FOLDER=program
3059     LIBO_LIB_PYUNO_FOLDER=program
3060     LIBO_SHARE_FOLDER=share
3061     LIBO_SHARE_HELP_FOLDER=help
3062     LIBO_SHARE_JAVA_FOLDER=program/classes
3063     LIBO_SHARE_PRESETS_FOLDER=presets
3064     LIBO_SHARE_READMES_FOLDER=readmes
3065     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3066     LIBO_SHARE_SHELL_FOLDER=program/shell
3067     LIBO_URE_BIN_FOLDER=program
3068     LIBO_URE_ETC_FOLDER=program
3069     LIBO_URE_LIB_FOLDER=program
3070     LIBO_URE_MISC_FOLDER=program
3071     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3072 else
3073     LIBO_BIN_FOLDER=program
3074     LIBO_ETC_FOLDER=program
3075     LIBO_LIBEXEC_FOLDER=program
3076     LIBO_LIB_FOLDER=program
3077     LIBO_LIB_PYUNO_FOLDER=program
3078     LIBO_SHARE_FOLDER=share
3079     LIBO_SHARE_HELP_FOLDER=help
3080     LIBO_SHARE_JAVA_FOLDER=program/classes
3081     LIBO_SHARE_PRESETS_FOLDER=presets
3082     LIBO_SHARE_READMES_FOLDER=readmes
3083     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3084     LIBO_SHARE_SHELL_FOLDER=program/shell
3085     LIBO_URE_BIN_FOLDER=program
3086     LIBO_URE_ETC_FOLDER=program
3087     LIBO_URE_LIB_FOLDER=program
3088     LIBO_URE_MISC_FOLDER=program
3089     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3091 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3092 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3093 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3094 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3095 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3096 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3097 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3098 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3099 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3100 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3101 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3102 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3103 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3104 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3105 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3106 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3108 # Not all of them needed in config_host.mk, add more if need arises
3109 AC_SUBST(LIBO_BIN_FOLDER)
3110 AC_SUBST(LIBO_ETC_FOLDER)
3111 AC_SUBST(LIBO_LIB_FOLDER)
3112 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3113 AC_SUBST(LIBO_SHARE_FOLDER)
3114 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3115 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3116 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3117 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3118 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3119 AC_SUBST(LIBO_URE_BIN_FOLDER)
3120 AC_SUBST(LIBO_URE_ETC_FOLDER)
3121 AC_SUBST(LIBO_URE_LIB_FOLDER)
3122 AC_SUBST(LIBO_URE_MISC_FOLDER)
3123 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3125 dnl ===================================================================
3126 dnl Windows specific tests and stuff
3127 dnl ===================================================================
3129 # Get a value from the 32-bit side of the Registry
3130 reg_get_value_32()
3132     # Return value: $regvalue
3133     unset regvalue
3134     _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`
3136     if test $? -eq 0; then
3137         regvalue=$_regvalue
3138     fi
3141 # Get a value from the 64-bit side of the Registry
3142 reg_get_value_64()
3144     # Return value: $regvalue
3145     unset regvalue
3146     _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`
3148     if test $? -eq 0; then
3149         regvalue=$_regvalue
3150     fi
3153 if test "$_os" = "WINNT"; then
3154     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3155     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3156         AC_MSG_RESULT([no])
3157         WINDOWS_SDK_ARCH="x86"
3158     else
3159         AC_MSG_RESULT([yes])
3160         WINDOWS_SDK_ARCH="x64"
3161         BITNESS_OVERRIDE=64
3162     fi
3165 if test "$cross_compiling" = "yes"; then
3166     export CROSS_COMPILING=TRUE
3167     SCPDEFS="$SCPDEFS -DCROSS_COMPILING"
3168 else
3169     CROSS_COMPILING=
3170     BUILD_TYPE="$BUILD_TYPE NATIVE"
3172 AC_SUBST(CROSS_COMPILING)
3174 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3175 if test "$GCC" = "yes"; then
3176     AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
3177     bsymbolic_functions_ldflags_save=$LDFLAGS
3178     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3179     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3180 #include <stdio.h>
3181         ],[
3182 printf ("hello world\n");
3183         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3184     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3185         AC_MSG_RESULT( found )
3186     else
3187         AC_MSG_RESULT( not found )
3188     fi
3189     LDFLAGS=$bsymbolic_functions_ldflags_save
3191 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3193 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3194 # NOTE: must _not_ be used for bundled external libraries!
3195 ISYSTEM=
3196 if test "$GCC" = "yes"; then
3197     AC_MSG_CHECKING( for -isystem )
3198     save_CFLAGS=$CFLAGS
3199     CFLAGS="$CFLAGS -Werror"
3200     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3201     CFLAGS=$save_CFLAGS
3202     if test -n "$ISYSTEM"; then
3203         AC_MSG_RESULT(yes)
3204     else
3205         AC_MSG_RESULT(no)
3206     fi
3208 if test -z "$ISYSTEM"; then
3209     # fall back to using -I
3210     ISYSTEM=-I
3212 AC_SUBST(ISYSTEM)
3214 dnl ===================================================================
3215 dnl  Check which Visual Studio or MinGW compiler is used
3216 dnl ===================================================================
3218 map_vs_year_to_version()
3220     # Return value: $vsversion
3222     unset vsversion
3224     case $1 in
3225     2013)
3226         vsversion=12.0;;
3227     2015)
3228         vsversion=14.0;;
3229     *)
3230         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3231     esac
3234 vs_versions_to_check()
3236     # Args: $1 (optional) : versions to check, in the order of preference
3237     # Return value: $vsversions
3239     unset vsversions
3241     if test -n "$1"; then
3242         map_vs_year_to_version "$1"
3243         vsversions=$vsversion
3244     else
3245         # By default we prefer 2013/2015, in this order
3246         vsversions="12.0 14.0"
3247     fi
3250 find_msvs()
3252     # Find Visual Studio 2013/2015
3253     # Args: $1 (optional) : versions to check, in the order of preference
3254     # Return value: $vstest
3256     unset vstest
3258     vs_versions_to_check "$1"
3260     for ver in $vsversions; do
3261         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
3262         if test -n "$regvalue"; then
3263             vstest=$regvalue
3264             break
3265         fi
3266         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
3267         if test -n "$regvalue"; then
3268             vstest=$regvalue
3269             break
3270         fi
3271     done
3274 win_get_env_from_vsvars32bat()
3276     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3277     echo -e "@setlocal\r\n" >> $WRAPPERBATCHFILEPATH
3278     echo -e "@call \"`cygpath -w $VC_PRODUCT_DIR`/../Common7/Tools/vsvars32.bat\"\r\n" >> $WRAPPERBATCHFILEPATH
3279     echo -e "@echo %$1%\r\n" >> $WRAPPERBATCHFILEPATH
3280     echo -e "@endlocal\r\n" >> $WRAPPERBATCHFILEPATH
3281     chmod +x $WRAPPERBATCHFILEPATH
3282     _win_get_env_from_vsvars32bat="`$WRAPPERBATCHFILEPATH | $SED -e s/^M^J//`"
3283     rm -f $WRAPPERBATCHFILEPATH
3284     echo $_win_get_env_from_vsvars32bat
3287 find_ucrt()
3289     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3290     if test -n "$regvalue"; then
3291         PathFormat "$regvalue"
3292         UCRTSDKDIR=$formatted_path
3293         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3294         UCRTVERSION=$regvalue
3295     fi
3296     if test -z "$UCRTSDKDIR"; then
3297         if test -f "$VC_PRODUCT_DIR/../Common7/Tools/vsvars32.bat"; then
3298             PathFormat "`win_get_env_from_vsvars32bat "UniversalCRTSdkDir"`"
3299             UCRTSDKDIR=$formatted_path
3300             UCRTVERSION=`win_get_env_from_vsvars32bat "UCRTVersion"`
3301         fi
3302     fi
3305 find_msvc()
3307     # Find Visual C++ 2013/2015
3308     # Args: $1 (optional) : The VS version year
3309     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot
3311     unset vctest vcnum vcnumwithdot vcexpress
3313     vs_versions_to_check "$1"
3315     for ver in $vsversions; do
3316         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3317         if test -n "$regvalue"; then
3318             vctest=$regvalue
3319             break
3320         fi
3321         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
3322         if test -n "$regvalue"; then
3323             vctest=$regvalue
3324             break
3325         fi
3326     done
3327     if test -n "$vctest"; then
3328         vcnumwithdot=$ver
3329         case "$vcnumwithdot" in
3330         12.0)
3331             vcyear=2013
3332             vcnum=120
3333             ;;
3334         14.0)
3335             vcyear=2015
3336             vcnum=140
3337             ;;
3338         esac
3339         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$vcnumwithdot/Setup/VC/ProductDir
3340         if test -n "$regvalue" -a "$regvalue" = "$vctest" ; then
3341             vcexpress=Express
3342         fi
3343     fi
3346 SOLARINC=
3347 SHOWINCLUDES_PREFIX=
3348 MSBUILD_PATH=
3349 DEVENV=
3350 if test "$_os" = "WINNT"; then
3351     if test "$WITH_MINGW" != "yes"; then
3352         AC_MSG_CHECKING([Visual C++])
3354         find_msvc "$with_visual_studio"
3355         if test -z "$vctest"; then
3356             if test -n "$with_visual_studio"; then
3357                 AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3358             else
3359                 AC_MSG_ERROR([No Visual Studio 2013/2015 installation found])
3360             fi
3361         fi
3363         if test "$BITNESS_OVERRIDE" = ""; then
3364             if test -f "$vctest/bin/cl.exe"; then
3365                 VC_PRODUCT_DIR=$vctest
3366             else
3367                 AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3368             fi
3369         else
3370             if test -f "$vctest/bin/amd64/cl.exe"; then
3371                 VC_PRODUCT_DIR=$vctest
3372             else
3373                 if test -f "$vctest/bin/x86_amd64/cl.exe" -a "$vcexpress" = "Express"; then
3374                     VC_PRODUCT_DIR=$vctest
3375                 else
3376                     AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3377                 fi
3378             fi
3379         fi
3381         VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3382         AC_MSG_RESULT([$VC_PRODUCT_DIR])
3384         AC_MSG_CHECKING([Is Visual C++ Express])
3385         if test "$vcexpress" = "Express" ; then
3386             AC_MSG_RESULT([Yes])
3387         else
3388             AC_MSG_RESULT([No])
3389         fi
3391         UCRTSDKDIR=
3392         UCRTVERSION=
3394         AC_MSG_CHECKING([whether UCRT is needed for this compiler version])
3395         if test "$vcnum" = "120"; then
3396             AC_MSG_RESULT([No])
3397         else
3398             AC_MSG_RESULT([Yes])
3399             AC_MSG_CHECKING([for UCRT location])
3400             find_ucrt
3401             if test -n "$UCRTSDKDIR"; then
3402                 AC_MSG_RESULT([found])
3403                 PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3404                 ucrtincpath_formatted=$formatted_path
3405                 # SOLARINC is used for external modules and must be set too.
3406                 # And no, it's not sufficient to set SOLARINC only, as configure
3407                 # itself doesn't honour it.
3408                 SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3409                 CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3410                 CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3411                 CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3412             else
3413                 AC_MSG_ERROR([not found])
3414             fi
3415         fi
3416         AC_SUBST(UCRTSDKDIR)
3417         AC_SUBST(UCRTVERSION)
3419         # Find the proper version of MSBuild.exe to use based on the VS version
3420         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3421         if test -n "$regvalue" ; then
3422             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3423         fi
3425         # Find the version of devenv.exe
3426         DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
3427         if test ! -e "$DEVENV" -a "$vcnum" = "120"; then
3428             # for Visual Studio 2013 Express, fall back
3429             DEVENV="$VC_PRODUCT_DIR/../Common7/IDE/WDExpress.exe"
3430         fi
3431         if test ! -e "$DEVENV"; then
3432             AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3433         fi
3435         dnl ===========================================================
3436         dnl  Check for the corresponding mspdb*.dll
3437         dnl ===========================================================
3439         MSPDB_PATH=
3441         if test "$BITNESS_OVERRIDE" = ""; then
3442             if test "$vcnum" = "120"; then
3443                 MSPDB_PATH="$VC_PRODUCT_DIR/../VC/bin"
3444             else
3445                 MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3446             fi
3447         else
3448             if test "$vcexpress" = "Express"; then
3449                 MSPDB_PATH="$VC_PRODUCT_DIR/bin"
3450             else
3451                 MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3452             fi
3453         fi
3455         mspdbnum=$vcnum
3457         if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3458             AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3459         fi
3461         MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3462         MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3464         dnl The path needs to be added before cl is called
3465         PATH="$MSPDB_PATH:$PATH"
3467         AC_MSG_CHECKING([cl.exe])
3469         # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3470         # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3471         # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3472         # is not enough?
3474         if test -z "$CC"; then
3475             if test "$BITNESS_OVERRIDE" = ""; then
3476                 if test -f "$VC_PRODUCT_DIR/bin/cl.exe"; then
3477                     CC="$VC_PRODUCT_DIR/bin/cl.exe"
3478                 fi
3479             else
3480                 if test "$vcexpress" = "Express"; then
3481                    if test -f "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"; then
3482                         CC="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3483                    fi
3484                 else
3485                    if test -f "$VC_PRODUCT_DIR/bin/amd64/cl.exe"; then
3486                         CC="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3487                    fi
3488                 fi
3489             fi
3491             # This gives us a posix path with 8.3 filename restrictions
3492             CC=`win_short_path_for_make "$CC"`
3493         fi
3495         if test -n "$CC"; then
3496             # Remove /cl.exe from CC case insensitive
3497             AC_MSG_RESULT([found Visual C++ $vcyear $vcexpress ($CC)])
3498             if test "$BITNESS_OVERRIDE" = ""; then
3499                 COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3500             else
3501                 if test -n "$VC_PRODUCT_DIR"; then
3502                     COMPATH=$VC_PRODUCT_DIR
3503                 fi
3504             fi
3505             if test "$BITNESS_OVERRIDE" = ""; then
3506                 dnl since MSVC 2012, default for x86 is -arch:SSE2:
3507                 CC="$CC -arch:SSE"
3508             fi
3509             export INCLUDE=`cygpath -d "$COMPATH/Include"`
3511             PathFormat "$COMPATH"
3512             COMPATH="$formatted_path"
3514             VCVER=$vcnum
3515             MSVSVER=$vcyear
3517             # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3518             # are always "better", we list them in reverse chronological order.
3520             case $vcnum in
3521             120)
3522                 COMEX=15
3523                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="8.1A 8.1 8.0 7.1A"
3524                 ;;
3525             140)
3526                 COMEX=19
3527                 WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0A 10.0 8.1A 8.1 8.0 7.1A"
3528                 ;;
3529             esac
3531             # The expectation is that --with-windows-sdk should not need to be used
3532             if test -n "$with_windows_sdk"; then
3533                 case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3534                 *" "$with_windows_sdk" "*)
3535                     WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3536                     ;;
3537                 *)
3538                     AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3539                     ;;
3540                 esac
3541             fi
3543             # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3544             ac_objext=obj
3545             ac_exeext=exe
3547         else
3548             AC_MSG_ERROR([Visual C++ not found after all, huh])
3549         fi
3551         dnl We need to guess the prefix of the -showIncludes output, it can be
3552         dnl localized
3553         AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3554         echo "#include <stdlib.h>" > conftest.c
3555         dnl Filter out -FIIntrin.h when CC points at clang-cl.exe and needs to
3556         dnl explicitly state that argument:
3557         my_CC=
3558         for i in $CC; do
3559             case $i in
3560             -FIIntrin.h)
3561                 ;;
3562             *)
3563                 my_CC="$my_CC $i"
3564                 ;;
3565             esac
3566         done
3567         SHOWINCLUDES_PREFIX=`$my_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3568             grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3569         rm -f conftest.c conftest.obj
3570         if test -z "$SHOWINCLUDES_PREFIX"; then
3571             AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3572         else
3573             AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3574         fi
3576         # Check for 64-bit (cross-)compiler to use to build the 64-bit
3577         # version of the Explorer extension (and maybe other small
3578         # bits, too) needed when installing a 32-bit LibreOffice on a
3579         # 64-bit OS. The 64-bit Explorer extension is a feature that
3580         # has been present since long in OOo. Don't confuse it with
3581         # building LibreOffice itself as 64-bit code.
3583         BUILD_X64=
3584         CXX_X64_BINARY=
3585         LINK_X64_BINARY=
3587         if test "$BITNESS_OVERRIDE" = ""; then
3588             AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3589             if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3590                 # Prefer native x64 compiler to cross-compiler, in case we are running
3591                 # the build on a 64-bit OS.
3592                 if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3593                     BUILD_X64=TRUE
3594                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3595                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3596                 elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3597                     BUILD_X64=TRUE
3598                     CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3599                     LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3600                 fi
3601             fi
3602             if test "$BUILD_X64" = TRUE; then
3603                 AC_MSG_RESULT([found])
3604             else
3605                 AC_MSG_RESULT([not found])
3606                 AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3607             fi
3608         fi
3609         AC_SUBST(BUILD_X64)
3611         # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3612         AC_SUBST(CXX_X64_BINARY)
3613         AC_SUBST(LINK_X64_BINARY)
3614     else
3615         AC_MSG_CHECKING([the compiler is MinGW])
3616         MACHINE_PREFIX=`$CC -dumpmachine`
3617         if echo $MACHINE_PREFIX | $GREP -q mingw32; then
3618             COMPATH=`echo "$COMPATH" | sed -e 's,/bin$,,'`
3619             AC_MSG_RESULT([yes])
3620         else
3621             AC_MSG_ERROR([Compiler is not MinGW.])
3622         fi
3623     fi
3625 AC_SUBST(VCVER)
3626 AC_SUBST(DEVENV)
3627 PathFormat "$MSPDB_PATH"
3628 MSPDB_PATH="$formatted_path"
3629 AC_SUBST(SHOWINCLUDES_PREFIX)
3631 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
3632     AC_MSG_CHECKING([whether to use DirectX])
3633     if test "$enable_directx" = "yes" -o "$enable_directx" = ""; then
3634         ENABLE_DIRECTX="TRUE"
3635         AC_MSG_RESULT([yes])
3636     else
3637         ENABLE_DIRECTX=""
3638         AC_MSG_RESULT([no])
3639     fi
3641     AC_MSG_CHECKING([whether to use ActiveX])
3642     if test "$enable_activex" = "yes" -o "$enable_activex" = "" -a "$vcexpress" != Express; then
3643         DISABLE_ACTIVEX=""
3644         AC_MSG_RESULT([yes])
3645     else
3646         DISABLE_ACTIVEX="TRUE"
3647         AC_MSG_RESULT([no])
3648     fi
3650     AC_MSG_CHECKING([whether to use ATL])
3651     if test "$enable_atl" = "yes" -o "$enable_atl" = "" -a "$vcexpress" != Express; then
3652         DISABLE_ATL=""
3653         AC_DEFINE(HAVE_FEATURE_ATL, 1)
3654         AC_MSG_RESULT([yes])
3655     else
3656         DISABLE_ATL="TRUE"
3657         AC_MSG_RESULT([no])
3658     fi
3659 else
3660     ENABLE_DIRECTX=""
3661     DISABLE_ACTIVEX="TRUE"
3662     DISABLE_ATL="TRUE"
3665 AC_SUBST(ENABLE_DIRECTX)
3666 AC_SUBST(DISABLE_ACTIVEX)
3667 AC_SUBST(DISABLE_ATL)
3670 # dbghelp.dll
3672 if test "$_os" = "WINNT"; then
3673     BUILD_TYPE="$BUILD_TYPE DBGHELP"
3677 # unowinreg.dll
3679 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3680 AC_SUBST(UNOWINREG_DLL)
3682 COM_IS_CLANG=
3683 AC_MSG_CHECKING([whether the compiler is actually Clang])
3684 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3685     #ifndef __clang__
3686     you lose
3687     #endif
3688     int foo=42;
3689     ]])],
3690     [AC_MSG_RESULT([yes])
3691      COM_IS_CLANG=TRUE],
3692     [AC_MSG_RESULT([no])])
3694 if test "$COM_IS_CLANG" = TRUE; then
3695     AC_MSG_CHECKING([the Clang version])
3696     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | ${CC%-cl.exe*} -E -P -`
3697     CLANG_FULL_VERSION=`echo __clang_version__ | ${CC%-cl.exe*} -E -P -`
3698     CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3699     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3700     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3701     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3703 AC_SUBST(COM_IS_CLANG)
3706 # prefix C with ccache if needed
3708 if test "$CCACHE" != ""; then
3709     AC_MSG_CHECKING([whether $CC is already ccached])
3711     AC_LANG_PUSH([C])
3712     save_CFLAGS=$CFLAGS
3713     CFLAGS="$CFLAGS --ccache-skip -O2"
3714     dnl an empty program will do, we're checking the compiler flags
3715     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3716                       [use_ccache=yes], [use_ccache=no])
3717     if test $use_ccache = yes; then
3718         AC_MSG_RESULT([yes])
3719     else
3720         CC="$CCACHE $CC"
3721         AC_MSG_RESULT([no])
3722     fi
3723     CFLAGS=$save_CFLAGS
3724     AC_LANG_POP([C])
3727 # ===================================================================
3728 # check various GCC options that Clang does not support now but maybe
3729 # will somewhen in the future, check them even for GCC, so that the
3730 # flags are set
3731 # ===================================================================
3733 HAVE_GCC_GGDB2=
3734 HAVE_GCC_FINLINE_LIMIT=
3735 HAVE_GCC_FNO_INLINE=
3736 HAVE_GCC_OG=
3737 if test "$GCC" = "yes"; then
3738     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3739     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3740         # Option just ignored and silly warning that isn't a real
3741         # warning printed
3742         :
3743     else
3744         save_CFLAGS=$CFLAGS
3745         CFLAGS="$CFLAGS -Werror -ggdb2"
3746         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3747         CFLAGS=$save_CFLAGS
3748     fi
3749     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3750         AC_MSG_RESULT([yes])
3751     else
3752         AC_MSG_RESULT([no])
3753     fi
3755     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3756     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3757         # As above
3758         :
3759     else
3760         save_CFLAGS=$CFLAGS
3761         CFLAGS="$CFLAGS -Werror -finline-limit=0"
3762         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3763         CFLAGS=$save_CFLAGS
3764     fi
3765     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3766         AC_MSG_RESULT([yes])
3767     else
3768         AC_MSG_RESULT([no])
3769     fi
3771     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3772     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
3773         # Ditto
3774         :
3775     else
3776         save_CFLAGS=$CFLAGS
3777         CFLAGS="$CFLAGS -Werror -fno-inline"
3778         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3779         CFLAGS=$save_CFLAGS
3780     fi
3781     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3782         AC_MSG_RESULT([yes])
3783     else
3784         AC_MSG_RESULT([no])
3785     fi
3787     AC_MSG_CHECKING([whether $CC supports -Og])
3788     # Note that clang-3.1 reports a real error for this option
3789     # so we do not need a special case for clang<=3.1 as above.
3790     save_CFLAGS=$CFLAGS
3791     CFLAGS="$CFLAGS -Werror -Og"
3792     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
3793     CFLAGS=$save_CFLAGS
3794     if test "$HAVE_GCC_OG" = "TRUE"; then
3795         AC_MSG_RESULT([yes])
3796     else
3797         AC_MSG_RESULT([no])
3798     fi
3800 AC_SUBST(HAVE_GCC_GGDB2)
3801 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3802 AC_SUBST(HAVE_GCC_FNO_INLINE)
3803 AC_SUBST(HAVE_GCC_OG)
3805 dnl ===================================================================
3806 dnl  Test the gcc version
3807 dnl ===================================================================
3808 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3809     AC_MSG_CHECKING([the GCC version])
3810     _gcc_version=`$CC -dumpversion`
3811     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3813     AC_MSG_RESULT([gcc $_gcc_version])
3815     if test "$GCC_VERSION" -lt 0407; then
3816         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.7.0])
3817     fi
3818 else
3819     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3820     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3821     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3822     # (which reports itself as GCC 4.2.1).
3823     GCC_VERSION=
3825 AC_SUBST(GCC_VERSION)
3827 dnl Set the ENABLE_DBGUTIL variable
3828 dnl ===================================================================
3829 AC_MSG_CHECKING([whether to build with additional debug utilities])
3830 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3831     ENABLE_DBGUTIL="TRUE"
3832     # this is an extra var so it can have different default on different MSVC
3833     # versions (in case there are version specific problems with it)
3834     MSVC_USE_DEBUG_RUNTIME="TRUE"
3836     AC_MSG_RESULT([yes])
3837     # cppunit and graphite expose STL in public headers
3838     if test "$with_system_cppunit" = "yes"; then
3839         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3840     else
3841         with_system_cppunit=no
3842     fi
3843     if test "$with_system_graphite" = "yes"; then
3844         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3845     else
3846         with_system_graphite=no
3847     fi
3848     if test "$with_system_mysql_cppconn" = "yes"; then
3849         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3850     else
3851         with_system_mysql_cppconn=no
3852     fi
3853     if test "$with_system_orcus" = "yes"; then
3854         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3855     else
3856         with_system_orcus=no
3857     fi
3858     if test "$with_system_libcmis" = "yes"; then
3859         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3860     else
3861         with_system_libcmis=no
3862     fi
3863     if test "$with_system_libgltf" = "yes"; then
3864         AC_MSG_ERROR([--with-system-libgltf conflicts with --enable-dbgutil])
3865     else
3866         with_system_libgltf=no
3867     fi
3868 else
3869     ENABLE_DBGUTIL=""
3870     MSVC_USE_DEBUG_RUNTIME=""
3871     AC_MSG_RESULT([no])
3873 AC_SUBST(ENABLE_DBGUTIL)
3874 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3876 dnl Set the ENABLE_DEBUG variable.
3877 dnl ===================================================================
3878 AC_MSG_CHECKING([whether to do a debug build])
3879 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3880     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3882 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3883     AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3886 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3887     ENABLE_DEBUG="TRUE"
3888     if test -n "$ENABLE_DBGUTIL" ; then
3889         AC_MSG_RESULT([yes (dbgutil)])
3890     else
3891         AC_MSG_RESULT([yes])
3892     fi
3893 else
3894     ENABLE_DEBUG=""
3895     AC_MSG_RESULT([no])
3897 AC_SUBST(ENABLE_DEBUG)
3899 if test "$enable_sal_log" = yes; then
3900     ENABLE_SAL_LOG=TRUE
3902 AC_SUBST(ENABLE_SAL_LOG)
3904 dnl Selective debuginfo
3905 ENABLE_DEBUGINFO_FOR=
3906 if test -n "$ENABLE_DEBUG"; then
3907     AC_MSG_CHECKING([whether to use selective debuginfo])
3908     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3909         if test "$enable_selective_debuginfo" = "yes"; then
3910             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3911         fi
3912         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3913         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3914     else
3915         ENABLE_DEBUGINFO_FOR=all
3916         AC_MSG_RESULT([no, for all])
3917     fi
3918 else
3919     if test -n "$enable_selective_debuginfo"; then
3920         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3921     fi
3923 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3925 dnl Check for enable symbols option
3926 dnl ===================================================================
3927 AC_MSG_CHECKING([whether to generate debug information])
3928 if test -z "$enable_symbols"; then
3929     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3930         enable_symbols=yes
3931     else
3932         enable_symbols=no
3933     fi
3935 if test "$enable_symbols" != no; then
3936     ENABLE_SYMBOLS=TRUE
3937     AC_MSG_RESULT([yes])
3938 else
3939     ENABLE_SYMBOLS=
3940     AC_MSG_RESULT([no])
3942 AC_SUBST(ENABLE_SYMBOLS)
3944 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3945     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3946     AC_MSG_CHECKING([whether enough memory is available for linking])
3947     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3948     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3949     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3950         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3951     else
3952         AC_MSG_RESULT([yes])
3953     fi
3956 # Debug information format for iOS. Running dsymutil takes a long time... you really need a separate
3957 # .dSYM only if running Instruments, I think. (Not for normal debugging in Xcode.) To enable a
3958 # separate .dSYM, either use --enable-release-build or change manually to "DWARF with DSYM" in Xcode.
3959 XCODE_DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
3960 if test "$enable_release_build" != yes -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \); then
3961     XCODE_DEBUG_INFORMATION_FORMAT=dwarf
3963 AC_SUBST(XCODE_DEBUG_INFORMATION_FORMAT)
3965 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
3966 # By default use the ones specified by our build system,
3967 # but explicit override is possible.
3968 AC_MSG_CHECKING(for explicit AFLAGS)
3969 if test -n "$AFLAGS"; then
3970     AC_MSG_RESULT([$AFLAGS])
3971     x_AFLAGS=
3972 else
3973     AC_MSG_RESULT(no)
3974     x_AFLAGS=[\#]
3976 AC_MSG_CHECKING(for explicit CFLAGS)
3977 if test -n "$CFLAGS"; then
3978     AC_MSG_RESULT([$CFLAGS])
3979     x_CFLAGS=
3980 else
3981     AC_MSG_RESULT(no)
3982     x_CFLAGS=[\#]
3984 AC_MSG_CHECKING(for explicit CXXFLAGS)
3985 if test -n "$CXXFLAGS"; then
3986     AC_MSG_RESULT([$CXXFLAGS])
3987     x_CXXFLAGS=
3988 else
3989     AC_MSG_RESULT(no)
3990     x_CXXFLAGS=[\#]
3992 AC_MSG_CHECKING(for explicit OBJCFLAGS)
3993 if test -n "$OBJCFLAGS"; then
3994     AC_MSG_RESULT([$OBJCFLAGS])
3995     x_OBJCFLAGS=
3996 else
3997     AC_MSG_RESULT(no)
3998     x_OBJCFLAGS=[\#]
4000 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
4001 if test -n "$OBJCXXFLAGS"; then
4002     AC_MSG_RESULT([$OBJCXXFLAGS])
4003     x_OBJCXXFLAGS=
4004 else
4005     AC_MSG_RESULT(no)
4006     x_OBJCXXFLAGS=[\#]
4008 AC_MSG_CHECKING(for explicit LDFLAGS)
4009 if test -n "$LDFLAGS"; then
4010     AC_MSG_RESULT([$LDFLAGS])
4011     x_LDFLAGS=
4012 else
4013     AC_MSG_RESULT(no)
4014     x_LDFLAGS=[\#]
4016 AC_SUBST(AFLAGS)
4017 AC_SUBST(CFLAGS)
4018 AC_SUBST(CXXFLAGS)
4019 AC_SUBST(OBJCFLAGS)
4020 AC_SUBST(OBJCXXFLAGS)
4021 AC_SUBST(LDFLAGS)
4022 AC_SUBST(x_AFLAGS)
4023 AC_SUBST(x_CFLAGS)
4024 AC_SUBST(x_CXXFLAGS)
4025 AC_SUBST(x_OBJCFLAGS)
4026 AC_SUBST(x_OBJCXXFLAGS)
4027 AC_SUBST(x_LDFLAGS)
4030 # determine CPUNAME, OS, ...
4031 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4033 case "$host_os" in
4035 aix*)
4036     COM=GCC
4037     CPUNAME=POWERPC
4038     USING_X11=TRUE
4039     OS=AIX
4040     RTL_OS=AIX
4041     RTL_ARCH=PowerPC
4042     PLATFORMID=aix_powerpc
4043     P_SEP=:
4044     ;;
4046 cygwin*)
4047     COM=MSC
4048     USING_X11=
4049     OS=WNT
4050     RTL_OS=Windows
4051     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4052         P_SEP=";"
4053     else
4054         P_SEP=:
4055     fi
4056     case "$host_cpu" in
4057     i*86|x86_64)
4058         if test "$BITNESS_OVERRIDE" = 64; then
4059             CPUNAME=X86_64
4060             RTL_ARCH=X86_64
4061             PLATFORMID=windows_x86_64
4062             WINDOWS_X64=1
4063             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4064         else
4065             CPUNAME=INTEL
4066             RTL_ARCH=x86
4067             PLATFORMID=windows_x86
4068         fi
4069         ;;
4070     *)
4071         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4072         ;;
4073     esac
4074     SCPDEFS="$SCPDEFS -D_MSC_VER"
4075     ;;
4077 darwin*)
4078     COM=GCC
4079     USING_X11=
4080     OS=MACOSX
4081     RTL_OS=MacOSX
4082     P_SEP=:
4084     case "$host_cpu" in
4085     arm*)
4086         CPUNAME=ARM
4087         RTL_ARCH=ARM_EABI
4088         PLATFORMID=ios_arm
4089         OS=IOS
4090         ;;
4091     i*86)
4092         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4093         ;;
4094     x86_64)
4095         CPUNAME=X86_64
4096         RTL_ARCH=X86_64
4097         PLATFORMID=macosx_x86_64
4098         ;;
4099     *)
4100         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4101         ;;
4102     esac
4103     ;;
4105 dragonfly*)
4106     COM=GCC
4107     USING_X11=TRUE
4108     OS=DRAGONFLY
4109     RTL_OS=DragonFly
4110     P_SEP=:
4112     case "$host_cpu" in
4113     i*86)
4114         CPUNAME=INTEL
4115         RTL_ARCH=x86
4116         PLATFORMID=dragonfly_x86
4117         ;;
4118     x86_64)
4119         CPUNAME=X86_64
4120         RTL_ARCH=X86_64
4121         PLATFORMID=dragonfly_x86_64
4122         ;;
4123     *)
4124         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4125         ;;
4126     esac
4127     ;;
4129 freebsd*)
4130     COM=GCC
4131     USING_X11=TRUE
4132     RTL_OS=FreeBSD
4133     OS=FREEBSD
4134     P_SEP=:
4136     case "$host_cpu" in
4137     i*86)
4138         CPUNAME=INTEL
4139         RTL_ARCH=x86
4140         PLATFORMID=freebsd_x86
4141         ;;
4142     x86_64|amd64)
4143         CPUNAME=X86_64
4144         RTL_ARCH=X86_64
4145         PLATFORMID=freebsd_x86_64
4146         ;;
4147     *)
4148         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4149         ;;
4150     esac
4151     ;;
4153 kfreebsd*)
4154     COM=GCC
4155     USING_X11=TRUE
4156     OS=LINUX
4157     RTL_OS=kFreeBSD
4158     P_SEP=:
4160     case "$host_cpu" in
4162     i*86)
4163         CPUNAME=INTEL
4164         RTL_ARCH=x86
4165         PLATFORMID=kfreebsd_x86
4166         ;;
4167     x86_64)
4168         CPUNAME=X86_64
4169         RTL_ARCH=X86_64
4170         PLATFORMID=kfreebsd_x86_64
4171         ;;
4172     *)
4173         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4174         ;;
4175     esac
4176     ;;
4178 linux-gnu*)
4179     COM=GCC
4180     USING_X11=TRUE
4181     OS=LINUX
4182     RTL_OS=Linux
4183     P_SEP=:
4185     case "$host_cpu" in
4187     aarch64)
4188         CPUNAME=AARCH64
4189         PLATFORMID=linux_aarch64
4190         RTL_ARCH=AARCH64
4191         ;;
4192     alpha)
4193         CPUNAME=AXP
4194         RTL_ARCH=ALPHA
4195         PLATFORMID=linux_alpha
4196         ;;
4197     arm*)
4198         CPUNAME=ARM
4199         EPM_FLAGS="-a arm"
4200         RTL_ARCH=ARM_EABI
4201         PLATFORMID=linux_arm_eabi
4202         case "$host_cpu" in
4203         arm*-linux)
4204             RTL_ARCH=ARM_OABI
4205             PLATFORMID=linux_arm_oabi
4206             ;;
4207         esac
4208         ;;
4209     hppa)
4210         CPUNAME=HPPA
4211         RTL_ARCH=HPPA
4212         EPM_FLAGS="-a hppa"
4213         PLATFORMID=linux_hppa
4214         ;;
4215     i*86)
4216         CPUNAME=INTEL
4217         RTL_ARCH=x86
4218         PLATFORMID=linux_x86
4219         ;;
4220     ia64)
4221         CPUNAME=IA64
4222         RTL_ARCH=IA64
4223         PLATFORMID=linux_ia64
4224         ;;
4225     mips)
4226         CPUNAME=GODSON
4227         RTL_ARCH=MIPS_EB
4228         EPM_FLAGS="-a mips"
4229         PLATFORMID=linux_mips_eb
4230         ;;
4231     mips64)
4232         CPUNAME=GODSON64
4233         RTL_ARCH=MIPS64_EB
4234         EPM_FLAGS="-a mips64"
4235         PLATFORMID=linux_mips64_eb
4236         ;;
4237     mips64el)
4238         CPUNAME=GODSON64
4239         RTL_ARCH=MIPS64_EL
4240         EPM_FLAGS="-a mips64el"
4241         PLATFORMID=linux_mips64_el
4242         ;;
4243     mipsel)
4244         CPUNAME=GODSON
4245         RTL_ARCH=MIPS_EL
4246         EPM_FLAGS="-a mipsel"
4247         PLATFORMID=linux_mips_el
4248         ;;
4249     m68k)
4250         CPUNAME=M68K
4251         RTL_ARCH=M68K
4252         PLATFORMID=linux_m68k
4253         ;;
4254     powerpc)
4255         CPUNAME=POWERPC
4256         RTL_ARCH=PowerPC
4257         PLATFORMID=linux_powerpc
4258         ;;
4259     powerpc64)
4260         CPUNAME=POWERPC64
4261         RTL_ARCH=PowerPC_64
4262         PLATFORMID=linux_powerpc64
4263         ;;
4264     powerpc64le)
4265         CPUNAME=POWERPC64
4266         RTL_ARCH=PowerPC_64_LE
4267         PLATFORMID=linux_powerpc64_le
4268         ;;
4269     sparc)
4270         CPUNAME=SPARC
4271         RTL_ARCH=SPARC
4272         PLATFORMID=linux_sparc
4273         ;;
4274     sparc64)
4275         CPUNAME=SPARC64
4276         RTL_ARCH=SPARC64
4277         PLATFORMID=linux_sparc64
4278         ;;
4279     s390)
4280         CPUNAME=S390
4281         RTL_ARCH=S390
4282         PLATFORMID=linux_s390
4283         ;;
4284     s390x)
4285         CPUNAME=S390X
4286         RTL_ARCH=S390x
4287         PLATFORMID=linux_s390x
4288         ;;
4289     x86_64)
4290         CPUNAME=X86_64
4291         RTL_ARCH=X86_64
4292         PLATFORMID=linux_x86_64
4293         ;;
4294     *)
4295         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4296         ;;
4297     esac
4298     ;;
4300 linux-android*)
4301     COM=GCC
4302     USING_X11=
4303     OS=ANDROID
4304     RTL_OS=Android
4305     P_SEP=:
4307     case "$host_cpu" in
4309     arm|armel)
4310         CPUNAME=ARM
4311         RTL_ARCH=ARM_EABI
4312         PLATFORMID=android_arm_eabi
4313         ;;
4314     aarch64)
4315         CPUNAME=AARCH64
4316         RTL_ARCH=AARCH64
4317         PLATFORMID=android_aarch64
4318         ;;
4319     mips|mipsel)
4320         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4321         RTL_ARCH=MIPS_EL
4322         PLATFORMID=android_mips_el
4323         ;;
4324     i*86)
4325         CPUNAME=INTEL
4326         RTL_ARCH=x86
4327         PLATFORMID=android_x86
4328         ;;
4329     *)
4330         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4331         ;;
4332     esac
4333     ;;
4335 emscripten*)
4336     COM=emcc
4337     USING_X11=
4338     OS=EMSCRIPTEN
4339     RTL_OS=Emscripten
4340     P_SEP=:
4341     CPUNAME=INTEL
4342     RTL_ARCH=x86
4343     PLATFORMID=linux_x86
4344     ;;
4346 mingw*)
4347     COM=GCC
4348     USING_X11=
4349     OS=WNT
4350     RTL_OS=Windows
4351     P_SEP=:
4353     case "$host_cpu" in
4354     i*86|x86_64)
4355         if test "$BITNESS_OVERRIDE" = 64; then
4356             CPUNAME=X86_64
4357             RTL_ARCH=X86_84
4358             PLATFORMID=windows_x86_64
4359             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgccx"
4360         else
4361             CPUNAME=INTEL
4362             RTL_ARCH=x86
4363             PLATFORMID=windows_x86
4364             SOLARINC="$SOLARINC -I$SRC_ROOT/include/wntgcci"
4365         fi
4366         ;;
4367     *)
4368         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4369         ;;
4370     esac
4371     ;;
4373 *netbsd*)
4374     COM=GCC
4375     USING_X11=TRUE
4376     OS=NETBSD
4377     RTL_OS=NetBSD
4378     P_SEP=:
4380     case "$host_cpu" in
4381     i*86)
4382         CPUNAME=INTEL
4383         RTL_ARCH=x86
4384         PLATFORMID=netbsd_x86
4385         ;;
4386     powerpc)
4387         CPUNAME=POWERPC
4388         RTL_ARCH=PowerPC
4389         PLATFORMID=netbsd_powerpc
4390         ;;
4391     sparc)
4392         CPUNAME=SPARC
4393         RTL_ARCH=SPARC
4394         PLATFORMID=netbsd_sparc
4395         ;;
4396     x86_64)
4397         CPUNAME=X86_64
4398         RTL_ARCH=X86_64
4399         PLATFORMID=netbsd_x86_64
4400         ;;
4401     *)
4402         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4403         ;;
4404     esac
4405     ;;
4407 openbsd*)
4408     COM=GCC
4409     USING_X11=TRUE
4410     OS=OPENBSD
4411     RTL_OS=OpenBSD
4412     P_SEP=:
4414     case "$host_cpu" in
4415     i*86)
4416         CPUNAME=INTEL
4417         RTL_ARCH=x86
4418         PLATFORMID=openbsd_x86
4419         ;;
4420     x86_64)
4421         CPUNAME=X86_64
4422         RTL_ARCH=X86_64
4423         PLATFORMID=openbsd_x86_64
4424         ;;
4425     *)
4426         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4427         ;;
4428     esac
4429     SOLARINC="$SOLARINC -I/usr/local/include"
4430     ;;
4432 solaris*)
4433     COM=GCC
4434     USING_X11=TRUE
4435     OS=SOLARIS
4436     RTL_OS=Solaris
4437     P_SEP=:
4439     case "$host_cpu" in
4440     i*86)
4441         CPUNAME=INTEL
4442         RTL_ARCH=x86
4443         PLATFORMID=solaris_x86
4444         ;;
4445     sparc)
4446         CPUNAME=SPARC
4447         RTL_ARCH=SPARC
4448         PLATFORMID=solaris_sparc
4449         ;;
4450     sparc64)
4451         CPUNAME=SPARC64
4452         RTL_ARCH=SPARC64
4453         PLATFORMID=solaris_sparc64
4454         ;;
4455     *)
4456         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4457         ;;
4458     esac
4459     SOLARINC="$SOLARINC -I/usr/local/include"
4460     ;;
4463     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4464     ;;
4465 esac
4467 if test "$with_x" = "no"; then
4468     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4471 ENABLE_HEADLESS=""
4472 if test "$enable_gui" = "no"; then
4473     if test "$USING_X11" != TRUE; then
4474         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4475     fi
4476     USING_X11=
4477     ENABLE_HEADLESS=TRUE
4478     AC_DEFINE(HAVE_FEATURE_UI,0)
4479     test_cairo=yes
4481 AC_SUBST(ENABLE_HEADLESS)
4483 WORKDIR="${BUILDDIR}/workdir"
4484 INSTDIR="${BUILDDIR}/instdir"
4485 INSTROOT="${INSTDIR}${INSTROOTSUFFIX}"
4486 SOLARINC="-I. -I$SRC_ROOT/include $SOLARINC"
4487 AC_SUBST(COM)
4488 AC_SUBST(CPUNAME)
4489 AC_SUBST(RTL_OS)
4490 AC_SUBST(RTL_ARCH)
4491 AC_SUBST(EPM_FLAGS)
4492 AC_SUBST(USING_X11)
4493 AC_SUBST([INSTDIR])
4494 AC_SUBST([INSTROOT])
4495 AC_SUBST(OS)
4496 AC_SUBST(P_SEP)
4497 AC_SUBST(WORKDIR)
4498 AC_SUBST(PLATFORMID)
4499 AC_SUBST(WINDOWS_X64)
4500 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4502 dnl ===================================================================
4503 dnl Test which package format to use
4504 dnl ===================================================================
4505 AC_MSG_CHECKING([which package format to use])
4506 if test -n "$with_package_format" -a "$with_package_format" != no; then
4507     for i in $with_package_format; do
4508         case "$i" in
4509         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4510             ;;
4511         *)
4512             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4513 aix - AIX software distribution
4514 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4515 deb - Debian software distribution
4516 pkg - Solaris software distribution
4517 rpm - RedHat software distribution
4519 LibreOffice additionally supports:
4520 archive - .tar.gz or .zip
4521 dmg - Mac OS X .dmg
4522 installed - installation tree
4523 msi - Windows .msi
4524         ])
4525             ;;
4526         esac
4527     done
4528     PKGFORMAT="$with_package_format"
4529     AC_MSG_RESULT([$PKGFORMAT])
4530 else
4531     PKGFORMAT=
4532     AC_MSG_RESULT([none])
4534 AC_SUBST(PKGFORMAT)
4536 dnl ===================================================================
4537 dnl Set up a different compiler to produce tools to run on the build
4538 dnl machine when doing cross-compilation
4539 dnl ===================================================================
4541 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4542 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4543 if test "$cross_compiling" = "yes"; then
4544     AC_MSG_CHECKING([for BUILD platform configuration])
4545     echo
4546     rm -rf CONF-FOR-BUILD config_build.mk
4547     mkdir CONF-FOR-BUILD
4548     # Here must be listed all files needed when running the configure script. In particular, also
4549     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4550     # keep them in the same order as there.
4551     (cd $SRC_ROOT && tar cf - \
4552         config.guess \
4553         bin/get_config_variables \
4554         solenv/bin/getcompver.awk \
4555         solenv/inc/langlist.mk \
4556         config_host.mk.in \
4557         config_host_lang.mk.in \
4558         Makefile.in \
4559         lo.xcent.in \
4560         bin/bffvalidator.sh.in \
4561         bin/odfvalidator.sh.in \
4562         bin/officeotron.sh.in \
4563         instsetoo_native/util/openoffice.lst.in \
4564         config_host/*.in \
4565         sysui/desktop/macosx/Info.plist.in \
4566         ios/lo.xcconfig.in) \
4567     | (cd CONF-FOR-BUILD && tar xf -)
4568     cp configure CONF-FOR-BUILD
4569     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4570     (
4571     unset COM USING_X11 OS CPUNAME
4572     unset CC CXX SYSBASE CFLAGS
4573     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4574     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4575     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4576     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4577     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4578     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4579     cd CONF-FOR-BUILD
4580     sub_conf_opts=""
4581     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4582     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4583     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4584     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4585     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4586     # we need the msi build tools on mingw if we are creating the
4587     # installation set
4588     if test "$WITH_MINGW" = "yes"; then
4589         enable_winegcc_for_build=
4590         for pkgformat in $PKGFORMAT; do
4591             case "$pkgformat" in
4592             msi|native) enable_winegcc_for_build=yes ;;
4593             esac
4594         done
4595         test -n "$enable_winegcc_for_build" && sub_conf_opts="$sub_conf_opts --enable-winegcc"
4596     fi
4597     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4598     # Don't bother having configure look for stuff not needed for the build platform anyway
4599     ./configure \
4600         --disable-cups \
4601         --disable-gtk3 \
4602         --disable-pdfimport \
4603         --disable-postgresql-sdbc \
4604         --with-parallelism="$with_parallelism" \
4605         --without-doxygen \
4606         --without-java \
4607         $sub_conf_opts \
4608         --srcdir=$srcdir \
4609         2>&1 | sed -e 's/^/    /'
4610     test -f ./config_host.mk 2>/dev/null || exit
4611     cp config_host.mk ../config_build.mk
4612     cp config_host_lang.mk ../config_build_lang.mk
4613     mv config.log ../config.Build.log
4614     mkdir -p ../config_build
4615     mv config_host/*.h ../config_build
4616     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT WORKDIR
4618     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
4619         VV='$'$V
4620         VV=`eval "echo $VV"`
4621         if test -n "$VV"; then
4622             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4623             echo "$line" >>build-config
4624         fi
4625     done
4627     for V in INSTDIR INSTROOT WORKDIR; do
4628         VV='$'$V
4629         VV=`eval "echo $VV"`
4630         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4631         if test -n "$VV"; then
4632             line="${V}_FOR_BUILD='$VV'"
4633             echo "$line" >>build-config
4634         fi
4635     done
4637     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4638     echo "$line" >>build-config
4640     )
4641     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4642     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])
4643     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4644              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4646     eval `cat CONF-FOR-BUILD/build-config`
4648     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4650     rm -rf CONF-FOR-BUILD
4651 else
4652     OS_FOR_BUILD="$OS"
4653     CC_FOR_BUILD="$CC"
4654     CXX_FOR_BUILD="$CXX"
4655     INSTDIR_FOR_BUILD="$INSTDIR"
4656     INSTROOT_FOR_BUILD="$INSTROOT"
4657     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4658     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4659     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4660     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4661     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4662     WORKDIR_FOR_BUILD="$WORKDIR"
4664 AC_SUBST(OS_FOR_BUILD)
4665 AC_SUBST(INSTDIR_FOR_BUILD)
4666 AC_SUBST(INSTROOT_FOR_BUILD)
4667 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4668 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4669 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4670 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4671 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4672 AC_SUBST(WORKDIR_FOR_BUILD)
4674 dnl ===================================================================
4675 dnl Check for syslog header
4676 dnl ===================================================================
4677 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4679 # placeholder for future crash reporter feature
4680 ENABLE_CRASHDUMP=""
4681 AC_SUBST(ENABLE_CRASHDUMP)
4683 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4684 dnl ===================================================================
4685 AC_MSG_CHECKING([whether to turn warnings to errors])
4686 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4687     ENABLE_WERROR="TRUE"
4688     AC_MSG_RESULT([yes])
4689 else
4690     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4691         ENABLE_WERROR="TRUE"
4692         AC_MSG_RESULT([yes])
4693     else
4694         AC_MSG_RESULT([no])
4695     fi
4697 AC_SUBST(ENABLE_WERROR)
4699 dnl Set the ASSERT_ALWAYS_ABORT variable. (Activate --enable-assert-always-abort)
4700 dnl ===================================================================
4701 AC_MSG_CHECKING([whether to have assert to abort in release code])
4702 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4703     ASSERT_ALWAYS_ABORT="TRUE"
4704     AC_MSG_RESULT([yes])
4705 else
4706     ASSERT_ALWAYS_ABORT="FALSE"
4707     AC_MSG_RESULT([no])
4709 AC_SUBST(ASSERT_ALWAYS_ABORT)
4711 # Determine whether to use ooenv for the instdir installation
4712 # ===================================================================
4713 if test $_os != "WINNT" -a $_os != "Darwin"; then
4714     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4715     if test "$enable_ooenv" = "no"; then
4716         AC_MSG_RESULT([no])
4717     else
4718         ENABLE_OOENV="TRUE"
4719         AC_MSG_RESULT([yes])
4720     fi
4722 AC_SUBST(ENABLE_OOENV)
4724 if test "$USING_X11" != TRUE; then
4725     # be sure to do not mess with unneeded stuff
4726     test_randr=no
4727     test_xrender=no
4728     test_cups=no
4729     test_dbus=no
4730     test_gtk=no
4731     build_gstreamer_1_0=no
4732     build_gstreamer_0_10=no
4733     test_tde=no
4734     test_kde4=no
4735     enable_cairo_canvas=no
4738 dnl ===================================================================
4739 dnl check for cups support
4740 dnl ===================================================================
4741 ENABLE_CUPS=""
4743 if test "$enable_cups" = "no"; then
4744     test_cups=no
4747 AC_MSG_CHECKING([whether to enable CUPS support])
4748 if test "$test_cups" = "yes"; then
4749     ENABLE_CUPS="TRUE"
4750     AC_MSG_RESULT([yes])
4752     AC_MSG_CHECKING([whether cups support is present])
4753     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4754     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4755     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4756         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4757     fi
4759 else
4760     AC_MSG_RESULT([no])
4763 AC_SUBST(ENABLE_CUPS)
4765 # fontconfig checks
4766 if test "$test_fontconfig" = "yes"; then
4767     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4768     SYSTEM_FONTCONFIG=TRUE
4769     FilterLibs "${FONTCONFIG_LIBS}"
4770     FONTCONFIG_LIBS="${filteredlibs}"
4772 AC_SUBST(FONTCONFIG_CFLAGS)
4773 AC_SUBST(FONTCONFIG_LIBS)
4774 AC_SUBST([SYSTEM_FONTCONFIG])
4776 dnl whether to find & fetch external tarballs?
4777 dnl ===================================================================
4778 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4779    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4780        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4781    else
4782        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4783    fi
4785 if test -z "$TARFILE_LOCATION"; then
4786     if test -d "$SRC_ROOT/src" ; then
4787         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4788         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4789     fi
4790     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4791 else
4792     AbsolutePath "$TARFILE_LOCATION"
4793     PathFormat "${absolute_path}"
4794     TARFILE_LOCATION="${formatted_path}"
4796 AC_SUBST(TARFILE_LOCATION)
4798 AC_MSG_CHECKING([whether we want to fetch tarballs])
4799 if test "$enable_fetch_external" != "no"; then
4800     if test "$with_all_tarballs" = "yes"; then
4801         AC_MSG_RESULT(["yes, all of them"])
4802         DO_FETCH_TARBALLS="ALL"
4803     else
4804         AC_MSG_RESULT(["yes, if we use them"])
4805         DO_FETCH_TARBALLS="TRUE"
4806     fi
4807 else
4808     AC_MSG_RESULT([no])
4809     DO_FETCH_TARBALLS=
4811 AC_SUBST(DO_FETCH_TARBALLS)
4813 AC_MSG_CHECKING([whether to build help])
4814 HELP_COMMON_ONLY=FALSE
4815 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4816     BUILD_TYPE="$BUILD_TYPE HELP"
4817     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4818     if test "$with_help" = "common" ; then
4819         HELP_COMMON_ONLY=TRUE
4820         AC_MSG_RESULT([common only])
4821     else
4822         SCPDEFS="$SCPDEFS -DWITH_HELP"
4823         AC_MSG_RESULT([yes])
4824     fi
4825 else
4826     AC_MSG_RESULT([no])
4828 AC_SUBST(HELP_COMMON_ONLY)
4830 dnl Test whether to include MySpell dictionaries
4831 dnl ===================================================================
4832 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4833 if test "$with_myspell_dicts" = "yes"; then
4834     AC_MSG_RESULT([yes])
4835     WITH_MYSPELL_DICTS=TRUE
4836     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4837     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4838 else
4839     AC_MSG_RESULT([no])
4840     WITH_MYSPELL_DICTS=
4842 AC_SUBST(WITH_MYSPELL_DICTS)
4844 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4845 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4846     if test "$with_system_dicts" = yes; then
4847         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4848     fi
4849     with_system_dicts=no
4852 AC_MSG_CHECKING([whether to use dicts from external paths])
4853 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4854     AC_MSG_RESULT([yes])
4855     SYSTEM_DICTS=TRUE
4856     AC_MSG_CHECKING([for spelling dictionary directory])
4857     if test -n "$with_external_dict_dir"; then
4858         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4859     else
4860         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4861         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4862             DICT_SYSTEM_DIR=file:///usr/share/myspell
4863         fi
4864     fi
4865     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4866     AC_MSG_CHECKING([for hyphenation patterns directory])
4867     if test -n "$with_external_hyph_dir"; then
4868         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4869     else
4870         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4871     fi
4872     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4873     AC_MSG_CHECKING([for thesaurus directory])
4874     if test -n "$with_external_thes_dir"; then
4875         THES_SYSTEM_DIR=file://$with_external_thes_dir
4876     else
4877         THES_SYSTEM_DIR=file:///usr/share/mythes
4878     fi
4879     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4880 else
4881     AC_MSG_RESULT([no])
4882     SYSTEM_DICTS=
4884 AC_SUBST(SYSTEM_DICTS)
4885 AC_SUBST(DICT_SYSTEM_DIR)
4886 AC_SUBST(HYPH_SYSTEM_DIR)
4887 AC_SUBST(THES_SYSTEM_DIR)
4889 dnl ===================================================================
4890 dnl enable pch by default on windows
4891 dnl enable it explicitly otherwise
4892 AC_MSG_CHECKING([whether to enable pch feature])
4893 ENABLE_PCH=""
4894 if test "$enable_pch" != "no"; then
4895     if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
4896         ENABLE_PCH="TRUE"
4897         AC_MSG_RESULT([yes])
4898     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4899         ENABLE_PCH="TRUE"
4900         AC_MSG_RESULT([yes])
4901     elif test -n "$enable_pch"; then
4902         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4903     else
4904         AC_MSG_RESULT([no])
4905     fi
4906 else
4907     AC_MSG_RESULT([no])
4909 AC_SUBST(ENABLE_PCH)
4911 TAB=`printf '\t'`
4913 AC_MSG_CHECKING([the GNU Make version])
4914 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4915 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4916 if test "$_make_longver" -ge "038200"; then
4917     AC_MSG_RESULT([$GNUMAKE $_make_version])
4919 elif test "$_make_longver" -ge "038100"; then
4920     if test "$build_os" = "cygwin"; then
4921         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4922     fi
4923     AC_MSG_RESULT([$GNUMAKE $_make_version])
4925     dnl ===================================================================
4926     dnl Search all the common names for sha1sum
4927     dnl ===================================================================
4928     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4929     if test -z "$SHA1SUM"; then
4930         AC_MSG_ERROR([install the approproate SHA-1 checksumming program for this OS])
4931     elif test "$SHA1SUM" = "openssl"; then
4932         SHA1SUM="openssl sha1"
4933     fi
4934     AC_MSG_CHECKING([for GNU Make bug 20033])
4935     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4936     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4937 A := \$(wildcard *.a)
4939 .PHONY: all
4940 all: \$(A:.a=.b)
4941 <TAB>@echo survived bug20033.
4943 .PHONY: setup
4944 setup:
4945 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4947 define d1
4948 @echo lala \$(1)
4949 @sleep 1
4950 endef
4952 define d2
4953 @echo tyty \$(1)
4954 @sleep 1
4955 endef
4957 %.b : %.a
4958 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4959 <TAB>\$(call d1,\$(CHECKSUM)),\
4960 <TAB>\$(call d2,\$(CHECKSUM)))
4962     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4963         no_parallelism_make="YES"
4964         AC_MSG_RESULT([yes, disable parallelism])
4965     else
4966         AC_MSG_RESULT([no, keep parallelism enabled])
4967     fi
4968     rm -rf $TESTGMAKEBUG20033
4969 else
4970     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4973 # find if gnumake support file function
4974 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4975 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4976 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4977     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4979 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4980 \$(file >test.txt,Success )
4982 .PHONY: all
4983 all:
4984 <TAB>@cat test.txt
4987 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4988 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4989     HAVE_GNUMAKE_FILE_FUNC=TRUE
4990     AC_MSG_RESULT([yes])
4991 else
4992     AC_MSG_RESULT([no])
4994 rm -rf $TESTGMAKEFILEFUNC
4995 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4996 AC_SUBST(GNUMAKE_WIN_NATIVE)
4998 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4999 STALE_MAKE=
5000 if test "$_make_ver_check" = ""; then
5001    STALE_MAKE=TRUE
5004 HAVE_LD_HASH_STYLE=FALSE
5005 WITH_LINKER_HASH_STYLE=
5006 AC_MSG_CHECKING( for --hash-style gcc linker support )
5007 if test "$GCC" = "yes"; then
5008     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5009         hash_styles="gnu sysv"
5010     elif test "$with_linker_hash_style" = "no"; then
5011         hash_styles=
5012     else
5013         hash_styles="$with_linker_hash_style"
5014     fi
5016     for hash_style in $hash_styles; do
5017         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5018         hash_style_ldflags_save=$LDFLAGS
5019         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5021         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5022             [
5023 #include <stdio.h>
5024             ],[
5025 printf ("");
5026             ])],
5027             [
5028                   HAVE_LD_HASH_STYLE=TRUE
5029                   WITH_LINKER_HASH_STYLE=$hash_style
5030             ],
5031             [HAVE_LD_HASH_STYLE=FALSE],
5032             [HAVE_LD_HASH_STYLE=FALSE])
5033         LDFLAGS=$hash_style_ldflags_save
5034     done
5036     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5037         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5038     else
5039         AC_MSG_RESULT( no )
5040     fi
5041     LDFLAGS=$hash_style_ldflags_save
5042 else
5043     AC_MSG_RESULT( no )
5045 AC_SUBST(HAVE_LD_HASH_STYLE)
5046 AC_SUBST(WITH_LINKER_HASH_STYLE)
5048 dnl ===================================================================
5049 dnl Check whether there's a Perl version available.
5050 dnl ===================================================================
5051 if test -z "$with_perl_home"; then
5052     AC_PATH_PROG(PERL, perl)
5053 else
5054     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5055     _perl_path="$with_perl_home/bin/perl"
5056     if test -x "$_perl_path"; then
5057         PERL=$_perl_path
5058     else
5059         AC_MSG_ERROR([$_perl_path not found])
5060     fi
5063 dnl ===================================================================
5064 dnl Testing for Perl version 5 or greater.
5065 dnl $] is the Perl version variable, it is returned as an integer
5066 dnl ===================================================================
5067 if test "$PERL"; then
5068     AC_MSG_CHECKING([the Perl version])
5069     ${PERL} -e "exit($]);"
5070     _perl_version=$?
5071     if test "$_perl_version" -lt 5; then
5072         AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
5073     fi
5074     AC_MSG_RESULT([checked (perl $_perl_version)])
5075 else
5076     AC_MSG_ERROR([Perl not found, install version 5 of Perl])
5079 dnl ===================================================================
5080 dnl Testing for required Perl modules
5081 dnl ===================================================================
5083 AC_MSG_CHECKING([for required Perl modules])
5084 if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
5085     AC_MSG_RESULT([all modules found])
5086 else
5087     AC_MSG_RESULT([failed to find some modules])
5088     # Find out which modules are missing.
5089     if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
5090         missing_perl_modules="$missing_perl_modules Cwd"
5091     fi
5092     if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
5093         missing_perl_modules="$missing_perl_modules Digest::MD5"
5094     fi
5095        AC_MSG_ERROR([
5096     The missing Perl modules are: $missing_perl_modules
5097     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5100 dnl ===================================================================
5101 dnl Check for pkg-config
5102 dnl ===================================================================
5103 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5104     PKG_PROG_PKG_CONFIG
5107 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5109     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5110     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5111     # explicitly. Or put /path/to/compiler in PATH yourself.
5113     # Use wrappers for LTO
5114     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5115         AC_CHECK_TOOL(AR,gcc-ar)
5116         AC_CHECK_TOOL(NM,gcc-nm)
5117         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5118     else
5119         AC_CHECK_TOOL(AR,ar)
5120         AC_CHECK_TOOL(NM,nm)
5121         AC_CHECK_TOOL(RANLIB,ranlib)
5122     fi
5123     AC_CHECK_TOOL(OBJDUMP,objdump)
5124     AC_CHECK_TOOL(READELF,readelf)
5125     AC_CHECK_TOOL(STRIP,strip)
5126     if test "$_os" = "WINNT"; then
5127         AC_CHECK_TOOL(DLLTOOL,dlltool)
5128         AC_CHECK_TOOL(WINDRES,windres)
5129     fi
5131 AC_SUBST(AR)
5132 AC_SUBST(DLLTOOL)
5133 AC_SUBST(NM)
5134 AC_SUBST(OBJDUMP)
5135 AC_SUBST(PKG_CONFIG)
5136 AC_SUBST(RANLIB)
5137 AC_SUBST(READELF)
5138 AC_SUBST(STRIP)
5139 AC_SUBST(WINDRES)
5141 dnl ===================================================================
5142 dnl pkg-config checks on Mac OS X
5143 dnl ===================================================================
5145 if test $_os = Darwin; then
5146     AC_MSG_CHECKING([for bogus pkg-config])
5147     if test -n "$PKG_CONFIG"; then
5148         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5149             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5150         else
5151             if test "$enable_bogus_pkg_config" = "yes"; then
5152                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5153             else
5154                 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.])
5155             fi
5156         fi
5157     else
5158         AC_MSG_RESULT([no, good])
5159     fi
5162 find_csc()
5164     # Return value: $csctest
5166     unset csctest
5168     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5169     if test -n "$regvalue"; then
5170         csctest=$regvalue
5171         return
5172     fi
5175 find_al()
5177     # Return value: $altest
5179     unset altest
5181     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5182         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5183         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5184             altest=$regvalue
5185             return
5186         fi
5187     done
5190 find_dotnetsdk()
5192     # Return value: $frametest (that's a silly name...)
5194     unset frametest
5196     for ver in 1.1 2.0; do
5197         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5198         if test -n "$regvalue"; then
5199             frametest=$regvalue
5200             return
5201         fi
5202     done
5205 find_dotnetsdk46()
5207     unset frametest
5209     for ver in 4.6.1 4.6; do
5210         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5211         if test -n "$regvalue"; then
5212             frametest=$regvalue
5213             return
5214         fi
5215         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5216         if test -n "$regvalue"; then
5217             frametest=$regvalue
5218             return
5219         fi
5220     done
5223 find_winsdk_version()
5225     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5226     # Return values: $winsdktest, $winsdklibsubdir
5228     unset winsdktest winsdklibsubdir
5230     # Why we look for them in this particular order I don't know. But OTOH I
5231     case "$1" in
5232     7.*)
5233         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5234         if test -n "$regvalue"; then
5235             winsdktest=$regvalue
5236             winsdklibsubdir=.
5237             return
5238         fi
5239         ;;
5240     8.1|8.1A)
5241         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5242         if test -n "$regvalue"; then
5243             winsdktest=$regvalue
5244             winsdklibsubdir=winv6.3
5245             return
5246         fi
5247         ;;
5248     8.0|8.0A)
5249         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5250         if test -n "$regvalue"; then
5251             winsdktest=$regvalue
5252             winsdklibsubdir=win8
5253             return
5254         fi
5255         ;;
5256     10.0)
5257         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5258         if test -n "$regvalue"; then
5259             winsdktest=$regvalue
5260             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5261             winsdklibsubdir=$regvalue
5262             return
5263         fi
5264         ;;
5265     esac
5268 find_winsdk()
5270     # Args: $1 (optional) : list of acceptable SDK versions
5271     # Return value: $winsdktest
5273     unset winsdktest
5275     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5276         find_winsdk_version $ver
5277         if test -n "$winsdktest"; then
5278             return
5279         fi
5280     done
5283 find_msms()
5285     my_msm_file=Microsoft_VC${VCVER}_CRT_x86.msm
5286     AC_MSG_CHECKING([for $my_msm_file])
5287     msmdir=
5288     for ver in 12.0 14.0; do
5289         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5290         if test -n "$regvalue"; then
5291             if test -e "$regvalue/$my_msm_file"; then
5292                 msmdir=$regvalue
5293                 break
5294             fi
5295         fi
5296     done
5297     dnl Is the following fallback really necessary, or was it added in response
5298     dnl to never having started Visual Studio on a given machine, so the
5299     dnl registry keys checked above had presumably not yet been created?
5300     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5301     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5302     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5303     dnl expanding to "C:\Program Files\Common Files"), which would need
5304     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5305     dnl obtain its value from cygwin:
5306     if test -z "$msmdir"; then
5307         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5308         if test -e "$my_msm_dir/$my_msm_file"; then
5309             msmdir=$my_msm_dir
5310         fi
5311     fi
5312     if test -n "$msmdir"; then
5313         msmdir=`cygpath -m "$msmdir"`
5314         AC_MSG_RESULT([$msmdir])
5315     else
5316         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5317             AC_MSG_ERROR([not found])
5318         else
5319             AC_MSG_WARN([not found])
5320         fi
5321     fi
5324 find_msvc_x64_dlls()
5326     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5327     # http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
5328     # Refactored C Runtime (CRT): This CTP contains the first preview of the substantially refactored CRT.
5329     # msvcr140.dll no longer exists. It is replaced by a trio of DLLs: vcruntime140.dll, appcrt140.dll,
5330     # and desktopcrt140.dll.
5331     if test "$VCVER" = 140; then
5332        msvcdlls="msvcp${VCVER}.dll vcruntime${VCVER}.dll"
5333     else
5334        msvcdlls="msvcp${VCVER}.dll msvcr${VCVER}.dll"
5335     fi
5336     for dll in $msvcdlls; do
5337         if ! test -f "$msvcdllpath/$dll"; then
5338             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5339         fi
5340     done
5343 if test "$build_os" = "cygwin"; then
5344     dnl Check midl.exe
5345     AC_MSG_CHECKING([for midl.exe])
5347     find_winsdk
5348     if test -f "$winsdktest/Bin/midl.exe"; then
5349         MIDL_PATH="$winsdktest/Bin"
5350     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5351         MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5352     fi
5353     if test ! -f "$MIDL_PATH/midl.exe"; then
5354         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5355     else
5356         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5357     fi
5359     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5360     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5362     dnl Check csc.exe
5363     AC_MSG_CHECKING([for csc.exe])
5364     find_csc
5365     if test -f "$csctest/csc.exe"; then
5366         CSC_PATH="$csctest"
5367     fi
5368     if test ! -f "$CSC_PATH/csc.exe"; then
5369         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5370     else
5371         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5372     fi
5374     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5376     dnl Check al.exe
5377     AC_MSG_CHECKING([for al.exe])
5378     find_winsdk
5379     if test -f "$winsdktest/Bin/al.exe"; then
5380         AL_PATH="$winsdktest/Bin"
5381     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5382         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5383     fi
5385     if test -z "$AL_PATH"; then
5386         find_al
5387         if test -f "$altest/bin/al.exe"; then
5388             AL_PATH="$altest/bin"
5389         elif test -f "$altest/al.exe"; then
5390             AL_PATH="$altest"
5391         fi
5392     fi
5393     if test ! -f "$AL_PATH/al.exe"; then
5394         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5395     else
5396         AC_MSG_RESULT([$AL_PATH/al.exe])
5397     fi
5399     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5401     dnl Check mscoree.lib / .NET Framework dir
5402     AC_MSG_CHECKING(.NET Framework find_dotnetsdk)
5403     find_dotnetsdk
5404     if test -f "$frametest/lib/mscoree.lib"; then
5405         DOTNET_FRAMEWORK_HOME="$frametest"
5406     else
5407         AC_MSG_CHECKING(.NET Framework find_winsdk)
5408         find_winsdk
5409         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5410             DOTNET_FRAMEWORK_HOME="$winsdktest"
5411         else
5412             AC_MSG_CHECKING(.NET Framework find_dotnetsdk46)
5413             find_dotnetsdk46
5414             PathFormat "$frametest"
5415             frametest="$formatted_path"
5416             AC_MSG_CHECKING(found: $frametest/um/$WINDOWS_SDK_ARCH/mscoree.lib)
5417             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5418                  DOTNET_FRAMEWORK_HOME="$frametest"
5419             fi
5420         fi
5421     fi
5423     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
5424         AC_MSG_ERROR([mscoree.lib not found])
5425     fi
5426     AC_MSG_RESULT(found)
5428     PathFormat "$MIDL_PATH"
5429     MIDL_PATH="$formatted_path"
5431     PathFormat "$AL_PATH"
5432     AL_PATH="$formatted_path"
5434     PathFormat "$DOTNET_FRAMEWORK_HOME"
5435     DOTNET_FRAMEWORK_HOME="$formatted_path"
5437     PathFormat "$CSC_PATH"
5438     CSC_PATH="$formatted_path"
5441 dnl ===================================================================
5442 dnl Check if stdc headers are available excluding MSVC.
5443 dnl ===================================================================
5444 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5445     AC_HEADER_STDC
5448 dnl ===================================================================
5449 dnl Testing for C++ compiler and version...
5450 dnl ===================================================================
5452 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5453     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5454     save_CXXFLAGS=$CXXFLAGS
5455     AC_PROG_CXX
5456     CXXFLAGS=$save_CXXFLAGS
5457 else
5458     if test -n "$CC" -a -z "$CXX"; then
5459         CXX="$CC"
5460     fi
5463 dnl check for GNU C++ compiler version
5464 if test "$GXX" = "yes" -a "$CXX" != "emcc"; then
5465     AC_MSG_CHECKING([the GNU C++ compiler version])
5467     _gpp_version=`$CXX -dumpversion`
5468     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5470     if test "$_gpp_majmin" -lt "401"; then
5471         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5472     else
5473         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5474     fi
5476     dnl see https://code.google.com/p/android/issues/detail?id=41770
5477     if test "$_gpp_majmin" -ge "401"; then
5478         glibcxx_threads=no
5479         AC_LANG_PUSH([C++])
5480         AC_REQUIRE_CPP
5481         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5482         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5483             #include <bits/c++config.h>]],[[
5484             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5485             && !defined(_GLIBCXX__PTHREADS) \
5486             && !defined(_GLIBCXX_HAS_GTHREADS)
5487             choke me
5488             #endif
5489         ]])],[AC_MSG_RESULT([yes])
5490         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5491         AC_LANG_POP([C++])
5492         if test $glibcxx_threads = yes; then
5493             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5494         fi
5495      fi
5497 AC_SUBST(BOOST_CXXFLAGS)
5500 # prefx CXX with ccache if needed
5502 if test "$CCACHE" != ""; then
5503     AC_MSG_CHECKING([whether $CXX is already ccached])
5504     AC_LANG_PUSH([C++])
5505     save_CXXFLAGS=$CXXFLAGS
5506     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5507     dnl an empty program will do, we're checking the compiler flags
5508     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5509                       [use_ccache=yes], [use_ccache=no])
5510     if test $use_ccache = yes; then
5511         AC_MSG_RESULT([yes])
5512     else
5513         CXX="$CCACHE $CXX"
5514         AC_MSG_RESULT([no])
5515     fi
5516     CXXFLAGS=$save_CXXFLAGS
5517     AC_LANG_POP([C++])
5520 dnl ===================================================================
5521 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5522 dnl ===================================================================
5524 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5525     AC_PROG_CXXCPP
5527     dnl Check whether there's a C pre-processor.
5528     AC_PROG_CPP
5532 dnl ===================================================================
5533 dnl Find integral type sizes and alignments
5534 dnl ===================================================================
5536 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
5538     AC_CHECK_SIZEOF(long)
5539     AC_CHECK_SIZEOF(short)
5540     AC_CHECK_SIZEOF(int)
5541     AC_CHECK_SIZEOF(long long)
5542     AC_CHECK_SIZEOF(double)
5543     AC_CHECK_SIZEOF(void*)
5545     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5546     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5547     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5548     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5549     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5551     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5552     m4_pattern_allow([AC_CHECK_ALIGNOF])
5553     m4_ifdef([AC_CHECK_ALIGNOF],
5554         [
5555             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5556             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5557             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5558             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5559         ],
5560         [
5561             case "$_os-$host_cpu" in
5562             Linux-i686)
5563                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5564                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5565                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5566                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5567                 ;;
5568             Linux-x86_64)
5569                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5570                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5571                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5572                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5573                 ;;
5574             *)
5575                 if test -z "$ac_cv_alignof_short" -o \
5576                         -z "$ac_cv_alignof_int" -o \
5577                         -z "$ac_cv_alignof_long" -o \
5578                         -z "$ac_cv_alignof_double"; then
5579                    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.])
5580                 fi
5581                 ;;
5582             esac
5583         ])
5585     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5586     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5587     if test $ac_cv_sizeof_long -eq 8; then
5588         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5589     elif test $ac_cv_sizeof_double -eq 8; then
5590         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5591     else
5592         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5593     fi
5595     dnl Check for large file support
5596     AC_SYS_LARGEFILE
5597     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5598         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5599     fi
5600     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5601         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5602     fi
5603 else
5604     # Hardcode for MSVC
5605     SAL_TYPES_SIZEOFSHORT=2
5606     SAL_TYPES_SIZEOFINT=4
5607     SAL_TYPES_SIZEOFLONG=4
5608     SAL_TYPES_SIZEOFLONGLONG=8
5609     if test "$BITNESS_OVERRIDE" = ""; then
5610         SAL_TYPES_SIZEOFPOINTER=4
5611     else
5612         SAL_TYPES_SIZEOFPOINTER=8
5613     fi
5614     SAL_TYPES_ALIGNMENT2=2
5615     SAL_TYPES_ALIGNMENT4=4
5616     SAL_TYPES_ALIGNMENT8=8
5617     LFS_CFLAGS=''
5619 AC_SUBST(LFS_CFLAGS)
5621 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5622 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5623 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5624 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5625 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5626 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5627 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5628 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5630 dnl ===================================================================
5631 dnl Check whether to enable runtime optimizations
5632 dnl ===================================================================
5633 ENABLE_RUNTIME_OPTIMIZATIONS=
5634 AC_MSG_CHECKING([whether to enable runtime optimizations])
5635 if test -z "$enable_runtime_optimizations"; then
5636     for i in $CC; do
5637         case $i in
5638         -fsanitize=*)
5639             enable_runtime_optimizations=no
5640             break
5641             ;;
5642         esac
5643     done
5645 if test "$enable_runtime_optimizations" != no; then
5646     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5647     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5648     AC_MSG_RESULT([yes])
5649 else
5650     AC_MSG_RESULT([no])
5652 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5654 dnl ===================================================================
5655 dnl Check if valgrind headers are available
5656 dnl ===================================================================
5657 ENABLE_VALGRIND=
5658 if test "$cross_compiling" != yes; then
5659     prev_cppflags=$CPPFLAGS
5660     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5661     # or where does it come from?
5662     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5663     AC_CHECK_HEADER([valgrind/valgrind.h],
5664         [ENABLE_VALGRIND=TRUE])
5665     CPPFLAGS=$prev_cppflags
5667 AC_SUBST([ENABLE_VALGRIND])
5668 if test -z "$ENABLE_VALGRIND"; then
5669     VALGRIND_CFLAGS=
5671 AC_SUBST([VALGRIND_CFLAGS])
5674 dnl ===================================================================
5675 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5676 dnl ===================================================================
5678 # We need at least the sys/sdt.h include header.
5679 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5680 if test "$SDT_H_FOUND" = "TRUE"; then
5681     # Found sys/sdt.h header, now make sure the c++ compiler works.
5682     # Old g++ versions had problems with probes in constructors/destructors.
5683     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5684     AC_LANG_PUSH([C++])
5685     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5686     #include <sys/sdt.h>
5687     class ProbeClass
5688     {
5689     private:
5690       int& ref;
5691       const char *name;
5693     public:
5694       ProbeClass(int& v, const char *n) : ref(v), name(n)
5695       {
5696         DTRACE_PROBE2(_test_, cons, name, ref);
5697       }
5699       void method(int min)
5700       {
5701         DTRACE_PROBE3(_test_, meth, name, ref, min);
5702         ref -= min;
5703       }
5705       ~ProbeClass()
5706       {
5707         DTRACE_PROBE2(_test_, dest, name, ref);
5708       }
5709     };
5710     ]],[[
5711     int i = 64;
5712     DTRACE_PROBE1(_test_, call, i);
5713     ProbeClass inst = ProbeClass(i, "call");
5714     inst.method(24);
5715     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5716           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5717     AC_LANG_POP([C++])
5719 AC_CONFIG_HEADERS([config_host/config_probes.h])
5721 dnl ===================================================================
5722 dnl Set the MinGW sys-root
5723 dnl ===================================================================
5724 if test "$WITH_MINGW" = "yes"; then
5725     AC_MSG_CHECKING([for MinGW sysroot])
5726     sysroot=`$CC -print-sysroot`
5727     AS_IF([test -d "$sysroot"/mingw],
5728           [MINGW_SYSROOT="$sysroot"/mingw
5729            AC_MSG_RESULT([$MINGW_SYSROOT])],
5730           [AC_MSG_RESULT([not found])
5731            AC_MSG_ERROR([cannot determine MinGW sysroot])])
5733 AC_SUBST([MINGW_DLLS])
5734 AC_SUBST([MINGW_SYSROOT])
5736 dnl ===================================================================
5737 dnl Set the MinGW include directories
5738 dnl ===================================================================
5739 if test "$WITH_MINGW" = "yes"; then
5740     AC_MSG_CHECKING([for MinGW include path])
5741     cat >conftest.$ac_ext <<_ACEOF
5742 #include <stddef.h>
5743 #include <bits/c++config.h>
5744 _ACEOF
5745     _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`
5746     rm conftest.$ac_ext
5747     if test -z "$_mingw_lib_include_path"; then
5748         _mingw_lib_include_path="NO_LIB_INCLUDE"
5749         AC_MSG_RESULT([no MinGW include path])
5750     else
5751         AC_MSG_RESULT([$_mingw_lib_include_path])
5752     fi
5753     MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
5754     AC_SUBST(MINGW_LIB_INCLUDE_PATH)
5756     AC_LANG_PUSH([C++])
5758     AC_MSG_CHECKING([for dynamic libgcc])
5759     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5760 #include <iostream>
5761 using namespace std;
5762 ]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
5763             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's@.*DLL Name: @@'`
5764             if test -n "$MINGW_GCCDLL"; then
5765                 MINGW_SHARED_GCCLIB=TRUE
5766                 AC_MSG_RESULT([ $MINGW_GCCDLL])
5767             else
5768                 MINGW_SHARED_GCCLIB=
5769                 AC_MSG_RESULT([no])
5770             fi
5771        ],[ AC_MSG_RESULT([no])
5773     ])
5775     AC_MSG_CHECKING([for dynamic libstdc++])
5776     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5777 #include <iostream>
5778 using namespace std;
5779 ]], [[ cout << "Hello there." << endl; ]])],[
5780             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's@.*DLL Name: @@'`
5781             if test -n "$MINGW_GXXDLL"; then
5782                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
5783                 mingw_gxxdll_root=${mingw_gxxdll_root#lib}
5784                 if test "$CROSS_COMPILING" = "TRUE"; then
5785                     dnl m4 escaping!
5786                     mingw_gxxdll_root=${mingw_gxxdll_root%-[[0-9]]}
5787                 fi
5788                 MINGW_SHARED_LIBSTDCPP=-l$mingw_gxxdll_root
5789                 MINGW_SHARED_GXXLIB=TRUE
5790                 AC_MSG_RESULT([$MINGW_GXXDLL])
5791             else
5792                 MINGW_SHARED_GXXLIB=
5793                 AC_MSG_RESULT([no])
5794             fi
5795        ],[ AC_MSG_RESULT([no])
5797     ])
5799     AC_LANG_POP([C++])
5801     AC_SUBST(MINGW_SHARED_GCCLIB)
5802     AC_SUBST(MINGW_SHARED_GXXLIB)
5803     AC_SUBST(MINGW_SHARED_LIBSTDCPP)
5804     AC_SUBST(MINGW_GCCDLL)
5805     AC_SUBST(MINGW_GXXDLL)
5808 dnl *************************************************************
5809 dnl Testing for exception handling - dwarf2 or sjlj exceptions...
5810 dnl *************************************************************
5811 if test "$WITH_MINGW" = "yes"; then
5812     AC_MSG_CHECKING([exception type])
5813     AC_LANG_PUSH([C++])
5814     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
5816         extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
5818         ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
5819     ])
5820     AC_MSG_RESULT($exceptions_type)
5821     AC_LANG_POP([C++])
5824 EXCEPTIONS="$exceptions_type"
5825 AC_SUBST(EXCEPTIONS)
5827 dnl ===================================================================
5828 dnl thread-safe statics
5829 dnl ===================================================================
5830 AC_MSG_CHECKING([whether $CXX supports thread safe statics])
5831 unset HAVE_THREADSAFE_STATICS
5832 if test "$GCC" = "yes"; then
5833     dnl -fthreadsafe-statics is available since GCC 4, so always available for
5834     dnl us.  However, some C++ runtimes use a single lock for all static
5835     dnl variables, which can cause deadlock in multi-threaded applications.
5836     dnl This is not easily tested here; for POSIX-based systems, if executing
5837     dnl the following C++ program does not terminate then the tool chain
5838     dnl apparently has this problem:
5839     dnl
5840     dnl   #include <pthread.h>
5841     dnl   int h() { return 0; }
5842     dnl   void * g(void * unused) {
5843     dnl     static int n = h();
5844     dnl     return &n;
5845     dnl   }
5846     dnl   int f() {
5847     dnl     pthread_t t;
5848     dnl     pthread_create(&t, 0, g, 0);
5849     dnl     pthread_join(t, 0);
5850     dnl     return 0;
5851     dnl   }
5852     dnl   int main() {
5853     dnl     static int n = f();
5854     dnl     return n;
5855     dnl   }
5856     dnl
5857     dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
5858     dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
5859     dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
5860     dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
5861     dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
5862     dnl difference there.  Conservative advice from Jakub Jelinek is to assume
5863     dnl it working in GCC >= 4.3, so conservative way to check here is to use
5864     dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
5865     dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
5866     dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
5867     dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
5868     dnl "too old"):
5869     if test "$_os" = Darwin; then
5870         dnl On Mac OS X, both /usr/lib/libstdc++.6.dylib and
5871         dnl /usr/lib/libc++1.dylib delegate to /usr/lib/libc++abi.dylib for the
5872         dnl __cxa_guard_* functionality; up to 10.8, libc++abi.dylib is
5873         dnl apparently provided by a libcppabi project that has broken semantics
5874         dnl (cf. <http://www.opensource.apple.com/source/libcppabi/libcppabi-26/
5875         dnl src/cxa_guard.cxx>), while in 10.9 (verified at least on 10.9.4) it
5876         dnl is apparently provided by LLVM's libcxxabi project, which has good
5877         dnl semantics (cf. <http://llvm.org/svn/llvm-project/libcxxabi/trunk/
5878         dnl src/cxa_guard.cpp>):
5879         if test "$MAC_OS_X_VERSION_MIN_REQUIRED" -ge 1090; then
5880             HAVE_THREADSAFE_STATICS=TRUE
5881         fi
5882     elif test "$_os" != Android; then
5883         if test "$COM_IS_CLANG" = TRUE; then
5884             AC_LANG_PUSH([C++])
5885             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5886 #include <list>
5887 #if defined __GLIBCXX__
5888 #if __GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306
5889 #error
5890 #endif
5891 #endif
5892                 ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
5893             AC_LANG_POP([C++])
5894         else # known to work in GCC since version 4.3
5895             HAVE_THREADSAFE_STATICS=TRUE
5896         fi
5897     fi
5898     if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
5899         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5900         AC_MSG_RESULT([yes])
5901     else
5902         AC_MSG_RESULT([broken (i.e., no)])
5903     fi
5904 else
5905     # MSVC has sprouted C++11 thread-safe statics in 2015
5906     # http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
5907     if test "$COM" = "MSC" -a "$VCVER" -ge "140"; then
5908         AC_DEFINE(HAVE_THREADSAFE_STATICS)
5909         AC_MSG_RESULT([yes])
5910     else
5911         AC_MSG_RESULT([no])
5912     fi
5914 AC_SUBST(HAVE_THREADSAFE_STATICS)
5916 dnl ===================================================================
5917 dnl visibility and other gcc features
5918 dnl ===================================================================
5919 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5920     if test "$COM" != MSC; then
5921         AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
5922         save_CFLAGS=$CFLAGS
5923         CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
5924         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
5925         CFLAGS=$save_CFLAGS
5926         if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
5927             AC_MSG_RESULT([yes])
5928         else
5929             AC_MSG_ERROR([no  This is no longer supported.])
5930         fi
5931     fi
5933     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5934     save_CFLAGS=$CFLAGS
5935     CFLAGS="$CFLAGS -Werror -mno-avx"
5936     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5937     CFLAGS=$save_CFLAGS
5938     if test "$HAVE_GCC_AVX" = "TRUE"; then
5939         AC_MSG_RESULT([yes])
5940     else
5941         AC_MSG_RESULT([no])
5942     fi
5944     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5945     save_CFLAGS=$CFLAGS
5946     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5947     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5948     CFLAGS=$save_CFLAGS
5949     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5950         AC_MSG_RESULT([yes])
5951     else
5952         AC_MSG_RESULT([no])
5953     fi
5955     AC_MSG_CHECKING([whether $CC supports atomic functions])
5956     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5957     int v = 0;
5958     if (__sync_add_and_fetch(&v, 1) != 1 ||
5959         __sync_sub_and_fetch(&v, 1) != 0)
5960         return 1;
5961     __sync_synchronize();
5962     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5963         v != 1)
5964         return 1;
5965     return 0;
5966 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5967     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5968         AC_MSG_RESULT([yes])
5969         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5970     else
5971         AC_MSG_RESULT([no])
5972     fi
5974     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5975     save_CFLAGS=$CFLAGS
5976     CFLAGS="$CFLAGS -Werror"
5977     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5978             __attribute__((deprecated("test"))) void f();
5979         ])], [
5980             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5981             AC_MSG_RESULT([yes])
5982         ], [AC_MSG_RESULT([no])])
5983     CFLAGS=$save_CFLAGS
5985     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5986     AC_LANG_PUSH([C++])
5987     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5988             #include <cstddef>
5989             #include <cxxabi.h>
5990             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5991         ])], [
5992             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5993             AC_MSG_RESULT([yes])
5994         ], [AC_MSG_RESULT([no])])
5995     AC_LANG_POP([C++])
5997     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5998     AC_LANG_PUSH([C++])
5999     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6000             #include <cstddef>
6001             #include <cxxabi.h>
6002             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6003         ])], [
6004             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6005             AC_MSG_RESULT([yes])
6006         ], [AC_MSG_RESULT([no])])
6007     AC_LANG_POP([C++])
6009     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
6010     AC_LANG_PUSH([C++])
6011     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6012             #include <cxxabi.h>
6013             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6014         ])], [
6015             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6016             AC_MSG_RESULT([yes])
6017         ], [AC_MSG_RESULT([no])])
6018     AC_LANG_POP([C++])
6020     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6021     AC_LANG_PUSH([C++])
6022     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6023             #include <cstddef>
6024             #include <cxxabi.h>
6025             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6026         ])], [
6027             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6028             AC_MSG_RESULT([yes])
6029         ], [AC_MSG_RESULT([no])])
6030     AC_LANG_POP([C++])
6032     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6033     AC_LANG_PUSH([C++])
6034     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6035             #include <cstddef>
6036             #include <cxxabi.h>
6037             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6038         ])], [
6039             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6040             AC_MSG_RESULT([yes])
6041         ], [AC_MSG_RESULT([no])])
6042     AC_LANG_POP([C++])
6044     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6045     AC_LANG_PUSH([C++])
6046     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6047             #include <cxxabi.h>
6048             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6049         ])], [
6050             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6051             AC_MSG_RESULT([yes])
6052         ], [AC_MSG_RESULT([no])])
6053     AC_LANG_POP([C++])
6055     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6056     AC_LANG_PUSH([C++])
6057     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6058             #include <cxxabi.h>
6059             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6060         ])], [
6061             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6062             AC_MSG_RESULT([yes])
6063         ], [AC_MSG_RESULT([no])])
6064     AC_LANG_POP([C++])
6066     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6067     AC_LANG_PUSH([C++])
6068     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6069             #include <cstddef>
6070             #include <cxxabi.h>
6071             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6072         ])], [
6073             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6074             AC_MSG_RESULT([yes])
6075         ], [AC_MSG_RESULT([no])])
6076     AC_LANG_POP([C++])
6078     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6079     AC_LANG_PUSH([C++])
6080     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6081             #include <cstddef>
6082             #include <cxxabi.h>
6083             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6084         ])], [
6085             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6086             AC_MSG_RESULT([yes])
6087         ], [AC_MSG_RESULT([no])])
6088     AC_LANG_POP([C++])
6090     AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
6091     AC_LANG_PUSH([C++])
6092     save_CXXFLAGS=$CXXFLAGS
6093     CXXFLAGS="$CXXFLAGS -Werror -Wunused"
6094     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6095             #include <string>
6096             void f() { std::string s; }
6097         ])], [
6098             AC_MSG_RESULT([no])
6099         ], [
6100             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
6101             AC_MSG_RESULT([yes])])
6102     CXXFLAGS=$save_CXXFLAGS
6103     AC_LANG_POP([C++])
6106 AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6107 AC_LANG_PUSH([C++])
6108 save_CXXFLAGS=$CXXFLAGS
6109 CXXFLAGS="$CXXFLAGS -Werror -Wunknown-pragmas"
6110 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6111         struct __attribute__((warn_unused)) dummy {};
6112     ])], [
6113         AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6114         AC_MSG_RESULT([yes])
6115     ], [AC_MSG_RESULT([no])])
6116 CXXFLAGS=$save_CXXFLAGS
6117 AC_LANG_POP([C++])
6119 AC_SUBST(HAVE_GCC_AVX)
6120 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6121 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6123 dnl ===================================================================
6124 dnl Identify the C++ library
6125 dnl ===================================================================
6127 AC_MSG_CHECKING([What the C++ library is])
6128 AC_LANG_PUSH([C++])
6129 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6130 #include <utility>
6131 #ifndef __GLIBCXX__
6132 foo bar
6133 #endif
6134 ]])],
6135     [CPP_LIBRARY=GLIBCXX
6136      cpp_library_name="GNU libstdc++"
6137     ],
6138     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6139 #include <utility>
6140 #ifndef _LIBCPP_VERSION
6141 foo bar
6142 #endif
6143 ]])],
6144     [CPP_LIBRARY=LIBCPP
6145      cpp_library_name="LLVM libc++"
6146     ],
6147     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6148 #include <utility>
6149 #ifndef _MSC_VER
6150 foo bar
6151 #endif
6152 ]])],
6153     [CPP_LIBRARY=MSVCRT
6154      cpp_library_name="Microsoft"
6155     ],
6156     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6157 AC_MSG_RESULT([$cpp_library_name])
6158 AC_LANG_POP([C++])
6160 dnl ===================================================================
6161 dnl C++11
6162 dnl ===================================================================
6164 CXXFLAGS_CXX11=
6165 if test "$COM" = MSC; then
6166     AC_MSG_CHECKING([whether $CXX supports C++11])
6167     AC_MSG_RESULT(yes)
6168     # MSVC supports (a subset of) CXX11 without any switch
6169 elif test "$GCC" = "yes"; then
6170     HAVE_CXX11=
6171     AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
6172     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
6173         save_CXXFLAGS=$CXXFLAGS
6174         CXXFLAGS="$CXXFLAGS $flag -Werror"
6175         AC_LANG_PUSH([C++])
6176         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6177             #include <algorithm>
6178             #include <functional>
6179             #include <vector>
6180             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6181                 std::sort(v.begin(), v.end(), fn);
6182             }
6183             ]])],[CXXFLAGS_CXX11=$flag])
6184         AC_LANG_POP([C++])
6185         CXXFLAGS=$save_CXXFLAGS
6186         if test -n "$CXXFLAGS_CXX11"; then
6187             HAVE_CXX11=TRUE
6188             break
6189         fi
6190     done
6191     if test "$HAVE_CXX11" = TRUE; then
6192         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6193     else
6194         AC_MSG_ERROR(no)
6195     fi
6198 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6199 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6200 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6201 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6202 dnl again towards 4.7.2:
6203 if test $CPP_LIBRARY = GLIBCXX; then
6204     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6205     AC_LANG_PUSH([C++])
6206     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6207 #include <list>
6208 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6209     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6210     //   GCC 4.7.0: 20120322
6211     //   GCC 4.7.1: 20120614
6212     // and using a range check is not possible as the mapping between
6213     // __GLIBCXX__ values and GCC versions is not monotonic
6214 /* ok */
6215 #else
6216 abi broken
6217 #endif
6218         ]])], [AC_MSG_RESULT(no, ok)],
6219         [AC_MSG_ERROR(yes)])
6220     AC_LANG_POP([C++])
6223 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6224 save_CXXFLAGS=$CXXFLAGS
6225 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6226 AC_LANG_PUSH([C++])
6228 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6229 #include <stddef.h>
6231 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6233 namespace
6235         struct b
6236         {
6237                 int i;
6238                 int j;
6239         };
6241 ]], [[
6242 struct a
6244         int i;
6245         int j;
6247 a thinga[]={{0,0}, {1,1}};
6248 b thingb[]={{0,0}, {1,1}};
6249 size_t i = sizeof(sal_n_array_size(thinga));
6250 size_t j = sizeof(sal_n_array_size(thingb));
6251 return !(i != 0 && j != 0);
6253     ], [ AC_MSG_RESULT(yes) ],
6254     [ AC_MSG_ERROR(no)])
6255 AC_LANG_POP([C++])
6256 CXXFLAGS=$save_CXXFLAGS
6258 AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error])
6259 save_CXXFLAGS=$CXXFLAGS
6260 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6261 AC_LANG_PUSH([C++])
6263 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6264 #include <vector>
6265     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6266     // (__float128)
6268     ],[ AC_MSG_RESULT(yes) ],
6269     [
6270         AC_MSG_RESULT(no)
6271         # The only reason why libstdc++ headers fail with Clang in C++11 mode is because
6272         # they use the __float128 type that Clang doesn't know (libstdc++ checks whether
6273         # __float128 is available during its build, but it's usually built using GCC,
6274         # and so c++config.h hardcodes __float128 being supported). As the only place
6275         # where __float128 is actually used is in a template specialization,
6276         # -D__float128=void will avoid the problem there while still causing a problem
6277         # if somebody actually uses the type.
6278         AC_MSG_CHECKING([whether -D__float128=void workaround helps])
6279         CXXFLAGS="$CXXFLAGS -D__float128=void"
6280         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6281 #include <vector>
6282     // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6283     // (__float128)
6285     ],
6286     [
6287      AC_MSG_RESULT(yes)
6288      CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
6289     ],
6290     [
6291      AC_MSG_ERROR(no)
6292     ])
6295 AC_LANG_POP([C++])
6296 CXXFLAGS=$save_CXXFLAGS
6298 AC_SUBST(CXXFLAGS_CXX11)
6300 AC_MSG_CHECKING([whether $CXX supports C++11 constexpr])
6301 save_CXXFLAGS=$CXXFLAGS
6302 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6303 AC_LANG_PUSH([C++])
6304 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6305     struct S {
6306         int n_;
6307         constexpr S(int n): n_(n) {}
6308     };
6309     ]])], [cxx11_constexpr=yes], [cxx11_constexpr=no])
6310 AC_LANG_POP([C++])
6311 CXXFLAGS=$save_CXXFLAGS
6312 AC_MSG_RESULT([$cxx11_constexpr])
6313 if test "$cxx11_constexpr" = yes; then
6314     AC_DEFINE([HAVE_CXX11_CONSTEXPR])
6317 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6318 save_CXXFLAGS=$CXXFLAGS
6319 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6320 AC_LANG_PUSH([C++])
6321 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6322     // A somewhat over-complicated way of checking for
6323     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6324     // in constexpr function":
6325     #include <cassert>
6326     template<typename T> inline constexpr T f(T x) { return x; }
6327     template<typename T> inline constexpr T g(T x) {
6328         assert(f(static_cast<int>(x)));
6329         return x;
6330     }
6331     enum E { e };
6332     auto v = g(E::e);
6334     struct S {
6335         int n_;
6336         constexpr bool f() {
6337             int n = n_;
6338             int i = 0;
6339             while (n > 0) { --n; ++i; }
6340             return i == 0;
6341         }
6342     };
6343     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6344 AC_LANG_POP([C++])
6345 CXXFLAGS=$save_CXXFLAGS
6346 AC_MSG_RESULT([$cxx14_constexpr])
6347 if test "$cxx14_constexpr" = yes; then
6348     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6351 AC_MSG_CHECKING([whether $CXX supports C++11 ref-qualifier])
6352 save_CXXFLAGS=$CXXFLAGS
6353 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6354 AC_LANG_PUSH([C++])
6355 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6356     struct S {
6357         void f() &;
6358         void f() &&;
6359     };
6360     ]])], [cxx11_ref_qualifier=yes], [cxx11_ref_qualifier=no])
6361 AC_LANG_POP([C++])
6362 CXXFLAGS=$save_CXXFLAGS
6363 AC_MSG_RESULT([$cxx11_ref_qualifier])
6364 if test "$cxx11_ref_qualifier" = yes; then
6365     AC_DEFINE([HAVE_CXX11_REF_QUALIFIER])
6368 AC_MSG_CHECKING([whether $CXX supports C++11 char16_t string literals])
6369 save_CXXFLAGS=$CXXFLAGS
6370 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6371 AC_LANG_PUSH([C++])
6372 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6373     auto s = u"";
6374     ]])], [cxx11_utf16_string_literal=yes], [cxx11_utf16_string_literal=no])
6375 AC_LANG_POP([C++])
6376 CXXFLAGS=$save_CXXFLAGS
6377 AC_MSG_RESULT([$cxx11_utf16_string_literal])
6378 if test "$cxx11_utf16_string_literal" = yes; then
6379     AC_DEFINE([HAVE_CXX11_UTF16_STRING_LITERAL])
6382 AC_MSG_CHECKING([whether $CXX supports C++14 sized deallocation])
6383 dnl At least Clang -fsanitize=address causes "multiple definition of
6384 dnl `operator delete(void*, unsigned long)'" also defined in
6385 dnl projects/compiler-rt/lib/asan/asan_new_delete.cc:
6386 save_CXX=$CXX
6387 if test "$COM_IS_CLANG" = TRUE; then
6388     my_CXX=
6389     for i in $CXX; do
6390         case $i in
6391         -fsanitize=address)
6392             ;;
6393         *)
6394             my_CXX="$my_CXX $i"
6395             ;;
6396         esac
6397     done
6398     CXX=$my_CXX
6400 save_CXXFLAGS=$CXXFLAGS
6401 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6402 AC_LANG_PUSH([C++])
6403 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
6404     #include <cstddef>
6405     #include <cstdlib>
6406     void operator delete(void *) throw () { std::exit(1); }
6407     void operator delete(void *, std::size_t) throw () { std::exit(0); }
6408     struct S { S() { throw 0; } };
6409     ]],[[
6410     try { new S; } catch (...) {}
6411     return 1;
6412     ]])], [cxx14_sized_deallocation=yes], [cxx14_sized_deallocation=no], [cxx14_sized_deallocation=no])
6413 AC_LANG_POP([C++])
6414 CXX=$save_CXX
6415 CXXFLAGS=$save_CXXFLAGS
6416 AC_MSG_RESULT([$cxx14_sized_deallocation])
6417 if test "$cxx14_sized_deallocation" = yes; then
6418     AC_DEFINE([HAVE_CXX14_SIZED_DEALLOCATION])
6421 HAVE_GCC_PRAGMA_OPERATOR=
6422 dnl _Pragma support (may require C++11)
6423 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6424     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6425     AC_LANG_PUSH([C++])
6426     save_CXXFLAGS=$CXXFLAGS
6427     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6428     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6429             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6430         ])], [
6431             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6432             HAVE_GCC_PRAGMA_OPERATOR=1
6433             AC_MSG_RESULT([yes])
6434         ], [AC_MSG_RESULT([no])])
6435     AC_LANG_POP([C++])
6436     CXXFLAGS=$save_CXXFLAGS
6438 AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
6440 HAVE_GCC_FNO_FNO_SIZED_DEALLOCATION=
6441 if test "$GCC" = yes; then
6442     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6443     AC_LANG_PUSH([C++])
6444     save_CXXFLAGS=$CXXFLAGS
6445     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6446     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6447     CXXFLAGS=$save_CXXFLAGS
6448     AC_LANG_POP([C++])
6449     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6450         AC_MSG_RESULT([yes])
6451     else
6452         AC_MSG_RESULT([no])
6453     fi
6455 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6457 dnl ===================================================================
6458 dnl system stl sanity tests
6459 dnl ===================================================================
6460 if test \( "$_os" != "WINNT" -o "$WITH_MINGW" = "yes" \); then
6462     AC_LANG_PUSH([C++])
6464     save_CPPFLAGS="$CPPFLAGS"
6465     if test -n "$MACOSX_SDK_PATH"; then
6466         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6467     fi
6469     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6470     # only.
6471     if test "$CPP_LIBRARY" = GLIBCXX; then
6472         dnl gcc#19664, gcc#22482, rhbz#162935
6473         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6474         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6475         AC_MSG_RESULT([$stlvisok])
6476         if test "$stlvisok" = "no"; then
6477             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6478         fi
6479     fi
6481     sharedlink_ldflags_save=$LDFLAGS
6482     LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden $PICSWITCH $LINKFLAGSSHL"
6484     AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
6485     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6486 #include <sstream>
6487 using namespace std;
6488         ]], [[
6489 istringstream strm( "test" ); return 0;
6490         ]])],
6491         # Ugh, surely bad to assume an error message will contain
6492         # the word "unresolvable", a problem with
6493         # -fvisibility-inlines-hidden and STL headers might cause
6494         # some more obscure message on some platform, and anway,
6495         # the error message could be localised.
6496         [$EGREP -q unresolvable conftest.err;
6497         if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no
6498     ])
6499     AC_MSG_RESULT([$gccvisok])
6500     if test "$gccvisok" = "no"; then
6501         AC_MSG_ERROR([Your gcc is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6502     fi
6504     LDFLAGS=$sharedlink_ldflags_save
6506     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6507     # when we don't make any dynamic libraries?
6508     if test "$DISABLE_DYNLOADING" = ""; then
6509         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6510         cat > conftestlib1.cc <<_ACEOF
6511 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6512 struct S2: S1<int> { virtual ~S2(); };
6513 S2::~S2() {}
6514 _ACEOF
6515         cat > conftestlib2.cc <<_ACEOF
6516 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6517 struct S2: S1<int> { virtual ~S2(); };
6518 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6519 _ACEOF
6520         gccvisinlineshiddenok=yes
6521         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6522             gccvisinlineshiddenok=no
6523         else
6524             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6525             dnl known to not work with -z defs (unsetting which makes the test
6526             dnl moot, though):
6527             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6528             if test "$COM_IS_CLANG" = TRUE; then
6529                 for i in $CXX; do
6530                     case $i in
6531                     -fsanitize=*)
6532                         my_linkflagsnoundefs=
6533                         break
6534                         ;;
6535                     esac
6536                 done
6537             fi
6538             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6539                 gccvisinlineshiddenok=no
6540             fi
6541         fi
6543         rm -fr libconftest*
6544         AC_MSG_RESULT([$gccvisinlineshiddenok])
6545         if test "$gccvisinlineshiddenok" = "no"; then
6546             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6547         fi
6548     fi
6550     AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6551     cat >visibility.cxx <<_ACEOF
6552 #pragma GCC visibility push(hidden)
6553 struct __attribute__ ((visibility ("default"))) TestStruct {
6554   static void Init();
6556 __attribute__ ((visibility ("default"))) void TestFunc() {
6557   TestStruct::Init();
6559 _ACEOF
6560     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6561         gccvisbroken=yes
6562     else
6563         case "$host_cpu" in
6564         i?86|x86_64)
6565             if test "$_os" = "Darwin" -o "$WITH_MINGW" = "yes"; then
6566                 gccvisbroken=no
6567             else
6568                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6569                     gccvisbroken=no
6570                 else
6571                     gccvisbroken=yes
6572                 fi
6573             fi
6574             ;;
6575         *)
6576             gccvisbroken=no
6577             ;;
6578         esac
6579     fi
6580     rm -f visibility.s visibility.cxx
6582     AC_MSG_RESULT([$gccvisbroken])
6583     if test "$gccvisbroken" = "yes"; then
6584         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6585     fi
6587     CPPFLAGS="$save_CPPFLAGS"
6589     AC_LANG_POP([C++])
6592 dnl ===================================================================
6593 dnl  Clang++ tests
6594 dnl ===================================================================
6596 HAVE_GCC_FNO_DEFAULT_INLINE=
6597 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6598 if test "$GCC" = "yes"; then
6599     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6600     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6601         # Option just ignored and silly warning that isn't a real
6602         # warning printed
6603         :
6604     else
6605         AC_LANG_PUSH([C++])
6606         save_CXXFLAGS=$CXXFLAGS
6607         CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6608         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6609         CXXFLAGS=$save_CXXFLAGS
6610         AC_LANG_POP([C++])
6611     fi
6612     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6613         AC_MSG_RESULT([yes])
6614     else
6615         AC_MSG_RESULT([no])
6616     fi
6618     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6619     if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
6620         # As above
6621         :
6622     else
6623         AC_LANG_PUSH([C++])
6624         save_CXXFLAGS=$CXXFLAGS
6625         CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6626         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6627         CXXFLAGS=$save_CXXFLAGS
6628         AC_LANG_POP([C++])
6629     fi
6630     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6631         AC_MSG_RESULT([yes])
6632     else
6633         AC_MSG_RESULT([no])
6634     fi
6636 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6637 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6639 dnl ===================================================================
6640 dnl Compiler plugins
6641 dnl ===================================================================
6643 COMPILER_PLUGINS=
6644 # currently only Clang
6645 if test "$COM_IS_CLANG" = "TRUE"; then
6646     if test -n "$enable_compiler_plugins"; then
6647         compiler_plugins="$enable_compiler_plugins"
6648     elif test -n "$ENABLE_DBGUTIL"; then
6649         compiler_plugins=test
6650     else
6651         compiler_plugins=no
6652     fi
6653     if test "$compiler_plugins" != "no"; then
6654         dnl The prefix where Clang resides, override to where Clang resides if
6655         dnl using a source build:
6656         if test -z "$CLANGDIR"; then
6657             CLANGDIR=/usr
6658         fi
6659         AC_LANG_PUSH([C++])
6660         save_CPPFLAGS=$CPPFLAGS
6661         save_CXX=$CXX
6662         # compiler plugins must be built with "native" bitness of clang
6663         # because they link against clang libraries
6664         CXX=${COMPILER_PLUGINS_CXX-$(echo $CXX | sed -e s/-m64// -e s/-m32//)}
6665         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6666         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6667             [COMPILER_PLUGINS=TRUE],
6668             [
6669             if test "$compiler_plugins" = "yes"; then
6670                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6671             else
6672                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6673                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6674             fi
6675             ])
6676         CXX=$save_CXX
6677         CPPFLAGS=$save_CPPFLAGS
6678         AC_LANG_POP([C++])
6679     fi
6680 else
6681     if test "$enable_compiler_plugins" = "yes"; then
6682         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6683     fi
6685 AC_SUBST(COMPILER_PLUGINS)
6686 AC_SUBST(COMPILER_PLUGINS_CXX)
6687 AC_SUBST(CLANGDIR)
6689 # Plugin to help linker.
6690 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6691 # This makes --enable-lto build with clang work.
6692 AC_SUBST(LD_PLUGIN)
6694 dnl ===================================================================
6695 dnl allocator
6696 dnl ===================================================================
6697 AC_MSG_CHECKING([which memory allocator to use])
6698 if test "$with_alloc" = "system"; then
6699     AC_MSG_RESULT([system])
6700     ALLOC="SYS_ALLOC"
6702 if test "$with_alloc" = "tcmalloc"; then
6703     AC_MSG_RESULT(tcmalloc)
6704     if ! echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6705         AC_MSG_ERROR([tcmalloc only available/usable on ix86])
6706     fi
6707     AC_CHECK_LIB([tcmalloc], [malloc], [:],
6708         [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
6709     ALLOC="TCMALLOC"
6711 if test "$with_alloc" = "jemalloc"; then
6712     if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
6713         AC_MSG_RESULT(jemalloc)
6714         save_CFLAGS=$CFLAGS
6715         CFLAGS="$CFLAGS -pthread"
6716         AC_CHECK_LIB([jemalloc], [malloc], [:],
6717             [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
6718         ALLOC="JEMALLOC"
6719         CFLAGS=$save_CFLAGS
6720     else
6721         AC_MSG_RESULT([system])
6722         ALLOC="SYS_ALLOC"
6723     fi
6725 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6726     AC_MSG_RESULT([internal])
6728 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6729 AC_SUBST(HAVE_POSIX_FALLOCATE)
6730 AC_SUBST(ALLOC)
6732 dnl ===================================================================
6733 dnl Custom build version
6734 dnl ===================================================================
6736 AC_MSG_CHECKING([whether to add custom build version])
6737 if test "$with_build_version" != ""; then
6738     BUILD_VER_STRING=$with_build_version
6739     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6740 else
6741     BUILD_VER_STRING=
6742     AC_MSG_RESULT([no])
6744 AC_SUBST(BUILD_VER_STRING)
6746 JITC_PROCESSOR_TYPE=""
6747 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6748     # IBMs JDK needs this...
6749     JITC_PROCESSOR_TYPE=6
6750     export JITC_PROCESSOR_TYPE
6752 AC_SUBST([JITC_PROCESSOR_TYPE])
6754 # Misc Windows Stuff
6755 if test $_os = "WINNT" -a "$WITH_MINGW" != yes; then
6756     find_msvc_x64_dlls
6757     find_msms
6758     MSVC_DLL_PATH="$msvcdllpath"
6759     MSVC_DLLS="$msvcdlls"
6760     MSM_PATH="$msmdir"
6761     SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6764 AC_SUBST(MSVC_DLL_PATH)
6765 AC_SUBST(MSVC_DLLS)
6766 AC_SUBST(MSM_PATH)
6768 dnl ===================================================================
6769 dnl Checks for Java
6770 dnl ===================================================================
6771 if test "$ENABLE_JAVA" != ""; then
6773     # Windows-specific tests
6774     if test "$build_os" = "cygwin"; then
6775         if test "$BITNESS_OVERRIDE" = 64; then
6776             bitness=64
6777         else
6778             bitness=32
6779         fi
6781         if test -z "$with_jdk_home"; then
6782             for ver in 1.8 1.7 1.6; do
6783                 reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6784                 if test -n "$regvalue"; then
6785                     _jdk_home=$regvalue
6786                     break
6787                 fi
6788             done
6789             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6790                 with_jdk_home="$_jdk_home"
6791                 howfound="found automatically"
6792             else
6793                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6794             fi
6795         else
6796             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6797             howfound="you passed"
6798         fi
6799     fi
6801     # 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.
6802     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6803     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6804         with_jdk_home=`/usr/libexec/java_home`
6805     fi
6807     JAVA_HOME=; export JAVA_HOME
6808     if test -z "$with_jdk_home"; then
6809         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6810     else
6811         _java_path="$with_jdk_home/bin/$with_java"
6812         dnl Check if there is a Java interpreter at all.
6813         if test -x "$_java_path"; then
6814             JAVAINTERPRETER=$_java_path
6815         else
6816             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6817         fi
6818     fi
6820     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6821     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6822     dnl loaded by java to run JunitTests:
6823     if test "$build_os" = "cygwin"; then
6824         shortjdkhome=`cygpath -d "$with_jdk_home"`
6825         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
6826             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6827             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6828         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
6829             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6830             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6831         fi
6833         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6834             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6835         fi
6836         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6837     elif test "$cross_compiling" != "yes"; then
6838         case $CPUNAME in
6839             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6840                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6841                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6842                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6843                 fi
6844                 ;;
6845             *) # assumption: everything else 32-bit
6846                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6847                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6848                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6849                 fi
6850                 ;;
6851         esac
6852     fi
6855 HAVE_JAVA9=
6856 dnl ===================================================================
6857 dnl Checks for JDK.
6858 dnl ===================================================================
6860 # Note that JAVA_HOME as for now always means the *build* platform's
6861 # JAVA_HOME. Whether all the complexity here actually is needed any
6862 # more or not, no idea.
6864 if test "$ENABLE_JAVA" != ""; then
6865     _gij_longver=0
6866     AC_MSG_CHECKING([the installed JDK])
6867     if test -n "$JAVAINTERPRETER"; then
6868         dnl java -version sends output to stderr!
6869         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6870             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6871         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6872             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6873         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6874             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6875         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6876             JDK=ibm
6878             dnl IBM JDK specific tests
6879             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6880             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6882             if test "$_jdk_ver" -lt 10600; then
6883                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6884             fi
6886             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6888             if test "$with_jdk_home" = ""; then
6889                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6890 you must use the "--with-jdk-home" configure option explicitly])
6891             fi
6893             JAVA_HOME=$with_jdk_home
6894         else
6895             JDK=sun
6897             dnl Sun JDK specific tests
6898             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6899             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6901             if test "$_jdk_ver" -lt 10600; then
6902                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6903             fi
6904             if test "$_jdk_ver" -gt 10600; then
6905                 JAVA_CLASSPATH_NOT_SET="1"
6906             fi
6907             if test "$_jdk_ver" -ge 10900; then
6908                 HAVE_JAVA9=TRUE
6909             fi
6911             AC_MSG_RESULT([checked (JDK $_jdk)])
6912             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6913             if test "$_os" = "WINNT"; then
6914                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6915             fi
6917             # set to limit VM usage for JunitTests
6918             JAVAIFLAGS=-Xmx64M
6919             # set to limit VM usage for javac
6920             JAVAFLAGS=-J-Xmx128M
6921         fi
6922     else
6923         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6924     fi
6925 else
6926     dnl Java disabled
6927     JAVA_HOME=
6928     export JAVA_HOME
6931 dnl ===================================================================
6932 dnl Set target Java bytecode version
6933 dnl ===================================================================
6934 if test "$ENABLE_JAVA" != ""; then
6935     if test "$HAVE_JAVA9" = "TRUE"; then
6936         _java_target_ver="1.6"
6937     else
6938         _java_target_ver="1.5"
6939     fi
6940     JAVA_SOURCE_VER="$_java_target_ver"
6941     JAVA_TARGET_VER="$_java_target_ver"
6944 dnl ===================================================================
6945 dnl Checks for javac
6946 dnl ===================================================================
6947 if test "$ENABLE_JAVA" != ""; then
6948     javacompiler="javac"
6949     if test -z "$with_jdk_home"; then
6950         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6951     else
6952         _javac_path="$with_jdk_home/bin/$javacompiler"
6953         dnl Check if there is a Java compiler at all.
6954         if test -x "$_javac_path"; then
6955             JAVACOMPILER=$_javac_path
6956         fi
6957     fi
6958     if test -z "$JAVACOMPILER"; then
6959         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6960     fi
6961     if test "$build_os" = "cygwin"; then
6962         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6963             JAVACOMPILER="${JAVACOMPILER}.exe"
6964         fi
6965         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6966     fi
6969 dnl ===================================================================
6970 dnl Checks for javadoc
6971 dnl ===================================================================
6972 if test "$ENABLE_JAVA" != ""; then
6973     if test -z "$with_jdk_home"; then
6974         AC_PATH_PROG(JAVADOC, javadoc)
6975     else
6976         _javadoc_path="$with_jdk_home/bin/javadoc"
6977         dnl Check if there is a javadoc at all.
6978         if test -x "$_javadoc_path"; then
6979             JAVADOC=$_javadoc_path
6980         else
6981             AC_PATH_PROG(JAVADOC, javadoc)
6982         fi
6983     fi
6984     if test -z "$JAVADOC"; then
6985         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6986     fi
6987     if test "$build_os" = "cygwin"; then
6988         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6989             JAVADOC="${JAVADOC}.exe"
6990         fi
6991         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6992     fi
6994     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6995     JAVADOCISGJDOC="yes"
6996     fi
6998 AC_SUBST(JAVADOCISGJDOC)
7000 if test "$ENABLE_JAVA" != ""; then
7001     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7002     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7003         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7004            # try to recover first by looking whether we have a alternatives
7005            # system as in Debian or newer SuSEs where following /usr/bin/javac
7006            # over /etc/alternatives/javac leads to the right bindir where we
7007            # just need to strip a bit away to get a valid JAVA_HOME
7008            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7009         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7010             # maybe only one level of symlink (e.g. on Mac)
7011             JAVA_HOME=$(readlink $JAVACOMPILER)
7012             if test "$(dirname $JAVA_HOME)" = "."; then
7013                 # we've got no path to trim back
7014                 JAVA_HOME=""
7015             fi
7016         else
7017             # else warn
7018             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7019             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7020             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7021             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7022         fi
7023         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7024         if test "$JAVA_HOME" != "/usr"; then
7025             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7026                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7027                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7028                 dnl Tiger already returns a JDK path..
7029                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7030             else
7031                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7032                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7033                 dnl that checks which version to run
7034                 if test -f "$JAVA_HOME"; then
7035                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7036                 fi
7037             fi
7038         fi
7039     fi
7040     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7042     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7043     if test -z "$JAVA_HOME"; then
7044         if test "x$with_jdk_home" = "x"; then
7045             cat > findhome.java <<_ACEOF
7046 [import java.io.File;
7048 class findhome
7050     public static void main(String args[])
7051     {
7052         String jrelocation = System.getProperty("java.home");
7053         File jre = new File(jrelocation);
7054         System.out.println(jre.getParent());
7055     }
7057 _ACEOF
7058             AC_MSG_CHECKING([if javac works])
7059             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7060             AC_TRY_EVAL(javac_cmd)
7061             if test $? = 0 -a -f ./findhome.class; then
7062                 AC_MSG_RESULT([javac works])
7063             else
7064                 echo "configure: javac test failed" >&5
7065                 cat findhome.java >&5
7066                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7067             fi
7068             AC_MSG_CHECKING([if gij knows its java.home])
7069             JAVA_HOME=`$JAVAINTERPRETER findhome`
7070             if test $? = 0 -a "$JAVA_HOME" != ""; then
7071                 AC_MSG_RESULT([$JAVA_HOME])
7072             else
7073                 echo "configure: java test failed" >&5
7074                 cat findhome.java >&5
7075                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7076             fi
7077             # clean-up after ourselves
7078             rm -f ./findhome.java ./findhome.class
7079         else
7080             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7081         fi
7082     fi
7084     # now check if $JAVA_HOME is really valid
7085     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7086         case "${JAVA_HOME}" in
7087             /Library/Java/JavaVirtualMachines/*)
7088                 ;;
7089             *)
7090                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7091                 ;;
7092         esac
7093         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7094             JAVA_HOME_OK="NO"
7095         fi
7096     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7097         JAVA_HOME_OK="NO"
7098     fi
7099     if test "$JAVA_HOME_OK" = "NO"; then
7100         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7101         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7102         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7103         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7104         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7105         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7106     fi
7107     PathFormat "$JAVA_HOME"
7108     JAVA_HOME="$formatted_path"
7111 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7112     "$_os" != Darwin
7113 then
7114     AC_MSG_CHECKING([for JAWT lib])
7115     if test "$_os" = WINNT; then
7116         if test "$WITH_MINGW" = yes; then
7117             # The path is taken care of in gb_LinkTarget__use_jawt
7118             # in RepositoryExternal.mk:
7119             JAWTLIB=-ljawt
7120         else
7121             # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7122             JAWTLIB=jawt.lib
7123         fi
7124     else
7125         case "$host_cpu" in
7126         arm*)
7127             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7128             JAVA_ARCH=$my_java_arch
7129             ;;
7130         i*86)
7131             my_java_arch=i386
7132             ;;
7133         m68k)
7134             my_java_arch=m68k
7135             ;;
7136         powerpc)
7137             my_java_arch=ppc
7138             ;;
7139         powerpc64)
7140             my_java_arch=ppc64
7141             ;;
7142         powerpc64le)
7143             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7144             JAVA_ARCH=$my_java_arch
7145             ;;
7146         sparc64)
7147             my_java_arch=sparcv9
7148             ;;
7149         x86_64)
7150             my_java_arch=amd64
7151             ;;
7152         *)
7153             my_java_arch=$host_cpu
7154             ;;
7155         esac
7156         JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7157         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7158     fi
7159     AC_MSG_RESULT([$JAWTLIB])
7161 AC_SUBST(JAWTLIB)
7163 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7164     case "$host_os" in
7166     aix*)
7167         JAVAINC="-I$JAVA_HOME/include"
7168         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7169         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7170         ;;
7172     cygwin*)
7173         JAVAINC="-I$JAVA_HOME/include/win32"
7174         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7175         ;;
7177     darwin*)
7178         if test -d "$JAVA_HOME/include/darwin"; then
7179             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7180         else
7181             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7182         fi
7183         ;;
7185     dragonfly*)
7186         JAVAINC="-I$JAVA_HOME/include"
7187         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7188         ;;
7190     freebsd*)
7191         JAVAINC="-I$JAVA_HOME/include"
7192         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7193         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7194         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7195         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7196         ;;
7198     k*bsd*-gnu*)
7199         JAVAINC="-I$JAVA_HOME/include"
7200         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7201         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7202         ;;
7204     linux-gnu*)
7205         JAVAINC="-I$JAVA_HOME/include"
7206         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7207         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7208         ;;
7210     mingw*)
7211         JAVAINC="-I$JAVA_HOME/include"
7212         ;;
7214     *netbsd*)
7215         JAVAINC="-I$JAVA_HOME/include"
7216         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7217         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7218        ;;
7220     openbsd*)
7221         JAVAINC="-I$JAVA_HOME/include"
7222         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7223         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7224         ;;
7226     solaris*)
7227         JAVAINC="-I$JAVA_HOME/include"
7228         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7229         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7230         ;;
7231     esac
7233 SOLARINC="$SOLARINC $JAVAINC"
7235 AC_SUBST(JAVACOMPILER)
7236 AC_SUBST(JAVADOC)
7237 AC_SUBST(JAVAINTERPRETER)
7238 AC_SUBST(JAVAIFLAGS)
7239 AC_SUBST(JAVAFLAGS)
7240 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7241 AC_SUBST(JAVA_HOME)
7242 AC_SUBST(JAVA_SOURCE_VER)
7243 AC_SUBST(JAVA_TARGET_VER)
7244 AC_SUBST(JDK)
7247 dnl ===================================================================
7248 dnl Export file validation
7249 dnl ===================================================================
7250 AC_MSG_CHECKING([whether to enable export file validation])
7251 if test "$with_export_validation" = yes; then
7252     if test -z "$ENABLE_JAVA"; then
7253         AC_MSG_RESULT([no, as Java is disabled])
7254     else
7255         AC_MSG_RESULT([yes])
7256         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7258         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7259         if test -z "$ODFVALIDATOR"; then
7260             # remember to download the ODF toolkit with validator later
7261             AC_MSG_NOTICE([no odfvalidator found, will download it])
7262             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7263             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7265             # and fetch name of odfvalidator jar name from download.lst
7266             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7267             AC_SUBST(ODFVALIDATOR_JAR)
7269             if test -z "$ODFVALIDATOR_JAR"; then
7270                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7271             fi
7272         fi
7273         if test "$build_os" = "cygwin"; then
7274             # In case of CygWin it will be executed from Windows,
7275             # so we need to run bash and absolute path to validator
7276             # so instead of "odfvalidator" it will be
7277             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7278             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7279         else
7280             ODFVALIDATOR="sh $ODFVALIDATOR"
7281         fi
7282         AC_SUBST(ODFVALIDATOR)
7285         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7286         if test -z "$OFFICEOTRON"; then
7287             # remember to download the officeotron with validator later
7288             AC_MSG_NOTICE([no officeotron found, will download it])
7289             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7290             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7292             # and fetch name of officeotron jar name from download.lst
7293             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7294             AC_SUBST(OFFICEOTRON_JAR)
7296             if test -z "$OFFICEOTRON_JAR"; then
7297                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7298             fi
7299         else
7300             # check version of existing officeotron
7301             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7302             if test 0"$OFFICEOTRON_VER" -lt 704; then
7303                 AC_MSG_ERROR([officeotron too old])
7304             fi
7305         fi
7306         if test "$build_os" = "cygwin"; then
7307             # In case of CygWin it will be executed from Windows,
7308             # so we need to run bash and absolute path to validator
7309             # so instead of "odfvalidator" it will be
7310             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7311             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7312         else
7313             OFFICEOTRON="sh $OFFICEOTRON"
7314         fi
7315     fi
7316     AC_SUBST(OFFICEOTRON)
7317 else
7318     AC_MSG_RESULT([no])
7321 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7322 if test "$with_bffvalidator" != "no"; then
7323     AC_DEFINE(HAVE_BFFVALIDATOR)
7325     if test "$with_export_validation" != "yes"; then
7326         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7327     fi
7329     if test "$with_bffvalidator" = "yes"; then
7330         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7331     else
7332         BFFVALIDATOR="$with_bffvalidator"
7333     fi
7335     if test "$build_os" = "cygwin"; then
7336         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7337             AC_MSG_RESULT($BFFVALIDATOR)
7338         else
7339             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7340         fi
7341     elif test -n "$BFFVALIDATOR"; then
7342         # We are not in CygWin but need to run Windows binary with wine
7343         AC_PATH_PROGS(WINE, wine)
7345         # so swap in a shell wrapper that converts paths transparently
7346         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7347         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7348         AC_SUBST(BFFVALIDATOR_EXE)
7349         AC_MSG_RESULT($BFFVALIDATOR)
7350     else
7351         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7352     fi
7353     AC_SUBST(BFFVALIDATOR)
7354 else
7355     AC_MSG_RESULT([no])
7358 dnl ===================================================================
7359 dnl Check for C preprocessor to use
7360 dnl ===================================================================
7361 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7362 if test -n "$with_idlc_cpp"; then
7363     AC_MSG_RESULT([$with_idlc_cpp])
7364     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7365 else
7366     AC_MSG_RESULT([ucpp])
7367     AC_MSG_CHECKING([which ucpp tp use])
7368     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7369         AC_MSG_RESULT([external])
7370         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7371     else
7372         AC_MSG_RESULT([internal])
7373         BUILD_TYPE="$BUILD_TYPE UCPP"
7374     fi
7376 AC_SUBST(SYSTEM_UCPP)
7378 dnl ===================================================================
7379 dnl Check for epm (not needed for Windows)
7380 dnl ===================================================================
7381 AC_MSG_CHECKING([whether to enable EPM for packing])
7382 if test "$enable_epm" = "yes"; then
7383     AC_MSG_RESULT([yes])
7384     if test "$_os" != "WINNT"; then
7385         if test $_os = Darwin; then
7386             EPM=internal
7387         elif test -n "$with_epm"; then
7388             EPM=$with_epm
7389         else
7390             AC_PATH_PROG(EPM, epm, no)
7391         fi
7392         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7393             AC_MSG_NOTICE([EPM will be built.])
7394             BUILD_TYPE="$BUILD_TYPE EPM"
7395             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7396         else
7397             # Gentoo has some epm which is something different...
7398             AC_MSG_CHECKING([whether the found epm is the right epm])
7399             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7400                 AC_MSG_RESULT([yes])
7401             else
7402                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7403             fi
7404             AC_MSG_CHECKING([epm version])
7405             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7406             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7407                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7408                 AC_MSG_RESULT([OK, >= 3.7])
7409             else
7410                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7411                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7412             fi
7413         fi
7414     fi
7416     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7417         AC_MSG_CHECKING([for rpm])
7418         for a in "$RPM" rpmbuild rpm; do
7419             $a --usage >/dev/null 2> /dev/null
7420             if test $? -eq 0; then
7421                 RPM=$a
7422                 break
7423             else
7424                 $a --version >/dev/null 2> /dev/null
7425                 if test $? -eq 0; then
7426                     RPM=$a
7427                     break
7428                 fi
7429             fi
7430         done
7431         if test -z "$RPM"; then
7432             AC_MSG_ERROR([not found])
7433         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7434             RPM_PATH=`which $RPM`
7435             AC_MSG_RESULT([$RPM_PATH])
7436             SCPDEFS="$SCPDEFS -DWITH_RPM"
7437         else
7438             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7439         fi
7440     fi
7441     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7442         AC_PATH_PROG(DPKG, dpkg, no)
7443         if test "$DPKG" = "no"; then
7444             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7445         fi
7446     fi
7447     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7448        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7449         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7450             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7451                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7452                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7453                     AC_MSG_RESULT([yes])
7454                 else
7455                     AC_MSG_RESULT([no])
7456                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7457                         _pt="rpm"
7458                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7459                         add_warning "the rpms will need to be installed with --nodeps"
7460                     else
7461                         _pt="pkg"
7462                     fi
7463                     AC_MSG_WARN([the ${_pt}s will not be relocateable])
7464                     add_warning "the ${_pt}s will not be relocateable"
7465                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7466                                  relocation will work, you need to patch your epm with the
7467                                  patch in epm/epm-3.7.patch or build with
7468                                  --with-epm=internal which will build a suitable epm])
7469                 fi
7470             fi
7471         fi
7472     fi
7473     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7474         AC_PATH_PROG(PKGMK, pkgmk, no)
7475         if test "$PKGMK" = "no"; then
7476             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7477         fi
7478     fi
7479     AC_SUBST(RPM)
7480     AC_SUBST(DPKG)
7481     AC_SUBST(PKGMK)
7482 else
7483     for i in $PKGFORMAT; do
7484         case "$i" in
7485         aix | bsd | deb | pkg | rpm | native | portable)
7486             AC_MSG_ERROR(
7487                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7488             ;;
7489         esac
7490     done
7491     AC_MSG_RESULT([no])
7492     EPM=NO
7494 AC_SUBST(EPM)
7496 dnl ===================================================================
7497 dnl We need winegcc when building MinGW build to be able to cross-build msi tools
7498 dnl ===================================================================
7499 WINEGCC=
7500 if test "$enable_winegcc" = "yes"; then
7501     AC_PATH_PROG(WINEGCC, winegcc)
7502     if test "$WINEGCC" = ""; then
7503         AC_MSG_ERROR([winegcc was not found, please install wine-devel, or wine-devel-32bit])
7504     fi
7505     CC_save="$CC"
7506     ac_exeext_save="$ac_exeext"
7507     CC="$WINEGCC -m32"
7508     ac_exeext=".exe"
7509     AC_LINK_IFELSE([AC_LANG_PROGRAM([
7510 #include <stdio.h>
7511         ],[
7512 printf ("hello world\n");
7513         ])],,
7514         [AC_MSG_ERROR([winegcc cannot build 32bit binaries, please install glibc-devel-32bit and gcc-32bit])]
7515     )
7516     CC="$CC_save"
7517     ac_exeext="$ac_exeext_save"
7519 AC_SUBST(WINEGCC)
7521 if test $_os = iOS; then
7522     enable_mpl_subset=yes
7523     enable_lotuswordpro=no
7524     enable_coinmp=yes
7525     enable_lpsolve=no
7526     enable_postgresql_sdbc=no
7527     enable_extension_integration=no
7528     enable_report_builder=no
7529     with_theme="tango"
7530     with_ppds=no
7533 ENABLE_LWP=
7534 if test "$enable_lotuswordpro" = "yes"; then
7535     ENABLE_LWP="TRUE"
7536     SCPDEFS="$SCPDEFS -DDISABLE_LWP"
7538 AC_SUBST(ENABLE_LWP)
7540 dnl ===================================================================
7541 dnl Check for gperf
7542 dnl ===================================================================
7543 AC_PATH_PROG(GPERF, gperf)
7544 if test -z "$GPERF"; then
7545     AC_MSG_ERROR([gperf not found but needed. Install it.])
7547 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7548     GPERF=`cygpath -m $GPERF`
7550 AC_MSG_CHECKING([gperf version])
7551 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
7552     AC_MSG_RESULT([OK])
7553 else
7554     AC_MSG_ERROR([too old, you need at least 3.0.0])
7556 AC_SUBST(GPERF)
7558 dnl ===================================================================
7559 dnl Check for building ODK
7560 dnl ===================================================================
7561 if test "$enable_odk" = no; then
7562     unset DOXYGEN
7563 else
7564     if test "$with_doxygen" = no; then
7565         AC_MSG_CHECKING([for doxygen])
7566         unset DOXYGEN
7567         AC_MSG_RESULT([no])
7568     else
7569         if test "$with_doxygen" = yes; then
7570             AC_PATH_PROG([DOXYGEN], [doxygen])
7571             if test -z "$DOXYGEN"; then
7572                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7573             fi
7574         else
7575             AC_MSG_CHECKING([for doxygen])
7576             DOXYGEN=$with_doxygen
7577             AC_MSG_RESULT([$DOXYGEN])
7578         fi
7579         if test -n "$DOXYGEN"; then
7580             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7581             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7582             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7583                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7584             fi
7585         fi
7586     fi
7588 AC_SUBST([DOXYGEN])
7590 AC_MSG_CHECKING([whether to build the ODK])
7591 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7592     AC_MSG_RESULT([yes])
7594     if test "$with_java" != "no"; then
7595         AC_MSG_CHECKING([whether to build unowinreg.dll])
7596         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7597             # build on Win by default
7598             enable_build_unowinreg=yes
7599         fi
7600         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7601             AC_MSG_RESULT([no])
7602             BUILD_UNOWINREG=
7603         else
7604             AC_MSG_RESULT([yes])
7605             BUILD_UNOWINREG=TRUE
7606         fi
7607         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7608             if test -z "$with_mingw_cross_compiler"; then
7609                 dnl Guess...
7610                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7611             elif test -x "$with_mingw_cross_compiler"; then
7612                  MINGWCXX="$with_mingw_cross_compiler"
7613             else
7614                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7615             fi
7617             if test "$MINGWCXX" = "false"; then
7618                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7619             fi
7621             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7622             if test -x "$mingwstrip_test"; then
7623                 MINGWSTRIP="$mingwstrip_test"
7624             else
7625                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7626             fi
7628             if test "$MINGWSTRIP" = "false"; then
7629                 AC_MSG_ERROR(MinGW32 binutils not found.)
7630             fi
7631         fi
7632     fi
7633     BUILD_TYPE="$BUILD_TYPE ODK"
7634 else
7635     AC_MSG_RESULT([no])
7636     BUILD_UNOWINREG=
7638 AC_SUBST(BUILD_UNOWINREG)
7639 AC_SUBST(MINGWCXX)
7640 AC_SUBST(MINGWSTRIP)
7642 dnl ===================================================================
7643 dnl Check for system zlib
7644 dnl ===================================================================
7645 if test "$with_system_zlib" = "auto"; then
7646     case "$_os" in
7647     WINNT)
7648         with_system_zlib="$with_system_libs"
7649         ;;
7650     *)
7651         with_system_zlib=yes
7652         ;;
7653     esac
7656 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7657 dnl and has no pkg-config for it at least on some tinderboxes,
7658 dnl so leaving that out for now
7659 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7660 AC_MSG_CHECKING([which zlib to use])
7661 if test "$with_system_zlib" = "yes"; then
7662     AC_MSG_RESULT([external])
7663     SYSTEM_ZLIB=TRUE
7664     if test "$_os" != "Emscripten"; then
7665         # Emscripten provides its own zlib, don't check for that
7666         AC_CHECK_HEADER(zlib.h, [],
7667             [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7668         AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7669             [AC_MSG_ERROR(zlib not found or functional)], [])
7670     fi
7671 else
7672     AC_MSG_RESULT([internal])
7673     SYSTEM_ZLIB=
7674     BUILD_TYPE="$BUILD_TYPE ZLIB"
7675     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7676     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7678 AC_SUBST(ZLIB_CFLAGS)
7679 AC_SUBST(ZLIB_LIBS)
7680 AC_SUBST(SYSTEM_ZLIB)
7682 dnl ===================================================================
7683 dnl Check for system jpeg
7684 dnl ===================================================================
7685 AC_MSG_CHECKING([which libjpeg to use])
7686 if test "$with_jpeg_turbo" = "auto"; then
7687     # TODO use jpeg-turbo on Darwin too
7688     case "$_os" in
7689     WINNT)
7690         with_jpeg_turbo=yes
7691         ;;
7692     *)
7693         with_jpeg_turbo=no
7694         ;;
7695     esac
7698 if test "$with_system_jpeg" = "yes"; then
7699     AC_MSG_RESULT([external])
7700     SYSTEM_JPEG=TRUE
7701     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7702         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7703     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7704         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7705     libo_MINGW_CHECK_DLL([libjpeg])
7706 else
7707     SYSTEM_JPEG=
7708     if test "$with_jpeg_turbo" = "yes"; then
7709         AC_MSG_RESULT([internal, jpeg-turbo])
7710         BUILD_TYPE="$BUILD_TYPE JPEG_TURBO"
7711         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7713         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7714             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7715                 NASM="$LODE_HOME/opt/bin/nasm"
7716             elif test -x "/opt/lo/bin/nasm"; then
7717                 NASM="/opt/lo/bin/nasm"
7718             fi
7719         fi
7720         if test -z "$NASM"; then
7721 cat << _EOS
7722 ****************************************************************************
7723 You need nasm (Netwide Assembler) to build internal jpeg library.
7724 To get one please do:
7726 _EOS
7727         if test "$build_os" = "cygwin"; then
7728 cat << _EOS
7729 install a pre-compiled binary for Win32
7731  mkdir -p /opt/lo/bin
7732  cd /opt/lo/bin
7733  wget http://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7734  chmod +x nasm
7735 _EOS
7736             else
7737 cat << _EOS
7738 consult http://svn.code.sf.net/p/libjpeg-turbo/code/trunk/BUILDING.txt
7739 _EOS
7740             fi
7741 cat << _EOS
7743 or get and install one from http://www.nasm.us/
7745 Then re-run autogen.sh
7747 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7748 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7750 _EOS
7751         AC_MSG_ERROR([no nasm (Netwide Assembler) found])
7752         fi
7753         LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg-turbo"
7754         if test "$COM" = "MSC"; then
7755             LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs/libjpeg.lib"
7756         else
7757             LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/jpeg-turbo/.libs -ljpeg"
7758         fi
7759     else
7760         AC_MSG_RESULT([internal, jpeg])
7761         BUILD_TYPE="$BUILD_TYPE JPEG"
7762         LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/jpeg"
7763         if test "$COM" = "MSC"; then
7764             LIBJPEG_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/libjpeg.lib"
7765         else
7766             LIBJPEG_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -ljpeg"
7767         fi
7768     fi
7770 AC_SUBST(NASM)
7771 AC_SUBST(LIBJPEG_CFLAGS)
7772 AC_SUBST(LIBJPEG_LIBS)
7773 AC_SUBST(SYSTEM_JPEG)
7775 dnl ===================================================================
7776 dnl Check for system clucene
7777 dnl ===================================================================
7778 dnl we should rather be using
7779 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7780 dnl but the contribs-lib check seems tricky
7781 AC_MSG_CHECKING([which clucene to use])
7782 if test "$with_system_clucene" = "yes"; then
7783     AC_MSG_RESULT([external])
7784     SYSTEM_CLUCENE=TRUE
7785     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7786     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7787     FilterLibs "${CLUCENE_LIBS}"
7788     CLUCENE_LIBS="${filteredlibs}"
7789     AC_LANG_PUSH([C++])
7790     save_CXXFLAGS=$CXXFLAGS
7791     save_CPPFLAGS=$CPPFLAGS
7792     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7793     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7794     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7795     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7796     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7797                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7798     CXXFLAGS=$save_CXXFLAGS
7799     CPPFLAGS=$save_CPPFLAGS
7800     AC_LANG_POP([C++])
7802     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7803 else
7804     AC_MSG_RESULT([internal])
7805     SYSTEM_CLUCENE=
7806     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7808 AC_SUBST(SYSTEM_CLUCENE)
7809 AC_SUBST(CLUCENE_CFLAGS)
7810 AC_SUBST(CLUCENE_LIBS)
7812 dnl ===================================================================
7813 dnl Check for system expat
7814 dnl ===================================================================
7815 dnl we should use libo_CHECK_SYSTEM_MODULE, but e.g. the mingw tinderbox has no
7816 dnl proper pkg-config for it. It should really be fixed on the tinderbox though.
7817 AC_MSG_CHECKING([which expat to use])
7818 if test "$with_system_expat" = "yes"; then
7819     AC_MSG_RESULT([external])
7820     SYSTEM_EXPAT=TRUE
7821     AC_CHECK_HEADER(expat.h, [],
7822         [AC_MSG_ERROR(expat.h not found. install expat)], [])
7823     AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
7824         [AC_MSG_RESULT(expat library not found or functional.)], [])
7825     libo_MINGW_CHECK_DLL([libexpat])
7826 else
7827     AC_MSG_RESULT([internal])
7828     SYSTEM_EXPAT=
7829     BUILD_TYPE="$BUILD_TYPE EXPAT"
7831 AC_SUBST(SYSTEM_EXPAT)
7833 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7834 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7835     ENABLE_EOT="TRUE"
7836     AC_DEFINE([ENABLE_EOT])
7837     AC_MSG_RESULT([yes])
7839     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7840 else
7841     ENABLE_EOT=
7842     AC_MSG_RESULT([no])
7844 AC_SUBST([ENABLE_EOT])
7846 dnl ===================================================================
7847 dnl Check for DLP libs
7848 dnl ===================================================================
7849 AS_IF([test "$COM" = "MSC"],
7850       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7851       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7853 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7855 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7857 AS_IF([test "$COM" = "MSC"],
7858       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7859       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7861 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7863 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7865 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7866 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.4])
7868 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7870 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7872 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7874 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7875 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.9])
7877 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7878 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
7880 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7882 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7883 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7885 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7887 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7889 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7891 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7892 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.2])
7894 dnl ===================================================================
7895 dnl Check for system libcmis
7896 dnl ===================================================================
7897 # libcmis requires curl and we can't build curl for iOS
7898 if test $_os != iOS; then
7899     libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.5 >= 0.5.0])
7900     ENABLE_CMIS=TRUE
7901 else
7902     ENABLE_CMIS=
7904 AC_SUBST(ENABLE_CMIS)
7906 dnl ===================================================================
7907 dnl Check for system lcms2
7908 dnl ===================================================================
7909 if test "$with_system_lcms2" = "yes"; then
7910     libo_MINGW_CHECK_DLL([liblcms2])
7911 else
7912     SYSTEM_LCMS2=
7914 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7915 if test "$GCC" = "yes"; then
7916     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7918 if test "$COM" = "MSC"; then # override the above
7919     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7922 dnl ===================================================================
7923 dnl Check for system cppunit
7924 dnl ===================================================================
7925 if test "$cross_compiling" != "yes"; then
7926     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
7929 dnl ===================================================================
7930 dnl Check whether freetype is available
7931 dnl ===================================================================
7932 if test  "$test_freetype" = "yes"; then
7933     AC_MSG_CHECKING([whether freetype is available])
7934     # FreeType has 3 different kinds of versions
7935     # * release, like 2.4.10
7936     # * libtool, like 13.0.7 (this what pkg-config returns)
7937     # * soname
7938     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7939     #
7940     # 9.9.3 is 2.2.0
7941     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7942     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7943     FilterLibs "${FREETYPE_LIBS}"
7944     FREETYPE_LIBS="${filteredlibs}"
7945     SYSTEM_FREETYPE=TRUE
7946     _save_libs="$LIBS"
7947     _save_cflags="$CFLAGS"
7948     LIBS="$LIBS $FREETYPE_LIBS"
7949     CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
7950     AC_CHECK_FUNC(FT_Face_GetCharVariantIndex, AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX), [])
7951     LIBS="$_save_libs"
7952     CFLAGS="$_save_cflags"
7954 AC_SUBST(FREETYPE_CFLAGS)
7955 AC_SUBST(FREETYPE_LIBS)
7956 AC_SUBST([SYSTEM_FREETYPE])
7958 # ===================================================================
7959 # Check for system libxslt
7960 # to prevent incompatibilities between internal libxml2 and external libxslt,
7961 # or vice versa, use with_system_libxml here
7962 # ===================================================================
7963 if test "$with_system_libxml" = "auto"; then
7964     case "$_os" in
7965     WINNT|iOS|Android)
7966         with_system_libxml="$with_system_libs"
7967         ;;
7968     *)
7969         with_system_libxml=yes
7970         ;;
7971     esac
7974 AC_MSG_CHECKING([which libxslt to use])
7975 if test "$with_system_libxml" = "yes"; then
7976     AC_MSG_RESULT([external])
7977     SYSTEM_LIBXSLT=TRUE
7978     if test "$_os" = "Darwin"; then
7979         dnl make sure to use SDK path
7980         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7981         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7982         dnl omit -L/usr/lib
7983         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7984         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7985     else
7986         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7987         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7988         FilterLibs "${LIBXSLT_LIBS}"
7989         LIBXSLT_LIBS="${filteredlibs}"
7990         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7991         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7992         FilterLibs "${LIBEXSLT_LIBS}"
7993         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7994     fi
7996     dnl Check for xsltproc
7997     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7998     if test "$XSLTPROC" = "no"; then
7999         AC_MSG_ERROR([xsltproc is required])
8000     fi
8002     libo_MINGW_CHECK_DLL([libxslt])
8003     libo_MINGW_CHECK_DLL([libexslt])
8004     libo_MINGW_TRY_DLL([iconv])
8005 else
8006     AC_MSG_RESULT([internal])
8007     SYSTEM_LIBXSLT=
8008     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8010     if test "$cross_compiling" = "yes"; then
8011         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8012         if test "$XSLTPROC" = "no"; then
8013             AC_MSG_ERROR([xsltproc is required])
8014         fi
8015     fi
8017 AC_SUBST(SYSTEM_LIBXSLT)
8018 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8019     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8021 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8023 AC_SUBST(LIBEXSLT_CFLAGS)
8024 AC_SUBST(LIBEXSLT_LIBS)
8025 AC_SUBST(LIBXSLT_CFLAGS)
8026 AC_SUBST(LIBXSLT_LIBS)
8027 AC_SUBST(XSLTPROC)
8029 # ===================================================================
8030 # Check for system libxml
8031 # ===================================================================
8032 AC_MSG_CHECKING([which libxml to use])
8033 if test "$with_system_libxml" = "yes"; then
8034     AC_MSG_RESULT([external])
8035     SYSTEM_LIBXML=TRUE
8036     if test "$_os" = "Darwin"; then
8037         dnl make sure to use SDK path
8038         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8039         dnl omit -L/usr/lib
8040         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8041     elif test $_os = iOS; then
8042         dnl make sure to use SDK path
8043         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8044         LIBXML_CFLAGS="-I$usr/include/libxml2"
8045         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8046     else
8047         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8048         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8049         FilterLibs "${LIBXML_LIBS}"
8050         LIBXML_LIBS="${filteredlibs}"
8051     fi
8053     dnl Check for xmllint
8054     AC_PATH_PROG(XMLLINT, xmllint, no)
8055     if test "$XMLLINT" = "no"; then
8056         AC_MSG_ERROR([xmllint is required])
8057     fi
8059     libo_MINGW_CHECK_DLL([libxml2])
8060     libo_MINGW_TRY_DLL([zlib1])
8061 else
8062     AC_MSG_RESULT([internal])
8063     SYSTEM_LIBXML=
8064     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/xml2/include"
8065     if test "$COM" = "MSC"; then
8066         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8067     fi
8068     if test "$COM" = "MSC"; then
8069         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/xml2/win32/bin.msvc/libxml2.lib"
8070     else
8071         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/xml2/.libs -lxml2"
8072     fi
8073     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8075 AC_SUBST(SYSTEM_LIBXML)
8076 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8077     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8079 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8080 AC_SUBST(LIBXML_CFLAGS)
8081 AC_SUBST(LIBXML_LIBS)
8082 AC_SUBST(XMLLINT)
8084 # =====================================================================
8085 # Checking for a Python interpreter with version >= 2.6.
8086 # Build and runtime requires Python 3 compatible version (>= 2.6).
8087 # Optionally user can pass an option to configure, i. e.
8088 # ./configure PYTHON=/usr/bin/python
8089 # =====================================================================
8090 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8091     # This allows a lack of system python with no error, we use internal one in that case.
8092     AM_PATH_PYTHON([2.6],, [:])
8093     # Clean PYTHON_VERSION checked below if cross-compiling
8094     PYTHON_VERSION=""
8095     if test "$PYTHON" != ":"; then
8096         PYTHON_FOR_BUILD=$PYTHON
8097     fi
8099 AC_SUBST(PYTHON_FOR_BUILD)
8101 # Checks for Python to use for Pyuno
8102 AC_MSG_CHECKING([which Python to use for Pyuno])
8103 case "$enable_python" in
8104 no|disable)
8105     if test -z $PYTHON_FOR_BUILD; then
8106         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8107         # requirement from the choice whether to include Python stuff in the installer, but why
8108         # bother?
8109         AC_MSG_ERROR([Python is required at build time.])
8110     fi
8111     enable_python=no
8112     AC_MSG_RESULT([none])
8113     ;;
8114 ""|yes|auto)
8115     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8116         AC_MSG_RESULT([no, overridden by --disable-scripting])
8117         enable_python=no
8118     elif test $build_os = cygwin; then
8119         dnl When building on Windows we don't attempt to use any installed
8120         dnl "system"  Python.
8121         dnl
8122         dnl (When cross-compiling to Windows from Linux using the mingw32-cross
8123         dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
8124         dnl MinGW cross-compilation setups.)
8125         AC_MSG_RESULT([fully internal])
8126         enable_python=internal
8127     elif test "$cross_compiling" = yes; then
8128         AC_MSG_RESULT([system])
8129         enable_python=system
8130     else
8131         # Unset variables set by the above AM_PATH_PYTHON so that
8132         # we actually do check anew.
8133         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
8134         AM_PATH_PYTHON([3.3],, [:])
8135         if test "$PYTHON" = ":"; then
8136             if test -z "$PYTHON_FOR_BUILD"; then
8137                 AC_MSG_RESULT([fully internal])
8138             else
8139                 AC_MSG_RESULT([internal])
8140             fi
8141             enable_python=internal
8142         else
8143             AC_MSG_RESULT([system])
8144             enable_python=system
8145         fi
8146     fi
8147     ;;
8148 internal)
8149     AC_MSG_RESULT([internal])
8150     ;;
8151 fully-internal)
8152     AC_MSG_RESULT([fully internal])
8153     enable_python=internal
8154     ;;
8155 system)
8156     AC_MSG_RESULT([system])
8157     ;;
8159     AC_MSG_ERROR([Incorrect --enable-python option])
8160     ;;
8161 esac
8163 if test $enable_python != no; then
8164     BUILD_TYPE="$BUILD_TYPE PYUNO"
8167 if test $enable_python = system; then
8168     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8169         python_version=2.7
8170         PYTHON=python$python_version
8171         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8172             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8173             PYTHON_LIBS="-framework Python"
8174         else
8175             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8176             PYTHON_LIBS="`$PYTHON-config --libs`"
8177         fi
8178     fi
8179     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8180         # Fallback: Accept these in the environment, or as set above
8181         # for MacOSX.
8182         :
8183     elif test "$cross_compiling" != yes; then
8184         # Unset variables set by the above AM_PATH_PYTHON so that
8185         # we actually do check anew.
8186         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
8187         # This causes an error if no python command is found
8188         AM_PATH_PYTHON([3.3])
8189         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8190         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8191         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8192         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8193         if test -z "$PKG_CONFIG"; then
8194             PYTHON_CFLAGS="-I$python_include"
8195             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8196         elif $PKG_CONFIG --exists python-$python_version; then
8197             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8198             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8199         else
8200             PYTHON_CFLAGS="-I$python_include"
8201             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8202         fi
8203         FilterLibs "${PYTHON_LIBS}"
8204         PYTHON_LIBS="${filteredlibs}"
8205     else
8206         dnl How to find out the cross-compilation Python installation path?
8207         dnl Let's hardocode what we know for different distributions for now...
8208         for python_version in 2.6; do
8209             if test -f ${MINGW_SYSROOT}/include/python${python_version}/Python.h; then
8210                 PYTHON_CFLAGS="-I${MINGW_SYSROOT}/include/python$python_version"
8211                 PYTHON_LIBS="-L${MINGW_SYSROOT}/lib -lpython$python_version $python_libs"
8212                 AC_MSG_CHECKING([for python.exe])
8213                 libo_MINGW_CHECK_DLL([libpython$python_version])
8214                 libo_MINGW_CHECK_DLL([libreadline6])
8215                 libo_MINGW_CHECK_DLL([libtermcap])
8216                 # could we somehow extract the really mingw python version from
8217                 # actual distro package?
8218                 # 2.6.2 currently on OpenSUSE 12.1?
8219                 # rpm -q mingw32-python => mingw32-python-2.6.2-17.17.noarch
8220                 PYTHON_VERSION=$python_version.2
8221                 PYTHON_VERSION_MAJOR=`echo $python_version | cut -d . -f 1`
8222                 PYTHON_VERSION_MINOR=`echo $python_version | cut -d . -f 2`
8223                 break
8224             fi
8225         done
8226         AC_MSG_CHECKING([for python version])
8227         AS_IF([test -n "$PYTHON_VERSION"],
8228               [AC_MSG_RESULT([$PYTHON_VERSION])],
8229               [AC_MSG_RESULT([not found])
8230                AC_MSG_ERROR([no usable python found])])
8231         test -n "$PYTHON_CFLAGS" && break
8232     fi
8233     # let the PYTHON_FOR_BUILD match the same python installation that
8234     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8235     # better for PythonTests.
8236     PYTHON_FOR_BUILD=$PYTHON
8239 dnl By now enable_python should be "system", "internal" or "no"
8240 case $enable_python in
8241 system)
8242     SYSTEM_PYTHON=TRUE
8244     dnl Check if the headers really work
8245     save_CPPFLAGS="$CPPFLAGS"
8246     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8247     AC_CHECK_HEADER(Python.h, [],
8248        [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
8249        [])
8250     CPPFLAGS="$save_CPPFLAGS"
8252     AC_LANG_PUSH(C)
8253     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8254     AC_MSG_CHECKING([for correct python library version])
8255        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8256 #include <Python.h>
8258 int main(int argc, char **argv) {
8259    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6) ||
8260        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8261    else return 1;
8263        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.6 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8264     CFLAGS=$save_CFLAGS
8265     AC_LANG_POP(C)
8267     dnl FIXME Check if the Python library can be linked with, too?
8268     ;;
8270 internal)
8271     SYSTEM_PYTHON=
8272     PYTHON_VERSION_MAJOR=3
8273     # On windows we are supporting two different python versions: 3.3 and 3.5.
8274     # We msut do it as long as we support MSVC 2013. Python 3.3 can be removed
8275     # when MSVC 2013 support was dropped.
8276     if test "$COM" = "MSC" -a "$VCVER" = "120"; then
8277         PYTHON_VERSION_MINOR=3
8278     else
8279         PYTHON_VERSION_MINOR=5
8280     fi
8281     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.0
8282     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8283     BUILD_TYPE="$BUILD_TYPE PYTHON"
8284     # Embedded Python dies without Home set
8285     if test "$HOME" = ""; then
8286         export HOME=""
8287     fi
8288     # bz2 tarball and bzip2 is not standard
8289     if test -z "$BZIP2"; then
8290         AC_PATH_PROG( BZIP2, bzip2)
8291         if test -z "$BZIP2"; then
8292             AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
8293         fi
8294     fi
8295     ;;
8297     DISABLE_PYTHON=TRUE
8298     SYSTEM_PYTHON=
8299     ;;
8301     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8302     ;;
8303 esac
8305 AC_SUBST(DISABLE_PYTHON)
8306 AC_SUBST(SYSTEM_PYTHON)
8307 AC_SUBST(PYTHON_CFLAGS)
8308 AC_SUBST(PYTHON_LIBS)
8309 AC_SUBST(PYTHON_VERSION)
8310 AC_SUBST(PYTHON_VERSION_MAJOR)
8311 AC_SUBST(PYTHON_VERSION_MINOR)
8313 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8314 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8315     AC_MSG_RESULT([yes])
8316     ENABLE_MARIADBC=TRUE
8317     MARIADBC_MAJOR=1
8318     MARIADBC_MINOR=0
8319     MARIADBC_MICRO=2
8320     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8321 else
8322     AC_MSG_RESULT([no])
8323     ENABLE_MARIADBC=
8325 AC_SUBST(ENABLE_MARIADBC)
8326 AC_SUBST(MARIADBC_MAJOR)
8327 AC_SUBST(MARIADBC_MINOR)
8328 AC_SUBST(MARIADBC_MICRO)
8330 if test "$ENABLE_MARIADBC" = "TRUE"; then
8332     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8334     dnl ===================================================================
8335     dnl Check for system MariaDB
8336     dnl ===================================================================
8337     AC_MSG_CHECKING([which MariaDB to use])
8338     if test "$with_system_mariadb" = "yes"; then
8339         AC_MSG_RESULT([external])
8340         SYSTEM_MARIADB=TRUE
8341         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8342         if test -z "$MARIADBCONFIG"; then
8343             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8344             if test -z "$MARIADBCONFIG"; then
8345                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8346                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8347             fi
8348         fi
8349         AC_MSG_CHECKING([MariaDB version])
8350         MARIADB_VERSION=`$MARIADBCONFIG --version`
8351         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8352         if test "$MARIADB_MAJOR" -ge "5"; then
8353             AC_MSG_RESULT([OK])
8354         else
8355             AC_MSG_ERROR([too old, use 5.0.x or later])
8356         fi
8357         AC_MSG_CHECKING([for MariaDB Client library])
8358         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8359         if test "$COM_IS_CLANG" = TRUE; then
8360             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8361         fi
8362         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8363         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8364         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8365         dnl linux32:
8366         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8367             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8368             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8369                 | sed -e 's|/lib64/|/lib/|')
8370         fi
8371         FilterLibs "${MARIADB_LIBS}"
8372         MARIADB_LIBS="${filteredlibs}"
8373         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8374         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8375         if test "$enable_bundle_mariadb" = "yes"; then
8376             AC_MSG_RESULT([yes])
8377             BUNDLE_MARIADB=TRUE
8378             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8380 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8382 /g' | grep -E '(mysqlclient|mariadb)')
8383             if test "$_os" = "Darwin"; then
8384                 LIBMARIADB=${LIBMARIADB}.dylib
8385             elif test "$_os" = "WINNT"; then
8386                 LIBMARIADB=${LIBMARIADB}.dll
8387             else
8388                 LIBMARIADB=${LIBMARIADB}.so
8389             fi
8390             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8391             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8392             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8393                 AC_MSG_RESULT([found.])
8394                 PathFormat "$LIBMARIADB_PATH"
8395                 LIBMARIADB_PATH="$formatted_path"
8396             else
8397                 AC_MSG_ERROR([not found.])
8398             fi
8399         else
8400             AC_MSG_RESULT([no])
8401             BUNDLE_MARIADB=
8402         fi
8403     else
8404         AC_MSG_RESULT([internal])
8405         SYSTEM_MARIADB=
8406         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb/include"
8407         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadblib"
8408         BUILD_TYPE="$BUILD_TYPE MARIADB"
8409     fi
8411     AC_SUBST(SYSTEM_MARIADB)
8412     AC_SUBST(MARIADB_CFLAGS)
8413     AC_SUBST(MARIADB_LIBS)
8414     AC_SUBST(LIBMARIADB)
8415     AC_SUBST(LIBMARIADB_PATH)
8416     AC_SUBST(BUNDLE_MARIADB)
8418     AC_LANG_PUSH([C++])
8419     dnl ===================================================================
8420     dnl Check for system MySQL C++ Connector
8421     dnl ===================================================================
8422     # FIXME!
8423     # who thought this too-generic cppconn dir was a good idea?
8424     AC_MSG_CHECKING([MySQL Connector/C++])
8425     if test "$with_system_mysql_cppconn" = "yes"; then
8426         AC_MSG_RESULT([external])
8427         SYSTEM_MYSQL_CPPCONN=TRUE
8428         AC_LANG_PUSH([C++])
8429         AC_CHECK_HEADER(mysql_driver.h, [],
8430                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8431         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8432                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8433         save_LIBS=$LIBS
8434         LIBS="$LIBS -lmysqlcppconn"
8435         AC_MSG_CHECKING([version])
8436         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8437 #include <mysql_driver.h>
8439 int main(int argc, char **argv) {
8440     sql::Driver *driver;
8441     driver = get_driver_instance();
8442     if (driver->getMajorVersion() > 1 || \
8443        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8444        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8445         return 0;
8446       else
8447         return 1;
8449       ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[AC_MSG_ERROR([MySQL C++ Connecter not tested with cross-compilation])])
8451         AC_LANG_POP([C++])
8452         LIBS=$save_LIBS
8453     else
8454         AC_MSG_RESULT([internal])
8455         BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN"
8456         SYSTEM_MYSQL_CPPCONN=
8457     fi
8458     AC_LANG_POP([C++])
8460 AC_SUBST(SYSTEM_MYSQL_CPPCONN)
8462 dnl ===================================================================
8463 dnl Check for system hsqldb
8464 dnl ===================================================================
8465 if test "$with_java" != "no"; then
8466     HSQLDB_USE_JDBC_4_1=
8467     AC_MSG_CHECKING([which hsqldb to use])
8468     if test "$with_system_hsqldb" = "yes"; then
8469         AC_MSG_RESULT([external])
8470         SYSTEM_HSQLDB=TRUE
8471         if test -z $HSQLDB_JAR; then
8472             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8473         fi
8474         if ! test -f $HSQLDB_JAR; then
8475                AC_MSG_ERROR(hsqldb.jar not found.)
8476         fi
8477         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8478         export HSQLDB_JAR
8479         if $PERL -e \
8480            'use Archive::Zip;
8481             my $file = "$ENV{'HSQLDB_JAR'}";
8482             my $zip = Archive::Zip->new( $file );
8483             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8484             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8485             {
8486                 push @l, split(/\n/, $mf);
8487                 foreach my $line (@l)
8488                 {
8489                     if ($line =~ m/Specification-Version:/)
8490                     {
8491                         ($t, $version) = split (/:/,$line);
8492                         $version =~ s/^\s//;
8493                         ($a, $b, $c, $d) = split (/\./,$version);
8494                         if ($c == "0" && $d > "8")
8495                         {
8496                             exit 0;
8497                         }
8498                         else
8499                         {
8500                             exit 1;
8501                         }
8502                     }
8503                 }
8504             }
8505             else
8506             {
8507                 exit 1;
8508             }'; then
8509             AC_MSG_RESULT([yes])
8510         else
8511             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8512         fi
8513     else
8514         AC_MSG_RESULT([internal])
8515         SYSTEM_HSQLDB=
8516         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8517         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8518         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8519         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8520             AC_MSG_RESULT([yes])
8521             HSQLDB_USE_JDBC_4_1=TRUE
8522         else
8523             AC_MSG_RESULT([no])
8524         fi
8525     fi
8526     AC_SUBST(SYSTEM_HSQLDB)
8527     AC_SUBST(HSQLDB_JAR)
8528     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8531 dnl ===================================================================
8532 dnl Check for PostgreSQL stuff
8533 dnl ===================================================================
8534 if test "x$enable_postgresql_sdbc" != "xno"; then
8535     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8537     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8538         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8539     fi
8540     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8541         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8542     fi
8544     postgres_interface=""
8545     if test "$with_system_postgresql" = "yes"; then
8546         postgres_interface="external PostgreSQL"
8547         SYSTEM_POSTGRESQL=TRUE
8548         if test "$_os" = Darwin; then
8549             supp_path=''
8550             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8551                 pg_supp_path="$P_SEP$d$pg_supp_path"
8552             done
8553         fi
8554         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8555         if test -z "$PGCONFIG"; then
8556             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8557         fi
8558         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8559         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8560         FilterLibs "${POSTGRESQL_LIB}"
8561         POSTGRESQL_LIB="${filteredlibs}"
8562     else
8563         # if/when anything else than PostgreSQL uses Kerberos,
8564         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8565         WITH_KRB5=
8566         WITH_GSSAPI=
8567         case "$_os" in
8568         Darwin)
8569             # MacOS X has system MIT Kerberos 5 since 10.4
8570             if test "$with_krb5" != "no"; then
8571                 WITH_KRB5=TRUE
8572                 save_LIBS=$LIBS
8573                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8574                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5, try installing libcom_err devel package])])
8575                 KRB5_LIBS=$LIBS
8576                 LIBS=$save_LIBS
8577                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8578                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5, try installing krb5 devel package])])
8579                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8580                 LIBS=$save_LIBS
8581             fi
8582             if test "$with_gssapi" != "no"; then
8583                 WITH_GSSAPI=TRUE
8584                 save_LIBS=$LIBS
8585                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8586                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8587                 GSSAPI_LIBS=$LIBS
8588                 LIBS=$save_LIBS
8589             fi
8590             ;;
8591         WINNT)
8592             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8593                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8594             fi
8595             ;;
8596         Linux|GNU|*BSD|DragonFly)
8597             if test "$with_krb5" != "no"; then
8598                 WITH_KRB5=TRUE
8599                 save_LIBS=$LIBS
8600                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8601                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8602                 KRB5_LIBS=$LIBS
8603                 LIBS=$save_LIBS
8604                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8605                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8606                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8607                 LIBS=$save_LIBS
8608             fi
8609             if test "$with_gssapi" != "no"; then
8610                 WITH_GSSAPI=TRUE
8611                 save_LIBS=$LIBS
8612                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8613                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8614                 GSSAPI_LIBS=$LIBS
8615                 LIBS=$save_LIBS
8616             fi
8617             ;;
8618         *)
8619             if test "$with_krb5" = "yes"; then
8620                 WITH_KRB5=TRUE
8621                 save_LIBS=$LIBS
8622                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8623                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8624                 KRB5_LIBS=$LIBS
8625                 LIBS=$save_LIBS
8626                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8627                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8628                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8629                 LIBS=$save_LIBS
8630             fi
8631             if test "$with_gssapi" = "yes"; then
8632                 WITH_GSSAPI=TRUE
8633                 save_LIBS=$LIBS
8634                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8635                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8636                 LIBS=$save_LIBS
8637                 GSSAPI_LIBS=$LIBS
8638             fi
8639         esac
8641         if test -n "$with_libpq_path"; then
8642             SYSTEM_POSTGRESQL=TRUE
8643             postgres_interface="external libpq"
8644             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8645             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8646         else
8647             SYSTEM_POSTGRESQL=
8648             postgres_interface="internal"
8649             POSTGRESQL_LIB=""
8650             POSTGRESQL_INC="%OVERRIDE_ME%"
8651             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8652         fi
8653     fi
8655     AC_MSG_CHECKING([PostgreSQL C interface])
8656     AC_MSG_RESULT([$postgres_interface])
8658     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8659         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8660         save_CFLAGS=$CFLAGS
8661         save_CPPFLAGS=$CPPFLAGS
8662         save_LIBS=$LIBS
8663         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8664         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8665         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8666         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8667             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8668         CFLAGS=$save_CFLAGS
8669         CPPFLAGS=$save_CPPFLAGS
8670         LIBS=$save_LIBS
8671     fi
8672     BUILD_POSTGRESQL_SDBC=TRUE
8674 AC_SUBST(WITH_KRB5)
8675 AC_SUBST(WITH_GSSAPI)
8676 AC_SUBST(GSSAPI_LIBS)
8677 AC_SUBST(KRB5_LIBS)
8678 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8679 AC_SUBST(SYSTEM_POSTGRESQL)
8680 AC_SUBST(POSTGRESQL_INC)
8681 AC_SUBST(POSTGRESQL_LIB)
8683 dnl ===================================================================
8684 dnl Check for Firebird stuff
8685 dnl ===================================================================
8686 ENABLE_FIREBIRD_SDBC=""
8687 if test "$enable_firebird_sdbc" = "yes" ; then
8688     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8690     dnl ===================================================================
8691     dnl Check for system Firebird
8692     dnl ===================================================================
8693     AC_MSG_CHECKING([which Firebird to use])
8694     if test "$with_system_firebird" = "yes"; then
8695         AC_MSG_RESULT([external])
8696         SYSTEM_FIREBIRD=TRUE
8697         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8698         if test -z "$FIREBIRDCONFIG"; then
8699             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8700             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8701                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8702             ])
8703             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8704         else
8705             AC_MSG_NOTICE([fb_config found])
8706             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8707             AC_MSG_CHECKING([for Firebird Client library])
8708             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8709             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8710             FilterLibs "${FIREBIRD_LIBS}"
8711             FIREBIRD_LIBS="${filteredlibs}"
8712         fi
8713         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8714         AC_MSG_CHECKING([Firebird version])
8715         if test -n "${FIREBIRD_VERSION}"; then
8716             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8717             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8718             if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then
8719                 AC_MSG_RESULT([OK])
8720             elif test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8721                 AC_DEFINE(HAVE_FIREBIRD_30, 1)
8722                 AC_MSG_RESULT([OK])
8723             else
8724                 AC_MSG_ERROR([Ensure firebird 2.5.x or 3.0.x is installed])
8725             fi
8726         else
8727             __save_CFLAGS="${CFLAGS}"
8728             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8729             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8730 #if defined(FB_API_VER) && FB_API_VER == 25
8731 int fb_api_is_25(void) { return 0; }
8732 #elif defined(FB_API_VER) && FB_API_VER == 30
8733 int fb_api_is_30(void) { return 0; }
8734 #else
8735 #error "Wrong Firebird API version"
8736 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x or 3.0.x is installed]))
8737             if nm conftest.$OBJEXT | grep fb_api_is_30; then
8738                 AC_DEFINE(HAVE_FIREBIRD_30, 1)
8739             fi
8740             CFLAGS="${__save_CFLAGS}"
8741         fi
8742         ENABLE_FIREBIRD_SDBC="TRUE"
8743     elif test "$enable_database_connectivity" != yes; then
8744         AC_MSG_RESULT([none])
8745     elif test "$cross_compiling" = "yes"; then
8746         AC_MSG_RESULT([none])
8747     else
8748         dnl Embedded Firebird has version 3.0
8749         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8750         dnl We need libatomic-ops for any non X86/X64 system
8751         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8752             dnl ===================================================================
8753             dnl Check for system libatomic-ops
8754             dnl ===================================================================
8755             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8756             if test "$with_system_libatomic_ops" = "yes"; then
8757                 SYSTEM_LIBATOMIC_OPS=TRUE
8758                 AC_CHECK_HEADERS(atomic_ops.h, [],
8759                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8760             else
8761                 SYSTEM_LIBATOMIC_OPS=
8762                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8763                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8764                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8765             fi
8766         fi
8768         AC_MSG_RESULT([internal])
8769         SYSTEM_FIREBIRD=
8770         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8771         FIREBIRD_LIBS="-lfbclient"
8773         if test "$with_system_libtommath" = "yes"; then
8774             SYSTEM_LIBTOMMATH=TRUE
8775             dnl check for tommath presence
8776             save_LIBS=$LIBS
8777             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8778             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8779             LIBS=$save_LIBS
8780         else
8781             SYSTEM_LIBTOMMATH=
8782             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8783             LIBTOMMATH_LIBS="-ltommath"
8784             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8785         fi
8787         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8788         ENABLE_FIREBIRD_SDBC="TRUE"
8789     fi
8791 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8792 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8793 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8794 AC_SUBST(LIBATOMIC_OPS_LIBS)
8795 AC_SUBST(SYSTEM_FIREBIRD)
8796 AC_SUBST(FIREBIRD_CFLAGS)
8797 AC_SUBST(FIREBIRD_LIBS)
8798 AC_SUBST(HAVE_FIREBIRD_30)
8799 AC_SUBST([TOMMATH_CFLAGS])
8800 AC_SUBST([TOMMATH_LIBS])
8802 dnl ===================================================================
8803 dnl Check for system curl
8804 dnl ===================================================================
8805 AC_MSG_CHECKING([which libcurl to use])
8806 if test "$with_system_curl" = "auto"; then
8807     with_system_curl="$with_system_libs"
8810 if test "$with_system_curl" = "yes"; then
8811     AC_MSG_RESULT([external])
8812     SYSTEM_CURL=TRUE
8814     # First try PKGCONFIG and then fall back
8815     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8817     if test -n "$CURL_PKG_ERRORS"; then
8818         AC_PATH_PROG(CURLCONFIG, curl-config)
8819         if test -z "$CURLCONFIG"; then
8820             AC_MSG_ERROR([curl development files not found])
8821         fi
8822         CURL_LIBS=`$CURLCONFIG --libs`
8823         FilterLibs "${CURL_LIBS}"
8824         CURL_LIBS="${filteredlibs}"
8825         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8826         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8828         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8829         case $curl_version in
8830         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8831         dnl so they need to be doubled to end up in the configure script
8832         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8833             AC_MSG_RESULT([yes])
8834             ;;
8835         *)
8836             AC_MSG_ERROR([no, you have $curl_version])
8837             ;;
8838         esac
8839     fi
8841     libo_MINGW_CHECK_DLL([libcurl])
8842     libo_MINGW_TRY_DLL([libintl])
8843     libo_MINGW_TRY_DLL([libidn])
8844     libo_MINGW_TRY_DLL([libnspr4])
8845     libo_MINGW_TRY_DLL([nssutil3])
8846     libo_MINGW_TRY_DLL([libplc4])
8847     libo_MINGW_TRY_DLL([libplds4])
8848     libo_MINGW_TRY_DLL([nss3])
8849     libo_MINGW_TRY_DLL([ssl3])
8850     libo_MINGW_TRY_DLL([libgpg-error])
8851     libo_MINGW_TRY_DLL([libgcrypt])
8852     libo_MINGW_TRY_DLL([libssh2])
8853     ENABLE_CURL=TRUE
8854 elif test $_os = iOS; then
8855     # Let's see if we need curl, I think not?
8856     AC_MSG_RESULT([none])
8857     ENABLE_CURL=
8858 else
8859     AC_MSG_RESULT([internal])
8860     SYSTEM_CURL=
8861     BUILD_TYPE="$BUILD_TYPE CURL"
8862     ENABLE_CURL=TRUE
8864 AC_SUBST(SYSTEM_CURL)
8865 AC_SUBST(CURL_CFLAGS)
8866 AC_SUBST(CURL_LIBS)
8867 AC_SUBST(ENABLE_CURL)
8869 dnl ===================================================================
8870 dnl Check for system boost
8871 dnl ===================================================================
8872 AC_MSG_CHECKING([which boost to use])
8873 if test "$with_system_boost" = "yes"; then
8874     AC_MSG_RESULT([external])
8875     SYSTEM_BOOST=TRUE
8876     AX_BOOST_BASE(1.47)
8877     AX_BOOST_DATE_TIME
8878     AX_BOOST_FILESYSTEM
8879     AX_BOOST_IOSTREAMS
8880     mingw_boost_date_time_dll=`echo $BOOST_DATE_TIME_LIB | sed -e 's/^-l//' -e 's/\.dll$//'`
8881     libo_MINGW_TRY_DLL([$mingw_boost_date_time_dll])
8882     if test -z "$MINGW_BOOST_DATE_TIME_DLL"; then
8883         # if not found, try again with 'lib' prefix
8884         libo_MINGW_CHECK_DLL([lib$mingw_boost_date_time_dll])
8885     fi
8886     AC_LANG_PUSH([C++])
8887     save_CXXFLAGS=$CXXFLAGS
8888     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8889     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8890        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8891     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8892        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8893     AC_CHECK_HEADER(boost/function.hpp, [],
8894        [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
8895     CXXFLAGS="$CXXFLAGS -fno-exceptions"
8896     AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
8897     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
8898 ]], [[]])],[ac_cv_cxx_boost_no_exceptions_broken=no],[ac_cv_cxx_boost_no_exceptions_broken=yes])
8899     if test "$ac_cv_cxx_boost_no_exceptions_broken" = "yes"; then
8900         AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
8901     else
8902         AC_MSG_RESULT([yes])
8903     fi
8904     CXXFLAGS=$save_CXXFLAGS
8905     AC_LANG_POP([C++])
8906     # this is in m4/ax_boost_base.m4
8907     FilterLibs "${BOOST_LDFLAGS}"
8908     BOOST_LDFLAGS="${filteredlibs}"
8909 else
8910     AC_MSG_RESULT([internal])
8911     BUILD_TYPE="$BUILD_TYPE BOOST"
8912     SYSTEM_BOOST=
8913     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8914         # use warning-suppressing wrapper headers
8915         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8916     else
8917         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8918     fi
8920 AC_SUBST(SYSTEM_BOOST)
8922 dnl ===================================================================
8923 dnl Check for system mdds
8924 dnl ===================================================================
8925 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8927 dnl ===================================================================
8928 dnl Check for system glm
8929 dnl ===================================================================
8930 AC_MSG_CHECKING([which glm to use])
8931 if test "$with_system_glm" = "yes"; then
8932     AC_MSG_RESULT([external])
8933     SYSTEM_GLM=TRUE
8934     AC_LANG_PUSH([C++])
8935     AC_CHECK_HEADER([glm/glm.hpp], [],
8936        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8937     AC_LANG_POP([C++])
8938 else
8939     AC_MSG_RESULT([internal])
8940     BUILD_TYPE="$BUILD_TYPE GLM"
8941     SYSTEM_GLM=
8942     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8944 AC_SUBST([GLM_CFLAGS])
8945 AC_SUBST([SYSTEM_GLM])
8947 dnl ===================================================================
8948 dnl Check for system glew
8949 dnl ===================================================================
8950 libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
8951 AS_IF([test "$with_system_glew" = "yes"],
8952     [PKG_CHECK_EXISTS([glew >= 1.12.0], [AC_DEFINE([HAVE_GLEW_1_12])])],
8953     [AC_DEFINE([HAVE_GLEW_1_12])])
8955 dnl ===================================================================
8956 dnl Check for system odbc
8957 dnl ===================================================================
8958 AC_MSG_CHECKING([which odbc headers to use])
8959 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
8960     AC_MSG_RESULT([external])
8961     SYSTEM_ODBC_HEADERS=TRUE
8963     if test "$build_os" = "cygwin"; then
8964         save_CPPFLAGS=$CPPFLAGS
8965         find_winsdk
8966         PathFormat "$winsdktest"
8967         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"
8968         AC_CHECK_HEADER(sqlext.h, [],
8969             [AC_MSG_ERROR(odbc not found. install odbc)],
8970             [#include <windows.h>])
8971         CPPFLAGS=$save_CPPFLAGS
8972     else
8973         AC_CHECK_HEADER(sqlext.h, [],
8974             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8975     fi
8976 elif test "$enable_database_connectivity" != yes; then
8977     AC_MSG_RESULT([none])
8978 else
8979     AC_MSG_RESULT([internal])
8980     SYSTEM_ODBC_HEADERS=
8982 AC_SUBST(SYSTEM_ODBC_HEADERS)
8985 dnl ===================================================================
8986 dnl Check for system openldap
8987 dnl ===================================================================
8989 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8990 AC_MSG_CHECKING([which openldap library to use])
8991 if test "$with_system_openldap" = "yes"; then
8992     AC_MSG_RESULT([external])
8993     SYSTEM_OPENLDAP=TRUE
8994     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8995     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8996     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8997 else
8998     AC_MSG_RESULT([internal])
8999     SYSTEM_OPENLDAP=
9000     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9003 AC_SUBST(SYSTEM_OPENLDAP)
9005 dnl ===================================================================
9006 dnl Check for TLS/SSL and cryptographic implementation to use
9007 dnl ===================================================================
9008 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9009 if test -n "$with_tls"; then
9010     case $with_tls in
9011     openssl)
9012         AC_DEFINE(USE_TLS_OPENSSL)
9013         TLS=OPENSSL
9015         if test "$enable_openssl" != "yes"; then
9016             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9017         fi
9019         # warn that OpenSSL has been selected but not all TLS code has this option
9020         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS])
9021         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still be depending on NSS or GNUTLS"
9022         ;;
9023     nss)
9024         AC_DEFINE(USE_TLS_NSS)
9025         TLS=NSS
9026         ;;
9027     *)
9028         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9029 openssl - OpenSSL
9030 nss - Mozilla's Network Security Services (NSS)
9031     ])
9032         ;;
9033     esac
9034 elif test $_os = iOS -o $_os = Android; then
9035     # We don't build NSS for iOS and Android
9036     AC_DEFINE(USE_TLS_OPENSSL)
9037     TLS=OPENSSL
9038 else
9039     # default to using NSS, it results in smaller oox lib
9040     AC_DEFINE(USE_TLS_NSS)
9041     TLS=NSS
9043 AC_MSG_RESULT([$TLS])
9044 AC_SUBST(TLS)
9046 dnl ===================================================================
9047 dnl Check for system NSS
9048 dnl ===================================================================
9049 if test $_os != iOS; then
9050     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9052 if test "$with_system_nss" = "yes"; then
9053     libo_MINGW_CHECK_DLL([libnspr4])
9054     libo_MINGW_CHECK_DLL([libplc4])
9055     libo_MINGW_CHECK_DLL([libplds4])
9056     libo_MINGW_CHECK_DLL([nss3])
9057     libo_MINGW_CHECK_DLL([nssutil3])
9058     libo_MINGW_CHECK_DLL([smime3])
9059     libo_MINGW_CHECK_DLL([ssl3])
9062 dnl ===================================================================
9063 dnl Check for system sane
9064 dnl ===================================================================
9065 AC_MSG_CHECKING([which sane header to use])
9066 if test "$with_system_sane" = "yes"; then
9067     AC_MSG_RESULT([external])
9068     AC_CHECK_HEADER(sane/sane.h, [],
9069       [AC_MSG_ERROR(sane not found. install sane)], [])
9070 else
9071     AC_MSG_RESULT([internal])
9072     BUILD_TYPE="$BUILD_TYPE SANE"
9075 dnl ===================================================================
9076 dnl Check for system icu
9077 dnl ===================================================================
9078 SYSTEM_GENBRK=
9079 SYSTEM_GENCCODE=
9080 SYSTEM_GENCMN=
9082 ICU_MAJOR=58
9083 ICU_MINOR=1
9084 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9085 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9086 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9087 AC_MSG_CHECKING([which icu to use])
9088 if test "$with_system_icu" = "yes"; then
9089     AC_MSG_RESULT([external])
9090     SYSTEM_ICU=TRUE
9091     AC_LANG_PUSH([C++])
9092     AC_MSG_CHECKING([for unicode/rbbi.h])
9093     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9094     AC_LANG_POP([C++])
9096     if test "$cross_compiling" != "yes" -o "$WITH_MINGW" = "yes"; then
9097         ICUPATH="$PATH"
9098         if test "$WITH_MINGW" = "yes"; then
9099             ICUPATH=`$CC -print-sysroot`/mingw/bin:"$ICUPATH"
9100         fi
9101         AC_PATH_PROG(ICUCONFIG,icu-config,,[$ICUPATH])
9103         AC_MSG_CHECKING([ICU version])
9104         ICU_VERSION=`$ICUCONFIG --noverify --version 2>/dev/null || $ICUCONFIG --version`
9105         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9106         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9108         if test "$ICU_MAJOR" -ge "49" -o \( "$ICU_MAJOR" = "4" -a "$ICU_MINOR" -ge "6" \); then
9109             AC_MSG_RESULT([OK, $ICU_VERSION])
9110         else
9111             AC_MSG_ERROR([not suitable, only >= 4.6 supported currently])
9112         fi
9113     fi
9115     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9116         AC_PATH_PROG([ICUCONFIG_FOR_BUILD], [icu-config], [], [$PATH:/usr/sbin:/sbin])
9117         ICU_VERSION_FOR_BUILD=`$ICUCONFIG_FOR_BUILD --noverify --version 2>/dev/null || $ICUCONFIG_FOR_BUILD --version`
9118         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9119         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9120         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9121         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9122             AC_MSG_RESULT([yes])
9123         else
9124             AC_MSG_RESULT([no])
9125             if test "$with_system_icu_for_build" != "force"; then
9126                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9127 You can use --with-system-icu-for-build=force to use it anyway.])
9128             fi
9129         fi
9130     fi
9132     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9133         # using the system icu tools can lead to version confusion, use the
9134         # ones from the build environment when cross-compiling
9135         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9136         if test -z "$SYSTEM_GENBRK"; then
9137             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9138         fi
9139         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9140         if test -z "$SYSTEM_GENCCODE"; then
9141             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9142         fi
9143         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9144         if test -z "$SYSTEM_GENCMN"; then
9145             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9146         fi
9147         if test "$ICU_MAJOR" -ge "49"; then
9148             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9149             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9150             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9151         else
9152             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9153             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9154             ICU_RECLASSIFIED_HEBREW_LETTER=
9155         fi
9156     fi
9158     if test "$cross_compiling" = "yes"; then
9159         if test "$ICU_MAJOR" -ge "50"; then
9160             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9161             ICU_MINOR=""
9162         fi
9163     fi
9165     libo_MINGW_CHECK_DLL([icudata][$ICU_MAJOR][$ICU_MINOR])
9166     libo_MINGW_CHECK_DLL([icui18n][$ICU_MAJOR][$ICU_MINOR])
9167     libo_MINGW_CHECK_DLL([icuuc][$ICU_MAJOR][$ICU_MINOR])
9168 else
9169     AC_MSG_RESULT([internal])
9170     SYSTEM_ICU=
9171     BUILD_TYPE="$BUILD_TYPE ICU"
9172     # surprisingly set these only for "internal" (to be used by various other
9173     # external libs): the system icu-config is quite unhelpful and spits out
9174     # dozens of weird flags and also default path -I/usr/include
9175     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9176     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9178 AC_SUBST(SYSTEM_ICU)
9179 AC_SUBST(SYSTEM_GENBRK)
9180 AC_SUBST(SYSTEM_GENCCODE)
9181 AC_SUBST(SYSTEM_GENCMN)
9182 AC_SUBST(ICU_MAJOR)
9183 AC_SUBST(ICU_MINOR)
9184 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9185 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9186 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9187 AC_SUBST(ICU_CFLAGS)
9188 AC_SUBST(ICU_LIBS)
9190 dnl ==================================================================
9191 dnl Breakpad
9192 dnl ==================================================================
9193 AC_MSG_CHECKING([whether to enable breakpad])
9194 if test "$enable_breakpad" != yes; then
9195     AC_MSG_RESULT([no])
9196 else
9197     AC_MSG_RESULT([yes])
9198     ENABLE_BREAKPAD="TRUE"
9199     AC_DEFINE(ENABLE_BREAKPAD)
9200     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9201     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9203     AC_MSG_CHECKING([for crashreport config])
9204     if test "$with_symbol_config" = "no"; then
9205         BREAKPAD_SYMBOL_CONFIG="invalid"
9206         AC_MSG_RESULT([no])
9207     else
9208         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9209         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9210         AC_MSG_RESULT([yes])
9211     fi
9212     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9214 AC_SUBST(ENABLE_BREAKPAD)
9216 dnl ===================================================================
9217 dnl Orcus
9218 dnl ===================================================================
9219 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.12 >= 0.12.0])
9220 if test "$with_system_orcus" != "yes"; then
9221     if test "$SYSTEM_BOOST" = "TRUE"; then
9222         # ===========================================================
9223         # Determine if we are going to need to link with Boost.System
9224         # ===========================================================
9225         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9226         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9227         dnl in documentation has no effect.
9228         AC_MSG_CHECKING([if we need to link with Boost.System])
9229         AC_LANG_PUSH([C++])
9230         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9231                 @%:@include <boost/version.hpp>
9232             ]],[[
9233                 #if BOOST_VERSION >= 105000
9234                 #   error yes, we need to link with Boost.System
9235                 #endif
9236             ]])],[
9237                 AC_MSG_RESULT([no])
9238             ],[
9239                 AC_MSG_RESULT([yes])
9240                 AX_BOOST_SYSTEM
9241         ])
9242         AC_LANG_POP([C++])
9243     fi
9245 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9246 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9247 AC_SUBST([BOOST_SYSTEM_LIB])
9248 AC_SUBST(SYSTEM_LIBORCUS)
9250 dnl ===================================================================
9251 dnl HarfBuzz
9252 dnl ===================================================================
9253 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9254                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9255                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9257 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.18],
9258                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9259                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9261 if test "$COM" = "MSC"; then # override the above
9262     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9263     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9266 if test "$with_system_harfbuzz" = "yes"; then
9267     if test "$with_system_graphite" = "no"; then
9268         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9269     fi
9270     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9271     _save_libs="$LIBS"
9272     _save_cflags="$CFLAGS"
9273     LIBS="$LIBS $HARFBUZZ_LIBS"
9274     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9275     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9276     LIBS="$_save_libs"
9277     CFLAGS="$_save_cflags"
9278 else
9279     if test "$with_system_graphite" = "yes"; then
9280         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9281     fi
9284 AC_MSG_CHECKING([whether to use X11])
9285 dnl ***************************************
9286 dnl testing for X libraries and includes...
9287 dnl ***************************************
9288 if test "$USING_X11" = TRUE; then
9289     AC_DEFINE(HAVE_FEATURE_X11)
9291 AC_MSG_RESULT([$USING_X11])
9293 if test "$USING_X11" = TRUE; then
9294     AC_PATH_X
9295     AC_PATH_XTRA
9296     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9298     if test -z "$x_includes"; then
9299         x_includes="default_x_includes"
9300     fi
9301     if test -z "$x_libraries"; then
9302         x_libraries="default_x_libraries"
9303     fi
9304     CFLAGS="$CFLAGS $X_CFLAGS"
9305     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9306     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9307 else
9308     x_includes="no_x_includes"
9309     x_libraries="no_x_libraries"
9312 if test "$USING_X11" = TRUE; then
9313     dnl ===================================================================
9314     dnl Check for Composite.h for Mozilla plugin
9315     dnl ===================================================================
9316     AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])],
9317      [#include <X11/Intrinsic.h>])
9319     dnl ===================================================================
9320     dnl Check for extension headers
9321     dnl ===================================================================
9322     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9323      [#include <X11/extensions/shape.h>])
9325     # vcl needs ICE and SM
9326     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9327     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9328         [AC_MSG_ERROR(ICE library not found)])
9329     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9330     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9331         [AC_MSG_ERROR(SM library not found)])
9334 dnl ===================================================================
9335 dnl Check for system Xrender
9336 dnl ===================================================================
9337 AC_MSG_CHECKING([whether to use Xrender])
9338 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9339     AC_MSG_RESULT([yes])
9340     PKG_CHECK_MODULES(XRENDER, xrender)
9341     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9342     FilterLibs "${XRENDER_LIBS}"
9343     XRENDER_LIBS="${filteredlibs}"
9344     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9345       [AC_MSG_ERROR(libXrender not found or functional)], [])
9346     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9347       [AC_MSG_ERROR(Xrender not found. install X)], [])
9348 else
9349     AC_MSG_RESULT([no])
9351 AC_SUBST(XRENDER_CFLAGS)
9352 AC_SUBST(XRENDER_LIBS)
9354 dnl ===================================================================
9355 dnl Check for XRandr
9356 dnl ===================================================================
9357 AC_MSG_CHECKING([whether to enable RandR support])
9358 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9359     AC_MSG_RESULT([yes])
9360     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9361     if test "$ENABLE_RANDR" != "TRUE"; then
9362         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9363                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9364         XRANDR_CFLAGS=" "
9365         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9366           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9367         XRANDR_LIBS="-lXrandr "
9368         ENABLE_RANDR="TRUE"
9369     fi
9370     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9371     FilterLibs "${XRANDR_LIBS}"
9372     XRANDR_LIBS="${filteredlibs}"
9373 else
9374     ENABLE_RANDR=""
9375     AC_MSG_RESULT([no])
9377 AC_SUBST(XRANDR_CFLAGS)
9378 AC_SUBST(XRANDR_LIBS)
9379 AC_SUBST(ENABLE_RANDR)
9381 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9382     WITH_WEBDAV="serf"
9384 if test $_os = iOS -o $_os = Android; then
9385     WITH_WEBDAV="no"
9387 AC_MSG_CHECKING([for webdav library])
9388 case "$WITH_WEBDAV" in
9389 serf)
9390     AC_MSG_RESULT([serf])
9391     # Check for system apr-util
9392     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9393                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9394                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9395     if test "$COM" = "MSC"; then
9396         APR_LIB_DIR="LibR"
9397         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9398         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9399     fi
9401     # Check for system serf
9402     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9403                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9404     if test "$COM" = "MSC"; then
9405         SERF_LIB_DIR="Release"
9406         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9407         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9408     fi
9409     ;;
9410 neon)
9411     AC_MSG_RESULT([neon])
9412     # Check for system neon
9413     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9414     if test "$with_system_neon" = "yes"; then
9415         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9416         libo_MINGW_CHECK_DLL([libneon])
9417         libo_MINGW_TRY_DLL([libtasn1])
9418         libo_MINGW_TRY_DLL([libgnutls])
9419     else
9420         NEON_VERSION=0295
9421     fi
9422     AC_SUBST(NEON_VERSION)
9423     ;;
9425     AC_MSG_RESULT([none, disabled])
9426     WITH_WEBDAV=""
9427     ;;
9428 esac
9429 AC_SUBST(WITH_WEBDAV)
9431 dnl ===================================================================
9432 dnl Check for disabling cve_tests
9433 dnl ===================================================================
9434 AC_MSG_CHECKING([whether to execute CVE tests])
9435 # If not explicitly enabled or disabled, default
9436 if test -z "$enable_cve_tests"; then
9437     case "$OS" in
9438     WNT)
9439         # Default cves off for windows with its wild and wonderful
9440         # varienty of AV software kicking in and panicing
9441         enable_cve_tests=no
9442         ;;
9443     *)
9444         # otherwise yes
9445         enable_cve_tests=yes
9446         ;;
9447     esac
9449 if test "$enable_cve_tests" = "no"; then
9450     AC_MSG_RESULT([no])
9451     DISABLE_CVE_TESTS=TRUE
9452     AC_SUBST(DISABLE_CVE_TESTS)
9453 else
9454     AC_MSG_RESULT([yes])
9457 dnl ===================================================================
9458 dnl Check for enabling chart XShape tests
9459 dnl ===================================================================
9460 AC_MSG_CHECKING([whether to execute chart XShape tests])
9461 if test "$enable_chart_tests" = "yes"; then
9462     AC_MSG_RESULT([yes])
9463     ENABLE_CHART_TESTS=TRUE
9464     AC_SUBST(ENABLE_CHART_TESTS)
9465 else
9466     AC_MSG_RESULT([no])
9469 dnl ===================================================================
9470 dnl Check for system openssl
9471 dnl ===================================================================
9472 DISABLE_OPENSSL=
9473 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9474 if test "$enable_openssl" = "yes"; then
9475     AC_MSG_RESULT([no])
9476     if test "$_os" = Darwin ; then
9477         # OpenSSL is deprecated when building for 10.7 or later.
9478         #
9479         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9480         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9482         with_system_openssl=no
9483         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9484     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9485             && test "$with_system_openssl" != "no"; then
9486         with_system_openssl=yes
9487         SYSTEM_OPENSSL=TRUE
9488         OPENSSL_CFLAGS=
9489         OPENSSL_LIBS="-lssl -lcrypto"
9490     else
9491         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9492     fi
9493     if test "$with_system_openssl" = "yes"; then
9494         libo_MINGW_CHECK_DLL([libssl])
9495         libo_MINGW_CHECK_DLL([libcrypto])
9496         AC_MSG_CHECKING([whether openssl supports SHA512])
9497         AC_LANG_PUSH([C])
9498         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9499             SHA512_CTX context;
9500 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9501         AC_LANG_POP(C)
9502     fi
9503 else
9504     AC_MSG_RESULT([yes])
9505     DISABLE_OPENSSL=TRUE
9507     # warn that although OpenSSL is disabled, system libraries may be depending on it
9508     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9509     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9512 AC_SUBST([DISABLE_OPENSSL])
9514 dnl ===================================================================
9515 dnl Check for building gnutls
9516 dnl ===================================================================
9517 AC_MSG_CHECKING([whether to use gnutls])
9518 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9519     AC_MSG_RESULT([yes])
9520     AM_PATH_LIBGCRYPT()
9521     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9522         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9523                       available in the system to use as replacement.]]))
9524     FilterLibs "${LIBGCRYPT_LIBS}"
9525     LIBGCRYPT_LIBS="${filteredlibs}"
9526 else
9527     AC_MSG_RESULT([no])
9530 AC_SUBST([LIBGCRYPT_CFLAGS])
9531 AC_SUBST([LIBGCRYPT_LIBS])
9533 dnl ===================================================================
9534 dnl Check for system redland
9535 dnl ===================================================================
9536 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9537 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9538 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9539 if test "$with_system_redland" = "yes"; then
9540     libo_MINGW_CHECK_DLL([librdf])
9541     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9542             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9543     libo_MINGW_TRY_DLL([libraptor])
9544     libo_MINGW_TRY_DLL([librasqal])
9545     libo_MINGW_TRY_DLL([libsqlite3])
9546 else
9547     RAPTOR_MAJOR="0"
9548     RASQAL_MAJOR="3"
9549     REDLAND_MAJOR="0"
9551 AC_SUBST(RAPTOR_MAJOR)
9552 AC_SUBST(RASQAL_MAJOR)
9553 AC_SUBST(REDLAND_MAJOR)
9555 dnl ===================================================================
9556 dnl Check for system hunspell
9557 dnl ===================================================================
9558 AC_MSG_CHECKING([which libhunspell to use])
9559 if test "$with_system_hunspell" = "yes"; then
9560     AC_MSG_RESULT([external])
9561     SYSTEM_HUNSPELL=TRUE
9562     AC_LANG_PUSH([C++])
9563     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9564     if test "$HUNSPELL_PC" != "TRUE"; then
9565         AC_CHECK_HEADER(hunspell.hxx, [],
9566             [
9567             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9568             [AC_MSG_ERROR(hunspell headers not found.)], [])
9569             ], [])
9570         AC_CHECK_LIB([hunspell], [main], [:],
9571            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9572         HUNSPELL_LIBS=-lhunspell
9573     fi
9574     AC_LANG_POP([C++])
9575     libo_MINGW_CHECK_DLL([libhunspell-1.4])
9576     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9577     FilterLibs "${HUNSPELL_LIBS}"
9578     HUNSPELL_LIBS="${filteredlibs}"
9579 else
9580     AC_MSG_RESULT([internal])
9581     SYSTEM_HUNSPELL=
9582     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9583     if test "$COM" = "MSC"; then
9584         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9585     else
9586         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.4"
9587     fi
9588     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9590 AC_SUBST(SYSTEM_HUNSPELL)
9591 AC_SUBST(HUNSPELL_CFLAGS)
9592 AC_SUBST(HUNSPELL_LIBS)
9594 dnl ===================================================================
9595 dnl Checking for altlinuxhyph
9596 dnl ===================================================================
9597 AC_MSG_CHECKING([which altlinuxhyph to use])
9598 if test "$with_system_altlinuxhyph" = "yes"; then
9599     AC_MSG_RESULT([external])
9600     SYSTEM_HYPH=TRUE
9601     AC_CHECK_HEADER(hyphen.h, [],
9602        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9603     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9604        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9605        [#include <hyphen.h>])
9606     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9607         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9608     if test -z "$HYPHEN_LIB"; then
9609         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9610            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9611     fi
9612     if test -z "$HYPHEN_LIB"; then
9613         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9614            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9615     fi
9616     libo_MINGW_CHECK_DLL([libhyphen])
9617 else
9618     AC_MSG_RESULT([internal])
9619     SYSTEM_HYPH=
9620     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9621     if test "$COM" = "MSC"; then
9622         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9623     else
9624         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9625     fi
9627 AC_SUBST(SYSTEM_HYPH)
9628 AC_SUBST(HYPHEN_LIB)
9630 dnl ===================================================================
9631 dnl Checking for mythes
9632 dnl ===================================================================
9633 AC_MSG_CHECKING([which mythes to use])
9634 if test "$with_system_mythes" = "yes"; then
9635     AC_MSG_RESULT([external])
9636     SYSTEM_MYTHES=TRUE
9637     AC_LANG_PUSH([C++])
9638     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9639     if test "$MYTHES_PKGCONFIG" = "no"; then
9640         AC_CHECK_HEADER(mythes.hxx, [],
9641             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9642         AC_CHECK_LIB([mythes-1.2], [main], [:],
9643             [ MYTHES_FOUND=no], [])
9644     if test "$MYTHES_FOUND" = "no"; then
9645         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9646                 [ MYTHES_FOUND=no], [])
9647     fi
9648     if test "$MYTHES_FOUND" = "no"; then
9649         AC_MSG_ERROR([mythes library not found!.])
9650     fi
9651     fi
9652     AC_LANG_POP([C++])
9653     libo_MINGW_CHECK_DLL([libmythes-1.2])
9654     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9655     FilterLibs "${MYTHES_LIBS}"
9656     MYTHES_LIBS="${filteredlibs}"
9657 else
9658     AC_MSG_RESULT([internal])
9659     SYSTEM_MYTHES=
9660     BUILD_TYPE="$BUILD_TYPE MYTHES"
9661     if test "$COM" = "MSC"; then
9662         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9663     else
9664         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9665     fi
9667 AC_SUBST(SYSTEM_MYTHES)
9668 AC_SUBST(MYTHES_CFLAGS)
9669 AC_SUBST(MYTHES_LIBS)
9671 dnl ===================================================================
9672 dnl How should we build the linear programming solver ?
9673 dnl ===================================================================
9675 ENABLE_COINMP=
9676 AC_MSG_CHECKING([whether to build with CoinMP])
9677 if test "$enable_coinmp" != "no"; then
9678     ENABLE_COINMP=TRUE
9679     AC_MSG_RESULT([yes])
9680     if test "$with_system_coinmp" = "yes"; then
9681         SYSTEM_COINMP=TRUE
9682         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9683         FilterLibs "${COINMP_LIBS}"
9684         COINMP_LIBS="${filteredlibs}"
9685     else
9686         BUILD_TYPE="$BUILD_TYPE COINMP"
9687     fi
9688 else
9689     AC_MSG_RESULT([no])
9691 AC_SUBST(ENABLE_COINMP)
9692 AC_SUBST(SYSTEM_COINMP)
9693 AC_SUBST(COINMP_CFLAGS)
9694 AC_SUBST(COINMP_LIBS)
9696 ENABLE_LPSOLVE=
9697 AC_MSG_CHECKING([whether to build with lpsolve])
9698 if test "$enable_lpsolve" != "no"; then
9699     ENABLE_LPSOLVE=TRUE
9700     AC_MSG_RESULT([yes])
9701 else
9702     AC_MSG_RESULT([no])
9704 AC_SUBST(ENABLE_LPSOLVE)
9706 if test "$ENABLE_LPSOLVE" = TRUE; then
9707     AC_MSG_CHECKING([which lpsolve to use])
9708     if test "$with_system_lpsolve" = "yes"; then
9709         AC_MSG_RESULT([external])
9710         SYSTEM_LPSOLVE=TRUE
9711         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9712            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9713         save_LIBS=$LIBS
9714         # some systems need this. Like Ubuntu....
9715         AC_CHECK_LIB(m, floor)
9716         AC_CHECK_LIB(dl, dlopen)
9717         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9718             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9719         LIBS=$save_LIBS
9720         libo_MINGW_CHECK_DLL([lpsolve55])
9721     else
9722         AC_MSG_RESULT([internal])
9723         SYSTEM_LPSOLVE=
9724         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9725     fi
9727 AC_SUBST(SYSTEM_LPSOLVE)
9729 dnl ===================================================================
9730 dnl Checking for libexttextcat
9731 dnl ===================================================================
9732 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9733 if test "$with_system_libexttextcat" = "yes"; then
9734     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9736 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9738 dnl ***************************************
9739 dnl testing libc version for Linux...
9740 dnl ***************************************
9741 if test "$_os" = "Linux"; then
9742     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9743     exec 6>/dev/null # no output
9744     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9745     exec 6>&1 # output on again
9746     if test "$HAVE_LIBC"; then
9747         AC_MSG_RESULT([yes])
9748     else
9749         AC_MSG_ERROR([no, upgrade libc])
9750     fi
9753 dnl =========================================
9754 dnl Check for the Windows  SDK.
9755 dnl =========================================
9756 dnl FIXME: I don't know yet if the Windows SDK works with MinGW, keep it until I know better,
9757 dnl and add "-a \( "$WITH_MINGW" != "yes" \)" then
9758 if test "$_os" = "WINNT"; then
9759     AC_MSG_CHECKING([for Windows SDK])
9760     if test "$build_os" = "cygwin"; then
9761         find_winsdk
9762         WINDOWS_SDK_HOME=$winsdktest
9764         # normalize if found
9765         if test -n "$WINDOWS_SDK_HOME"; then
9766             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
9767             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
9768         fi
9770         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
9771     fi
9773     if test -n "$WINDOWS_SDK_HOME"; then
9774         # Remove a possible trailing backslash
9775         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
9777         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
9778              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
9779              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
9780             have_windows_sdk_headers=yes
9781         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
9782              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
9783              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
9784             have_windows_sdk_headers=yes
9785         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
9786              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
9787              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
9788             have_windows_sdk_headers=yes
9789         else
9790             have_windows_sdk_headers=no
9791         fi
9793         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
9794             have_windows_sdk_libs=yes
9795         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
9796             have_windows_sdk_libs=yes
9797         else
9798             have_windows_sdk_libs=no
9799         fi
9801         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
9802             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
9803 the  Windows SDK are installed.])
9804         fi
9806         if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
9807              -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
9808              -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
9809              -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
9810         elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
9811              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
9812              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
9813              -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
9814         else
9815             AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
9816         fi
9817     fi
9819     if test -z "$WINDOWS_SDK_HOME"; then
9820         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
9821     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
9822         WINDOWS_SDK_VERSION=70
9823         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
9824     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
9825         WINDOWS_SDK_VERSION=80
9826         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
9827         dnl compatibility warning if not explicitly choosing the 80 SDK:
9828         if test -z "$with_windows_sdk"; then
9829             AC_MSG_WARN([If a build should run on Windows XP,])
9830             AC_MSG_WARN([use --with-windows-sdk=7.1A])
9831             add_warning "If a build should run on Windows XP,"
9832             add_warning "use --with-windows-sdk=7.1A"
9833         fi
9834     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
9835         WINDOWS_SDK_VERSION=81
9836         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
9837     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
9838         WINDOWS_SDK_VERSION=10
9839         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
9840     else
9841         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
9842     fi
9843     PathFormat "$WINDOWS_SDK_HOME"
9844     WINDOWS_SDK_HOME="$formatted_path"
9845     if test "$build_os" = "cygwin"; then
9846         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/include"
9847         if test -d "$WINDOWS_SDK_HOME/include/um"; then
9848             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
9849         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
9850             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
9851         fi
9852     fi
9854     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
9855     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
9856     dnl but not in v8.0), so allow this to be overridden with a
9857     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
9858     dnl and configuration error if no WiLangId.vbs is found would arguably be
9859     dnl better, but I do not know under which conditions exactly it is needed by
9860     dnl msiglobal.pm:
9861     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
9862         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
9863         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9864             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
9865         fi
9866         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9867             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
9868         fi
9869         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
9870             AC_MSG_WARN([WiLangId.vbs not found - building translated packages will fail])
9871             add_warning "WiLangId.vbs not found - building translated packages will fail"
9872         fi
9873     fi
9875 AC_SUBST(WINDOWS_SDK_HOME)
9876 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
9877 AC_SUBST(WINDOWS_SDK_VERSION)
9878 AC_SUBST(WINDOWS_SDK_WILANGID)
9880 dnl =========================================
9881 dnl Check for uuidgen
9882 dnl =========================================
9883 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9884     if test "$WITH_MINGW" = "yes"; then
9885         AC_PATH_PROG([UUIDGEN], [uuid])
9886         if test -z "$UUIDGEN"; then
9887             AC_MSG_WARN([uuid is needed for building installation sets])
9888         fi
9889     else
9890         # presence is already tested above in the WINDOWS_SDK_HOME check
9891         UUIDGEN=uuidgen.exe
9892         AC_SUBST(UUIDGEN)
9893     fi
9894 else
9895     AC_PATH_PROG([UUIDGEN], [uuidgen])
9896     if test -z "$UUIDGEN"; then
9897         AC_MSG_WARN([uuid is needed for building installation sets])
9898     fi
9901 dnl ***************************************
9902 dnl Checking for bison and flex
9903 dnl ***************************************
9904 AC_PATH_PROG(BISON, bison)
9905 if test -z "$BISON"; then
9906     AC_MSG_ERROR([no bison found in \$PATH, install it])
9907 else
9908     AC_MSG_CHECKING([the bison version])
9909     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9910     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9911     # Accept newer than 2.0
9912     if test "$_bison_longver" -lt 2000; then
9913         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9914     fi
9917 AC_PATH_PROG(FLEX, flex)
9918 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9919     FLEX=`cygpath -m $FLEX`
9921 if test -z "$FLEX"; then
9922     AC_MSG_ERROR([no flex found in \$PATH, install it])
9923 else
9924     AC_MSG_CHECKING([the flex version])
9925     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9926     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9927         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9928     fi
9930 AC_SUBST([FLEX])
9931 dnl ***************************************
9932 dnl Checking for patch
9933 dnl ***************************************
9934 AC_PATH_PROG(PATCH, patch)
9935 if test -z "$PATCH"; then
9936     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9939 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9940 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9941     if test -z "$with_gnu_patch"; then
9942         GNUPATCH=$PATCH
9943     else
9944         if test -x "$with_gnu_patch"; then
9945             GNUPATCH=$with_gnu_patch
9946         else
9947             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9948         fi
9949     fi
9951     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9952     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9953         AC_MSG_RESULT([yes])
9954     else
9955         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9956     fi
9957 else
9958     GNUPATCH=$PATCH
9961 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9962     GNUPATCH=`cygpath -m $GNUPATCH`
9965 dnl We also need to check for --with-gnu-cp
9967 if test -z "$with_gnu_cp"; then
9968     # check the place where the good stuff is hidden on Solaris...
9969     if test -x /usr/gnu/bin/cp; then
9970         GNUCP=/usr/gnu/bin/cp
9971     else
9972         AC_PATH_PROGS(GNUCP, gnucp cp)
9973     fi
9974     if test -z $GNUCP; then
9975         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9976     fi
9977 else
9978     if test -x "$with_gnu_cp"; then
9979         GNUCP=$with_gnu_cp
9980     else
9981         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9982     fi
9985 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9986     GNUCP=`cygpath -m $GNUCP`
9989 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9990 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9991     AC_MSG_RESULT([yes])
9992 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9993     AC_MSG_RESULT([yes])
9994 else
9995     case "$build_os" in
9996     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9997         x_GNUCP=[\#]
9998         GNUCP=''
9999         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10000         ;;
10001     *)
10002         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10003         ;;
10004     esac
10007 AC_SUBST(GNUPATCH)
10008 AC_SUBST(GNUCP)
10009 AC_SUBST(x_GNUCP)
10011 dnl ***************************************
10012 dnl testing assembler path
10013 dnl ***************************************
10014 ML_EXE=""
10015 if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then
10016     if test "$BITNESS_OVERRIDE" = ""; then
10017         assembler=ml.exe
10018         assembler_bin=bin
10019     else
10020         if test "$vcexpress" = "Express"; then
10021             assembler=ml64.exe
10022             assembler_bin=bin/x86_amd64
10023         else
10024             assembler=ml64.exe
10025             assembler_bin=bin/amd64
10026         fi
10027     fi
10029     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
10030     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
10031         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
10032         AC_MSG_RESULT([found])
10033         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
10034     else
10035         AC_MSG_ERROR([Configure did not find $assembler assembler.])
10036     fi
10038     PathFormat "$ASM_HOME"
10039     ASM_HOME="$formatted_path"
10040 else
10041     ASM_HOME=""
10044 AC_SUBST(ML_EXE)
10046 dnl ===================================================================
10047 dnl We need zip and unzip
10048 dnl ===================================================================
10049 AC_PATH_PROG(ZIP, zip)
10050 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10051 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10052     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],,)
10055 AC_PATH_PROG(UNZIP, unzip)
10056 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10058 dnl ===================================================================
10059 dnl Zip must be a specific type for different build types.
10060 dnl ===================================================================
10061 if test $build_os = cygwin; then
10062     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10063         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10064     fi
10067 dnl ===================================================================
10068 dnl We need touch with -h option support.
10069 dnl ===================================================================
10070 AC_PATH_PROG(TOUCH, touch)
10071 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10072 touch warn
10073 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10074     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],,)
10077 dnl ===================================================================
10078 dnl Set vcl option: coordinate device in double or sal_Int32
10079 dnl ===================================================================
10081 dnl disabled for now, we don't want subtle differences between OSs
10082 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10083 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10084 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10085 dnl     AC_MSG_RESULT([double])
10086 dnl else
10087 dnl     AC_MSG_RESULT([sal_Int32])
10088 dnl fi
10090 dnl ===================================================================
10091 dnl Test which vclplugs have to be built.
10092 dnl ===================================================================
10093 R=""
10094 if test "$USING_X11" != TRUE; then
10095     enable_gtk=no
10096     enable_gtk3=no
10098 GTK3_CFLAGS=""
10099 GTK3_LIBS=""
10100 ENABLE_GTK3=""
10101 if test "x$enable_gtk3" = "xyes"; then
10102     if test "$with_system_cairo" = no; then
10103         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10104     fi
10105     : ${with_system_cairo:=yes}
10106     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="")
10107     if test "x$ENABLE_GTK3" = "xTRUE"; then
10108         R="gtk3"
10109         dnl Avoid installed by unpackaged files for now.
10110         if test -z "$PKGFORMAT"; then
10111             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
10112         fi
10113     else
10114         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10115     fi
10116     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10117     FilterLibs "${GTK3_LIBS}"
10118     GTK3_LIBS="${filteredlibs}"
10120 AC_SUBST(GTK3_LIBS)
10121 AC_SUBST(GTK3_CFLAGS)
10122 AC_SUBST(ENABLE_GTK3)
10124 ENABLE_GTK=""
10125 if test "x$enable_gtk" = "xyes"; then
10126     if test "$with_system_cairo" = no; then
10127         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10128     fi
10129     : ${with_system_cairo:=yes}
10130     ENABLE_GTK="TRUE"
10131     AC_DEFINE(ENABLE_GTK)
10132     R="gtk $R"
10134 AC_SUBST(ENABLE_GTK)
10136 ENABLE_TDE=""
10137 if test "x$enable_tde" = "xyes"; then
10138     ENABLE_TDE="TRUE"
10139     AC_DEFINE(ENABLE_TDE)
10140     R="$R tde"
10142 AC_SUBST(ENABLE_TDE)
10144 ENABLE_KDE4=""
10145 if test "x$enable_kde4" = "xyes"; then
10146     ENABLE_KDE4="TRUE"
10147     AC_DEFINE(ENABLE_KDE4)
10148     R="$R kde4"
10150 AC_SUBST(ENABLE_KDE4)
10153 build_vcl_plugins="$R"
10154 if test -z "$build_vcl_plugins"; then
10155     build_vcl_plugins="none"
10157 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10159 dnl ===================================================================
10160 dnl check for dbus support
10161 dnl ===================================================================
10162 ENABLE_DBUS=""
10163 DBUS_CFLAGS=""
10164 DBUS_LIBS=""
10166 if test "$enable_dbus" = "no"; then
10167     test_dbus=no
10170 AC_MSG_CHECKING([whether to enable DBUS support])
10171 if test "$test_dbus" = "yes"; then
10172     ENABLE_DBUS="TRUE"
10173     AC_MSG_RESULT([yes])
10174     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
10175     AC_DEFINE(ENABLE_DBUS)
10176     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10177     FilterLibs "${DBUS_LIBS}"
10178     DBUS_LIBS="${filteredlibs}"
10179 else
10180     AC_MSG_RESULT([no])
10183 AC_SUBST(ENABLE_DBUS)
10184 AC_SUBST(DBUS_CFLAGS)
10185 AC_SUBST(DBUS_LIBS)
10187 AC_MSG_CHECKING([whether to enable Impress remote control])
10188 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10189     AC_MSG_RESULT([yes])
10190     ENABLE_SDREMOTE=TRUE
10191     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10193     # If not explicitly enabled or disabled, default
10194     if test -z "$enable_sdremote_bluetooth"; then
10195         case "$OS" in
10196         LINUX|MACOSX|WNT)
10197             # Default to yes for these
10198             enable_sdremote_bluetooth=yes
10199             ;;
10200         *)
10201             # otherwise no
10202             enable_sdremote_bluetooth=no
10203             ;;
10204         esac
10205     fi
10206     # $enable_sdremote_bluetooth is guaranteed non-empty now
10208     if test "$enable_sdremote_bluetooth" != "no"; then
10209         if test "$OS" = "LINUX"; then
10210             if test "$ENABLE_DBUS" = "TRUE"; then
10211                 AC_MSG_RESULT([yes])
10212                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10213                 dnl ===================================================================
10214                 dnl Check for system bluez
10215                 dnl ===================================================================
10216                 AC_MSG_CHECKING([which Bluetooth header to use])
10217                 if test "$with_system_bluez" = "yes"; then
10218                     AC_MSG_RESULT([external])
10219                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10220                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10221                     SYSTEM_BLUEZ=TRUE
10222                 else
10223                     AC_MSG_RESULT([internal])
10224                     SYSTEM_BLUEZ=
10225                 fi
10226             else
10227                 AC_MSG_RESULT([no, dbus disabled])
10228                 ENABLE_SDREMOTE_BLUETOOTH=
10229                 SYSTEM_BLUEZ=
10230             fi
10231         else
10232             AC_MSG_RESULT([yes])
10233             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10234             SYSTEM_BLUEZ=
10235         fi
10236     else
10237         AC_MSG_RESULT([no])
10238         ENABLE_SDREMOTE_BLUETOOTH=
10239         SYSTEM_BLUEZ=
10240     fi
10241 else
10242     ENABLE_SDREMOTE=
10243     SYSTEM_BLUEZ=
10244     AC_MSG_RESULT([no])
10246 AC_SUBST(ENABLE_SDREMOTE)
10247 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10248 AC_SUBST(SYSTEM_BLUEZ)
10250 dnl ===================================================================
10251 dnl Check whether the gtk 2.0 libraries are available.
10252 dnl ===================================================================
10254 GTK_CFLAGS=""
10255 GTK_LIBS=""
10256 ENABLE_SYSTRAY_GTK=""
10257 if test  "$test_gtk" = "yes"; then
10259     if test "$ENABLE_GTK" = "TRUE"; then
10260         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]))
10261         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10262         FilterLibs "${GTK_LIBS}"
10263         GTK_LIBS="${filteredlibs}"
10264         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]))
10265         BUILD_TYPE="$BUILD_TYPE GTK"
10266         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10267         FilterLibs "${GTHREAD_LIBS}"
10268         GTHREAD_LIBS="${filteredlibs}"
10270         if test "x$enable_systray" = "xyes"; then
10271             ENABLE_SYSTRAY_GTK="TRUE"
10272         fi
10274         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10275         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10276                           [ENABLE_GTK_PRINT="TRUE"],
10277                           [ENABLE_GTK_PRINT=""])
10278         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10279         FilterLibs "${GTK_PRINT_LIBS}"
10280         GTK_PRINT_LIBS="${filteredlibs}"
10282         AC_MSG_CHECKING([whether to enable GIO support])
10283         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10284             dnl Need at least 2.26 for the dbus support.
10285             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10286                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10287             if test "$ENABLE_GIO" = "TRUE"; then
10288                 AC_DEFINE(ENABLE_GIO)
10289                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10290                 FilterLibs "${GIO_LIBS}"
10291                 GIO_LIBS="${filteredlibs}"
10292             fi
10293         else
10294             AC_MSG_RESULT([no])
10295         fi
10296     fi
10298 AC_SUBST(ENABLE_GIO)
10299 AC_SUBST(GIO_CFLAGS)
10300 AC_SUBST(GIO_LIBS)
10301 AC_SUBST(ENABLE_SYSTRAY_GTK)
10302 AC_SUBST(GTK_CFLAGS)
10303 AC_SUBST(GTK_LIBS)
10304 AC_SUBST(GTHREAD_CFLAGS)
10305 AC_SUBST(GTHREAD_LIBS)
10306 AC_SUBST([ENABLE_GTK_PRINT])
10307 AC_SUBST([GTK_PRINT_CFLAGS])
10308 AC_SUBST([GTK_PRINT_LIBS])
10311 dnl ===================================================================
10312 dnl Check whether the Telepathy libraries are available.
10313 dnl ===================================================================
10315 ENABLE_TELEPATHY=""
10316 TELEPATHY_CFLAGS=""
10317 TELEPATHY_LIBS=""
10319 AC_MSG_CHECKING([whether to enable Telepathy support])
10320 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
10321     ENABLE_TELEPATHY="TRUE"
10322     AC_DEFINE(ENABLE_TELEPATHY)
10323     AC_MSG_RESULT([yes])
10324     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 )
10325     TELEPATHY_CFLAGS=$(printf '%s' "$TELEPATHY_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10326     FilterLibs "${TELEPATHY_LIBS}"
10327     TELEPATHY_LIBS="${filteredlibs}"
10328 else
10329     AC_MSG_RESULT([no])
10332 AC_SUBST(ENABLE_TELEPATHY)
10333 AC_SUBST(TELEPATHY_CFLAGS)
10334 AC_SUBST(TELEPATHY_LIBS)
10337 dnl ===================================================================
10339 SPLIT_APP_MODULES=""
10340 if test "$enable_split_app_modules" = "yes"; then
10341     SPLIT_APP_MODULES="TRUE"
10343 AC_SUBST(SPLIT_APP_MODULES)
10345 SPLIT_OPT_FEATURES=""
10346 if test "$enable_split_opt_features" = "yes"; then
10347     SPLIT_OPT_FEATURES="TRUE"
10349 AC_SUBST(SPLIT_OPT_FEATURES)
10351 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10352     if test "$enable_cairo_canvas" = yes; then
10353         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10354     fi
10355     enable_cairo_canvas=no
10356 elif test -z "$enable_cairo_canvas"; then
10357     enable_cairo_canvas=yes
10360 ENABLE_CAIRO_CANVAS=""
10361 if test "$enable_cairo_canvas" = "yes"; then
10362     test_cairo=yes
10363     ENABLE_CAIRO_CANVAS="TRUE"
10364     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10366 AC_SUBST(ENABLE_CAIRO_CANVAS)
10368 dnl ===================================================================
10369 dnl Check whether the GStreamer libraries are available.
10370 dnl It's possible to build avmedia with both GStreamer backends!
10371 dnl ===================================================================
10373 ENABLE_GSTREAMER_1_0=""
10375 if test "$build_gstreamer_1_0" = "yes"; then
10377     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10378     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10379         ENABLE_GSTREAMER_1_0="TRUE"
10380         AC_MSG_RESULT([yes])
10381         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10382         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10383         FilterLibs "${GSTREAMER_1_0_LIBS}"
10384         GSTREAMER_1_0_LIBS="${filteredlibs}"
10385     else
10386         AC_MSG_RESULT([no])
10387     fi
10389 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10390 AC_SUBST(GSTREAMER_1_0_LIBS)
10391 AC_SUBST(ENABLE_GSTREAMER_1_0)
10394 ENABLE_GSTREAMER_0_10=""
10395 if test "$build_gstreamer_0_10" = "yes"; then
10397     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10398     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10399         ENABLE_GSTREAMER_0_10="TRUE"
10400         AC_MSG_RESULT([yes])
10401         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10402             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10403         ])
10404         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10405         FilterLibs "${GSTREAMER_0_10_LIBS}"
10406         GSTREAMER_0_10_LIBS="${filteredlibs}"
10407     else
10408         AC_MSG_RESULT([no])
10409     fi
10412 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10413 AC_SUBST(GSTREAMER_0_10_LIBS)
10414 AC_SUBST(ENABLE_GSTREAMER_0_10)
10416 dnl ===================================================================
10417 dnl Check whether to build the VLC avmedia backend
10418 dnl ===================================================================
10420 ENABLE_VLC=""
10422 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10423 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10424     ENABLE_VLC="TRUE"
10425     AC_MSG_RESULT([yes])
10426 else
10427     AC_MSG_RESULT([no])
10429 AC_SUBST(ENABLE_VLC)
10431 ENABLE_OPENGL_TRANSITIONS=
10432 ENABLE_OPENGL_CANVAS=
10433 if test $_os = iOS -o $_os = Android; then
10434    : # disable
10435 elif test "$_os" = "Darwin"; then
10436     # We use frameworks on Mac OS X, no need for detail checks
10437     ENABLE_OPENGL_TRANSITIONS=TRUE
10438     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10439     ENABLE_OPENGL_CANVAS=TRUE
10440 elif test $_os = WINNT; then
10441     ENABLE_OPENGL_TRANSITIONS=TRUE
10442     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10443     ENABLE_OPENGL_CANVAS=TRUE
10444 else
10445     if test "$USING_X11" = TRUE; then
10446         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10447         ENABLE_OPENGL_TRANSITIONS=TRUE
10448         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10449         ENABLE_OPENGL_CANVAS=TRUE
10450     fi
10453 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10454 AC_SUBST(ENABLE_OPENGL_CANVAS)
10456 dnl =================================================
10457 dnl Check whether to build with OpenCL support.
10458 dnl =================================================
10460 if test $_os != iOS -a $_os != Android; then
10461     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10462     # platform (optional at run-time, used through clew).
10463     BUILD_TYPE="$BUILD_TYPE OPENCL"
10464     AC_DEFINE(HAVE_FEATURE_OPENCL)
10467 dnl ===================================================================
10468 dnl Check whether to enable glTF support
10469 dnl ===================================================================
10470 AC_MSG_CHECKING([whether to enable glTF support])
10471 ENABLE_GLTF=
10472 if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android -a "$ENABLE_HEADLESS" = ""; then
10473     ENABLE_GLTF=TRUE
10474     AC_MSG_RESULT([yes])
10475     AC_DEFINE(HAVE_FEATURE_GLTF,1)
10476     if test "$with_system_libgltf" = "yes"; then
10477         SYSTEM_LIBGLTF=TRUE
10478         PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10479         FilterLibs "${LIBGLTF_LIBS}"
10480         LIBGLTF_LIBS="${filteredlibs}"
10481     else
10482         BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10483     fi
10484 else
10485     AC_MSG_RESULT([no])
10487 AC_SUBST(ENABLE_GLTF)
10488 AC_SUBST(SYSTEM_LIBGLTF)
10489 AC_SUBST(LIBGLTF_CFLAGS)
10490 AC_SUBST(LIBGLTF_LIBS)
10492 dnl ===================================================================
10493 dnl Check whether to enable COLLADA support
10494 dnl ===================================================================
10495 AC_MSG_CHECKING([whether to enable COLLADA support])
10496 ENABLE_COLLADA=
10497 if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
10498     AC_MSG_RESULT([yes])
10499     ENABLE_COLLADA=TRUE
10500     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
10502     AC_MSG_CHECKING([which OPENCOLLADA to use])
10503     if test "$with_system_opencollada" = "yes"; then
10504         AC_MSG_RESULT([external])
10505         SYSTEM_OPENCOLLADA=TRUE
10506         AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
10507         AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
10508         AC_LANG_PUSH([C++])
10509         save_CXXFLAGS=$CXXFLAGS
10510         save_CPPFLAGS=$CPPFLAGS
10511         CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
10512         CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
10513         AC_CHECK_HEADERS(
10514                 COLLADABU.h \
10515                 COLLADAFW.h \
10516                 COLLADASaxFWLLoader.h \
10517                 GeneratedSaxParser.h,
10518             [],
10519             [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
10520             [])
10521         CXXFLAGS=$save_CXXFLAGS
10522         CPPFLAGS=$save_CPPFLAGS
10523         AC_LANG_POP([C++])
10524         OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10525         FilterLibs "${OPENCOLLADA_LIBS}"
10526         OPENCOLLADA_LIBS="${filteredlibs}"
10527     else
10528         AC_MSG_RESULT([internal])
10529         BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
10530     fi
10532     AC_MSG_CHECKING([which collada2gltf to use])
10533     if test "$with_system_collada2gltf" = "yes"; then
10534         if test "$with_system_opencollada" = "no"; then
10535             AC_MSG_ERROR([the combination of system collada2gltf and internal openCOLLADA is not allowed])
10536         fi
10537         AC_MSG_RESULT([external])
10538         SYSTEM_COLLADA2GLTF=TRUE
10539         AS_IF([test -n "$COLLADA2GLTF_CFLAGS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_CFLAGS])])
10540         AS_IF([test -n "$COLLADA2GLTF_LIBS"],[],[AC_MSG_ERROR([export COLLADA2GLTF_LIBS])])
10541         AC_LANG_PUSH([C++])
10542         save_CXXFLAGS=$CXXFLAGS
10543         save_CPPFLAGS=$CPPFLAGS
10544         CXXFLAGS="$CXXFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10545         CPPFLAGS="$CPPFLAGS $COLLADA2GLTF_CFLAGS $OPENCOLLADA_CFLAGS $CXXFLAGS_CXX11"
10546         AC_CHECK_HEADERS(
10547                 GLTF.h \
10548                 encodingHelpers.h,
10549             [],
10550             [AC_MSG_ERROR([collada2gltf headers not found. Install collada2gltf])],
10551             [])
10552         CXXFLAGS=$save_CXXFLAGS
10553         CPPFLAGS=$save_CPPFLAGS
10554         AC_LANG_POP([C++])
10555         COLLADA2GLTF_CFLAGS=$(printf '%s' "$COLLADA2GLTF_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10556         FilterLibs "${COLLADA2GLTF_LIBS}"
10557         COLLADA2GLTF_LIBS="${filteredlibs}"
10558     else
10559         AC_MSG_RESULT([internal])
10560         BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
10561     fi
10562 else
10563     AC_MSG_RESULT([no])
10565 AC_SUBST(ENABLE_COLLADA)
10566 AC_SUBST([OPENCOLLADA_CFLAGS])
10567 AC_SUBST([OPENCOLLADA_LIBS])
10568 AC_SUBST([SYSTEM_OPENCOLLADA])
10570 AC_SUBST([COLLADA2GLTF_CFLAGS])
10571 AC_SUBST([COLLADA2GLTF_LIBS])
10572 AC_SUBST([SYSTEM_COLLADA2GLTF])
10574 if test "$enable_dconf" != no; then
10575     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10576         if test "$enable_dconf" = yes; then
10577             AC_MSG_ERROR([dconf not found])
10578         else
10579             enable_dconf=no
10580         fi])
10582 AC_MSG_CHECKING([whether to enable dconf])
10583 if test "$enable_dconf" = no; then
10584     DCONF_CFLAGS=
10585     DCONF_LIBS=
10586     ENABLE_DCONF=
10587     AC_MSG_RESULT([no])
10588 else
10589     ENABLE_DCONF=TRUE
10590     AC_DEFINE(ENABLE_DCONF)
10591     AC_MSG_RESULT([yes])
10593 AC_SUBST([DCONF_CFLAGS])
10594 AC_SUBST([DCONF_LIBS])
10595 AC_SUBST([ENABLE_DCONF])
10597 # pdf import?
10598 AC_MSG_CHECKING([whether to build the PDF import feature])
10599 ENABLE_PDFIMPORT=
10600 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10601     AC_MSG_RESULT([yes])
10602     ENABLE_PDFIMPORT=TRUE
10603     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10605     dnl ===================================================================
10606     dnl Check for system poppler
10607     dnl ===================================================================
10608     AC_MSG_CHECKING([which PDF import backend to use])
10609     if test "$with_system_poppler" = "yes"; then
10610         AC_MSG_RESULT([external])
10611         SYSTEM_POPPLER=TRUE
10612         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10613         AC_LANG_PUSH([C++])
10614         save_CXXFLAGS=$CXXFLAGS
10615         save_CPPFLAGS=$CPPFLAGS
10616         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10617         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10618         AC_CHECK_HEADER([cpp/poppler-version.h],
10619             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10620             [])
10621         CXXFLAGS=$save_CXXFLAGS
10622         CPPFLAGS=$save_CPPFLAGS
10623         AC_LANG_POP([C++])
10624         libo_MINGW_CHECK_DLL([libpoppler])
10625         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10627         FilterLibs "${POPPLER_LIBS}"
10628         POPPLER_LIBS="${filteredlibs}"
10629     else
10630         AC_MSG_RESULT([internal])
10631         SYSTEM_POPPLER=
10632         BUILD_TYPE="$BUILD_TYPE POPPLER"
10633         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10634     fi
10635     AC_DEFINE([ENABLE_PDFIMPORT],1)
10636 else
10637     AC_MSG_RESULT([no])
10639 AC_SUBST(ENABLE_PDFIMPORT)
10640 AC_SUBST(SYSTEM_POPPLER)
10641 AC_SUBST(POPPLER_CFLAGS)
10642 AC_SUBST(POPPLER_LIBS)
10644 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10645 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10646     AC_MSG_RESULT([yes])
10647     ENABLE_MEDIAWIKI=TRUE
10648     BUILD_TYPE="$BUILD_TYPE XSLTML"
10649     if test  "x$with_java" = "xno"; then
10650         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10651     fi
10652 else
10653     AC_MSG_RESULT([no])
10654     ENABLE_MEDIAWIKI=
10655     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10657 AC_SUBST(ENABLE_MEDIAWIKI)
10659 AC_MSG_CHECKING([whether to build the Report Builder])
10660 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10661     AC_MSG_RESULT([yes])
10662     ENABLE_REPORTBUILDER=TRUE
10663     AC_MSG_CHECKING([which jfreereport libs to use])
10664     if test "$with_system_jfreereport" = "yes"; then
10665         SYSTEM_JFREEREPORT=TRUE
10666         AC_MSG_RESULT([external])
10667         if test -z $SAC_JAR; then
10668             SAC_JAR=/usr/share/java/sac.jar
10669         fi
10670         if ! test -f $SAC_JAR; then
10671              AC_MSG_ERROR(sac.jar not found.)
10672         fi
10674         if test -z $LIBXML_JAR; then
10675             if test -f /usr/share/java/libxml-1.0.0.jar; then
10676                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10677             elif test -f /usr/share/java/libxml.jar; then
10678                 LIBXML_JAR=/usr/share/java/libxml.jar
10679             else
10680                 AC_MSG_ERROR(libxml.jar replacement not found.)
10681             fi
10682         elif ! test -f $LIBXML_JAR; then
10683             AC_MSG_ERROR(libxml.jar not found.)
10684         fi
10686         if test -z $FLUTE_JAR; then
10687             if test -f/usr/share/java/flute-1.3.0.jar; then
10688                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10689             elif test -f /usr/share/java/flute.jar; then
10690                 FLUTE_JAR=/usr/share/java/flute.jar
10691             else
10692                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10693             fi
10694         elif ! test -f $FLUTE_JAR; then
10695             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10696         fi
10698         if test -z $JFREEREPORT_JAR; then
10699             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10700                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10701             elif test -f /usr/share/java/flow-engine.jar; then
10702                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10703             else
10704                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10705             fi
10706         elif ! test -f  $JFREEREPORT_JAR; then
10707                 AC_MSG_ERROR(jfreereport.jar not found.)
10708         fi
10710         if test -z $LIBLAYOUT_JAR; then
10711             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10712                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10713             elif test -f /usr/share/java/liblayout.jar; then
10714                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10715             else
10716                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10717             fi
10718         elif ! test -f $LIBLAYOUT_JAR; then
10719                 AC_MSG_ERROR(liblayout.jar not found.)
10720         fi
10722         if test -z $LIBLOADER_JAR; then
10723             if test -f /usr/share/java/libloader-1.0.0.jar; then
10724                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10725             elif test -f /usr/share/java/libloader.jar; then
10726                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10727             else
10728                 AC_MSG_ERROR(libloader.jar replacement not found.)
10729             fi
10730         elif ! test -f  $LIBLOADER_JAR; then
10731             AC_MSG_ERROR(libloader.jar not found.)
10732         fi
10734         if test -z $LIBFORMULA_JAR; then
10735             if test -f /usr/share/java/libformula-0.2.0.jar; then
10736                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10737             elif test -f /usr/share/java/libformula.jar; then
10738                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10739             else
10740                 AC_MSG_ERROR(libformula.jar replacement not found.)
10741             fi
10742         elif ! test -f $LIBFORMULA_JAR; then
10743                 AC_MSG_ERROR(libformula.jar not found.)
10744         fi
10746         if test -z $LIBREPOSITORY_JAR; then
10747             if test -f /usr/share/java/librepository-1.0.0.jar; then
10748                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10749             elif test -f /usr/share/java/librepository.jar; then
10750                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10751             else
10752                 AC_MSG_ERROR(librepository.jar replacement not found.)
10753             fi
10754         elif ! test -f $LIBREPOSITORY_JAR; then
10755             AC_MSG_ERROR(librepository.jar not found.)
10756         fi
10758         if test -z $LIBFONTS_JAR; then
10759             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10760                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10761             elif test -f /usr/share/java/libfonts.jar; then
10762                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10763             else
10764                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10765             fi
10766         elif ! test -f $LIBFONTS_JAR; then
10767                 AC_MSG_ERROR(libfonts.jar not found.)
10768         fi
10770         if test -z $LIBSERIALIZER_JAR; then
10771             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10772                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10773             elif test -f /usr/share/java/libserializer.jar; then
10774                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10775             else
10776                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10777             fi
10778         elif ! test -f $LIBSERIALIZER_JAR; then
10779                 AC_MSG_ERROR(libserializer.jar not found.)
10780         fi
10782         if test -z $LIBBASE_JAR; then
10783             if test -f /usr/share/java/libbase-1.0.0.jar; then
10784                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10785             elif test -f /usr/share/java/libbase.jar; then
10786                 LIBBASE_JAR=/usr/share/java/libbase.jar
10787             else
10788                 AC_MSG_ERROR(libbase.jar replacement not found.)
10789             fi
10790         elif ! test -f $LIBBASE_JAR; then
10791             AC_MSG_ERROR(libbase.jar not found.)
10792         fi
10794     else
10795         AC_MSG_RESULT([internal])
10796         SYSTEM_JFREEREPORT=
10797         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10798     fi
10799 else
10800     AC_MSG_RESULT([no])
10801     ENABLE_REPORTBUILDER=
10802     SYSTEM_JFREEREPORT=
10804 AC_SUBST(ENABLE_REPORTBUILDER)
10805 AC_SUBST(SYSTEM_JFREEREPORT)
10806 AC_SUBST(SAC_JAR)
10807 AC_SUBST(LIBXML_JAR)
10808 AC_SUBST(FLUTE_JAR)
10809 AC_SUBST(JFREEREPORT_JAR)
10810 AC_SUBST(LIBBASE_JAR)
10811 AC_SUBST(LIBLAYOUT_JAR)
10812 AC_SUBST(LIBLOADER_JAR)
10813 AC_SUBST(LIBFORMULA_JAR)
10814 AC_SUBST(LIBREPOSITORY_JAR)
10815 AC_SUBST(LIBFONTS_JAR)
10816 AC_SUBST(LIBSERIALIZER_JAR)
10818 # this has to be here because both the Wiki Publisher and the SRB use
10819 # commons-logging
10820 COMMONS_LOGGING_VERSION=1.2
10821 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10822     AC_MSG_CHECKING([which Apache commons-* libs to use])
10823     if test "$with_system_apache_commons" = "yes"; then
10824         SYSTEM_APACHE_COMMONS=TRUE
10825         AC_MSG_RESULT([external])
10826         if test -z $COMMONS_LOGGING_JAR; then
10827             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10828                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10829            elif test -f /usr/share/java/commons-logging.jar; then
10830                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10831             else
10832                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10833             fi
10834         elif ! test -f $COMMONS_LOGGING_JAR; then
10835             AC_MSG_ERROR(commons-logging.jar not found.)
10836         fi
10837     else
10838         AC_MSG_RESULT([internal])
10839         SYSTEM_APACHE_COMMONS=
10840         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
10841     fi
10843 AC_SUBST(SYSTEM_APACHE_COMMONS)
10844 AC_SUBST(COMMONS_LOGGING_JAR)
10845 AC_SUBST(COMMONS_LOGGING_VERSION)
10847 # scripting provider for BeanShell?
10848 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10849 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10850     AC_MSG_RESULT([yes])
10851     ENABLE_SCRIPTING_BEANSHELL=TRUE
10853     dnl ===================================================================
10854     dnl Check for system beanshell
10855     dnl ===================================================================
10856     AC_MSG_CHECKING([which beanshell to use])
10857     if test "$with_system_beanshell" = "yes"; then
10858         AC_MSG_RESULT([external])
10859         SYSTEM_BSH=TRUE
10860         if test -z $BSH_JAR; then
10861             BSH_JAR=/usr/share/java/bsh.jar
10862         fi
10863         if ! test -f $BSH_JAR; then
10864             AC_MSG_ERROR(bsh.jar not found.)
10865         fi
10866     else
10867         AC_MSG_RESULT([internal])
10868         SYSTEM_BSH=
10869         BUILD_TYPE="$BUILD_TYPE BSH"
10870     fi
10871 else
10872     AC_MSG_RESULT([no])
10873     ENABLE_SCRIPTING_BEANSHELL=
10874     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10876 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10877 AC_SUBST(SYSTEM_BSH)
10878 AC_SUBST(BSH_JAR)
10880 # scripting provider for JavaScript?
10881 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10882 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10883     AC_MSG_RESULT([yes])
10884     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10886     dnl ===================================================================
10887     dnl Check for system rhino
10888     dnl ===================================================================
10889     AC_MSG_CHECKING([which rhino to use])
10890     if test "$with_system_rhino" = "yes"; then
10891         AC_MSG_RESULT([external])
10892         SYSTEM_RHINO=TRUE
10893         if test -z $RHINO_JAR; then
10894             RHINO_JAR=/usr/share/java/js.jar
10895         fi
10896         if ! test -f $RHINO_JAR; then
10897             AC_MSG_ERROR(js.jar not found.)
10898         fi
10899     else
10900         AC_MSG_RESULT([internal])
10901         SYSTEM_RHINO=
10902         BUILD_TYPE="$BUILD_TYPE RHINO"
10903     fi
10904 else
10905     AC_MSG_RESULT([no])
10906     ENABLE_SCRIPTING_JAVASCRIPT=
10907     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10909 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10910 AC_SUBST(SYSTEM_RHINO)
10911 AC_SUBST(RHINO_JAR)
10913 # This is only used in KDE3/KDE4/TDE checks to determine if /usr/lib64
10914 # paths should be added to library search path. So lets put all 64-bit
10915 # platforms there.
10916 supports_multilib=
10917 case "$host_cpu" in
10918 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10919     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10920         supports_multilib="yes"
10921     fi
10922     ;;
10924     ;;
10925 esac
10927 dnl ===================================================================
10928 dnl Check whether the TQt and TDE libraries are available.
10929 dnl ===================================================================
10931 TDE_CFLAGS=""
10932 TDE_LIBS=""
10933 if test "$_os" != "OpenBSD"; then
10934     TDE_MOC="moc"
10936 if test "$test_tde" = "yes" -a "$ENABLE_TDE" = "TRUE"; then
10937     dnl Search paths for TQt and TDE
10938     if test -z "$supports_multilib"; then
10939         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"
10940         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"
10941     else
10942         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"
10943         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"
10944     fi
10945     if test -n "$TQTDIR"; then
10946         tqt_incdirs="$TQTDIR/include $tqt_incdirs"
10947         if test -z "$supports_multilib"; then
10948             tqt_libdirs="$TQTDIR/lib $tqt_libdirs"
10949         else
10950             tqt_libdirs="$TQTDIR/lib64 $TQTDIR/lib $tqt_libdirs"
10951         fi
10952     fi
10953     if test -z "$supports_multilib"; then
10954         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"
10955         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"
10956     else
10957         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"
10958         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"
10959     fi
10960     if test -n "$TDEDIR"; then
10961         tde_incdirs="$TDEDIR/include $tde_incdirs"
10962         if test -z "$supports_multilib"; then
10963             tde_libdirs="$TDEDIR/lib $tde_libdirs"
10964         else
10965             tde_libdirs="$TDEDIR/lib64 $TDEDIR/lib $tde_libdirs"
10966         fi
10967     fi
10969     dnl What to test
10970     tqt_test_include="ntqstyle.h"
10971     tde_test_include="kapp.h"
10973     if test "$_os" != "OpenBSD"; then
10974         tqt_test_library="libtqt-mt.so"
10975         tde_test_library="libDCOP.so"
10976     else
10977         tqt_test_library="libtqt-mt.so*"
10978         tde_test_library="libDCOP.so*"
10979     fi
10981     dnl Check for TQt headers
10982     AC_MSG_CHECKING([for TQt headers])
10983     tqt_incdir="no"
10984     for tde_check in $tqt_incdirs; do
10985         if test -r "$tde_check/$tqt_test_include"; then
10986             tqt_incdir="$tde_check"
10987             break
10988         fi
10989     done
10990     AC_MSG_RESULT([$tqt_incdir])
10991     if test "x$tqt_incdir" = "xno"; then
10992         AC_MSG_ERROR([TQt headers not found.  Please specify the root of
10993 your TQt installation by exporting TQTDIR before running "configure".])
10994     fi
10996     dnl Check for TQt libraries
10997     AC_MSG_CHECKING([for TQt libraries])
10998     tqt_libdir="no"
10999     for tqt_check in $tqt_libdirs; do
11000         if test -r "`ls $tqt_check/$tqt_test_library 2>/dev/null | head -1`"; then
11001             tqt_libdir="$tqt_check"
11002             break
11003         fi
11004     done
11005     AC_MSG_RESULT([$tqt_libdir])
11006     if test "x$tqt_libdir" = "xno"; then
11007         AC_MSG_ERROR([TQt libraries not found.  Please specify the root of
11008 your TQt installation by exporting TQTDIR before running "configure".])
11009     fi
11011     dnl Check for Meta Object Compiler
11012     AC_PATH_PROG( MOC, moc, no, [`dirname $tqt_libdir`/bin:$TQTDIR/bin:$PATH] )
11013     if test "$MOC" = "no"; then
11014         AC_MSG_ERROR([TQt Meta Object Compiler not found.  Please specify
11015 the root of your TQt installation by exporting TQTDIR before running "configure".])
11016     fi
11018     dnl Check for TDE headers
11019     AC_MSG_CHECKING([for TDE headers])
11020     tde_incdir="no"
11021     for tde_check in $tde_incdirs; do
11022         if test -r "$tde_check/$tde_test_include"; then
11023             tde_incdir="$tde_check"
11024             break
11025         fi
11026     done
11027     AC_MSG_RESULT([$tde_incdir])
11028     if test "x$tde_incdir" = "xno"; then
11029         AC_MSG_ERROR([TDE headers not found.  Please specify the root of
11030 your TDE installation by exporting TDEDIR before running "configure".])
11031     fi
11033     dnl Check for TDE libraries
11034     AC_MSG_CHECKING([for TDE libraries])
11035     tde_libdir="no"
11036     for tde_check in $tde_libdirs; do
11037         if test -r "`ls $tde_check/$tde_test_library 2>/dev/null | head -1`"; then
11038             tde_libdir="$tde_check"
11039             break
11040         fi
11041     done
11042     AC_MSG_RESULT([$tde_libdir])
11043     if test "x$tde_libdir" = "xno"; then
11044         AC_MSG_ERROR([TDE libraries not found.  Please specify the root of
11045 your TDE installation by exporting TDEDIR before running "configure".])
11046     fi
11048     dnl Set the variables
11049     TDE_CFLAGS="-I$tqt_incdir -I$tde_incdir -I/usr/include/tqt -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11050     TDE_LIBS="-L$tde_libdir -L$tqt_libdir -ltdeio -ltdeui -ltdecore -ltqt -ltqt-mt"
11052 AC_SUBST(TDE_CFLAGS)
11053 AC_SUBST(TDE_LIBS)
11054 AC_SUBST(TDE_MOC)
11056 dnl ===================================================================
11057 dnl KDE4 Integration
11058 dnl ===================================================================
11060 KDE4_CFLAGS=""
11061 KDE4_LIBS=""
11062 QMAKE4="qmake"
11063 MOC4="moc"
11064 KDE4_GLIB_CFLAGS=""
11065 KDE4_GLIB_LIBS=""
11066 KDE4_HAVE_GLIB=""
11067 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
11068     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
11069     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
11071     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
11072     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
11074     if test -n "$supports_multilib"; then
11075         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
11076         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
11077     fi
11079     if test -n "$QTDIR"; then
11080         qt4_incdirs="$QTDIR/include $qt4_incdirs"
11081         if test -z "$supports_multilib"; then
11082             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
11083         else
11084             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
11085         fi
11086     fi
11087     if test -n "$QT4DIR"; then
11088         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
11089         if test -z "$supports_multilib"; then
11090             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
11091         else
11092             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
11093         fi
11094     fi
11096     if test -n "$KDEDIR"; then
11097         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
11098         if test -z "$supports_multilib"; then
11099             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
11100         else
11101             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
11102         fi
11103     fi
11104     if test -n "$KDE4DIR"; then
11105         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
11106         if test -z "$supports_multilib"; then
11107             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
11108         else
11109             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
11110         fi
11111     fi
11113     qt4_test_include="Qt/qobject.h"
11114     qt4_test_library="libQtNetwork.so"
11115     kde4_test_include="kwindowsystem.h"
11116     kde4_test_library="libsolid.so"
11118     AC_MSG_CHECKING([for Qt4 headers])
11119     qt4_header_dir="no"
11120     for inc_dir in $qt4_incdirs; do
11121         if test -r "$inc_dir/$qt4_test_include"; then
11122             qt4_header_dir="$inc_dir"
11123             break
11124         fi
11125     done
11127     AC_MSG_RESULT([$qt4_header_dir])
11128     if test "x$qt4_header_dir" = "xno"; then
11129         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11130     fi
11132     dnl Check for qmake
11133     AC_PATH_PROG( QMAKEQT4, qmake-qt4, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
11134     QMAKE4="$QMAKEQT4"
11135     if test "$QMAKE4" = "no"; then
11136         AC_PATH_PROG( QMAKE4, qmake, no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
11137         if test "$QMAKE4" = "no"; then
11138             AC_MSG_ERROR([Qmake not found.  Please specify
11139 the root of your Qt installation by exporting QT4DIR before running "configure".])
11140         fi
11141     fi
11143     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
11144     AC_MSG_CHECKING([for Qt4 libraries])
11145     qt4_lib_dir="no"
11146     for lib_dir in $qt4_libdirs; do
11147         if test -r "$lib_dir/$qt4_test_library"; then
11148             qt4_lib_dir="$lib_dir"
11149             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
11150             break
11151         fi
11152     done
11154     AC_MSG_RESULT([$qt4_lib_dir])
11156     if test "x$qt4_lib_dir" = "xno"; then
11157         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
11158     fi
11160     dnl Check for Meta Object Compiler
11162     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11163     MOC4="$MOCQT4"
11164     if test "$MOC4" = "no"; then
11165         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
11166         if test "$MOC4" = "no"; then
11167             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11168 the root of your Qt installation by exporting QT4DIR before running "configure".])
11169         fi
11170     fi
11172     dnl Check for KDE4 headers
11173     AC_MSG_CHECKING([for KDE4 headers])
11174     kde4_incdir="no"
11175     for kde4_check in $kde4_incdirs; do
11176         if test -r "$kde4_check/$kde4_test_include"; then
11177             kde4_incdir="$kde4_check"
11178             break
11179         fi
11180     done
11181     AC_MSG_RESULT([$kde4_incdir])
11182     if test "x$kde4_incdir" = "xno"; then
11183         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11184     fi
11185     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
11187     dnl Check for KDE4 libraries
11188     AC_MSG_CHECKING([for KDE4 libraries])
11189     kde4_libdir="no"
11190     for kde4_check in $kde4_libdirs; do
11191         if test -r "$kde4_check/$kde4_test_library"; then
11192             kde4_libdir="$kde4_check"
11193             break
11194         fi
11195     done
11197     AC_MSG_RESULT([$kde4_libdir])
11198     if test "x$kde4_libdir" = "xno"; then
11199         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
11200     fi
11202     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
11203     if ! test -z "$kde4_incdir"; then
11204         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11205     else
11206         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11207     fi
11209     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
11210     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11211     FilterLibs "$KDE4_LIBS"
11212     KDE4_LIBS="$filteredlibs"
11214     AC_LANG_PUSH([C++])
11215     save_CXXFLAGS=$CXXFLAGS
11216     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11217     AC_MSG_CHECKING([whether KDE is >= 4.2])
11218        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11219 #include <kdeversion.h>
11221 int main(int argc, char **argv) {
11222        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
11223        else return 1;
11225 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
11226     CXXFLAGS=$save_CXXFLAGS
11227     AC_LANG_POP([C++])
11229     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11230     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
11231     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
11232         [
11233             KDE4_HAVE_GLIB=1
11234             AC_DEFINE(KDE4_HAVE_GLIB,1)
11235             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11236             FilterLibs "${KDE4_GLIB_LIBS}"
11237             KDE4_GLIB_LIBS="${filteredlibs}"
11239             qt4_fix_warning=
11241             AC_LANG_PUSH([C++])
11242             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11243             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11244             #  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
11245             #               ^~~~~~~~~~~~~~~~~~~~~~~
11246             #               vptr for 'QObjectPrivate'
11247             save_CXX=$CXX
11248             CXX=$(printf %s "$CXX" \
11249                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11250             save_CXXFLAGS=$CXXFLAGS
11251             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11252             save_LIBS=$LIBS
11253             LIBS="$LIBS $KDE4_LIBS"
11254             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11256             # Prepare meta object data
11257             TSTBASE="tst_exclude_socket_notifiers"
11258             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11259             ln -fs "${TSTMOC}.hxx"
11260             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11262             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11263 #include <cstdlib>
11264 #include "tst_exclude_socket_notifiers.moc"
11266 int main(int argc, char *argv[])
11268     QCoreApplication app(argc, argv);
11269     exit(tst_processEventsExcludeSocket());
11270     return 0;
11272             ]])],[
11273                 AC_MSG_RESULT([yes])
11274             ],[
11275                 AC_MSG_RESULT([no])
11276                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11277                 if test -z "$qt4_fix_warning"; then
11278                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11279                 fi
11280                 qt4_fix_warning=1
11281                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-37380 (needed)"
11282                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11284             # Remove meta object data
11285             rm -f "${TSTBASE}."*
11287             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11289             # Prepare meta object data
11290             TSTBASE="tst_exclude_posted_events"
11291             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11292             ln -fs "${TSTMOC}.hxx"
11293             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11295             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11296 #include <cstdlib>
11297 #include "tst_exclude_posted_events.moc"
11299 int main(int argc, char *argv[])
11301     QCoreApplication app(argc, argv);
11302     exit(tst_excludePostedEvents());
11303     return 0;
11305             ]])],[
11306                 AC_MSG_RESULT([yes])
11307             ],[
11308                 AC_MSG_RESULT([no])
11309                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11310                 if test -z "$qt4_fix_warning"; then
11311                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11312                 fi
11313                 qt4_fix_warning=1
11314                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-34614 (needed)"
11315             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11317             # Remove meta object data
11318             rm -f "${TSTBASE}."*
11320             if test -n "$qt4_fix_warning"; then
11321                 add_warning "  https://bugreports.qt-project.org/browse/QTBUG-38585 (recommended)"
11322             fi
11324             LIBS=$save_LIBS
11325             CXXFLAGS=$save_CXXFLAGS
11326             CXX=$save_CXX
11327             AC_LANG_POP([C++])
11328         ],
11329         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11331 AC_SUBST(KDE4_CFLAGS)
11332 AC_SUBST(KDE4_LIBS)
11333 AC_SUBST(MOC4)
11334 AC_SUBST(KDE4_GLIB_CFLAGS)
11335 AC_SUBST(KDE4_GLIB_LIBS)
11336 AC_SUBST(KDE4_HAVE_GLIB)
11338 dnl ===================================================================
11339 dnl Test whether to include Evolution 2 support
11340 dnl ===================================================================
11341 AC_MSG_CHECKING([whether to enable evolution 2 support])
11342 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11343     AC_MSG_RESULT([yes])
11344     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11345     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11346     FilterLibs "${GOBJECT_LIBS}"
11347     GOBJECT_LIBS="${filteredlibs}"
11348     ENABLE_EVOAB2="TRUE"
11349 else
11350     ENABLE_EVOAB2=""
11351     AC_MSG_RESULT([no])
11353 AC_SUBST(ENABLE_EVOAB2)
11354 AC_SUBST(GOBJECT_CFLAGS)
11355 AC_SUBST(GOBJECT_LIBS)
11357 dnl ===================================================================
11358 dnl Test whether to include TDE AB support
11359 dnl ===================================================================
11360 AC_MSG_CHECKING([whether to enable TDE address book support])
11361 if test "$enable_tdeab" = "yes" -a "$enable_tde" = "yes"; then
11362     AC_MSG_RESULT([yes])
11363     AC_LANG_PUSH([C++])
11364     save_CXXFLAGS=$CXXFLAGS
11365     CXXFLAGS="$CXXFLAGS $TDE_CFLAGS"
11366     AC_MSG_CHECKING([whether TDE is at least R14.0])
11367        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11368 #include <tdeversion.h>
11370 int main(int argc, char **argv) {
11371        if (TDE_VERSION_MAJOR >= 14) return 0;
11372        else return 1;
11374        ]])],[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])],
11375        [AC_MSG_ERROR([TDE support not tested with cross compilation])])
11376     CXXFLAGS=$save_CXXFLAGS
11377     AC_LANG_POP([C++])
11378     ENABLE_TDEAB=TRUE
11379 else
11380     AC_MSG_RESULT([no])
11381     ENABLE_TDEAB=
11383 AC_SUBST(ENABLE_TDEAB)
11385 dnl ===================================================================
11386 dnl Test which themes to include
11387 dnl ===================================================================
11388 AC_MSG_CHECKING([which themes to include])
11389 # if none given use default subset of available themes
11390 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11391     with_theme="breeze breeze_dark galaxy hicontrast oxygen sifr tango"
11392     test -z "$ENABLE_RELEASE_BUILD" && with_theme="$with_theme tango_testing"
11395 WITH_THEMES=""
11396 if test "x$with_theme" != "xno"; then
11397     for theme in $with_theme; do
11398         case $theme in
11399         breeze|breeze_dark|crystal|elementary|galaxy|hicontrast|oxygen|sifr|tango|tango_testing) real_theme="$theme" ;;
11400         default) real_theme=galaxy ;;
11401         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11402         esac
11403         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11404     done
11406 AC_MSG_RESULT([$WITH_THEMES])
11407 AC_SUBST([WITH_THEMES])
11408 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11409 for theme in $with_theme; do
11410     case $theme in
11411     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11412     *) ;;
11413     esac
11414 done
11416 dnl ===================================================================
11417 dnl Test whether to integrate helppacks into the product's installer
11418 dnl ===================================================================
11419 AC_MSG_CHECKING([for helppack integration])
11420 if test "$with_helppack_integration" = "no"; then
11421     WITH_HELPPACK_INTEGRATION=
11422     AC_MSG_RESULT([no integration])
11423 else
11424     WITH_HELPPACK_INTEGRATION=TRUE
11425     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11426     AC_MSG_RESULT([integration])
11428 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11430 ###############################################################################
11431 # Extensions checking
11432 ###############################################################################
11433 AC_MSG_CHECKING([for extensions integration])
11434 if test "x$enable_extension_integration" != "xno"; then
11435     WITH_EXTENSION_INTEGRATION=TRUE
11436     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11437     AC_MSG_RESULT([yes, use integration])
11438 else
11439     WITH_EXTENSION_INTEGRATION=
11440     AC_MSG_RESULT([no, do not integrate])
11442 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11444 dnl Should any extra extensions be included?
11445 dnl There are standalone tests for each of these below.
11446 WITH_EXTRA_EXTENSIONS=
11447 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11449 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11450 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11451 libo_CHECK_EXTENSION([Google Docs],[GOOGLE_DOCS],[google_docs],[google-docs],[27211596cf0ad97cab7321239406fde0-gdocs_3.0.1_modified.oxt])
11452 if test "x$with_java" != "xno"; then
11453     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11454     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11457 TEST_FONTS_MISSING=0
11459 # $1  = font family
11460 # $2+ = accepted font mappings
11461 test_font_map()
11463     FONT="$1" ; shift
11464     AC_MSG_CHECKING([font mapping for '$FONT'])
11465     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11466     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11468     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11469     while test "$#" -ge 1 ; do
11470         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11471         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11472     done
11473     if test $TESTEXPR
11474     then
11475         AC_MSG_RESULT([ok])
11476     else
11477         AC_MSG_RESULT([unknown ($FONTFILE)])
11478         TEST_FONTS_MISSING=1
11479     fi
11482 dnl ===================================================================
11483 dnl Test whether to include fonts
11484 dnl ===================================================================
11485 AC_MSG_CHECKING([whether to include third-party fonts])
11486 if test "$with_fonts" != "no"; then
11487     AC_MSG_RESULT([yes])
11488     WITH_FONTS=TRUE
11489     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11490 else
11491     AC_MSG_RESULT([no])
11492     WITH_FONTS=
11493     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11494     if test "$test_fontconfig" = "yes"; then
11495         AC_PATH_PROG([FCMATCH], [fc-match])
11496         if test -z "$FCMATCH"; then
11497             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11498             TEST_FONTS_MISSING=1
11499         else
11500             test_font_map 'Calibri' 'Carlito'
11501             if test ${TEST_FONTS_MISSING} -eq 1
11502             then
11503                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11504             fi
11505         fi
11506     else
11507         TEST_FONTS_MISSING=0
11508     fi
11510 AC_SUBST(WITH_FONTS)
11511 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11514 dnl ===================================================================
11515 dnl Test whether to enable online update service
11516 dnl ===================================================================
11517 AC_MSG_CHECKING([whether to enable online update])
11518 ENABLE_ONLINE_UPDATE=
11519 ENABLE_ONLINE_UPDATE_MAR=
11520 if test "$enable_online_update" = ""; then
11521     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11522         AC_MSG_RESULT([yes])
11523         ENABLE_ONLINE_UPDATE="TRUE"
11524     else
11525         AC_MSG_RESULT([no])
11526     fi
11527 else
11528     if test "$enable_online_update" = "mar"; then
11529         AC_MSG_RESULT([yes - MAR-based online update])
11530         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11531     elif test "$enable_online_update" = "yes"; then
11532         AC_MSG_RESULT([yes])
11533         ENABLE_ONLINE_UPDATE="TRUE"
11534     else
11535         AC_MSG_RESULT([no])
11536     fi
11538 AC_SUBST(ENABLE_ONLINE_UPDATE)
11539 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11541 dnl ===================================================================
11542 dnl Test whether we need bzip2
11543 dnl ===================================================================
11544 SYSTEM_BZIP2=
11545 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11546     AC_MSG_CHECKING([whether to use system bzip2])
11547     if test "$with_system_bzip2" = yes; then
11548         SYSTEM_BZIP2=TRUE
11549         AC_MSG_RESULT([yes])
11550         PKG_CHECK_MODULES(BZIP2, bzip2)
11551         FilterLibs "${BZIP2_LIBS}"
11552         BZIP2_LIBS="${filteredlibs}"
11553     else
11554         AC_MSG_RESULT([no])
11555         BUILD_TYPE="$BUILD_TYPE BZIP2"
11556     fi
11558 AC_SUBST(SYSTEM_BZIP2)
11559 AC_SUBST(BZIP2_CFLAGS)
11560 AC_SUBST(BZIP2_LIBS)
11562 dnl ===================================================================
11563 dnl Test whether to enable extension update
11564 dnl ===================================================================
11565 AC_MSG_CHECKING([whether to enable extension update])
11566 ENABLE_EXTENSION_UPDATE=
11567 if test "x$enable_extension_update" = "xno"; then
11568     AC_MSG_RESULT([no])
11569 else
11570     AC_MSG_RESULT([yes])
11571     ENABLE_EXTENSION_UPDATE="TRUE"
11572     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11573     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11575 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11578 dnl ===================================================================
11579 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11580 dnl ===================================================================
11581 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11582 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11583     AC_MSG_RESULT([no])
11584     ENABLE_SILENT_MSI=
11585 else
11586     AC_MSG_RESULT([yes])
11587     ENABLE_SILENT_MSI=TRUE
11588     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11590 AC_SUBST(ENABLE_SILENT_MSI)
11592 AC_MSG_CHECKING([whether and how to use Xinerama])
11593 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11594     if test "$x_libraries" = "default_x_libraries"; then
11595         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11596         if test "x$XINERAMALIB" = x; then
11597            XINERAMALIB="/usr/lib"
11598         fi
11599     else
11600         XINERAMALIB="$x_libraries"
11601     fi
11602     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11603         # we have both versions, let the user decide but use the dynamic one
11604         # per default
11605         USE_XINERAMA=TRUE
11606         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11607             XINERAMA_LINK=dynamic
11608         else
11609             XINERAMA_LINK=static
11610         fi
11611     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11612         # we have only the dynamic version
11613         USE_XINERAMA=TRUE
11614         XINERAMA_LINK=dynamic
11615     elif test -e "$XINERAMALIB/libXinerama.a"; then
11616         # static version
11617         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11618             USE_XINERAMA=TRUE
11619             XINERAMA_LINK=static
11620         else
11621             USE_XINERAMA=
11622             XINERAMA_LINK=none
11623         fi
11624     else
11625         # no Xinerama
11626         USE_XINERAMA=
11627         XINERAMA_LINK=none
11628     fi
11629     if test "$USE_XINERAMA" = "TRUE"; then
11630         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11631         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11632             [AC_MSG_ERROR(Xinerama header not found.)], [])
11633         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11634         if test "x$XEXTLIB" = x; then
11635            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11636         fi
11637         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11638         if test "$_os" = "FreeBSD"; then
11639             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11640         fi
11641         if test "$_os" = "Linux"; then
11642             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11643         fi
11644         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11645             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11646     else
11647         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11648     fi
11649 else
11650     USE_XINERAMA=
11651     XINERAMA_LINK=none
11652     AC_MSG_RESULT([no])
11654 AC_SUBST(USE_XINERAMA)
11655 AC_SUBST(XINERAMA_LINK)
11657 dnl ===================================================================
11658 dnl Test whether to build cairo or rely on the system version
11659 dnl ===================================================================
11661 if test "$USING_X11" = TRUE; then
11662     # Used in vcl/Library_vclplug_gen.mk
11663     test_cairo=yes
11666 if test "$test_cairo" = "yes"; then
11667     AC_MSG_CHECKING([whether to use the system cairo])
11669     : ${with_system_cairo:=$with_system_libs}
11670     if test "$with_system_cairo" = "yes"; then
11671         SYSTEM_CAIRO=TRUE
11672         AC_MSG_RESULT([yes])
11674         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11675         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11676         FilterLibs "${CAIRO_LIBS}"
11677         CAIRO_LIBS="${filteredlibs}"
11679         if test "$test_xrender" = "yes"; then
11680             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11681             AC_LANG_PUSH([C])
11682             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11683 #ifdef PictStandardA8
11684 #else
11685       return fail;
11686 #endif
11687 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11689             AC_LANG_POP([C])
11690         fi
11691         libo_MINGW_CHECK_DLL([libcairo])
11692         libo_MINGW_TRY_DLL([libfontconfig])
11693         libo_MINGW_TRY_DLL([libfreetype])
11694         libo_MINGW_TRY_DLL([libpixman])
11695         libo_MINGW_TRY_DLL([libpng15])
11696     else
11697         SYSTEM_CAIRO=
11698         AC_MSG_RESULT([no])
11700         BUILD_TYPE="$BUILD_TYPE CAIRO"
11701     fi
11704 AC_SUBST(SYSTEM_CAIRO)
11705 AC_SUBST(CAIRO_CFLAGS)
11706 AC_SUBST(CAIRO_LIBS)
11708 dnl ===================================================================
11709 dnl Test whether to use avahi
11710 dnl ===================================================================
11711 if test "$_os" = "WINNT"; then
11712     # Windows uses bundled mDNSResponder
11713     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11714 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11715     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11716                       [ENABLE_AVAHI="TRUE"])
11717     AC_DEFINE(HAVE_FEATURE_AVAHI)
11718     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11719     FilterLibs "${AVAHI_LIBS}"
11720     AVAHI_LIBS="${filteredlibs}"
11723 AC_SUBST(ENABLE_AVAHI)
11724 AC_SUBST(AVAHI_CFLAGS)
11725 AC_SUBST(AVAHI_LIBS)
11727 dnl ===================================================================
11728 dnl Test whether to use liblangtag
11729 dnl ===================================================================
11730 ENABLE_LIBLANGTAG=
11731 SYSTEM_LIBLANGTAG=
11732 AC_MSG_CHECKING([whether to use liblangtag])
11733 if test "$enable_liblangtag" = "yes" -o \
11734         \( "$enable_liblangtag" = "" -a $_os != Emscripten \); then
11735     ENABLE_LIBLANGTAG=TRUE
11736     AC_MSG_RESULT([yes])
11737     AC_MSG_CHECKING([whether to use system liblangtag])
11738     if test "$with_system_liblangtag" = yes; then
11739         SYSTEM_LIBLANGTAG=TRUE
11740         AC_MSG_RESULT([yes])
11741         PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11742         dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11743         PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11744         LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11745         FilterLibs "${LIBLANGTAG_LIBS}"
11746         LIBLANGTAG_LIBS="${filteredlibs}"
11747         libo_MINGW_CHECK_DLL([liblangtag])
11748     else
11749         SYSTEM_LIBLANGTAG=
11750         AC_MSG_RESULT([no])
11751         BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11752         LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/langtag"
11753         if test "$COM" = "MSC"; then
11754             LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs/liblangtag.lib"
11755         else
11756             LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
11757         fi
11758     fi
11759     AC_DEFINE(ENABLE_LIBLANGTAG)
11760 else
11761     AC_MSG_RESULT([no])
11763 AC_SUBST(ENABLE_LIBLANGTAG)
11764 AC_SUBST(SYSTEM_LIBLANGTAG)
11765 AC_SUBST(LIBLANGTAG_CFLAGS)
11766 AC_SUBST(LIBLANGTAG_LIBS)
11768 dnl ===================================================================
11769 dnl Test whether to build libpng or rely on the system version
11770 dnl ===================================================================
11772 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/png"],["-L${WORKDIR}/LinkTarget/StaticLibrary -lpng"])
11774 dnl ===================================================================
11775 dnl Check for runtime JVM search path
11776 dnl ===================================================================
11777 if test "$ENABLE_JAVA" != ""; then
11778     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11779     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11780         AC_MSG_RESULT([yes])
11781         if ! test -d "$with_jvm_path"; then
11782             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11783         fi
11784         if ! test -d "$with_jvm_path"jvm; then
11785             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11786         fi
11787         JVM_ONE_PATH_CHECK="$with_jvm_path"
11788         AC_SUBST(JVM_ONE_PATH_CHECK)
11789     else
11790         AC_MSG_RESULT([no])
11791     fi
11794 dnl ===================================================================
11795 dnl Test for the presence of Ant and that it works
11796 dnl ===================================================================
11798 if test "$ENABLE_JAVA" != ""; then
11799     ANT_HOME=; export ANT_HOME
11800     WITH_ANT_HOME=; export WITH_ANT_HOME
11801     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11802         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11803             if test "$_os" = "WINNT"; then
11804                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11805             else
11806                 with_ant_home="$LODE_HOME/opt/ant"
11807             fi
11808         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11809             with_ant_home="$LODE_HOME/opt/ant"
11810         fi
11811     fi
11812     if test -z "$with_ant_home"; then
11813         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11814     else
11815         if test "$_os" = "WINNT"; then
11816             # AC_PATH_PROGS needs unix path
11817             with_ant_home=`cygpath -u "$with_ant_home"`
11818         fi
11819         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11820         WITH_ANT_HOME=$with_ant_home
11821         ANT_HOME=$with_ant_home
11822     fi
11824     if test -z "$ANT"; then
11825         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11826     else
11827         # resolve relative or absolute symlink
11828         while test -h "$ANT"; do
11829             a_cwd=`pwd`
11830             a_basename=`basename "$ANT"`
11831             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11832             cd "`dirname "$ANT"`"
11833             cd "`dirname "$a_script"`"
11834             ANT="`pwd`"/"`basename "$a_script"`"
11835             cd "$a_cwd"
11836         done
11838         AC_MSG_CHECKING([if $ANT works])
11839         cat > conftest.java << EOF
11840         public class conftest {
11841             int testmethod(int a, int b) {
11842                     return a + b;
11843             }
11844         }
11847         cat > conftest.xml << EOF
11848         <project name="conftest" default="conftest">
11849         <target name="conftest">
11850             <javac srcdir="." includes="conftest.java">
11851             </javac>
11852         </target>
11853         </project>
11856         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11857         if test $? = 0 -a -f ./conftest.class; then
11858             AC_MSG_RESULT([Ant works])
11859             if test -z "$WITH_ANT_HOME"; then
11860                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11861                 if test -z "$ANT_HOME"; then
11862                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11863                 fi
11864             else
11865                 ANT_HOME="$WITH_ANT_HOME"
11866             fi
11867         else
11868             echo "configure: Ant test failed" >&5
11869             cat conftest.java >&5
11870             cat conftest.xml >&5
11871             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11872         fi
11873         rm -f conftest* core core.* *.core
11874     fi
11875     if test -z "$ANT_HOME"; then
11876         ANT_HOME="NO_ANT_HOME"
11877     else
11878         PathFormat "$ANT_HOME"
11879         ANT_HOME="$formatted_path"
11880         PathFormat "$ANT"
11881         ANT="$formatted_path"
11882     fi
11883     AC_SUBST(ANT_HOME)
11884     AC_SUBST(ANT)
11886     dnl Checking for ant.jar
11887     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11888         AC_MSG_CHECKING([Ant lib directory])
11889         if test -f $ANT_HOME/lib/ant.jar; then
11890             ANT_LIB="$ANT_HOME/lib"
11891         else
11892             if test -f $ANT_HOME/ant.jar; then
11893                 ANT_LIB="$ANT_HOME"
11894             else
11895                 if test -f /usr/share/java/ant.jar; then
11896                     ANT_LIB=/usr/share/java
11897                 else
11898                     if test -f /usr/share/ant-core/lib/ant.jar; then
11899                         ANT_LIB=/usr/share/ant-core/lib
11900                     else
11901                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11902                             ANT_LIB="$ANT_HOME/lib/ant"
11903                         else
11904                             if test -f /usr/share/lib/ant/ant.jar; then
11905                                 ANT_LIB=/usr/share/lib/ant
11906                             else
11907                                 AC_MSG_ERROR([Ant libraries not found!])
11908                             fi
11909                         fi
11910                     fi
11911                 fi
11912             fi
11913         fi
11914         PathFormat "$ANT_LIB"
11915         ANT_LIB="$formatted_path"
11916         AC_MSG_RESULT([Ant lib directory found.])
11917     fi
11918     AC_SUBST(ANT_LIB)
11920     ant_minver=1.6.0
11921     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11923     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11924     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11925     ant_version_major=`echo $ant_version | cut -d. -f1`
11926     ant_version_minor=`echo $ant_version | cut -d. -f2`
11927     echo "configure: ant_version $ant_version " >&5
11928     echo "configure: ant_version_major $ant_version_major " >&5
11929     echo "configure: ant_version_minor $ant_version_minor " >&5
11930     if test "$ant_version_major" -ge "2"; then
11931         AC_MSG_RESULT([yes, $ant_version])
11932     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11933         AC_MSG_RESULT([yes, $ant_version])
11934     else
11935         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11936     fi
11938     rm -f conftest* core core.* *.core
11941 OOO_JUNIT_JAR=
11942 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11943     AC_MSG_CHECKING([for JUnit 4])
11944     if test "$with_junit" = "yes"; then
11945         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11946             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11947         elif test -e /usr/share/java/junit4.jar; then
11948             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11949         else
11950            if test -e /usr/share/lib/java/junit.jar; then
11951               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11952            else
11953               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11954            fi
11955         fi
11956     else
11957         OOO_JUNIT_JAR=$with_junit
11958     fi
11959     if test "$_os" = "WINNT"; then
11960         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11961     fi
11962     printf 'import org.junit.Before;' > conftest.java
11963     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11964         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11965     else
11966         AC_MSG_ERROR(
11967 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11968  specify its pathname via --with-junit=..., or disable it via --without-junit])
11969     fi
11970     rm -f conftest.class conftest.java
11971     if test $OOO_JUNIT_JAR != ""; then
11972     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11973     fi
11975 AC_SUBST(OOO_JUNIT_JAR)
11977 HAMCREST_JAR=
11978 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11979     AC_MSG_CHECKING([for included Hamcrest])
11980     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11981     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11982         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11983     else
11984         AC_MSG_RESULT([Not included])
11985         AC_MSG_CHECKING([for standalone hamcrest jar.])
11986         if test "$with_hamcrest" = "yes"; then
11987             if test -e /usr/share/lib/java/hamcrest.jar; then
11988                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11989             elif test -e /usr/share/java/hamcrest/core.jar; then
11990                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11991             else
11992                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11993             fi
11994         else
11995             HAMCREST_JAR=$with_hamcrest
11996         fi
11997         if test "$_os" = "WINNT"; then
11998             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11999         fi
12000         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12001             AC_MSG_RESULT([$HAMCREST_JAR])
12002         else
12003             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),
12004                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12005         fi
12006     fi
12007     rm -f conftest.class conftest.java
12009 AC_SUBST(HAMCREST_JAR)
12012 AC_SUBST(SCPDEFS)
12015 # check for wget and curl
12017 WGET=
12018 CURL=
12020 if test "$enable_fetch_external" != "no"; then
12022 CURL=`which curl 2>/dev/null`
12024 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12025     # wget new enough?
12026     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12027     if test $? -eq 0; then
12028         WGET=$i
12029         break
12030     fi
12031 done
12033 if test -z "$WGET" -a -z "$CURL"; then
12034     AC_MSG_ERROR([neither wget nor curl found!])
12039 AC_SUBST(WGET)
12040 AC_SUBST(CURL)
12043 # check for md5sum
12045 MD5SUM=
12047 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
12048     if test "$i" = "md5"; then
12049         eval "$i -x" > /dev/null 2>&1
12050     else
12051         eval "$i --version" > /dev/null 2>&1
12052     fi
12053     ret=$?
12054     if test $ret -eq 0; then
12055         MD5SUM=$i
12056         break
12057     fi
12058 done
12060 if test "$MD5SUM" = "md5"; then
12061     if md5 -r < /dev/null > /dev/null 2>/dev/null; then
12062         MD5SUM="$MD5SUM -r"
12063     elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
12064         MD5SUM="$MD5SUM -n"
12065     fi
12068 if test -z "$MD5SUM"; then
12069     AC_MSG_ERROR([no md5sum found!])
12072 AC_SUBST(MD5SUM)
12074 dnl ===================================================================
12075 dnl Dealing with l10n options
12076 dnl ===================================================================
12077 AC_MSG_CHECKING([which languages to be built])
12078 # get list of all languages
12079 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12080 # the sed command does the following:
12081 #   + if a line ends with a backslash, append the next line to it
12082 #   + adds " on the beginning of the value (after =)
12083 #   + adds " at the end of the value
12084 #   + removes en-US; we want to put it on the beginning
12085 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12086 [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)]
12087 ALL_LANGS="en-US $completelangiso"
12088 # check the configured localizations
12089 WITH_LANG="$with_lang"
12090 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12091     AC_MSG_RESULT([en-US])
12092 else
12093     AC_MSG_RESULT([$WITH_LANG])
12094     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12096 # check that the list is valid
12097 for lang in $WITH_LANG; do
12098     test "$lang" = "ALL" && continue
12099     # need to check for the exact string, so add space before and after the list of all languages
12100     for vl in $ALL_LANGS; do
12101         if test "$vl" = "$lang"; then
12102            break
12103         fi
12104     done
12105     if test "$vl" != "$lang"; then
12106         # if you're reading this - you prolly quoted your languages remove the quotes ...
12107         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12108     fi
12109 done
12110 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12111     echo $WITH_LANG | grep -q en-US
12112     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12114 # list with substituted ALL
12115 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12116 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12117 test "$WITH_LANG" = "en-US" && WITH_LANG=
12118 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12119     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12120     ALL_LANGS=`echo $ALL_LANGS qtz`
12122 AC_SUBST(ALL_LANGS)
12123 AC_SUBST(WITH_LANG)
12124 AC_SUBST(WITH_LANG_LIST)
12125 AC_SUBST(GIT_NEEDED_SUBMODULES)
12127 WITH_POOR_HELP_LOCALIZATIONS=
12128 if test -d "$SRC_ROOT/translations/source"; then
12129     for l in `ls -1 $SRC_ROOT/translations/source`; do
12130         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12131             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12132         fi
12133     done
12135 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12137 if test -n "$with_locales"; then
12138     WITH_LOCALES="$with_locales"
12140     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12141     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12142     # config_host/config_locales.h.in
12143     for locale in $WITH_LOCALES; do
12144         lang=${locale%_*}
12146         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12148         case $lang in
12149         hi|mr*ne)
12150             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12151             ;;
12152         bg|ru)
12153             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12154             ;;
12155         esac
12156     done
12157 else
12158     AC_DEFINE(WITH_LOCALE_ALL)
12160 AC_SUBST(WITH_LOCALES)
12162 dnl git submodule update --reference
12163 dnl ===================================================================
12164 if test -n "${GIT_REFERENCE_SRC}"; then
12165     for repo in ${GIT_NEEDED_SUBMODULES}; do
12166         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12167             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12168         fi
12169     done
12171 AC_SUBST(GIT_REFERENCE_SRC)
12173 dnl git submodules linked dirs
12174 dnl ===================================================================
12175 if test -n "${GIT_LINK_SRC}"; then
12176     for repo in ${GIT_NEEDED_SUBMODULES}; do
12177         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12178             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12179         fi
12180     done
12182 AC_SUBST(GIT_LINK_SRC)
12184 dnl branding
12185 dnl ===================================================================
12186 AC_MSG_CHECKING([for alternative branding images directory])
12187 # initialize mapped arrays
12188 BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
12189 brand_files="$BRAND_INTRO_IMAGES about.svg"
12191 if test -z "$with_branding" -o "$with_branding" = "no"; then
12192     AC_MSG_RESULT([none])
12193     DEFAULT_BRAND_IMAGES="$brand_files"
12194 else
12195     if ! test -d $with_branding ; then
12196         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12197     else
12198         AC_MSG_RESULT([$with_branding])
12199         CUSTOM_BRAND_DIR="$with_branding"
12200         for lfile in $brand_files
12201         do
12202             if ! test -f $with_branding/$lfile ; then
12203                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12204                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12205             else
12206                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12207             fi
12208         done
12209         check_for_progress="yes"
12210     fi
12212 AC_SUBST([BRAND_INTRO_IMAGES])
12213 AC_SUBST([CUSTOM_BRAND_DIR])
12214 AC_SUBST([CUSTOM_BRAND_IMAGES])
12215 AC_SUBST([DEFAULT_BRAND_IMAGES])
12218 AC_MSG_CHECKING([for 'intro' progress settings])
12219 PROGRESSBARCOLOR=
12220 PROGRESSSIZE=
12221 PROGRESSPOSITION=
12222 PROGRESSFRAMECOLOR=
12223 PROGRESSTEXTCOLOR=
12224 PROGRESSTEXTBASELINE=
12226 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12227     source "$with_branding/progress.conf"
12228     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12229 else
12230     AC_MSG_RESULT([none])
12233 AC_SUBST(PROGRESSBARCOLOR)
12234 AC_SUBST(PROGRESSSIZE)
12235 AC_SUBST(PROGRESSPOSITION)
12236 AC_SUBST(PROGRESSFRAMECOLOR)
12237 AC_SUBST(PROGRESSTEXTCOLOR)
12238 AC_SUBST(PROGRESSTEXTBASELINE)
12241 AC_MSG_CHECKING([for extra build ID])
12242 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12243     EXTRA_BUILDID="$with_extra_buildid"
12245 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12246 if test -n "$EXTRA_BUILDID" ; then
12247     AC_MSG_RESULT([$EXTRA_BUILDID])
12248 else
12249     AC_MSG_RESULT([not set])
12251 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12253 OOO_VENDOR=
12254 AC_MSG_CHECKING([for vendor])
12255 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12256     OOO_VENDOR="$USERNAME"
12258     if test -z "$OOO_VENDOR"; then
12259         OOO_VENDOR="$USER"
12260     fi
12262     if test -z "$OOO_VENDOR"; then
12263         OOO_VENDOR="`id -u -n`"
12264     fi
12266     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12267 else
12268     OOO_VENDOR="$with_vendor"
12269     AC_MSG_RESULT([$OOO_VENDOR])
12271 AC_SUBST(OOO_VENDOR)
12273 if echo "$host_os" | grep -q linux-android ; then
12274     ANDROID_PACKAGE_NAME=
12275     AC_MSG_CHECKING([for Android package name])
12276     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12277         if test -n "$ENABLE_DEBUG"; then
12278             # Default to the package name that makes ndk-gdb happy.
12279             ANDROID_PACKAGE_NAME="org.libreoffice"
12280         else
12281             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12282         fi
12284         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12285     else
12286         ANDROID_PACKAGE_NAME="$with_android_package_name"
12287         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12288     fi
12289     AC_SUBST(ANDROID_PACKAGE_NAME)
12292 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12293 if test "$with_compat_oowrappers" = "yes"; then
12294     WITH_COMPAT_OOWRAPPERS=TRUE
12295     AC_MSG_RESULT(yes)
12296 else
12297     WITH_COMPAT_OOWRAPPERS=
12298     AC_MSG_RESULT(no)
12300 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12302 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12303 AC_MSG_CHECKING([for install dirname])
12304 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12305     INSTALLDIRNAME="$with_install_dirname"
12307 AC_MSG_RESULT([$INSTALLDIRNAME])
12308 AC_SUBST(INSTALLDIRNAME)
12310 AC_MSG_CHECKING([for prefix])
12311 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12312 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12313 PREFIXDIR="$prefix"
12314 AC_MSG_RESULT([$PREFIXDIR])
12315 AC_SUBST(PREFIXDIR)
12317 LIBDIR=[$(eval echo $(eval echo $libdir))]
12318 AC_SUBST(LIBDIR)
12320 DATADIR=[$(eval echo $(eval echo $datadir))]
12321 AC_SUBST(DATADIR)
12323 MANDIR=[$(eval echo $(eval echo $mandir))]
12324 AC_SUBST(MANDIR)
12326 DOCDIR=[$(eval echo $(eval echo $docdir))]
12327 AC_SUBST(DOCDIR)
12329 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12330 AC_SUBST(INSTALLDIR)
12332 TESTINSTALLDIR="${BUILDDIR}/test-install"
12333 AC_SUBST(TESTINSTALLDIR)
12336 # ===================================================================
12337 # OAuth2 id and secrets
12338 # ===================================================================
12340 AC_MSG_CHECKING([for Google Drive client id and secret])
12341 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12342 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12343 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12344     GDRIVE_CLIENT_ID="\"\""
12347 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12348     GDRIVE_CLIENT_SECRET="\"\""
12351 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12352     AC_MSG_RESULT([not set])
12353 else
12354     AC_MSG_RESULT([set])
12357 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12358 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12360 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12361 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12362 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12363 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12364     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12367 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12368     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12371 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12372     AC_MSG_RESULT([not set])
12373 else
12374     AC_MSG_RESULT([set])
12376 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12377 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12379 AC_MSG_CHECKING([for OneDrive client id and secret])
12380 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12381 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12382 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12383     ONEDRIVE_CLIENT_ID="\"\""
12386 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12387     ONEDRIVE_CLIENT_SECRET="\"\""
12390 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12391     AC_MSG_RESULT([not set])
12392 else
12393     AC_MSG_RESULT([set])
12395 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12396 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12399 dnl ===================================================================
12400 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12401 dnl --enable-dependency-tracking configure option
12402 dnl ===================================================================
12403 AC_MSG_CHECKING([whether to enable dependency tracking])
12404 if test "$enable_dependency_tracking" = "no"; then
12405     nodep=TRUE
12406     AC_MSG_RESULT([no])
12407 else
12408     AC_MSG_RESULT([yes])
12410 AC_SUBST(nodep)
12412 dnl ===================================================================
12413 dnl Number of CPUs to use during the build
12414 dnl ===================================================================
12415 AC_MSG_CHECKING([for number of processors to use])
12416 # plain --with-parallelism is just the default
12417 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12418     if test "$with_parallelism" = "no"; then
12419         PARALLELISM=0
12420     else
12421         PARALLELISM=$with_parallelism
12422     fi
12423 else
12424     if test "$enable_icecream" = "yes"; then
12425         PARALLELISM="10"
12426     else
12427         case `uname -s` in
12429         Darwin|FreeBSD|NetBSD|OpenBSD)
12430             PARALLELISM=`sysctl -n hw.ncpu`
12431             ;;
12433         Linux)
12434             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12435         ;;
12436         # what else than above does profit here *and* has /proc?
12437         *)
12438             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12439             ;;
12440         esac
12442         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12443         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12444     fi
12447 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12448     if test -z "$with_parallelism"; then
12449             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12450             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12451             PARALLELISM="1"
12452     else
12453         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."
12454     fi
12457 if test $PARALLELISM -eq 0; then
12458     AC_MSG_RESULT([explicit make -j option needed])
12459 else
12460     AC_MSG_RESULT([$PARALLELISM])
12462 AC_SUBST(PARALLELISM)
12464 IWYU_PATH="$with_iwyu"
12465 AC_SUBST(IWYU_PATH)
12466 if test ! -z "$IWYU_PATH"; then
12467     if test ! -f "$IWYU_PATH"; then
12468         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12469     fi
12473 # Set up ILIB for MSVC build
12475 ILIB1=
12476 if test "$build_os" = "cygwin"; then
12477     ILIB="."
12478     if test -n "$JAVA_HOME"; then
12479         ILIB="$ILIB;$JAVA_HOME/lib"
12480     fi
12481     ILIB1=-link
12482     if test "$BITNESS_OVERRIDE" = 64; then
12483         ILIB="$ILIB;$COMPATH/lib/amd64"
12484         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12485         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12486         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12487         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12488             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12489             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12490         fi
12491         if test $VCVER = 140; then
12492             PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12493             ucrtlibpath_formatted=$formatted_path
12494             ILIB="$ILIB;$ucrtlibpath_formatted"
12495         fi
12496     else
12497         ILIB="$ILIB;$COMPATH/lib"
12498         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12499         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12500         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12501         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12502             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12503             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12504         fi
12505         if test $VCVER = 140; then
12506             PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12507             ucrtlibpath_formatted=$formatted_path
12508             ILIB="$ILIB;$ucrtlibpath_formatted"
12509         fi
12510     fi
12511     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12512         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12513     else
12514         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12515     fi
12517     AC_SUBST(ILIB)
12520 AC_MSG_CHECKING(
12521     [whether C++11 use of const_iterator in standard containers is broken])
12522 save_CXXFLAGS=$CXXFLAGS
12523 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12524 AC_LANG_PUSH([C++])
12525 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12526     #include <list>
12527     ]],[[
12528         std::list<int> l;
12529         l.erase(l.cbegin());
12530     ]])],
12531     [broken=no], [broken=yes])
12532 AC_LANG_POP([C++])
12533 LIBS=$save_LIBS
12534 CXXFLAGS=$save_CXXFLAGS
12535 AC_MSG_RESULT([$broken])
12536 if test "$broken" = yes; then
12537     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12541 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12542 save_CXXFLAGS=$CXXFLAGS
12543 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12544 save_LIBS=$LIBS
12545 if test -n "$ILIB1"; then
12546     LIBS="$LIBS $ILIB1"
12548 AC_LANG_PUSH([C++])
12549 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12550     // Exit with failure if the static initializer_list is stored on the
12551     // stack (as done by Clang < 3.4):
12552     #include <initializer_list>
12553     struct S {};
12554     bool g(void const * p1, void const * p2) {
12555         int n;
12556         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12557     }
12558     bool f(void const * p1) {
12559         static std::initializer_list<S> s { S() };
12560         return g(p1, s.begin());
12561     }
12562     ]],[[
12563         int n;
12564         return f(&n) ? 0 : 1;
12565     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12566 AC_LANG_POP([C++])
12567 LIBS=$save_LIBS
12568 CXXFLAGS=$save_CXXFLAGS
12569 AC_MSG_RESULT([$broken])
12570 if test "$broken" = yes; then
12571     AC_DEFINE([HAVE_BROKEN_STATIC_INITIALIZER_LIST])
12575 # ===================================================================
12576 # Creating bigger shared library to link against
12577 # ===================================================================
12578 AC_MSG_CHECKING([whether to create huge library])
12579 MERGELIBS=
12581 if test $_os = iOS -o $_os = Android; then
12582     # Never any point in mergelibs for these as we build just static
12583     # libraries anyway...
12584     enable_mergelibs=no
12587 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12588     if test $_os != Linux -a $_os != WINNT; then
12589         add_warning "--enable-mergelibs is not tested for this platform"
12590     fi
12591     MERGELIBS="TRUE"
12592     AC_MSG_RESULT([yes])
12593 else
12594     AC_MSG_RESULT([no])
12596 AC_SUBST([MERGELIBS])
12598 dnl ===================================================================
12599 dnl icerun is a wrapper that stops us spawning tens of processes
12600 dnl locally - for tools that can't be executed on the compile cluster
12601 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12602 dnl ===================================================================
12603 AC_MSG_CHECKING([whether to use icerun wrapper])
12604 ICECREAM_RUN=
12605 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12606     ICECREAM_RUN=icerun
12607     AC_MSG_RESULT([yes])
12608 else
12609     AC_MSG_RESULT([no])
12611 AC_SUBST(ICECREAM_RUN)
12613 dnl ===================================================================
12614 dnl Setup the ICECC_VERSION for the build the same way it was set for
12615 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12616 dnl ===================================================================
12617 x_ICECC_VERSION=[\#]
12618 if test -n "$ICECC_VERSION" ; then
12619     x_ICECC_VERSION=
12621 AC_SUBST(x_ICECC_VERSION)
12622 AC_SUBST(ICECC_VERSION)
12624 dnl ===================================================================
12626 AC_MSG_CHECKING([MPL subset])
12627 MPL_SUBSET=
12629 if test "$enable_mpl_subset" = "yes"; then
12630     warn_report=false
12631     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12632         warn_report=true
12633     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12634         warn_report=true
12635     fi
12636     if test "$warn_report" = "true"; then
12637         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12638     fi
12639     if test "x$enable_postgresql_sdbc" != "xno"; then
12640         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the postgress database backend.])
12641     fi
12642     if test "$enable_lotuswordpro" = "yes"; then
12643         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12644     fi
12645     if test "$WITH_WEBDAV" = "neon"; then
12646         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12647     fi
12648     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12649         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12650     fi
12651     if test -n "$ENABLE_PDFIMPORT"; then
12652         if test "x$SYSTEM_POPPLER" = "x"; then
12653             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12654         fi
12655     fi
12656     # cf. m4/libo_check_extension.m4
12657     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12658         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12659     fi
12660     for theme in $WITH_THEMES; do
12661         case $theme in
12662         breeze|crystal|default|hicontrast|oxygen|sifr)
12663             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12664         *) : ;;
12665         esac
12666     done
12668     ENABLE_OPENGL_TRANSITIONS=
12670     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12671         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12672     fi
12674     MPL_SUBSET="TRUE"
12675     AC_DEFINE(MPL_HAVE_SUBSET)
12676     AC_MSG_RESULT([only])
12677 else
12678     AC_MSG_RESULT([no restrictions])
12680 AC_SUBST(MPL_SUBSET)
12682 dnl ===================================================================
12684 AC_MSG_CHECKING([formula logger])
12685 ENABLE_FORMULA_LOGGER=
12687 if test "x$enable_formula_logger" = "xyes"; then
12688     AC_MSG_RESULT([yes])
12689     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12690     ENABLE_FORMULA_LOGGER=TRUE
12691 else
12692     AC_MSG_RESULT([no])
12695 AC_SUBST(ENABLE_FORMULA_LOGGER)
12697 dnl ===================================================================
12698 dnl Setting up the environment.
12699 dnl ===================================================================
12700 AC_MSG_NOTICE([setting up the build environment variables...])
12702 AC_SUBST(COMPATH)
12704 if test "$build_os" = "cygwin"; then
12705     if test -d "$COMPATH/atlmfc/lib"; then
12706         ATL_LIB="$COMPATH/atlmfc/lib"
12707         ATL_INCLUDE="$COMPATH/atlmfc/include"
12708     else
12709         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12710         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12711     fi
12712     if test "$BITNESS_OVERRIDE" = 64; then
12713         ATL_LIB="$ATL_LIB/amd64"
12714     fi
12715     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12716     PathFormat "/usr/bin/find.exe"
12717     FIND="$formatted_path"
12718     PathFormat "/usr/bin/sort.exe"
12719     SORT="$formatted_path"
12720     PathFormat "/usr/bin/grep.exe"
12721     WIN_GREP="$formatted_path"
12722     PathFormat "/usr/bin/ls.exe"
12723     WIN_LS="$formatted_path"
12724     PathFormat "/usr/bin/touch.exe"
12725     WIN_TOUCH="$formatted_path"
12726 else
12727     FIND=find
12728     SORT=sort
12731 AC_SUBST(ATL_INCLUDE)
12732 AC_SUBST(ATL_LIB)
12733 AC_SUBST(FIND)
12734 AC_SUBST(SORT)
12735 AC_SUBST(WIN_GREP)
12736 AC_SUBST(WIN_LS)
12737 AC_SUBST(WIN_TOUCH)
12739 AC_SUBST(BUILD_TYPE)
12741 AC_SUBST(SOLARINC)
12743 PathFormat "$PERL"
12744 PERL="$formatted_path"
12745 AC_SUBST(PERL)
12747 if test -n "$TMPDIR"; then
12748     TEMP_DIRECTORY="$TMPDIR"
12749 else
12750     TEMP_DIRECTORY="/tmp"
12752 if test "$build_os" = "cygwin"; then
12753     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12755 AC_SUBST(TEMP_DIRECTORY)
12757 # setup the PATH for the environment
12758 if test -n "$LO_PATH_FOR_BUILD"; then
12759     LO_PATH="$LO_PATH_FOR_BUILD"
12760 else
12761     LO_PATH="$PATH"
12763     case "$host_os" in
12765     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12766         if test "$ENABLE_JAVA" != ""; then
12767             pathmunge "$JAVA_HOME/bin" "after"
12768         fi
12769         ;;
12771     cygwin*)
12772         # Win32 make needs native paths
12773         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12774             LO_PATH=`cygpath -p -m "$PATH"`
12775         fi
12776         if test "$BITNESS_OVERRIDE" = 64; then
12777             # needed for msi packaging
12778             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12779         fi
12780         # .NET 4.6 and higher don't have bin directory
12781         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12782             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12783         fi
12784         pathmunge "$ASM_HOME" "before"
12785         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12786         pathmunge "$CSC_PATH" "before"
12787         pathmunge "$MIDL_PATH" "before"
12788         pathmunge "$AL_PATH" "before"
12789         pathmunge "$MSPDB_PATH" "before"
12790         if test -n "$MSBUILD_PATH" ; then
12791             pathmunge "$MSBUILD_PATH" "before"
12792         fi
12793         if test "$BITNESS_OVERRIDE" = 64; then
12794             if test "$vcexpress" = "Express"; then
12795                 pathmunge "$COMPATH/bin/x86_amd64" "before"
12796                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12797             else
12798                 pathmunge "$COMPATH/bin/amd64" "before"
12799                 pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
12800             fi
12801         else
12802             pathmunge "$COMPATH/bin" "before"
12803             pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
12804         fi
12805         if test "$ENABLE_JAVA" != ""; then
12806             if test -d "$JAVA_HOME/jre/bin/client"; then
12807                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12808             fi
12809             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12810                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12811             fi
12812             pathmunge "$JAVA_HOME/bin" "before"
12813         fi
12814         ;;
12816     solaris*)
12817         pathmunge "/usr/css/bin" "before"
12818         if test "$ENABLE_JAVA" != ""; then
12819             pathmunge "$JAVA_HOME/bin" "after"
12820         fi
12821         ;;
12822     esac
12825 AC_SUBST(LO_PATH)
12827 # Generate a configuration md5 we can use for deps
12828 if test -f config_host.mk; then
12829     config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"`
12831 if test -f config_host_lang.mk; then
12832     config_lang_md5=`$MD5SUM config_host_lang.mk | sed "s/ .*//"`
12835 AC_CONFIG_FILES([config_host.mk
12836                  config_host_lang.mk
12837                  Makefile
12838                  lo.xcent
12839                  bin/bffvalidator.sh
12840                  bin/odfvalidator.sh
12841                  bin/officeotron.sh
12842                  instsetoo_native/util/openoffice.lst
12843                  sysui/desktop/macosx/Info.plist
12844                  ios/lo.xcconfig])
12845 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12846 AC_CONFIG_HEADERS([config_host/config_clang.h])
12847 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12848 AC_CONFIG_HEADERS([config_host/config_eot.h])
12849 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12850 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12851 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12852 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12853 AC_CONFIG_HEADERS([config_host/config_features.h])
12854 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12855 AC_CONFIG_HEADERS([config_host/config_folders.h])
12856 AC_CONFIG_HEADERS([config_host/config_gio.h])
12857 AC_CONFIG_HEADERS([config_host/config_global.h])
12858 AC_CONFIG_HEADERS([config_host/config_java.h])
12859 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12860 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12861 AC_CONFIG_HEADERS([config_host/config_locales.h])
12862 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12863 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12864 AC_CONFIG_HEADERS([config_host/config_oox.h])
12865 AC_CONFIG_HEADERS([config_host/config_opengl.h])
12866 AC_CONFIG_HEADERS([config_host/config_options.h])
12867 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12868 AC_CONFIG_HEADERS([config_host/config_test.h])
12869 AC_CONFIG_HEADERS([config_host/config_telepathy.h])
12870 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12871 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12872 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12873 AC_CONFIG_HEADERS([config_host/config_version.h])
12874 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12875 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12876 AC_CONFIG_HEADERS([config_host/config_python.h])
12877 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12878 AC_OUTPUT
12880 if test "$CROSS_COMPILING" = TRUE; then
12881     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12884 # touch the config timestamp file
12885 if test ! -f config_host.mk.stamp; then
12886     echo > config_host.mk.stamp
12887 elif test "$config_md5" = `$MD5SUM config_host.mk | sed "s/ .*//"`; then
12888     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12889 else
12890     echo > config_host.mk.stamp
12893 # touch the config lang timestamp file
12894 if test ! -f config_host_lang.mk.stamp; then
12895     echo > config_host_lang.mk.stamp
12896 elif test "$config_lang_md5" = `$MD5SUM config_host_lang.mk | sed "s/ .*//"`; then
12897     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12898 else
12899     echo > config_host_lang.mk.stamp
12903 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12905 cat << _EOS
12906 ****************************************************************************
12907 WARNING:
12908 Your make version is known to be horribly slow, and hard to debug
12909 problems with. To get a reasonably functional make please do:
12911 to install a pre-compiled binary make for Win32
12913  mkdir -p /opt/lo/bin
12914  cd /opt/lo/bin
12915  wget http://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12916  cp make-85047eb-msvc.exe make
12917  chmod +x make
12919 to install from source:
12920 place yourself in a working directory of you choice.
12922  git clone git://git.savannah.gnu.org/make.git
12924  [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"]
12925  set PATH=%PATH%;C:\Cygwin\bin
12926  [or Cygwin64, if that is what you have]
12927  cd path-to-make-repo-you-cloned-above
12928  build_w32.bat --without-guile
12930 should result in a WinRel/gnumake.exe.
12931 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12933 Then re-run autogen.sh
12935 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12936 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12938 _EOS
12941 cat << _EOF
12942 ****************************************************************************
12944 To build, run:
12945 $GNUMAKE
12947 To view some help, run:
12948 $GNUMAKE help
12950 _EOF
12952 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12953     cat << _EOF
12954 After the build has finished, you can immediately run it using:
12955 _EOF
12957     if test $_os = Darwin; then
12958         echo open instdir/$PRODUCTNAME.app
12959     else
12960         echo instdir/program/soffice
12961     fi
12962     cat << _EOF
12964 If you want to run the smoketest, run:
12965 $GNUMAKE check
12967 _EOF
12970 if test -f warn; then
12971     cat warn
12972     rm warn
12975 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: