tdf#110740 Wrong formatting when cutting from the input line
[LibreOffice.git] / configure.ac
blob56e9b01811a4c101d3f288dfc61c614a470f4c99
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 argument 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],[6.1.0.0.alpha1+],[],[],[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 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
137 dnl path location is gpg, so make sure we find it
138     mac_gpg_path=`which gpg 2>/dev/null`
139     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
140         mac_path="$mac_path:`dirname $mac_gpg_path`"
141     fi
142     PATH="$mac_path"
143     unset mac_path
144     unset mac_git_path
145     unset mac_gpg_path
148 echo "********************************************************************"
149 echo "*"
150 echo "*   Running ${PACKAGE_NAME} build configuration."
151 echo "*"
152 echo "********************************************************************"
153 echo ""
155 dnl ===================================================================
156 dnl checks build and host OSes
157 dnl do this before argument processing to allow for platform dependent defaults
158 dnl ===================================================================
159 AC_CANONICAL_HOST
161 AC_MSG_CHECKING([for product name])
162 PRODUCTNAME="AC_PACKAGE_NAME"
163 if test -n "$with_product_name" -a "$with_product_name" != no; then
164     PRODUCTNAME="$with_product_name"
166 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
167     PRODUCTNAME="${PRODUCTNAME}Dev"
169 AC_MSG_RESULT([$PRODUCTNAME])
170 AC_SUBST(PRODUCTNAME)
171 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
172 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
174 dnl ===================================================================
175 dnl Our version is defined by the AC_INIT() at the top of this script.
176 dnl ===================================================================
178 AC_MSG_CHECKING([for package version])
179 if test -n "$with_package_version" -a "$with_package_version" != no; then
180     PACKAGE_VERSION="$with_package_version"
182 AC_MSG_RESULT([$PACKAGE_VERSION])
184 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
186 LIBO_VERSION_MAJOR=$1
187 LIBO_VERSION_MINOR=$2
188 LIBO_VERSION_MICRO=$3
189 LIBO_VERSION_PATCH=$4
191 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
192 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
193 # no way to encode that into an integer in general.
194 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
196 LIBO_VERSION_SUFFIX=$5
197 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
198 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
199 # they get undoubled before actually passed to sed.
200 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
201 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
202 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
203 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
205 AC_SUBST(LIBO_VERSION_MAJOR)
206 AC_SUBST(LIBO_VERSION_MINOR)
207 AC_SUBST(LIBO_VERSION_MICRO)
208 AC_SUBST(LIBO_VERSION_PATCH)
209 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
210 AC_SUBST(LIBO_VERSION_SUFFIX)
211 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
213 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
214 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
215 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
216 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
218 LIBO_THIS_YEAR=`date +%Y`
219 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
221 dnl ===================================================================
222 dnl Product version
223 dnl ===================================================================
224 AC_MSG_CHECKING([for product version])
225 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
226 AC_MSG_RESULT([$PRODUCTVERSION])
227 AC_SUBST(PRODUCTVERSION)
229 AC_PROG_EGREP
230 # AC_PROG_EGREP doesn't set GREP on all systems as well
231 AC_PATH_PROG(GREP, grep)
233 BUILDDIR=`pwd`
234 cd $srcdir
235 SRC_ROOT=`pwd`
236 cd $BUILDDIR
237 x_Cygwin=[\#]
239 dnl ======================================
240 dnl Required GObject introspection version
241 dnl ======================================
242 INTROSPECTION_REQUIRED_VERSION=1.32.0
244 dnl ===================================================================
245 dnl Search all the common names for GNU Make
246 dnl ===================================================================
247 AC_MSG_CHECKING([for GNU Make])
249 # try to use our own make if it is available and GNUMAKE was not already defined
250 if test -z "$GNUMAKE"; then
251     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
252         GNUMAKE="$LODE_HOME/opt/bin/make"
253     elif test -x "/opt/lo/bin/make"; then
254         GNUMAKE="/opt/lo/bin/make"
255     fi
258 GNUMAKE_WIN_NATIVE=
259 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
260     if test -n "$a"; then
261         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
262         if test $? -eq 0;  then
263             if test "$build_os" = "cygwin"; then
264                 if test -n "$($a -v | grep 'Built for Windows')" ; then
265                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
266                     GNUMAKE_WIN_NATIVE="TRUE"
267                 else
268                     GNUMAKE=`which $a`
269                 fi
270             else
271                 GNUMAKE=`which $a`
272             fi
273             break
274         fi
275     fi
276 done
277 AC_MSG_RESULT($GNUMAKE)
278 if test -z "$GNUMAKE"; then
279     AC_MSG_ERROR([not found. install GNU Make.])
280 else
281     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
282         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
283     fi
286 win_short_path_for_make()
288     local_short_path="$1"
289     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
290         cygpath -sm "$local_short_path"
291     else
292         cygpath -u "$(cygpath -d "$local_short_path")"
293     fi
297 if test "$build_os" = "cygwin"; then
298     PathFormat "$SRC_ROOT"
299     SRC_ROOT="$formatted_path"
300     PathFormat "$BUILDDIR"
301     BUILDDIR="$formatted_path"
302     x_Cygwin=
303     AC_MSG_CHECKING(for explicit COMSPEC)
304     if test -z "$COMSPEC"; then
305         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
306     else
307         AC_MSG_RESULT([found: $COMSPEC])
308     fi
311 AC_SUBST(SRC_ROOT)
312 AC_SUBST(BUILDDIR)
313 AC_SUBST(x_Cygwin)
314 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
315 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
317 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
318     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
321 # need sed in os checks...
322 AC_PATH_PROGS(SED, sed)
323 if test -z "$SED"; then
324     AC_MSG_ERROR([install sed to run this script])
327 # Set the ENABLE_LTO variable
328 # ===================================================================
329 AC_MSG_CHECKING([whether to use link-time optimization])
330 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
331     ENABLE_LTO="TRUE"
332     AC_MSG_RESULT([yes])
333     AC_DEFINE(STATIC_LINKING)
334 else
335     ENABLE_LTO=""
336     AC_MSG_RESULT([no])
338 AC_SUBST(ENABLE_LTO)
340 AC_ARG_ENABLE(fuzz-options,
341     AS_HELP_STRING([--enable-fuzz-options],
342         [Randomly enable or disable each of those configurable options
343          that are supposed to be freely selectable without interdependencies,
344          or where bad interaction from interdependencies is automatically avoided.])
347 dnl ===================================================================
348 dnl When building for Android, --with-android-ndk,
349 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
350 dnl mandatory
351 dnl ===================================================================
353 AC_ARG_WITH(android-ndk,
354     AS_HELP_STRING([--with-android-ndk],
355         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
358 AC_ARG_WITH(android-ndk-toolchain-version,
359     AS_HELP_STRING([--with-android-ndk-toolchain-version],
360         [Specify which toolchain version to use, of those present in the
361         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
362         with_android_ndk_toolchain_version=clang5.0)
364 AC_ARG_WITH(android-sdk,
365     AS_HELP_STRING([--with-android-sdk],
366         [Specify location of the Android SDK. Mandatory when building for Android.]),
369 ANDROID_NDK_HOME=
370 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
371     with_android_ndk="$SRC_ROOT/external/android-ndk"
373 if test -n "$with_android_ndk"; then
374     ANDROID_NDK_HOME=$with_android_ndk
376     # Set up a lot of pre-canned defaults
378     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
379         if test ! -f $ANDROID_NDK_HOME/source.properties; then
380             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
381         fi
382         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
383     else
384         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
385     fi
386     if test -z "$ANDROID_NDK_VERSION";  then
387         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
388     fi
389     case $ANDROID_NDK_VERSION in
390     r9*|r10*)
391         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
392         ;;
393     11.1.*|12.1.*|13.1.*|14.1.*)
394         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
395         ;;
396     16.*)
397         ;;
398     *)
399         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
400         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
401         ;;
402     esac
404     ANDROID_API_LEVEL=14
405     android_cpu=$host_cpu
406     ANDROID_ARCH=$android_cpu
407     if test $host_cpu = arm; then
408         android_platform_prefix=$android_cpu-linux-androideabi
409         android_gnu_prefix=$android_platform_prefix
410         LLVM_TRIPLE=armv7-none-linux-androideabi
411         ANDROID_APP_ABI=armeabi-v7a
412         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
413     elif test $host_cpu = aarch64; then
414         android_platform_prefix=$android_cpu-linux-android
415         android_gnu_prefix=$android_platform_prefix
416         LLVM_TRIPLE=aarch64-none-linux-android
417         # minimum android version that supports aarch64
418         ANDROID_API_LEVEL=21
419         ANDROID_APP_ABI=arm64-v8a
420         ANDROID_ARCH=arm64
421     elif test $host_cpu = mips; then
422         android_platform_prefix=mipsel-linux-android
423         android_gnu_prefix=$android_platform_prefix
424         LLVM_TRIPLE=mipsel-none-linux-android
425         ANDROID_APP_ABI=mips
426     else
427         # host_cpu is something like "i386" or "i686" I guess, NDK uses
428         # "x86" in some contexts
429         android_cpu=x86
430         android_platform_prefix=$android_cpu
431         android_gnu_prefix=i686-linux-android
432         LLVM_TRIPLE=i686-none-linux-android
433         ANDROID_APP_ABI=x86
434         ANDROID_ARCH=$android_cpu
435         ANDROIDCFLAGS="-march=atom"
436     fi
438     case "$with_android_ndk_toolchain_version" in
439     clang5.0)
440         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
441         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
442         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
443         ;;
444     *)
445         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
446     esac
448     if test ! -d $ANDROID_BINUTILS_DIR; then
449         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
450     elif test ! -d $ANDROID_COMPILER_DIR; then
451         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
452     fi
454     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
455     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
456     # manage to link the (app-specific) single huge .so that is built for the app in
457     # android/source/ if there is debug information in a significant part of the object files.
458     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
459     # all objects have been built with debug information.)
460     case $build_os in
461     linux-gnu*)
462         ndk_build_os=linux
463         ;;
464     darwin*)
465         ndk_build_os=darwin
466         ;;
467     *)
468         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
469         ;;
470     esac
471     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
472     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
473     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
475     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
476     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
477     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
478     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
479     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
480     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
482     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
483     # android is using different sysroots for compilation and linking, but as
484     # there is no full separation in configure and elsewhere, use isystem for
485     # compilation stuff and sysroot for linking
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
487     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
488     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
489     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
491     else
492     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
493     fi
494     if test "$ENABLE_LTO" = TRUE; then
495         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
496         # $CC and $CXX when building external libraries
497         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
498     fi
500     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
501     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI/include -std=c++11"
502     else
503     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
504     fi
506     if test -z "$CC"; then
507         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
508     fi
509     if test -z "$CXX"; then
510         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
511     fi
513     # remember to download the ownCloud Android library later
514     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
516 AC_SUBST(ANDROID_NDK_HOME)
517 AC_SUBST(ANDROID_APP_ABI)
518 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
520 dnl ===================================================================
521 dnl --with-android-sdk
522 dnl ===================================================================
523 ANDROID_SDK_HOME=
524 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
525     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
527 if test -n "$with_android_sdk"; then
528     ANDROID_SDK_HOME=$with_android_sdk
529     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
531 AC_SUBST(ANDROID_SDK_HOME)
533 dnl ===================================================================
534 dnl The following is a list of supported systems.
535 dnl Sequential to keep the logic very simple
536 dnl These values may be checked and reset later.
537 dnl ===================================================================
538 #defaults unless the os test overrides this:
539 test_randr=yes
540 test_xrender=yes
541 test_cups=yes
542 test_dbus=yes
543 test_fontconfig=yes
544 test_cairo=no
546 # Default values, as such probably valid just for Linux, set
547 # differently below just for Mac OSX,but at least better than
548 # hardcoding these as we used to do. Much of this is duplicated also
549 # in solenv for old build system and for gbuild, ideally we should
550 # perhaps define stuff like this only here in configure.ac?
552 LINKFLAGSSHL="-shared"
553 PICSWITCH="-fpic"
554 DLLPOST=".so"
556 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
558 INSTROOTBASESUFFIX=
559 INSTROOTCONTENTSUFFIX=
560 SDKDIRNAME=sdk
562 case "$host_os" in
564 solaris*)
565     test_gtk=yes
566     build_gstreamer_1_0=yes
567     build_gstreamer_0_10=yes
568     test_freetype=yes
569     _os=SunOS
571     dnl ===========================================================
572     dnl Check whether we're using Solaris 10 - SPARC or Intel.
573     dnl ===========================================================
574     AC_MSG_CHECKING([the Solaris operating system release])
575     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
576     if test "$_os_release" -lt "10"; then
577         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
578     else
579         AC_MSG_RESULT([ok ($_os_release)])
580     fi
582     dnl Check whether we're using a SPARC or i386 processor
583     AC_MSG_CHECKING([the processor type])
584     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
585         AC_MSG_RESULT([ok ($host_cpu)])
586     else
587         AC_MSG_ERROR([only SPARC and i386 processors are supported])
588     fi
589     ;;
591 linux-gnu*|k*bsd*-gnu*)
592     test_gtk=yes
593     build_gstreamer_1_0=yes
594     build_gstreamer_0_10=yes
595     test_kde4=yes
596     test_kde5=yes
597     test_qt5=yes
598     test_gtk3_kde5=yes
599     if test "$enable_fuzzers" != yes; then
600         test_freetype=yes
601         test_fontconfig=yes
602     else
603         test_freetype=no
604         test_fontconfig=no
605         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
606     fi
607     _os=Linux
608     ;;
610 gnu)
611     test_randr=no
612     test_xrender=no
613     _os=GNU
614      ;;
616 cygwin*|interix*)
618     # When building on Windows normally with MSVC under Cygwin,
619     # configure thinks that the host platform (the platform the
620     # built code will run on) is Cygwin, even if it obviously is
621     # Windows, which in Autoconf terminology is called
622     # "mingw32". (Which is misleading as MinGW is the name of the
623     # tool-chain, not an operating system.)
625     # Somewhat confusing, yes. But this configure script doesn't
626     # look at $host etc that much, it mostly uses its own $_os
627     # variable, set here in this case statement.
629     test_cups=no
630     test_dbus=no
631     test_randr=no
632     test_xrender=no
633     test_freetype=no
634     test_fontconfig=no
635     _os=WINNT
637     DLLPOST=".dll"
638     LINKFLAGSNOUNDEFS=
639     ;;
641 darwin*) # Mac OS X or iOS
642     test_gtk=yes
643     test_randr=no
644     test_xrender=no
645     test_freetype=no
646     test_fontconfig=no
647     test_dbus=no
648     if test -n "$LODE_HOME" ; then
649         mac_sanitize_path
650         AC_MSG_NOTICE([sanitized the PATH to $PATH])
651     fi
652     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
653         build_for_ios=YES
654         _os=iOS
655         test_gtk=no
656         test_cups=no
657         enable_mpl_subset=yes
658         enable_lotuswordpro=no
659         enable_coinmp=no
660         enable_lpsolve=no
661         enable_postgresql_sdbc=no
662         enable_extension_integration=no
663         enable_report_builder=no
664         with_theme="tango"
665         with_ppds=no
666         if test "$enable_ios_simulator" = "yes"; then
667             host=x86_64-apple-darwin
668         fi
669     else
670         _os=Darwin
671         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
672         INSTROOTCONTENTSUFFIX=/Contents
673         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
674     fi
675     enable_systray=no
676     # See comment above the case "$host_os"
677     LINKFLAGSSHL="-dynamiclib -single_module"
679     # -fPIC is default
680     PICSWITCH=""
682     DLLPOST=".dylib"
684     # -undefined error is the default
685     LINKFLAGSNOUNDEFS=""
688 freebsd*)
689     test_gtk=yes
690     build_gstreamer_1_0=yes
691     build_gstreamer_0_10=yes
692     test_kde4=yes
693     test_kde5=yes
694     test_qt5=yes
695     test_gtk3_kde5=yes
696     test_freetype=yes
697     AC_MSG_CHECKING([the FreeBSD operating system release])
698     if test -n "$with_os_version"; then
699         OSVERSION="$with_os_version"
700     else
701         OSVERSION=`/sbin/sysctl -n kern.osreldate`
702     fi
703     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
704     AC_MSG_CHECKING([which thread library to use])
705     if test "$OSVERSION" -lt "500016"; then
706         PTHREAD_CFLAGS="-D_THREAD_SAFE"
707         PTHREAD_LIBS="-pthread"
708     elif test "$OSVERSION" -lt "502102"; then
709         PTHREAD_CFLAGS="-D_THREAD_SAFE"
710         PTHREAD_LIBS="-lc_r"
711     else
712         PTHREAD_CFLAGS=""
713         PTHREAD_LIBS="-pthread"
714     fi
715     AC_MSG_RESULT([$PTHREAD_LIBS])
716     _os=FreeBSD
717     ;;
719 *netbsd*)
720     test_gtk=yes
721     build_gstreamer_1_0=yes
722     build_gstreamer_0_10=yes
723     test_kde4=yes
724     test_kde5=yes
725     test_qt5=yes
726     test_gtk3_kde5=yes
727     test_freetype=yes
728     PTHREAD_LIBS="-pthread -lpthread"
729     _os=NetBSD
730     ;;
732 aix*)
733     test_randr=no
734     test_freetype=yes
735     PTHREAD_LIBS=-pthread
736     _os=AIX
737     ;;
739 openbsd*)
740     test_gtk=yes
741     test_freetype=yes
742     PTHREAD_CFLAGS="-D_THREAD_SAFE"
743     PTHREAD_LIBS="-pthread"
744     _os=OpenBSD
745     ;;
747 dragonfly*)
748     test_gtk=yes
749     build_gstreamer_1_0=yes
750     build_gstreamer_0_10=yes
751     test_kde4=yes
752     test_kde5=yes
753     test_qt5=yes
754     test_gtk3_kde5=yes
755     test_freetype=yes
756     PTHREAD_LIBS="-pthread"
757     _os=DragonFly
758     ;;
760 linux-android*)
761     build_gstreamer_1_0=no
762     build_gstreamer_0_10=no
763     enable_lotuswordpro=no
764     enable_mpl_subset=yes
765     enable_coinmp=yes
766     enable_lpsolve=no
767     enable_report_builder=no
768     enable_odk=no
769     enable_postgresql_sdbc=no
770     enable_python=no
771     with_theme="tango"
772     test_cups=no
773     test_dbus=no
774     test_fontconfig=no
775     test_freetype=no
776     test_gtk=no
777     test_kde4=no
778     test_kde5=no
779     test_qt5=no
780     test_gtk3_kde5=no
781     test_randr=no
782     test_xrender=no
783     _os=Android
785     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
786     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
787     ;;
789 haiku*)
790     test_cups=no
791     test_dbus=no
792     test_randr=no
793     test_xrender=no
794     test_freetype=yes
795     enable_java=no
796     enable_opengl=no
797     enable_odk=no
798     enable_gconf=no
799     enable_gnome_vfs=no
800     enable_gstreamer=no
801     enable_vlc=no
802     enable_gltf=no
803     enable_collada=no
804     enable_coinmp=no
805     enable_pdfium=no
806     enable_postgresql_sdbc=no
807     enable_firebird_sdbc=no
808     _os=Haiku
809     ;;
812     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
813     ;;
814 esac
816 if test "$_os" = "Android" ; then
817     # Verify that the NDK and SDK options are proper
818     if test -z "$with_android_ndk"; then
819         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
820     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
821         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
822     fi
824     if test -z "$ANDROID_SDK_HOME"; then
825         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
826     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
827         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
828     fi
830     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
831     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
832         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
833                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
834                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
835         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
836         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
837         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
838     fi
839     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
840         AC_MSG_WARN([android support repository not found - install with
841                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
842                      to allow the build to download the specified version of the android support libraries])
843         add_warning "android support repository not found - install with"
844         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
845         add_warning "to allow the build to download the specified version of the android support libraries"
846     fi
849 if test "$_os" = "AIX"; then
850     AC_PATH_PROG(GAWK, gawk)
851     if test -z "$GAWK"; then
852         AC_MSG_ERROR([gawk not found in \$PATH])
853     fi
856 AC_SUBST(SDKDIRNAME)
858 AC_SUBST(PTHREAD_CFLAGS)
859 AC_SUBST(PTHREAD_LIBS)
861 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
862 # By default use the ones specified by our build system,
863 # but explicit override is possible.
864 AC_MSG_CHECKING(for explicit AFLAGS)
865 if test -n "$AFLAGS"; then
866     AC_MSG_RESULT([$AFLAGS])
867     x_AFLAGS=
868 else
869     AC_MSG_RESULT(no)
870     x_AFLAGS=[\#]
872 AC_MSG_CHECKING(for explicit CFLAGS)
873 if test -n "$CFLAGS"; then
874     AC_MSG_RESULT([$CFLAGS])
875     x_CFLAGS=
876 else
877     AC_MSG_RESULT(no)
878     x_CFLAGS=[\#]
880 AC_MSG_CHECKING(for explicit CXXFLAGS)
881 if test -n "$CXXFLAGS"; then
882     AC_MSG_RESULT([$CXXFLAGS])
883     x_CXXFLAGS=
884 else
885     AC_MSG_RESULT(no)
886     x_CXXFLAGS=[\#]
888 AC_MSG_CHECKING(for explicit OBJCFLAGS)
889 if test -n "$OBJCFLAGS"; then
890     AC_MSG_RESULT([$OBJCFLAGS])
891     x_OBJCFLAGS=
892 else
893     AC_MSG_RESULT(no)
894     x_OBJCFLAGS=[\#]
896 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
897 if test -n "$OBJCXXFLAGS"; then
898     AC_MSG_RESULT([$OBJCXXFLAGS])
899     x_OBJCXXFLAGS=
900 else
901     AC_MSG_RESULT(no)
902     x_OBJCXXFLAGS=[\#]
904 AC_MSG_CHECKING(for explicit LDFLAGS)
905 if test -n "$LDFLAGS"; then
906     AC_MSG_RESULT([$LDFLAGS])
907     x_LDFLAGS=
908 else
909     AC_MSG_RESULT(no)
910     x_LDFLAGS=[\#]
912 AC_SUBST(AFLAGS)
913 AC_SUBST(CFLAGS)
914 AC_SUBST(CXXFLAGS)
915 AC_SUBST(OBJCFLAGS)
916 AC_SUBST(OBJCXXFLAGS)
917 AC_SUBST(LDFLAGS)
918 AC_SUBST(x_AFLAGS)
919 AC_SUBST(x_CFLAGS)
920 AC_SUBST(x_CXXFLAGS)
921 AC_SUBST(x_OBJCFLAGS)
922 AC_SUBST(x_OBJCXXFLAGS)
923 AC_SUBST(x_LDFLAGS)
925 dnl These are potentially set for MSVC, in the code checking for UCRT below:
926 my_original_CFLAGS=$CFLAGS
927 my_original_CXXFLAGS=$CXXFLAGS
928 my_original_CPPFLAGS=$CPPFLAGS
930 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
931 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
932 dnl AC_PROG_CC internally.
933 if test "$_os" != "WINNT"; then
934     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
935     save_CFLAGS=$CFLAGS
936     AC_PROG_CC
937     CFLAGS=$save_CFLAGS
940 if test $_os != "WINNT"; then
941     save_LIBS="$LIBS"
942     AC_SEARCH_LIBS([dlsym], [dl],
943         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
944         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
945     LIBS="$save_LIBS"
947 AC_SUBST(DLOPEN_LIBS)
949 ###############################################################################
950 # Extensions switches --enable/--disable
951 ###############################################################################
952 # By default these should be enabled unless having extra dependencies.
953 # If there is extra dependency over configure options then the enable should
954 # be automagic based on whether the requiring feature is enabled or not.
955 # All this options change anything only with --enable-extension-integration.
957 # The name of this option and its help string makes it sound as if
958 # extensions are built anyway, just not integrated in the installer,
959 # if you use --disable-extension-integration. Is that really the
960 # case?
962 AC_ARG_ENABLE(ios-simulator,
963     AS_HELP_STRING([--enable-ios-simulator],
964         [build i386 or x86_64 for ios simulator])
967 libo_FUZZ_ARG_ENABLE(extension-integration,
968     AS_HELP_STRING([--disable-extension-integration],
969         [Disable integration of the built extensions in the installer of the
970          product. Use this switch to disable the integration.])
973 AC_ARG_ENABLE(avmedia,
974     AS_HELP_STRING([--disable-avmedia],
975         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
978 AC_ARG_ENABLE(database-connectivity,
979     AS_HELP_STRING([--disable-database-connectivity],
980         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
983 # This doesn't mean not building (or "integrating") extensions
984 # (although it probably should; i.e. it should imply
985 # --disable-extension-integration I guess), it means not supporting
986 # any extension mechanism at all
987 libo_FUZZ_ARG_ENABLE(extensions,
988     AS_HELP_STRING([--disable-extensions],
989         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
992 AC_ARG_ENABLE(scripting,
993     AS_HELP_STRING([--disable-scripting],
994         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
997 # This is mainly for Android and iOS, but could potentially be used in some
998 # special case otherwise, too, so factored out as a separate setting
1000 AC_ARG_ENABLE(dynamic-loading,
1001     AS_HELP_STRING([--disable-dynamic-loading],
1002         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1005 libo_FUZZ_ARG_ENABLE(ext-mariadb-connector,
1006     AS_HELP_STRING([--enable-ext-mariadb-connector],
1007         [Enable the build of the MariaDB/MySQL Connector extension.])
1010 libo_FUZZ_ARG_ENABLE(report-builder,
1011     AS_HELP_STRING([--disable-report-builder],
1012         [Disable the Report Builder.])
1015 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1016     AS_HELP_STRING([--enable-ext-wiki-publisher],
1017         [Enable the Wiki Publisher extension.])
1020 libo_FUZZ_ARG_ENABLE(lpsolve,
1021     AS_HELP_STRING([--disable-lpsolve],
1022         [Disable compilation of the lp solve solver ])
1024 libo_FUZZ_ARG_ENABLE(coinmp,
1025     AS_HELP_STRING([--disable-coinmp],
1026         [Disable compilation of the CoinMP solver ])
1029 libo_FUZZ_ARG_ENABLE(pdfimport,
1030     AS_HELP_STRING([--disable-pdfimport],
1031         [Disable building the PDF import feature.])
1034 libo_FUZZ_ARG_ENABLE(pdfium,
1035     AS_HELP_STRING([--disable-pdfium],
1036         [Disable building PDFium.])
1039 ###############################################################################
1041 dnl ---------- *** ----------
1043 libo_FUZZ_ARG_ENABLE(mergelibs,
1044     AS_HELP_STRING([--enable-mergelibs],
1045         [Merge several of the smaller libraries into one big, "merged", one.])
1048 libo_FUZZ_ARG_ENABLE(breakpad,
1049     AS_HELP_STRING([--enable-breakpad],
1050         [Enables breakpad for crash reporting.])
1053 AC_ARG_ENABLE(fetch-external,
1054     AS_HELP_STRING([--disable-fetch-external],
1055         [Disables fetching external tarballs from web sources.])
1058 AC_ARG_ENABLE(fuzzers,
1059     AS_HELP_STRING([--enable-fuzzers],
1060         [Enables building libfuzzer targets for fuzz testing.])
1063 libo_FUZZ_ARG_ENABLE(pch,
1064     AS_HELP_STRING([--enable-pch],
1065         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1068 libo_FUZZ_ARG_ENABLE(epm,
1069     AS_HELP_STRING([--enable-epm],
1070         [LibreOffice includes self-packaging code, that requires epm, however epm is
1071          useless for large scale package building.])
1074 libo_FUZZ_ARG_ENABLE(odk,
1075     AS_HELP_STRING([--disable-odk],
1076         [LibreOffice includes an ODK, office development kit which some packagers may
1077          wish to build without.])
1080 AC_ARG_ENABLE(mpl-subset,
1081     AS_HELP_STRING([--enable-mpl-subset],
1082         [Don't compile any pieces which are not MPL or more liberally licensed])
1085 libo_FUZZ_ARG_ENABLE(evolution2,
1086     AS_HELP_STRING([--enable-evolution2],
1087         [Allows the built-in evolution 2 addressbook connectivity build to be
1088          enabled.])
1091 AC_ARG_ENABLE(avahi,
1092     AS_HELP_STRING([--enable-avahi],
1093         [Determines whether to use Avahi to advertise Impress to remote controls.])
1096 libo_FUZZ_ARG_ENABLE(werror,
1097     AS_HELP_STRING([--enable-werror],
1098         [Turn warnings to errors. (Has no effect in modules where the treating
1099          of warnings as errors is disabled explicitly.)]),
1102 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1103     AS_HELP_STRING([--enable-assert-always-abort],
1104         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1107 libo_FUZZ_ARG_ENABLE(dbgutil,
1108     AS_HELP_STRING([--enable-dbgutil],
1109         [Provide debugging support from --enable-debug and include additional debugging
1110          utilities such as object counting or more expensive checks.
1111          This is the recommended option for developers.
1112          Note that this makes the build ABI incompatible, it is not possible to mix object
1113          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1115 libo_FUZZ_ARG_ENABLE(debug,
1116     AS_HELP_STRING([--enable-debug],
1117         [Include debugging information, disable compiler optimization and inlining plus
1118          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1120 libo_FUZZ_ARG_ENABLE(sal-log,
1121     AS_HELP_STRING([--enable-sal-log],
1122         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1124 AC_ARG_ENABLE(selective-debuginfo,
1125     AS_HELP_STRING([--enable-selective-debuginfo],
1126         [If --enable-debug or --enable-dbgutil is used, build debugging information
1127          (-g compiler flag) only for the specified gbuild build targets
1128          (where all means everything, - prepended means not to enable, / appended means
1129          everything in the directory; there is no ordering, more specific overrides
1130          more general, and disabling takes precedence).
1131          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1133 libo_FUZZ_ARG_ENABLE(symbols,
1134     AS_HELP_STRING([--enable-symbols],
1135         [Generate debug information.
1136          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1137          otherwise.]))
1139 libo_FUZZ_ARG_ENABLE(optimized,
1140     AS_HELP_STRING([--disable-optimized],
1141         [Whether to compile with optimization flags.
1142          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1143          otherwise.]))
1145 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1146     AS_HELP_STRING([--disable-runtime-optimizations],
1147         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1148          JVM JIT) that are known to interact badly with certain dynamic analysis
1149          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1150          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1151          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1153 AC_ARG_WITH(valgrind,
1154     AS_HELP_STRING([--with-valgrind],
1155         [Make availability of Valgrind headers a hard requirement.]))
1157 libo_FUZZ_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.
1161          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1162 COMPILER_PLUGINS_DEBUG=
1163 if test "$enable_compiler_plugins" = debug; then
1164     enable_compiler_plugins=yes
1165     COMPILER_PLUGINS_DEBUG=TRUE
1168 libo_FUZZ_ARG_ENABLE(ooenv,
1169     AS_HELP_STRING([--disable-ooenv],
1170         [Disable ooenv for the instdir installation.]))
1172 AC_ARG_ENABLE(lto,
1173     AS_HELP_STRING([--enable-lto],
1174         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1175          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1176          linker. For MSVC, this option is broken at the moment. This is experimental work
1177          in progress that shouldn't be used unless you are working on it.)]))
1179 AC_ARG_ENABLE(python,
1180     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1181         [Enables or disables Python support at run-time.
1182          Also specifies what Python to use. 'auto' is the default.
1183          'fully-internal' even forces the internal version for uses of Python
1184          during the build.]))
1186 libo_FUZZ_ARG_ENABLE(gtk,
1187     AS_HELP_STRING([--disable-gtk],
1188         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1189 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1191 libo_FUZZ_ARG_ENABLE(gtk3,
1192     AS_HELP_STRING([--disable-gtk3],
1193         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1194 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1196 libo_FUZZ_ARG_ENABLE(systray,
1197     AS_HELP_STRING([--disable-systray],
1198         [Determines whether to build the systray quickstarter.]),
1199 ,test "${enable_systray+set}" = set || enable_systray=yes)
1201 AC_ARG_ENABLE(split-app-modules,
1202     AS_HELP_STRING([--enable-split-app-modules],
1203         [Split file lists for app modules, e.g. base, calc.
1204          Has effect only with make distro-pack-install]),
1207 AC_ARG_ENABLE(split-opt-features,
1208     AS_HELP_STRING([--enable-split-opt-features],
1209         [Split file lists for some optional features, e.g. pyuno, testtool.
1210          Has effect only with make distro-pack-install]),
1213 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1214     AS_HELP_STRING([--disable-cairo-canvas],
1215         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1218 libo_FUZZ_ARG_ENABLE(dbus,
1219     AS_HELP_STRING([--disable-dbus],
1220         [Determines whether to enable features that depend on dbus.
1221          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1222 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1224 libo_FUZZ_ARG_ENABLE(sdremote,
1225     AS_HELP_STRING([--disable-sdremote],
1226         [Determines whether to enable Impress remote control (i.e. the server component).]),
1227 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1229 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1230     AS_HELP_STRING([--disable-sdremote-bluetooth],
1231         [Determines whether to build sdremote with bluetooth support.
1232          Requires dbus on Linux.]))
1234 libo_FUZZ_ARG_ENABLE(gio,
1235     AS_HELP_STRING([--disable-gio],
1236         [Determines whether to use the GIO support.]),
1237 ,test "${enable_gio+set}" = set || enable_gio=yes)
1239 AC_ARG_ENABLE(kde4,
1240     AS_HELP_STRING([--enable-kde4],
1241         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1242          KDE4 are available.]),
1245 AC_ARG_ENABLE(qt5,
1246     AS_HELP_STRING([--enable-qt5],
1247         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1248          available.]),
1251 AC_ARG_ENABLE(kde5,
1252     AS_HELP_STRING([--enable-kde5],
1253         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1254          KF5 are available.]),
1257 AC_ARG_ENABLE(gtk3_kde5,
1258     AS_HELP_STRING([--enable-gtk3-kde5],
1259         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1260          platforms where Gtk3, Qt5 and Plasma is available.]),
1263 libo_FUZZ_ARG_ENABLE(gui,
1264     AS_HELP_STRING([--disable-gui],
1265         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1266          command-line option. Not related to LibreOffice Online functionality. Don't use
1267          unless you are certain you need to. Nobody will help you if you insist on trying
1268          this and run into problems.]),
1269 ,test "${enable_gui+set}" = set || enable_gui=yes)
1271 libo_FUZZ_ARG_ENABLE(randr,
1272     AS_HELP_STRING([--disable-randr],
1273         [Disable RandR support in the vcl project.]),
1274 ,test "${enable_randr+set}" = set || enable_randr=yes)
1276 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1277     AS_HELP_STRING([--disable-gstreamer-1-0],
1278         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1279 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1281 AC_ARG_ENABLE(gstreamer-0-10,
1282     AS_HELP_STRING([--enable-gstreamer-0-10],
1283         [Enable building with the gstreamer 0.10 avmedia backend.]),
1284 ,enable_gstreamer_0_10=no)
1286 libo_FUZZ_ARG_ENABLE(vlc,
1287     AS_HELP_STRING([--enable-vlc],
1288         [Enable building with the (experimental) VLC avmedia backend.]),
1289 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1291 libo_FUZZ_ARG_ENABLE(neon,
1292     AS_HELP_STRING([--disable-neon],
1293         [Disable neon and the compilation of webdav binding.]),
1296 libo_FUZZ_ARG_ENABLE([eot],
1297     [AS_HELP_STRING([--enable-eot],
1298         [Enable support for Embedded OpenType fonts.])],
1299 ,test "${enable_eot+set}" = set || enable_eot=no)
1301 libo_FUZZ_ARG_ENABLE(cve-tests,
1302     AS_HELP_STRING([--disable-cve-tests],
1303         [Prevent CVE tests to be executed]),
1306 libo_FUZZ_ARG_ENABLE(chart-tests,
1307     AS_HELP_STRING([--enable-chart-tests],
1308         [Executes chart XShape tests. In a perfect world these tests would be
1309          stable and everyone could run them, in reality it is best to run them
1310          only on a few machines that are known to work and maintained by people
1311          who can judge if a test failure is a regression or not.]),
1314 AC_ARG_ENABLE(build-unowinreg,
1315     AS_HELP_STRING([--enable-build-unowinreg],
1316         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1317          compiler is needed on Linux.]),
1320 AC_ARG_ENABLE(dependency-tracking,
1321     AS_HELP_STRING([--enable-dependency-tracking],
1322         [Do not reject slow dependency extractors.])[
1323   --disable-dependency-tracking
1324                           Disables generation of dependency information.
1325                           Speed up one-time builds.],
1328 AC_ARG_ENABLE(icecream,
1329     AS_HELP_STRING([--enable-icecream],
1330         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1331          It defaults to /opt/icecream for the location of the icecream gcc/g++
1332          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1335 libo_FUZZ_ARG_ENABLE(cups,
1336     AS_HELP_STRING([--disable-cups],
1337         [Do not build cups support.])
1340 AC_ARG_ENABLE(ccache,
1341     AS_HELP_STRING([--disable-ccache],
1342         [Do not try to use ccache automatically.
1343          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1344          CC/CXX are not yet set, and --enable-icecream is not given, we
1345          attempt to use ccache. --disable-ccache disables ccache completely.
1349 AC_ARG_ENABLE(64-bit,
1350     AS_HELP_STRING([--enable-64-bit],
1351         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1352          At the moment meaningful only for Windows.]), ,)
1354 libo_FUZZ_ARG_ENABLE(online-update,
1355     AS_HELP_STRING([--enable-online-update],
1356         [Enable the online update service that will check for new versions of
1357          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1358          If the value is "mar", the experimental Mozilla-like update will be
1359          enabled instead of the traditional update mechanism.]),
1362 AC_ARG_WITH(update-config,
1363     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1364                    [Path to the update config ini file]))
1366 libo_FUZZ_ARG_ENABLE(extension-update,
1367     AS_HELP_STRING([--disable-extension-update],
1368         [Disable possibility to update installed extensions.]),
1371 libo_FUZZ_ARG_ENABLE(release-build,
1372     AS_HELP_STRING([--enable-release-build],
1373         [Enable release build. Note that the "release build" choice is orthogonal to
1374          whether symbols are present, debug info is generated, or optimization
1375          is done.
1376          See http://wiki.documentfoundation.org/Development/DevBuild]),
1379 AC_ARG_ENABLE(windows-build-signing,
1380     AS_HELP_STRING([--enable-windows-build-signing],
1381         [Enable signing of windows binaries (*.exe, *.dll)]),
1384 AC_ARG_ENABLE(silent-msi,
1385     AS_HELP_STRING([--enable-silent-msi],
1386         [Enable MSI with LIMITUI=1 (silent install).]),
1389 AC_ARG_ENABLE(macosx-code-signing,
1390     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1391         [Sign executables, dylibs, frameworks and the app bundle. If you
1392          don't provide an identity the first suitable certificate
1393          in your keychain is used.]),
1396 AC_ARG_ENABLE(macosx-package-signing,
1397     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1398         [Create a .pkg suitable for uploading to the Mac App Store and sign
1399          it. If you don't provide an identity the first suitable certificate
1400          in your keychain is used.]),
1403 AC_ARG_ENABLE(macosx-sandbox,
1404     AS_HELP_STRING([--enable-macosx-sandbox],
1405         [Make the app bundle run in a sandbox. Requires code signing.
1406          Is required by apps distributed in the Mac App Store, and implies
1407          adherence to App Store rules.]),
1410 AC_ARG_WITH(macosx-bundle-identifier,
1411     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1412         [Define the OS X bundle identifier. Default is the somewhat weird
1413          org.libreoffice.script ("script", huh?).]),
1414 ,with_macosx_bundle_identifier=org.libreoffice.script)
1416 AC_ARG_WITH(product-name,
1417     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1418         [Define the product name. Default is AC_PACKAGE_NAME.]),
1419 ,with_product_name=$PRODUCTNAME)
1421 AC_ARG_WITH(package-version,
1422     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1423         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1426 libo_FUZZ_ARG_ENABLE(readonly-installset,
1427     AS_HELP_STRING([--enable-readonly-installset],
1428         [Prevents any attempts by LibreOffice to write into its installation. That means
1429          at least that no "system-wide" extensions can be added. Experimental work in
1430          progress.]),
1433 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1434     AS_HELP_STRING([--disable-postgresql-sdbc],
1435         [Disable the build of the PostgreSQL-SDBC driver.])
1438 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1439     AS_HELP_STRING([--disable-lotuswordpro],
1440         [Disable the build of the Lotus Word Pro filter.]),
1441 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1443 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1444     AS_HELP_STRING([--disable-firebird-sdbc],
1445         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1446 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1448 AC_ARG_ENABLE(bogus-pkg-config,
1449     AS_HELP_STRING([--enable-bogus-pkg-config],
1450         [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.]),
1453 AC_ARG_ENABLE(openssl,
1454     AS_HELP_STRING([--disable-openssl],
1455         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1456          components will either use GNUTLS or NSS. Work in progress,
1457          use only if you are hacking on it.]),
1458 ,enable_openssl=yes)
1460 AC_ARG_ENABLE(library-bin-tar,
1461     AS_HELP_STRING([--enable-library-bin-tar],
1462         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1463         Some libraries can save their build result in a tarball
1464         stored in TARFILE_LOCATION. That binary tarball is
1465         uniquely identified by the source tarball,
1466         the content of the config_host.mk file and the content
1467         of the top-level directory in core for that library
1468         If this option is enabled, then if such a tarfile exist, it will be untarred
1469         instead of the source tarfile, and the build step will be skipped for that
1470         library.
1471         If a proper tarfile does not exist, then the normal source-based
1472         build is done for that library and a proper binary tarfile is created
1473         for the next time.]),
1476 AC_ARG_ENABLE(dconf,
1477     AS_HELP_STRING([--disable-dconf],
1478         [Disable the dconf configuration backend (enabled by default where
1479          available).]))
1481 libo_FUZZ_ARG_ENABLE(formula-logger,
1482     AS_HELP_STRING(
1483         [--enable-formula-logger],
1484         [Enable formula logger for logging formula calculation flow in Calc.]
1485     )
1488 dnl ===================================================================
1489 dnl Optional Packages (--with/without-)
1490 dnl ===================================================================
1492 AC_ARG_WITH(gcc-home,
1493     AS_HELP_STRING([--with-gcc-home],
1494         [Specify the location of gcc/g++ manually. This can be used in conjunction
1495          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1496          non-default path.]),
1499 AC_ARG_WITH(gnu-patch,
1500     AS_HELP_STRING([--with-gnu-patch],
1501         [Specify location of GNU patch on Solaris or FreeBSD.]),
1504 AC_ARG_WITH(build-platform-configure-options,
1505     AS_HELP_STRING([--with-build-platform-configure-options],
1506         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1509 AC_ARG_WITH(gnu-cp,
1510     AS_HELP_STRING([--with-gnu-cp],
1511         [Specify location of GNU cp on Solaris or FreeBSD.]),
1514 AC_ARG_WITH(external-tar,
1515     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1516         [Specify an absolute path of where to find (and store) tarfiles.]),
1517     TARFILE_LOCATION=$withval ,
1520 AC_ARG_WITH(referenced-git,
1521     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1522         [Specify another checkout directory to reference. This makes use of
1523                  git submodule update --reference, and saves a lot of diskspace
1524                  when having multiple trees side-by-side.]),
1525     GIT_REFERENCE_SRC=$withval ,
1528 AC_ARG_WITH(linked-git,
1529     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1530         [Specify a directory where the repositories of submodules are located.
1531          This uses a method similar to git-new-workdir to get submodules.]),
1532     GIT_LINK_SRC=$withval ,
1535 AC_ARG_WITH(galleries,
1536     AS_HELP_STRING([--with-galleries],
1537         [Specify how galleries should be built. It is possible either to
1538          build these internally from source ("build"),
1539          or to disable them ("no")]),
1542 AC_ARG_WITH(theme,
1543     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1544         [Choose which themes to include. By default those themes with an '*' are included.
1545          Possible choices: *breeze, *breeze_dark, *colibre, *elementary, *galaxy, oxygen, *sifr, *sifr_dark, *tango.]),
1548 libo_FUZZ_ARG_WITH(helppack-integration,
1549     AS_HELP_STRING([--without-helppack-integration],
1550         [It will not integrate the helppacks to the installer
1551          of the product. Please use this switch to use the online help
1552          or separate help packages.]),
1555 libo_FUZZ_ARG_WITH(fonts,
1556     AS_HELP_STRING([--without-fonts],
1557         [LibreOffice includes some third-party fonts to provide a reliable basis for
1558          help content, templates, samples, etc. When these fonts are already
1559          known to be available on the system then you should use this option.]),
1562 AC_ARG_WITH(epm,
1563     AS_HELP_STRING([--with-epm],
1564         [Decides which epm to use. Default is to use the one from the system if
1565          one is built. When either this is not there or you say =internal epm
1566          will be built.]),
1569 AC_ARG_WITH(package-format,
1570     AS_HELP_STRING([--with-package-format],
1571         [Specify package format(s) for LibreOffice installation sets. The
1572          implicit --without-package-format leads to no installation sets being
1573          generated. Possible values: aix, archive, bsd, deb, dmg,
1574          installed, msi, pkg, and rpm.
1575          Example: --with-package-format='deb rpm']),
1578 AC_ARG_WITH(tls,
1579     AS_HELP_STRING([--with-tls],
1580         [Decides which TLS/SSL and cryptographic implementations to use for
1581          LibreOffice's code. Notice that this doesn't apply for depending
1582          libraries like "neon", for example. Default is to use OpenSSL
1583          although NSS is also possible. Notice that selecting NSS restricts
1584          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1585          restrict by now the usage of NSS in LO's code. Possible values:
1586          openssl, nss. Example: --with-tls="nss"]),
1589 AC_ARG_WITH(system-libs,
1590     AS_HELP_STRING([--with-system-libs],
1591         [Use libraries already on system -- enables all --with-system-* flags.]),
1594 AC_ARG_WITH(system-bzip2,
1595     AS_HELP_STRING([--with-system-bzip2],
1596         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1597     [with_system_bzip2="$with_system_libs"])
1599 AC_ARG_WITH(system-headers,
1600     AS_HELP_STRING([--with-system-headers],
1601         [Use headers already on system -- enables all --with-system-* flags for
1602          external packages whose headers are the only entities used i.e.
1603          boost/odbc/sane-header(s).]),,
1604     [with_system_headers="$with_system_libs"])
1606 AC_ARG_WITH(system-jars,
1607     AS_HELP_STRING([--without-system-jars],
1608         [When building with --with-system-libs, also the needed jars are expected
1609          on the system. Use this to disable that]),,
1610     [with_system_jars="$with_system_libs"])
1612 AC_ARG_WITH(system-cairo,
1613     AS_HELP_STRING([--with-system-cairo],
1614         [Use cairo libraries already on system.  Happens automatically for
1615          (implicit) --enable-gtk and for --enable-gtk3.]))
1617 AC_ARG_WITH(system-epoxy,
1618     AS_HELP_STRING([--with-system-epoxy],
1619         [Use epoxy libraries already on system.  Happens automatically for
1620          --enable-gtk3.]),,
1621        [with_system_epoxy="$with_system_libs"])
1623 AC_ARG_WITH(myspell-dicts,
1624     AS_HELP_STRING([--with-myspell-dicts],
1625         [Adds myspell dictionaries to the LibreOffice installation set]),
1628 AC_ARG_WITH(system-dicts,
1629     AS_HELP_STRING([--without-system-dicts],
1630         [Do not use dictionaries from system paths.]),
1633 AC_ARG_WITH(external-dict-dir,
1634     AS_HELP_STRING([--with-external-dict-dir],
1635         [Specify external dictionary dir.]),
1638 AC_ARG_WITH(external-hyph-dir,
1639     AS_HELP_STRING([--with-external-hyph-dir],
1640         [Specify external hyphenation pattern dir.]),
1643 AC_ARG_WITH(external-thes-dir,
1644     AS_HELP_STRING([--with-external-thes-dir],
1645         [Specify external thesaurus dir.]),
1648 AC_ARG_WITH(system-zlib,
1649     AS_HELP_STRING([--with-system-zlib],
1650         [Use zlib already on system.]),,
1651     [with_system_zlib=auto])
1653 AC_ARG_WITH(system-jpeg,
1654     AS_HELP_STRING([--with-system-jpeg],
1655         [Use jpeg already on system.]),,
1656     [with_system_jpeg="$with_system_libs"])
1658 AC_ARG_WITH(system-clucene,
1659     AS_HELP_STRING([--with-system-clucene],
1660         [Use clucene already on system.]),,
1661     [with_system_clucene="$with_system_libs"])
1663 AC_ARG_WITH(system-expat,
1664     AS_HELP_STRING([--with-system-expat],
1665         [Use expat already on system.]),,
1666     [with_system_expat="$with_system_libs"])
1668 AC_ARG_WITH(system-libxml,
1669     AS_HELP_STRING([--with-system-libxml],
1670         [Use libxml/libxslt already on system.]),,
1671     [with_system_libxml=auto])
1673 AC_ARG_WITH(system-icu,
1674     AS_HELP_STRING([--with-system-icu],
1675         [Use icu already on system.]),,
1676     [with_system_icu="$with_system_libs"])
1678 AC_ARG_WITH(system-ucpp,
1679     AS_HELP_STRING([--with-system-ucpp],
1680         [Use ucpp already on system.]),,
1681     [])
1683 AC_ARG_WITH(system-openldap,
1684     AS_HELP_STRING([--with-system-openldap],
1685         [Use the OpenLDAP LDAP SDK already on system.]),,
1686     [with_system_openldap="$with_system_libs"])
1688 AC_ARG_WITH(system-poppler,
1689     AS_HELP_STRING([--with-system-poppler],
1690         [Use system poppler (only needed for PDF import).]),,
1691     [with_system_poppler="$with_system_libs"])
1693 AC_ARG_WITH(system-gpgmepp,
1694     AS_HELP_STRING([--with-system-gpgmepp],
1695         [Use gpgmepp already on system]),,
1696     [with_system_gpgmepp="$with_system_libs"])
1698 AC_ARG_WITH(system-apache-commons,
1699     AS_HELP_STRING([--with-system-apache-commons],
1700         [Use Apache commons libraries already on system.]),,
1701     [with_system_apache_commons="$with_system_jars"])
1703 AC_ARG_WITH(system-mariadb,
1704     AS_HELP_STRING([--with-system-mariadb],
1705         [Use MariaDB/MySQL libraries already on system, for building the MariaDB Connector/LibreOffice
1706          extension.]),,
1707     [with_system_mariadb="$with_system_libs"])
1709 AC_ARG_ENABLE(bundle-mariadb,
1710     AS_HELP_STRING([--enable-bundle-mariadb],
1711         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice extension.])
1714 AC_ARG_WITH(system-mysql-cppconn,
1715     AS_HELP_STRING([--with-system-mysql-cppconn],
1716         [Use MySQL C++ Connector libraries already on system.]),,
1717     [with_system_mysql_cppconn="$with_system_libs"])
1719 AC_ARG_WITH(system-postgresql,
1720     AS_HELP_STRING([--with-system-postgresql],
1721         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1722          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1723     [with_system_postgresql="$with_system_libs"])
1725 AC_ARG_WITH(libpq-path,
1726     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1727         [Use this PostgreSQL C interface (libpq) installation for building
1728          the PostgreSQL-SDBC extension.]),
1731 AC_ARG_WITH(system-firebird,
1732     AS_HELP_STRING([--with-system-firebird],
1733         [Use Firebird libraries already on system, for building the Firebird-SDBC
1734          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1735     [with_system_firebird="$with_system_libs"])
1737 AC_ARG_WITH(system-libtommath,
1738             AS_HELP_STRING([--with-system-libtommath],
1739                            [Use libtommath already on system]),,
1740             [with_system_libtommath="$with_system_libs"])
1742 AC_ARG_WITH(system-hsqldb,
1743     AS_HELP_STRING([--with-system-hsqldb],
1744         [Use hsqldb already on system.]))
1746 AC_ARG_WITH(hsqldb-jar,
1747     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1748         [Specify path to jarfile manually.]),
1749     HSQLDB_JAR=$withval)
1751 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1752     AS_HELP_STRING([--disable-scripting-beanshell],
1753         [Disable support for scripts in BeanShell.]),
1757 AC_ARG_WITH(system-beanshell,
1758     AS_HELP_STRING([--with-system-beanshell],
1759         [Use beanshell already on system.]),,
1760     [with_system_beanshell="$with_system_jars"])
1762 AC_ARG_WITH(beanshell-jar,
1763     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1764         [Specify path to jarfile manually.]),
1765     BSH_JAR=$withval)
1767 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1768     AS_HELP_STRING([--disable-scripting-javascript],
1769         [Disable support for scripts in JavaScript.]),
1773 AC_ARG_WITH(system-rhino,
1774     AS_HELP_STRING([--with-system-rhino],
1775         [Use rhino already on system.]),,)
1776 #    [with_system_rhino="$with_system_jars"])
1777 # Above is not used as we have different debug interface
1778 # patched into internal rhino. This code needs to be fixed
1779 # before we can enable it by default.
1781 AC_ARG_WITH(rhino-jar,
1782     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1783         [Specify path to jarfile manually.]),
1784     RHINO_JAR=$withval)
1786 AC_ARG_WITH(commons-logging-jar,
1787     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1788         [Specify path to jarfile manually.]),
1789     COMMONS_LOGGING_JAR=$withval)
1791 AC_ARG_WITH(system-jfreereport,
1792     AS_HELP_STRING([--with-system-jfreereport],
1793         [Use JFreeReport already on system.]),,
1794     [with_system_jfreereport="$with_system_jars"])
1796 AC_ARG_WITH(sac-jar,
1797     AS_HELP_STRING([--with-sac-jar=JARFILE],
1798         [Specify path to jarfile manually.]),
1799     SAC_JAR=$withval)
1801 AC_ARG_WITH(libxml-jar,
1802     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1803         [Specify path to jarfile manually.]),
1804     LIBXML_JAR=$withval)
1806 AC_ARG_WITH(flute-jar,
1807     AS_HELP_STRING([--with-flute-jar=JARFILE],
1808         [Specify path to jarfile manually.]),
1809     FLUTE_JAR=$withval)
1811 AC_ARG_WITH(jfreereport-jar,
1812     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1813         [Specify path to jarfile manually.]),
1814     JFREEREPORT_JAR=$withval)
1816 AC_ARG_WITH(liblayout-jar,
1817     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1818         [Specify path to jarfile manually.]),
1819     LIBLAYOUT_JAR=$withval)
1821 AC_ARG_WITH(libloader-jar,
1822     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1823         [Specify path to jarfile manually.]),
1824     LIBLOADER_JAR=$withval)
1826 AC_ARG_WITH(libformula-jar,
1827     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1828         [Specify path to jarfile manually.]),
1829     LIBFORMULA_JAR=$withval)
1831 AC_ARG_WITH(librepository-jar,
1832     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1833         [Specify path to jarfile manually.]),
1834     LIBREPOSITORY_JAR=$withval)
1836 AC_ARG_WITH(libfonts-jar,
1837     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1838         [Specify path to jarfile manually.]),
1839     LIBFONTS_JAR=$withval)
1841 AC_ARG_WITH(libserializer-jar,
1842     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1843         [Specify path to jarfile manually.]),
1844     LIBSERIALIZER_JAR=$withval)
1846 AC_ARG_WITH(libbase-jar,
1847     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1848         [Specify path to jarfile manually.]),
1849     LIBBASE_JAR=$withval)
1851 AC_ARG_WITH(system-odbc,
1852     AS_HELP_STRING([--with-system-odbc],
1853         [Use the odbc headers already on system.]),,
1854     [with_system_odbc="auto"])
1856 AC_ARG_WITH(system-sane,
1857     AS_HELP_STRING([--with-system-sane],
1858         [Use sane.h already on system.]),,
1859     [with_system_sane="$with_system_headers"])
1861 AC_ARG_WITH(system-bluez,
1862     AS_HELP_STRING([--with-system-bluez],
1863         [Use bluetooth.h already on system.]),,
1864     [with_system_bluez="$with_system_headers"])
1866 AC_ARG_WITH(system-curl,
1867     AS_HELP_STRING([--with-system-curl],
1868         [Use curl already on system.]),,
1869     [with_system_curl=auto])
1871 AC_ARG_WITH(system-boost,
1872     AS_HELP_STRING([--with-system-boost],
1873         [Use boost already on system.]),,
1874     [with_system_boost="$with_system_headers"])
1876 AC_ARG_WITH(system-glm,
1877     AS_HELP_STRING([--with-system-glm],
1878         [Use glm already on system.]),,
1879     [with_system_glm="$with_system_headers"])
1881 AC_ARG_WITH(system-hunspell,
1882     AS_HELP_STRING([--with-system-hunspell],
1883         [Use libhunspell already on system.]),,
1884     [with_system_hunspell="$with_system_libs"])
1886 AC_ARG_WITH(system-mythes,
1887     AS_HELP_STRING([--with-system-mythes],
1888         [Use mythes already on system.]),,
1889     [with_system_mythes="$with_system_libs"])
1891 AC_ARG_WITH(system-altlinuxhyph,
1892     AS_HELP_STRING([--with-system-altlinuxhyph],
1893         [Use ALTLinuxhyph already on system.]),,
1894     [with_system_altlinuxhyph="$with_system_libs"])
1896 AC_ARG_WITH(system-lpsolve,
1897     AS_HELP_STRING([--with-system-lpsolve],
1898         [Use lpsolve already on system.]),,
1899     [with_system_lpsolve="$with_system_libs"])
1901 AC_ARG_WITH(system-coinmp,
1902     AS_HELP_STRING([--with-system-coinmp],
1903         [Use CoinMP already on system.]),,
1904     [with_system_coinmp="$with_system_libs"])
1906 AC_ARG_WITH(system-liblangtag,
1907     AS_HELP_STRING([--with-system-liblangtag],
1908         [Use liblangtag library already on system.]),,
1909     [with_system_liblangtag="$with_system_libs"])
1911 AC_ARG_WITH(webdav,
1912     AS_HELP_STRING([--with-webdav],
1913         [Specify which library to use for webdav implementation.
1914          Possible values: "neon", "serf", "no". The default value is "neon".
1915          Example: --with-webdav="serf"]),
1916     WITH_WEBDAV=$withval,
1917     WITH_WEBDAV="neon")
1919 AC_ARG_WITH(linker-hash-style,
1920     AS_HELP_STRING([--with-linker-hash-style],
1921         [Use linker with --hash-style=<style> when linking shared objects.
1922          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1923          if supported on the build system, and "sysv" otherwise.]))
1925 AC_ARG_WITH(jdk-home,
1926     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1927         [If you have installed JDK 1.6 or later on your system please supply the
1928          path here. Note that this is not the location of the java command but the
1929          location of the entire distribution.]),
1932 AC_ARG_WITH(help,
1933     AS_HELP_STRING([--with-help],
1934         [Enable the build of help. There is a special parameter "common" that
1935          can be used to bundle only the common part, .e.g help-specific icons.
1936          This is useful when you build the helpcontent separately.])
1937     [
1938                           Usage:     --with-help    build the old local help
1939                                  --without-help     no local help (default)
1940                                  --with-help=html   build the new HTML local help
1941                                  --with-help=online build the new HTML online help
1942                                  --with-help=common bundle common files for the local
1943                                                     help but do not build the whole help
1944     ],
1947 libo_FUZZ_ARG_WITH(java,
1948     AS_HELP_STRING([--with-java=<java command>],
1949         [Specify the name of the Java interpreter command. Typically "java"
1950          which is the default.
1952          To build without support for Java components, applets, accessibility
1953          or the XML filters written in Java, use --without-java or --with-java=no.]),
1954     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1955     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1958 AC_ARG_WITH(jvm-path,
1959     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1960         [Use a specific JVM search path at runtime.
1961          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1964 AC_ARG_WITH(ant-home,
1965     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1966         [If you have installed Jakarta Ant on your system, please supply the path here.
1967          Note that this is not the location of the Ant binary but the location
1968          of the entire distribution.]),
1971 AC_ARG_WITH(symbol-config,
1972     AS_HELP_STRING([--with-symbol-config],
1973         [Configuration for the crashreport symbol upload]),
1974         [],
1975         [with_symbol_config=no])
1977 AC_ARG_WITH(export-validation,
1978     AS_HELP_STRING([--without-export-validation],
1979         [Disable validating OOXML and ODF files as exported from in-tree tests.
1980          Use this option e.g. if your system only provides Java 5.]),
1981 ,with_export_validation=auto)
1983 AC_ARG_WITH(bffvalidator,
1984     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
1985         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
1986          Requires installed Microsoft Office Binary File Format Validator.
1987          Note: export-validation (--with-export-validation) is required to be turned on.
1988          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
1989 ,with_bffvalidator=no)
1991 libo_FUZZ_ARG_WITH(junit,
1992     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
1993         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
1994          --without-junit disables those tests. Not relevant in the --without-java case.]),
1995 ,with_junit=yes)
1997 AC_ARG_WITH(hamcrest,
1998     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
1999         [Specifies the hamcrest jar file to use for JUnit-based tests.
2000          --without-junit disables those tests. Not relevant in the --without-java case.]),
2001 ,with_hamcrest=yes)
2003 AC_ARG_WITH(perl-home,
2004     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2005         [If you have installed Perl 5 Distribution, on your system, please
2006          supply the path here. Note that this is not the location of the Perl
2007          binary but the location of the entire distribution.]),
2010 libo_FUZZ_ARG_WITH(doxygen,
2011     AS_HELP_STRING(
2012         [--with-doxygen=<absolute path to doxygen executable>],
2013         [Specifies the doxygen executable to use when generating ODK C/C++
2014          documentation. --without-doxygen disables generation of ODK C/C++
2015          documentation. Not relevant in the --disable-odk case.]),
2016 ,with_doxygen=yes)
2018 AC_ARG_WITH(visual-studio,
2019     AS_HELP_STRING([--with-visual-studio=<2015/2017>],
2020         [Specify which Visual Studio version to use in case several are
2021          installed. If not specified, defaults to 2015.]),
2024 AC_ARG_WITH(windows-sdk,
2025     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2026         [Specify which Windows SDK, or "Windows Kit", version to use
2027          in case the one that came with the selected Visual Studio
2028          is not what you want for some reason. Note that not all compiler/SDK
2029          combinations are supported. The intent is that this option should not
2030          be needed.]),
2033 AC_ARG_WITH(lang,
2034     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2035         [Use this option to build LibreOffice with additional UI language support.
2036          English (US) is always included by default.
2037          Separate multiple languages with space.
2038          For all languages, use --with-lang=ALL.]),
2041 AC_ARG_WITH(locales,
2042     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2043         [Use this option to limit the locale information built in.
2044          Separate multiple locales with space.
2045          Very experimental and might well break stuff.
2046          Just a desperate measure to shrink code and data size.
2047          By default all the locales available is included.
2048          This option is completely unrelated to --with-lang.])
2049     [
2050                           Affects also our character encoding conversion
2051                           tables for encodings mainly targeted for a
2052                           particular locale, like EUC-CN and EUC-TW for
2053                           zh, ISO-2022-JP for ja.
2055                           Affects also our add-on break iterator data for
2056                           some languages.
2058                           For the default, all locales, don't use this switch at all.
2059                           Specifying just the language part of a locale means all matching
2060                           locales will be included.
2061     ],
2064 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2065 libo_FUZZ_ARG_WITH(krb5,
2066     AS_HELP_STRING([--with-krb5],
2067         [Enable MIT Kerberos 5 support in modules that support it.
2068          By default automatically enabled on platforms
2069          where a good system Kerberos 5 is available.]),
2072 libo_FUZZ_ARG_WITH(gssapi,
2073     AS_HELP_STRING([--with-gssapi],
2074         [Enable GSSAPI support in modules that support it.
2075          By default automatically enabled on platforms
2076          where a good system GSSAPI is available.]),
2079 AC_ARG_WITH(iwyu,
2080     AS_HELP_STRING([--with-iwyu],
2081         [Use given IWYU binary path to check unneeded includes instead of building.
2082          Use only if you are hacking on it.]),
2085 libo_FUZZ_ARG_WITH(lxml,
2086     AS_HELP_STRING([--without-lxml],
2087         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2088          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2089          report widget classes and ids.]),
2092 dnl ===================================================================
2093 dnl Branding
2094 dnl ===================================================================
2096 AC_ARG_WITH(branding,
2097     AS_HELP_STRING([--with-branding=/path/to/images],
2098         [Use given path to retrieve branding images set.])
2099     [
2100                           Search for intro.png about.svg and flat_logo.svg.
2101                           If any is missing, default ones will be used instead.
2103                           Search also progress.conf for progress
2104                           settings on intro screen :
2106                           PROGRESSBARCOLOR="255,255,255" Set color of
2107                           progress bar. Comma separated RGB decimal values.
2108                           PROGRESSSIZE="407,6" Set size of progress bar.
2109                           Comma separated decimal values (width, height).
2110                           PROGRESSPOSITION="61,317" Set position of progress
2111                           bar from left,top. Comma separated decimal values.
2112                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2113                           bar frame. Comma separated RGB decimal values.
2114                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2115                           bar text. Comma separated RGB decimal values.
2116                           PROGRESSTEXTBASELINE="287" Set vertical position of
2117                           progress bar text from top. Decimal value.
2119                           Default values will be used if not found.
2120     ],
2124 AC_ARG_WITH(extra-buildid,
2125     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2126         [Show addition build identification in about dialog.]),
2130 AC_ARG_WITH(vendor,
2131     AS_HELP_STRING([--with-vendor="John the Builder"],
2132         [Set vendor of the build.]),
2135 AC_ARG_WITH(android-package-name,
2136     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2137         [Set Android package name of the build.]),
2140 AC_ARG_WITH(compat-oowrappers,
2141     AS_HELP_STRING([--with-compat-oowrappers],
2142         [Install oo* wrappers in parallel with
2143          lo* ones to keep backward compatibility.
2144          Has effect only with make distro-pack-install]),
2147 AC_ARG_WITH(os-version,
2148     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2149         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2152 AC_ARG_WITH(mingw-cross-compiler,
2153     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2154         [Specify the MinGW cross-compiler to use.
2155          When building on the ODK on Unix and building unowinreg.dll,
2156          specify the MinGW C++ cross-compiler.]),
2159 AC_ARG_WITH(idlc-cpp,
2160     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2161         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2164 AC_ARG_WITH(build-version,
2165     AS_HELP_STRING([--with-build-version="Built by Jim"],
2166         [Allows the builder to add a custom version tag that will appear in the
2167          Help/About box for QA purposes.]),
2168 with_build_version=$withval,
2171 AC_ARG_WITH(alloc,
2172     AS_HELP_STRING([--with-alloc],
2173         [Define which allocator to build with (choices are internal, system).]),
2176 AC_ARG_WITH(parallelism,
2177     AS_HELP_STRING([--with-parallelism],
2178         [Number of jobs to run simultaneously during build. Parallel builds can
2179         save a lot of time on multi-cpu machines. Defaults to the number of
2180         CPUs on the machine, unless you configure --enable-icecream - then to
2181         10.]),
2184 AC_ARG_WITH(all-tarballs,
2185     AS_HELP_STRING([--with-all-tarballs],
2186         [Download all external tarballs unconditionally]))
2188 AC_ARG_WITH(gdrive-client-id,
2189     AS_HELP_STRING([--with-gdrive-client-id],
2190         [Provides the client id of the application for OAuth2 authentication
2191         on Google Drive. If either this or --with-gdrive-client-secret is
2192         empty, the feature will be disabled]),
2195 AC_ARG_WITH(gdrive-client-secret,
2196     AS_HELP_STRING([--with-gdrive-client-secret],
2197         [Provides the client secret of the application for OAuth2
2198         authentication on Google Drive. If either this or
2199         --with-gdrive-client-id is empty, the feature will be disabled]),
2202 AC_ARG_WITH(alfresco-cloud-client-id,
2203     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2204         [Provides the client id of the application for OAuth2 authentication
2205         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2206         empty, the feature will be disabled]),
2209 AC_ARG_WITH(alfresco-cloud-client-secret,
2210     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2211         [Provides the client secret of the application for OAuth2
2212         authentication on Alfresco Cloud. If either this or
2213         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2216 AC_ARG_WITH(onedrive-client-id,
2217     AS_HELP_STRING([--with-onedrive-client-id],
2218         [Provides the client id of the application for OAuth2 authentication
2219         on OneDrive. If either this or --with-onedrive-client-secret is
2220         empty, the feature will be disabled]),
2223 AC_ARG_WITH(onedrive-client-secret,
2224     AS_HELP_STRING([--with-onedrive-client-secret],
2225         [Provides the client secret of the application for OAuth2
2226         authentication on OneDrive. If either this or
2227         --with-onedrive-client-id is empty, the feature will be disabled]),
2229 dnl ===================================================================
2230 dnl Do we want to use pre-build binary tarball for recompile
2231 dnl ===================================================================
2233 if test "$enable_library_bin_tar" = "yes" ; then
2234     USE_LIBRARY_BIN_TAR=TRUE
2235 else
2236     USE_LIBRARY_BIN_TAR=
2238 AC_SUBST(USE_LIBRARY_BIN_TAR)
2240 dnl ===================================================================
2241 dnl Test whether build target is Release Build
2242 dnl ===================================================================
2243 AC_MSG_CHECKING([whether build target is Release Build])
2244 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2245     AC_MSG_RESULT([no])
2246     ENABLE_RELEASE_BUILD=
2247 else
2248     AC_MSG_RESULT([yes])
2249     ENABLE_RELEASE_BUILD=TRUE
2251 AC_SUBST(ENABLE_RELEASE_BUILD)
2253 dnl ===================================================================
2254 dnl Test whether to sign Windows Build
2255 dnl ===================================================================
2256 AC_MSG_CHECKING([whether to sign windows build])
2257 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2258     AC_MSG_RESULT([yes])
2259     WINDOWS_BUILD_SIGNING="TRUE"
2260 else
2261     AC_MSG_RESULT([no])
2262     WINDOWS_BUILD_SIGNING="FALSE"
2264 AC_SUBST(WINDOWS_BUILD_SIGNING)
2266 dnl ===================================================================
2267 dnl MacOSX build and runtime environment options
2268 dnl ===================================================================
2270 AC_ARG_WITH(macosx-sdk,
2271     AS_HELP_STRING([--with-macosx-sdk=<version>],
2272         [Prefer a specific SDK for building.])
2273     [
2274                           If the requested SDK is not available, a search for the oldest one will be done.
2275                           With current Xcode versions, only the latest SDK is included, so this option is
2276                           not terribly useful. It works fine to build with a new SDK and run the result
2277                           on an older OS.
2279                           e. g.: --with-macosx-sdk=10.9
2281                           there are 3 options to control the MacOSX build:
2282                           --with-macosx-sdk (referred as 'sdk' below)
2283                           --with-macosx-version-min-required (referred as 'min' below)
2284                           --with-macosx-version-max-allowed (referred as 'max' below)
2286                           the connection between these value and the default they take is as follow:
2287                           ( ? means not specified on the command line, s means the SDK version found,
2288                           constraint: 8 <= x <= y <= z)
2290                           ==========================================
2291                            command line      || config result
2292                           ==========================================
2293                           min  | max  | sdk  || min  | max  | sdk  |
2294                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2295                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2296                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2297                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2298                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2299                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2300                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2301                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2304                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2305                           for a detailed technical explanation of these variables
2307                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2308     ],
2311 AC_ARG_WITH(macosx-version-min-required,
2312     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2313         [set the minimum OS version needed to run the built LibreOffice])
2314     [
2315                           e. g.: --with-macos-version-min-required=10.9
2316                           see --with-macosx-sdk for more info
2317     ],
2320 AC_ARG_WITH(macosx-version-max-allowed,
2321     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2322         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2323     [
2324                           e. g.: --with-macos-version-max-allowed=10.9
2325                           see --with-macosx-sdk for more info
2326     ],
2330 dnl ===================================================================
2331 dnl options for stuff used during cross-compilation build
2332 dnl Not quite superseded by --with-build-platform-configure-options.
2333 dnl TODO: check, if the "force" option is still needed anywhere.
2334 dnl ===================================================================
2336 AC_ARG_WITH(system-icu-for-build,
2337     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2338         [Use icu already on system for build tools (cross-compilation only).]))
2341 dnl ===================================================================
2342 dnl Check for incompatible options set by fuzzing, and reset those
2343 dnl automatically to working combinations
2344 dnl ===================================================================
2346 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2347         "$enable_dbus" != "$enable_avahi"; then
2348     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2349     enable_avahi=$enable_dbus
2352 dnl ===================================================================
2353 dnl check for required programs (grep, awk, sed, bash)
2354 dnl ===================================================================
2356 pathmunge ()
2358     if test -n "$1"; then
2359         if test "$build_os" = "cygwin"; then
2360             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2361                 PathFormat "$1"
2362                 new_path=`cygpath -sm "$formatted_path"`
2363             else
2364                 PathFormat "$1"
2365                 new_path=`cygpath -u "$formatted_path"`
2366             fi
2367         else
2368             new_path="$1"
2369         fi
2370         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2371             if test "$2" = "after"; then
2372                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2373             else
2374                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2375             fi
2376         fi
2377         unset new_path
2378     fi
2381 AC_PROG_AWK
2382 AC_PATH_PROG( AWK, $AWK)
2383 if test -z "$AWK"; then
2384     AC_MSG_ERROR([install awk to run this script])
2387 AC_PATH_PROG(BASH, bash)
2388 if test -z "$BASH"; then
2389     AC_MSG_ERROR([bash not found in \$PATH])
2391 AC_SUBST(BASH)
2393 AC_MSG_CHECKING([for GNU or BSD tar])
2394 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2395     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2396     if test $? -eq 0;  then
2397         GNUTAR=$a
2398         break
2399     fi
2400 done
2401 AC_MSG_RESULT($GNUTAR)
2402 if test -z "$GNUTAR"; then
2403     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2405 AC_SUBST(GNUTAR)
2407 AC_MSG_CHECKING([for tar's option to strip components])
2408 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2409 if test $? -eq 0; then
2410     STRIP_COMPONENTS="--strip-components"
2411 else
2412     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2413     if test $? -eq 0; then
2414         STRIP_COMPONENTS="--strip-path"
2415     else
2416         STRIP_COMPONENTS="unsupported"
2417     fi
2419 AC_MSG_RESULT($STRIP_COMPONENTS)
2420 if test x$STRIP_COMPONENTS = xunsupported; then
2421     AC_MSG_ERROR([you need a tar that is able to strip components.])
2423 AC_SUBST(STRIP_COMPONENTS)
2425 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2426 dnl desktop OSes from "mobile" ones.
2428 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2429 dnl In other words, that when building for an OS that is not a
2430 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2432 dnl Note the direction of the implication; there is no assumption that
2433 dnl cross-compiling would imply a non-desktop OS.
2435 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2436     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2437     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2438     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2441 # Whether to build "avmedia" functionality or not.
2443 if test -z "$enable_avmedia"; then
2444     enable_avmedia=yes
2447 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2448 if test "$enable_avmedia" = yes; then
2449     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2450 else
2451     USE_AVMEDIA_DUMMY='TRUE'
2453 AC_SUBST(USE_AVMEDIA_DUMMY)
2455 # Decide whether to build database connectivity stuff (including
2456 # Base) or not. We probably don't want to on non-desktop OSes.
2457 if test -z "$enable_database_connectivity"; then
2458     # --disable-database-connectivity is unfinished work in progress
2459     # and the iOS test app doesn't link if we actually try to use it.
2460     # if test $_os != iOS -a $_os != Android; then
2461     if test $_os != iOS; then
2462         enable_database_connectivity=yes
2463     fi
2466 if test "$enable_database_connectivity" = yes; then
2467     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2468     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2471 if test -z "$enable_extensions"; then
2472     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2473     if test $_os != iOS -a $_os != Android; then
2474         enable_extensions=yes
2475     fi
2478 if test "$enable_extensions" = yes; then
2479     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2480     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2483 if test -z "$enable_scripting"; then
2484     # Disable scripting for iOS unless specifically overridden
2485     # with --enable-scripting.
2486     if test $_os != iOS; then
2487         enable_scripting=yes
2488     fi
2491 DISABLE_SCRIPTING=''
2492 if test "$enable_scripting" = yes; then
2493     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2494     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2495 else
2496     DISABLE_SCRIPTING='TRUE'
2497     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2500 if test $_os = iOS -o $_os = Android; then
2501     # Disable dynamic_loading always for iOS and Android
2502     enable_dynamic_loading=no
2503 elif test -z "$enable_dynamic_loading"; then
2504     # Otherwise enable it unless speficically disabled
2505     enable_dynamic_loading=yes
2508 DISABLE_DYNLOADING=''
2509 if test "$enable_dynamic_loading" = yes; then
2510     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2511 else
2512     DISABLE_DYNLOADING='TRUE'
2514 AC_SUBST(DISABLE_DYNLOADING)
2516 # remenber SYSBASE value
2517 AC_SUBST(SYSBASE)
2519 dnl ===================================================================
2520 dnl  Sort out various gallery compilation options
2521 dnl ===================================================================
2522 AC_MSG_CHECKING([how to build and package galleries])
2523 if test -n "${with_galleries}"; then
2524     if test "$with_galleries" = "build"; then
2525         WITH_GALLERY_BUILD=TRUE
2526         AC_MSG_RESULT([build from source images internally])
2527     elif test "$with_galleries" = "no"; then
2528         WITH_GALLERY_BUILD=
2529         AC_MSG_RESULT([disable non-internal gallery build])
2530     else
2531         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2532     fi
2533 else
2534     if test $_os != iOS -a $_os != Android; then
2535         WITH_GALLERY_BUILD=TRUE
2536         AC_MSG_RESULT([internal src images for desktop])
2537     else
2538         WITH_GALLERY_BUILD=
2539         AC_MSG_RESULT([disable src image build])
2540     fi
2542 AC_SUBST(WITH_GALLERY_BUILD)
2544 dnl ===================================================================
2545 dnl  Checks if ccache is available
2546 dnl ===================================================================
2547 if test "$_os" = "WINNT"; then
2548     # on windows/VC build do not use ccache
2549     CCACHE=""
2550 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2551     case "%$CC%$CXX%" in
2552     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2553     # assume that's good then
2554     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2555         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2556         ;;
2557     *)
2558         AC_PATH_PROG([CCACHE],[ccache],[not found])
2559         if test "$CCACHE" = "not found"; then
2560             CCACHE=""
2561         else
2562             # Need to check for ccache version: otherwise prevents
2563             # caching of the results (like "-x objective-c++" for Mac)
2564             if test $_os = Darwin -o $_os = iOS; then
2565                 # Check ccache version
2566                 AC_MSG_CHECKING([whether version of ccache is suitable])
2567                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2568                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2569                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2570                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2571                 else
2572                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2573                     CCACHE=""
2574                 fi
2575             fi
2576         fi
2577         ;;
2578     esac
2579 else
2580     CCACHE=""
2583 if test "$CCACHE" != ""; then
2584     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2585     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2586     if test "$ccache_size" = ""; then
2587         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2588         if test "$ccache_size" = ""; then
2589             ccache_size=0
2590         fi
2591         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2592         if test $ccache_size -lt 1024; then
2593             CCACHE=""
2594             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2595             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2596         else
2597             # warn that ccache may be too small for debug build
2598             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2599             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2600         fi
2601     else
2602         if test $ccache_size -lt 5; then
2603             #warn that ccache may be too small for debug build
2604             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2605             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2606         fi
2607     fi
2610 dnl ===================================================================
2611 dnl  Checks for C compiler,
2612 dnl  The check for the C++ compiler is later on.
2613 dnl ===================================================================
2614 if test "$_os" != "WINNT"; then
2615     GCC_HOME_SET="true"
2616     AC_MSG_CHECKING([gcc home])
2617     if test -z "$with_gcc_home"; then
2618         if test "$enable_icecream" = "yes"; then
2619             if test -d "/usr/lib/icecc/bin"; then
2620                 GCC_HOME="/usr/lib/icecc/"
2621             elif test -d "/usr/libexec/icecc/bin"; then
2622                 GCC_HOME="/usr/libexec/icecc/"
2623             elif test -d "/opt/icecream/bin"; then
2624                 GCC_HOME="/opt/icecream/"
2625             else
2626                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2628             fi
2629         else
2630             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2631             GCC_HOME_SET="false"
2632         fi
2633     else
2634         GCC_HOME="$with_gcc_home"
2635     fi
2636     AC_MSG_RESULT($GCC_HOME)
2637     AC_SUBST(GCC_HOME)
2639     if test "$GCC_HOME_SET" = "true"; then
2640         if test -z "$CC"; then
2641             CC="$GCC_HOME/bin/gcc"
2642         fi
2643         if test -z "$CXX"; then
2644             CXX="$GCC_HOME/bin/g++"
2645         fi
2646     fi
2649 COMPATH=`dirname "$CC"`
2650 if test "$COMPATH" = "."; then
2651     AC_PATH_PROGS(COMPATH, $CC)
2652     dnl double square bracket to get single because of M4 quote...
2653     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2655 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2657 dnl ===================================================================
2658 dnl Java support
2659 dnl ===================================================================
2660 AC_MSG_CHECKING([whether to build with Java support])
2661 if test "$with_java" != "no"; then
2662     if test "$DISABLE_SCRIPTING" = TRUE; then
2663         AC_MSG_RESULT([no, overridden by --disable-scripting])
2664         ENABLE_JAVA=""
2665         with_java=no
2666     else
2667         AC_MSG_RESULT([yes])
2668         ENABLE_JAVA="TRUE"
2669         AC_DEFINE(HAVE_FEATURE_JAVA)
2670     fi
2671 else
2672     AC_MSG_RESULT([no])
2673     ENABLE_JAVA=""
2676 AC_SUBST(ENABLE_JAVA)
2678 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2680 dnl ENABLE_JAVA="" indicate no Java support at all
2682 dnl ===================================================================
2683 dnl Check OS X SDK and compiler
2684 dnl ===================================================================
2686 if test $_os = Darwin -o $_os = iOS; then
2688     # If no --with-macosx-sdk option is given, look for one
2690     # The intent is that for "most" Mac-based developers, a suitable
2691     # SDK will be found automatically without any configure options.
2693     # For developers with a current Xcode, the lowest-numbered SDK
2694     # higher than or equal to the minimum required should be found.
2696     AC_MSG_CHECKING([what Mac OS X SDK to use])
2697     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2698         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2699         if test -d "$MACOSX_SDK_PATH"; then
2700             with_macosx_sdk="${_macosx_sdk}"
2701             break
2702         else
2703             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2704             if test -d "$MACOSX_SDK_PATH"; then
2705                 with_macosx_sdk="${_macosx_sdk}"
2706                 break
2707             fi
2708         fi
2709     done
2710     if test ! -d "$MACOSX_SDK_PATH"; then
2711         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2712     fi
2714     if test $_os = iOS; then
2715         if test "$enable_ios_simulator" = "yes"; then
2716             useos=iphonesimulator
2717         else
2718             useos=iphoneos
2719         fi
2720         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2721     fi
2722     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2725     case $with_macosx_sdk in
2726     10.9)
2727         MACOSX_SDK_VERSION=1090
2728         ;;
2729     10.10)
2730         MACOSX_SDK_VERSION=101000
2731         ;;
2732     10.11)
2733         MACOSX_SDK_VERSION=101100
2734         ;;
2735     10.12)
2736         MACOSX_SDK_VERSION=101200
2737         ;;
2738     10.13)
2739         MACOSX_SDK_VERSION=101300
2740         ;;
2741     *)
2742         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2743         ;;
2744     esac
2746     if test "$with_macosx_version_min_required" = "" ; then
2747         with_macosx_version_min_required="10.9";
2748     fi
2750     if test "$with_macosx_version_max_allowed" = "" ; then
2751         with_macosx_version_max_allowed="$with_macosx_sdk"
2752     fi
2754     # export this so that "xcrun" invocations later return matching values
2755     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2756     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2757     export DEVELOPER_DIR
2758     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2759     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2761     case "$with_macosx_version_min_required" in
2762     10.9)
2763         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2764         ;;
2765     10.10)
2766         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2767         ;;
2768     10.11)
2769         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2770         ;;
2771     10.12)
2772         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2773         ;;
2774     10.13)
2775         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2776         ;;
2777     *)
2778         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2779         ;;
2780     esac
2781     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2783     LIBTOOL=/usr/bin/libtool
2784     INSTALL_NAME_TOOL=install_name_tool
2785     if test -z "$save_CC"; then
2786         AC_MSG_CHECKING([what compiler to use])
2787         stdlib=-stdlib=libc++
2788         if test "$ENABLE_LTO" = TRUE; then
2789             lto=-flto
2790         fi
2791         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2792         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2793         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2794         AR=`xcrun -find ar`
2795         NM=`xcrun -find nm`
2796         STRIP=`xcrun -find strip`
2797         LIBTOOL=`xcrun -find libtool`
2798         RANLIB=`xcrun -find ranlib`
2799         AC_MSG_RESULT([$CC and $CXX])
2800     fi
2802     case "$with_macosx_version_max_allowed" in
2803     10.9)
2804         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2805         ;;
2806     10.10)
2807         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2808         ;;
2809     10.11)
2810         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2811         ;;
2812     10.12)
2813         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2814         ;;
2815     10.13)
2816         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2817         ;;
2818     *)
2819         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2820         ;;
2821     esac
2823     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2824     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2825         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2826         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2827         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2828     else
2829         AC_MSG_RESULT([ok])
2830     fi
2832     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2833     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2834         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2835     else
2836         AC_MSG_RESULT([ok])
2837     fi
2838     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2839     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2841     AC_MSG_CHECKING([whether to do code signing])
2843     if test "$enable_macosx_code_signing" = yes; then
2844         # By default use the first suitable certificate (?).
2846         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2847         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2848         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2849         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2850         # "Developer ID Application" one.
2852         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2853         if test -n "$identity"; then
2854             MACOSX_CODESIGNING_IDENTITY=$identity
2855             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2856             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2857         else
2858             AC_MSG_ERROR([cannot determine identity to use])
2859         fi
2860     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2861         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2862         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2863         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2864     else
2865         AC_MSG_RESULT([no])
2866     fi
2868     AC_MSG_CHECKING([whether to create a Mac App Store package])
2870     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2871         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2872     elif test "$enable_macosx_package_signing" = yes; then
2873         # By default use the first suitable certificate.
2874         # It should be a "3rd Party Mac Developer Installer" one
2876         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2877         if test -n "$identity"; then
2878             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2879             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2880             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2881         else
2882             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2883         fi
2884     elif test -n "$enable_macosx_package_signing"; then
2885         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2886         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2887         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2888     else
2889         AC_MSG_RESULT([no])
2890     fi
2892     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2893         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2894     fi
2896     AC_MSG_CHECKING([whether to sandbox the application])
2898     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2899         AC_MSG_ERROR([OS X sandboxing requires code signing])
2900     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2901         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2902     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2903         ENABLE_MACOSX_SANDBOX=TRUE
2904         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2905         AC_MSG_RESULT([yes])
2906     else
2907         AC_MSG_RESULT([no])
2908     fi
2910     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2911     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2912     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2914 AC_SUBST(MACOSX_SDK_PATH)
2915 AC_SUBST(MACOSX_SDK_VERSION)
2916 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2917 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2918 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2919 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2920 AC_SUBST(INSTALL_NAME_TOOL)
2921 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2922 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2923 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2924 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2925 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2927 dnl ===================================================================
2928 dnl Check iOS SDK and compiler
2929 dnl ===================================================================
2931 if test $_os = iOS; then
2932     AC_MSG_CHECKING([what iOS SDK to use])
2933     current_sdk_ver=11.3
2934     if test "$enable_ios_simulator" = "yes"; then
2935         platform=iPhoneSimulator
2936         versionmin=-mios-simulator-version-min=$current_sdk_ver
2937     else
2938         platform=iPhoneOS
2939         versionmin=-miphoneos-version-min=$current_sdk_ver
2940     fi
2941     xcode_developer=`xcode-select -print-path`
2943     for sdkver in $current_sdk_ver; do
2944         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2945         if test -d $t; then
2946             ios_sdk=$sdkver
2947             sysroot=$t
2948             break
2949         fi
2950     done
2952     if test -z "$sysroot"; then
2953         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2954     fi
2956     AC_MSG_RESULT($sysroot)
2958     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2959     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2961     # LTO is not really recommended for iOS builds,
2962     # the link time will be astronomical
2963     if test "$ENABLE_LTO" = TRUE; then
2964         lto=-flto
2965     fi
2967     stdlib="-stdlib=libc++"
2969     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2970     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2972     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2973     AR=`xcrun -find ar`
2974     NM=`xcrun -find nm`
2975     STRIP=`xcrun -find strip`
2976     LIBTOOL=`xcrun -find libtool`
2977     RANLIB=`xcrun -find ranlib`
2980 AC_SUBST(IOS_SDK)
2981 AC_SUBST(IOS_DEPLOYMENT_VERSION)
2983 AC_MSG_CHECKING([whether to treat the installation as read-only])
2985 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
2986         "$enable_extensions" != yes; then
2987     enable_readonly_installset=yes
2989 if test "$enable_readonly_installset" = yes; then
2990     AC_MSG_RESULT([yes])
2991     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
2992 else
2993     AC_MSG_RESULT([no])
2996 dnl ===================================================================
2997 dnl Structure of install set
2998 dnl ===================================================================
3000 if test $_os = Darwin; then
3001     LIBO_BIN_FOLDER=MacOS
3002     LIBO_ETC_FOLDER=Resources
3003     LIBO_LIBEXEC_FOLDER=MacOS
3004     LIBO_LIB_FOLDER=Frameworks
3005     LIBO_LIB_PYUNO_FOLDER=Resources
3006     LIBO_SHARE_FOLDER=Resources
3007     LIBO_SHARE_HELP_FOLDER=Resources/help
3008     LIBO_SHARE_JAVA_FOLDER=Resources/java
3009     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3010     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3011     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3012     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3013     LIBO_URE_BIN_FOLDER=MacOS
3014     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3015     LIBO_URE_LIB_FOLDER=Frameworks
3016     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3017     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3018 elif test $_os = WINNT; then
3019     LIBO_BIN_FOLDER=program
3020     LIBO_ETC_FOLDER=program
3021     LIBO_LIBEXEC_FOLDER=program
3022     LIBO_LIB_FOLDER=program
3023     LIBO_LIB_PYUNO_FOLDER=program
3024     LIBO_SHARE_FOLDER=share
3025     LIBO_SHARE_HELP_FOLDER=help
3026     LIBO_SHARE_JAVA_FOLDER=program/classes
3027     LIBO_SHARE_PRESETS_FOLDER=presets
3028     LIBO_SHARE_READMES_FOLDER=readmes
3029     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3030     LIBO_SHARE_SHELL_FOLDER=program/shell
3031     LIBO_URE_BIN_FOLDER=program
3032     LIBO_URE_ETC_FOLDER=program
3033     LIBO_URE_LIB_FOLDER=program
3034     LIBO_URE_MISC_FOLDER=program
3035     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3036 else
3037     LIBO_BIN_FOLDER=program
3038     LIBO_ETC_FOLDER=program
3039     LIBO_LIBEXEC_FOLDER=program
3040     LIBO_LIB_FOLDER=program
3041     LIBO_LIB_PYUNO_FOLDER=program
3042     LIBO_SHARE_FOLDER=share
3043     LIBO_SHARE_HELP_FOLDER=help
3044     LIBO_SHARE_JAVA_FOLDER=program/classes
3045     LIBO_SHARE_PRESETS_FOLDER=presets
3046     LIBO_SHARE_READMES_FOLDER=readmes
3047     if test "$enable_fuzzers" != yes; then
3048         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3049     else
3050         LIBO_SHARE_RESOURCE_FOLDER=resource
3051     fi
3052     LIBO_SHARE_SHELL_FOLDER=program/shell
3053     LIBO_URE_BIN_FOLDER=program
3054     LIBO_URE_ETC_FOLDER=program
3055     LIBO_URE_LIB_FOLDER=program
3056     LIBO_URE_MISC_FOLDER=program
3057     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3059 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3060 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3061 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3062 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3063 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3064 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3065 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3066 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3067 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3068 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3069 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3070 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3071 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3072 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3073 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3074 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3076 # Not all of them needed in config_host.mk, add more if need arises
3077 AC_SUBST(LIBO_BIN_FOLDER)
3078 AC_SUBST(LIBO_ETC_FOLDER)
3079 AC_SUBST(LIBO_LIB_FOLDER)
3080 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3081 AC_SUBST(LIBO_SHARE_FOLDER)
3082 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3083 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3084 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3085 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3086 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3087 AC_SUBST(LIBO_URE_BIN_FOLDER)
3088 AC_SUBST(LIBO_URE_ETC_FOLDER)
3089 AC_SUBST(LIBO_URE_LIB_FOLDER)
3090 AC_SUBST(LIBO_URE_MISC_FOLDER)
3091 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3093 dnl ===================================================================
3094 dnl Windows specific tests and stuff
3095 dnl ===================================================================
3097 reg_get_value()
3099     # Return value: $regvalue
3100     unset regvalue
3102     local _regentry="/proc/registry${1}/${2}"
3103     if test -f "$_regentry"; then
3104         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3105         # Registry keys read via /proc/registry* are always \0 terminated!
3106         local _regvalue=$(tr -d '\0' < "$_regentry")
3107         if test $? -eq 0; then
3108             regvalue=$_regvalue
3109         fi
3110     fi
3113 # Get a value from the 32-bit side of the Registry
3114 reg_get_value_32()
3116     reg_get_value "32" "$1"
3119 # Get a value from the 64-bit side of the Registry
3120 reg_get_value_64()
3122     reg_get_value "64" "$1"
3125 if test "$_os" = "WINNT"; then
3126     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3127     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3128         AC_MSG_RESULT([no])
3129         WINDOWS_SDK_ARCH="x86"
3130     else
3131         AC_MSG_RESULT([yes])
3132         WINDOWS_SDK_ARCH="x64"
3133         BITNESS_OVERRIDE=64
3134     fi
3136 if test "$_os" = "iOS"; then
3137     cross_compiling="yes"
3140 if test "$cross_compiling" = "yes"; then
3141     export CROSS_COMPILING=TRUE
3142 else
3143     CROSS_COMPILING=
3144     BUILD_TYPE="$BUILD_TYPE NATIVE"
3146 AC_SUBST(CROSS_COMPILING)
3148 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3149 if test "$GCC" = "yes"; then
3150     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3151     bsymbolic_functions_ldflags_save=$LDFLAGS
3152     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
3153     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3154 #include <stdio.h>
3155         ],[
3156 printf ("hello world\n");
3157         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3158     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3159         AC_MSG_RESULT( found )
3160     else
3161         AC_MSG_RESULT( not found )
3162     fi
3163     LDFLAGS=$bsymbolic_functions_ldflags_save
3165 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3167 # Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
3168 # NOTE: must _not_ be used for bundled external libraries!
3169 ISYSTEM=
3170 if test "$GCC" = "yes"; then
3171     AC_MSG_CHECKING( for -isystem )
3172     save_CFLAGS=$CFLAGS
3173     CFLAGS="$CFLAGS -Werror"
3174     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3175     CFLAGS=$save_CFLAGS
3176     if test -n "$ISYSTEM"; then
3177         AC_MSG_RESULT(yes)
3178     else
3179         AC_MSG_RESULT(no)
3180     fi
3182 if test -z "$ISYSTEM"; then
3183     # fall back to using -I
3184     ISYSTEM=-I
3186 AC_SUBST(ISYSTEM)
3188 dnl ===================================================================
3189 dnl  Check which Visual Studio compiler is used
3190 dnl ===================================================================
3192 map_vs_year_to_version()
3194     # Return value: $vsversion
3196     unset vsversion
3198     case $1 in
3199     2015)
3200         vsversion=14.0;;
3201     2017)
3202         vsversion=15.0;;
3203     *)
3204         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3205     esac
3208 vs_versions_to_check()
3210     # Args: $1 (optional) : versions to check, in the order of preference
3211     # Return value: $vsversions
3213     unset vsversions
3215     if test -n "$1"; then
3216         map_vs_year_to_version "$1"
3217         vsversions=$vsversion
3218     else
3219         # By default we prefer 2015/2017, in this order
3220         vsversions="14.0 15.0"
3221     fi
3224 win_get_env_from_vsvars32bat()
3226     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3227     if test $vcnum = "150"; then
3228       # Also seems to be located in another directory under the same name: vsvars32.bat
3229       # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3230       printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3231     else
3232       printf '@call "%s/../Common7/Tools/vsvars32.bat"\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3233     fi
3234     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3235     chmod +x $WRAPPERBATCHFILEPATH
3236     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3237     rm -f $WRAPPERBATCHFILEPATH
3238     printf '%s' "$_win_get_env_from_vsvars32bat"
3241 find_ucrt()
3243     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3244     if test -n "$regvalue"; then
3245         PathFormat "$regvalue"
3246         UCRTSDKDIR=$formatted_path
3247         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3248         UCRTVERSION=$regvalue
3249         # Rest if not exist
3250         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3251           UCRTSDKDIR=
3252         fi
3253     fi
3254     if test -z "$UCRTSDKDIR"; then
3255         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3256         if test "$vcnum" = "150"; then
3257           ide_env_file="${ide_env_dir}VsDevCmd.bat"
3258         else
3259           ide_env_file="${ide_env_dir}/vsvars32.bat"
3260         fi
3261         if test -f "$ide_env_file"; then
3262             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3263             UCRTSDKDIR=$formatted_path
3264             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3265             dnl Hack needed at least by tml:
3266             if test "$UCRTVERSION" = 10.0.15063.0 \
3267                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3268                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3269             then
3270                 UCRTVERSION=10.0.14393.0
3271             fi
3272         else
3273           AC_MSG_ERROR([No UCRT found])
3274         fi
3275     fi
3278 find_msvc()
3280     # Find Visual C++ 2015/2017
3281     # Args: $1 (optional) : The VS version year
3282     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3284     unset vctest vcnum vcnumwithdot vcbuildnumber
3286     vs_versions_to_check "$1"
3288     for ver in $vsversions; do
3289         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3290         if test -n "$regvalue"; then
3291             vctest=$regvalue
3292             break
3293         fi
3294         # As always MSVC 15.0 is special here
3295         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3296         if test -n "$regvalue"; then
3297             AC_MSG_RESULT([found: $regvalue])
3298             PathFormat "$regvalue"
3299             vctest=$formatted_path
3300             break
3301         fi
3302     done
3303     if test -n "$vctest"; then
3304         vcnumwithdot=$ver
3305         case "$vcnumwithdot" in
3306         14.0)
3307             vcyear=2015
3308             vcnum=140
3309             ;;
3310         15.0)
3311             vcyear=2017
3312             vcnum=150
3313             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3314             ;;
3315         esac
3316     fi
3319 SOLARINC=
3320 MSBUILD_PATH=
3321 DEVENV=
3322 if test "$_os" = "WINNT"; then
3323     AC_MSG_CHECKING([Visual C++])
3325     find_msvc "$with_visual_studio"
3326     if test -z "$vctest"; then
3327         if test -n "$with_visual_studio"; then
3328             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3329         else
3330             AC_MSG_ERROR([No Visual Studio 2015/2017 installation found])
3331         fi
3332     fi
3334     if test "$BITNESS_OVERRIDE" = ""; then
3335         if test -f "$vctest/bin/cl.exe"; then
3336             VC_PRODUCT_DIR=$vctest
3337         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3338             VC_PRODUCT_DIR=$vctest/VC
3339         else
3340             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3341         fi
3342     else
3343         if test -f "$vctest/bin/amd64/cl.exe"; then
3344             VC_PRODUCT_DIR=$vctest
3345         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3346             VC_PRODUCT_DIR=$vctest/VC
3347         else
3348             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe or $vctest/bin/amd64/cl.exe or $vctest/bin/x86_amd64/cl.exe])
3349         fi
3350     fi
3352     AC_MSG_CHECKING([for short pathname of VC product directory])
3353     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3354     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3356     UCRTSDKDIR=
3357     UCRTVERSION=
3359     AC_MSG_CHECKING([for UCRT location])
3360     find_ucrt
3361     # find_ucrt errors out if it doesn't find it
3362     AC_MSG_RESULT([found])
3363     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3364     ucrtincpath_formatted=$formatted_path
3365     # SOLARINC is used for external modules and must be set too.
3366     # And no, it's not sufficient to set SOLARINC only, as configure
3367     # itself doesn't honour it.
3368     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3369     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3370     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3371     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3373     AC_SUBST(UCRTSDKDIR)
3374     AC_SUBST(UCRTVERSION)
3376     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3377     # Find the proper version of MSBuild.exe to use based on the VS version
3378     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3379     if test -n "$regvalue" ; then
3380         AC_MSG_RESULT([found: $regvalue])
3381         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3382     else
3383         if test $vcnum = "150"; then
3384             if test "$BITNESS_OVERRIDE" = ""; then
3385                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3386             else
3387                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3388             fi
3389             MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3390         else
3391             AC_MSG_ERROR([No msbuild found, Visual Studio installation broken?])
3392         fi
3393         AC_MSG_RESULT([$regvalue])
3394     fi
3396     # Find the version of devenv.exe
3397     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3398     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3399     if test ! -e "$DEVENV"; then
3400         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3401     fi
3403     dnl ===========================================================
3404     dnl  Check for the corresponding mspdb*.dll
3405     dnl ===========================================================
3407     MSPDB_PATH=
3408     CL_DIR=
3409     CL_LIB=
3411     if test "$BITNESS_OVERRIDE" = ""; then
3412         if test "$vcnum" = "150"; then
3413             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3414             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3415         else
3416             MSPDB_PATH="$VC_PRODUCT_DIR/../Common7/IDE"
3417             CL_DIR=bin
3418         fi
3419     else
3420         if test "$vcnum" = "150"; then
3421             MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3422             CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3423         else
3424             MSPDB_PATH="$VC_PRODUCT_DIR/bin/amd64"
3425             CL_DIR=bin/amd64
3426         fi
3427     fi
3429     # MSVC 15.0 has libraries from 14.0?
3430     if test  "$vcnum" = "150"; then
3431         mspdbnum="140"
3432     else
3433         mspdbnum=$vcnum
3434     fi
3436     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3437         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3438     fi
3440     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3441     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3443     dnl The path needs to be added before cl is called
3444     PATH="$MSPDB_PATH:$PATH"
3446     AC_MSG_CHECKING([cl.exe])
3448     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3449     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3450     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3451     # is not enough?
3453     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3454     dnl needed when building CLR code:
3455     if test -z "$MSVC_CXX"; then
3456         if test "$BITNESS_OVERRIDE" = ""; then
3457             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3458                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3459             fi
3460         else
3461             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3462                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3463             fi
3464         fi
3466         # This gives us a posix path with 8.3 filename restrictions
3467         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3468     fi
3470     if test -z "$CC"; then
3471         CC=$MSVC_CXX
3472     fi
3473     if test "$BITNESS_OVERRIDE" = ""; then
3474         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3475         MSVC_CXX="$MSVC_CXX -arch:SSE"
3476     fi
3478     if test -n "$CC"; then
3479         # Remove /cl.exe from CC case insensitive
3480         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3481         if test "$BITNESS_OVERRIDE" = ""; then
3482            if test "$vcnum" = "150"; then
3483                COMPATH="$VC_PRODUCT_DIR"
3484            else
3485                COMPATH=`echo "$CC" | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'`
3486            fi
3487         else
3488             if test -n "$VC_PRODUCT_DIR"; then
3489                 COMPATH=$VC_PRODUCT_DIR
3490             fi
3491         fi
3492         if test "$BITNESS_OVERRIDE" = ""; then
3493             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3494             CC="$CC -arch:SSE"
3495         fi
3497         if test "$vcnum" = "150"; then
3498             COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3499         fi
3501         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3503         PathFormat "$COMPATH"
3504         COMPATH="$formatted_path"
3506         VCVER=$vcnum
3507         MSVSVER=$vcyear
3509         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3510         # are always "better", we list them in reverse chronological order.
3512         case $vcnum in
3513         140)
3514             COMEX=19
3515             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3516             ;;
3517         150)
3518             COMEX=19
3519             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3520             ;;
3521         esac
3523         # The expectation is that --with-windows-sdk should not need to be used
3524         if test -n "$with_windows_sdk"; then
3525             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3526             *" "$with_windows_sdk" "*)
3527                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3528                 ;;
3529             *)
3530                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3531                 ;;
3532             esac
3533         fi
3535         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3536         ac_objext=obj
3537         ac_exeext=exe
3539     else
3540         AC_MSG_ERROR([Visual C++ not found after all, huh])
3541     fi
3543     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3544     # version of the Explorer extension (and maybe other small
3545     # bits, too) needed when installing a 32-bit LibreOffice on a
3546     # 64-bit OS. The 64-bit Explorer extension is a feature that
3547     # has been present since long in OOo. Don't confuse it with
3548     # building LibreOffice itself as 64-bit code.
3550     BUILD_X64=
3551     CXX_X64_BINARY=
3552     LINK_X64_BINARY=
3554     if test "$BITNESS_OVERRIDE" = ""; then
3555         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3556         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3557             # Prefer native x64 compiler to cross-compiler, in case we are running
3558             # the build on a 64-bit OS.
3559             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3560                 BUILD_X64=TRUE
3561                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3562                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3563             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3564                 BUILD_X64=TRUE
3565                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3566                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3567             fi
3568         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3569             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3570             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3571                 BUILD_X64=TRUE
3572                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3573                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3574             fi
3575         fi
3576         if test "$BUILD_X64" = TRUE; then
3577             AC_MSG_RESULT([found])
3578         else
3579             AC_MSG_RESULT([not found])
3580             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3581         fi
3582     fi
3583     AC_SUBST(BUILD_X64)
3585     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3586     AC_SUBST(CXX_X64_BINARY)
3587     AC_SUBST(LINK_X64_BINARY)
3589 AC_SUBST(VCVER)
3590 AC_SUBST(DEVENV)
3591 PathFormat "$MSPDB_PATH"
3592 MSPDB_PATH="$formatted_path"
3593 AC_SUBST(MSVC_CXX)
3596 # unowinreg.dll
3598 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3599 AC_SUBST(UNOWINREG_DLL)
3601 COM_IS_CLANG=
3602 AC_MSG_CHECKING([whether the compiler is actually Clang])
3603 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3604     #ifndef __clang__
3605     you lose
3606     #endif
3607     int foo=42;
3608     ]])],
3609     [AC_MSG_RESULT([yes])
3610      COM_IS_CLANG=TRUE],
3611     [AC_MSG_RESULT([no])])
3613 CC_PLAIN=$CC
3614 if test "$COM_IS_CLANG" = TRUE; then
3615     AC_MSG_CHECKING([the Clang version])
3616     if test "$_os" = WINNT; then
3617         dnl In which case, assume clang-cl:
3618         my_args="/EP /TC"
3619         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3620         dnl clang-cl:
3621         CC_PLAIN=
3622         for i in $CC; do
3623             case $i in
3624             -FIIntrin.h)
3625                 ;;
3626             *)
3627                 CC_PLAIN="$CC_PLAIN $i"
3628                 ;;
3629             esac
3630         done
3631     else
3632         my_args="-E -P"
3633     fi
3634     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3635     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3636     CLANGVER=`echo $clang_version \
3637         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3638     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3639     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3640     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3642 AC_SUBST(COM_IS_CLANG)
3643 AC_SUBST(CLANGVER)
3645 SHOWINCLUDES_PREFIX=
3646 if test "$_os" = WINNT; then
3647     dnl We need to guess the prefix of the -showIncludes output, it can be
3648     dnl localized
3649     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3650     echo "#include <stdlib.h>" > conftest.c
3651     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3652         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3653     rm -f conftest.c conftest.obj
3654     if test -z "$SHOWINCLUDES_PREFIX"; then
3655         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3656     else
3657         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3658     fi
3660 AC_SUBST(SHOWINCLUDES_PREFIX)
3663 # prefix C with ccache if needed
3665 if test "$CCACHE" != ""; then
3666     AC_MSG_CHECKING([whether $CC is already ccached])
3668     AC_LANG_PUSH([C])
3669     save_CFLAGS=$CFLAGS
3670     CFLAGS="$CFLAGS --ccache-skip -O2"
3671     dnl an empty program will do, we're checking the compiler flags
3672     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3673                       [use_ccache=yes], [use_ccache=no])
3674     if test $use_ccache = yes; then
3675         AC_MSG_RESULT([yes])
3676     else
3677         CC="$CCACHE $CC"
3678         AC_MSG_RESULT([no])
3679     fi
3680     CFLAGS=$save_CFLAGS
3681     AC_LANG_POP([C])
3684 # ===================================================================
3685 # check various GCC options that Clang does not support now but maybe
3686 # will somewhen in the future, check them even for GCC, so that the
3687 # flags are set
3688 # ===================================================================
3690 HAVE_GCC_GGDB2=
3691 HAVE_GCC_FINLINE_LIMIT=
3692 HAVE_GCC_FNO_INLINE=
3693 if test "$GCC" = "yes"; then
3694     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3695     save_CFLAGS=$CFLAGS
3696     CFLAGS="$CFLAGS -Werror -ggdb2"
3697     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3698     CFLAGS=$save_CFLAGS
3699     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3700         AC_MSG_RESULT([yes])
3701     else
3702         AC_MSG_RESULT([no])
3703     fi
3705     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3706     save_CFLAGS=$CFLAGS
3707     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3708     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3709     CFLAGS=$save_CFLAGS
3710     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3711         AC_MSG_RESULT([yes])
3712     else
3713         AC_MSG_RESULT([no])
3714     fi
3716     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3717     save_CFLAGS=$CFLAGS
3718     CFLAGS="$CFLAGS -Werror -fno-inline"
3719     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3720     CFLAGS=$save_CFLAGS
3721     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3722         AC_MSG_RESULT([yes])
3723     else
3724         AC_MSG_RESULT([no])
3725     fi
3727     if test "$host_cpu" = "m68k"; then
3728         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3729         save_CFLAGS=$CFLAGS
3730         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3731         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3732         CFLAGS=$save_CFLAGS
3733         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3734             AC_MSG_RESULT([yes])
3735         else
3736             AC_MSG_ERROR([no])
3737         fi
3738     fi
3740 AC_SUBST(HAVE_GCC_GGDB2)
3741 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3742 AC_SUBST(HAVE_GCC_FNO_INLINE)
3744 dnl ===================================================================
3745 dnl  Test the gcc version
3746 dnl ===================================================================
3747 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3748     AC_MSG_CHECKING([the GCC version])
3749     _gcc_version=`$CC -dumpversion`
3750     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3751         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3752     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3754     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3756     if test "$gcc_full_version" -lt 40801; then
3757         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3758     fi
3759 else
3760     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3761     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3762     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3763     # (which reports itself as GCC 4.2.1).
3764     GCC_VERSION=
3766 AC_SUBST(GCC_VERSION)
3768 dnl Set the ENABLE_DBGUTIL variable
3769 dnl ===================================================================
3770 AC_MSG_CHECKING([whether to build with additional debug utilities])
3771 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3772     ENABLE_DBGUTIL="TRUE"
3773     # this is an extra var so it can have different default on different MSVC
3774     # versions (in case there are version specific problems with it)
3775     MSVC_USE_DEBUG_RUNTIME="TRUE"
3777     AC_MSG_RESULT([yes])
3778     # cppunit and graphite expose STL in public headers
3779     if test "$with_system_cppunit" = "yes"; then
3780         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3781     else
3782         with_system_cppunit=no
3783     fi
3784     if test "$with_system_graphite" = "yes"; then
3785         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3786     else
3787         with_system_graphite=no
3788     fi
3789     if test "$with_system_mysql_cppconn" = "yes"; then
3790         AC_MSG_ERROR([--with-system-mysql-cppconn conflicts with --enable-dbgutil])
3791     else
3792         with_system_mysql_cppconn=no
3793     fi
3794     if test "$with_system_orcus" = "yes"; then
3795         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3796     else
3797         with_system_orcus=no
3798     fi
3799     if test "$with_system_libcmis" = "yes"; then
3800         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3801     else
3802         with_system_libcmis=no
3803     fi
3804     if test "$with_system_hunspell" = "yes"; then
3805         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3806     else
3807         with_system_hunspell=no
3808     fi
3809     if test "$with_system_gpgmepp" = "yes"; then
3810         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3811     else
3812         with_system_gpgmepp=no
3813     fi
3814 else
3815     ENABLE_DBGUTIL=""
3816     MSVC_USE_DEBUG_RUNTIME=""
3817     AC_MSG_RESULT([no])
3819 AC_SUBST(ENABLE_DBGUTIL)
3820 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3822 dnl Set the ENABLE_DEBUG variable.
3823 dnl ===================================================================
3824 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3825     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3827 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3828     if test -z "$libo_fuzzed_enable_debug"; then
3829         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3830     else
3831         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3832         enable_debug=yes
3833     fi
3836 AC_MSG_CHECKING([whether to do a debug build])
3837 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3838     ENABLE_DEBUG="TRUE"
3839     if test -n "$ENABLE_DBGUTIL" ; then
3840         AC_MSG_RESULT([yes (dbgutil)])
3841     else
3842         AC_MSG_RESULT([yes])
3843     fi
3844 else
3845     ENABLE_DEBUG=""
3846     AC_MSG_RESULT([no])
3848 AC_SUBST(ENABLE_DEBUG)
3850 if test "$enable_sal_log" = yes; then
3851     ENABLE_SAL_LOG=TRUE
3853 AC_SUBST(ENABLE_SAL_LOG)
3855 dnl Selective debuginfo
3856 ENABLE_DEBUGINFO_FOR=
3857 if test -n "$ENABLE_DEBUG"; then
3858     AC_MSG_CHECKING([whether to use selective debuginfo])
3859     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3860         if test "$enable_selective_debuginfo" = "yes"; then
3861             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3862         fi
3863         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3864         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3865     else
3866         ENABLE_DEBUGINFO_FOR=all
3867         AC_MSG_RESULT([no, for all])
3868     fi
3869 else
3870     if test -n "$enable_selective_debuginfo"; then
3871         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3872     fi
3874 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3876 dnl Check for enable symbols option
3877 dnl ===================================================================
3878 AC_MSG_CHECKING([whether to generate debug information])
3879 if test -z "$enable_symbols"; then
3880     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3881         enable_symbols=yes
3882     else
3883         enable_symbols=no
3884     fi
3886 if test "$enable_symbols" != no; then
3887     ENABLE_SYMBOLS=TRUE
3888     AC_MSG_RESULT([yes])
3889 else
3890     ENABLE_SYMBOLS=
3891     AC_MSG_RESULT([no])
3893 AC_SUBST(ENABLE_SYMBOLS)
3895 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3896     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3897     AC_MSG_CHECKING([whether enough memory is available for linking])
3898     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3899     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3900     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3901         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3902     else
3903         AC_MSG_RESULT([yes])
3904     fi
3907 AC_MSG_CHECKING([whether to compile with optimization flags])
3908 if test -z "$enable_optimized"; then
3909     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3910         enable_optimized=no
3911     else
3912         enable_optimized=yes
3913     fi
3915 if test "$enable_optimized" != no; then
3916     ENABLE_OPTIMIZED=TRUE
3917     AC_MSG_RESULT([yes])
3918 else
3919     ENABLE_OPTIMIZED=
3920     AC_MSG_RESULT([no])
3922 AC_SUBST(ENABLE_OPTIMIZED)
3925 # determine CPUNAME, OS, ...
3926 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3928 case "$host_os" in
3930 aix*)
3931     COM=GCC
3932     CPUNAME=POWERPC
3933     USING_X11=TRUE
3934     OS=AIX
3935     RTL_OS=AIX
3936     RTL_ARCH=PowerPC
3937     PLATFORMID=aix_powerpc
3938     P_SEP=:
3939     ;;
3941 cygwin*)
3942     COM=MSC
3943     USING_X11=
3944     OS=WNT
3945     RTL_OS=Windows
3946     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3947         P_SEP=";"
3948     else
3949         P_SEP=:
3950     fi
3951     case "$host_cpu" in
3952     i*86|x86_64)
3953         if test "$BITNESS_OVERRIDE" = 64; then
3954             CPUNAME=X86_64
3955             RTL_ARCH=X86_64
3956             PLATFORMID=windows_x86_64
3957             WINDOWS_X64=1
3958             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3959         else
3960             CPUNAME=INTEL
3961             RTL_ARCH=x86
3962             PLATFORMID=windows_x86
3963         fi
3964         ;;
3965     *)
3966         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3967         ;;
3968     esac
3969     SCPDEFS="$SCPDEFS -D_MSC_VER"
3970     ;;
3972 darwin*)
3973     COM=GCC
3974     USING_X11=
3975     OS=MACOSX
3976     RTL_OS=MacOSX
3977     P_SEP=:
3979     case "$host_cpu" in
3980     arm)
3981         AC_MSG_ERROR([Can't build 32-bit code for iOS])
3982         ;;
3983     arm64)
3984         OS=IOS
3985         if test "$enable_ios_simulator" = "yes"; then
3986             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
3987         else
3988             CPUNAME=ARM64
3989             RTL_ARCH=ARM_EABI
3990             PLATFORMID=ios_arm64
3991         fi
3992         ;;
3993     i*86)
3994         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
3995         ;;
3996     x86_64)
3997         if test "$enable_ios_simulator" = "yes"; then
3998             OS=IOS
3999         fi
4000         CPUNAME=X86_64
4001         RTL_ARCH=X86_64
4002         PLATFORMID=macosx_x86_64
4003         ;;
4004     *)
4005         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4006         ;;
4007     esac
4008     ;;
4010 dragonfly*)
4011     COM=GCC
4012     USING_X11=TRUE
4013     OS=DRAGONFLY
4014     RTL_OS=DragonFly
4015     P_SEP=:
4017     case "$host_cpu" in
4018     i*86)
4019         CPUNAME=INTEL
4020         RTL_ARCH=x86
4021         PLATFORMID=dragonfly_x86
4022         ;;
4023     x86_64)
4024         CPUNAME=X86_64
4025         RTL_ARCH=X86_64
4026         PLATFORMID=dragonfly_x86_64
4027         ;;
4028     *)
4029         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4030         ;;
4031     esac
4032     ;;
4034 freebsd*)
4035     COM=GCC
4036     USING_X11=TRUE
4037     RTL_OS=FreeBSD
4038     OS=FREEBSD
4039     P_SEP=:
4041     case "$host_cpu" in
4042     i*86)
4043         CPUNAME=INTEL
4044         RTL_ARCH=x86
4045         PLATFORMID=freebsd_x86
4046         ;;
4047     x86_64|amd64)
4048         CPUNAME=X86_64
4049         RTL_ARCH=X86_64
4050         PLATFORMID=freebsd_x86_64
4051         ;;
4052     *)
4053         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4054         ;;
4055     esac
4056     ;;
4058 haiku*)
4059     COM=GCC
4060     USING_X11=
4061     GUIBASE=haiku
4062     RTL_OS=Haiku
4063     OS=HAIKU
4064     P_SEP=:
4066     case "$host_cpu" in
4067     i*86)
4068         CPUNAME=INTEL
4069         RTL_ARCH=x86
4070         PLATFORMID=haiku_x86
4071         ;;
4072     x86_64|amd64)
4073         CPUNAME=X86_64
4074         RTL_ARCH=X86_64
4075         PLATFORMID=haiku_x86_64
4076         ;;
4077     *)
4078         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4079         ;;
4080     esac
4081     ;;
4083 kfreebsd*)
4084     COM=GCC
4085     USING_X11=TRUE
4086     OS=LINUX
4087     RTL_OS=kFreeBSD
4088     P_SEP=:
4090     case "$host_cpu" in
4092     i*86)
4093         CPUNAME=INTEL
4094         RTL_ARCH=x86
4095         PLATFORMID=kfreebsd_x86
4096         ;;
4097     x86_64)
4098         CPUNAME=X86_64
4099         RTL_ARCH=X86_64
4100         PLATFORMID=kfreebsd_x86_64
4101         ;;
4102     *)
4103         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4104         ;;
4105     esac
4106     ;;
4108 linux-gnu*)
4109     COM=GCC
4110     USING_X11=TRUE
4111     OS=LINUX
4112     RTL_OS=Linux
4113     P_SEP=:
4115     case "$host_cpu" in
4117     aarch64)
4118         CPUNAME=AARCH64
4119         PLATFORMID=linux_aarch64
4120         RTL_ARCH=AARCH64
4121         ;;
4122     alpha)
4123         CPUNAME=AXP
4124         RTL_ARCH=ALPHA
4125         PLATFORMID=linux_alpha
4126         ;;
4127     arm*)
4128         CPUNAME=ARM
4129         EPM_FLAGS="-a arm"
4130         RTL_ARCH=ARM_EABI
4131         PLATFORMID=linux_arm_eabi
4132         case "$host_cpu" in
4133         arm*-linux)
4134             RTL_ARCH=ARM_OABI
4135             PLATFORMID=linux_arm_oabi
4136             ;;
4137         esac
4138         ;;
4139     hppa)
4140         CPUNAME=HPPA
4141         RTL_ARCH=HPPA
4142         EPM_FLAGS="-a hppa"
4143         PLATFORMID=linux_hppa
4144         ;;
4145     i*86)
4146         CPUNAME=INTEL
4147         RTL_ARCH=x86
4148         PLATFORMID=linux_x86
4149         ;;
4150     ia64)
4151         CPUNAME=IA64
4152         RTL_ARCH=IA64
4153         PLATFORMID=linux_ia64
4154         ;;
4155     mips)
4156         CPUNAME=GODSON
4157         RTL_ARCH=MIPS_EB
4158         EPM_FLAGS="-a mips"
4159         PLATFORMID=linux_mips_eb
4160         ;;
4161     mips64)
4162         CPUNAME=GODSON64
4163         RTL_ARCH=MIPS64_EB
4164         EPM_FLAGS="-a mips64"
4165         PLATFORMID=linux_mips64_eb
4166         ;;
4167     mips64el)
4168         CPUNAME=GODSON64
4169         RTL_ARCH=MIPS64_EL
4170         EPM_FLAGS="-a mips64el"
4171         PLATFORMID=linux_mips64_el
4172         ;;
4173     mipsel)
4174         CPUNAME=GODSON
4175         RTL_ARCH=MIPS_EL
4176         EPM_FLAGS="-a mipsel"
4177         PLATFORMID=linux_mips_el
4178         ;;
4179     m68k)
4180         CPUNAME=M68K
4181         RTL_ARCH=M68K
4182         PLATFORMID=linux_m68k
4183         ;;
4184     powerpc)
4185         CPUNAME=POWERPC
4186         RTL_ARCH=PowerPC
4187         PLATFORMID=linux_powerpc
4188         ;;
4189     powerpc64)
4190         CPUNAME=POWERPC64
4191         RTL_ARCH=PowerPC_64
4192         PLATFORMID=linux_powerpc64
4193         ;;
4194     powerpc64le)
4195         CPUNAME=POWERPC64
4196         RTL_ARCH=PowerPC_64_LE
4197         PLATFORMID=linux_powerpc64_le
4198         ;;
4199     sparc)
4200         CPUNAME=SPARC
4201         RTL_ARCH=SPARC
4202         PLATFORMID=linux_sparc
4203         ;;
4204     sparc64)
4205         CPUNAME=SPARC64
4206         RTL_ARCH=SPARC64
4207         PLATFORMID=linux_sparc64
4208         ;;
4209     s390)
4210         CPUNAME=S390
4211         RTL_ARCH=S390
4212         PLATFORMID=linux_s390
4213         ;;
4214     s390x)
4215         CPUNAME=S390X
4216         RTL_ARCH=S390x
4217         PLATFORMID=linux_s390x
4218         ;;
4219     x86_64)
4220         CPUNAME=X86_64
4221         RTL_ARCH=X86_64
4222         PLATFORMID=linux_x86_64
4223         ;;
4224     *)
4225         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4226         ;;
4227     esac
4228     ;;
4230 linux-android*)
4231     COM=GCC
4232     USING_X11=
4233     OS=ANDROID
4234     RTL_OS=Android
4235     P_SEP=:
4237     case "$host_cpu" in
4239     arm|armel)
4240         CPUNAME=ARM
4241         RTL_ARCH=ARM_EABI
4242         PLATFORMID=android_arm_eabi
4243         ;;
4244     aarch64)
4245         CPUNAME=AARCH64
4246         RTL_ARCH=AARCH64
4247         PLATFORMID=android_aarch64
4248         ;;
4249     mips|mipsel)
4250         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4251         RTL_ARCH=MIPS_EL
4252         PLATFORMID=android_mips_el
4253         ;;
4254     i*86)
4255         CPUNAME=INTEL
4256         RTL_ARCH=x86
4257         PLATFORMID=android_x86
4258         ;;
4259     *)
4260         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4261         ;;
4262     esac
4263     ;;
4265 *netbsd*)
4266     COM=GCC
4267     USING_X11=TRUE
4268     OS=NETBSD
4269     RTL_OS=NetBSD
4270     P_SEP=:
4272     case "$host_cpu" in
4273     i*86)
4274         CPUNAME=INTEL
4275         RTL_ARCH=x86
4276         PLATFORMID=netbsd_x86
4277         ;;
4278     powerpc)
4279         CPUNAME=POWERPC
4280         RTL_ARCH=PowerPC
4281         PLATFORMID=netbsd_powerpc
4282         ;;
4283     sparc)
4284         CPUNAME=SPARC
4285         RTL_ARCH=SPARC
4286         PLATFORMID=netbsd_sparc
4287         ;;
4288     x86_64)
4289         CPUNAME=X86_64
4290         RTL_ARCH=X86_64
4291         PLATFORMID=netbsd_x86_64
4292         ;;
4293     *)
4294         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4295         ;;
4296     esac
4297     ;;
4299 openbsd*)
4300     COM=GCC
4301     USING_X11=TRUE
4302     OS=OPENBSD
4303     RTL_OS=OpenBSD
4304     P_SEP=:
4306     case "$host_cpu" in
4307     i*86)
4308         CPUNAME=INTEL
4309         RTL_ARCH=x86
4310         PLATFORMID=openbsd_x86
4311         ;;
4312     x86_64)
4313         CPUNAME=X86_64
4314         RTL_ARCH=X86_64
4315         PLATFORMID=openbsd_x86_64
4316         ;;
4317     *)
4318         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4319         ;;
4320     esac
4321     SOLARINC="$SOLARINC -I/usr/local/include"
4322     ;;
4324 solaris*)
4325     COM=GCC
4326     USING_X11=TRUE
4327     OS=SOLARIS
4328     RTL_OS=Solaris
4329     P_SEP=:
4331     case "$host_cpu" in
4332     i*86)
4333         CPUNAME=INTEL
4334         RTL_ARCH=x86
4335         PLATFORMID=solaris_x86
4336         ;;
4337     sparc)
4338         CPUNAME=SPARC
4339         RTL_ARCH=SPARC
4340         PLATFORMID=solaris_sparc
4341         ;;
4342     sparc64)
4343         CPUNAME=SPARC64
4344         RTL_ARCH=SPARC64
4345         PLATFORMID=solaris_sparc64
4346         ;;
4347     *)
4348         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4349         ;;
4350     esac
4351     SOLARINC="$SOLARINC -I/usr/local/include"
4352     ;;
4355     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4356     ;;
4357 esac
4359 if test "$with_x" = "no"; then
4360     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4363 ENABLE_HEADLESS=""
4364 if test "$enable_gui" = "no"; then
4365     if test "$USING_X11" != TRUE; then
4366         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4367     fi
4368     USING_X11=
4369     ENABLE_HEADLESS=TRUE
4370     AC_DEFINE(HAVE_FEATURE_UI,0)
4371     test_cairo=yes
4373 AC_SUBST(ENABLE_HEADLESS)
4375 WORKDIR="${BUILDDIR}/workdir"
4376 INSTDIR="${BUILDDIR}/instdir"
4377 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4378 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4379 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4380 AC_SUBST(COM)
4381 AC_SUBST(CPUNAME)
4382 AC_SUBST(RTL_OS)
4383 AC_SUBST(RTL_ARCH)
4384 AC_SUBST(EPM_FLAGS)
4385 AC_SUBST(USING_X11)
4386 AC_SUBST([INSTDIR])
4387 AC_SUBST([INSTROOT])
4388 AC_SUBST([INSTROOTBASE])
4389 AC_SUBST(OS)
4390 AC_SUBST(P_SEP)
4391 AC_SUBST(WORKDIR)
4392 AC_SUBST(PLATFORMID)
4393 AC_SUBST(WINDOWS_X64)
4394 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4396 dnl ===================================================================
4397 dnl Test which package format to use
4398 dnl ===================================================================
4399 AC_MSG_CHECKING([which package format to use])
4400 if test -n "$with_package_format" -a "$with_package_format" != no; then
4401     for i in $with_package_format; do
4402         case "$i" in
4403         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4404             ;;
4405         *)
4406             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4407 aix - AIX software distribution
4408 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4409 deb - Debian software distribution
4410 pkg - Solaris software distribution
4411 rpm - RedHat software distribution
4413 LibreOffice additionally supports:
4414 archive - .tar.gz or .zip
4415 dmg - Mac OS X .dmg
4416 installed - installation tree
4417 msi - Windows .msi
4418         ])
4419             ;;
4420         esac
4421     done
4422     # fakeroot is needed to ensure correct file ownerships/permissions
4423     # inside deb packages and tar archives created on Linux and Solaris.
4424     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4425         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4426         if test "$FAKEROOT" = "no"; then
4427             AC_MSG_ERROR(
4428                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4429         fi
4430     fi
4431     PKGFORMAT="$with_package_format"
4432     AC_MSG_RESULT([$PKGFORMAT])
4433 else
4434     PKGFORMAT=
4435     AC_MSG_RESULT([none])
4437 AC_SUBST(PKGFORMAT)
4439 dnl ===================================================================
4440 dnl Set up a different compiler to produce tools to run on the build
4441 dnl machine when doing cross-compilation
4442 dnl ===================================================================
4444 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4445 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4446 if test "$cross_compiling" = "yes"; then
4447     AC_MSG_CHECKING([for BUILD platform configuration])
4448     echo
4449     rm -rf CONF-FOR-BUILD config_build.mk
4450     mkdir CONF-FOR-BUILD
4451     # Here must be listed all files needed when running the configure script. In particular, also
4452     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4453     # keep them in the same order as there.
4454     (cd $SRC_ROOT && tar cf - \
4455         config.guess \
4456         bin/get_config_variables \
4457         solenv/bin/getcompver.awk \
4458         solenv/inc/langlist.mk \
4459         download.lst \
4460         config_host.mk.in \
4461         config_host_lang.mk.in \
4462         Makefile.in \
4463         lo.xcent.in \
4464         bin/bffvalidator.sh.in \
4465         bin/odfvalidator.sh.in \
4466         bin/officeotron.sh.in \
4467         instsetoo_native/util/openoffice.lst.in \
4468         config_host/*.in \
4469         sysui/desktop/macosx/Info.plist.in) \
4470     | (cd CONF-FOR-BUILD && tar xf -)
4471     cp configure CONF-FOR-BUILD
4472     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4473     (
4474     unset COM USING_X11 OS CPUNAME
4475     unset CC CXX SYSBASE CFLAGS
4476     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4477     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4478     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4479     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4480     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4481     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4482     cd CONF-FOR-BUILD
4483     sub_conf_opts=""
4484     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4485     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4486     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4487     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4488     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4489     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4490     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4491     # Don't bother having configure look for stuff not needed for the build platform anyway
4492     ./configure \
4493         --disable-cups \
4494         --disable-gtk3 \
4495         --disable-pdfimport \
4496         --disable-postgresql-sdbc \
4497         --with-parallelism="$with_parallelism" \
4498         --without-doxygen \
4499         --without-java \
4500         $sub_conf_opts \
4501         --srcdir=$srcdir \
4502         2>&1 | sed -e 's/^/    /'
4503     test -f ./config_host.mk 2>/dev/null || exit
4504     cp config_host.mk ../config_build.mk
4505     cp config_host_lang.mk ../config_build_lang.mk
4506     mv config.log ../config.Build.log
4507     mkdir -p ../config_build
4508     mv config_host/*.h ../config_build
4509     . ./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
4511     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
4512         VV='$'$V
4513         VV=`eval "echo $VV"`
4514         if test -n "$VV"; then
4515             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4516             echo "$line" >>build-config
4517         fi
4518     done
4520     for V in INSTDIR INSTROOT WORKDIR; do
4521         VV='$'$V
4522         VV=`eval "echo $VV"`
4523         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4524         if test -n "$VV"; then
4525             line="${V}_FOR_BUILD='$VV'"
4526             echo "$line" >>build-config
4527         fi
4528     done
4530     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4531     echo "$line" >>build-config
4533     )
4534     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4535     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])
4536     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4537              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4539     eval `cat CONF-FOR-BUILD/build-config`
4541     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4543     rm -rf CONF-FOR-BUILD
4544 else
4545     OS_FOR_BUILD="$OS"
4546     CC_FOR_BUILD="$CC"
4547     CXX_FOR_BUILD="$CXX"
4548     INSTDIR_FOR_BUILD="$INSTDIR"
4549     INSTROOT_FOR_BUILD="$INSTROOT"
4550     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4551     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4552     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4553     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4554     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4555     WORKDIR_FOR_BUILD="$WORKDIR"
4557 AC_SUBST(OS_FOR_BUILD)
4558 AC_SUBST(INSTDIR_FOR_BUILD)
4559 AC_SUBST(INSTROOT_FOR_BUILD)
4560 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4561 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4562 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4563 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4564 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4565 AC_SUBST(WORKDIR_FOR_BUILD)
4567 dnl ===================================================================
4568 dnl Check for syslog header
4569 dnl ===================================================================
4570 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4572 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4573 dnl ===================================================================
4574 AC_MSG_CHECKING([whether to turn warnings to errors])
4575 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4576     ENABLE_WERROR="TRUE"
4577     AC_MSG_RESULT([yes])
4578 else
4579     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4580         ENABLE_WERROR="TRUE"
4581         AC_MSG_RESULT([yes])
4582     else
4583         AC_MSG_RESULT([no])
4584     fi
4586 AC_SUBST(ENABLE_WERROR)
4588 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4589 dnl ===================================================================
4590 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4591 if test -n "$enable_assert_always_abort" -a "$enable_assert_always_abort" = "yes"; then
4592     ASSERT_ALWAYS_ABORT="TRUE"
4593     AC_MSG_RESULT([yes])
4594 else
4595     ASSERT_ALWAYS_ABORT="FALSE"
4596     AC_MSG_RESULT([no])
4598 AC_SUBST(ASSERT_ALWAYS_ABORT)
4600 # Determine whether to use ooenv for the instdir installation
4601 # ===================================================================
4602 if test $_os != "WINNT" -a $_os != "Darwin"; then
4603     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4604     if test "$enable_ooenv" = "no"; then
4605         AC_MSG_RESULT([no])
4606     else
4607         ENABLE_OOENV="TRUE"
4608         AC_MSG_RESULT([yes])
4609     fi
4611 AC_SUBST(ENABLE_OOENV)
4613 if test "$USING_X11" != TRUE; then
4614     # be sure to do not mess with unneeded stuff
4615     test_randr=no
4616     test_xrender=no
4617     test_cups=no
4618     test_dbus=no
4619     test_gtk=no
4620     build_gstreamer_1_0=no
4621     build_gstreamer_0_10=no
4622     test_kde4=no
4623     test_kde5=no
4624     test_qt5=no
4625     test_gtk3_kde5=no
4626     enable_cairo_canvas=no
4629 if test "$OS" = "HAIKU"; then
4630     enable_cairo_canvas=yes
4633 dnl ===================================================================
4634 dnl check for cups support
4635 dnl ===================================================================
4636 ENABLE_CUPS=""
4638 if test "$enable_cups" = "no"; then
4639     test_cups=no
4642 AC_MSG_CHECKING([whether to enable CUPS support])
4643 if test "$test_cups" = "yes"; then
4644     ENABLE_CUPS="TRUE"
4645     AC_MSG_RESULT([yes])
4647     AC_MSG_CHECKING([whether cups support is present])
4648     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4649     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4650     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4651         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4652     fi
4654 else
4655     AC_MSG_RESULT([no])
4658 AC_SUBST(ENABLE_CUPS)
4660 # fontconfig checks
4661 if test "$test_fontconfig" = "yes"; then
4662     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4663     SYSTEM_FONTCONFIG=TRUE
4664     FilterLibs "${FONTCONFIG_LIBS}"
4665     FONTCONFIG_LIBS="${filteredlibs}"
4667 AC_SUBST(FONTCONFIG_CFLAGS)
4668 AC_SUBST(FONTCONFIG_LIBS)
4669 AC_SUBST([SYSTEM_FONTCONFIG])
4671 dnl whether to find & fetch external tarballs?
4672 dnl ===================================================================
4673 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4674    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4675        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4676    else
4677        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4678    fi
4680 if test -z "$TARFILE_LOCATION"; then
4681     if test -d "$SRC_ROOT/src" ; then
4682         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4683         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4684     fi
4685     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4686 else
4687     AbsolutePath "$TARFILE_LOCATION"
4688     PathFormat "${absolute_path}"
4689     TARFILE_LOCATION="${formatted_path}"
4691 AC_SUBST(TARFILE_LOCATION)
4693 AC_MSG_CHECKING([whether we want to fetch tarballs])
4694 if test "$enable_fetch_external" != "no"; then
4695     if test "$with_all_tarballs" = "yes"; then
4696         AC_MSG_RESULT([yes, all of them])
4697         DO_FETCH_TARBALLS="ALL"
4698     else
4699         AC_MSG_RESULT([yes, if we use them])
4700         DO_FETCH_TARBALLS="TRUE"
4701     fi
4702 else
4703     AC_MSG_RESULT([no])
4704     DO_FETCH_TARBALLS=
4706 AC_SUBST(DO_FETCH_TARBALLS)
4708 AC_MSG_CHECKING([whether to build help])
4709 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4710     BUILD_TYPE="$BUILD_TYPE HELP"
4711     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4712     case "$with_help" in
4713     "common")
4714         AC_MSG_RESULT([common only])
4715         ;;
4716     "html")
4717         ENABLE_HTMLHELP=TRUE
4718         AC_MSG_RESULT([HTML])
4719         ;;
4720     "online")
4721         ENABLE_HTMLHELP=TRUE
4722         HELP_ONLINE=TRUE
4723         AC_MSG_RESULT([HTML])
4724         ;;
4725     *)
4726         SCPDEFS="$SCPDEFS -DWITH_HELP"
4727         AC_MSG_RESULT([yes])
4728         ;;
4729     esac
4730 else
4731     AC_MSG_RESULT([no])
4733 AC_SUBST([ENABLE_HTMLHELP])
4734 AC_SUBST([HELP_ONLINE])
4736 dnl Test whether to include MySpell dictionaries
4737 dnl ===================================================================
4738 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4739 if test "$with_myspell_dicts" = "yes"; then
4740     AC_MSG_RESULT([yes])
4741     WITH_MYSPELL_DICTS=TRUE
4742     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4743     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4744 else
4745     AC_MSG_RESULT([no])
4746     WITH_MYSPELL_DICTS=
4748 AC_SUBST(WITH_MYSPELL_DICTS)
4750 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4751 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4752     if test "$with_system_dicts" = yes; then
4753         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4754     fi
4755     with_system_dicts=no
4758 AC_MSG_CHECKING([whether to use dicts from external paths])
4759 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4760     AC_MSG_RESULT([yes])
4761     SYSTEM_DICTS=TRUE
4762     AC_MSG_CHECKING([for spelling dictionary directory])
4763     if test -n "$with_external_dict_dir"; then
4764         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4765     else
4766         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4767         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4768             DICT_SYSTEM_DIR=file:///usr/share/myspell
4769         fi
4770     fi
4771     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4772     AC_MSG_CHECKING([for hyphenation patterns directory])
4773     if test -n "$with_external_hyph_dir"; then
4774         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4775     else
4776         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4777     fi
4778     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4779     AC_MSG_CHECKING([for thesaurus directory])
4780     if test -n "$with_external_thes_dir"; then
4781         THES_SYSTEM_DIR=file://$with_external_thes_dir
4782     else
4783         THES_SYSTEM_DIR=file:///usr/share/mythes
4784     fi
4785     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4786 else
4787     AC_MSG_RESULT([no])
4788     SYSTEM_DICTS=
4790 AC_SUBST(SYSTEM_DICTS)
4791 AC_SUBST(DICT_SYSTEM_DIR)
4792 AC_SUBST(HYPH_SYSTEM_DIR)
4793 AC_SUBST(THES_SYSTEM_DIR)
4795 dnl ===================================================================
4796 dnl enable pch by default on windows
4797 dnl enable it explicitly otherwise
4798 ENABLE_PCH=""
4799 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4800     if test -z "$libo_fuzzed_enable_pch"; then
4801         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4802     else
4803         AC_MSG_NOTICE([Resetting --enable-pch=no])
4804         enable_pch=no
4805     fi
4808 AC_MSG_CHECKING([whether to enable pch feature])
4809 if test "$enable_pch" != "no"; then
4810     if test "$_os" = "WINNT"; then
4811         ENABLE_PCH="TRUE"
4812         AC_MSG_RESULT([yes])
4813     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4814         ENABLE_PCH="TRUE"
4815         AC_MSG_RESULT([yes])
4816     elif test -n "$enable_pch"; then
4817         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4818     else
4819         AC_MSG_RESULT([no])
4820     fi
4821 else
4822     AC_MSG_RESULT([no])
4824 AC_SUBST(ENABLE_PCH)
4826 TAB=`printf '\t'`
4828 AC_MSG_CHECKING([the GNU Make version])
4829 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4830 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4831 if test "$_make_longver" -ge "038200"; then
4832     AC_MSG_RESULT([$GNUMAKE $_make_version])
4834 elif test "$_make_longver" -ge "038100"; then
4835     if test "$build_os" = "cygwin"; then
4836         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4837     fi
4838     AC_MSG_RESULT([$GNUMAKE $_make_version])
4840     dnl ===================================================================
4841     dnl Search all the common names for sha1sum
4842     dnl ===================================================================
4843     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4844     if test -z "$SHA1SUM"; then
4845         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4846     elif test "$SHA1SUM" = "openssl"; then
4847         SHA1SUM="openssl sha1"
4848     fi
4849     AC_MSG_CHECKING([for GNU Make bug 20033])
4850     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4851     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4852 A := \$(wildcard *.a)
4854 .PHONY: all
4855 all: \$(A:.a=.b)
4856 <TAB>@echo survived bug20033.
4858 .PHONY: setup
4859 setup:
4860 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4862 define d1
4863 @echo lala \$(1)
4864 @sleep 1
4865 endef
4867 define d2
4868 @echo tyty \$(1)
4869 @sleep 1
4870 endef
4872 %.b : %.a
4873 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4874 <TAB>\$(call d1,\$(CHECKSUM)),\
4875 <TAB>\$(call d2,\$(CHECKSUM)))
4877     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4878         no_parallelism_make="YES"
4879         AC_MSG_RESULT([yes, disable parallelism])
4880     else
4881         AC_MSG_RESULT([no, keep parallelism enabled])
4882     fi
4883     rm -rf $TESTGMAKEBUG20033
4884 else
4885     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4888 # find if gnumake support file function
4889 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4890 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4891 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4892     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4894 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4895 \$(file >test.txt,Success )
4897 .PHONY: all
4898 all:
4899 <TAB>@cat test.txt
4902 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4903 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4904     HAVE_GNUMAKE_FILE_FUNC=TRUE
4905     AC_MSG_RESULT([yes])
4906 else
4907     AC_MSG_RESULT([no])
4909 rm -rf $TESTGMAKEFILEFUNC
4910 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4911 AC_SUBST(GNUMAKE_WIN_NATIVE)
4913 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4914 STALE_MAKE=
4915 if test "$_make_ver_check" = ""; then
4916    STALE_MAKE=TRUE
4919 HAVE_LD_HASH_STYLE=FALSE
4920 WITH_LINKER_HASH_STYLE=
4921 AC_MSG_CHECKING([for --hash-style gcc linker support])
4922 if test "$GCC" = "yes"; then
4923     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4924         hash_styles="gnu sysv"
4925     elif test "$with_linker_hash_style" = "no"; then
4926         hash_styles=
4927     else
4928         hash_styles="$with_linker_hash_style"
4929     fi
4931     for hash_style in $hash_styles; do
4932         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4933         hash_style_ldflags_save=$LDFLAGS
4934         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4936         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4937             [
4938 #include <stdio.h>
4939             ],[
4940 printf ("");
4941             ])],
4942             [
4943                   HAVE_LD_HASH_STYLE=TRUE
4944                   WITH_LINKER_HASH_STYLE=$hash_style
4945             ],
4946             [HAVE_LD_HASH_STYLE=FALSE],
4947             [HAVE_LD_HASH_STYLE=FALSE])
4948         LDFLAGS=$hash_style_ldflags_save
4949     done
4951     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
4952         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
4953     else
4954         AC_MSG_RESULT( no )
4955     fi
4956     LDFLAGS=$hash_style_ldflags_save
4957 else
4958     AC_MSG_RESULT( no )
4960 AC_SUBST(HAVE_LD_HASH_STYLE)
4961 AC_SUBST(WITH_LINKER_HASH_STYLE)
4963 dnl ===================================================================
4964 dnl Check whether there's a Perl version available.
4965 dnl ===================================================================
4966 if test -z "$with_perl_home"; then
4967     AC_PATH_PROG(PERL, perl)
4968 else
4969     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
4970     _perl_path="$with_perl_home/bin/perl"
4971     if test -x "$_perl_path"; then
4972         PERL=$_perl_path
4973     else
4974         AC_MSG_ERROR([$_perl_path not found])
4975     fi
4978 dnl ===================================================================
4979 dnl Testing for Perl version 5 or greater.
4980 dnl $] is the Perl version variable, it is returned as an integer
4981 dnl ===================================================================
4982 if test "$PERL"; then
4983     AC_MSG_CHECKING([the Perl version])
4984     ${PERL} -e "exit($]);"
4985     _perl_version=$?
4986     if test "$_perl_version" -lt 5; then
4987         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
4988     fi
4989     AC_MSG_RESULT([Perl $_perl_version])
4990 else
4991     AC_MSG_ERROR([Perl not found, install Perl 5])
4994 dnl ===================================================================
4995 dnl Testing for required Perl modules
4996 dnl ===================================================================
4998 AC_MSG_CHECKING([for required Perl modules])
4999 perl_use_string="use Cwd ; use Digest::MD5"
5000 if test "$_os" = "WINNT"; then
5001     if test -n "$PKGFORMAT"; then
5002         for i in $PKGFORMAT; do
5003             case "$i" in
5004             msi)
5005                 # for getting fonts versions to use in MSI
5006                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5007                 ;;
5008             esac
5009         done
5010     fi
5012 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5013     AC_MSG_RESULT([all modules found])
5014 else
5015     AC_MSG_RESULT([failed to find some modules])
5016     # Find out which modules are missing.
5017     for i in $perl_use_string; do
5018         if test "$i" != "use" -a "$i" != ";"; then
5019             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5020                 missing_perl_modules="$missing_perl_modules $i"
5021             fi
5022         fi
5023     done
5024     AC_MSG_ERROR([
5025     The missing Perl modules are: $missing_perl_modules
5026     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5029 dnl ===================================================================
5030 dnl Check for pkg-config
5031 dnl ===================================================================
5032 if test "$_os" != "WINNT"; then
5033     PKG_PROG_PKG_CONFIG
5036 if test "$_os" != "WINNT"; then
5038     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5039     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5040     # explicitly. Or put /path/to/compiler in PATH yourself.
5042     # Use wrappers for LTO
5043     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5044         AC_CHECK_TOOL(AR,gcc-ar)
5045         AC_CHECK_TOOL(NM,gcc-nm)
5046         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5047     else
5048         AC_CHECK_TOOL(AR,ar)
5049         AC_CHECK_TOOL(NM,nm)
5050         AC_CHECK_TOOL(RANLIB,ranlib)
5051     fi
5052     AC_CHECK_TOOL(OBJDUMP,objdump)
5053     AC_CHECK_TOOL(READELF,readelf)
5054     AC_CHECK_TOOL(STRIP,strip)
5055     if test "$_os" = "WINNT"; then
5056         AC_CHECK_TOOL(DLLTOOL,dlltool)
5057         AC_CHECK_TOOL(WINDRES,windres)
5058     fi
5060 AC_SUBST(AR)
5061 AC_SUBST(DLLTOOL)
5062 AC_SUBST(NM)
5063 AC_SUBST(OBJDUMP)
5064 AC_SUBST(PKG_CONFIG)
5065 AC_SUBST(RANLIB)
5066 AC_SUBST(READELF)
5067 AC_SUBST(STRIP)
5068 AC_SUBST(WINDRES)
5070 dnl ===================================================================
5071 dnl pkg-config checks on Mac OS X
5072 dnl ===================================================================
5074 if test $_os = Darwin; then
5075     AC_MSG_CHECKING([for bogus pkg-config])
5076     if test -n "$PKG_CONFIG"; then
5077         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5078             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5079         else
5080             if test "$enable_bogus_pkg_config" = "yes"; then
5081                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5082             else
5083                 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.])
5084             fi
5085         fi
5086     else
5087         AC_MSG_RESULT([no, good])
5088     fi
5091 find_csc()
5093     # Return value: $csctest
5095     unset csctest
5097     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5098     if test -n "$regvalue"; then
5099         csctest=$regvalue
5100         return
5101     fi
5104 find_al()
5106     # Return value: $altest
5108     unset altest
5110     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5111         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5112         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5113             altest=$regvalue
5114             return
5115         fi
5116     done
5118     # We need this additional check to detect 4.6.1 or above.
5119     for ver in 4.7.1 4.7 4.6.2 4.6.1; do
5120         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5121         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5122             altest=$regvalue
5123             return
5124         fi
5126         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5127         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5128             altest=$regvalue
5129             return
5130         fi
5131     done
5134 find_dotnetsdk()
5136     # Return value: $frametest (that's a silly name...)
5138     unset frametest
5140     for ver in 1.1 2.0; do
5141         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
5142         if test -n "$regvalue"; then
5143             frametest=$regvalue
5144             return
5145         fi
5146     done
5149 find_dotnetsdk46()
5151     unset frametest
5153     for ver in 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5154         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5155         if test -n "$regvalue"; then
5156             frametest=$regvalue
5157             return
5158         fi
5159         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5160         if test -n "$regvalue"; then
5161             frametest=$regvalue
5162             return
5163         fi
5164     done
5167 find_winsdk_version()
5169     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5170     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5172     unset winsdktest winsdkbinsubdir winsdklibsubdir
5174     case "$1" in
5175     7.*)
5176         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5177         if test -n "$regvalue"; then
5178             winsdktest=$regvalue
5179             winsdklibsubdir=.
5180             return
5181         fi
5182         ;;
5183     8.0|8.0A)
5184         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5185         if test -n "$regvalue"; then
5186             winsdktest=$regvalue
5187             winsdklibsubdir=win8
5188             return
5189         fi
5190         ;;
5191     8.1|8.1A)
5192         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5193         if test -n "$regvalue"; then
5194             winsdktest=$regvalue
5195             winsdklibsubdir=winv6.3
5196             return
5197         fi
5198         ;;
5199     10.0)
5200         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5201         if test -n "$regvalue"; then
5202             winsdktest=$regvalue
5203             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5204             if test -n "$regvalue"; then
5205                 winsdkbinsubdir="$regvalue".0
5206             fi
5207             winsdklibsubdir=$regvalue
5208             if test "$regvalue" = "10.0.14393"; then
5209                 winsdklibsubdir="10.0.14393.0"
5210             elif test "$regvalue" = "10.0.16299"; then
5211                 winsdklibsubdir="10.0.16299.0"
5212             elif test "$regvalue" = "10.0.15063"; then
5213                 winsdklibsubdir="10.0.15063.0"
5214                 dnl Hack needed at least by tml:
5215                 if test ! -f "${winsdktest}/Include/10.0.15063.0/um/sqlext.h" \
5216                     -a -f "${winsdktest}/Include/10.0.14393.0/um/sqlext.h"
5217                 then
5218                     winsdklibsubdir="10.0.14393.0"
5219                 fi
5220             fi
5221             return
5222         fi
5223         ;;
5224     esac
5227 find_winsdk()
5229     # Return value: From find_winsdk_version
5231     unset winsdktest
5233     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5234         find_winsdk_version $ver
5235         if test -n "$winsdktest"; then
5236             return
5237         fi
5238     done
5241 find_msms()
5243     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5244     if test $VCVER = 150; then
5245         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5246     fi
5247     AC_MSG_CHECKING([for ${my_msm_files}])
5248     msmdir=
5249     for ver in 14.0 15.0; do
5250         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5251         if test -n "$regvalue"; then
5252             for f in ${my_msm_files}; do
5253                 if test -e "$regvalue/${f}"; then
5254                     msmdir=$regvalue
5255                     break
5256                 fi
5257             done
5258         fi
5259     done
5260     dnl Is the following fallback really necessary, or was it added in response
5261     dnl to never having started Visual Studio on a given machine, so the
5262     dnl registry keys checked above had presumably not yet been created?
5263     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5264     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5265     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5266     dnl expanding to "C:\Program Files\Common Files"), which would need
5267     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5268     dnl obtain its value from cygwin:
5269     if test -z "$msmdir"; then
5270         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5271         for f in ${my_msm_files}; do
5272             if test -e "$my_msm_dir/${f}"; then
5273                 msmdir=$my_msm_dir
5274             fi
5275         done
5276     fi
5278     dnl Starting from MSVC 15.0, merge modules are located in different directory
5279     if test $VCVER = 150; then
5280         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5281             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5282             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5283             for f in ${my_msm_files}; do
5284                 if test -e "$my_msm_dir/${f}"; then
5285                     msmdir=$my_msm_dir
5286                     break
5287                 fi
5288             done
5289         done
5290     fi
5292     if test -n "$msmdir"; then
5293         msmdir=`cygpath -m "$msmdir"`
5294         AC_MSG_RESULT([$msmdir])
5295     else
5296         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5297             AC_MSG_ERROR([not found])
5298         else
5299             AC_MSG_WARN([not found])
5300             add_warning "MSM none of ${my_msm_files} found"
5301         fi
5302     fi
5305 find_msvc_x64_dlls()
5307     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5308     if test "$VCVER" = 150; then
5309         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5310             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5311             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5312                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5313                 break
5314             fi
5315             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5316                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5317                 break
5318             fi
5319         done
5320     fi
5321     msvcdlls="msvcp140.dll vcruntime140.dll"
5322     for dll in $msvcdlls; do
5323         if ! test -f "$msvcdllpath/$dll"; then
5324             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5325         fi
5326     done
5329 dnl =========================================
5330 dnl Check for the Windows  SDK.
5331 dnl =========================================
5332 if test "$_os" = "WINNT"; then
5333     AC_MSG_CHECKING([for Windows SDK])
5334     if test "$build_os" = "cygwin"; then
5335         find_winsdk
5336         WINDOWS_SDK_HOME=$winsdktest
5338         # normalize if found
5339         if test -n "$WINDOWS_SDK_HOME"; then
5340             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5341             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5342         fi
5344         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5345     fi
5347     if test -n "$WINDOWS_SDK_HOME"; then
5348         # Remove a possible trailing backslash
5349         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5351         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5352              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5353              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5354             have_windows_sdk_headers=yes
5355         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5356              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5357              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5358             have_windows_sdk_headers=yes
5359         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5360              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5361              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5362             have_windows_sdk_headers=yes
5363         else
5364             have_windows_sdk_headers=no
5365         fi
5367         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5368             have_windows_sdk_libs=yes
5369         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5370             have_windows_sdk_libs=yes
5371         else
5372             have_windows_sdk_libs=no
5373         fi
5375         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5376             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5377 the  Windows SDK are installed.])
5378         fi
5379     fi
5381     if test -z "$WINDOWS_SDK_HOME"; then
5382         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5383     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5384         WINDOWS_SDK_VERSION=70
5385         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5386     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5387         WINDOWS_SDK_VERSION=80
5388         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5389     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5390         WINDOWS_SDK_VERSION=81
5391         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5392     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5393         WINDOWS_SDK_VERSION=10
5394         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5395     else
5396         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5397     fi
5398     PathFormat "$WINDOWS_SDK_HOME"
5399     WINDOWS_SDK_HOME="$formatted_path"
5400     if test "$build_os" = "cygwin"; then
5401         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5402         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5403             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5404         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5405             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5406         fi
5407     fi
5409     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5410     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5411     dnl but not in v8.0), so allow this to be overridden with a
5412     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5413     dnl and configuration error if no WiLangId.vbs is found would arguably be
5414     dnl better, but I do not know under which conditions exactly it is needed by
5415     dnl msiglobal.pm:
5416     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5417         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5418         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5419             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5420         fi
5421         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5422             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5423         fi
5424         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5425             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5426         fi
5427     fi
5428     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5429         if test -n "$with_package_format" -a "$with_package_format" != no; then
5430             for i in "$with_package_format"; do
5431                 if test "$i" = "msi"; then
5432                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5433                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5434                     fi
5435                 fi
5436             done
5437         fi
5438     fi
5440 AC_SUBST(WINDOWS_SDK_HOME)
5441 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5442 AC_SUBST(WINDOWS_SDK_VERSION)
5443 AC_SUBST(WINDOWS_SDK_WILANGID)
5445 if test "$build_os" = "cygwin"; then
5446     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5447     dnl dir, it also determines that dir's path w/o an arch segment if any,
5448     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5449     AC_MSG_CHECKING([for midl.exe])
5451     find_winsdk
5452     if test -n "$winsdkbinsubdir" \
5453         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5454     then
5455         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5456         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5457     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5458         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5459         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5460     elif test -f "$winsdktest/Bin/midl.exe"; then
5461         MIDL_PATH=$winsdktest/Bin
5462         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5463     fi
5464     if test ! -f "$MIDL_PATH/midl.exe"; then
5465         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5466     else
5467         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5468     fi
5470     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5471     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5473     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5474          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5475          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5476          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5477     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5478          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5479          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5480          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5481     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5482          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5483          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5484          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5485     else
5486         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5487     fi
5489     dnl Check csc.exe
5490     AC_MSG_CHECKING([for csc.exe])
5491     find_csc
5492     if test -f "$csctest/csc.exe"; then
5493         CSC_PATH="$csctest"
5494     fi
5495     if test ! -f "$CSC_PATH/csc.exe"; then
5496         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5497     else
5498         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5499     fi
5501     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5503     dnl Check al.exe
5504     AC_MSG_CHECKING([for al.exe])
5505     find_winsdk
5506     if test -n "$winsdkbinsubdir" \
5507         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5508     then
5509         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5510     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5511         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5512     elif test -f "$winsdktest/Bin/al.exe"; then
5513         AL_PATH="$winsdktest/Bin"
5514     fi
5516     if test -z "$AL_PATH"; then
5517         find_al
5518         if test -f "$altest/bin/al.exe"; then
5519             AL_PATH="$altest/bin"
5520         elif test -f "$altest/al.exe"; then
5521             AL_PATH="$altest"
5522         fi
5523     fi
5524     if test ! -f "$AL_PATH/al.exe"; then
5525         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5526     else
5527         AC_MSG_RESULT([$AL_PATH/al.exe])
5528     fi
5530     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5532     dnl Check mscoree.lib / .NET Framework dir
5533     AC_MSG_CHECKING(.NET Framework)
5534     find_dotnetsdk
5535     if test -f "$frametest/lib/mscoree.lib"; then
5536         DOTNET_FRAMEWORK_HOME="$frametest"
5537     else
5538         find_winsdk
5539         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5540             DOTNET_FRAMEWORK_HOME="$winsdktest"
5541         else
5542             find_dotnetsdk46
5543             PathFormat "$frametest"
5544             frametest="$formatted_path"
5545             if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5546                  DOTNET_FRAMEWORK_HOME="$frametest"
5547             fi
5548         fi
5549     fi
5551     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
5552         AC_MSG_ERROR([mscoree.lib not found])
5553     fi
5554     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5556     PathFormat "$MIDL_PATH"
5557     MIDL_PATH="$formatted_path"
5559     PathFormat "$AL_PATH"
5560     AL_PATH="$formatted_path"
5562     PathFormat "$DOTNET_FRAMEWORK_HOME"
5563     DOTNET_FRAMEWORK_HOME="$formatted_path"
5565     PathFormat "$CSC_PATH"
5566     CSC_PATH="$formatted_path"
5569 dnl ===================================================================
5570 dnl Check if stdc headers are available excluding MSVC.
5571 dnl ===================================================================
5572 if test "$_os" != "WINNT"; then
5573     AC_HEADER_STDC
5576 dnl ===================================================================
5577 dnl Testing for C++ compiler and version...
5578 dnl ===================================================================
5580 if test "$_os" != "WINNT"; then
5581     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5582     save_CXXFLAGS=$CXXFLAGS
5583     AC_PROG_CXX
5584     CXXFLAGS=$save_CXXFLAGS
5585 else
5586     if test -n "$CC" -a -z "$CXX"; then
5587         CXX="$CC"
5588     fi
5591 dnl At least MSVC 2015 Update 1 is known to sporadically emit warning C4592
5592 dnl ("implementation limitation" when defining OUStringLiteral variables in
5593 dnl vcl/source/app/IconThemeInfo.cxx), while Update 3 is known good, and it is
5594 dnl probably a good idea to require that anyway.  A reliable way to check for
5595 dnl MSVC 2015 Update 3 appears to be to check for support of C++17 nested
5596 dnl namespace definitions (which requires /std:c++latest to be enabled):
5597 if test "$COM" = MSC -a "$VCVER" = 140; then
5598     AC_MSG_CHECKING([whether MSVC 2015 compiler $MSVC_CXX is at least Update 3])
5599     save_CXX=$CXX
5600     save_CXXFLAGS=$CXXFLAGS
5601     CXX=$MSVC_CXX
5602     CXXFLAGS="$CXXFLAGS /std:c++latest"
5603     AC_LANG_PUSH([C++])
5604     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5605         namespace A::B {}
5606     ]])], [good=yes], [good=no])
5607     AC_LANG_POP([C++])
5608     CXX=$save_CXX
5609     CXXFLAGS=$save_CXXFLAGS
5610     AC_MSG_RESULT([$good])
5611     if test "$good" = no; then
5612         AC_MSG_ERROR([When using MSVC 2015, at least Update 3 must be installed])
5613     fi
5616 dnl check for GNU C++ compiler version
5617 if test "$GXX" = "yes"; then
5618     AC_MSG_CHECKING([the GNU C++ compiler version])
5620     _gpp_version=`$CXX -dumpversion`
5621     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5623     if test "$_gpp_majmin" -lt "401"; then
5624         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5625     else
5626         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5627     fi
5629     dnl see https://code.google.com/p/android/issues/detail?id=41770
5630     if test "$_gpp_majmin" -ge "401"; then
5631         glibcxx_threads=no
5632         AC_LANG_PUSH([C++])
5633         AC_REQUIRE_CPP
5634         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5635         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5636             #include <bits/c++config.h>]],[[
5637             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5638             && !defined(_GLIBCXX__PTHREADS) \
5639             && !defined(_GLIBCXX_HAS_GTHREADS)
5640             choke me
5641             #endif
5642         ]])],[AC_MSG_RESULT([yes])
5643         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5644         AC_LANG_POP([C++])
5645         if test $glibcxx_threads = yes; then
5646             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5647         fi
5648      fi
5650 AC_SUBST(BOOST_CXXFLAGS)
5653 # prefx CXX with ccache if needed
5655 if test "$CCACHE" != ""; then
5656     AC_MSG_CHECKING([whether $CXX is already ccached])
5657     AC_LANG_PUSH([C++])
5658     save_CXXFLAGS=$CXXFLAGS
5659     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5660     dnl an empty program will do, we're checking the compiler flags
5661     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5662                       [use_ccache=yes], [use_ccache=no])
5663     if test $use_ccache = yes; then
5664         AC_MSG_RESULT([yes])
5665     else
5666         CXX="$CCACHE $CXX"
5667         AC_MSG_RESULT([no])
5668     fi
5669     CXXFLAGS=$save_CXXFLAGS
5670     AC_LANG_POP([C++])
5673 dnl ===================================================================
5674 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5675 dnl ===================================================================
5677 if test "$_os" != "WINNT"; then
5678     AC_PROG_CXXCPP
5680     dnl Check whether there's a C pre-processor.
5681     AC_PROG_CPP
5685 dnl ===================================================================
5686 dnl Find integral type sizes and alignments
5687 dnl ===================================================================
5689 if test "$_os" != "WINNT"; then
5691 if test "$_os" == "iOS"; then
5692     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5693     ac_cv_sizeof_long=8
5694     ac_cv_sizeof_short=2
5695     ac_cv_sizeof_int=4
5696     ac_cv_sizeof_long_long=8
5697     ac_cv_sizeof_double=8
5698     ac_cv_sizeof_voidp=8
5699 else
5700     AC_CHECK_SIZEOF(long)
5701     AC_CHECK_SIZEOF(short)
5702     AC_CHECK_SIZEOF(int)
5703     AC_CHECK_SIZEOF(long long)
5704     AC_CHECK_SIZEOF(double)
5705     AC_CHECK_SIZEOF(void*)
5708     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5709     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5710     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5711     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5712     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5714     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5715     m4_pattern_allow([AC_CHECK_ALIGNOF])
5716     m4_ifdef([AC_CHECK_ALIGNOF],
5717         [
5718             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5719             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5720             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5721             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5722         ],
5723         [
5724             case "$_os-$host_cpu" in
5725             Linux-i686)
5726                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5727                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5728                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5729                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5730                 ;;
5731             Linux-x86_64)
5732                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5733                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5734                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5735                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5736                 ;;
5737             *)
5738                 if test -z "$ac_cv_alignof_short" -o \
5739                         -z "$ac_cv_alignof_int" -o \
5740                         -z "$ac_cv_alignof_long" -o \
5741                         -z "$ac_cv_alignof_double"; then
5742                    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.])
5743                 fi
5744                 ;;
5745             esac
5746         ])
5748     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5749     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5750     if test $ac_cv_sizeof_long -eq 8; then
5751         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5752     elif test $ac_cv_sizeof_double -eq 8; then
5753         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5754     else
5755         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5756     fi
5758     dnl Check for large file support
5759     AC_SYS_LARGEFILE
5760     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5761         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5762     fi
5763     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5764         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5765     fi
5766 else
5767     # Hardcode for MSVC
5768     SAL_TYPES_SIZEOFSHORT=2
5769     SAL_TYPES_SIZEOFINT=4
5770     SAL_TYPES_SIZEOFLONG=4
5771     SAL_TYPES_SIZEOFLONGLONG=8
5772     if test "$BITNESS_OVERRIDE" = ""; then
5773         SAL_TYPES_SIZEOFPOINTER=4
5774     else
5775         SAL_TYPES_SIZEOFPOINTER=8
5776     fi
5777     SAL_TYPES_ALIGNMENT2=2
5778     SAL_TYPES_ALIGNMENT4=4
5779     SAL_TYPES_ALIGNMENT8=8
5780     LFS_CFLAGS=''
5782 AC_SUBST(LFS_CFLAGS)
5784 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5785 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5786 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5787 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5788 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5789 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5790 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5791 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5793 dnl ===================================================================
5794 dnl Check whether to enable runtime optimizations
5795 dnl ===================================================================
5796 ENABLE_RUNTIME_OPTIMIZATIONS=
5797 AC_MSG_CHECKING([whether to enable runtime optimizations])
5798 if test -z "$enable_runtime_optimizations"; then
5799     for i in $CC; do
5800         case $i in
5801         -fsanitize=*)
5802             enable_runtime_optimizations=no
5803             break
5804             ;;
5805         esac
5806     done
5808 if test "$enable_runtime_optimizations" != no; then
5809     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5810     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5811     AC_MSG_RESULT([yes])
5812 else
5813     AC_MSG_RESULT([no])
5815 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5817 dnl ===================================================================
5818 dnl Check if valgrind headers are available
5819 dnl ===================================================================
5820 ENABLE_VALGRIND=
5821 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5822     prev_cppflags=$CPPFLAGS
5823     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5824     # or where does it come from?
5825     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5826     AC_CHECK_HEADER([valgrind/valgrind.h],
5827         [ENABLE_VALGRIND=TRUE])
5828     CPPFLAGS=$prev_cppflags
5830 AC_SUBST([ENABLE_VALGRIND])
5831 if test -z "$ENABLE_VALGRIND"; then
5832     if test "$with_valgrind" = yes; then
5833         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5834     fi
5835     VALGRIND_CFLAGS=
5837 AC_SUBST([VALGRIND_CFLAGS])
5840 dnl ===================================================================
5841 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5842 dnl ===================================================================
5844 # We need at least the sys/sdt.h include header.
5845 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5846 if test "$SDT_H_FOUND" = "TRUE"; then
5847     # Found sys/sdt.h header, now make sure the c++ compiler works.
5848     # Old g++ versions had problems with probes in constructors/destructors.
5849     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5850     AC_LANG_PUSH([C++])
5851     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5852     #include <sys/sdt.h>
5853     class ProbeClass
5854     {
5855     private:
5856       int& ref;
5857       const char *name;
5859     public:
5860       ProbeClass(int& v, const char *n) : ref(v), name(n)
5861       {
5862         DTRACE_PROBE2(_test_, cons, name, ref);
5863       }
5865       void method(int min)
5866       {
5867         DTRACE_PROBE3(_test_, meth, name, ref, min);
5868         ref -= min;
5869       }
5871       ~ProbeClass()
5872       {
5873         DTRACE_PROBE2(_test_, dest, name, ref);
5874       }
5875     };
5876     ]],[[
5877     int i = 64;
5878     DTRACE_PROBE1(_test_, call, i);
5879     ProbeClass inst = ProbeClass(i, "call");
5880     inst.method(24);
5881     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5882           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5883     AC_LANG_POP([C++])
5885 AC_CONFIG_HEADERS([config_host/config_probes.h])
5887 dnl ===================================================================
5888 dnl GCC features
5889 dnl ===================================================================
5890 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5891     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5892     save_CFLAGS=$CFLAGS
5893     CFLAGS="$CFLAGS -Werror -mno-avx"
5894     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5895     CFLAGS=$save_CFLAGS
5896     if test "$HAVE_GCC_AVX" = "TRUE"; then
5897         AC_MSG_RESULT([yes])
5898     else
5899         AC_MSG_RESULT([no])
5900     fi
5902     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5903     save_CFLAGS=$CFLAGS
5904     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5905     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5906     CFLAGS=$save_CFLAGS
5907     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5908         AC_MSG_RESULT([yes])
5909     else
5910         AC_MSG_RESULT([no])
5911     fi
5913     AC_MSG_CHECKING([whether $CC supports atomic functions])
5914     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5915     int v = 0;
5916     if (__sync_add_and_fetch(&v, 1) != 1 ||
5917         __sync_sub_and_fetch(&v, 1) != 0)
5918         return 1;
5919     __sync_synchronize();
5920     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5921         v != 1)
5922         return 1;
5923     return 0;
5924 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5925     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5926         AC_MSG_RESULT([yes])
5927         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5928     else
5929         AC_MSG_RESULT([no])
5930     fi
5932     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5933     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5934     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5935         AC_MSG_RESULT([yes])
5936         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5937     else
5938         AC_MSG_RESULT([no])
5939     fi
5941     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5942     save_CFLAGS=$CFLAGS
5943     CFLAGS="$CFLAGS -Werror"
5944     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5945             __attribute__((deprecated("test"))) void f();
5946         ])], [
5947             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5948             AC_MSG_RESULT([yes])
5949         ], [AC_MSG_RESULT([no])])
5950     CFLAGS=$save_CFLAGS
5952     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5953     AC_LANG_PUSH([C++])
5954     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5955             #include <cstddef>
5956             #include <cxxabi.h>
5957             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5958         ])], [
5959             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5960             AC_MSG_RESULT([yes])
5961         ], [AC_MSG_RESULT([no])])
5962     AC_LANG_POP([C++])
5964     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5965     AC_LANG_PUSH([C++])
5966     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5967             #include <cstddef>
5968             #include <cxxabi.h>
5969             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5970         ])], [
5971             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5972             AC_MSG_RESULT([yes])
5973         ], [AC_MSG_RESULT([no])])
5974     AC_LANG_POP([C++])
5976     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5977     AC_LANG_PUSH([C++])
5978     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5979             #include <cxxabi.h>
5980             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5981         ])], [
5982             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5983             AC_MSG_RESULT([yes])
5984         ], [AC_MSG_RESULT([no])])
5985     AC_LANG_POP([C++])
5987     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
5988     AC_LANG_PUSH([C++])
5989     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5990             #include <cstddef>
5991             #include <cxxabi.h>
5992             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
5993         ])], [
5994             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
5995             AC_MSG_RESULT([yes])
5996         ], [AC_MSG_RESULT([no])])
5997     AC_LANG_POP([C++])
5999     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6000     AC_LANG_PUSH([C++])
6001     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6002             #include <cstddef>
6003             #include <cxxabi.h>
6004             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6005         ])], [
6006             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6007             AC_MSG_RESULT([yes])
6008         ], [AC_MSG_RESULT([no])])
6009     AC_LANG_POP([C++])
6011     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6012     AC_LANG_PUSH([C++])
6013     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6014             #include <cxxabi.h>
6015             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6016         ])], [
6017             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6018             AC_MSG_RESULT([yes])
6019         ], [AC_MSG_RESULT([no])])
6020     AC_LANG_POP([C++])
6022     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6023     AC_LANG_PUSH([C++])
6024     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6025             #include <cxxabi.h>
6026             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6027         ])], [
6028             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6029             AC_MSG_RESULT([yes])
6030         ], [AC_MSG_RESULT([no])])
6031     AC_LANG_POP([C++])
6033     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6034     AC_LANG_PUSH([C++])
6035     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6036             #include <cstddef>
6037             #include <cxxabi.h>
6038             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6039         ])], [
6040             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6041             AC_MSG_RESULT([yes])
6042         ], [AC_MSG_RESULT([no])])
6043     AC_LANG_POP([C++])
6045     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6046     AC_LANG_PUSH([C++])
6047     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6048             #include <cstddef>
6049             #include <cxxabi.h>
6050             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6051         ])], [
6052             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6053             AC_MSG_RESULT([yes])
6054         ], [AC_MSG_RESULT([no])])
6055     AC_LANG_POP([C++])
6057     dnl Available in GCC 4.9 and at least since Clang 3.4:
6058     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6059     AC_LANG_PUSH([C++])
6060     save_CXXFLAGS=$CXXFLAGS
6061     CXXFLAGS="$CXXFLAGS -Werror"
6062     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6063             struct __attribute__((warn_unused)) dummy {};
6064         ])], [
6065             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6066             AC_MSG_RESULT([yes])
6067         ], [AC_MSG_RESULT([no])])
6068     CXXFLAGS=$save_CXXFLAGS
6069 AC_LANG_POP([C++])
6072 AC_SUBST(HAVE_GCC_AVX)
6073 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6074 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6075 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6077 dnl ===================================================================
6078 dnl Identify the C++ library
6079 dnl ===================================================================
6081 AC_MSG_CHECKING([What the C++ library is])
6082 AC_LANG_PUSH([C++])
6083 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6084 #include <utility>
6085 #ifndef __GLIBCXX__
6086 foo bar
6087 #endif
6088 ]])],
6089     [CPP_LIBRARY=GLIBCXX
6090      cpp_library_name="GNU libstdc++"
6091     ],
6092     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6093 #include <utility>
6094 #ifndef _LIBCPP_VERSION
6095 foo bar
6096 #endif
6097 ]])],
6098     [CPP_LIBRARY=LIBCPP
6099      cpp_library_name="LLVM libc++"
6100      AC_DEFINE([HAVE_LIBCXX])
6101     ],
6102     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6103 #include <utility>
6104 #ifndef _MSC_VER
6105 foo bar
6106 #endif
6107 ]])],
6108     [CPP_LIBRARY=MSVCRT
6109      cpp_library_name="Microsoft"
6110     ],
6111     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6112 AC_MSG_RESULT([$cpp_library_name])
6113 AC_LANG_POP([C++])
6115 dnl ===================================================================
6116 dnl Check for gperf
6117 dnl ===================================================================
6118 AC_PATH_PROG(GPERF, gperf)
6119 if test -z "$GPERF"; then
6120     AC_MSG_ERROR([gperf not found but needed. Install it.])
6122 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6123     GPERF=`cygpath -m $GPERF`
6125 AC_MSG_CHECKING([gperf version])
6126 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6127     AC_MSG_RESULT([OK])
6128 else
6129     AC_MSG_ERROR([too old, you need at least 3.0.0])
6131 AC_SUBST(GPERF)
6133 dnl ===================================================================
6134 dnl Check for system libcmis
6135 dnl ===================================================================
6136 # libcmis requires curl and we can't build curl for iOS
6137 if test $_os != iOS; then
6138     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6139     ENABLE_LIBCMIS=TRUE
6140 else
6141     ENABLE_LIBCMIS=
6143 AC_SUBST(ENABLE_LIBCMIS)
6145 dnl ===================================================================
6146 dnl C++11
6147 dnl ===================================================================
6149 my_cxx17switches=
6150 libo_FUZZ_ARG_ENABLE(c++17,
6151     AS_HELP_STRING([--disable-c++17],
6152         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6155 CXXFLAGS_CXX11=
6156 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6157     AC_MSG_CHECKING([whether $CXX supports C++11])
6158     AC_MSG_RESULT(yes)
6159     # MSVC supports (a subset of) CXX11 without any switch
6160 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6161     HAVE_CXX11=
6162     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6163     dnl But only use C++17 if the gperf that is being used knows not to emit
6164     dnl "register" in C++ output:
6165     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6166     my_flags='-std=gnu++14 -std=gnu++1y -std=c++14 -std=c++1y -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x'
6167     if test "$enable_c__17" != no; then
6168         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6169     fi
6170     for flag in $my_flags; do
6171         if test "$COM" = MSC; then
6172             flag="-Xclang $flag"
6173         fi
6174         save_CXXFLAGS=$CXXFLAGS
6175         CXXFLAGS="$CXXFLAGS $flag -Werror"
6176         if test "$SYSTEM_LIBCMIS" = TRUE; then
6177             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6178         fi
6179         AC_LANG_PUSH([C++])
6180         dnl Clang 3.9 supports __float128 since
6181         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6182         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6183         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6184         dnl $flag is supported below, so check this first):
6185         my_float128hack=
6186         my_float128hack_impl=-D__float128=void
6187         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6188             #include <vector>
6189             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6190             // (__float128)
6191             ]])
6192         ],,[
6193             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6194             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6195             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6196             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6197             dnl place where __float128 is used is in a template specialization, -D__float128=void
6198             dnl will avoid the problem there while still causing a problem if somebody actually uses
6199             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6200             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6201             dnl "fixed" with this hack):
6202             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6203             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6204                 #include <vector>
6205                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6206                 // (__float128)
6207                 ]])
6208             ],[my_float128hack=$my_float128hack_impl])
6209         ])
6210         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6211             #include <algorithm>
6212             #include <functional>
6213             #include <vector>
6215             #include <string.h>
6216             #pragma GCC diagnostic push
6217             #pragma GCC diagnostic ignored "-Wpragmas"
6218                 // make GCC not warn about next pragma
6219             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6220                 // make Clang with -std < C++17 not even warn about register
6221             #include "conftest.inc"
6222             #pragma GCC diagnostic pop
6224             #if defined SYSTEM_LIBCMIS
6225             // See ucb/source/ucp/cmis/auth_provider.hxx:
6226             #if __GNUC__ >= 7
6227             #pragma GCC diagnostic push
6228             #pragma GCC diagnostic ignored "-Wdeprecated"
6229             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6230             #endif
6231             #include <libcmis/libcmis.hxx>
6232             #if __GNUC__ >= 7
6233             #pragma GCC diagnostic pop
6234             #endif
6235             #endif
6237             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6238                 std::sort(v.begin(), v.end(), fn);
6239             }
6240             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6241         AC_LANG_POP([C++])
6242         CXXFLAGS=$save_CXXFLAGS
6243         if test -n "$CXXFLAGS_CXX11"; then
6244             HAVE_CXX11=TRUE
6245             break
6246         fi
6247     done
6248     rm conftest.inc
6249     if test "$HAVE_CXX11" = TRUE; then
6250         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6251     else
6252         AC_MSG_ERROR(no)
6253     fi
6255 AC_SUBST(CXXFLAGS_CXX11)
6257 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6258 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6259 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6260 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6261 dnl again towards 4.7.2:
6262 if test $CPP_LIBRARY = GLIBCXX; then
6263     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6264     AC_LANG_PUSH([C++])
6265     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6266 #include <list>
6267 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6268     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6269     //   GCC 4.7.0: 20120322
6270     //   GCC 4.7.1: 20120614
6271     // and using a range check is not possible as the mapping between
6272     // __GLIBCXX__ values and GCC versions is not monotonic
6273 /* ok */
6274 #else
6275 abi broken
6276 #endif
6277         ]])], [AC_MSG_RESULT(no, ok)],
6278         [AC_MSG_ERROR(yes)])
6279     AC_LANG_POP([C++])
6282 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6283 save_CXXFLAGS=$CXXFLAGS
6284 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6285 AC_LANG_PUSH([C++])
6287 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6288 #include <stddef.h>
6290 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6292 namespace
6294         struct b
6295         {
6296                 int i;
6297                 int j;
6298         };
6300 ]], [[
6301 struct a
6303         int i;
6304         int j;
6306 a thinga[]={{0,0}, {1,1}};
6307 b thingb[]={{0,0}, {1,1}};
6308 size_t i = sizeof(sal_n_array_size(thinga));
6309 size_t j = sizeof(sal_n_array_size(thingb));
6310 return !(i != 0 && j != 0);
6312     ], [ AC_MSG_RESULT(yes) ],
6313     [ AC_MSG_ERROR(no)])
6314 AC_LANG_POP([C++])
6315 CXXFLAGS=$save_CXXFLAGS
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             assert(i >= 0);
6341             return i == 0;
6342         }
6343     };
6344     constexpr auto v2 = S{10}.f();
6345     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6346 AC_LANG_POP([C++])
6347 CXXFLAGS=$save_CXXFLAGS
6348 AC_MSG_RESULT([$cxx14_constexpr])
6349 if test "$cxx14_constexpr" = yes; then
6350     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6353 dnl _Pragma support (may require C++11)
6354 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6355     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6356     AC_LANG_PUSH([C++])
6357     save_CXXFLAGS=$CXXFLAGS
6358     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6359     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6360             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6361         ])], [
6362             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6363             AC_MSG_RESULT([yes])
6364         ], [AC_MSG_RESULT([no])])
6365     AC_LANG_POP([C++])
6366     CXXFLAGS=$save_CXXFLAGS
6369 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6370 if test "$GCC" = yes; then
6371     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6372     AC_LANG_PUSH([C++])
6373     save_CXXFLAGS=$CXXFLAGS
6374     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6375     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6376     CXXFLAGS=$save_CXXFLAGS
6377     AC_LANG_POP([C++])
6378     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6379         AC_MSG_RESULT([yes])
6380     else
6381         AC_MSG_RESULT([no])
6382     fi
6384 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6386 dnl ===================================================================
6387 dnl system stl sanity tests
6388 dnl ===================================================================
6389 if test "$_os" != "WINNT"; then
6391     AC_LANG_PUSH([C++])
6393     save_CPPFLAGS="$CPPFLAGS"
6394     if test -n "$MACOSX_SDK_PATH"; then
6395         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6396     fi
6398     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6399     # only.
6400     if test "$CPP_LIBRARY" = GLIBCXX; then
6401         dnl gcc#19664, gcc#22482, rhbz#162935
6402         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6403         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6404         AC_MSG_RESULT([$stlvisok])
6405         if test "$stlvisok" = "no"; then
6406             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6407         fi
6408     fi
6410     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6411     # when we don't make any dynamic libraries?
6412     if test "$DISABLE_DYNLOADING" = ""; then
6413         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6414         cat > conftestlib1.cc <<_ACEOF
6415 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6416 struct S2: S1<int> { virtual ~S2(); };
6417 S2::~S2() {}
6418 _ACEOF
6419         cat > conftestlib2.cc <<_ACEOF
6420 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6421 struct S2: S1<int> { virtual ~S2(); };
6422 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6423 _ACEOF
6424         gccvisinlineshiddenok=yes
6425         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6426             gccvisinlineshiddenok=no
6427         else
6428             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6429             dnl known to not work with -z defs (unsetting which makes the test
6430             dnl moot, though):
6431             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6432             if test "$COM_IS_CLANG" = TRUE; then
6433                 for i in $CXX $CXXFLAGS; do
6434                     case $i in
6435                     -fsanitize=*)
6436                         my_linkflagsnoundefs=
6437                         break
6438                         ;;
6439                     esac
6440                 done
6441             fi
6442             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6443                 gccvisinlineshiddenok=no
6444             fi
6445         fi
6447         rm -fr libconftest*
6448         AC_MSG_RESULT([$gccvisinlineshiddenok])
6449         if test "$gccvisinlineshiddenok" = "no"; then
6450             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6451         fi
6452     fi
6454    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6455     cat >visibility.cxx <<_ACEOF
6456 #pragma GCC visibility push(hidden)
6457 struct __attribute__ ((visibility ("default"))) TestStruct {
6458   static void Init();
6460 __attribute__ ((visibility ("default"))) void TestFunc() {
6461   TestStruct::Init();
6463 _ACEOF
6464     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6465         gccvisbroken=yes
6466     else
6467         case "$host_cpu" in
6468         i?86|x86_64)
6469             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6470                 gccvisbroken=no
6471             else
6472                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6473                     gccvisbroken=no
6474                 else
6475                     gccvisbroken=yes
6476                 fi
6477             fi
6478             ;;
6479         *)
6480             gccvisbroken=no
6481             ;;
6482         esac
6483     fi
6484     rm -f visibility.s visibility.cxx
6486     AC_MSG_RESULT([$gccvisbroken])
6487     if test "$gccvisbroken" = "yes"; then
6488         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6489     fi
6491     CPPFLAGS="$save_CPPFLAGS"
6493     AC_LANG_POP([C++])
6496 dnl ===================================================================
6497 dnl  Clang++ tests
6498 dnl ===================================================================
6500 HAVE_GCC_FNO_DEFAULT_INLINE=
6501 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6502 if test "$GCC" = "yes"; then
6503     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6504     AC_LANG_PUSH([C++])
6505     save_CXXFLAGS=$CXXFLAGS
6506     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6507     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6508     CXXFLAGS=$save_CXXFLAGS
6509     AC_LANG_POP([C++])
6510     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6511         AC_MSG_RESULT([yes])
6512     else
6513         AC_MSG_RESULT([no])
6514     fi
6516     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6517     AC_LANG_PUSH([C++])
6518     save_CXXFLAGS=$CXXFLAGS
6519     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6520     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6521     CXXFLAGS=$save_CXXFLAGS
6522     AC_LANG_POP([C++])
6523     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6524         AC_MSG_RESULT([yes])
6525     else
6526         AC_MSG_RESULT([no])
6527     fi
6529 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6530 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6532 dnl ===================================================================
6533 dnl Compiler plugins
6534 dnl ===================================================================
6536 COMPILER_PLUGINS=
6537 # currently only Clang
6539 if test "$COM_IS_CLANG" != "TRUE"; then
6540     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6541         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6542         enable_compiler_plugins=no
6543     fi
6546 if test "$COM_IS_CLANG" = "TRUE"; then
6547     if test -n "$enable_compiler_plugins"; then
6548         compiler_plugins="$enable_compiler_plugins"
6549     elif test -n "$ENABLE_DBGUTIL"; then
6550         compiler_plugins=test
6551     else
6552         compiler_plugins=no
6553     fi
6554     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6555         if test "$compiler_plugins" = yes; then
6556             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6557         else
6558             compiler_plugins=no
6559         fi
6560     fi
6561     if test "$compiler_plugins" != "no"; then
6562         dnl The prefix where Clang resides, override to where Clang resides if
6563         dnl using a source build:
6564         if test -z "$CLANGDIR"; then
6565             CLANGDIR=/usr
6566         fi
6567         AC_LANG_PUSH([C++])
6568         save_CPPFLAGS=$CPPFLAGS
6569         save_CXX=$CXX
6570         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6571         : "${COMPILER_PLUGINS_CXX=g++}"
6572         CXX=$COMPILER_PLUGINS_CXX
6573         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6574         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6575             [COMPILER_PLUGINS=TRUE],
6576             [
6577             if test "$compiler_plugins" = "yes"; then
6578                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6579             else
6580                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6581                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6582             fi
6583             ])
6584         CXX=$save_CXX
6585         CPPFLAGS=$save_CPPFLAGS
6586         AC_LANG_POP([C++])
6587     fi
6588 else
6589     if test "$enable_compiler_plugins" = "yes"; then
6590         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6591     fi
6593 AC_SUBST(COMPILER_PLUGINS)
6594 AC_SUBST(COMPILER_PLUGINS_CXX)
6595 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6596 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6597 AC_SUBST(CLANGDIR)
6598 AC_SUBST(CLANGLIBDIR)
6600 # Plugin to help linker.
6601 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6602 # This makes --enable-lto build with clang work.
6603 AC_SUBST(LD_PLUGIN)
6605 dnl ===================================================================
6606 dnl allocator
6607 dnl ===================================================================
6608 AC_MSG_CHECKING([which memory allocator to use])
6609 if test "$with_alloc" = "system"; then
6610     AC_MSG_RESULT([system])
6611     ALLOC="SYS_ALLOC"
6613 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
6614     AC_MSG_RESULT([internal])
6616 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6617 AC_SUBST(HAVE_POSIX_FALLOCATE)
6618 AC_SUBST(ALLOC)
6620 dnl ===================================================================
6621 dnl Custom build version
6622 dnl ===================================================================
6624 AC_MSG_CHECKING([whether to add custom build version])
6625 if test "$with_build_version" != ""; then
6626     BUILD_VER_STRING=$with_build_version
6627     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6628 else
6629     BUILD_VER_STRING=
6630     AC_MSG_RESULT([no])
6632 AC_SUBST(BUILD_VER_STRING)
6634 JITC_PROCESSOR_TYPE=""
6635 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6636     # IBMs JDK needs this...
6637     JITC_PROCESSOR_TYPE=6
6638     export JITC_PROCESSOR_TYPE
6640 AC_SUBST([JITC_PROCESSOR_TYPE])
6642 # Misc Windows Stuff
6643 AC_ARG_WITH(ucrt-dir,
6644     AS_HELP_STRING([--with-ucrt-dir],
6645         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6646         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6647         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6648             Windows6.1-KB2999226-x64.msu
6649             Windows6.1-KB2999226-x86.msu
6650             Windows8.1-KB2999226-x64.msu
6651             Windows8.1-KB2999226-x86.msu
6652             Windows8-RT-KB2999226-x64.msu
6653             Windows8-RT-KB2999226-x86.msu
6654         A zip archive including those files is available from Microsoft site:
6655         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6657 UCRT_REDISTDIR="$with_ucrt_dir"
6658 if test $_os = "WINNT"; then
6659     find_msvc_x64_dlls
6660     find_msms
6661     MSVC_DLL_PATH="$msvcdllpath"
6662     MSVC_DLLS="$msvcdlls"
6663     MSM_PATH="$msmdir"
6664     # MSVC 15.3 changed it to VC141
6665     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6666         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6667     else
6668         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6669     fi
6670     if test "$UCRT_REDISTDIR" = "no"; then
6671         dnl explicitly disabled
6672         UCRT_REDISTDIR=""
6673     else
6674         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6675                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6676                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6677                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6678                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6679                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6680             UCRT_REDISTDIR=""
6681             if test -n "$PKGFORMAT"; then
6682                for i in $PKGFORMAT; do
6683                    case "$i" in
6684                    msi)
6685                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6686                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6687                        ;;
6688                    esac
6689                done
6690             fi
6691         fi
6692     fi
6695 AC_SUBST(UCRT_REDISTDIR)
6696 AC_SUBST(MSVC_DLL_PATH)
6697 AC_SUBST(MSVC_DLLS)
6698 AC_SUBST(MSM_PATH)
6700 dnl ===================================================================
6701 dnl Checks for Java
6702 dnl ===================================================================
6703 if test "$ENABLE_JAVA" != ""; then
6705     # Windows-specific tests
6706     if test "$build_os" = "cygwin"; then
6707         if test "$BITNESS_OVERRIDE" = 64; then
6708             bitness=64
6709         else
6710             bitness=32
6711         fi
6713         if test -z "$with_jdk_home"; then
6714             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6715             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6716             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6717             if test -n "$regvalue"; then
6718                 ver=$regvalue
6719                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6720                 _jdk_home=$regvalue
6721             fi
6722             if test -z "$with_jdk_home"; then
6723                 for ver in 1.8 1.7 1.6; do
6724                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6725                     if test -n "$regvalue"; then
6726                         _jdk_home=$regvalue
6727                         break
6728                     fi
6729                 done
6730             fi
6731             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6732                 with_jdk_home="$_jdk_home"
6733                 howfound="found automatically"
6734             else
6735                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6736             fi
6737         else
6738             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6739             howfound="you passed"
6740         fi
6741     fi
6743     # 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.
6744     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6745     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6746         with_jdk_home=`/usr/libexec/java_home`
6747     fi
6749     JAVA_HOME=; export JAVA_HOME
6750     if test -z "$with_jdk_home"; then
6751         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6752     else
6753         _java_path="$with_jdk_home/bin/$with_java"
6754         dnl Check if there is a Java interpreter at all.
6755         if test -x "$_java_path"; then
6756             JAVAINTERPRETER=$_java_path
6757         else
6758             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6759         fi
6760     fi
6762     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6763     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6764     dnl loaded by java to run JunitTests:
6765     if test "$build_os" = "cygwin"; then
6766         shortjdkhome=`cygpath -d "$with_jdk_home"`
6767         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
6768             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6769             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6770         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
6771             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6772             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6773         fi
6775         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6776             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6777         fi
6778         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6779     elif test "$cross_compiling" != "yes"; then
6780         case $CPUNAME in
6781             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6782                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6783                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6784                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6785                 fi
6786                 ;;
6787             *) # assumption: everything else 32-bit
6788                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6789                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6790                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6791                 fi
6792                 ;;
6793         esac
6794     fi
6797 HAVE_JAVA9=
6798 dnl ===================================================================
6799 dnl Checks for JDK.
6800 dnl ===================================================================
6802 # Note that JAVA_HOME as for now always means the *build* platform's
6803 # JAVA_HOME. Whether all the complexity here actually is needed any
6804 # more or not, no idea.
6806 if test "$ENABLE_JAVA" != ""; then
6807     _gij_longver=0
6808     AC_MSG_CHECKING([the installed JDK])
6809     if test -n "$JAVAINTERPRETER"; then
6810         dnl java -version sends output to stderr!
6811         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6812             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6813         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6814             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6815         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6816             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6817         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6818             JDK=ibm
6820             dnl IBM JDK specific tests
6821             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6822             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6824             if test "$_jdk_ver" -lt 10600; then
6825                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6826             fi
6828             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6830             if test "$with_jdk_home" = ""; then
6831                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6832 you must use the "--with-jdk-home" configure option explicitly])
6833             fi
6835             JAVA_HOME=$with_jdk_home
6836         else
6837             JDK=sun
6839             dnl Sun JDK specific tests
6840             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6841             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6843             if test "$_jdk_ver" -lt 10600; then
6844                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6845             fi
6846             if test "$_jdk_ver" -gt 10600; then
6847                 JAVA_CLASSPATH_NOT_SET=TRUE
6848             fi
6849             if test "$_jdk_ver" -ge 10900; then
6850                 HAVE_JAVA9=TRUE
6851             fi
6853             AC_MSG_RESULT([checked (JDK $_jdk)])
6854             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6855             if test "$_os" = "WINNT"; then
6856                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6857             fi
6859             # set to limit VM usage for JunitTests
6860             JAVAIFLAGS=-Xmx64M
6861             # set to limit VM usage for javac
6862             JAVAFLAGS=-J-Xmx128M
6863         fi
6864     else
6865         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6866     fi
6867 else
6868     dnl Java disabled
6869     JAVA_HOME=
6870     export JAVA_HOME
6873 dnl ===================================================================
6874 dnl Set target Java bytecode version
6875 dnl ===================================================================
6876 if test "$ENABLE_JAVA" != ""; then
6877     if test "$HAVE_JAVA9" = "TRUE"; then
6878         _java_target_ver="1.6"
6879     else
6880         _java_target_ver="1.5"
6881     fi
6882     JAVA_SOURCE_VER="$_java_target_ver"
6883     JAVA_TARGET_VER="$_java_target_ver"
6886 dnl ===================================================================
6887 dnl Checks for javac
6888 dnl ===================================================================
6889 if test "$ENABLE_JAVA" != ""; then
6890     javacompiler="javac"
6891     if test -z "$with_jdk_home"; then
6892         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6893     else
6894         _javac_path="$with_jdk_home/bin/$javacompiler"
6895         dnl Check if there is a Java compiler at all.
6896         if test -x "$_javac_path"; then
6897             JAVACOMPILER=$_javac_path
6898         fi
6899     fi
6900     if test -z "$JAVACOMPILER"; then
6901         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6902     fi
6903     if test "$build_os" = "cygwin"; then
6904         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6905             JAVACOMPILER="${JAVACOMPILER}.exe"
6906         fi
6907         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6908     fi
6911 dnl ===================================================================
6912 dnl Checks for javadoc
6913 dnl ===================================================================
6914 if test "$ENABLE_JAVA" != ""; then
6915     if test -z "$with_jdk_home"; then
6916         AC_PATH_PROG(JAVADOC, javadoc)
6917     else
6918         _javadoc_path="$with_jdk_home/bin/javadoc"
6919         dnl Check if there is a javadoc at all.
6920         if test -x "$_javadoc_path"; then
6921             JAVADOC=$_javadoc_path
6922         else
6923             AC_PATH_PROG(JAVADOC, javadoc)
6924         fi
6925     fi
6926     if test -z "$JAVADOC"; then
6927         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
6928     fi
6929     if test "$build_os" = "cygwin"; then
6930         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
6931             JAVADOC="${JAVADOC}.exe"
6932         fi
6933         JAVADOC=`win_short_path_for_make "$JAVADOC"`
6934     fi
6936     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
6937     JAVADOCISGJDOC="yes"
6938     fi
6940 AC_SUBST(JAVADOCISGJDOC)
6942 if test "$ENABLE_JAVA" != ""; then
6943     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
6944     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
6945         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
6946            # try to recover first by looking whether we have a alternatives
6947            # system as in Debian or newer SuSEs where following /usr/bin/javac
6948            # over /etc/alternatives/javac leads to the right bindir where we
6949            # just need to strip a bit away to get a valid JAVA_HOME
6950            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
6951         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
6952             # maybe only one level of symlink (e.g. on Mac)
6953             JAVA_HOME=$(readlink $JAVACOMPILER)
6954             if test "$(dirname $JAVA_HOME)" = "."; then
6955                 # we've got no path to trim back
6956                 JAVA_HOME=""
6957             fi
6958         else
6959             # else warn
6960             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
6961             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
6962             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
6963             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
6964         fi
6965         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
6966         if test "$JAVA_HOME" != "/usr"; then
6967             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
6968                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
6969                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
6970                 dnl Tiger already returns a JDK path..
6971                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
6972             else
6973                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
6974                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
6975                 dnl that checks which version to run
6976                 if test -f "$JAVA_HOME"; then
6977                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
6978                 fi
6979             fi
6980         fi
6981     fi
6982     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
6984     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
6985     if test -z "$JAVA_HOME"; then
6986         if test "x$with_jdk_home" = "x"; then
6987             cat > findhome.java <<_ACEOF
6988 [import java.io.File;
6990 class findhome
6992     public static void main(String args[])
6993     {
6994         String jrelocation = System.getProperty("java.home");
6995         File jre = new File(jrelocation);
6996         System.out.println(jre.getParent());
6997     }
6999 _ACEOF
7000             AC_MSG_CHECKING([if javac works])
7001             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7002             AC_TRY_EVAL(javac_cmd)
7003             if test $? = 0 -a -f ./findhome.class; then
7004                 AC_MSG_RESULT([javac works])
7005             else
7006                 echo "configure: javac test failed" >&5
7007                 cat findhome.java >&5
7008                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7009             fi
7010             AC_MSG_CHECKING([if gij knows its java.home])
7011             JAVA_HOME=`$JAVAINTERPRETER findhome`
7012             if test $? = 0 -a "$JAVA_HOME" != ""; then
7013                 AC_MSG_RESULT([$JAVA_HOME])
7014             else
7015                 echo "configure: java test failed" >&5
7016                 cat findhome.java >&5
7017                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7018             fi
7019             # clean-up after ourselves
7020             rm -f ./findhome.java ./findhome.class
7021         else
7022             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7023         fi
7024     fi
7026     # now check if $JAVA_HOME is really valid
7027     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7028         case "${JAVA_HOME}" in
7029             /Library/Java/JavaVirtualMachines/*)
7030                 ;;
7031             *)
7032                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7033                 ;;
7034         esac
7035         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7036             JAVA_HOME_OK="NO"
7037         fi
7038     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7039         JAVA_HOME_OK="NO"
7040     fi
7041     if test "$JAVA_HOME_OK" = "NO"; then
7042         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7043         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7044         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
7045         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7046         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7047         add_warning "in case JAVA_HOME is incorrectly set, some projects with not be built correctly"
7048     fi
7049     PathFormat "$JAVA_HOME"
7050     JAVA_HOME="$formatted_path"
7053 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7054     "$_os" != Darwin
7055 then
7056     AC_MSG_CHECKING([for JAWT lib])
7057     if test "$_os" = WINNT; then
7058         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7059         JAWTLIB=jawt.lib
7060     else
7061         case "$host_cpu" in
7062         arm*)
7063             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7064             JAVA_ARCH=$my_java_arch
7065             ;;
7066         i*86)
7067             my_java_arch=i386
7068             ;;
7069         m68k)
7070             my_java_arch=m68k
7071             ;;
7072         powerpc)
7073             my_java_arch=ppc
7074             ;;
7075         powerpc64)
7076             my_java_arch=ppc64
7077             ;;
7078         powerpc64le)
7079             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7080             JAVA_ARCH=$my_java_arch
7081             ;;
7082         sparc64)
7083             my_java_arch=sparcv9
7084             ;;
7085         x86_64)
7086             my_java_arch=amd64
7087             ;;
7088         *)
7089             my_java_arch=$host_cpu
7090             ;;
7091         esac
7092         # This is where JDK9 puts the library
7093         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7094             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7095         else
7096             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7097         fi
7098         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7099     fi
7100     AC_MSG_RESULT([$JAWTLIB])
7102 AC_SUBST(JAWTLIB)
7104 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7105     case "$host_os" in
7107     aix*)
7108         JAVAINC="-I$JAVA_HOME/include"
7109         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7110         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7111         ;;
7113     cygwin*)
7114         JAVAINC="-I$JAVA_HOME/include/win32"
7115         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7116         ;;
7118     darwin*)
7119         if test -d "$JAVA_HOME/include/darwin"; then
7120             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7121         else
7122             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7123         fi
7124         ;;
7126     dragonfly*)
7127         JAVAINC="-I$JAVA_HOME/include"
7128         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7129         ;;
7131     freebsd*)
7132         JAVAINC="-I$JAVA_HOME/include"
7133         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7134         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7135         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7136         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7137         ;;
7139     k*bsd*-gnu*)
7140         JAVAINC="-I$JAVA_HOME/include"
7141         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7142         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7143         ;;
7145     linux-gnu*)
7146         JAVAINC="-I$JAVA_HOME/include"
7147         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7148         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7149         ;;
7151     *netbsd*)
7152         JAVAINC="-I$JAVA_HOME/include"
7153         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7154         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7155        ;;
7157     openbsd*)
7158         JAVAINC="-I$JAVA_HOME/include"
7159         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7160         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7161         ;;
7163     solaris*)
7164         JAVAINC="-I$JAVA_HOME/include"
7165         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7166         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7167         ;;
7168     esac
7170 SOLARINC="$SOLARINC $JAVAINC"
7172 AC_SUBST(JAVACOMPILER)
7173 AC_SUBST(JAVADOC)
7174 AC_SUBST(JAVAINTERPRETER)
7175 AC_SUBST(JAVAIFLAGS)
7176 AC_SUBST(JAVAFLAGS)
7177 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7178 AC_SUBST(JAVA_HOME)
7179 AC_SUBST(JAVA_SOURCE_VER)
7180 AC_SUBST(JAVA_TARGET_VER)
7181 AC_SUBST(JDK)
7184 dnl ===================================================================
7185 dnl Export file validation
7186 dnl ===================================================================
7187 AC_MSG_CHECKING([whether to enable export file validation])
7188 if test "$with_export_validation" != "no"; then
7189     if test -z "$ENABLE_JAVA"; then
7190         if test "$with_export_validation" = "yes"; then
7191             AC_MSG_ERROR([requested, but Java is disabled])
7192         else
7193             AC_MSG_RESULT([no, as Java is disabled])
7194         fi
7195     elif test "$_jdk_ver" -lt 10800; then
7196         if test "$with_export_validation" = "yes"; then
7197             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7198         else
7199             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7200         fi
7201     else
7202         AC_MSG_RESULT([yes])
7203         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7205         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7206         if test -z "$ODFVALIDATOR"; then
7207             # remember to download the ODF toolkit with validator later
7208             AC_MSG_NOTICE([no odfvalidator found, will download it])
7209             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7210             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7212             # and fetch name of odfvalidator jar name from download.lst
7213             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7214             AC_SUBST(ODFVALIDATOR_JAR)
7216             if test -z "$ODFVALIDATOR_JAR"; then
7217                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7218             fi
7219         fi
7220         if test "$build_os" = "cygwin"; then
7221             # In case of Cygwin it will be executed from Windows,
7222             # so we need to run bash and absolute path to validator
7223             # so instead of "odfvalidator" it will be
7224             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7225             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7226         else
7227             ODFVALIDATOR="sh $ODFVALIDATOR"
7228         fi
7229         AC_SUBST(ODFVALIDATOR)
7232         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7233         if test -z "$OFFICEOTRON"; then
7234             # remember to download the officeotron with validator later
7235             AC_MSG_NOTICE([no officeotron found, will download it])
7236             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7237             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7239             # and fetch name of officeotron jar name from download.lst
7240             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7241             AC_SUBST(OFFICEOTRON_JAR)
7243             if test -z "$OFFICEOTRON_JAR"; then
7244                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7245             fi
7246         else
7247             # check version of existing officeotron
7248             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7249             if test 0"$OFFICEOTRON_VER" -lt 704; then
7250                 AC_MSG_ERROR([officeotron too old])
7251             fi
7252         fi
7253         if test "$build_os" = "cygwin"; then
7254             # In case of Cygwin it will be executed from Windows,
7255             # so we need to run bash and absolute path to validator
7256             # so instead of "odfvalidator" it will be
7257             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7258             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7259         else
7260             OFFICEOTRON="sh $OFFICEOTRON"
7261         fi
7262     fi
7263     AC_SUBST(OFFICEOTRON)
7264 else
7265     AC_MSG_RESULT([no])
7268 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7269 if test "$with_bffvalidator" != "no"; then
7270     AC_DEFINE(HAVE_BFFVALIDATOR)
7272     if test "$with_export_validation" = "no"; then
7273         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7274     fi
7276     if test "$with_bffvalidator" = "yes"; then
7277         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7278     else
7279         BFFVALIDATOR="$with_bffvalidator"
7280     fi
7282     if test "$build_os" = "cygwin"; then
7283         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7284             AC_MSG_RESULT($BFFVALIDATOR)
7285         else
7286             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7287         fi
7288     elif test -n "$BFFVALIDATOR"; then
7289         # We are not in Cygwin but need to run Windows binary with wine
7290         AC_PATH_PROGS(WINE, wine)
7292         # so swap in a shell wrapper that converts paths transparently
7293         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7294         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7295         AC_SUBST(BFFVALIDATOR_EXE)
7296         AC_MSG_RESULT($BFFVALIDATOR)
7297     else
7298         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7299     fi
7300     AC_SUBST(BFFVALIDATOR)
7301 else
7302     AC_MSG_RESULT([no])
7305 dnl ===================================================================
7306 dnl Check for C preprocessor to use
7307 dnl ===================================================================
7308 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7309 if test -n "$with_idlc_cpp"; then
7310     AC_MSG_RESULT([$with_idlc_cpp])
7311     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7312 else
7313     AC_MSG_RESULT([ucpp])
7314     AC_MSG_CHECKING([which ucpp tp use])
7315     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7316         AC_MSG_RESULT([external])
7317         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7318     else
7319         AC_MSG_RESULT([internal])
7320         BUILD_TYPE="$BUILD_TYPE UCPP"
7321     fi
7323 AC_SUBST(SYSTEM_UCPP)
7325 dnl ===================================================================
7326 dnl Check for epm (not needed for Windows)
7327 dnl ===================================================================
7328 AC_MSG_CHECKING([whether to enable EPM for packing])
7329 if test "$enable_epm" = "yes"; then
7330     AC_MSG_RESULT([yes])
7331     if test "$_os" != "WINNT"; then
7332         if test $_os = Darwin; then
7333             EPM=internal
7334         elif test -n "$with_epm"; then
7335             EPM=$with_epm
7336         else
7337             AC_PATH_PROG(EPM, epm, no)
7338         fi
7339         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7340             AC_MSG_NOTICE([EPM will be built.])
7341             BUILD_TYPE="$BUILD_TYPE EPM"
7342             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7343         else
7344             # Gentoo has some epm which is something different...
7345             AC_MSG_CHECKING([whether the found epm is the right epm])
7346             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7347                 AC_MSG_RESULT([yes])
7348             else
7349                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7350             fi
7351             AC_MSG_CHECKING([epm version])
7352             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7353             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7354                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7355                 AC_MSG_RESULT([OK, >= 3.7])
7356             else
7357                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7358                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7359             fi
7360         fi
7361     fi
7363     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7364         AC_MSG_CHECKING([for rpm])
7365         for a in "$RPM" rpmbuild rpm; do
7366             $a --usage >/dev/null 2> /dev/null
7367             if test $? -eq 0; then
7368                 RPM=$a
7369                 break
7370             else
7371                 $a --version >/dev/null 2> /dev/null
7372                 if test $? -eq 0; then
7373                     RPM=$a
7374                     break
7375                 fi
7376             fi
7377         done
7378         if test -z "$RPM"; then
7379             AC_MSG_ERROR([not found])
7380         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7381             RPM_PATH=`which $RPM`
7382             AC_MSG_RESULT([$RPM_PATH])
7383             SCPDEFS="$SCPDEFS -DWITH_RPM"
7384         else
7385             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7386         fi
7387     fi
7388     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7389         AC_PATH_PROG(DPKG, dpkg, no)
7390         if test "$DPKG" = "no"; then
7391             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7392         fi
7393     fi
7394     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7395        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7396         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7397             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7398                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7399                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7400                     AC_MSG_RESULT([yes])
7401                 else
7402                     AC_MSG_RESULT([no])
7403                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7404                         _pt="rpm"
7405                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7406                         add_warning "the rpms will need to be installed with --nodeps"
7407                     else
7408                         _pt="pkg"
7409                     fi
7410                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7411                     add_warning "the ${_pt}s will not be relocatable"
7412                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7413                                  relocation will work, you need to patch your epm with the
7414                                  patch in epm/epm-3.7.patch or build with
7415                                  --with-epm=internal which will build a suitable epm])
7416                 fi
7417             fi
7418         fi
7419     fi
7420     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7421         AC_PATH_PROG(PKGMK, pkgmk, no)
7422         if test "$PKGMK" = "no"; then
7423             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7424         fi
7425     fi
7426     AC_SUBST(RPM)
7427     AC_SUBST(DPKG)
7428     AC_SUBST(PKGMK)
7429 else
7430     for i in $PKGFORMAT; do
7431         case "$i" in
7432         aix | bsd | deb | pkg | rpm | native | portable)
7433             AC_MSG_ERROR(
7434                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7435             ;;
7436         esac
7437     done
7438     AC_MSG_RESULT([no])
7439     EPM=NO
7441 AC_SUBST(EPM)
7443 ENABLE_LWP=
7444 if test "$enable_lotuswordpro" = "yes"; then
7445     ENABLE_LWP="TRUE"
7447 AC_SUBST(ENABLE_LWP)
7449 dnl ===================================================================
7450 dnl Check for building ODK
7451 dnl ===================================================================
7452 if test "$enable_odk" = no; then
7453     unset DOXYGEN
7454 else
7455     if test "$with_doxygen" = no; then
7456         AC_MSG_CHECKING([for doxygen])
7457         unset DOXYGEN
7458         AC_MSG_RESULT([no])
7459     else
7460         if test "$with_doxygen" = yes; then
7461             AC_PATH_PROG([DOXYGEN], [doxygen])
7462             if test -z "$DOXYGEN"; then
7463                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7464             fi
7465             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7466                 if ! dot -V 2>/dev/null; then
7467                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7468                 fi
7469             fi
7470         else
7471             AC_MSG_CHECKING([for doxygen])
7472             DOXYGEN=$with_doxygen
7473             AC_MSG_RESULT([$DOXYGEN])
7474         fi
7475         if test -n "$DOXYGEN"; then
7476             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7477             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7478             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7479                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7480             fi
7481         fi
7482     fi
7484 AC_SUBST([DOXYGEN])
7486 AC_MSG_CHECKING([whether to build the ODK])
7487 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7488     AC_MSG_RESULT([yes])
7490     if test "$with_java" != "no"; then
7491         AC_MSG_CHECKING([whether to build unowinreg.dll])
7492         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7493             # build on Win by default
7494             enable_build_unowinreg=yes
7495         fi
7496         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7497             AC_MSG_RESULT([no])
7498             BUILD_UNOWINREG=
7499         else
7500             AC_MSG_RESULT([yes])
7501             BUILD_UNOWINREG=TRUE
7502         fi
7503         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7504             if test -z "$with_mingw_cross_compiler"; then
7505                 dnl Guess...
7506                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7507             elif test -x "$with_mingw_cross_compiler"; then
7508                  MINGWCXX="$with_mingw_cross_compiler"
7509             else
7510                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7511             fi
7513             if test "$MINGWCXX" = "false"; then
7514                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7515             fi
7517             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7518             if test -x "$mingwstrip_test"; then
7519                 MINGWSTRIP="$mingwstrip_test"
7520             else
7521                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7522             fi
7524             if test "$MINGWSTRIP" = "false"; then
7525                 AC_MSG_ERROR(MinGW32 binutils not found.)
7526             fi
7527         fi
7528     fi
7529     BUILD_TYPE="$BUILD_TYPE ODK"
7530 else
7531     AC_MSG_RESULT([no])
7532     BUILD_UNOWINREG=
7534 AC_SUBST(BUILD_UNOWINREG)
7535 AC_SUBST(MINGWCXX)
7536 AC_SUBST(MINGWSTRIP)
7538 dnl ===================================================================
7539 dnl Check for system zlib
7540 dnl ===================================================================
7541 if test "$with_system_zlib" = "auto"; then
7542     case "$_os" in
7543     WINNT)
7544         with_system_zlib="$with_system_libs"
7545         ;;
7546     *)
7547         if test "$enable_fuzzers" != "yes"; then
7548             with_system_zlib=yes
7549         else
7550             with_system_zlib=no
7551         fi
7552         ;;
7553     esac
7556 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7557 dnl and has no pkg-config for it at least on some tinderboxes,
7558 dnl so leaving that out for now
7559 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7560 AC_MSG_CHECKING([which zlib to use])
7561 if test "$with_system_zlib" = "yes"; then
7562     AC_MSG_RESULT([external])
7563     SYSTEM_ZLIB=TRUE
7564     AC_CHECK_HEADER(zlib.h, [],
7565         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7566     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7567         [AC_MSG_ERROR(zlib not found or functional)], [])
7568 else
7569     AC_MSG_RESULT([internal])
7570     SYSTEM_ZLIB=
7571     BUILD_TYPE="$BUILD_TYPE ZLIB"
7572     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7573     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7575 AC_SUBST(ZLIB_CFLAGS)
7576 AC_SUBST(ZLIB_LIBS)
7577 AC_SUBST(SYSTEM_ZLIB)
7579 dnl ===================================================================
7580 dnl Check for system jpeg
7581 dnl ===================================================================
7582 AC_MSG_CHECKING([which libjpeg to use])
7583 if test "$with_system_jpeg" = "yes"; then
7584     AC_MSG_RESULT([external])
7585     SYSTEM_LIBJPEG=TRUE
7586     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7587         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7588     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7589         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7590 else
7591     SYSTEM_LIBJPEG=
7592     AC_MSG_RESULT([internal, libjpeg-turbo])
7593     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7594     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7595     if test "$COM" = "MSC"; then
7596         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7597     else
7598         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7599     fi
7601     case "$host_cpu" in
7602     x86_64 | amd64 | i*86 | x86 | ia32)
7603         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7604         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7605             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7606                 NASM="$LODE_HOME/opt/bin/nasm"
7607             elif test -x "/opt/lo/bin/nasm"; then
7608                 NASM="/opt/lo/bin/nasm"
7609             fi
7610         fi
7612         if test -n "$NASM"; then
7613             AC_MSG_CHECKING([for object file format of host system])
7614             case "$host_os" in
7615               cygwin* | mingw* | pw32* | interix*)
7616                 case "$host_cpu" in
7617                   x86_64)
7618                     objfmt='Win64-COFF'
7619                     ;;
7620                   *)
7621                     objfmt='Win32-COFF'
7622                     ;;
7623                 esac
7624               ;;
7625               msdosdjgpp* | go32*)
7626                 objfmt='COFF'
7627               ;;
7628               os2-emx*)                 # not tested
7629                 objfmt='MSOMF'          # obj
7630               ;;
7631               linux*coff* | linux*oldld*)
7632                 objfmt='COFF'           # ???
7633               ;;
7634               linux*aout*)
7635                 objfmt='a.out'
7636               ;;
7637               linux*)
7638                 case "$host_cpu" in
7639                   x86_64)
7640                     objfmt='ELF64'
7641                     ;;
7642                   *)
7643                     objfmt='ELF'
7644                     ;;
7645                 esac
7646               ;;
7647               kfreebsd* | freebsd* | netbsd* | openbsd*)
7648                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7649                   objfmt='BSD-a.out'
7650                 else
7651                   case "$host_cpu" in
7652                     x86_64 | amd64)
7653                       objfmt='ELF64'
7654                       ;;
7655                     *)
7656                       objfmt='ELF'
7657                       ;;
7658                   esac
7659                 fi
7660               ;;
7661               solaris* | sunos* | sysv* | sco*)
7662                 case "$host_cpu" in
7663                   x86_64)
7664                     objfmt='ELF64'
7665                     ;;
7666                   *)
7667                     objfmt='ELF'
7668                     ;;
7669                 esac
7670               ;;
7671               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7672                 case "$host_cpu" in
7673                   x86_64)
7674                     objfmt='Mach-O64'
7675                     ;;
7676                   *)
7677                     objfmt='Mach-O'
7678                     ;;
7679                 esac
7680               ;;
7681               *)
7682                 objfmt='ELF ?'
7683               ;;
7684             esac
7686             AC_MSG_RESULT([$objfmt])
7687             if test "$objfmt" = 'ELF ?'; then
7688               objfmt='ELF'
7689               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7690             fi
7692             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7693             case "$objfmt" in
7694               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7695               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7696               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7697               COFF)       NAFLAGS='-fcoff -DCOFF';;
7698               a.out)      NAFLAGS='-faout -DAOUT';;
7699               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7700               ELF)        NAFLAGS='-felf -DELF';;
7701               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7702               RDF)        NAFLAGS='-frdf -DRDF';;
7703               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7704               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7705             esac
7706             AC_MSG_RESULT([$NAFLAGS])
7708             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7709             cat > conftest.asm << EOF
7710             [%line __oline__ "configure"
7711                     section .text
7712                     global  _main,main
7713             _main:
7714             main:   xor     eax,eax
7715                     ret
7716             ]
7718             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7719             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7720               AC_MSG_RESULT(yes)
7721             else
7722               echo "configure: failed program was:" >&AC_FD_CC
7723               cat conftest.asm >&AC_FD_CC
7724               rm -rf conftest*
7725               AC_MSG_RESULT(no)
7726               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7727               NASM=""
7728             fi
7730         fi
7732         if test -z "$NASM"; then
7733 cat << _EOS
7734 ****************************************************************************
7735 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7736 To get one please:
7738 _EOS
7739             if test "$build_os" = "cygwin"; then
7740 cat << _EOS
7741 install a pre-compiled binary for Win32
7743 mkdir -p /opt/lo/bin
7744 cd /opt/lo/bin
7745 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7746 chmod +x nasm
7748 or get and install one from http://www.nasm.us/
7750 Then re-run autogen.sh
7752 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7753 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7755 _EOS
7756             else
7757 cat << _EOS
7758 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7760 _EOS
7761             fi
7762             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7763             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7764         fi
7765       ;;
7766     esac
7769 AC_SUBST(NASM)
7770 AC_SUBST(LIBJPEG_CFLAGS)
7771 AC_SUBST(LIBJPEG_LIBS)
7772 AC_SUBST(SYSTEM_LIBJPEG)
7774 dnl ===================================================================
7775 dnl Check for system clucene
7776 dnl ===================================================================
7777 dnl we should rather be using
7778 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7779 dnl but the contribs-lib check seems tricky
7780 AC_MSG_CHECKING([which clucene to use])
7781 if test "$with_system_clucene" = "yes"; then
7782     AC_MSG_RESULT([external])
7783     SYSTEM_CLUCENE=TRUE
7784     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7785     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7786     FilterLibs "${CLUCENE_LIBS}"
7787     CLUCENE_LIBS="${filteredlibs}"
7788     AC_LANG_PUSH([C++])
7789     save_CXXFLAGS=$CXXFLAGS
7790     save_CPPFLAGS=$CPPFLAGS
7791     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7792     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7793     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7794     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7795     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7796                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7797     CXXFLAGS=$save_CXXFLAGS
7798     CPPFLAGS=$save_CPPFLAGS
7799     AC_LANG_POP([C++])
7801     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7802 else
7803     AC_MSG_RESULT([internal])
7804     SYSTEM_CLUCENE=
7805     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7807 AC_SUBST(SYSTEM_CLUCENE)
7808 AC_SUBST(CLUCENE_CFLAGS)
7809 AC_SUBST(CLUCENE_LIBS)
7811 dnl ===================================================================
7812 dnl Check for system expat
7813 dnl ===================================================================
7814 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7816 dnl ===================================================================
7817 dnl Check for system xmlsec
7818 dnl ===================================================================
7819 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7821 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7822 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7823     ENABLE_EOT="TRUE"
7824     AC_DEFINE([ENABLE_EOT])
7825     AC_MSG_RESULT([yes])
7827     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7828 else
7829     ENABLE_EOT=
7830     AC_MSG_RESULT([no])
7832 AC_SUBST([ENABLE_EOT])
7834 dnl ===================================================================
7835 dnl Check for DLP libs
7836 dnl ===================================================================
7837 AS_IF([test "$COM" = "MSC"],
7838       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7839       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7841 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7843 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7845 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7847 AS_IF([test "$COM" = "MSC"],
7848       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7849       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7851 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7853 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7855 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7856 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.9])
7858 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7860 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7862 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7864 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7865 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
7867 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7868 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
7870 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7872 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7873 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7875 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7877 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7879 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7881 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7883 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7884 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
7886 dnl ===================================================================
7887 dnl Check for system lcms2
7888 dnl ===================================================================
7889 if test "$with_system_lcms2" != "yes"; then
7890     SYSTEM_LCMS2=
7892 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7893 if test "$GCC" = "yes"; then
7894     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7896 if test "$COM" = "MSC"; then # override the above
7897     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7900 dnl ===================================================================
7901 dnl Check for system cppunit
7902 dnl ===================================================================
7903 if test "$cross_compiling" != "yes"; then
7904     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7907 dnl ===================================================================
7908 dnl Check whether freetype is available
7909 dnl ===================================================================
7910 if test  "$test_freetype" = "yes"; then
7911     AC_MSG_CHECKING([whether freetype is available])
7912     # FreeType has 3 different kinds of versions
7913     # * release, like 2.4.10
7914     # * libtool, like 13.0.7 (this what pkg-config returns)
7915     # * soname
7916     # FreeType's docs/VERSION.DLL provides a table mapping between the three
7917     #
7918     # 9.9.3 is 2.2.0
7919     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
7920     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7921     FilterLibs "${FREETYPE_LIBS}"
7922     FREETYPE_LIBS="${filteredlibs}"
7923     SYSTEM_FREETYPE=TRUE
7924 else
7925     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
7926     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
7928 AC_SUBST(FREETYPE_CFLAGS)
7929 AC_SUBST(FREETYPE_LIBS)
7930 AC_SUBST([SYSTEM_FREETYPE])
7932 # ===================================================================
7933 # Check for system libxslt
7934 # to prevent incompatibilities between internal libxml2 and external libxslt,
7935 # or vice versa, use with_system_libxml here
7936 # ===================================================================
7937 if test "$with_system_libxml" = "auto"; then
7938     case "$_os" in
7939     WINNT|iOS|Android)
7940         with_system_libxml="$with_system_libs"
7941         ;;
7942     *)
7943         if test "$enable_fuzzers" != "yes"; then
7944             with_system_libxml=yes
7945         else
7946             with_system_libxml=no
7947         fi
7948         ;;
7949     esac
7952 AC_MSG_CHECKING([which libxslt to use])
7953 if test "$with_system_libxml" = "yes"; then
7954     AC_MSG_RESULT([external])
7955     SYSTEM_LIBXSLT=TRUE
7956     if test "$_os" = "Darwin"; then
7957         dnl make sure to use SDK path
7958         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
7959         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
7960         dnl omit -L/usr/lib
7961         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
7962         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
7963     else
7964         PKG_CHECK_MODULES(LIBXSLT, libxslt)
7965         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7966         FilterLibs "${LIBXSLT_LIBS}"
7967         LIBXSLT_LIBS="${filteredlibs}"
7968         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
7969         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
7970         FilterLibs "${LIBEXSLT_LIBS}"
7971         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
7972     fi
7974     dnl Check for xsltproc
7975     AC_PATH_PROG(XSLTPROC, xsltproc, no)
7976     if test "$XSLTPROC" = "no"; then
7977         AC_MSG_ERROR([xsltproc is required])
7978     fi
7979 else
7980     AC_MSG_RESULT([internal])
7981     SYSTEM_LIBXSLT=
7982     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
7984     if test "$cross_compiling" = "yes"; then
7985         AC_PATH_PROG(XSLTPROC, xsltproc, no)
7986         if test "$XSLTPROC" = "no"; then
7987             AC_MSG_ERROR([xsltproc is required])
7988         fi
7989     fi
7991 AC_SUBST(SYSTEM_LIBXSLT)
7992 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
7993     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
7995 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
7997 AC_SUBST(LIBEXSLT_CFLAGS)
7998 AC_SUBST(LIBEXSLT_LIBS)
7999 AC_SUBST(LIBXSLT_CFLAGS)
8000 AC_SUBST(LIBXSLT_LIBS)
8001 AC_SUBST(XSLTPROC)
8003 # ===================================================================
8004 # Check for system libxml
8005 # ===================================================================
8006 AC_MSG_CHECKING([which libxml to use])
8007 if test "$with_system_libxml" = "yes"; then
8008     AC_MSG_RESULT([external])
8009     SYSTEM_LIBXML=TRUE
8010     if test "$_os" = "Darwin"; then
8011         dnl make sure to use SDK path
8012         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8013         dnl omit -L/usr/lib
8014         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8015     elif test $_os = iOS; then
8016         dnl make sure to use SDK path
8017         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8018         LIBXML_CFLAGS="-I$usr/include/libxml2"
8019         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8020     else
8021         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8022         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8023         FilterLibs "${LIBXML_LIBS}"
8024         LIBXML_LIBS="${filteredlibs}"
8025     fi
8027     dnl Check for xmllint
8028     AC_PATH_PROG(XMLLINT, xmllint, no)
8029     if test "$XMLLINT" = "no"; then
8030         AC_MSG_ERROR([xmllint is required])
8031     fi
8032 else
8033     AC_MSG_RESULT([internal])
8034     SYSTEM_LIBXML=
8035     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8036     if test "$COM" = "MSC"; then
8037         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8038     fi
8039     if test "$COM" = "MSC"; then
8040         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8041     else
8042         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8043     fi
8044     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8046 AC_SUBST(SYSTEM_LIBXML)
8047 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8048     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8050 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8051 AC_SUBST(LIBXML_CFLAGS)
8052 AC_SUBST(LIBXML_LIBS)
8053 AC_SUBST(XMLLINT)
8055 # =====================================================================
8056 # Checking for a Python interpreter with version >= 2.7.
8057 # Build and runtime requires Python 3 compatible version (>= 2.7).
8058 # Optionally user can pass an option to configure, i. e.
8059 # ./configure PYTHON=/usr/bin/python
8060 # =====================================================================
8061 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8062     # This allows a lack of system python with no error, we use internal one in that case.
8063     AM_PATH_PYTHON([2.7],, [:])
8064     # Clean PYTHON_VERSION checked below if cross-compiling
8065     PYTHON_VERSION=""
8066     if test "$PYTHON" != ":"; then
8067         PYTHON_FOR_BUILD=$PYTHON
8068     fi
8070 AC_SUBST(PYTHON_FOR_BUILD)
8072 # Checks for Python to use for Pyuno
8073 AC_MSG_CHECKING([which Python to use for Pyuno])
8074 case "$enable_python" in
8075 no|disable)
8076     if test -z $PYTHON_FOR_BUILD; then
8077         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8078         # requirement from the choice whether to include Python stuff in the installer, but why
8079         # bother?
8080         AC_MSG_ERROR([Python is required at build time.])
8081     fi
8082     enable_python=no
8083     AC_MSG_RESULT([none])
8084     ;;
8085 ""|yes|auto)
8086     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8087         AC_MSG_RESULT([no, overridden by --disable-scripting])
8088         enable_python=no
8089     elif test $build_os = cygwin; then
8090         dnl When building on Windows we don't attempt to use any installed
8091         dnl "system"  Python.
8092         AC_MSG_RESULT([fully internal])
8093         enable_python=internal
8094     elif test "$cross_compiling" = yes; then
8095         AC_MSG_RESULT([system])
8096         enable_python=system
8097     else
8098         # Unset variables set by the above AM_PATH_PYTHON so that
8099         # we actually do check anew.
8100         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
8101         AM_PATH_PYTHON([3.3],, [:])
8102         if test "$PYTHON" = ":"; then
8103             if test -z "$PYTHON_FOR_BUILD"; then
8104                 AC_MSG_RESULT([fully internal])
8105             else
8106                 AC_MSG_RESULT([internal])
8107             fi
8108             enable_python=internal
8109         else
8110             AC_MSG_RESULT([system])
8111             enable_python=system
8112         fi
8113     fi
8114     ;;
8115 internal)
8116     AC_MSG_RESULT([internal])
8117     ;;
8118 fully-internal)
8119     AC_MSG_RESULT([fully internal])
8120     enable_python=internal
8121     ;;
8122 system)
8123     AC_MSG_RESULT([system])
8124     ;;
8126     AC_MSG_ERROR([Incorrect --enable-python option])
8127     ;;
8128 esac
8130 if test $enable_python != no; then
8131     BUILD_TYPE="$BUILD_TYPE PYUNO"
8134 if test $enable_python = system; then
8135     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8136         python_version=2.7
8137         PYTHON=python$python_version
8138         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8139             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8140             PYTHON_LIBS="-framework Python"
8141         else
8142             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8143             PYTHON_LIBS="`$PYTHON-config --libs`"
8144         fi
8145     fi
8146     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8147         # Fallback: Accept these in the environment, or as set above
8148         # for MacOSX.
8149         :
8150     elif test "$cross_compiling" != yes; then
8151         # Unset variables set by the above AM_PATH_PYTHON so that
8152         # we actually do check anew.
8153         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
8154         # This causes an error if no python command is found
8155         AM_PATH_PYTHON([3.3])
8156         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8157         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8158         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8159         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8160         if test -z "$PKG_CONFIG"; then
8161             PYTHON_CFLAGS="-I$python_include"
8162             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8163         elif $PKG_CONFIG --exists python-$python_version; then
8164             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8165             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8166         else
8167             PYTHON_CFLAGS="-I$python_include"
8168             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8169         fi
8170         FilterLibs "${PYTHON_LIBS}"
8171         PYTHON_LIBS="${filteredlibs}"
8172     else
8173         dnl How to find out the cross-compilation Python installation path?
8174         AC_MSG_CHECKING([for python version])
8175         AS_IF([test -n "$PYTHON_VERSION"],
8176               [AC_MSG_RESULT([$PYTHON_VERSION])],
8177               [AC_MSG_RESULT([not found])
8178                AC_MSG_ERROR([no usable python found])])
8179         test -n "$PYTHON_CFLAGS" && break
8180     fi
8182     dnl Check if the headers really work
8183     save_CPPFLAGS="$CPPFLAGS"
8184     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8185     AC_CHECK_HEADER(Python.h)
8186     CPPFLAGS="$save_CPPFLAGS"
8188     # let the PYTHON_FOR_BUILD match the same python installation that
8189     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8190     # better for PythonTests.
8191     PYTHON_FOR_BUILD=$PYTHON
8194 if test "$with_lxml" != no; then
8195     if test -z "$PYTHON_FOR_BUILD"; then
8196         case $build_os in
8197             cygwin)
8198                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8199                 ;;
8200             *)
8201                 if test "$cross_compiling" != yes ; then
8202                     BUILD_TYPE="$BUILD_TYPE LXML"
8203                 fi
8204                 ;;
8205         esac
8206     else
8207         AC_MSG_CHECKING([for python lxml])
8208         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8209             AC_MSG_RESULT([yes])
8210         else
8211             case $build_os in
8212                 cygwin)
8213                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8214                     ;;
8215                 *)
8216                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8217                         BUILD_TYPE="$BUILD_TYPE LXML"
8218                         AC_MSG_RESULT([no, using internal lxml])
8219                     else
8220                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8221                     fi
8222                     ;;
8223             esac
8224         fi
8225     fi
8228 dnl By now enable_python should be "system", "internal" or "no"
8229 case $enable_python in
8230 system)
8231     SYSTEM_PYTHON=TRUE
8233     if test "x$ac_cv_header_Python_h" != "xyes"; then
8234        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8235     fi
8237     AC_LANG_PUSH(C)
8238     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8239     AC_MSG_CHECKING([for correct python library version])
8240        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8241 #include <Python.h>
8243 int main(int argc, char **argv) {
8244    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8245        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8246    else return 1;
8248        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.7 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8249     CFLAGS=$save_CFLAGS
8250     AC_LANG_POP(C)
8252     dnl FIXME Check if the Python library can be linked with, too?
8253     ;;
8255 internal)
8256     SYSTEM_PYTHON=
8257     PYTHON_VERSION_MAJOR=3
8258     PYTHON_VERSION_MINOR=5
8259     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.4
8260     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8261         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8262     fi
8263     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8264     BUILD_TYPE="$BUILD_TYPE PYTHON"
8265     # Embedded Python dies without Home set
8266     if test "$HOME" = ""; then
8267         export HOME=""
8268     fi
8269     ;;
8271     DISABLE_PYTHON=TRUE
8272     SYSTEM_PYTHON=
8273     ;;
8275     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8276     ;;
8277 esac
8279 AC_SUBST(DISABLE_PYTHON)
8280 AC_SUBST(SYSTEM_PYTHON)
8281 AC_SUBST(PYTHON_CFLAGS)
8282 AC_SUBST(PYTHON_LIBS)
8283 AC_SUBST(PYTHON_VERSION)
8284 AC_SUBST(PYTHON_VERSION_MAJOR)
8285 AC_SUBST(PYTHON_VERSION_MINOR)
8287 AC_MSG_CHECKING([whether to build the MariaDB/MySQL Connector extension])
8288 if test "x$enable_ext_mariadb_connector" = "xyes" -a "x$enable_extension_integration" != "xno"; then
8289     AC_MSG_RESULT([yes])
8290     ENABLE_MARIADBC=TRUE
8291     MARIADBC_MAJOR=1
8292     MARIADBC_MINOR=0
8293     MARIADBC_MICRO=2
8294     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8295 else
8296     AC_MSG_RESULT([no])
8297     ENABLE_MARIADBC=
8299 AC_SUBST(ENABLE_MARIADBC)
8300 AC_SUBST(MARIADBC_MAJOR)
8301 AC_SUBST(MARIADBC_MINOR)
8302 AC_SUBST(MARIADBC_MICRO)
8304 if test "$ENABLE_MARIADBC" = "TRUE"; then
8306     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_MARIADBC"
8308     dnl ===================================================================
8309     dnl Check for system MariaDB
8310     dnl ===================================================================
8311     AC_MSG_CHECKING([which MariaDB to use])
8312     if test "$with_system_mariadb" = "yes"; then
8313         AC_MSG_RESULT([external])
8314         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8315         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8316         if test -z "$MARIADBCONFIG"; then
8317             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8318             if test -z "$MARIADBCONFIG"; then
8319                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8320                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8321             fi
8322         fi
8323         AC_MSG_CHECKING([MariaDB version])
8324         MARIADB_VERSION=`$MARIADBCONFIG --version`
8325         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8326         if test "$MARIADB_MAJOR" -ge "5"; then
8327             AC_MSG_RESULT([OK])
8328         else
8329             AC_MSG_ERROR([too old, use 5.0.x or later])
8330         fi
8331         AC_MSG_CHECKING([for MariaDB Client library])
8332         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8333         if test "$COM_IS_CLANG" = TRUE; then
8334             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8335         fi
8336         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8337         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8338         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8339         dnl linux32:
8340         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8341             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8342             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8343                 | sed -e 's|/lib64/|/lib/|')
8344         fi
8345         FilterLibs "${MARIADB_LIBS}"
8346         MARIADB_LIBS="${filteredlibs}"
8347         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8348         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8349         if test "$enable_bundle_mariadb" = "yes"; then
8350             AC_MSG_RESULT([yes])
8351             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8352             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8354 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8356 /g' | grep -E '(mysqlclient|mariadb)')
8357             if test "$_os" = "Darwin"; then
8358                 LIBMARIADB=${LIBMARIADB}.dylib
8359             elif test "$_os" = "WINNT"; then
8360                 LIBMARIADB=${LIBMARIADB}.dll
8361             else
8362                 LIBMARIADB=${LIBMARIADB}.so
8363             fi
8364             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8365             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8366             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8367                 AC_MSG_RESULT([found.])
8368                 PathFormat "$LIBMARIADB_PATH"
8369                 LIBMARIADB_PATH="$formatted_path"
8370             else
8371                 AC_MSG_ERROR([not found.])
8372             fi
8373         else
8374             AC_MSG_RESULT([no])
8375             BUNDLE_MARIADB_CONNECTOR_C=
8376         fi
8377     else
8378         AC_MSG_RESULT([internal])
8379         SYSTEM_MARIADB_CONNECTOR_C=
8380         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8381         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8382         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8383     fi
8385     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8386     AC_SUBST(MARIADB_CFLAGS)
8387     AC_SUBST(MARIADB_LIBS)
8388     AC_SUBST(LIBMARIADB)
8389     AC_SUBST(LIBMARIADB_PATH)
8390     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8392     AC_LANG_PUSH([C++])
8393     dnl ===================================================================
8394     dnl Check for system MySQL C++ Connector
8395     dnl ===================================================================
8396     # FIXME!
8397     # who thought this too-generic cppconn dir was a good idea?
8398     AC_MSG_CHECKING([MySQL Connector/C++])
8399     if test "$with_system_mysql_cppconn" = "yes"; then
8400         AC_MSG_RESULT([external])
8401         SYSTEM_MYSQL_CONNECTOR_CPP=TRUE
8402         AC_LANG_PUSH([C++])
8403         AC_CHECK_HEADER(mysql_driver.h, [],
8404                     [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
8405         AC_CHECK_LIB([mysqlcppconn], [main], [:],
8406                     [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
8407         save_LIBS=$LIBS
8408         LIBS="$LIBS -lmysqlcppconn"
8409         AC_MSG_CHECKING([version])
8410         AC_RUN_IFELSE([AC_LANG_SOURCE([[
8411 #include <mysql_driver.h>
8413 int main(int argc, char **argv) {
8414     sql::Driver *driver;
8415     driver = get_driver_instance();
8416     if (driver->getMajorVersion() > 1 || \
8417        (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
8418        (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
8419         return 0;
8420       else
8421         return 1;
8423       ]])],[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])])
8425         AC_LANG_POP([C++])
8426         LIBS=$save_LIBS
8427     else
8428         AC_MSG_RESULT([internal])
8429         BUILD_TYPE="$BUILD_TYPE MYSQL_CONNECTOR_CPP"
8430         SYSTEM_MYSQL_CONNECTOR_CPP=
8431     fi
8432     AC_LANG_POP([C++])
8434 AC_SUBST(SYSTEM_MYSQL_CONNECTOR_CPP)
8436 dnl ===================================================================
8437 dnl Check for system hsqldb
8438 dnl ===================================================================
8439 if test "$with_java" != "no"; then
8440     HSQLDB_USE_JDBC_4_1=
8441     AC_MSG_CHECKING([which hsqldb to use])
8442     if test "$with_system_hsqldb" = "yes"; then
8443         AC_MSG_RESULT([external])
8444         SYSTEM_HSQLDB=TRUE
8445         if test -z $HSQLDB_JAR; then
8446             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8447         fi
8448         if ! test -f $HSQLDB_JAR; then
8449                AC_MSG_ERROR(hsqldb.jar not found.)
8450         fi
8451         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8452         export HSQLDB_JAR
8453         if $PERL -e \
8454            'use Archive::Zip;
8455             my $file = "$ENV{'HSQLDB_JAR'}";
8456             my $zip = Archive::Zip->new( $file );
8457             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8458             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8459             {
8460                 push @l, split(/\n/, $mf);
8461                 foreach my $line (@l)
8462                 {
8463                     if ($line =~ m/Specification-Version:/)
8464                     {
8465                         ($t, $version) = split (/:/,$line);
8466                         $version =~ s/^\s//;
8467                         ($a, $b, $c, $d) = split (/\./,$version);
8468                         if ($c == "0" && $d > "8")
8469                         {
8470                             exit 0;
8471                         }
8472                         else
8473                         {
8474                             exit 1;
8475                         }
8476                     }
8477                 }
8478             }
8479             else
8480             {
8481                 exit 1;
8482             }'; then
8483             AC_MSG_RESULT([yes])
8484         else
8485             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8486         fi
8487     else
8488         AC_MSG_RESULT([internal])
8489         SYSTEM_HSQLDB=
8490         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8491         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8492         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8493         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8494             AC_MSG_RESULT([yes])
8495             HSQLDB_USE_JDBC_4_1=TRUE
8496         else
8497             AC_MSG_RESULT([no])
8498         fi
8499     fi
8500     AC_SUBST(SYSTEM_HSQLDB)
8501     AC_SUBST(HSQLDB_JAR)
8502     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8505 dnl ===================================================================
8506 dnl Check for PostgreSQL stuff
8507 dnl ===================================================================
8508 if test "x$enable_postgresql_sdbc" != "xno"; then
8509     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8511     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8512         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8513     fi
8514     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8515         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8516     fi
8518     postgres_interface=""
8519     if test "$with_system_postgresql" = "yes"; then
8520         postgres_interface="external PostgreSQL"
8521         SYSTEM_POSTGRESQL=TRUE
8522         if test "$_os" = Darwin; then
8523             supp_path=''
8524             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8525                 pg_supp_path="$P_SEP$d$pg_supp_path"
8526             done
8527         fi
8528         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8529         if test -z "$PGCONFIG"; then
8530             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8531         fi
8532         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8533         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8534         FilterLibs "${POSTGRESQL_LIB}"
8535         POSTGRESQL_LIB="${filteredlibs}"
8536     else
8537         # if/when anything else than PostgreSQL uses Kerberos,
8538         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8539         WITH_KRB5=
8540         WITH_GSSAPI=
8541         case "$_os" in
8542         Darwin)
8543             # MacOS X has system MIT Kerberos 5 since 10.4
8544             if test "$with_krb5" != "no"; then
8545                 WITH_KRB5=TRUE
8546                 save_LIBS=$LIBS
8547                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8548                 # that the libraries where these functions are located on macOS will change, is it?
8549                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8550                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8551                 KRB5_LIBS=$LIBS
8552                 LIBS=$save_LIBS
8553                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8554                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8555                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8556                 LIBS=$save_LIBS
8557             fi
8558             if test "$with_gssapi" != "no"; then
8559                 WITH_GSSAPI=TRUE
8560                 save_LIBS=$LIBS
8561                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8562                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8563                 GSSAPI_LIBS=$LIBS
8564                 LIBS=$save_LIBS
8565             fi
8566             ;;
8567         WINNT)
8568             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8569                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8570             fi
8571             ;;
8572         Linux|GNU|*BSD|DragonFly)
8573             if test "$with_krb5" != "no"; then
8574                 WITH_KRB5=TRUE
8575                 save_LIBS=$LIBS
8576                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8577                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8578                 KRB5_LIBS=$LIBS
8579                 LIBS=$save_LIBS
8580                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8581                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8582                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8583                 LIBS=$save_LIBS
8584             fi
8585             if test "$with_gssapi" != "no"; then
8586                 WITH_GSSAPI=TRUE
8587                 save_LIBS=$LIBS
8588                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8589                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8590                 GSSAPI_LIBS=$LIBS
8591                 LIBS=$save_LIBS
8592             fi
8593             ;;
8594         *)
8595             if test "$with_krb5" = "yes"; then
8596                 WITH_KRB5=TRUE
8597                 save_LIBS=$LIBS
8598                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8599                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8600                 KRB5_LIBS=$LIBS
8601                 LIBS=$save_LIBS
8602                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8603                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8604                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8605                 LIBS=$save_LIBS
8606             fi
8607             if test "$with_gssapi" = "yes"; then
8608                 WITH_GSSAPI=TRUE
8609                 save_LIBS=$LIBS
8610                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8611                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8612                 LIBS=$save_LIBS
8613                 GSSAPI_LIBS=$LIBS
8614             fi
8615         esac
8617         if test -n "$with_libpq_path"; then
8618             SYSTEM_POSTGRESQL=TRUE
8619             postgres_interface="external libpq"
8620             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8621             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8622         else
8623             SYSTEM_POSTGRESQL=
8624             postgres_interface="internal"
8625             POSTGRESQL_LIB=""
8626             POSTGRESQL_INC="%OVERRIDE_ME%"
8627             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8628         fi
8629     fi
8631     AC_MSG_CHECKING([PostgreSQL C interface])
8632     AC_MSG_RESULT([$postgres_interface])
8634     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8635         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8636         save_CFLAGS=$CFLAGS
8637         save_CPPFLAGS=$CPPFLAGS
8638         save_LIBS=$LIBS
8639         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8640         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8641         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8642         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8643             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8644         CFLAGS=$save_CFLAGS
8645         CPPFLAGS=$save_CPPFLAGS
8646         LIBS=$save_LIBS
8647     fi
8648     BUILD_POSTGRESQL_SDBC=TRUE
8650 AC_SUBST(WITH_KRB5)
8651 AC_SUBST(WITH_GSSAPI)
8652 AC_SUBST(GSSAPI_LIBS)
8653 AC_SUBST(KRB5_LIBS)
8654 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8655 AC_SUBST(SYSTEM_POSTGRESQL)
8656 AC_SUBST(POSTGRESQL_INC)
8657 AC_SUBST(POSTGRESQL_LIB)
8659 dnl ===================================================================
8660 dnl Check for Firebird stuff
8661 dnl ===================================================================
8662 ENABLE_FIREBIRD_SDBC=""
8663 if test "$enable_firebird_sdbc" = "yes" ; then
8664     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8666     dnl ===================================================================
8667     dnl Check for system Firebird
8668     dnl ===================================================================
8669     AC_MSG_CHECKING([which Firebird to use])
8670     if test "$with_system_firebird" = "yes"; then
8671         AC_MSG_RESULT([external])
8672         SYSTEM_FIREBIRD=TRUE
8673         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8674         if test -z "$FIREBIRDCONFIG"; then
8675             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8676             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8677                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8678             ])
8679             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8680         else
8681             AC_MSG_NOTICE([fb_config found])
8682             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8683             AC_MSG_CHECKING([for Firebird Client library])
8684             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8685             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8686             FilterLibs "${FIREBIRD_LIBS}"
8687             FIREBIRD_LIBS="${filteredlibs}"
8688         fi
8689         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8690         AC_MSG_CHECKING([Firebird version])
8691         if test -n "${FIREBIRD_VERSION}"; then
8692             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8693             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8694             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8695                 AC_MSG_RESULT([OK])
8696             else
8697                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8698             fi
8699         else
8700             __save_CFLAGS="${CFLAGS}"
8701             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8702             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8703 #if defined(FB_API_VER) && FB_API_VER == 30
8704 int fb_api_is_30(void) { return 0; }
8705 #else
8706 #error "Wrong Firebird API version"
8707 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8708             CFLAGS="${__save_CFLAGS}"
8709         fi
8710         ENABLE_FIREBIRD_SDBC="TRUE"
8711     elif test "$enable_database_connectivity" != yes; then
8712         AC_MSG_RESULT([none])
8713     elif test "$cross_compiling" = "yes"; then
8714         AC_MSG_RESULT([none])
8715     else
8716         dnl Embedded Firebird has version 3.0
8717         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8718         dnl We need libatomic-ops for any non X86/X64 system
8719         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8720             dnl ===================================================================
8721             dnl Check for system libatomic-ops
8722             dnl ===================================================================
8723             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8724             if test "$with_system_libatomic_ops" = "yes"; then
8725                 SYSTEM_LIBATOMIC_OPS=TRUE
8726                 AC_CHECK_HEADERS(atomic_ops.h, [],
8727                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8728             else
8729                 SYSTEM_LIBATOMIC_OPS=
8730                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8731                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8732                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8733             fi
8734         fi
8736         AC_MSG_RESULT([internal])
8737         SYSTEM_FIREBIRD=
8738         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8739         FIREBIRD_LIBS="-lfbclient"
8741         if test "$with_system_libtommath" = "yes"; then
8742             SYSTEM_LIBTOMMATH=TRUE
8743             dnl check for tommath presence
8744             save_LIBS=$LIBS
8745             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8746             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8747             LIBS=$save_LIBS
8748         else
8749             SYSTEM_LIBTOMMATH=
8750             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8751             LIBTOMMATH_LIBS="-ltommath"
8752             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8753         fi
8755         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8756         ENABLE_FIREBIRD_SDBC="TRUE"
8757     fi
8759 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8760 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8761 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8762 AC_SUBST(LIBATOMIC_OPS_LIBS)
8763 AC_SUBST(SYSTEM_FIREBIRD)
8764 AC_SUBST(FIREBIRD_CFLAGS)
8765 AC_SUBST(FIREBIRD_LIBS)
8766 AC_SUBST([TOMMATH_CFLAGS])
8767 AC_SUBST([TOMMATH_LIBS])
8769 dnl ===================================================================
8770 dnl Check for system curl
8771 dnl ===================================================================
8772 AC_MSG_CHECKING([which libcurl to use])
8773 if test "$with_system_curl" = "auto"; then
8774     with_system_curl="$with_system_libs"
8777 if test "$with_system_curl" = "yes"; then
8778     AC_MSG_RESULT([external])
8779     SYSTEM_CURL=TRUE
8781     # First try PKGCONFIG and then fall back
8782     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8784     if test -n "$CURL_PKG_ERRORS"; then
8785         AC_PATH_PROG(CURLCONFIG, curl-config)
8786         if test -z "$CURLCONFIG"; then
8787             AC_MSG_ERROR([curl development files not found])
8788         fi
8789         CURL_LIBS=`$CURLCONFIG --libs`
8790         FilterLibs "${CURL_LIBS}"
8791         CURL_LIBS="${filteredlibs}"
8792         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8793         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8795         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8796         case $curl_version in
8797         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8798         dnl so they need to be doubled to end up in the configure script
8799         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8800             AC_MSG_RESULT([yes])
8801             ;;
8802         *)
8803             AC_MSG_ERROR([no, you have $curl_version])
8804             ;;
8805         esac
8806     fi
8808     ENABLE_CURL=TRUE
8809 elif test $_os = iOS; then
8810     # Let's see if we need curl, I think not?
8811     AC_MSG_RESULT([none])
8812     ENABLE_CURL=
8813 else
8814     AC_MSG_RESULT([internal])
8815     SYSTEM_CURL=
8816     BUILD_TYPE="$BUILD_TYPE CURL"
8817     ENABLE_CURL=TRUE
8819 AC_SUBST(SYSTEM_CURL)
8820 AC_SUBST(CURL_CFLAGS)
8821 AC_SUBST(CURL_LIBS)
8822 AC_SUBST(ENABLE_CURL)
8824 dnl ===================================================================
8825 dnl Check for system boost
8826 dnl ===================================================================
8827 AC_MSG_CHECKING([which boost to use])
8828 if test "$with_system_boost" = "yes"; then
8829     AC_MSG_RESULT([external])
8830     SYSTEM_BOOST=TRUE
8831     AX_BOOST_BASE(1.47)
8832     AX_BOOST_DATE_TIME
8833     AX_BOOST_FILESYSTEM
8834     AX_BOOST_IOSTREAMS
8835     AX_BOOST_LOCALE
8836     AC_LANG_PUSH([C++])
8837     save_CXXFLAGS=$CXXFLAGS
8838     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8839     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8840        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8841     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8842        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8843     CXXFLAGS=$save_CXXFLAGS
8844     AC_LANG_POP([C++])
8845     # this is in m4/ax_boost_base.m4
8846     FilterLibs "${BOOST_LDFLAGS}"
8847     BOOST_LDFLAGS="${filteredlibs}"
8848 else
8849     AC_MSG_RESULT([internal])
8850     BUILD_TYPE="$BUILD_TYPE BOOST"
8851     SYSTEM_BOOST=
8852     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8853         # use warning-suppressing wrapper headers
8854         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8855     else
8856         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8857     fi
8859 AC_SUBST(SYSTEM_BOOST)
8861 dnl ===================================================================
8862 dnl Check for system mdds
8863 dnl ===================================================================
8864 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.2 >= 1.2.3], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8866 dnl ===================================================================
8867 dnl Check for system glm
8868 dnl ===================================================================
8869 AC_MSG_CHECKING([which glm to use])
8870 if test "$with_system_glm" = "yes"; then
8871     AC_MSG_RESULT([external])
8872     SYSTEM_GLM=TRUE
8873     AC_LANG_PUSH([C++])
8874     AC_CHECK_HEADER([glm/glm.hpp], [],
8875        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8876     AC_LANG_POP([C++])
8877 else
8878     AC_MSG_RESULT([internal])
8879     BUILD_TYPE="$BUILD_TYPE GLM"
8880     SYSTEM_GLM=
8881     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8883 AC_SUBST([GLM_CFLAGS])
8884 AC_SUBST([SYSTEM_GLM])
8886 dnl ===================================================================
8887 dnl Check for system odbc
8888 dnl ===================================================================
8889 AC_MSG_CHECKING([which odbc headers to use])
8890 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
8891     AC_MSG_RESULT([external])
8892     SYSTEM_ODBC_HEADERS=TRUE
8894     if test "$build_os" = "cygwin"; then
8895         save_CPPFLAGS=$CPPFLAGS
8896         find_winsdk
8897         PathFormat "$winsdktest"
8898         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"
8899         AC_CHECK_HEADER(sqlext.h, [],
8900             [AC_MSG_ERROR(odbc not found. install odbc)],
8901             [#include <windows.h>])
8902         CPPFLAGS=$save_CPPFLAGS
8903     else
8904         AC_CHECK_HEADER(sqlext.h, [],
8905             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8906     fi
8907 elif test "$enable_database_connectivity" != yes; then
8908     AC_MSG_RESULT([none])
8909 else
8910     AC_MSG_RESULT([internal])
8911     SYSTEM_ODBC_HEADERS=
8913 AC_SUBST(SYSTEM_ODBC_HEADERS)
8916 dnl ===================================================================
8917 dnl Check for system openldap
8918 dnl ===================================================================
8920 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8921 AC_MSG_CHECKING([which openldap library to use])
8922 if test "$with_system_openldap" = "yes"; then
8923     AC_MSG_RESULT([external])
8924     SYSTEM_OPENLDAP=TRUE
8925     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8926     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8927     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8928 else
8929     AC_MSG_RESULT([internal])
8930     SYSTEM_OPENLDAP=
8931     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8934 AC_SUBST(SYSTEM_OPENLDAP)
8936 dnl ===================================================================
8937 dnl Check for system NSS
8938 dnl ===================================================================
8939 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8940     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8941     AC_DEFINE(HAVE_FEATURE_NSS)
8942     ENABLE_NSS="TRUE"
8943     AC_DEFINE(ENABLE_NSS)
8944 elif test $_os != iOS ; then
8945     with_tls=openssl
8947 AC_SUBST(ENABLE_NSS)
8949 dnl ===================================================================
8950 dnl Check for TLS/SSL and cryptographic implementation to use
8951 dnl ===================================================================
8952 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8953 if test -n "$with_tls"; then
8954     case $with_tls in
8955     openssl)
8956         AC_DEFINE(USE_TLS_OPENSSL)
8957         TLS=OPENSSL
8959         if test "$enable_openssl" != "yes"; then
8960             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
8961         fi
8963         # warn that OpenSSL has been selected but not all TLS code has this option
8964         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
8965         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
8966         ;;
8967     nss)
8968         AC_DEFINE(USE_TLS_NSS)
8969         TLS=NSS
8970         ;;
8971     no)
8972         AC_MSG_WARN([Skipping TLS/SSL])
8973         ;;
8974     *)
8975         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
8976 openssl - OpenSSL
8977 nss - Mozilla's Network Security Services (NSS)
8978     ])
8979         ;;
8980     esac
8981 else
8982     # default to using NSS, it results in smaller oox lib
8983     AC_DEFINE(USE_TLS_NSS)
8984     TLS=NSS
8986 AC_MSG_RESULT([$TLS])
8987 AC_SUBST(TLS)
8989 dnl ===================================================================
8990 dnl Check for system sane
8991 dnl ===================================================================
8992 AC_MSG_CHECKING([which sane header to use])
8993 if test "$with_system_sane" = "yes"; then
8994     AC_MSG_RESULT([external])
8995     AC_CHECK_HEADER(sane/sane.h, [],
8996       [AC_MSG_ERROR(sane not found. install sane)], [])
8997 else
8998     AC_MSG_RESULT([internal])
8999     BUILD_TYPE="$BUILD_TYPE SANE"
9002 dnl ===================================================================
9003 dnl Check for system icu
9004 dnl ===================================================================
9005 SYSTEM_GENBRK=
9006 SYSTEM_GENCCODE=
9007 SYSTEM_GENCMN=
9009 ICU_MAJOR=61
9010 ICU_MINOR=1
9011 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9012 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9013 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9014 AC_MSG_CHECKING([which icu to use])
9015 if test "$with_system_icu" = "yes"; then
9016     AC_MSG_RESULT([external])
9017     SYSTEM_ICU=TRUE
9018     AC_LANG_PUSH([C++])
9019     AC_MSG_CHECKING([for unicode/rbbi.h])
9020     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9021     AC_LANG_POP([C++])
9023     if test "$cross_compiling" != "yes"; then
9024         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9025         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9026         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9027         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9028     fi
9030     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9031         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9032         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9033         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9034         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9035         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9036             AC_MSG_RESULT([yes])
9037         else
9038             AC_MSG_RESULT([no])
9039             if test "$with_system_icu_for_build" != "force"; then
9040                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9041 You can use --with-system-icu-for-build=force to use it anyway.])
9042             fi
9043         fi
9044     fi
9046     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9047         # using the system icu tools can lead to version confusion, use the
9048         # ones from the build environment when cross-compiling
9049         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9050         if test -z "$SYSTEM_GENBRK"; then
9051             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9052         fi
9053         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9054         if test -z "$SYSTEM_GENCCODE"; then
9055             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9056         fi
9057         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9058         if test -z "$SYSTEM_GENCMN"; then
9059             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9060         fi
9061         if test "$ICU_MAJOR" -ge "49"; then
9062             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9063             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9064             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9065         else
9066             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9067             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9068             ICU_RECLASSIFIED_HEBREW_LETTER=
9069         fi
9070     fi
9072     if test "$cross_compiling" = "yes"; then
9073         if test "$ICU_MAJOR" -ge "50"; then
9074             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9075             ICU_MINOR=""
9076         fi
9077     fi
9078 else
9079     AC_MSG_RESULT([internal])
9080     SYSTEM_ICU=
9081     BUILD_TYPE="$BUILD_TYPE ICU"
9082     # surprisingly set these only for "internal" (to be used by various other
9083     # external libs): the system icu-config is quite unhelpful and spits out
9084     # dozens of weird flags and also default path -I/usr/include
9085     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9086     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9088 if test "$ICU_MAJOR" -ge "59"; then
9089     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9090     # with -std=c++11 but not all external libraries can be built with that,
9091     # for those use a bit-compatible typedef uint16_t UChar; see
9092     # icu/source/common/unicode/umachine.h
9093     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9094 else
9095     ICU_UCHAR_TYPE=""
9097 AC_SUBST(SYSTEM_ICU)
9098 AC_SUBST(SYSTEM_GENBRK)
9099 AC_SUBST(SYSTEM_GENCCODE)
9100 AC_SUBST(SYSTEM_GENCMN)
9101 AC_SUBST(ICU_MAJOR)
9102 AC_SUBST(ICU_MINOR)
9103 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9104 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9105 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9106 AC_SUBST(ICU_CFLAGS)
9107 AC_SUBST(ICU_LIBS)
9108 AC_SUBST(ICU_UCHAR_TYPE)
9110 dnl ==================================================================
9111 dnl Breakpad
9112 dnl ==================================================================
9113 AC_MSG_CHECKING([whether to enable breakpad])
9114 if test "$enable_breakpad" != yes; then
9115     AC_MSG_RESULT([no])
9116 else
9117     AC_MSG_RESULT([yes])
9118     ENABLE_BREAKPAD="TRUE"
9119     AC_DEFINE(ENABLE_BREAKPAD)
9120     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9121     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9123     AC_MSG_CHECKING([for crashreport config])
9124     if test "$with_symbol_config" = "no"; then
9125         BREAKPAD_SYMBOL_CONFIG="invalid"
9126         AC_MSG_RESULT([no])
9127     else
9128         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9129         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9130         AC_MSG_RESULT([yes])
9131     fi
9132     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9134 AC_SUBST(ENABLE_BREAKPAD)
9136 dnl ==================================================================
9137 dnl libfuzzer
9138 dnl ==================================================================
9139 AC_MSG_CHECKING([whether to enable fuzzers])
9140 if test "$enable_fuzzers" != yes; then
9141     AC_MSG_RESULT([no])
9142 else
9143     AC_MSG_RESULT([yes])
9144     ENABLE_FUZZERS="TRUE"
9145     AC_DEFINE(ENABLE_FUZZERS)
9146     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9148 AC_SUBST(ENABLE_FUZZERS)
9150 dnl ===================================================================
9151 dnl Orcus
9152 dnl ===================================================================
9153 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.13 >= 0.13.3])
9154 if test "$with_system_orcus" != "yes"; then
9155     if test "$SYSTEM_BOOST" = "TRUE"; then
9156         # ===========================================================
9157         # Determine if we are going to need to link with Boost.System
9158         # ===========================================================
9159         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9160         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9161         dnl in documentation has no effect.
9162         AC_MSG_CHECKING([if we need to link with Boost.System])
9163         AC_LANG_PUSH([C++])
9164         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9165                 @%:@include <boost/version.hpp>
9166             ]],[[
9167                 #if BOOST_VERSION >= 105000
9168                 #   error yes, we need to link with Boost.System
9169                 #endif
9170             ]])],[
9171                 AC_MSG_RESULT([no])
9172             ],[
9173                 AC_MSG_RESULT([yes])
9174                 AX_BOOST_SYSTEM
9175         ])
9176         AC_LANG_POP([C++])
9177     fi
9179 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9180 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9181 AC_SUBST([BOOST_SYSTEM_LIB])
9182 AC_SUBST(SYSTEM_LIBORCUS)
9184 dnl ===================================================================
9185 dnl HarfBuzz
9186 dnl ===================================================================
9187 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9188                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9189                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9191 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9192                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9193                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9195 if test "$COM" = "MSC"; then # override the above
9196     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9197     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9200 if test "$with_system_harfbuzz" = "yes"; then
9201     if test "$with_system_graphite" = "no"; then
9202         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9203     fi
9204     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9205     _save_libs="$LIBS"
9206     _save_cflags="$CFLAGS"
9207     LIBS="$LIBS $HARFBUZZ_LIBS"
9208     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9209     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9210     LIBS="$_save_libs"
9211     CFLAGS="$_save_cflags"
9212 else
9213     if test "$with_system_graphite" = "yes"; then
9214         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9215     fi
9218 AC_MSG_CHECKING([whether to use X11])
9219 dnl ***************************************
9220 dnl testing for X libraries and includes...
9221 dnl ***************************************
9222 if test "$USING_X11" = TRUE; then
9223     AC_DEFINE(HAVE_FEATURE_X11)
9225 AC_MSG_RESULT([$USING_X11])
9227 if test "$USING_X11" = TRUE; then
9228     AC_PATH_X
9229     AC_PATH_XTRA
9230     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9232     if test -z "$x_includes"; then
9233         x_includes="default_x_includes"
9234     fi
9235     if test -z "$x_libraries"; then
9236         x_libraries="default_x_libraries"
9237     fi
9238     CFLAGS="$CFLAGS $X_CFLAGS"
9239     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9240     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9241 else
9242     x_includes="no_x_includes"
9243     x_libraries="no_x_libraries"
9246 if test "$USING_X11" = TRUE; then
9247     dnl ===================================================================
9248     dnl Check for extension headers
9249     dnl ===================================================================
9250     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9251      [#include <X11/extensions/shape.h>])
9253     # vcl needs ICE and SM
9254     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9255     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9256         [AC_MSG_ERROR(ICE library not found)])
9257     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9258     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9259         [AC_MSG_ERROR(SM library not found)])
9262 dnl ===================================================================
9263 dnl Check for system Xrender
9264 dnl ===================================================================
9265 AC_MSG_CHECKING([whether to use Xrender])
9266 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9267     AC_MSG_RESULT([yes])
9268     PKG_CHECK_MODULES(XRENDER, xrender)
9269     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9270     FilterLibs "${XRENDER_LIBS}"
9271     XRENDER_LIBS="${filteredlibs}"
9272     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9273       [AC_MSG_ERROR(libXrender not found or functional)], [])
9274     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9275       [AC_MSG_ERROR(Xrender not found. install X)], [])
9276 else
9277     AC_MSG_RESULT([no])
9279 AC_SUBST(XRENDER_CFLAGS)
9280 AC_SUBST(XRENDER_LIBS)
9282 dnl ===================================================================
9283 dnl Check for XRandr
9284 dnl ===================================================================
9285 AC_MSG_CHECKING([whether to enable RandR support])
9286 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9287     AC_MSG_RESULT([yes])
9288     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9289     if test "$ENABLE_RANDR" != "TRUE"; then
9290         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9291                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9292         XRANDR_CFLAGS=" "
9293         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9294           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9295         XRANDR_LIBS="-lXrandr "
9296         ENABLE_RANDR="TRUE"
9297     fi
9298     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9299     FilterLibs "${XRANDR_LIBS}"
9300     XRANDR_LIBS="${filteredlibs}"
9301 else
9302     ENABLE_RANDR=""
9303     AC_MSG_RESULT([no])
9305 AC_SUBST(XRANDR_CFLAGS)
9306 AC_SUBST(XRANDR_LIBS)
9307 AC_SUBST(ENABLE_RANDR)
9309 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9310     WITH_WEBDAV="serf"
9312 if test $_os = iOS -o $_os = Android; then
9313     WITH_WEBDAV="no"
9315 AC_MSG_CHECKING([for webdav library])
9316 case "$WITH_WEBDAV" in
9317 serf)
9318     AC_MSG_RESULT([serf])
9319     # Check for system apr-util
9320     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9321                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9322                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9323     if test "$COM" = "MSC"; then
9324         APR_LIB_DIR="LibR"
9325         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9326         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9327     fi
9329     # Check for system serf
9330     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9331                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9332     if test "$COM" = "MSC"; then
9333         SERF_LIB_DIR="Release"
9334         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9335         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9336     fi
9337     ;;
9338 neon)
9339     AC_MSG_RESULT([neon])
9340     # Check for system neon
9341     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9342     if test "$with_system_neon" = "yes"; then
9343         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9344     else
9345         NEON_VERSION=0295
9346     fi
9347     AC_SUBST(NEON_VERSION)
9348     ;;
9350     AC_MSG_RESULT([none, disabled])
9351     WITH_WEBDAV=""
9352     ;;
9353 esac
9354 AC_SUBST(WITH_WEBDAV)
9356 dnl ===================================================================
9357 dnl Check for disabling cve_tests
9358 dnl ===================================================================
9359 AC_MSG_CHECKING([whether to execute CVE tests])
9360 # If not explicitly enabled or disabled, default
9361 if test -z "$enable_cve_tests"; then
9362     case "$OS" in
9363     WNT)
9364         # Default cves off for windows with its wild and wonderful
9365         # varienty of AV software kicking in and panicking
9366         enable_cve_tests=no
9367         ;;
9368     *)
9369         # otherwise yes
9370         enable_cve_tests=yes
9371         ;;
9372     esac
9374 if test "$enable_cve_tests" = "no"; then
9375     AC_MSG_RESULT([no])
9376     DISABLE_CVE_TESTS=TRUE
9377     AC_SUBST(DISABLE_CVE_TESTS)
9378 else
9379     AC_MSG_RESULT([yes])
9382 dnl ===================================================================
9383 dnl Check for enabling chart XShape tests
9384 dnl ===================================================================
9385 AC_MSG_CHECKING([whether to execute chart XShape tests])
9386 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9387     AC_MSG_RESULT([yes])
9388     ENABLE_CHART_TESTS=TRUE
9389     AC_SUBST(ENABLE_CHART_TESTS)
9390 else
9391     AC_MSG_RESULT([no])
9394 dnl ===================================================================
9395 dnl Check for system openssl
9396 dnl ===================================================================
9397 DISABLE_OPENSSL=
9398 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9399 if test "$enable_openssl" = "yes"; then
9400     AC_MSG_RESULT([no])
9401     if test "$_os" = Darwin ; then
9402         # OpenSSL is deprecated when building for 10.7 or later.
9403         #
9404         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9405         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9407         with_system_openssl=no
9408         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9409     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9410             && test "$with_system_openssl" != "no"; then
9411         with_system_openssl=yes
9412         SYSTEM_OPENSSL=TRUE
9413         OPENSSL_CFLAGS=
9414         OPENSSL_LIBS="-lssl -lcrypto"
9415     else
9416         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9417     fi
9418     if test "$with_system_openssl" = "yes"; then
9419         AC_MSG_CHECKING([whether openssl supports SHA512])
9420         AC_LANG_PUSH([C])
9421         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9422             SHA512_CTX context;
9423 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9424         AC_LANG_POP(C)
9425     fi
9426 else
9427     AC_MSG_RESULT([yes])
9428     DISABLE_OPENSSL=TRUE
9430     # warn that although OpenSSL is disabled, system libraries may depend on it
9431     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9432     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9435 AC_SUBST([DISABLE_OPENSSL])
9437 dnl ===================================================================
9438 dnl Check for building gnutls
9439 dnl ===================================================================
9440 AC_MSG_CHECKING([whether to use gnutls])
9441 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9442     AC_MSG_RESULT([yes])
9443     AM_PATH_LIBGCRYPT()
9444     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9445         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9446                       available in the system to use as replacement.]]))
9447     FilterLibs "${LIBGCRYPT_LIBS}"
9448     LIBGCRYPT_LIBS="${filteredlibs}"
9449 else
9450     AC_MSG_RESULT([no])
9453 AC_SUBST([LIBGCRYPT_CFLAGS])
9454 AC_SUBST([LIBGCRYPT_LIBS])
9456 dnl ===================================================================
9457 dnl Check for system redland
9458 dnl ===================================================================
9459 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9460 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9461 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9462 if test "$with_system_redland" = "yes"; then
9463     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9464             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9465 else
9466     RAPTOR_MAJOR="0"
9467     RASQAL_MAJOR="3"
9468     REDLAND_MAJOR="0"
9470 AC_SUBST(RAPTOR_MAJOR)
9471 AC_SUBST(RASQAL_MAJOR)
9472 AC_SUBST(REDLAND_MAJOR)
9474 dnl ===================================================================
9475 dnl Check for system hunspell
9476 dnl ===================================================================
9477 AC_MSG_CHECKING([which libhunspell to use])
9478 if test "$with_system_hunspell" = "yes"; then
9479     AC_MSG_RESULT([external])
9480     SYSTEM_HUNSPELL=TRUE
9481     AC_LANG_PUSH([C++])
9482     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9483     if test "$HUNSPELL_PC" != "TRUE"; then
9484         AC_CHECK_HEADER(hunspell.hxx, [],
9485             [
9486             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9487             [AC_MSG_ERROR(hunspell headers not found.)], [])
9488             ], [])
9489         AC_CHECK_LIB([hunspell], [main], [:],
9490            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9491         HUNSPELL_LIBS=-lhunspell
9492     fi
9493     AC_LANG_POP([C++])
9494     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9495     FilterLibs "${HUNSPELL_LIBS}"
9496     HUNSPELL_LIBS="${filteredlibs}"
9497 else
9498     AC_MSG_RESULT([internal])
9499     SYSTEM_HUNSPELL=
9500     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9501     if test "$COM" = "MSC"; then
9502         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9503     else
9504         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9505     fi
9506     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9508 AC_SUBST(SYSTEM_HUNSPELL)
9509 AC_SUBST(HUNSPELL_CFLAGS)
9510 AC_SUBST(HUNSPELL_LIBS)
9512 dnl ===================================================================
9513 dnl Checking for altlinuxhyph
9514 dnl ===================================================================
9515 AC_MSG_CHECKING([which altlinuxhyph to use])
9516 if test "$with_system_altlinuxhyph" = "yes"; then
9517     AC_MSG_RESULT([external])
9518     SYSTEM_HYPH=TRUE
9519     AC_CHECK_HEADER(hyphen.h, [],
9520        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9521     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9522        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9523        [#include <hyphen.h>])
9524     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9525         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9526     if test -z "$HYPHEN_LIB"; then
9527         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9528            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9529     fi
9530     if test -z "$HYPHEN_LIB"; then
9531         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9532            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9533     fi
9534 else
9535     AC_MSG_RESULT([internal])
9536     SYSTEM_HYPH=
9537     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9538     if test "$COM" = "MSC"; then
9539         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9540     else
9541         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9542     fi
9544 AC_SUBST(SYSTEM_HYPH)
9545 AC_SUBST(HYPHEN_LIB)
9547 dnl ===================================================================
9548 dnl Checking for mythes
9549 dnl ===================================================================
9550 AC_MSG_CHECKING([which mythes to use])
9551 if test "$with_system_mythes" = "yes"; then
9552     AC_MSG_RESULT([external])
9553     SYSTEM_MYTHES=TRUE
9554     AC_LANG_PUSH([C++])
9555     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9556     if test "$MYTHES_PKGCONFIG" = "no"; then
9557         AC_CHECK_HEADER(mythes.hxx, [],
9558             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9559         AC_CHECK_LIB([mythes-1.2], [main], [:],
9560             [ MYTHES_FOUND=no], [])
9561     if test "$MYTHES_FOUND" = "no"; then
9562         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9563                 [ MYTHES_FOUND=no], [])
9564     fi
9565     if test "$MYTHES_FOUND" = "no"; then
9566         AC_MSG_ERROR([mythes library not found!.])
9567     fi
9568     fi
9569     AC_LANG_POP([C++])
9570     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9571     FilterLibs "${MYTHES_LIBS}"
9572     MYTHES_LIBS="${filteredlibs}"
9573 else
9574     AC_MSG_RESULT([internal])
9575     SYSTEM_MYTHES=
9576     BUILD_TYPE="$BUILD_TYPE MYTHES"
9577     if test "$COM" = "MSC"; then
9578         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9579     else
9580         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9581     fi
9583 AC_SUBST(SYSTEM_MYTHES)
9584 AC_SUBST(MYTHES_CFLAGS)
9585 AC_SUBST(MYTHES_LIBS)
9587 dnl ===================================================================
9588 dnl How should we build the linear programming solver ?
9589 dnl ===================================================================
9591 ENABLE_COINMP=
9592 AC_MSG_CHECKING([whether to build with CoinMP])
9593 if test "$enable_coinmp" != "no"; then
9594     ENABLE_COINMP=TRUE
9595     AC_MSG_RESULT([yes])
9596     if test "$with_system_coinmp" = "yes"; then
9597         SYSTEM_COINMP=TRUE
9598         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9599         FilterLibs "${COINMP_LIBS}"
9600         COINMP_LIBS="${filteredlibs}"
9601     else
9602         BUILD_TYPE="$BUILD_TYPE COINMP"
9603     fi
9604 else
9605     AC_MSG_RESULT([no])
9607 AC_SUBST(ENABLE_COINMP)
9608 AC_SUBST(SYSTEM_COINMP)
9609 AC_SUBST(COINMP_CFLAGS)
9610 AC_SUBST(COINMP_LIBS)
9612 ENABLE_LPSOLVE=
9613 AC_MSG_CHECKING([whether to build with lpsolve])
9614 if test "$enable_lpsolve" != "no"; then
9615     ENABLE_LPSOLVE=TRUE
9616     AC_MSG_RESULT([yes])
9617 else
9618     AC_MSG_RESULT([no])
9620 AC_SUBST(ENABLE_LPSOLVE)
9622 if test "$ENABLE_LPSOLVE" = TRUE; then
9623     AC_MSG_CHECKING([which lpsolve to use])
9624     if test "$with_system_lpsolve" = "yes"; then
9625         AC_MSG_RESULT([external])
9626         SYSTEM_LPSOLVE=TRUE
9627         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9628            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9629         save_LIBS=$LIBS
9630         # some systems need this. Like Ubuntu....
9631         AC_CHECK_LIB(m, floor)
9632         AC_CHECK_LIB(dl, dlopen)
9633         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9634             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9635         LIBS=$save_LIBS
9636     else
9637         AC_MSG_RESULT([internal])
9638         SYSTEM_LPSOLVE=
9639         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9640     fi
9642 AC_SUBST(SYSTEM_LPSOLVE)
9644 dnl ===================================================================
9645 dnl Checking for libexttextcat
9646 dnl ===================================================================
9647 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9648 if test "$with_system_libexttextcat" = "yes"; then
9649     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9651 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9653 dnl ***************************************
9654 dnl testing libc version for Linux...
9655 dnl ***************************************
9656 if test "$_os" = "Linux"; then
9657     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9658     exec 6>/dev/null # no output
9659     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9660     exec 6>&1 # output on again
9661     if test "$HAVE_LIBC"; then
9662         AC_MSG_RESULT([yes])
9663     else
9664         AC_MSG_ERROR([no, upgrade libc])
9665     fi
9668 dnl =========================================
9669 dnl Check for uuidgen
9670 dnl =========================================
9671 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9672     # presence is already tested above in the WINDOWS_SDK_HOME check
9673     UUIDGEN=uuidgen.exe
9674     AC_SUBST(UUIDGEN)
9675 else
9676     AC_PATH_PROG([UUIDGEN], [uuidgen])
9677     if test -z "$UUIDGEN"; then
9678         AC_MSG_WARN([uuid is needed for building installation sets])
9679     fi
9682 dnl ***************************************
9683 dnl Checking for bison and flex
9684 dnl ***************************************
9685 AC_PATH_PROG(BISON, bison)
9686 if test -z "$BISON"; then
9687     AC_MSG_ERROR([no bison found in \$PATH, install it])
9688 else
9689     AC_MSG_CHECKING([the bison version])
9690     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9691     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9692     # Accept newer than 2.0
9693     if test "$_bison_longver" -lt 2000; then
9694         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9695     fi
9698 AC_PATH_PROG(FLEX, flex)
9699 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9700     FLEX=`cygpath -m $FLEX`
9702 if test -z "$FLEX"; then
9703     AC_MSG_ERROR([no flex found in \$PATH, install it])
9704 else
9705     AC_MSG_CHECKING([the flex version])
9706     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9707     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9708         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9709     fi
9711 AC_SUBST([FLEX])
9712 dnl ***************************************
9713 dnl Checking for patch
9714 dnl ***************************************
9715 AC_PATH_PROG(PATCH, patch)
9716 if test -z "$PATCH"; then
9717     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9720 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9721 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9722     if test -z "$with_gnu_patch"; then
9723         GNUPATCH=$PATCH
9724     else
9725         if test -x "$with_gnu_patch"; then
9726             GNUPATCH=$with_gnu_patch
9727         else
9728             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9729         fi
9730     fi
9732     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9733     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9734         AC_MSG_RESULT([yes])
9735     else
9736         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9737     fi
9738 else
9739     GNUPATCH=$PATCH
9742 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9743     GNUPATCH=`cygpath -m $GNUPATCH`
9746 dnl We also need to check for --with-gnu-cp
9748 if test -z "$with_gnu_cp"; then
9749     # check the place where the good stuff is hidden on Solaris...
9750     if test -x /usr/gnu/bin/cp; then
9751         GNUCP=/usr/gnu/bin/cp
9752     else
9753         AC_PATH_PROGS(GNUCP, gnucp cp)
9754     fi
9755     if test -z $GNUCP; then
9756         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9757     fi
9758 else
9759     if test -x "$with_gnu_cp"; then
9760         GNUCP=$with_gnu_cp
9761     else
9762         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9763     fi
9766 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9767     GNUCP=`cygpath -m $GNUCP`
9770 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9771 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9772     AC_MSG_RESULT([yes])
9773 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9774     AC_MSG_RESULT([yes])
9775 else
9776     case "$build_os" in
9777     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9778         x_GNUCP=[\#]
9779         GNUCP=''
9780         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9781         ;;
9782     *)
9783         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9784         ;;
9785     esac
9788 AC_SUBST(GNUPATCH)
9789 AC_SUBST(GNUCP)
9790 AC_SUBST(x_GNUCP)
9792 dnl ***************************************
9793 dnl testing assembler path
9794 dnl ***************************************
9795 ML_EXE=""
9796 if test "$_os" = "WINNT"; then
9797     if test "$BITNESS_OVERRIDE" = ""; then
9798         assembler=ml.exe
9799         assembler_bin=$CL_DIR
9800     else
9801         assembler=ml64.exe
9802         assembler_bin=$CL_DIR
9803     fi
9805     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9806     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9807         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9808         AC_MSG_RESULT([found])
9809         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9810     else
9811         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9812     fi
9814     PathFormat "$ASM_HOME"
9815     ASM_HOME="$formatted_path"
9816 else
9817     ASM_HOME=""
9820 AC_SUBST(ML_EXE)
9822 dnl ===================================================================
9823 dnl We need zip and unzip
9824 dnl ===================================================================
9825 AC_PATH_PROG(ZIP, zip)
9826 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9827 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9828     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],,)
9831 AC_PATH_PROG(UNZIP, unzip)
9832 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9834 dnl ===================================================================
9835 dnl Zip must be a specific type for different build types.
9836 dnl ===================================================================
9837 if test $build_os = cygwin; then
9838     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9839         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9840     fi
9843 dnl ===================================================================
9844 dnl We need touch with -h option support.
9845 dnl ===================================================================
9846 AC_PATH_PROG(TOUCH, touch)
9847 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9848 touch warn
9849 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9850     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],,)
9853 dnl ===================================================================
9854 dnl Check for system epoxy
9855 dnl ===================================================================
9856 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9858 dnl ===================================================================
9859 dnl Set vcl option: coordinate device in double or sal_Int32
9860 dnl ===================================================================
9862 dnl disabled for now, we don't want subtle differences between OSs
9863 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9864 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9865 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9866 dnl     AC_MSG_RESULT([double])
9867 dnl else
9868 dnl     AC_MSG_RESULT([sal_Int32])
9869 dnl fi
9871 dnl ===================================================================
9872 dnl Test which vclplugs have to be built.
9873 dnl ===================================================================
9874 R=""
9875 if test "$USING_X11" != TRUE; then
9876     enable_gtk=no
9877     enable_gtk3=no
9879 GTK3_CFLAGS=""
9880 GTK3_LIBS=""
9881 ENABLE_GTK3=""
9882 if test "x$enable_gtk3" = "xyes"; then
9883     if test "$with_system_cairo" = no; then
9884         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9885     fi
9886     : ${with_system_cairo:=yes}
9887     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.18 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
9888     if test "x$ENABLE_GTK3" = "xTRUE"; then
9889         R="gtk3"
9890         dnl Avoid installed by unpackaged files for now.
9891         if test -z "$PKGFORMAT"; then
9892             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9893         fi
9894     else
9895         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9896     fi
9897     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9898     FilterLibs "${GTK3_LIBS}"
9899     GTK3_LIBS="${filteredlibs}"
9901     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
9902     if test "$with_system_epoxy" != "yes"; then
9903         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
9904         AC_CHECK_HEADER(EGL/eglplatform.h, [],
9905                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
9906     fi
9908 AC_SUBST(GTK3_LIBS)
9909 AC_SUBST(GTK3_CFLAGS)
9910 AC_SUBST(ENABLE_GTK3)
9912 ENABLE_GTK=""
9913 if test "x$enable_gtk" = "xyes"; then
9914     if test "$with_system_cairo" = no; then
9915         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
9916     fi
9917     : ${with_system_cairo:=yes}
9918     ENABLE_GTK="TRUE"
9919     AC_DEFINE(ENABLE_GTK)
9920     R="gtk $R"
9922 AC_SUBST(ENABLE_GTK)
9924 ENABLE_KDE4=""
9925 if test "x$enable_kde4" = "xyes"; then
9926     ENABLE_KDE4="TRUE"
9927     AC_DEFINE(ENABLE_KDE4)
9928     R="$R kde4"
9930 AC_SUBST(ENABLE_KDE4)
9932 ENABLE_QT5=""
9933 if test "x$enable_qt5" = "xyes"; then
9934     ENABLE_QT5="TRUE"
9935     AC_DEFINE(ENABLE_QT5)
9936     R="$R qt5"
9938 AC_SUBST(ENABLE_QT5)
9940 ENABLE_KDE5=""
9941 if test "x$enable_kde5" = "xyes"; then
9942     ENABLE_KDE5="TRUE"
9943     AC_DEFINE(ENABLE_KDE5)
9944     R="$R kde5"
9946 AC_SUBST(ENABLE_KDE5)
9948 ENABLE_GTK3_KDE5=""
9949 if test "x$enable_gtk3_kde5" = "xyes"; then
9950     ENABLE_GTK3_KDE5="TRUE"
9951     AC_DEFINE(ENABLE_GTK3_KDE5)
9952     R="$R gtk3_kde5"
9954 AC_SUBST(ENABLE_GTK3_KDE5)
9956 build_vcl_plugins="$R"
9957 if test -z "$build_vcl_plugins"; then
9958     build_vcl_plugins="none"
9960 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
9962 dnl ===================================================================
9963 dnl check for dbus support
9964 dnl ===================================================================
9965 ENABLE_DBUS=""
9966 DBUS_CFLAGS=""
9967 DBUS_LIBS=""
9969 if test "$enable_dbus" = "no"; then
9970     test_dbus=no
9973 AC_MSG_CHECKING([whether to enable DBUS support])
9974 if test "$test_dbus" = "yes"; then
9975     ENABLE_DBUS="TRUE"
9976     AC_MSG_RESULT([yes])
9977     PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70)
9978     AC_DEFINE(ENABLE_DBUS)
9979     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9980     FilterLibs "${DBUS_LIBS}"
9981     DBUS_LIBS="${filteredlibs}"
9982 else
9983     AC_MSG_RESULT([no])
9986 AC_SUBST(ENABLE_DBUS)
9987 AC_SUBST(DBUS_CFLAGS)
9988 AC_SUBST(DBUS_LIBS)
9990 AC_MSG_CHECKING([whether to enable Impress remote control])
9991 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
9992     AC_MSG_RESULT([yes])
9993     ENABLE_SDREMOTE=TRUE
9994     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
9996     # If not explicitly enabled or disabled, default
9997     if test -z "$enable_sdremote_bluetooth"; then
9998         case "$OS" in
9999         LINUX|MACOSX|WNT)
10000             # Default to yes for these
10001             enable_sdremote_bluetooth=yes
10002             ;;
10003         *)
10004             # otherwise no
10005             enable_sdremote_bluetooth=no
10006             ;;
10007         esac
10008     fi
10009     # $enable_sdremote_bluetooth is guaranteed non-empty now
10011     if test "$enable_sdremote_bluetooth" != "no"; then
10012         if test "$OS" = "LINUX"; then
10013             if test "$ENABLE_DBUS" = "TRUE"; then
10014                 AC_MSG_RESULT([yes])
10015                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10016                 dnl ===================================================================
10017                 dnl Check for system bluez
10018                 dnl ===================================================================
10019                 AC_MSG_CHECKING([which Bluetooth header to use])
10020                 if test "$with_system_bluez" = "yes"; then
10021                     AC_MSG_RESULT([external])
10022                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10023                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10024                     SYSTEM_BLUEZ=TRUE
10025                 else
10026                     AC_MSG_RESULT([internal])
10027                     SYSTEM_BLUEZ=
10028                 fi
10029             else
10030                 AC_MSG_RESULT([no, dbus disabled])
10031                 ENABLE_SDREMOTE_BLUETOOTH=
10032                 SYSTEM_BLUEZ=
10033             fi
10034         else
10035             AC_MSG_RESULT([yes])
10036             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10037             SYSTEM_BLUEZ=
10038         fi
10039     else
10040         AC_MSG_RESULT([no])
10041         ENABLE_SDREMOTE_BLUETOOTH=
10042         SYSTEM_BLUEZ=
10043     fi
10044 else
10045     ENABLE_SDREMOTE=
10046     SYSTEM_BLUEZ=
10047     AC_MSG_RESULT([no])
10049 AC_SUBST(ENABLE_SDREMOTE)
10050 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10051 AC_SUBST(SYSTEM_BLUEZ)
10053 dnl ===================================================================
10054 dnl Check whether the gtk 2.0 libraries are available.
10055 dnl ===================================================================
10057 GTK_CFLAGS=""
10058 GTK_LIBS=""
10059 ENABLE_SYSTRAY_GTK=""
10060 if test  "$test_gtk" = "yes"; then
10062     if test "$ENABLE_GTK" = "TRUE"; then
10063         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]))
10064         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10065         FilterLibs "${GTK_LIBS}"
10066         GTK_LIBS="${filteredlibs}"
10067         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]))
10068         BUILD_TYPE="$BUILD_TYPE GTK"
10069         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10070         FilterLibs "${GTHREAD_LIBS}"
10071         GTHREAD_LIBS="${filteredlibs}"
10073         if test "x$enable_systray" = "xyes"; then
10074             ENABLE_SYSTRAY_GTK="TRUE"
10075         fi
10077         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10078         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10079                           [ENABLE_GTK_PRINT="TRUE"],
10080                           [ENABLE_GTK_PRINT=""])
10081         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10082         FilterLibs "${GTK_PRINT_LIBS}"
10083         GTK_PRINT_LIBS="${filteredlibs}"
10085         AC_MSG_CHECKING([whether to enable GIO support])
10086         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10087             dnl Need at least 2.26 for the dbus support.
10088             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10089                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10090             if test "$ENABLE_GIO" = "TRUE"; then
10091                 AC_DEFINE(ENABLE_GIO)
10092                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10093                 FilterLibs "${GIO_LIBS}"
10094                 GIO_LIBS="${filteredlibs}"
10095             fi
10096         else
10097             AC_MSG_RESULT([no])
10098         fi
10099     fi
10101 AC_SUBST(ENABLE_GIO)
10102 AC_SUBST(GIO_CFLAGS)
10103 AC_SUBST(GIO_LIBS)
10104 AC_SUBST(ENABLE_SYSTRAY_GTK)
10105 AC_SUBST(GTK_CFLAGS)
10106 AC_SUBST(GTK_LIBS)
10107 AC_SUBST(GTHREAD_CFLAGS)
10108 AC_SUBST(GTHREAD_LIBS)
10109 AC_SUBST([ENABLE_GTK_PRINT])
10110 AC_SUBST([GTK_PRINT_CFLAGS])
10111 AC_SUBST([GTK_PRINT_LIBS])
10114 dnl ===================================================================
10116 SPLIT_APP_MODULES=""
10117 if test "$enable_split_app_modules" = "yes"; then
10118     SPLIT_APP_MODULES="TRUE"
10120 AC_SUBST(SPLIT_APP_MODULES)
10122 SPLIT_OPT_FEATURES=""
10123 if test "$enable_split_opt_features" = "yes"; then
10124     SPLIT_OPT_FEATURES="TRUE"
10126 AC_SUBST(SPLIT_OPT_FEATURES)
10128 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10129     if test "$enable_cairo_canvas" = yes; then
10130         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10131     fi
10132     enable_cairo_canvas=no
10133 elif test -z "$enable_cairo_canvas"; then
10134     enable_cairo_canvas=yes
10137 ENABLE_CAIRO_CANVAS=""
10138 if test "$enable_cairo_canvas" = "yes"; then
10139     test_cairo=yes
10140     ENABLE_CAIRO_CANVAS="TRUE"
10141     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10143 AC_SUBST(ENABLE_CAIRO_CANVAS)
10145 dnl ===================================================================
10146 dnl Check whether the GStreamer libraries are available.
10147 dnl It's possible to build avmedia with both GStreamer backends!
10148 dnl ===================================================================
10150 ENABLE_GSTREAMER_1_0=""
10152 if test "$build_gstreamer_1_0" = "yes"; then
10154     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10155     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10156         ENABLE_GSTREAMER_1_0="TRUE"
10157         AC_MSG_RESULT([yes])
10158         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10159         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10160         FilterLibs "${GSTREAMER_1_0_LIBS}"
10161         GSTREAMER_1_0_LIBS="${filteredlibs}"
10162     else
10163         AC_MSG_RESULT([no])
10164     fi
10166 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10167 AC_SUBST(GSTREAMER_1_0_LIBS)
10168 AC_SUBST(ENABLE_GSTREAMER_1_0)
10171 ENABLE_GSTREAMER_0_10=""
10172 if test "$build_gstreamer_0_10" = "yes"; then
10174     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10175     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10176         ENABLE_GSTREAMER_0_10="TRUE"
10177         AC_MSG_RESULT([yes])
10178         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10179             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10180         ])
10181         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10182         FilterLibs "${GSTREAMER_0_10_LIBS}"
10183         GSTREAMER_0_10_LIBS="${filteredlibs}"
10184     else
10185         AC_MSG_RESULT([no])
10186     fi
10189 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10190 AC_SUBST(GSTREAMER_0_10_LIBS)
10191 AC_SUBST(ENABLE_GSTREAMER_0_10)
10193 dnl ===================================================================
10194 dnl Check whether to build the VLC avmedia backend
10195 dnl ===================================================================
10197 ENABLE_VLC=""
10199 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10200 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10201     ENABLE_VLC="TRUE"
10202     AC_MSG_RESULT([yes])
10203 else
10204     AC_MSG_RESULT([no])
10206 AC_SUBST(ENABLE_VLC)
10208 ENABLE_OPENGL_TRANSITIONS=
10209 ENABLE_OPENGL_CANVAS=
10210 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10211    : # disable
10212 elif test "$_os" = "Darwin"; then
10213     # We use frameworks on Mac OS X, no need for detail checks
10214     ENABLE_OPENGL_TRANSITIONS=TRUE
10215     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10216     ENABLE_OPENGL_CANVAS=TRUE
10217 elif test $_os = WINNT; then
10218     ENABLE_OPENGL_TRANSITIONS=TRUE
10219     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10220     ENABLE_OPENGL_CANVAS=TRUE
10221 else
10222     if test "$USING_X11" = TRUE; then
10223         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10224         ENABLE_OPENGL_TRANSITIONS=TRUE
10225         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10226         ENABLE_OPENGL_CANVAS=TRUE
10227     fi
10230 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10231 AC_SUBST(ENABLE_OPENGL_CANVAS)
10233 dnl =================================================
10234 dnl Check whether to build with OpenCL support.
10235 dnl =================================================
10237 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10238     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10239     # platform (optional at run-time, used through clew).
10240     BUILD_TYPE="$BUILD_TYPE OPENCL"
10241     AC_DEFINE(HAVE_FEATURE_OPENCL)
10244 dnl =================================================
10245 dnl Check whether to build with dconf support.
10246 dnl =================================================
10248 if test "$enable_dconf" != no; then
10249     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10250         if test "$enable_dconf" = yes; then
10251             AC_MSG_ERROR([dconf not found])
10252         else
10253             enable_dconf=no
10254         fi])
10256 AC_MSG_CHECKING([whether to enable dconf])
10257 if test "$enable_dconf" = no; then
10258     DCONF_CFLAGS=
10259     DCONF_LIBS=
10260     ENABLE_DCONF=
10261     AC_MSG_RESULT([no])
10262 else
10263     ENABLE_DCONF=TRUE
10264     AC_DEFINE(ENABLE_DCONF)
10265     AC_MSG_RESULT([yes])
10267 AC_SUBST([DCONF_CFLAGS])
10268 AC_SUBST([DCONF_LIBS])
10269 AC_SUBST([ENABLE_DCONF])
10271 # pdf import?
10272 AC_MSG_CHECKING([whether to build the PDF import feature])
10273 ENABLE_PDFIMPORT=
10274 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10275     AC_MSG_RESULT([yes])
10276     ENABLE_PDFIMPORT=TRUE
10277     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10279     dnl ===================================================================
10280     dnl Check for system poppler
10281     dnl ===================================================================
10282     AC_MSG_CHECKING([which PDF import backend to use])
10283     if test "$with_system_poppler" = "yes"; then
10284         AC_MSG_RESULT([external])
10285         SYSTEM_POPPLER=TRUE
10286         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10287         AC_LANG_PUSH([C++])
10288         save_CXXFLAGS=$CXXFLAGS
10289         save_CPPFLAGS=$CPPFLAGS
10290         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10291         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10292         AC_CHECK_HEADER([cpp/poppler-version.h],
10293             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10294             [])
10295         CXXFLAGS=$save_CXXFLAGS
10296         CPPFLAGS=$save_CPPFLAGS
10297         AC_LANG_POP([C++])
10298         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10300         FilterLibs "${POPPLER_LIBS}"
10301         POPPLER_LIBS="${filteredlibs}"
10302     else
10303         AC_MSG_RESULT([internal])
10304         SYSTEM_POPPLER=
10305         BUILD_TYPE="$BUILD_TYPE POPPLER"
10306         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10307     fi
10308     AC_DEFINE([ENABLE_PDFIMPORT],1)
10309 else
10310     AC_MSG_RESULT([no])
10312 AC_SUBST(ENABLE_PDFIMPORT)
10313 AC_SUBST(SYSTEM_POPPLER)
10314 AC_SUBST(POPPLER_CFLAGS)
10315 AC_SUBST(POPPLER_LIBS)
10317 # pdf import?
10318 AC_MSG_CHECKING([whether to build PDFium])
10319 ENABLE_PDFIUM=
10320 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10321     AC_MSG_RESULT([yes])
10322     ENABLE_PDFIUM=TRUE
10323     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10324     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10325 else
10326     AC_MSG_RESULT([no])
10328 AC_SUBST(ENABLE_PDFIUM)
10330 SYSTEM_GPGMEPP=
10332 if test "$build_for_ios" = "YES"; then
10333     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10334     AC_MSG_RESULT([yes])
10335 elif test "$enable_mpl_subset" = "yes"; then
10336     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10337     AC_MSG_RESULT([yes])
10338 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10339     dnl ===================================================================
10340     dnl Check for system gpgme
10341     dnl ===================================================================
10342     AC_MSG_CHECKING([which gpgmepp to use])
10343     if test "$with_system_gpgmepp" = "yes"; then
10344         AC_MSG_RESULT([external])
10345         SYSTEM_GPGMEPP=TRUE
10347         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10348         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10349             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10350         # progress_callback is the only func with plain C linkage
10351         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10352         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10353             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10354         AC_CHECK_HEADER(gpgme.h, [],
10355             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10356     else
10357         AC_MSG_RESULT([internal])
10358         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10359         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10361         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10362         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10363         if test "$_os" != "WINNT"; then
10364             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10365             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10366         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10367             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10368         fi
10369     fi
10370     ENABLE_GPGMEPP=TRUE
10371     AC_DEFINE([HAVE_FEATURE_GPGME])
10372     AC_PATH_PROG(GPG, gpg)
10373     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10374     # so let's exclude that manually for the moment
10375     if test -n "$GPG" -a "$_os" != "WINNT"; then
10376         # make sure we not only have a working gpgme, but a full working
10377         # gpg installation to run OpenPGP signature verification
10378         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10379     fi
10380     if test "$_os" = "Linux"; then
10381       uid=`id -u`
10382       AC_MSG_CHECKING([for /run/user/$uid])
10383       if test -d /run/user/$uid; then
10384         AC_MSG_RESULT([yes])
10385         AC_PATH_PROG(GPGCONF, gpgconf)
10386         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10387         if $GPGCONF --dump-options > /dev/null ; then
10388           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10389             AC_MSG_RESULT([yes])
10390             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10391           else
10392             AC_MSG_RESULT([no])
10393           fi
10394         else
10395           AC_MSG_RESULT([no. missing or broken gpgconf?])
10396         fi
10397       else
10398         AC_MSG_RESULT([no])
10399      fi
10400    fi
10402 AC_SUBST(ENABLE_GPGMEPP)
10403 AC_SUBST(SYSTEM_GPGMEPP)
10404 AC_SUBST(GPG_ERROR_CFLAGS)
10405 AC_SUBST(GPG_ERROR_LIBS)
10406 AC_SUBST(LIBASSUAN_CFLAGS)
10407 AC_SUBST(LIBASSUAN_LIBS)
10408 AC_SUBST(GPGMEPP_CFLAGS)
10409 AC_SUBST(GPGMEPP_LIBS)
10410 AC_SUBST(GPGCONF)
10411 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10413 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10414 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10415     AC_MSG_RESULT([yes])
10416     ENABLE_MEDIAWIKI=TRUE
10417     BUILD_TYPE="$BUILD_TYPE XSLTML"
10418     if test  "x$with_java" = "xno"; then
10419         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10420     fi
10421 else
10422     AC_MSG_RESULT([no])
10423     ENABLE_MEDIAWIKI=
10424     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10426 AC_SUBST(ENABLE_MEDIAWIKI)
10428 AC_MSG_CHECKING([whether to build the Report Builder])
10429 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10430     AC_MSG_RESULT([yes])
10431     ENABLE_REPORTBUILDER=TRUE
10432     AC_MSG_CHECKING([which jfreereport libs to use])
10433     if test "$with_system_jfreereport" = "yes"; then
10434         SYSTEM_JFREEREPORT=TRUE
10435         AC_MSG_RESULT([external])
10436         if test -z $SAC_JAR; then
10437             SAC_JAR=/usr/share/java/sac.jar
10438         fi
10439         if ! test -f $SAC_JAR; then
10440              AC_MSG_ERROR(sac.jar not found.)
10441         fi
10443         if test -z $LIBXML_JAR; then
10444             if test -f /usr/share/java/libxml-1.0.0.jar; then
10445                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10446             elif test -f /usr/share/java/libxml.jar; then
10447                 LIBXML_JAR=/usr/share/java/libxml.jar
10448             else
10449                 AC_MSG_ERROR(libxml.jar replacement not found.)
10450             fi
10451         elif ! test -f $LIBXML_JAR; then
10452             AC_MSG_ERROR(libxml.jar not found.)
10453         fi
10455         if test -z $FLUTE_JAR; then
10456             if test -f/usr/share/java/flute-1.3.0.jar; then
10457                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10458             elif test -f /usr/share/java/flute.jar; then
10459                 FLUTE_JAR=/usr/share/java/flute.jar
10460             else
10461                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10462             fi
10463         elif ! test -f $FLUTE_JAR; then
10464             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10465         fi
10467         if test -z $JFREEREPORT_JAR; then
10468             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10469                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10470             elif test -f /usr/share/java/flow-engine.jar; then
10471                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10472             else
10473                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10474             fi
10475         elif ! test -f  $JFREEREPORT_JAR; then
10476                 AC_MSG_ERROR(jfreereport.jar not found.)
10477         fi
10479         if test -z $LIBLAYOUT_JAR; then
10480             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10481                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10482             elif test -f /usr/share/java/liblayout.jar; then
10483                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10484             else
10485                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10486             fi
10487         elif ! test -f $LIBLAYOUT_JAR; then
10488                 AC_MSG_ERROR(liblayout.jar not found.)
10489         fi
10491         if test -z $LIBLOADER_JAR; then
10492             if test -f /usr/share/java/libloader-1.0.0.jar; then
10493                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10494             elif test -f /usr/share/java/libloader.jar; then
10495                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10496             else
10497                 AC_MSG_ERROR(libloader.jar replacement not found.)
10498             fi
10499         elif ! test -f  $LIBLOADER_JAR; then
10500             AC_MSG_ERROR(libloader.jar not found.)
10501         fi
10503         if test -z $LIBFORMULA_JAR; then
10504             if test -f /usr/share/java/libformula-0.2.0.jar; then
10505                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10506             elif test -f /usr/share/java/libformula.jar; then
10507                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10508             else
10509                 AC_MSG_ERROR(libformula.jar replacement not found.)
10510             fi
10511         elif ! test -f $LIBFORMULA_JAR; then
10512                 AC_MSG_ERROR(libformula.jar not found.)
10513         fi
10515         if test -z $LIBREPOSITORY_JAR; then
10516             if test -f /usr/share/java/librepository-1.0.0.jar; then
10517                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10518             elif test -f /usr/share/java/librepository.jar; then
10519                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10520             else
10521                 AC_MSG_ERROR(librepository.jar replacement not found.)
10522             fi
10523         elif ! test -f $LIBREPOSITORY_JAR; then
10524             AC_MSG_ERROR(librepository.jar not found.)
10525         fi
10527         if test -z $LIBFONTS_JAR; then
10528             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10529                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10530             elif test -f /usr/share/java/libfonts.jar; then
10531                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10532             else
10533                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10534             fi
10535         elif ! test -f $LIBFONTS_JAR; then
10536                 AC_MSG_ERROR(libfonts.jar not found.)
10537         fi
10539         if test -z $LIBSERIALIZER_JAR; then
10540             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10541                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10542             elif test -f /usr/share/java/libserializer.jar; then
10543                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10544             else
10545                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10546             fi
10547         elif ! test -f $LIBSERIALIZER_JAR; then
10548                 AC_MSG_ERROR(libserializer.jar not found.)
10549         fi
10551         if test -z $LIBBASE_JAR; then
10552             if test -f /usr/share/java/libbase-1.0.0.jar; then
10553                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10554             elif test -f /usr/share/java/libbase.jar; then
10555                 LIBBASE_JAR=/usr/share/java/libbase.jar
10556             else
10557                 AC_MSG_ERROR(libbase.jar replacement not found.)
10558             fi
10559         elif ! test -f $LIBBASE_JAR; then
10560             AC_MSG_ERROR(libbase.jar not found.)
10561         fi
10563     else
10564         AC_MSG_RESULT([internal])
10565         SYSTEM_JFREEREPORT=
10566         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10567     fi
10568 else
10569     AC_MSG_RESULT([no])
10570     ENABLE_REPORTBUILDER=
10571     SYSTEM_JFREEREPORT=
10573 AC_SUBST(ENABLE_REPORTBUILDER)
10574 AC_SUBST(SYSTEM_JFREEREPORT)
10575 AC_SUBST(SAC_JAR)
10576 AC_SUBST(LIBXML_JAR)
10577 AC_SUBST(FLUTE_JAR)
10578 AC_SUBST(JFREEREPORT_JAR)
10579 AC_SUBST(LIBBASE_JAR)
10580 AC_SUBST(LIBLAYOUT_JAR)
10581 AC_SUBST(LIBLOADER_JAR)
10582 AC_SUBST(LIBFORMULA_JAR)
10583 AC_SUBST(LIBREPOSITORY_JAR)
10584 AC_SUBST(LIBFONTS_JAR)
10585 AC_SUBST(LIBSERIALIZER_JAR)
10587 # this has to be here because both the Wiki Publisher and the SRB use
10588 # commons-logging
10589 COMMONS_LOGGING_VERSION=1.2
10590 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10591     AC_MSG_CHECKING([which Apache commons-* libs to use])
10592     if test "$with_system_apache_commons" = "yes"; then
10593         SYSTEM_APACHE_COMMONS=TRUE
10594         AC_MSG_RESULT([external])
10595         if test -z $COMMONS_LOGGING_JAR; then
10596             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10597                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10598            elif test -f /usr/share/java/commons-logging.jar; then
10599                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10600             else
10601                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10602             fi
10603         elif ! test -f $COMMONS_LOGGING_JAR; then
10604             AC_MSG_ERROR(commons-logging.jar not found.)
10605         fi
10606     else
10607         AC_MSG_RESULT([internal])
10608         SYSTEM_APACHE_COMMONS=
10609         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10610     fi
10612 AC_SUBST(SYSTEM_APACHE_COMMONS)
10613 AC_SUBST(COMMONS_LOGGING_JAR)
10614 AC_SUBST(COMMONS_LOGGING_VERSION)
10616 # scripting provider for BeanShell?
10617 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10618 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10619     AC_MSG_RESULT([yes])
10620     ENABLE_SCRIPTING_BEANSHELL=TRUE
10622     dnl ===================================================================
10623     dnl Check for system beanshell
10624     dnl ===================================================================
10625     AC_MSG_CHECKING([which beanshell to use])
10626     if test "$with_system_beanshell" = "yes"; then
10627         AC_MSG_RESULT([external])
10628         SYSTEM_BSH=TRUE
10629         if test -z $BSH_JAR; then
10630             BSH_JAR=/usr/share/java/bsh.jar
10631         fi
10632         if ! test -f $BSH_JAR; then
10633             AC_MSG_ERROR(bsh.jar not found.)
10634         fi
10635     else
10636         AC_MSG_RESULT([internal])
10637         SYSTEM_BSH=
10638         BUILD_TYPE="$BUILD_TYPE BSH"
10639     fi
10640 else
10641     AC_MSG_RESULT([no])
10642     ENABLE_SCRIPTING_BEANSHELL=
10643     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10645 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10646 AC_SUBST(SYSTEM_BSH)
10647 AC_SUBST(BSH_JAR)
10649 # scripting provider for JavaScript?
10650 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10651 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10652     AC_MSG_RESULT([yes])
10653     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10655     dnl ===================================================================
10656     dnl Check for system rhino
10657     dnl ===================================================================
10658     AC_MSG_CHECKING([which rhino to use])
10659     if test "$with_system_rhino" = "yes"; then
10660         AC_MSG_RESULT([external])
10661         SYSTEM_RHINO=TRUE
10662         if test -z $RHINO_JAR; then
10663             RHINO_JAR=/usr/share/java/js.jar
10664         fi
10665         if ! test -f $RHINO_JAR; then
10666             AC_MSG_ERROR(js.jar not found.)
10667         fi
10668     else
10669         AC_MSG_RESULT([internal])
10670         SYSTEM_RHINO=
10671         BUILD_TYPE="$BUILD_TYPE RHINO"
10672     fi
10673 else
10674     AC_MSG_RESULT([no])
10675     ENABLE_SCRIPTING_JAVASCRIPT=
10676     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10678 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10679 AC_SUBST(SYSTEM_RHINO)
10680 AC_SUBST(RHINO_JAR)
10682 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10683 # paths should be added to library search path. So lets put all 64-bit
10684 # platforms there.
10685 supports_multilib=
10686 case "$host_cpu" in
10687 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10688     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10689         supports_multilib="yes"
10690     fi
10691     ;;
10693     ;;
10694 esac
10696 dnl ===================================================================
10697 dnl KDE4 Integration
10698 dnl ===================================================================
10700 KDE4_CFLAGS=""
10701 KDE4_LIBS=""
10702 QMAKE4="qmake"
10703 MOC4="moc"
10704 KDE4_GLIB_CFLAGS=""
10705 KDE4_GLIB_LIBS=""
10706 KDE4_HAVE_GLIB=""
10707 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10708     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10709     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10711     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10712     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10714     if test -n "$supports_multilib"; then
10715         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10716         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10717     fi
10719     if test -n "$QTDIR"; then
10720         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10721         if test -z "$supports_multilib"; then
10722             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10723         else
10724             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10725         fi
10726     fi
10727     if test -n "$QT4DIR"; then
10728         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10729         if test -z "$supports_multilib"; then
10730             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10731         else
10732             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10733         fi
10734     fi
10736     if test -n "$KDEDIR"; then
10737         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10738         if test -z "$supports_multilib"; then
10739             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10740         else
10741             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10742         fi
10743     fi
10744     if test -n "$KDE4DIR"; then
10745         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10746         if test -z "$supports_multilib"; then
10747             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10748         else
10749             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10750         fi
10751     fi
10753     qt4_test_include="Qt/qobject.h"
10754     qt4_test_library="libQtNetwork.so"
10755     kde4_test_include="kwindowsystem.h"
10756     kde4_test_library="libsolid.so"
10758     AC_MSG_CHECKING([for Qt4 headers])
10759     qt4_header_dir="no"
10760     for inc_dir in $qt4_incdirs; do
10761         if test -r "$inc_dir/$qt4_test_include"; then
10762             qt4_header_dir="$inc_dir"
10763             break
10764         fi
10765     done
10767     AC_MSG_RESULT([$qt4_header_dir])
10768     if test "x$qt4_header_dir" = "xno"; then
10769         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10770     fi
10772     dnl Check for qmake
10773     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10774     if test "$QMAKE4" = "no"; then
10775         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10776     else
10777         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10778         if test -z "$qmake4_test_ver"; then
10779             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10780         fi
10781     fi
10783     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10784     AC_MSG_CHECKING([for Qt4 libraries])
10785     qt4_lib_dir="no"
10786     for lib_dir in $qt4_libdirs; do
10787         if test -r "$lib_dir/$qt4_test_library"; then
10788             qt4_lib_dir="$lib_dir"
10789             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10790             break
10791         fi
10792     done
10794     AC_MSG_RESULT([$qt4_lib_dir])
10796     if test "x$qt4_lib_dir" = "xno"; then
10797         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10798     fi
10800     dnl Check for Meta Object Compiler
10802     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10803     MOC4="$MOCQT4"
10804     if test "$MOC4" = "no"; then
10805         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10806         if test "$MOC4" = "no"; then
10807             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10808 the root of your Qt installation by exporting QT4DIR before running "configure".])
10809         fi
10810     fi
10812     dnl Check for KDE4 headers
10813     AC_MSG_CHECKING([for KDE4 headers])
10814     kde4_incdir="no"
10815     for kde4_check in $kde4_incdirs; do
10816         if test -r "$kde4_check/$kde4_test_include"; then
10817             kde4_incdir="$kde4_check"
10818             break
10819         fi
10820     done
10821     AC_MSG_RESULT([$kde4_incdir])
10822     if test "x$kde4_incdir" = "xno"; then
10823         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10824     fi
10825     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10827     dnl Check for KDE4 libraries
10828     AC_MSG_CHECKING([for KDE4 libraries])
10829     kde4_libdir="no"
10830     for kde4_check in $kde4_libdirs; do
10831         if test -r "$kde4_check/$kde4_test_library"; then
10832             kde4_libdir="$kde4_check"
10833             break
10834         fi
10835     done
10837     AC_MSG_RESULT([$kde4_libdir])
10838     if test "x$kde4_libdir" = "xno"; then
10839         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10840     fi
10842     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10843     if ! test -z "$kde4_incdir"; then
10844         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10845     else
10846         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10847     fi
10849     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10850     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10851     FilterLibs "$KDE4_LIBS"
10852     KDE4_LIBS="$filteredlibs"
10854     AC_LANG_PUSH([C++])
10855     save_CXXFLAGS=$CXXFLAGS
10856     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10857     AC_MSG_CHECKING([whether KDE is >= 4.2])
10858        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10859 #include <kdeversion.h>
10861 int main(int argc, char **argv) {
10862        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10863        else return 1;
10865 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10866     CXXFLAGS=$save_CXXFLAGS
10867     AC_LANG_POP([C++])
10869     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10870     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10871     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10872         [
10873             KDE4_HAVE_GLIB=TRUE
10874             AC_DEFINE(KDE4_HAVE_GLIB,1)
10875             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10876             FilterLibs "${KDE4_GLIB_LIBS}"
10877             KDE4_GLIB_LIBS="${filteredlibs}"
10879             qt4_fix_warning=
10881             AC_LANG_PUSH([C++])
10882             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
10883             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
10884             #  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
10885             #               ^~~~~~~~~~~~~~~~~~~~~~~
10886             #               vptr for 'QObjectPrivate'
10887             # so temporarily ignore here whichever way would be used to make such errors fatal
10888             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
10889             save_CXX=$CXX
10890             CXX=$(printf %s "$CXX" \
10891                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
10892             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
10893             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
10894             save_CXXFLAGS=$CXXFLAGS
10895             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10896             save_LIBS=$LIBS
10897             LIBS="$LIBS $KDE4_LIBS"
10898             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
10900             # Prepare meta object data
10901             TSTBASE="tst_exclude_socket_notifiers"
10902             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10903             ln -fs "${TSTMOC}.hxx"
10904             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10906             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10907 #include <cstdlib>
10908 #include "tst_exclude_socket_notifiers.moc"
10910 int main(int argc, char *argv[])
10912     QCoreApplication app(argc, argv);
10913     exit(tst_processEventsExcludeSocket());
10914     return 0;
10916             ]])],[
10917                 AC_MSG_RESULT([yes])
10918             ],[
10919                 AC_MSG_RESULT([no])
10920                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10921                 if test -z "$qt4_fix_warning"; then
10922                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10923                 fi
10924                 qt4_fix_warning=1
10925                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
10926                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10928             # Remove meta object data
10929             rm -f "${TSTBASE}."*
10931             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
10933             # Prepare meta object data
10934             TSTBASE="tst_exclude_posted_events"
10935             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
10936             ln -fs "${TSTMOC}.hxx"
10937             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
10939             AC_RUN_IFELSE([AC_LANG_SOURCE([[
10940 #include <cstdlib>
10941 #include "tst_exclude_posted_events.moc"
10943 int main(int argc, char *argv[])
10945     QCoreApplication app(argc, argv);
10946     exit(tst_excludePostedEvents());
10947     return 0;
10949             ]])],[
10950                 AC_MSG_RESULT([yes])
10951             ],[
10952                 AC_MSG_RESULT([no])
10953                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
10954                 if test -z "$qt4_fix_warning"; then
10955                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
10956                 fi
10957                 qt4_fix_warning=1
10958                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
10959             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
10961             # Remove meta object data
10962             rm -f "${TSTBASE}."*
10964             if test -n "$qt4_fix_warning"; then
10965                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
10966             fi
10968             LIBS=$save_LIBS
10969             CXXFLAGS=$save_CXXFLAGS
10970             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
10971             CXX=$save_CXX
10972             AC_LANG_POP([C++])
10973         ],
10974         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
10976 AC_SUBST(KDE4_CFLAGS)
10977 AC_SUBST(KDE4_LIBS)
10978 AC_SUBST(MOC4)
10979 AC_SUBST(KDE4_GLIB_CFLAGS)
10980 AC_SUBST(KDE4_GLIB_LIBS)
10981 AC_SUBST(KDE4_HAVE_GLIB)
10983 dnl ===================================================================
10984 dnl QT5 Integration
10985 dnl ===================================================================
10987 QT5_CFLAGS=""
10988 QT5_LIBS=""
10989 QMAKE5="qmake"
10990 MOC5="moc"
10991 QT5_GLIB_CFLAGS=""
10992 QT5_GLIB_LIBS=""
10993 QT5_HAVE_GLIB=""
10994 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
10995         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
10996         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
10997 then
10998     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
10999     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11001     if test -n "$supports_multilib"; then
11002         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11003     fi
11005     qt5_test_include="QtWidgets/qapplication.h"
11006     qt5_test_library="libQt5Widgets.so"
11008     dnl Check for qmake5
11009     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11010     if test "$QMAKE5" = "no"; then
11011         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11012     else
11013         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11014         if test -z "$qmake5_test_ver"; then
11015             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11016         fi
11017         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11018         qt5_minimal_minor="6"
11019         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11020             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11021         else
11022             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11023         fi
11024     fi
11026     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11027     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11029     AC_MSG_CHECKING([for Qt5 headers])
11030     qt5_incdir="no"
11031     for inc_dir in $qt5_incdirs; do
11032         if test -r "$inc_dir/$qt5_test_include"; then
11033             qt5_incdir="$inc_dir"
11034             break
11035         fi
11036     done
11037     AC_MSG_RESULT([$qt5_incdir])
11038     if test "x$qt5_incdir" = "xno"; then
11039         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11040     fi
11042     AC_MSG_CHECKING([for Qt5 libraries])
11043     qt5_libdir="no"
11044     for lib_dir in $qt5_libdirs; do
11045         if test -r "$lib_dir/$qt5_test_library"; then
11046             qt5_libdir="$lib_dir"
11047             break
11048         fi
11049     done
11050     AC_MSG_RESULT([$qt5_libdir])
11051     if test "x$qt5_libdir" = "xno"; then
11052         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11053     fi
11055     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11056     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11058     dnl Check for Meta Object Compiler
11060     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11061     if test "$MOC5" = "no"; then
11062         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11063 the root of your Qt installation by exporting QT5DIR before running "configure".])
11064     fi
11066     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11067     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11068     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11069         [
11070             QT5_HAVE_GLIB=1
11071             AC_DEFINE(QT5_HAVE_GLIB,1)
11072         ],
11073         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11074     )
11076 AC_SUBST(QT5_CFLAGS)
11077 AC_SUBST(QT5_LIBS)
11078 AC_SUBST(MOC5)
11079 AC_SUBST(QT5_GLIB_CFLAGS)
11080 AC_SUBST(QT5_GLIB_LIBS)
11081 AC_SUBST(QT5_HAVE_GLIB)
11083 dnl ===================================================================
11084 dnl KDE5 Integration
11085 dnl ===================================================================
11087 KF5_CFLAGS=""
11088 KF5_LIBS=""
11089 KF5_CONFIG="kf5-config"
11090 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11091         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11092         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11093 then
11094     kf5_incdirs="$KF5INC /usr/include/ $x_includes"
11095     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
11096     if test -n "$supports_multilib"; then
11097         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11098     fi
11100     kf5_test_include="KF5/kcoreaddons_version.h"
11101     kf5_test_library="libKF5CoreAddons.so"
11102     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11104     dnl kf5 KDE4 support compatibility installed
11105     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11106     if test "$KF5_CONFIG" != "no"; then
11107         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11108         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11109     fi
11111     dnl Check for KF5 headers
11112     AC_MSG_CHECKING([for KF5 headers])
11113     kf5_incdir="no"
11114     for kf5_check in $kf5_incdirs; do
11115         if test -r "$kf5_check/$kf5_test_include"; then
11116             kf5_incdir="$kf5_check/KF5"
11117             break
11118         fi
11119     done
11120     AC_MSG_RESULT([$kf5_incdir])
11121     if test "x$kf5_incdir" = "xno"; then
11122         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11123     fi
11125     dnl Check for KF5 libraries
11126     AC_MSG_CHECKING([for KF5 libraries])
11127     kf5_libdir="no"
11128     for kf5_check in $kf5_libdirs; do
11129         if test -r "$kf5_check/$kf5_test_library"; then
11130             kf5_libdir="$kf5_check"
11131             break
11132         fi
11133     done
11135     AC_MSG_RESULT([$kf5_libdir])
11136     if test "x$kf5_libdir" = "xno"; then
11137         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11138     fi
11140     PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11142     KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$kf5_incdir/KIOWidgets -I$kf5_incdir/KIOFileWidgets -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT $KF5_XCB_CFLAGS"
11143     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
11144     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11146     AC_LANG_PUSH([C++])
11147     save_CXXFLAGS=$CXXFLAGS
11148     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11149     AC_MSG_CHECKING([whether KDE is >= 5.0])
11150        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11151 #include <kcoreaddons_version.h>
11153 int main(int argc, char **argv) {
11154        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11155        else return 1;
11157        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11158     CXXFLAGS=$save_CXXFLAGS
11159     AC_LANG_POP([C++])
11161 AC_SUBST(KF5_CFLAGS)
11162 AC_SUBST(KF5_LIBS)
11164 dnl ===================================================================
11165 dnl Test whether to include Evolution 2 support
11166 dnl ===================================================================
11167 AC_MSG_CHECKING([whether to enable evolution 2 support])
11168 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11169     AC_MSG_RESULT([yes])
11170     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11171     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11172     FilterLibs "${GOBJECT_LIBS}"
11173     GOBJECT_LIBS="${filteredlibs}"
11174     ENABLE_EVOAB2="TRUE"
11175 else
11176     ENABLE_EVOAB2=""
11177     AC_MSG_RESULT([no])
11179 AC_SUBST(ENABLE_EVOAB2)
11180 AC_SUBST(GOBJECT_CFLAGS)
11181 AC_SUBST(GOBJECT_LIBS)
11183 dnl ===================================================================
11184 dnl Test which themes to include
11185 dnl ===================================================================
11186 AC_MSG_CHECKING([which themes to include])
11187 # if none given use default subset of available themes
11188 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11189     with_theme="breeze breeze_dark colibre elementary galaxy sifr sifr_dark tango"
11192 WITH_THEMES=""
11193 if test "x$with_theme" != "xno"; then
11194     for theme in $with_theme; do
11195         case $theme in
11196         breeze|breeze_dark|colibre|elementary|galaxy|oxygen|sifr|sifr_dark|tango) real_theme="$theme" ;;
11197         default) real_theme=galaxy ;;
11198         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11199         esac
11200         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11201     done
11203 AC_MSG_RESULT([$WITH_THEMES])
11204 AC_SUBST([WITH_THEMES])
11205 # FIXME: remove this, and the convenience default->galaxy remapping after a crace period
11206 for theme in $with_theme; do
11207     case $theme in
11208     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=galaxy]) ;;
11209     *) ;;
11210     esac
11211 done
11213 dnl ===================================================================
11214 dnl Test whether to integrate helppacks into the product's installer
11215 dnl ===================================================================
11216 AC_MSG_CHECKING([for helppack integration])
11217 if test "$with_helppack_integration" = "no"; then
11218     WITH_HELPPACK_INTEGRATION=
11219     AC_MSG_RESULT([no integration])
11220 else
11221     WITH_HELPPACK_INTEGRATION=TRUE
11222     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11223     AC_MSG_RESULT([integration])
11225 AC_SUBST(WITH_HELPPACK_INTEGRATION)
11227 ###############################################################################
11228 # Extensions checking
11229 ###############################################################################
11230 AC_MSG_CHECKING([for extensions integration])
11231 if test "x$enable_extension_integration" != "xno"; then
11232     WITH_EXTENSION_INTEGRATION=TRUE
11233     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11234     AC_MSG_RESULT([yes, use integration])
11235 else
11236     WITH_EXTENSION_INTEGRATION=
11237     AC_MSG_RESULT([no, do not integrate])
11239 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11241 dnl Should any extra extensions be included?
11242 dnl There are standalone tests for each of these below.
11243 WITH_EXTRA_EXTENSIONS=
11244 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11246 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11247 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11248 if test "x$with_java" != "xno"; then
11249     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11250     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11253 TEST_FONTS_MISSING=0
11255 # $1  = font family
11256 # $2+ = accepted font mappings
11257 test_font_map()
11259     FONT="$1" ; shift
11260     AC_MSG_CHECKING([font mapping for '$FONT'])
11261     FONTFILE="$(basename `$FCMATCH -f '%{file}' "$FONT"`)"
11262     FONTFILE_LOWER="$(echo $FONTFILE | $AWK '{print tolower($0)}')"
11264     TESTEXPR="'${FONTFILE_LOWER}' = '$(echo $FONT | $AWK '{print tolower($0)}').ttf'"
11265     while test "$#" -ge 1 ; do
11266         MAPPING="$(echo $1 | $AWK '{print tolower($0)}')"; shift
11267         TESTEXPR="${TESTEXPR} -o '${FONTFILE_LOWER}' = '$MAPPING-regular.ttf'"
11268     done
11269     if test $TESTEXPR
11270     then
11271         AC_MSG_RESULT([ok])
11272     else
11273         AC_MSG_WARN([unknown ($FONTFILE)])
11274         add_warning "unknown ($FONTFILE)"
11275         TEST_FONTS_MISSING=1
11276     fi
11279 dnl ===================================================================
11280 dnl Test whether to include fonts
11281 dnl ===================================================================
11282 AC_MSG_CHECKING([whether to include third-party fonts])
11283 if test "$with_fonts" != "no"; then
11284     AC_MSG_RESULT([yes])
11285     WITH_FONTS=TRUE
11286     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11287     AC_DEFINE(HAVE_MORE_FONTS)
11288 else
11289     AC_MSG_RESULT([no])
11290     WITH_FONTS=
11291     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11292     if test "$test_fontconfig" = "yes"; then
11293         AC_PATH_PROG([FCMATCH], [fc-match])
11294         if test -z "$FCMATCH"; then
11295             AC_MSG_WARN([Unable to query installed fonts - unit tests disabled.])
11296             TEST_FONTS_MISSING=1
11297         else
11298             test_font_map 'Calibri' 'Carlito'
11299             test_font_map 'DejaVuSans' 'DejaVuSans'
11300             if test ${TEST_FONTS_MISSING} -eq 1
11301             then
11302                 AC_MSG_WARN([Unknown font mappings - unit tests disabled.])
11303                 add_warning "Unknown font mappings - unit tests disabled."
11304             fi
11305         fi
11306     else
11307         TEST_FONTS_MISSING=1
11308     fi
11310 AC_SUBST(WITH_FONTS)
11311 AC_DEFINE_UNQUOTED([TEST_FONTS_MISSING], $TEST_FONTS_MISSING)
11314 dnl ===================================================================
11315 dnl Test whether to enable online update service
11316 dnl ===================================================================
11317 AC_MSG_CHECKING([whether to enable online update])
11318 ENABLE_ONLINE_UPDATE=
11319 ENABLE_ONLINE_UPDATE_MAR=
11320 UPDATE_CONFIG=
11321 if test "$enable_online_update" = ""; then
11322     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11323         AC_MSG_RESULT([yes])
11324         ENABLE_ONLINE_UPDATE="TRUE"
11325     else
11326         AC_MSG_RESULT([no])
11327     fi
11328 else
11329     if test "$enable_online_update" = "mar"; then
11330         AC_MSG_RESULT([yes - MAR-based online update])
11331         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11332         if test "$with_update_config" = ""; then
11333             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11334         fi
11335         UPDATE_CONFIG="$with_update_config"
11336         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11337     elif test "$enable_online_update" = "yes"; then
11338         AC_MSG_RESULT([yes])
11339         ENABLE_ONLINE_UPDATE="TRUE"
11340     else
11341         AC_MSG_RESULT([no])
11342     fi
11344 AC_SUBST(ENABLE_ONLINE_UPDATE)
11345 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11346 AC_SUBST(UPDATE_CONFIG)
11348 dnl ===================================================================
11349 dnl Test whether we need bzip2
11350 dnl ===================================================================
11351 SYSTEM_BZIP2=
11352 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11353     AC_MSG_CHECKING([whether to use system bzip2])
11354     if test "$with_system_bzip2" = yes; then
11355         SYSTEM_BZIP2=TRUE
11356         AC_MSG_RESULT([yes])
11357         PKG_CHECK_MODULES(BZIP2, bzip2)
11358         FilterLibs "${BZIP2_LIBS}"
11359         BZIP2_LIBS="${filteredlibs}"
11360     else
11361         AC_MSG_RESULT([no])
11362         BUILD_TYPE="$BUILD_TYPE BZIP2"
11363     fi
11365 AC_SUBST(SYSTEM_BZIP2)
11366 AC_SUBST(BZIP2_CFLAGS)
11367 AC_SUBST(BZIP2_LIBS)
11369 dnl ===================================================================
11370 dnl Test whether to enable extension update
11371 dnl ===================================================================
11372 AC_MSG_CHECKING([whether to enable extension update])
11373 ENABLE_EXTENSION_UPDATE=
11374 if test "x$enable_extension_update" = "xno"; then
11375     AC_MSG_RESULT([no])
11376 else
11377     AC_MSG_RESULT([yes])
11378     ENABLE_EXTENSION_UPDATE="TRUE"
11379     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11380     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11382 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11385 dnl ===================================================================
11386 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11387 dnl ===================================================================
11388 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11389 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11390     AC_MSG_RESULT([no])
11391     ENABLE_SILENT_MSI=
11392 else
11393     AC_MSG_RESULT([yes])
11394     ENABLE_SILENT_MSI=TRUE
11395     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11397 AC_SUBST(ENABLE_SILENT_MSI)
11399 AC_MSG_CHECKING([whether and how to use Xinerama])
11400 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11401     if test "$x_libraries" = "default_x_libraries"; then
11402         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11403         if test "x$XINERAMALIB" = x; then
11404            XINERAMALIB="/usr/lib"
11405         fi
11406     else
11407         XINERAMALIB="$x_libraries"
11408     fi
11409     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11410         # we have both versions, let the user decide but use the dynamic one
11411         # per default
11412         USE_XINERAMA=TRUE
11413         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11414             XINERAMA_LINK=dynamic
11415         else
11416             XINERAMA_LINK=static
11417         fi
11418     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11419         # we have only the dynamic version
11420         USE_XINERAMA=TRUE
11421         XINERAMA_LINK=dynamic
11422     elif test -e "$XINERAMALIB/libXinerama.a"; then
11423         # static version
11424         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11425             USE_XINERAMA=TRUE
11426             XINERAMA_LINK=static
11427         else
11428             USE_XINERAMA=
11429             XINERAMA_LINK=none
11430         fi
11431     else
11432         # no Xinerama
11433         USE_XINERAMA=
11434         XINERAMA_LINK=none
11435     fi
11436     if test "$USE_XINERAMA" = "TRUE"; then
11437         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11438         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11439             [AC_MSG_ERROR(Xinerama header not found.)], [])
11440         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11441         if test "x$XEXTLIB" = x; then
11442            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11443         fi
11444         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11445         if test "$_os" = "FreeBSD"; then
11446             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11447         fi
11448         if test "$_os" = "Linux"; then
11449             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11450         fi
11451         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11452             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11453     else
11454         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11455     fi
11456 else
11457     USE_XINERAMA=
11458     XINERAMA_LINK=none
11459     AC_MSG_RESULT([no])
11461 AC_SUBST(USE_XINERAMA)
11462 AC_SUBST(XINERAMA_LINK)
11464 dnl ===================================================================
11465 dnl Test whether to build cairo or rely on the system version
11466 dnl ===================================================================
11468 if test "$USING_X11" = TRUE; then
11469     # Used in vcl/Library_vclplug_gen.mk
11470     test_cairo=yes
11473 if test "$test_cairo" = "yes"; then
11474     AC_MSG_CHECKING([whether to use the system cairo])
11476     : ${with_system_cairo:=$with_system_libs}
11477     if test "$with_system_cairo" = "yes"; then
11478         SYSTEM_CAIRO=TRUE
11479         AC_MSG_RESULT([yes])
11481         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11482         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11483         FilterLibs "${CAIRO_LIBS}"
11484         CAIRO_LIBS="${filteredlibs}"
11486         if test "$test_xrender" = "yes"; then
11487             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11488             AC_LANG_PUSH([C])
11489             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11490 #ifdef PictStandardA8
11491 #else
11492       return fail;
11493 #endif
11494 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11496             AC_LANG_POP([C])
11497         fi
11498     else
11499         SYSTEM_CAIRO=
11500         AC_MSG_RESULT([no])
11502         BUILD_TYPE="$BUILD_TYPE CAIRO"
11503     fi
11506 AC_SUBST(SYSTEM_CAIRO)
11507 AC_SUBST(CAIRO_CFLAGS)
11508 AC_SUBST(CAIRO_LIBS)
11510 dnl ===================================================================
11511 dnl Test whether to use avahi
11512 dnl ===================================================================
11513 if test "$_os" = "WINNT"; then
11514     # Windows uses bundled mDNSResponder
11515     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11516 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11517     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11518                       [ENABLE_AVAHI="TRUE"])
11519     AC_DEFINE(HAVE_FEATURE_AVAHI)
11520     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11521     FilterLibs "${AVAHI_LIBS}"
11522     AVAHI_LIBS="${filteredlibs}"
11525 AC_SUBST(ENABLE_AVAHI)
11526 AC_SUBST(AVAHI_CFLAGS)
11527 AC_SUBST(AVAHI_LIBS)
11529 dnl ===================================================================
11530 dnl Test whether to use liblangtag
11531 dnl ===================================================================
11532 SYSTEM_LIBLANGTAG=
11533 AC_MSG_CHECKING([whether to use system liblangtag])
11534 if test "$with_system_liblangtag" = yes; then
11535     SYSTEM_LIBLANGTAG=TRUE
11536     AC_MSG_RESULT([yes])
11537     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11538     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11539     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11540     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11541     FilterLibs "${LIBLANGTAG_LIBS}"
11542     LIBLANGTAG_LIBS="${filteredlibs}"
11543 else
11544     SYSTEM_LIBLANGTAG=
11545     AC_MSG_RESULT([no])
11546     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11547     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11548     if test "$COM" = "MSC"; then
11549         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11550     else
11551         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11552     fi
11554 AC_SUBST(SYSTEM_LIBLANGTAG)
11555 AC_SUBST(LIBLANGTAG_CFLAGS)
11556 AC_SUBST(LIBLANGTAG_LIBS)
11558 dnl ===================================================================
11559 dnl Test whether to build libpng or rely on the system version
11560 dnl ===================================================================
11562 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11564 dnl ===================================================================
11565 dnl Check for runtime JVM search path
11566 dnl ===================================================================
11567 if test "$ENABLE_JAVA" != ""; then
11568     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11569     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11570         AC_MSG_RESULT([yes])
11571         if ! test -d "$with_jvm_path"; then
11572             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11573         fi
11574         if ! test -d "$with_jvm_path"jvm; then
11575             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11576         fi
11577         JVM_ONE_PATH_CHECK="$with_jvm_path"
11578         AC_SUBST(JVM_ONE_PATH_CHECK)
11579     else
11580         AC_MSG_RESULT([no])
11581     fi
11584 dnl ===================================================================
11585 dnl Test for the presence of Ant and that it works
11586 dnl ===================================================================
11588 if test "$ENABLE_JAVA" != ""; then
11589     ANT_HOME=; export ANT_HOME
11590     WITH_ANT_HOME=; export WITH_ANT_HOME
11591     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11592         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11593             if test "$_os" = "WINNT"; then
11594                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11595             else
11596                 with_ant_home="$LODE_HOME/opt/ant"
11597             fi
11598         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11599             with_ant_home="$LODE_HOME/opt/ant"
11600         fi
11601     fi
11602     if test -z "$with_ant_home"; then
11603         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11604     else
11605         if test "$_os" = "WINNT"; then
11606             # AC_PATH_PROGS needs unix path
11607             with_ant_home=`cygpath -u "$with_ant_home"`
11608         fi
11609         AbsolutePath "$with_ant_home"
11610         with_ant_home=$absolute_path
11611         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11612         WITH_ANT_HOME=$with_ant_home
11613         ANT_HOME=$with_ant_home
11614     fi
11616     if test -z "$ANT"; then
11617         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11618     else
11619         # resolve relative or absolute symlink
11620         while test -h "$ANT"; do
11621             a_cwd=`pwd`
11622             a_basename=`basename "$ANT"`
11623             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11624             cd "`dirname "$ANT"`"
11625             cd "`dirname "$a_script"`"
11626             ANT="`pwd`"/"`basename "$a_script"`"
11627             cd "$a_cwd"
11628         done
11630         AC_MSG_CHECKING([if $ANT works])
11631         cat > conftest.java << EOF
11632         public class conftest {
11633             int testmethod(int a, int b) {
11634                     return a + b;
11635             }
11636         }
11639         cat > conftest.xml << EOF
11640         <project name="conftest" default="conftest">
11641         <target name="conftest">
11642             <javac srcdir="." includes="conftest.java">
11643             </javac>
11644         </target>
11645         </project>
11648         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11649         if test $? = 0 -a -f ./conftest.class; then
11650             AC_MSG_RESULT([Ant works])
11651             if test -z "$WITH_ANT_HOME"; then
11652                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11653                 if test -z "$ANT_HOME"; then
11654                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11655                 fi
11656             else
11657                 ANT_HOME="$WITH_ANT_HOME"
11658             fi
11659         else
11660             echo "configure: Ant test failed" >&5
11661             cat conftest.java >&5
11662             cat conftest.xml >&5
11663             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11664         fi
11665         rm -f conftest* core core.* *.core
11666     fi
11667     if test -z "$ANT_HOME"; then
11668         ANT_HOME="NO_ANT_HOME"
11669     else
11670         PathFormat "$ANT_HOME"
11671         ANT_HOME="$formatted_path"
11672         PathFormat "$ANT"
11673         ANT="$formatted_path"
11674     fi
11675     AC_SUBST(ANT_HOME)
11676     AC_SUBST(ANT)
11678     dnl Checking for ant.jar
11679     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11680         AC_MSG_CHECKING([Ant lib directory])
11681         if test -f $ANT_HOME/lib/ant.jar; then
11682             ANT_LIB="$ANT_HOME/lib"
11683         else
11684             if test -f $ANT_HOME/ant.jar; then
11685                 ANT_LIB="$ANT_HOME"
11686             else
11687                 if test -f /usr/share/java/ant.jar; then
11688                     ANT_LIB=/usr/share/java
11689                 else
11690                     if test -f /usr/share/ant-core/lib/ant.jar; then
11691                         ANT_LIB=/usr/share/ant-core/lib
11692                     else
11693                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11694                             ANT_LIB="$ANT_HOME/lib/ant"
11695                         else
11696                             if test -f /usr/share/lib/ant/ant.jar; then
11697                                 ANT_LIB=/usr/share/lib/ant
11698                             else
11699                                 AC_MSG_ERROR([Ant libraries not found!])
11700                             fi
11701                         fi
11702                     fi
11703                 fi
11704             fi
11705         fi
11706         PathFormat "$ANT_LIB"
11707         ANT_LIB="$formatted_path"
11708         AC_MSG_RESULT([Ant lib directory found.])
11709     fi
11710     AC_SUBST(ANT_LIB)
11712     ant_minver=1.6.0
11713     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11715     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11716     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11717     ant_version_major=`echo $ant_version | cut -d. -f1`
11718     ant_version_minor=`echo $ant_version | cut -d. -f2`
11719     echo "configure: ant_version $ant_version " >&5
11720     echo "configure: ant_version_major $ant_version_major " >&5
11721     echo "configure: ant_version_minor $ant_version_minor " >&5
11722     if test "$ant_version_major" -ge "2"; then
11723         AC_MSG_RESULT([yes, $ant_version])
11724     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11725         AC_MSG_RESULT([yes, $ant_version])
11726     else
11727         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11728     fi
11730     rm -f conftest* core core.* *.core
11733 OOO_JUNIT_JAR=
11734 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11735     AC_MSG_CHECKING([for JUnit 4])
11736     if test "$with_junit" = "yes"; then
11737         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11738             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11739         elif test -e /usr/share/java/junit4.jar; then
11740             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11741         else
11742            if test -e /usr/share/lib/java/junit.jar; then
11743               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11744            else
11745               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11746            fi
11747         fi
11748     else
11749         OOO_JUNIT_JAR=$with_junit
11750     fi
11751     if test "$_os" = "WINNT"; then
11752         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11753     fi
11754     printf 'import org.junit.Before;' > conftest.java
11755     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11756         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11757     else
11758         AC_MSG_ERROR(
11759 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11760  specify its pathname via --with-junit=..., or disable it via --without-junit])
11761     fi
11762     rm -f conftest.class conftest.java
11763     if test $OOO_JUNIT_JAR != ""; then
11764     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11765     fi
11767 AC_SUBST(OOO_JUNIT_JAR)
11769 HAMCREST_JAR=
11770 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11771     AC_MSG_CHECKING([for included Hamcrest])
11772     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11773     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11774         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11775     else
11776         AC_MSG_RESULT([Not included])
11777         AC_MSG_CHECKING([for standalone hamcrest jar.])
11778         if test "$with_hamcrest" = "yes"; then
11779             if test -e /usr/share/lib/java/hamcrest.jar; then
11780                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11781             elif test -e /usr/share/java/hamcrest/core.jar; then
11782                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11783             else
11784                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11785             fi
11786         else
11787             HAMCREST_JAR=$with_hamcrest
11788         fi
11789         if test "$_os" = "WINNT"; then
11790             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11791         fi
11792         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11793             AC_MSG_RESULT([$HAMCREST_JAR])
11794         else
11795             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),
11796                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11797         fi
11798     fi
11799     rm -f conftest.class conftest.java
11801 AC_SUBST(HAMCREST_JAR)
11804 AC_SUBST(SCPDEFS)
11807 # check for wget and curl
11809 WGET=
11810 CURL=
11812 if test "$enable_fetch_external" != "no"; then
11814 CURL=`which curl 2>/dev/null`
11816 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11817     # wget new enough?
11818     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11819     if test $? -eq 0; then
11820         WGET=$i
11821         break
11822     fi
11823 done
11825 if test -z "$WGET" -a -z "$CURL"; then
11826     AC_MSG_ERROR([neither wget nor curl found!])
11831 AC_SUBST(WGET)
11832 AC_SUBST(CURL)
11835 # check for sha256sum
11837 SHA256SUM=
11839 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11840     eval "$i -a 256 --version" > /dev/null 2>&1
11841     ret=$?
11842     if test $ret -eq 0; then
11843         SHA256SUM="$i -a 256"
11844         break
11845     fi
11846 done
11848 if test -z "$SHA256SUM"; then
11849     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11850         eval "$i --version" > /dev/null 2>&1
11851         ret=$?
11852         if test $ret -eq 0; then
11853             SHA256SUM=$i
11854             break
11855         fi
11856     done
11859 if test -z "$SHA256SUM"; then
11860     AC_MSG_ERROR([no sha256sum found!])
11863 AC_SUBST(SHA256SUM)
11865 dnl ===================================================================
11866 dnl Dealing with l10n options
11867 dnl ===================================================================
11868 AC_MSG_CHECKING([which languages to be built])
11869 # get list of all languages
11870 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11871 # the sed command does the following:
11872 #   + if a line ends with a backslash, append the next line to it
11873 #   + adds " on the beginning of the value (after =)
11874 #   + adds " at the end of the value
11875 #   + removes en-US; we want to put it on the beginning
11876 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11877 [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)]
11878 ALL_LANGS="en-US $completelangiso"
11879 # check the configured localizations
11880 WITH_LANG="$with_lang"
11881 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11882     AC_MSG_RESULT([en-US])
11883 else
11884     AC_MSG_RESULT([$WITH_LANG])
11885     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11886     if test -z "$MSGFMT"; then
11887         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
11888             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
11889         elif test -x "/opt/lo/bin/msgfmt"; then
11890             MSGFMT="/opt/lo/bin/msgfmt"
11891         else
11892             AC_CHECK_PROGS(MSGFMT, [msgfmt])
11893             if test -z "$MSGFMT"; then
11894                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
11895             fi
11896         fi
11897     fi
11898     if test -z "$MSGUNIQ"; then
11899         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
11900             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
11901         elif test -x "/opt/lo/bin/msguniq"; then
11902             MSGUNIQ="/opt/lo/bin/msguniq"
11903         else
11904             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
11905             if test -z "$MSGUNIQ"; then
11906                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
11907             fi
11908         fi
11909     fi
11911 AC_SUBST(MSGFMT)
11912 AC_SUBST(MSGUNIQ)
11913 # check that the list is valid
11914 for lang in $WITH_LANG; do
11915     test "$lang" = "ALL" && continue
11916     # need to check for the exact string, so add space before and after the list of all languages
11917     for vl in $ALL_LANGS; do
11918         if test "$vl" = "$lang"; then
11919            break
11920         fi
11921     done
11922     if test "$vl" != "$lang"; then
11923         # if you're reading this - you prolly quoted your languages remove the quotes ...
11924         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
11925     fi
11926 done
11927 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
11928     echo $WITH_LANG | grep -q en-US
11929     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
11931 # list with substituted ALL
11932 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
11933 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
11934 test "$WITH_LANG" = "en-US" && WITH_LANG=
11935 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
11936     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
11937     ALL_LANGS=`echo $ALL_LANGS qtz`
11939 AC_SUBST(ALL_LANGS)
11940 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
11941 AC_SUBST(WITH_LANG)
11942 AC_SUBST(WITH_LANG_LIST)
11943 AC_SUBST(GIT_NEEDED_SUBMODULES)
11945 WITH_POOR_HELP_LOCALIZATIONS=
11946 if test -d "$SRC_ROOT/translations/source"; then
11947     for l in `ls -1 $SRC_ROOT/translations/source`; do
11948         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
11949             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
11950         fi
11951     done
11953 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
11955 if test -n "$with_locales"; then
11956     WITH_LOCALES="$with_locales"
11958     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
11959     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
11960     # config_host/config_locales.h.in
11961     for locale in $WITH_LOCALES; do
11962         lang=${locale%_*}
11964         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
11966         case $lang in
11967         hi|mr*ne)
11968             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
11969             ;;
11970         bg|ru)
11971             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
11972             ;;
11973         esac
11974     done
11975 else
11976     AC_DEFINE(WITH_LOCALE_ALL)
11978 AC_SUBST(WITH_LOCALES)
11980 dnl git submodule update --reference
11981 dnl ===================================================================
11982 if test -n "${GIT_REFERENCE_SRC}"; then
11983     for repo in ${GIT_NEEDED_SUBMODULES}; do
11984         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
11985             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
11986         fi
11987     done
11989 AC_SUBST(GIT_REFERENCE_SRC)
11991 dnl git submodules linked dirs
11992 dnl ===================================================================
11993 if test -n "${GIT_LINK_SRC}"; then
11994     for repo in ${GIT_NEEDED_SUBMODULES}; do
11995         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
11996             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
11997         fi
11998     done
12000 AC_SUBST(GIT_LINK_SRC)
12002 dnl branding
12003 dnl ===================================================================
12004 AC_MSG_CHECKING([for alternative branding images directory])
12005 # initialize mapped arrays
12006 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12007 brand_files="$BRAND_INTRO_IMAGES about.svg"
12009 if test -z "$with_branding" -o "$with_branding" = "no"; then
12010     AC_MSG_RESULT([none])
12011     DEFAULT_BRAND_IMAGES="$brand_files"
12012 else
12013     if ! test -d $with_branding ; then
12014         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12015     else
12016         AC_MSG_RESULT([$with_branding])
12017         CUSTOM_BRAND_DIR="$with_branding"
12018         for lfile in $brand_files
12019         do
12020             if ! test -f $with_branding/$lfile ; then
12021                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12022                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12023             else
12024                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12025             fi
12026         done
12027         check_for_progress="yes"
12028     fi
12030 AC_SUBST([BRAND_INTRO_IMAGES])
12031 AC_SUBST([CUSTOM_BRAND_DIR])
12032 AC_SUBST([CUSTOM_BRAND_IMAGES])
12033 AC_SUBST([DEFAULT_BRAND_IMAGES])
12036 AC_MSG_CHECKING([for 'intro' progress settings])
12037 PROGRESSBARCOLOR=
12038 PROGRESSSIZE=
12039 PROGRESSPOSITION=
12040 PROGRESSFRAMECOLOR=
12041 PROGRESSTEXTCOLOR=
12042 PROGRESSTEXTBASELINE=
12044 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12045     source "$with_branding/progress.conf"
12046     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12047 else
12048     AC_MSG_RESULT([none])
12051 AC_SUBST(PROGRESSBARCOLOR)
12052 AC_SUBST(PROGRESSSIZE)
12053 AC_SUBST(PROGRESSPOSITION)
12054 AC_SUBST(PROGRESSFRAMECOLOR)
12055 AC_SUBST(PROGRESSTEXTCOLOR)
12056 AC_SUBST(PROGRESSTEXTBASELINE)
12059 AC_MSG_CHECKING([for extra build ID])
12060 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12061     EXTRA_BUILDID="$with_extra_buildid"
12063 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12064 if test -n "$EXTRA_BUILDID" ; then
12065     AC_MSG_RESULT([$EXTRA_BUILDID])
12066 else
12067     AC_MSG_RESULT([not set])
12069 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12071 OOO_VENDOR=
12072 AC_MSG_CHECKING([for vendor])
12073 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12074     OOO_VENDOR="$USERNAME"
12076     if test -z "$OOO_VENDOR"; then
12077         OOO_VENDOR="$USER"
12078     fi
12080     if test -z "$OOO_VENDOR"; then
12081         OOO_VENDOR="`id -u -n`"
12082     fi
12084     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12085 else
12086     OOO_VENDOR="$with_vendor"
12087     AC_MSG_RESULT([$OOO_VENDOR])
12089 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12090 AC_SUBST(OOO_VENDOR)
12092 if test "$_os" = "Android" ; then
12093     ANDROID_PACKAGE_NAME=
12094     AC_MSG_CHECKING([for Android package name])
12095     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12096         if test -n "$ENABLE_DEBUG"; then
12097             # Default to the package name that makes ndk-gdb happy.
12098             ANDROID_PACKAGE_NAME="org.libreoffice"
12099         else
12100             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12101         fi
12103         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12104     else
12105         ANDROID_PACKAGE_NAME="$with_android_package_name"
12106         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12107     fi
12108     AC_SUBST(ANDROID_PACKAGE_NAME)
12111 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12112 if test "$with_compat_oowrappers" = "yes"; then
12113     WITH_COMPAT_OOWRAPPERS=TRUE
12114     AC_MSG_RESULT(yes)
12115 else
12116     WITH_COMPAT_OOWRAPPERS=
12117     AC_MSG_RESULT(no)
12119 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12121 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12122 AC_MSG_CHECKING([for install dirname])
12123 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12124     INSTALLDIRNAME="$with_install_dirname"
12126 AC_MSG_RESULT([$INSTALLDIRNAME])
12127 AC_SUBST(INSTALLDIRNAME)
12129 AC_MSG_CHECKING([for prefix])
12130 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12131 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12132 PREFIXDIR="$prefix"
12133 AC_MSG_RESULT([$PREFIXDIR])
12134 AC_SUBST(PREFIXDIR)
12136 LIBDIR=[$(eval echo $(eval echo $libdir))]
12137 AC_SUBST(LIBDIR)
12139 DATADIR=[$(eval echo $(eval echo $datadir))]
12140 AC_SUBST(DATADIR)
12142 MANDIR=[$(eval echo $(eval echo $mandir))]
12143 AC_SUBST(MANDIR)
12145 DOCDIR=[$(eval echo $(eval echo $docdir))]
12146 AC_SUBST(DOCDIR)
12148 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12149 AC_SUBST(INSTALLDIR)
12151 TESTINSTALLDIR="${BUILDDIR}/test-install"
12152 AC_SUBST(TESTINSTALLDIR)
12155 # ===================================================================
12156 # OAuth2 id and secrets
12157 # ===================================================================
12159 AC_MSG_CHECKING([for Google Drive client id and secret])
12160 GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12161 GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12162 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12163     GDRIVE_CLIENT_ID="\"\""
12166 if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
12167     GDRIVE_CLIENT_SECRET="\"\""
12170 if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
12171     AC_MSG_RESULT([not set])
12172 else
12173     AC_MSG_RESULT([set])
12176 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12177 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12179 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12180 ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12181 ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12182 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12183     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12186 if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
12187     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12190 if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
12191     AC_MSG_RESULT([not set])
12192 else
12193     AC_MSG_RESULT([set])
12195 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12196 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12198 AC_MSG_CHECKING([for OneDrive client id and secret])
12199 ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12200 ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12201 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12202     ONEDRIVE_CLIENT_ID="\"\""
12205 if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then
12206     ONEDRIVE_CLIENT_SECRET="\"\""
12209 if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then
12210     AC_MSG_RESULT([not set])
12211 else
12212     AC_MSG_RESULT([set])
12214 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12215 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12218 dnl ===================================================================
12219 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12220 dnl --enable-dependency-tracking configure option
12221 dnl ===================================================================
12222 AC_MSG_CHECKING([whether to enable dependency tracking])
12223 if test "$enable_dependency_tracking" = "no"; then
12224     nodep=TRUE
12225     AC_MSG_RESULT([no])
12226 else
12227     AC_MSG_RESULT([yes])
12229 AC_SUBST(nodep)
12231 dnl ===================================================================
12232 dnl Number of CPUs to use during the build
12233 dnl ===================================================================
12234 AC_MSG_CHECKING([for number of processors to use])
12235 # plain --with-parallelism is just the default
12236 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12237     if test "$with_parallelism" = "no"; then
12238         PARALLELISM=0
12239     else
12240         PARALLELISM=$with_parallelism
12241     fi
12242 else
12243     if test "$enable_icecream" = "yes"; then
12244         PARALLELISM="10"
12245     else
12246         case `uname -s` in
12248         Darwin|FreeBSD|NetBSD|OpenBSD)
12249             PARALLELISM=`sysctl -n hw.ncpu`
12250             ;;
12252         Linux)
12253             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12254         ;;
12255         # what else than above does profit here *and* has /proc?
12256         *)
12257             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12258             ;;
12259         esac
12261         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12262         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12263     fi
12266 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12267     if test -z "$with_parallelism"; then
12268             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12269             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12270             PARALLELISM="1"
12271     else
12272         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."
12273     fi
12276 if test $PARALLELISM -eq 0; then
12277     AC_MSG_RESULT([explicit make -j option needed])
12278 else
12279     AC_MSG_RESULT([$PARALLELISM])
12281 AC_SUBST(PARALLELISM)
12283 IWYU_PATH="$with_iwyu"
12284 AC_SUBST(IWYU_PATH)
12285 if test ! -z "$IWYU_PATH"; then
12286     if test ! -f "$IWYU_PATH"; then
12287         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12288     fi
12292 # Set up ILIB for MSVC build
12294 ILIB1=
12295 if test "$build_os" = "cygwin"; then
12296     ILIB="."
12297     if test -n "$JAVA_HOME"; then
12298         ILIB="$ILIB;$JAVA_HOME/lib"
12299     fi
12300     ILIB1=-link
12301     if test "$BITNESS_OVERRIDE" = 64; then
12302         if test $vcnum = "150"; then
12303             ILIB="$ILIB;$COMPATH/lib/x64"
12304             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12305         else
12306             ILIB="$ILIB;$COMPATH/lib/amd64"
12307             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/amd64"
12308         fi
12309         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12310         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12311         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12312             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12313             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12314         fi
12315         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12316         ucrtlibpath_formatted=$formatted_path
12317         ILIB="$ILIB;$ucrtlibpath_formatted"
12318         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12319     else
12320         if test $vcnum = "150"; then
12321             ILIB="$ILIB;$COMPATH/lib/x86"
12322             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12323         else
12324             ILIB="$ILIB;$COMPATH/lib"
12325             ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib"
12326         fi
12327         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12328         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12329         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12330             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12331             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12332         fi
12333         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12334         ucrtlibpath_formatted=$formatted_path
12335         ILIB="$ILIB;$ucrtlibpath_formatted"
12336         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12337     fi
12338     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12339         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12340     else
12341         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12342     fi
12344     AC_SUBST(ILIB)
12347 dnl We should be able to drop the below check when bumping the GCC baseline to
12348 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12349 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12350 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12351 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12352 AC_MSG_CHECKING(
12353     [whether C++11 use of const_iterator in standard containers is broken])
12354 save_CXXFLAGS=$CXXFLAGS
12355 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12356 AC_LANG_PUSH([C++])
12357 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12358     #include <list>
12359     ]],[[
12360         std::list<int> l;
12361         l.erase(l.cbegin());
12362     ]])],
12363     [broken=no], [broken=yes])
12364 AC_LANG_POP([C++])
12365 CXXFLAGS=$save_CXXFLAGS
12366 AC_MSG_RESULT([$broken])
12367 if test "$broken" = yes; then
12368     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12372 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12373 save_CXXFLAGS=$CXXFLAGS
12374 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12375 save_LIBS=$LIBS
12376 if test -n "$ILIB1"; then
12377     LIBS="$LIBS $ILIB1"
12379 AC_LANG_PUSH([C++])
12380 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12381     // Exit with failure if the static initializer_list is stored on the
12382     // stack (as done by Clang < 3.4):
12383     #include <initializer_list>
12384     struct S {};
12385     bool g(void const * p1, void const * p2) {
12386         int n;
12387         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12388     }
12389     bool f(void const * p1) {
12390         static std::initializer_list<S> s { S() };
12391         return g(p1, s.begin());
12392     }
12393     ]],[[
12394         int n;
12395         return f(&n) ? 0 : 1;
12396     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12397 AC_LANG_POP([C++])
12398 LIBS=$save_LIBS
12399 CXXFLAGS=$save_CXXFLAGS
12400 AC_MSG_RESULT([$broken])
12401 if test "$broken" = yes -a "$_os" != "iOS"; then
12402     AC_MSG_ERROR([working support for static initializer_list needed])
12406 # ===================================================================
12407 # Creating bigger shared library to link against
12408 # ===================================================================
12409 AC_MSG_CHECKING([whether to create huge library])
12410 MERGELIBS=
12412 if test $_os = iOS -o $_os = Android; then
12413     # Never any point in mergelibs for these as we build just static
12414     # libraries anyway...
12415     enable_mergelibs=no
12418 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12419     if test $_os != Linux -a $_os != WINNT; then
12420         add_warning "--enable-mergelibs is not tested for this platform"
12421     fi
12422     MERGELIBS="TRUE"
12423     AC_MSG_RESULT([yes])
12424 else
12425     AC_MSG_RESULT([no])
12427 AC_SUBST([MERGELIBS])
12429 dnl ===================================================================
12430 dnl icerun is a wrapper that stops us spawning tens of processes
12431 dnl locally - for tools that can't be executed on the compile cluster
12432 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12433 dnl ===================================================================
12434 AC_MSG_CHECKING([whether to use icerun wrapper])
12435 ICECREAM_RUN=
12436 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12437     ICECREAM_RUN=icerun
12438     AC_MSG_RESULT([yes])
12439 else
12440     AC_MSG_RESULT([no])
12442 AC_SUBST(ICECREAM_RUN)
12444 dnl ===================================================================
12445 dnl Setup the ICECC_VERSION for the build the same way it was set for
12446 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12447 dnl ===================================================================
12448 x_ICECC_VERSION=[\#]
12449 if test -n "$ICECC_VERSION" ; then
12450     x_ICECC_VERSION=
12452 AC_SUBST(x_ICECC_VERSION)
12453 AC_SUBST(ICECC_VERSION)
12455 dnl ===================================================================
12457 AC_MSG_CHECKING([MPL subset])
12458 MPL_SUBSET=
12460 if test "$enable_mpl_subset" = "yes"; then
12461     warn_report=false
12462     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12463         warn_report=true
12464     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12465         warn_report=true
12466     fi
12467     if test "$warn_report" = "true"; then
12468         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12469     fi
12470     if test "x$enable_postgresql_sdbc" != "xno"; then
12471         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12472     fi
12473     if test "$enable_lotuswordpro" = "yes"; then
12474         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12475     fi
12476     if test "$WITH_WEBDAV" = "neon"; then
12477         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12478     fi
12479     if test "x$enable_ext_mariadb_connector" = "xyes"; then
12480         AC_MSG_ERROR([need to --disable-ext-mariadb-connector - mariadb/mysql support.])
12481     fi
12482     if test -n "$ENABLE_PDFIMPORT"; then
12483         if test "x$SYSTEM_POPPLER" = "x"; then
12484             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12485         fi
12486     fi
12487     # cf. m4/libo_check_extension.m4
12488     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12489         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12490     fi
12491     for theme in $WITH_THEMES; do
12492         case $theme in
12493         breeze|default|oxygen|sifr)
12494             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12495         *) : ;;
12496         esac
12497     done
12499     ENABLE_OPENGL_TRANSITIONS=
12501     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12502         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12503     fi
12505     MPL_SUBSET="TRUE"
12506     AC_DEFINE(MPL_HAVE_SUBSET)
12507     AC_MSG_RESULT([only])
12508 else
12509     AC_MSG_RESULT([no restrictions])
12511 AC_SUBST(MPL_SUBSET)
12513 dnl ===================================================================
12515 AC_MSG_CHECKING([formula logger])
12516 ENABLE_FORMULA_LOGGER=
12518 if test "x$enable_formula_logger" = "xyes"; then
12519     AC_MSG_RESULT([yes])
12520     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12521     ENABLE_FORMULA_LOGGER=TRUE
12522 elif test -n "$ENABLE_DBGUTIL" ; then
12523     AC_MSG_RESULT([yes])
12524     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12525     ENABLE_FORMULA_LOGGER=TRUE
12526 else
12527     AC_MSG_RESULT([no])
12530 AC_SUBST(ENABLE_FORMULA_LOGGER)
12532 dnl ===================================================================
12533 dnl Setting up the environment.
12534 dnl ===================================================================
12535 AC_MSG_NOTICE([setting up the build environment variables...])
12537 AC_SUBST(COMPATH)
12539 if test "$build_os" = "cygwin"; then
12540     if test -d "$COMPATH/atlmfc/lib"; then
12541         ATL_LIB="$COMPATH/atlmfc/lib"
12542         ATL_INCLUDE="$COMPATH/atlmfc/include"
12543     else
12544         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12545         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12546     fi
12547     if test "$BITNESS_OVERRIDE" = 64; then
12548         if test $VCVER = "150"; then
12549             ATL_LIB="$ATL_LIB/x64"
12550         else
12551             ATL_LIB="$ATL_LIB/amd64"
12552         fi
12553     else
12554         if test $VCVER = "150"; then
12555             ATL_LIB="$ATL_LIB/x86"
12556         fi
12557     fi
12558     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12559     PathFormat "/usr/bin/find.exe"
12560     FIND="$formatted_path"
12561     PathFormat "/usr/bin/sort.exe"
12562     SORT="$formatted_path"
12563     PathFormat "/usr/bin/grep.exe"
12564     WIN_GREP="$formatted_path"
12565     PathFormat "/usr/bin/ls.exe"
12566     WIN_LS="$formatted_path"
12567     PathFormat "/usr/bin/touch.exe"
12568     WIN_TOUCH="$formatted_path"
12569 else
12570     FIND=find
12571     SORT=sort
12574 AC_SUBST(ATL_INCLUDE)
12575 AC_SUBST(ATL_LIB)
12576 AC_SUBST(FIND)
12577 AC_SUBST(SORT)
12578 AC_SUBST(WIN_GREP)
12579 AC_SUBST(WIN_LS)
12580 AC_SUBST(WIN_TOUCH)
12582 AC_SUBST(BUILD_TYPE)
12584 AC_SUBST(SOLARINC)
12586 PathFormat "$PERL"
12587 PERL="$formatted_path"
12588 AC_SUBST(PERL)
12590 if test -n "$TMPDIR"; then
12591     TEMP_DIRECTORY="$TMPDIR"
12592 else
12593     TEMP_DIRECTORY="/tmp"
12595 if test "$build_os" = "cygwin"; then
12596     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12598 AC_SUBST(TEMP_DIRECTORY)
12600 # setup the PATH for the environment
12601 if test -n "$LO_PATH_FOR_BUILD"; then
12602     LO_PATH="$LO_PATH_FOR_BUILD"
12603 else
12604     LO_PATH="$PATH"
12606     case "$host_os" in
12608     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12609         if test "$ENABLE_JAVA" != ""; then
12610             pathmunge "$JAVA_HOME/bin" "after"
12611         fi
12612         ;;
12614     cygwin*)
12615         # Win32 make needs native paths
12616         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12617             LO_PATH=`cygpath -p -m "$PATH"`
12618         fi
12619         if test "$BITNESS_OVERRIDE" = 64; then
12620             # needed for msi packaging
12621             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12622         fi
12623         # .NET 4.6 and higher don't have bin directory
12624         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12625             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12626         fi
12627         pathmunge "$ASM_HOME" "before"
12628         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12629         pathmunge "$CSC_PATH" "before"
12630         pathmunge "$MIDL_PATH" "before"
12631         pathmunge "$AL_PATH" "before"
12632         pathmunge "$MSPDB_PATH" "before"
12633         if test -n "$MSBUILD_PATH" ; then
12634             pathmunge "$MSBUILD_PATH" "before"
12635         fi
12636         if test "$BITNESS_OVERRIDE" = 64; then
12637             pathmunge "$COMPATH/bin/amd64" "before"
12638             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12639         else
12640             pathmunge "$COMPATH/bin" "before"
12641             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12642         fi
12643         if test "$ENABLE_JAVA" != ""; then
12644             if test -d "$JAVA_HOME/jre/bin/client"; then
12645                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12646             fi
12647             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12648                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12649             fi
12650             pathmunge "$JAVA_HOME/bin" "before"
12651         fi
12652         ;;
12654     solaris*)
12655         pathmunge "/usr/css/bin" "before"
12656         if test "$ENABLE_JAVA" != ""; then
12657             pathmunge "$JAVA_HOME/bin" "after"
12658         fi
12659         ;;
12660     esac
12663 AC_SUBST(LO_PATH)
12665 libo_FUZZ_SUMMARY
12667 # Generate a configuration sha256 we can use for deps
12668 if test -f config_host.mk; then
12669     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12671 if test -f config_host_lang.mk; then
12672     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12675 CFLAGS=$my_original_CFLAGS
12676 CXXFLAGS=$my_original_CXXFLAGS
12677 CPPFLAGS=$my_original_CPPFLAGS
12679 AC_CONFIG_FILES([config_host.mk
12680                  config_host_lang.mk
12681                  Makefile
12682                  lo.xcent
12683                  bin/bffvalidator.sh
12684                  bin/odfvalidator.sh
12685                  bin/officeotron.sh
12686                  instsetoo_native/util/openoffice.lst
12687                  sysui/desktop/macosx/Info.plist])
12688 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12689 AC_CONFIG_HEADERS([config_host/config_clang.h])
12690 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12691 AC_CONFIG_HEADERS([config_host/config_eot.h])
12692 AC_CONFIG_HEADERS([config_host/config_extension_update.h])
12693 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12694 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12695 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12696 AC_CONFIG_HEADERS([config_host/config_features.h])
12697 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12698 AC_CONFIG_HEADERS([config_host/config_folders.h])
12699 AC_CONFIG_HEADERS([config_host/config_gio.h])
12700 AC_CONFIG_HEADERS([config_host/config_global.h])
12701 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12702 AC_CONFIG_HEADERS([config_host/config_java.h])
12703 AC_CONFIG_HEADERS([config_host/config_langs.h])
12704 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12705 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12706 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12707 AC_CONFIG_HEADERS([config_host/config_locales.h])
12708 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12709 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12710 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12711 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12712 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12713 AC_CONFIG_HEADERS([config_host/config_oox.h])
12714 AC_CONFIG_HEADERS([config_host/config_options.h])
12715 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12716 AC_CONFIG_HEADERS([config_host/config_test.h])
12717 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12718 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12719 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12720 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12721 AC_CONFIG_HEADERS([config_host/config_version.h])
12722 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12723 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12724 AC_CONFIG_HEADERS([config_host/config_python.h])
12725 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12726 AC_OUTPUT
12728 if test "$CROSS_COMPILING" = TRUE; then
12729     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12732 # touch the config timestamp file
12733 if test ! -f config_host.mk.stamp; then
12734     echo > config_host.mk.stamp
12735 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12736     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12737 else
12738     echo > config_host.mk.stamp
12741 # touch the config lang timestamp file
12742 if test ! -f config_host_lang.mk.stamp; then
12743     echo > config_host_lang.mk.stamp
12744 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12745     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12746 else
12747     echo > config_host_lang.mk.stamp
12751 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12753 cat << _EOS
12754 ****************************************************************************
12755 WARNING:
12756 Your make version is known to be horribly slow, and hard to debug
12757 problems with. To get a reasonably functional make please do:
12759 to install a pre-compiled binary make for Win32
12761  mkdir -p /opt/lo/bin
12762  cd /opt/lo/bin
12763  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12764  cp make-85047eb-msvc.exe make
12765  chmod +x make
12767 to install from source:
12768 place yourself in a working directory of you choice.
12770  git clone git://git.savannah.gnu.org/make.git
12772  [go to Start menu, click "All Programs", click "Visual Studio 2015", click "Visual Studio Tools", double-click "VS2015 x86 Native Tools Command Prompt" or "VS2015 x64 Native Tools Command Prompt"]
12773  set PATH=%PATH%;C:\Cygwin\bin
12774  [or Cygwin64, if that is what you have]
12775  cd path-to-make-repo-you-cloned-above
12776  build_w32.bat --without-guile
12778 should result in a WinRel/gnumake.exe.
12779 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12781 Then re-run autogen.sh
12783 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12784 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12786 _EOS
12789 cat << _EOF
12790 ****************************************************************************
12792 To build, run:
12793 $GNUMAKE
12795 To view some help, run:
12796 $GNUMAKE help
12798 _EOF
12800 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12801     cat << _EOF
12802 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12803 _EOF
12805     if test $_os = Darwin; then
12806         echo open instdir/$PRODUCTNAME.app
12807     else
12808         echo instdir/program/soffice
12809     fi
12810     cat << _EOF
12812 If you want to run the smoketest, run:
12813 $GNUMAKE check
12815 _EOF
12818 if test -f warn; then
12819     cat warn
12820     rm warn
12823 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: