sfx2 template dialogs: fix some a11y issues
[LibreOffice.git] / configure.ac
blob0e9d452ca5915e27a1407c6c91f29e105947bac8
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.2.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 AC_PREREQ([2.59])
16 if test -n "$BUILD_TYPE"; then
17     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
20 save_CC=$CC
21 save_CXX=$CXX
23 BUILD_TYPE="LibO"
24 SCPDEFS=""
25 GIT_NEEDED_SUBMODULES=""
26 LO_PATH= # used by path_munge to construct a PATH variable
28 FilterLibs()
30     filteredlibs=
31     for f in $1; do
32         case "$f" in
33             # let's start with Fedora's paths for now
34             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
35                 # ignore it: on UNIXoids it is searched by default anyway
36                 # but if it's given explicitly then it may override other paths
37                 # (on Mac OS X it would be an error to use it instead of SDK)
38                 ;;
39             *)
40                 filteredlibs="$filteredlibs $f"
41                 ;;
42         esac
43     done
46 PathFormat()
48     formatted_path="$1"
49     if test "$build_os" = "cygwin"; then
50         pf_conv_to_dos=
51         # spaces,parentheses,brackets,braces are problematic in pathname
52         # so are backslashes
53         case "$formatted_path" in
54             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
55                 pf_conv_to_dos="yes"
56             ;;
57         esac
58         if test "$pf_conv_to_dos" = "yes"; then
59             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
60                 formatted_path=`cygpath -sm "$formatted_path"`
61             else
62                 formatted_path=`cygpath -d "$formatted_path"`
63             fi
64             if test $? -ne 0;  then
65                 AC_MSG_ERROR([path conversion failed for "$1".])
66             fi
67         fi
68         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
69         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
70         if test "$fp_count_slash$fp_count_colon" != "00"; then
71             if test "$fp_count_colon" = "0"; then
72                 new_formatted_path=`realpath "$formatted_path"`
73                 if test $? -ne 0;  then
74                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
75                 else
76                     formatted_path="$new_formatted_path"
77                 fi
78             fi
79             formatted_path=`cygpath -m "$formatted_path"`
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
85         if test "$fp_count_space" != "0"; then
86             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
87         fi
88     fi
91 AbsolutePath()
93     # There appears to be no simple and portable method to get an absolute and
94     # canonical path, so we try creating the directory if does not exist and
95     # utilizing the shell and pwd.
96     rel="$1"
97     absolute_path=""
98     test ! -e "$rel" && mkdir -p "$rel"
99     if test -d "$rel" ; then
100         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
101         absolute_path="$(pwd)"
102         cd - > /dev/null
103     else
104         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
105     fi
108 rm -f warn
109 have_WARNINGS="no"
110 add_warning()
112     if test "$have_WARNINGS" = "no"; then
113         echo "*************************************" > warn
114         have_WARNINGS="yes"
115         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
116             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
117             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
118         else
119             COLORWARN="* WARNING :"
120         fi
121     fi
122     echo "$COLORWARN $@" >> warn
125 dnl Some Mac User have the bad habbit of letting a lot fo crap
126 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
127 dnl that confuse the build.
128 dnl For the ones that use LODE, let's be nice and protect them
129 dnl from themselves
131 mac_sanitize_path()
133     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
134 dnl a common but nevertheless necessary thing that may be in a fancy
135 dnl path location is git, so make sure we have it
136     mac_git_path=`which git 2>/dev/null`
137     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
138         mac_path="$mac_path:`dirname $mac_git_path`"
139     fi
140 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
141 dnl path location is gpg, so make sure we find it
142     mac_gpg_path=`which gpg 2>/dev/null`
143     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
144         mac_path="$mac_path:`dirname $mac_gpg_path`"
145     fi
146     PATH="$mac_path"
147     unset mac_path
148     unset mac_git_path
149     unset mac_gpg_path
152 echo "********************************************************************"
153 echo "*"
154 echo "*   Running ${PACKAGE_NAME} build configuration."
155 echo "*"
156 echo "********************************************************************"
157 echo ""
159 dnl ===================================================================
160 dnl checks build and host OSes
161 dnl do this before argument processing to allow for platform dependent defaults
162 dnl ===================================================================
163 AC_CANONICAL_HOST
165 AC_MSG_CHECKING([for product name])
166 PRODUCTNAME="AC_PACKAGE_NAME"
167 if test -n "$with_product_name" -a "$with_product_name" != no; then
168     PRODUCTNAME="$with_product_name"
170 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
171     PRODUCTNAME="${PRODUCTNAME}Dev"
173 AC_MSG_RESULT([$PRODUCTNAME])
174 AC_SUBST(PRODUCTNAME)
175 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
176 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
178 dnl ===================================================================
179 dnl Our version is defined by the AC_INIT() at the top of this script.
180 dnl ===================================================================
182 AC_MSG_CHECKING([for package version])
183 if test -n "$with_package_version" -a "$with_package_version" != no; then
184     PACKAGE_VERSION="$with_package_version"
186 AC_MSG_RESULT([$PACKAGE_VERSION])
188 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
190 LIBO_VERSION_MAJOR=$1
191 LIBO_VERSION_MINOR=$2
192 LIBO_VERSION_MICRO=$3
193 LIBO_VERSION_PATCH=$4
195 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
196 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
197 # no way to encode that into an integer in general.
198 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
200 LIBO_VERSION_SUFFIX=$5
201 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
202 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
203 # they get undoubled before actually passed to sed.
204 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
205 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
206 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
207 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
209 AC_SUBST(LIBO_VERSION_MAJOR)
210 AC_SUBST(LIBO_VERSION_MINOR)
211 AC_SUBST(LIBO_VERSION_MICRO)
212 AC_SUBST(LIBO_VERSION_PATCH)
213 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
214 AC_SUBST(LIBO_VERSION_SUFFIX)
215 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
217 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
218 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
219 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
220 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
222 LIBO_THIS_YEAR=`date +%Y`
223 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
225 dnl ===================================================================
226 dnl Product version
227 dnl ===================================================================
228 AC_MSG_CHECKING([for product version])
229 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
230 AC_MSG_RESULT([$PRODUCTVERSION])
231 AC_SUBST(PRODUCTVERSION)
233 AC_PROG_EGREP
234 # AC_PROG_EGREP doesn't set GREP on all systems as well
235 AC_PATH_PROG(GREP, grep)
237 BUILDDIR=`pwd`
238 cd $srcdir
239 SRC_ROOT=`pwd`
240 cd $BUILDDIR
241 x_Cygwin=[\#]
243 dnl ======================================
244 dnl Required GObject introspection version
245 dnl ======================================
246 INTROSPECTION_REQUIRED_VERSION=1.32.0
248 dnl ===================================================================
249 dnl Search all the common names for GNU Make
250 dnl ===================================================================
251 AC_MSG_CHECKING([for GNU Make])
253 # try to use our own make if it is available and GNUMAKE was not already defined
254 if test -z "$GNUMAKE"; then
255     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
256         GNUMAKE="$LODE_HOME/opt/bin/make"
257     elif test -x "/opt/lo/bin/make"; then
258         GNUMAKE="/opt/lo/bin/make"
259     fi
262 GNUMAKE_WIN_NATIVE=
263 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
264     if test -n "$a"; then
265         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
266         if test $? -eq 0;  then
267             if test "$build_os" = "cygwin"; then
268                 if test -n "$($a -v | grep 'Built for Windows')" ; then
269                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
270                     GNUMAKE_WIN_NATIVE="TRUE"
271                 else
272                     GNUMAKE=`which $a`
273                 fi
274             else
275                 GNUMAKE=`which $a`
276             fi
277             break
278         fi
279     fi
280 done
281 AC_MSG_RESULT($GNUMAKE)
282 if test -z "$GNUMAKE"; then
283     AC_MSG_ERROR([not found. install GNU Make.])
284 else
285     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
286         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
287     fi
290 win_short_path_for_make()
292     local_short_path="$1"
293     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
294         cygpath -sm "$local_short_path"
295     else
296         cygpath -u "$(cygpath -d "$local_short_path")"
297     fi
301 if test "$build_os" = "cygwin"; then
302     PathFormat "$SRC_ROOT"
303     SRC_ROOT="$formatted_path"
304     PathFormat "$BUILDDIR"
305     BUILDDIR="$formatted_path"
306     x_Cygwin=
307     AC_MSG_CHECKING(for explicit COMSPEC)
308     if test -z "$COMSPEC"; then
309         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
310     else
311         AC_MSG_RESULT([found: $COMSPEC])
312     fi
315 AC_SUBST(SRC_ROOT)
316 AC_SUBST(BUILDDIR)
317 AC_SUBST(x_Cygwin)
318 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
319 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
321 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
322     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
325 # need sed in os checks...
326 AC_PATH_PROGS(SED, sed)
327 if test -z "$SED"; then
328     AC_MSG_ERROR([install sed to run this script])
331 # Set the ENABLE_LTO variable
332 # ===================================================================
333 AC_MSG_CHECKING([whether to use link-time optimization])
334 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
335     ENABLE_LTO="TRUE"
336     AC_MSG_RESULT([yes])
337     AC_DEFINE(STATIC_LINKING)
338 else
339     ENABLE_LTO=""
340     AC_MSG_RESULT([no])
342 AC_SUBST(ENABLE_LTO)
344 AC_ARG_ENABLE(fuzz-options,
345     AS_HELP_STRING([--enable-fuzz-options],
346         [Randomly enable or disable each of those configurable options
347          that are supposed to be freely selectable without interdependencies,
348          or where bad interaction from interdependencies is automatically avoided.])
351 dnl ===================================================================
352 dnl When building for Android, --with-android-ndk,
353 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
354 dnl mandatory
355 dnl ===================================================================
357 AC_ARG_WITH(android-ndk,
358     AS_HELP_STRING([--with-android-ndk],
359         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
362 AC_ARG_WITH(android-ndk-toolchain-version,
363     AS_HELP_STRING([--with-android-ndk-toolchain-version],
364         [Specify which toolchain version to use, of those present in the
365         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
366         with_android_ndk_toolchain_version=clang5.0)
368 AC_ARG_WITH(android-sdk,
369     AS_HELP_STRING([--with-android-sdk],
370         [Specify location of the Android SDK. Mandatory when building for Android.]),
373 ANDROID_NDK_HOME=
374 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
375     with_android_ndk="$SRC_ROOT/external/android-ndk"
377 if test -n "$with_android_ndk"; then
378     ANDROID_NDK_HOME=$with_android_ndk
380     # Set up a lot of pre-canned defaults
382     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
383         if test ! -f $ANDROID_NDK_HOME/source.properties; then
384             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
385         fi
386         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
387     else
388         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
389     fi
390     if test -z "$ANDROID_NDK_VERSION";  then
391         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
392     fi
393     case $ANDROID_NDK_VERSION in
394     r9*|r10*)
395         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
396         ;;
397     11.1.*|12.1.*|13.1.*|14.1.*)
398         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
399         ;;
400     16.*)
401         ;;
402     *)
403         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
404         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
405         ;;
406     esac
408     ANDROID_API_LEVEL=14
409     android_cpu=$host_cpu
410     ANDROID_ARCH=$android_cpu
411     if test $host_cpu = arm; then
412         android_platform_prefix=$android_cpu-linux-androideabi
413         android_gnu_prefix=$android_platform_prefix
414         LLVM_TRIPLE=armv7-none-linux-androideabi
415         ANDROID_APP_ABI=armeabi-v7a
416         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
417     elif test $host_cpu = aarch64; then
418         android_platform_prefix=$android_cpu-linux-android
419         android_gnu_prefix=$android_platform_prefix
420         LLVM_TRIPLE=aarch64-none-linux-android
421         # minimum android version that supports aarch64
422         ANDROID_API_LEVEL=21
423         ANDROID_APP_ABI=arm64-v8a
424         ANDROID_ARCH=arm64
425     elif test $host_cpu = mips; then
426         android_platform_prefix=mipsel-linux-android
427         android_gnu_prefix=$android_platform_prefix
428         LLVM_TRIPLE=mipsel-none-linux-android
429         ANDROID_APP_ABI=mips
430     else
431         # host_cpu is something like "i386" or "i686" I guess, NDK uses
432         # "x86" in some contexts
433         android_cpu=x86
434         android_platform_prefix=$android_cpu
435         android_gnu_prefix=i686-linux-android
436         LLVM_TRIPLE=i686-none-linux-android
437         ANDROID_APP_ABI=x86
438         ANDROID_ARCH=$android_cpu
439         ANDROIDCFLAGS="-march=atom"
440     fi
442     case "$with_android_ndk_toolchain_version" in
443     clang5.0)
444         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
445         ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
446         ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
447         ;;
448     *)
449         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
450     esac
452     if test ! -d $ANDROID_BINUTILS_DIR; then
453         AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
454     elif test ! -d $ANDROID_COMPILER_DIR; then
455         AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
456     fi
458     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
459     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
460     # manage to link the (app-specific) single huge .so that is built for the app in
461     # android/source/ if there is debug information in a significant part of the object files.
462     # (A 64-bit ld.gold grows to much over 10 gigabytes of virtual space when linking such a .so if
463     # all objects have been built with debug information.)
464     case $build_os in
465     linux-gnu*)
466         ndk_build_os=linux
467         ;;
468     darwin*)
469         ndk_build_os=darwin
470         ;;
471     *)
472         AC_MSG_ERROR([We only support building for Android from Linux or OS X])
473         ;;
474     esac
475     ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
476     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
477     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
479     test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
480     test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
481     test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
482     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
483     test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
484     test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
486     ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
487     # android is using different sysroots for compilation and linking, but as
488     # there is no full separation in configure and elsewhere, use isystem for
489     # compilation stuff and sysroot for linking
490     ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
491     ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
492     ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
493     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
494     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
495     else
496     ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
497     fi
498     if test "$ENABLE_LTO" = TRUE; then
499         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
500         # $CC and $CXX when building external libraries
501         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
502     fi
504     if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
505     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"
506     else
507     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"
508     fi
510     if test -z "$CC"; then
511         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
512     fi
513     if test -z "$CXX"; then
514         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
515     fi
517     # remember to download the ownCloud Android library later
518     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
520 AC_SUBST(ANDROID_NDK_HOME)
521 AC_SUBST(ANDROID_APP_ABI)
522 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
524 dnl ===================================================================
525 dnl --with-android-sdk
526 dnl ===================================================================
527 ANDROID_SDK_HOME=
528 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
529     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
531 if test -n "$with_android_sdk"; then
532     ANDROID_SDK_HOME=$with_android_sdk
533     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
535 AC_SUBST(ANDROID_SDK_HOME)
537 dnl ===================================================================
538 dnl The following is a list of supported systems.
539 dnl Sequential to keep the logic very simple
540 dnl These values may be checked and reset later.
541 dnl ===================================================================
542 #defaults unless the os test overrides this:
543 test_randr=yes
544 test_xrender=yes
545 test_cups=yes
546 test_dbus=yes
547 test_fontconfig=yes
548 test_cairo=no
550 # Default values, as such probably valid just for Linux, set
551 # differently below just for Mac OSX,but at least better than
552 # hardcoding these as we used to do. Much of this is duplicated also
553 # in solenv for old build system and for gbuild, ideally we should
554 # perhaps define stuff like this only here in configure.ac?
556 LINKFLAGSSHL="-shared"
557 PICSWITCH="-fpic"
558 DLLPOST=".so"
560 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
562 INSTROOTBASESUFFIX=
563 INSTROOTCONTENTSUFFIX=
564 SDKDIRNAME=sdk
566 case "$host_os" in
568 solaris*)
569     test_gtk=yes
570     build_gstreamer_1_0=yes
571     build_gstreamer_0_10=yes
572     test_freetype=yes
573     _os=SunOS
575     dnl ===========================================================
576     dnl Check whether we're using Solaris 10 - SPARC or Intel.
577     dnl ===========================================================
578     AC_MSG_CHECKING([the Solaris operating system release])
579     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
580     if test "$_os_release" -lt "10"; then
581         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
582     else
583         AC_MSG_RESULT([ok ($_os_release)])
584     fi
586     dnl Check whether we're using a SPARC or i386 processor
587     AC_MSG_CHECKING([the processor type])
588     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
589         AC_MSG_RESULT([ok ($host_cpu)])
590     else
591         AC_MSG_ERROR([only SPARC and i386 processors are supported])
592     fi
593     ;;
595 linux-gnu*|k*bsd*-gnu*)
596     test_gtk=yes
597     build_gstreamer_1_0=yes
598     build_gstreamer_0_10=yes
599     test_kde4=yes
600     test_kde5=yes
601     test_qt5=yes
602     test_gtk3_kde5=yes
603     if test "$enable_fuzzers" != yes; then
604         test_freetype=yes
605         test_fontconfig=yes
606     else
607         test_freetype=no
608         test_fontconfig=no
609         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
610     fi
611     _os=Linux
612     ;;
614 gnu)
615     test_randr=no
616     test_xrender=no
617     _os=GNU
618      ;;
620 cygwin*|interix*)
622     # When building on Windows normally with MSVC under Cygwin,
623     # configure thinks that the host platform (the platform the
624     # built code will run on) is Cygwin, even if it obviously is
625     # Windows, which in Autoconf terminology is called
626     # "mingw32". (Which is misleading as MinGW is the name of the
627     # tool-chain, not an operating system.)
629     # Somewhat confusing, yes. But this configure script doesn't
630     # look at $host etc that much, it mostly uses its own $_os
631     # variable, set here in this case statement.
633     test_cups=no
634     test_dbus=no
635     test_randr=no
636     test_xrender=no
637     test_freetype=no
638     test_fontconfig=no
639     _os=WINNT
641     DLLPOST=".dll"
642     LINKFLAGSNOUNDEFS=
643     ;;
645 darwin*) # Mac OS X or iOS
646     test_gtk=yes
647     test_randr=no
648     test_xrender=no
649     test_freetype=no
650     test_fontconfig=no
651     test_dbus=no
652     if test -n "$LODE_HOME" ; then
653         mac_sanitize_path
654         AC_MSG_NOTICE([sanitized the PATH to $PATH])
655     fi
656     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
657         build_for_ios=YES
658         _os=iOS
659         test_gtk=no
660         test_cups=no
661         enable_mpl_subset=yes
662         enable_lotuswordpro=no
663         enable_coinmp=no
664         enable_lpsolve=no
665         enable_postgresql_sdbc=no
666         enable_extension_integration=no
667         enable_report_builder=no
668         with_theme="tango"
669         with_ppds=no
670         if test "$enable_ios_simulator" = "yes"; then
671             host=x86_64-apple-darwin
672         fi
673     else
674         _os=Darwin
675         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
676         INSTROOTCONTENTSUFFIX=/Contents
677         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
678     fi
679     # See comment above the case "$host_os"
680     LINKFLAGSSHL="-dynamiclib -single_module"
682     # -fPIC is default
683     PICSWITCH=""
685     DLLPOST=".dylib"
687     # -undefined error is the default
688     LINKFLAGSNOUNDEFS=""
691 freebsd*)
692     test_gtk=yes
693     build_gstreamer_1_0=yes
694     build_gstreamer_0_10=yes
695     test_kde4=yes
696     test_kde5=yes
697     test_qt5=yes
698     test_gtk3_kde5=yes
699     test_freetype=yes
700     AC_MSG_CHECKING([the FreeBSD operating system release])
701     if test -n "$with_os_version"; then
702         OSVERSION="$with_os_version"
703     else
704         OSVERSION=`/sbin/sysctl -n kern.osreldate`
705     fi
706     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
707     AC_MSG_CHECKING([which thread library to use])
708     if test "$OSVERSION" -lt "500016"; then
709         PTHREAD_CFLAGS="-D_THREAD_SAFE"
710         PTHREAD_LIBS="-pthread"
711     elif test "$OSVERSION" -lt "502102"; then
712         PTHREAD_CFLAGS="-D_THREAD_SAFE"
713         PTHREAD_LIBS="-lc_r"
714     else
715         PTHREAD_CFLAGS=""
716         PTHREAD_LIBS="-pthread"
717     fi
718     AC_MSG_RESULT([$PTHREAD_LIBS])
719     _os=FreeBSD
720     ;;
722 *netbsd*)
723     test_gtk=yes
724     build_gstreamer_1_0=yes
725     build_gstreamer_0_10=yes
726     test_kde4=yes
727     test_kde5=yes
728     test_qt5=yes
729     test_gtk3_kde5=yes
730     test_freetype=yes
731     PTHREAD_LIBS="-pthread -lpthread"
732     _os=NetBSD
733     ;;
735 aix*)
736     test_randr=no
737     test_freetype=yes
738     PTHREAD_LIBS=-pthread
739     _os=AIX
740     ;;
742 openbsd*)
743     test_gtk=yes
744     test_freetype=yes
745     PTHREAD_CFLAGS="-D_THREAD_SAFE"
746     PTHREAD_LIBS="-pthread"
747     _os=OpenBSD
748     ;;
750 dragonfly*)
751     test_gtk=yes
752     build_gstreamer_1_0=yes
753     build_gstreamer_0_10=yes
754     test_kde4=yes
755     test_kde5=yes
756     test_qt5=yes
757     test_gtk3_kde5=yes
758     test_freetype=yes
759     PTHREAD_LIBS="-pthread"
760     _os=DragonFly
761     ;;
763 linux-android*)
764     build_gstreamer_1_0=no
765     build_gstreamer_0_10=no
766     enable_lotuswordpro=no
767     enable_mpl_subset=yes
768     enable_coinmp=yes
769     enable_lpsolve=no
770     enable_report_builder=no
771     enable_odk=no
772     enable_postgresql_sdbc=no
773     enable_python=no
774     with_theme="tango"
775     test_cups=no
776     test_dbus=no
777     test_fontconfig=no
778     test_freetype=no
779     test_gtk=no
780     test_kde4=no
781     test_kde5=no
782     test_qt5=no
783     test_gtk3_kde5=no
784     test_randr=no
785     test_xrender=no
786     _os=Android
788     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
789     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
790     ;;
792 haiku*)
793     test_cups=no
794     test_dbus=no
795     test_randr=no
796     test_xrender=no
797     test_freetype=yes
798     enable_odk=no
799     enable_gstreamer_0_10=no
800     enable_gstreamer_1_0=no
801     enable_vlc=no
802     enable_coinmp=no
803     enable_pdfium=no
804     enable_sdremote=no
805     enable_postgresql_sdbc=no
806     enable_firebird_sdbc=no
807     _os=Haiku
808     ;;
811     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
812     ;;
813 esac
815 if test "$_os" = "Android" ; then
816     # Verify that the NDK and SDK options are proper
817     if test -z "$with_android_ndk"; then
818         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
819     elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
820         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
821     fi
823     if test -z "$ANDROID_SDK_HOME"; then
824         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
825     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
826         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
827     fi
829     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
830     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
831         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
832                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
833                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
834         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
835         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
836         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
837     fi
838     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
839         AC_MSG_WARN([android support repository not found - install with
840                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
841                      to allow the build to download the specified version of the android support libraries])
842         add_warning "android support repository not found - install with"
843         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
844         add_warning "to allow the build to download the specified version of the android support libraries"
845     fi
848 if test "$_os" = "AIX"; then
849     AC_PATH_PROG(GAWK, gawk)
850     if test -z "$GAWK"; then
851         AC_MSG_ERROR([gawk not found in \$PATH])
852     fi
855 AC_SUBST(SDKDIRNAME)
857 AC_SUBST(PTHREAD_CFLAGS)
858 AC_SUBST(PTHREAD_LIBS)
860 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
861 # By default use the ones specified by our build system,
862 # but explicit override is possible.
863 AC_MSG_CHECKING(for explicit AFLAGS)
864 if test -n "$AFLAGS"; then
865     AC_MSG_RESULT([$AFLAGS])
866     x_AFLAGS=
867 else
868     AC_MSG_RESULT(no)
869     x_AFLAGS=[\#]
871 AC_MSG_CHECKING(for explicit CFLAGS)
872 if test -n "$CFLAGS"; then
873     AC_MSG_RESULT([$CFLAGS])
874     x_CFLAGS=
875 else
876     AC_MSG_RESULT(no)
877     x_CFLAGS=[\#]
879 AC_MSG_CHECKING(for explicit CXXFLAGS)
880 if test -n "$CXXFLAGS"; then
881     AC_MSG_RESULT([$CXXFLAGS])
882     x_CXXFLAGS=
883 else
884     AC_MSG_RESULT(no)
885     x_CXXFLAGS=[\#]
887 AC_MSG_CHECKING(for explicit OBJCFLAGS)
888 if test -n "$OBJCFLAGS"; then
889     AC_MSG_RESULT([$OBJCFLAGS])
890     x_OBJCFLAGS=
891 else
892     AC_MSG_RESULT(no)
893     x_OBJCFLAGS=[\#]
895 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
896 if test -n "$OBJCXXFLAGS"; then
897     AC_MSG_RESULT([$OBJCXXFLAGS])
898     x_OBJCXXFLAGS=
899 else
900     AC_MSG_RESULT(no)
901     x_OBJCXXFLAGS=[\#]
903 AC_MSG_CHECKING(for explicit LDFLAGS)
904 if test -n "$LDFLAGS"; then
905     AC_MSG_RESULT([$LDFLAGS])
906     x_LDFLAGS=
907 else
908     AC_MSG_RESULT(no)
909     x_LDFLAGS=[\#]
911 AC_SUBST(AFLAGS)
912 AC_SUBST(CFLAGS)
913 AC_SUBST(CXXFLAGS)
914 AC_SUBST(OBJCFLAGS)
915 AC_SUBST(OBJCXXFLAGS)
916 AC_SUBST(LDFLAGS)
917 AC_SUBST(x_AFLAGS)
918 AC_SUBST(x_CFLAGS)
919 AC_SUBST(x_CXXFLAGS)
920 AC_SUBST(x_OBJCFLAGS)
921 AC_SUBST(x_OBJCXXFLAGS)
922 AC_SUBST(x_LDFLAGS)
924 dnl These are potentially set for MSVC, in the code checking for UCRT below:
925 my_original_CFLAGS=$CFLAGS
926 my_original_CXXFLAGS=$CXXFLAGS
927 my_original_CPPFLAGS=$CPPFLAGS
929 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
930 dnl Needs to precede the AC_SEARCH_LIBS call below, which apparently calls
931 dnl AC_PROG_CC internally.
932 if test "$_os" != "WINNT"; then
933     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
934     save_CFLAGS=$CFLAGS
935     AC_PROG_CC
936     CFLAGS=$save_CFLAGS
939 if test $_os != "WINNT"; then
940     save_LIBS="$LIBS"
941     AC_SEARCH_LIBS([dlsym], [dl],
942         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
943         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
944     LIBS="$save_LIBS"
946 AC_SUBST(DLOPEN_LIBS)
948 AC_ARG_ENABLE(ios-simulator,
949     AS_HELP_STRING([--enable-ios-simulator],
950         [build i386 or x86_64 for ios simulator])
953 AC_ARG_ENABLE(ios-libreofficelight-app,
954     AS_HELP_STRING([--enable-ios-libreofficelight-app],
955         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
956          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
957          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
960 ENABLE_IOS_LIBREOFFICELIGHT_APP=
961 if test "$enable_ios_libreofficelight_app" = yes; then
962     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
964 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
966 ###############################################################################
967 # Extensions switches --enable/--disable
968 ###############################################################################
969 # By default these should be enabled unless having extra dependencies.
970 # If there is extra dependency over configure options then the enable should
971 # be automagic based on whether the requiring feature is enabled or not.
972 # All this options change anything only with --enable-extension-integration.
974 # The name of this option and its help string makes it sound as if
975 # extensions are built anyway, just not integrated in the installer,
976 # if you use --disable-extension-integration. Is that really the
977 # case?
979 libo_FUZZ_ARG_ENABLE(extension-integration,
980     AS_HELP_STRING([--disable-extension-integration],
981         [Disable integration of the built extensions in the installer of the
982          product. Use this switch to disable the integration.])
985 AC_ARG_ENABLE(avmedia,
986     AS_HELP_STRING([--disable-avmedia],
987         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
990 AC_ARG_ENABLE(database-connectivity,
991     AS_HELP_STRING([--disable-database-connectivity],
992         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
995 # This doesn't mean not building (or "integrating") extensions
996 # (although it probably should; i.e. it should imply
997 # --disable-extension-integration I guess), it means not supporting
998 # any extension mechanism at all
999 libo_FUZZ_ARG_ENABLE(extensions,
1000     AS_HELP_STRING([--disable-extensions],
1001         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1004 AC_ARG_ENABLE(scripting,
1005     AS_HELP_STRING([--disable-scripting],
1006         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1009 # This is mainly for Android and iOS, but could potentially be used in some
1010 # special case otherwise, too, so factored out as a separate setting
1012 AC_ARG_ENABLE(dynamic-loading,
1013     AS_HELP_STRING([--disable-dynamic-loading],
1014         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1017 libo_FUZZ_ARG_ENABLE(report-builder,
1018     AS_HELP_STRING([--disable-report-builder],
1019         [Disable the Report Builder.])
1022 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1023     AS_HELP_STRING([--enable-ext-wiki-publisher],
1024         [Enable the Wiki Publisher extension.])
1027 libo_FUZZ_ARG_ENABLE(lpsolve,
1028     AS_HELP_STRING([--disable-lpsolve],
1029         [Disable compilation of the lp solve solver ])
1031 libo_FUZZ_ARG_ENABLE(coinmp,
1032     AS_HELP_STRING([--disable-coinmp],
1033         [Disable compilation of the CoinMP solver ])
1036 libo_FUZZ_ARG_ENABLE(pdfimport,
1037     AS_HELP_STRING([--disable-pdfimport],
1038         [Disable building the PDF import feature.])
1041 libo_FUZZ_ARG_ENABLE(pdfium,
1042     AS_HELP_STRING([--disable-pdfium],
1043         [Disable building PDFium.])
1046 ###############################################################################
1048 dnl ---------- *** ----------
1050 libo_FUZZ_ARG_ENABLE(mergelibs,
1051     AS_HELP_STRING([--enable-mergelibs],
1052         [Merge several of the smaller libraries into one big, "merged", one.])
1055 libo_FUZZ_ARG_ENABLE(breakpad,
1056     AS_HELP_STRING([--enable-breakpad],
1057         [Enables breakpad for crash reporting.])
1060 AC_ARG_ENABLE(fetch-external,
1061     AS_HELP_STRING([--disable-fetch-external],
1062         [Disables fetching external tarballs from web sources.])
1065 AC_ARG_ENABLE(fuzzers,
1066     AS_HELP_STRING([--enable-fuzzers],
1067         [Enables building libfuzzer targets for fuzz testing.])
1070 libo_FUZZ_ARG_ENABLE(pch,
1071     AS_HELP_STRING([--enable-pch],
1072         [Enables precompiled header support for C++. Forced default on Windows/VC build])
1075 libo_FUZZ_ARG_ENABLE(epm,
1076     AS_HELP_STRING([--enable-epm],
1077         [LibreOffice includes self-packaging code, that requires epm, however epm is
1078          useless for large scale package building.])
1081 libo_FUZZ_ARG_ENABLE(odk,
1082     AS_HELP_STRING([--disable-odk],
1083         [LibreOffice includes an ODK, office development kit which some packagers may
1084          wish to build without.])
1087 AC_ARG_ENABLE(mpl-subset,
1088     AS_HELP_STRING([--enable-mpl-subset],
1089         [Don't compile any pieces which are not MPL or more liberally licensed])
1092 libo_FUZZ_ARG_ENABLE(evolution2,
1093     AS_HELP_STRING([--enable-evolution2],
1094         [Allows the built-in evolution 2 addressbook connectivity build to be
1095          enabled.])
1098 AC_ARG_ENABLE(avahi,
1099     AS_HELP_STRING([--enable-avahi],
1100         [Determines whether to use Avahi to advertise Impress to remote controls.])
1103 libo_FUZZ_ARG_ENABLE(werror,
1104     AS_HELP_STRING([--enable-werror],
1105         [Turn warnings to errors. (Has no effect in modules where the treating
1106          of warnings as errors is disabled explicitly.)]),
1109 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1110     AS_HELP_STRING([--enable-assert-always-abort],
1111         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1114 libo_FUZZ_ARG_ENABLE(dbgutil,
1115     AS_HELP_STRING([--enable-dbgutil],
1116         [Provide debugging support from --enable-debug and include additional debugging
1117          utilities such as object counting or more expensive checks.
1118          This is the recommended option for developers.
1119          Note that this makes the build ABI incompatible, it is not possible to mix object
1120          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1122 libo_FUZZ_ARG_ENABLE(debug,
1123     AS_HELP_STRING([--enable-debug],
1124         [Include debugging information, disable compiler optimization and inlining plus
1125          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1127 libo_FUZZ_ARG_ENABLE(split-debug,
1128     AS_HELP_STRING([--enable-split-debug],
1129         [Uses split debug information (-gsplit-dwarf compile flag). Saves disk space and build time,
1130          but requires tools that support it (both build tools and debuggers).]))
1132 libo_FUZZ_ARG_ENABLE(gdb-index,
1133     AS_HELP_STRING([--enable-gdb-index],
1134         [Creates debug information in the gdb index format, which makes gdb start faster.
1135          Requires the gold or lld linker.]))
1137 libo_FUZZ_ARG_ENABLE(sal-log,
1138     AS_HELP_STRING([--enable-sal-log],
1139         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1141 AC_ARG_ENABLE(selective-debuginfo,
1142     AS_HELP_STRING([--enable-selective-debuginfo],
1143         [If --enable-debug or --enable-dbgutil is used, build debugging information
1144          (-g compiler flag) only for the specified gbuild build targets
1145          (where all means everything, - prepended means not to enable, / appended means
1146          everything in the directory; there is no ordering, more specific overrides
1147          more general, and disabling takes precedence).
1148          Example: --enable-selective-debuginfo="all -sw/ -Library_sc".]))
1150 libo_FUZZ_ARG_ENABLE(symbols,
1151     AS_HELP_STRING([--enable-symbols],
1152         [Generate debug information.
1153          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1154          otherwise.]))
1156 libo_FUZZ_ARG_ENABLE(optimized,
1157     AS_HELP_STRING([--disable-optimized],
1158         [Whether to compile with optimization flags.
1159          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1160          otherwise.]))
1162 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1163     AS_HELP_STRING([--disable-runtime-optimizations],
1164         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1165          JVM JIT) that are known to interact badly with certain dynamic analysis
1166          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1167          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1168          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1170 AC_ARG_WITH(valgrind,
1171     AS_HELP_STRING([--with-valgrind],
1172         [Make availability of Valgrind headers a hard requirement.]))
1174 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1175     AS_HELP_STRING([--enable-compiler-plugins],
1176         [Enable compiler plugins that will perform additional checks during
1177          building. Enabled automatically by --enable-dbgutil.
1178          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1179 COMPILER_PLUGINS_DEBUG=
1180 if test "$enable_compiler_plugins" = debug; then
1181     enable_compiler_plugins=yes
1182     COMPILER_PLUGINS_DEBUG=TRUE
1185 libo_FUZZ_ARG_ENABLE(ooenv,
1186     AS_HELP_STRING([--disable-ooenv],
1187         [Disable ooenv for the instdir installation.]))
1189 libo_FUZZ_ARG_ENABLE(libnumbertext,
1190     AS_HELP_STRING([--disable-libnumbertext],
1191         [Disable use of numbertext external library.]))
1193 AC_ARG_ENABLE(lto,
1194     AS_HELP_STRING([--enable-lto],
1195         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1196          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1197          linker. For MSVC, this option is broken at the moment. This is experimental work
1198          in progress that shouldn't be used unless you are working on it.)]))
1200 AC_ARG_ENABLE(python,
1201     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1202         [Enables or disables Python support at run-time.
1203          Also specifies what Python to use. 'auto' is the default.
1204          'fully-internal' even forces the internal version for uses of Python
1205          during the build.]))
1207 libo_FUZZ_ARG_ENABLE(gtk,
1208     AS_HELP_STRING([--disable-gtk],
1209         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1210 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1212 libo_FUZZ_ARG_ENABLE(gtk3,
1213     AS_HELP_STRING([--disable-gtk3],
1214         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1215 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1217 AC_ARG_ENABLE(split-app-modules,
1218     AS_HELP_STRING([--enable-split-app-modules],
1219         [Split file lists for app modules, e.g. base, calc.
1220          Has effect only with make distro-pack-install]),
1223 AC_ARG_ENABLE(split-opt-features,
1224     AS_HELP_STRING([--enable-split-opt-features],
1225         [Split file lists for some optional features, e.g. pyuno, testtool.
1226          Has effect only with make distro-pack-install]),
1229 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1230     AS_HELP_STRING([--disable-cairo-canvas],
1231         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1234 libo_FUZZ_ARG_ENABLE(dbus,
1235     AS_HELP_STRING([--disable-dbus],
1236         [Determines whether to enable features that depend on dbus.
1237          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1238 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1240 libo_FUZZ_ARG_ENABLE(sdremote,
1241     AS_HELP_STRING([--disable-sdremote],
1242         [Determines whether to enable Impress remote control (i.e. the server component).]),
1243 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1245 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1246     AS_HELP_STRING([--disable-sdremote-bluetooth],
1247         [Determines whether to build sdremote with bluetooth support.
1248          Requires dbus on Linux.]))
1250 libo_FUZZ_ARG_ENABLE(gio,
1251     AS_HELP_STRING([--disable-gio],
1252         [Determines whether to use the GIO support.]),
1253 ,test "${enable_gio+set}" = set || enable_gio=yes)
1255 AC_ARG_ENABLE(kde4,
1256     AS_HELP_STRING([--enable-kde4],
1257         [Determines whether to use Qt4/KDE4 vclplug on platforms where Qt4 and
1258          KDE4 are available.]),
1261 AC_ARG_ENABLE(qt5,
1262     AS_HELP_STRING([--enable-qt5],
1263         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1264          available.]),
1267 AC_ARG_ENABLE(kde5,
1268     AS_HELP_STRING([--enable-kde5],
1269         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1270          KF5 are available.]),
1273 AC_ARG_ENABLE(gtk3_kde5,
1274     AS_HELP_STRING([--enable-gtk3-kde5],
1275         [Determines whether to use Gtk3 vclplug with KDE file dialogs on
1276          platforms where Gtk3, Qt5 and Plasma is available.]),
1279 libo_FUZZ_ARG_ENABLE(gui,
1280     AS_HELP_STRING([--disable-gui],
1281         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1282          command-line option. Not related to LibreOffice Online functionality. Don't use
1283          unless you are certain you need to. Nobody will help you if you insist on trying
1284          this and run into problems.]),
1285 ,test "${enable_gui+set}" = set || enable_gui=yes)
1287 libo_FUZZ_ARG_ENABLE(randr,
1288     AS_HELP_STRING([--disable-randr],
1289         [Disable RandR support in the vcl project.]),
1290 ,test "${enable_randr+set}" = set || enable_randr=yes)
1292 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1293     AS_HELP_STRING([--disable-gstreamer-1-0],
1294         [Disable building with the new gstreamer 1.0 avmedia backend.]),
1295 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1297 AC_ARG_ENABLE(gstreamer-0-10,
1298     AS_HELP_STRING([--enable-gstreamer-0-10],
1299         [Enable building with the gstreamer 0.10 avmedia backend.]),
1300 ,enable_gstreamer_0_10=no)
1302 libo_FUZZ_ARG_ENABLE(vlc,
1303     AS_HELP_STRING([--enable-vlc],
1304         [Enable building with the (experimental) VLC avmedia backend.]),
1305 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1307 libo_FUZZ_ARG_ENABLE(neon,
1308     AS_HELP_STRING([--disable-neon],
1309         [Disable neon and the compilation of webdav binding.]),
1312 libo_FUZZ_ARG_ENABLE([eot],
1313     [AS_HELP_STRING([--enable-eot],
1314         [Enable support for Embedded OpenType fonts.])],
1315 ,test "${enable_eot+set}" = set || enable_eot=no)
1317 libo_FUZZ_ARG_ENABLE(cve-tests,
1318     AS_HELP_STRING([--disable-cve-tests],
1319         [Prevent CVE tests to be executed]),
1322 libo_FUZZ_ARG_ENABLE(chart-tests,
1323     AS_HELP_STRING([--enable-chart-tests],
1324         [Executes chart XShape tests. In a perfect world these tests would be
1325          stable and everyone could run them, in reality it is best to run them
1326          only on a few machines that are known to work and maintained by people
1327          who can judge if a test failure is a regression or not.]),
1330 AC_ARG_ENABLE(build-unowinreg,
1331     AS_HELP_STRING([--enable-build-unowinreg],
1332         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1333          compiler is needed on Linux.]),
1336 AC_ARG_ENABLE(build-opensymbol,
1337     AS_HELP_STRING([--enable-build-opensymbol],
1338         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1339          fontforge installed.]),
1342 AC_ARG_ENABLE(dependency-tracking,
1343     AS_HELP_STRING([--enable-dependency-tracking],
1344         [Do not reject slow dependency extractors.])[
1345   --disable-dependency-tracking
1346                           Disables generation of dependency information.
1347                           Speed up one-time builds.],
1350 AC_ARG_ENABLE(icecream,
1351     AS_HELP_STRING([--enable-icecream],
1352         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1353          It defaults to /opt/icecream for the location of the icecream gcc/g++
1354          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1357 AC_ARG_ENABLE(ld,
1358     AS_HELP_STRING([--enable-ld=<linker>],
1359         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.]),
1362 libo_FUZZ_ARG_ENABLE(cups,
1363     AS_HELP_STRING([--disable-cups],
1364         [Do not build cups support.])
1367 AC_ARG_ENABLE(ccache,
1368     AS_HELP_STRING([--disable-ccache],
1369         [Do not try to use ccache automatically.
1370          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1371          CC/CXX are not yet set, and --enable-icecream is not given, we
1372          attempt to use ccache. --disable-ccache disables ccache completely.
1376 AC_ARG_ENABLE(64-bit,
1377     AS_HELP_STRING([--enable-64-bit],
1378         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1379          At the moment meaningful only for Windows.]), ,)
1381 libo_FUZZ_ARG_ENABLE(online-update,
1382     AS_HELP_STRING([--enable-online-update],
1383         [Enable the online update service that will check for new versions of
1384          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1385          If the value is "mar", the experimental Mozilla-like update will be
1386          enabled instead of the traditional update mechanism.]),
1389 AC_ARG_WITH(update-config,
1390     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1391                    [Path to the update config ini file]))
1393 libo_FUZZ_ARG_ENABLE(extension-update,
1394     AS_HELP_STRING([--disable-extension-update],
1395         [Disable possibility to update installed extensions.]),
1398 libo_FUZZ_ARG_ENABLE(release-build,
1399     AS_HELP_STRING([--enable-release-build],
1400         [Enable release build. Note that the "release build" choice is orthogonal to
1401          whether symbols are present, debug info is generated, or optimization
1402          is done.
1403          See http://wiki.documentfoundation.org/Development/DevBuild]),
1406 AC_ARG_ENABLE(windows-build-signing,
1407     AS_HELP_STRING([--enable-windows-build-signing],
1408         [Enable signing of windows binaries (*.exe, *.dll)]),
1411 AC_ARG_ENABLE(silent-msi,
1412     AS_HELP_STRING([--enable-silent-msi],
1413         [Enable MSI with LIMITUI=1 (silent install).]),
1416 AC_ARG_ENABLE(macosx-code-signing,
1417     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1418         [Sign executables, dylibs, frameworks and the app bundle. If you
1419          don't provide an identity the first suitable certificate
1420          in your keychain is used.]),
1423 AC_ARG_ENABLE(macosx-package-signing,
1424     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1425         [Create a .pkg suitable for uploading to the Mac App Store and sign
1426          it. If you don't provide an identity the first suitable certificate
1427          in your keychain is used.]),
1430 AC_ARG_ENABLE(macosx-sandbox,
1431     AS_HELP_STRING([--enable-macosx-sandbox],
1432         [Make the app bundle run in a sandbox. Requires code signing.
1433          Is required by apps distributed in the Mac App Store, and implies
1434          adherence to App Store rules.]),
1437 AC_ARG_WITH(macosx-bundle-identifier,
1438     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1439         [Define the OS X bundle identifier. Default is the somewhat weird
1440          org.libreoffice.script ("script", huh?).]),
1441 ,with_macosx_bundle_identifier=org.libreoffice.script)
1443 AC_ARG_WITH(product-name,
1444     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1445         [Define the product name. Default is AC_PACKAGE_NAME.]),
1446 ,with_product_name=$PRODUCTNAME)
1448 AC_ARG_WITH(package-version,
1449     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1450         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1453 libo_FUZZ_ARG_ENABLE(readonly-installset,
1454     AS_HELP_STRING([--enable-readonly-installset],
1455         [Prevents any attempts by LibreOffice to write into its installation. That means
1456          at least that no "system-wide" extensions can be added. Partly experimental work in
1457          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1460 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1461     AS_HELP_STRING([--disable-postgresql-sdbc],
1462         [Disable the build of the PostgreSQL-SDBC driver.])
1465 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1466     AS_HELP_STRING([--disable-lotuswordpro],
1467         [Disable the build of the Lotus Word Pro filter.]),
1468 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1470 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1471     AS_HELP_STRING([--disable-firebird-sdbc],
1472         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1473 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1475 AC_ARG_ENABLE(bogus-pkg-config,
1476     AS_HELP_STRING([--enable-bogus-pkg-config],
1477         [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.]),
1480 AC_ARG_ENABLE(openssl,
1481     AS_HELP_STRING([--disable-openssl],
1482         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1483          components will either use GNUTLS or NSS. Work in progress,
1484          use only if you are hacking on it.]),
1485 ,enable_openssl=yes)
1487 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1488     AS_HELP_STRING([--enable-cipher-openssl-backend],
1489         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1490          Requires --enable-openssl.]))
1492 AC_ARG_ENABLE(library-bin-tar,
1493     AS_HELP_STRING([--enable-library-bin-tar],
1494         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1495         Some libraries can save their build result in a tarball
1496         stored in TARFILE_LOCATION. That binary tarball is
1497         uniquely identified by the source tarball,
1498         the content of the config_host.mk file and the content
1499         of the top-level directory in core for that library
1500         If this option is enabled, then if such a tarfile exist, it will be untarred
1501         instead of the source tarfile, and the build step will be skipped for that
1502         library.
1503         If a proper tarfile does not exist, then the normal source-based
1504         build is done for that library and a proper binary tarfile is created
1505         for the next time.]),
1508 AC_ARG_ENABLE(dconf,
1509     AS_HELP_STRING([--disable-dconf],
1510         [Disable the dconf configuration backend (enabled by default where
1511          available).]))
1513 libo_FUZZ_ARG_ENABLE(formula-logger,
1514     AS_HELP_STRING(
1515         [--enable-formula-logger],
1516         [Enable formula logger for logging formula calculation flow in Calc.]
1517     )
1520 dnl ===================================================================
1521 dnl Optional Packages (--with/without-)
1522 dnl ===================================================================
1524 AC_ARG_WITH(gcc-home,
1525     AS_HELP_STRING([--with-gcc-home],
1526         [Specify the location of gcc/g++ manually. This can be used in conjunction
1527          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1528          non-default path.]),
1531 AC_ARG_WITH(gnu-patch,
1532     AS_HELP_STRING([--with-gnu-patch],
1533         [Specify location of GNU patch on Solaris or FreeBSD.]),
1536 AC_ARG_WITH(build-platform-configure-options,
1537     AS_HELP_STRING([--with-build-platform-configure-options],
1538         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1541 AC_ARG_WITH(gnu-cp,
1542     AS_HELP_STRING([--with-gnu-cp],
1543         [Specify location of GNU cp on Solaris or FreeBSD.]),
1546 AC_ARG_WITH(external-tar,
1547     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1548         [Specify an absolute path of where to find (and store) tarfiles.]),
1549     TARFILE_LOCATION=$withval ,
1552 AC_ARG_WITH(referenced-git,
1553     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1554         [Specify another checkout directory to reference. This makes use of
1555                  git submodule update --reference, and saves a lot of diskspace
1556                  when having multiple trees side-by-side.]),
1557     GIT_REFERENCE_SRC=$withval ,
1560 AC_ARG_WITH(linked-git,
1561     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1562         [Specify a directory where the repositories of submodules are located.
1563          This uses a method similar to git-new-workdir to get submodules.]),
1564     GIT_LINK_SRC=$withval ,
1567 AC_ARG_WITH(galleries,
1568     AS_HELP_STRING([--with-galleries],
1569         [Specify how galleries should be built. It is possible either to
1570          build these internally from source ("build"),
1571          or to disable them ("no")]),
1574 AC_ARG_WITH(theme,
1575     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1576         [Choose which themes to include. By default those themes with an '*' are included.
1577          Possible choices: *breeze, *breeze_dark, *colibre, *elementary, *karasa_jaga, *sifr, *sifr_dark, *tango.]),
1580 libo_FUZZ_ARG_WITH(helppack-integration,
1581     AS_HELP_STRING([--without-helppack-integration],
1582         [It will not integrate the helppacks to the installer
1583          of the product. Please use this switch to use the online help
1584          or separate help packages.]),
1587 libo_FUZZ_ARG_WITH(fonts,
1588     AS_HELP_STRING([--without-fonts],
1589         [LibreOffice includes some third-party fonts to provide a reliable basis for
1590          help content, templates, samples, etc. When these fonts are already
1591          known to be available on the system then you should use this option.]),
1594 AC_ARG_WITH(epm,
1595     AS_HELP_STRING([--with-epm],
1596         [Decides which epm to use. Default is to use the one from the system if
1597          one is built. When either this is not there or you say =internal epm
1598          will be built.]),
1601 AC_ARG_WITH(package-format,
1602     AS_HELP_STRING([--with-package-format],
1603         [Specify package format(s) for LibreOffice installation sets. The
1604          implicit --without-package-format leads to no installation sets being
1605          generated. Possible values: aix, archive, bsd, deb, dmg,
1606          installed, msi, pkg, and rpm.
1607          Example: --with-package-format='deb rpm']),
1610 AC_ARG_WITH(tls,
1611     AS_HELP_STRING([--with-tls],
1612         [Decides which TLS/SSL and cryptographic implementations to use for
1613          LibreOffice's code. Notice that this doesn't apply for depending
1614          libraries like "neon", for example. Default is to use OpenSSL
1615          although NSS is also possible. Notice that selecting NSS restricts
1616          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1617          restrict by now the usage of NSS in LO's code. Possible values:
1618          openssl, nss. Example: --with-tls="nss"]),
1621 AC_ARG_WITH(system-libs,
1622     AS_HELP_STRING([--with-system-libs],
1623         [Use libraries already on system -- enables all --with-system-* flags.]),
1626 AC_ARG_WITH(system-bzip2,
1627     AS_HELP_STRING([--with-system-bzip2],
1628         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1629     [with_system_bzip2="$with_system_libs"])
1631 AC_ARG_WITH(system-headers,
1632     AS_HELP_STRING([--with-system-headers],
1633         [Use headers already on system -- enables all --with-system-* flags for
1634          external packages whose headers are the only entities used i.e.
1635          boost/odbc/sane-header(s).]),,
1636     [with_system_headers="$with_system_libs"])
1638 AC_ARG_WITH(system-jars,
1639     AS_HELP_STRING([--without-system-jars],
1640         [When building with --with-system-libs, also the needed jars are expected
1641          on the system. Use this to disable that]),,
1642     [with_system_jars="$with_system_libs"])
1644 AC_ARG_WITH(system-cairo,
1645     AS_HELP_STRING([--with-system-cairo],
1646         [Use cairo libraries already on system.  Happens automatically for
1647          (implicit) --enable-gtk and for --enable-gtk3.]))
1649 AC_ARG_WITH(system-epoxy,
1650     AS_HELP_STRING([--with-system-epoxy],
1651         [Use epoxy libraries already on system.  Happens automatically for
1652          --enable-gtk3.]),,
1653        [with_system_epoxy="$with_system_libs"])
1655 AC_ARG_WITH(myspell-dicts,
1656     AS_HELP_STRING([--with-myspell-dicts],
1657         [Adds myspell dictionaries to the LibreOffice installation set]),
1660 AC_ARG_WITH(system-dicts,
1661     AS_HELP_STRING([--without-system-dicts],
1662         [Do not use dictionaries from system paths.]),
1665 AC_ARG_WITH(external-dict-dir,
1666     AS_HELP_STRING([--with-external-dict-dir],
1667         [Specify external dictionary dir.]),
1670 AC_ARG_WITH(external-hyph-dir,
1671     AS_HELP_STRING([--with-external-hyph-dir],
1672         [Specify external hyphenation pattern dir.]),
1675 AC_ARG_WITH(external-thes-dir,
1676     AS_HELP_STRING([--with-external-thes-dir],
1677         [Specify external thesaurus dir.]),
1680 AC_ARG_WITH(system-zlib,
1681     AS_HELP_STRING([--with-system-zlib],
1682         [Use zlib already on system.]),,
1683     [with_system_zlib=auto])
1685 AC_ARG_WITH(system-jpeg,
1686     AS_HELP_STRING([--with-system-jpeg],
1687         [Use jpeg already on system.]),,
1688     [with_system_jpeg="$with_system_libs"])
1690 AC_ARG_WITH(system-clucene,
1691     AS_HELP_STRING([--with-system-clucene],
1692         [Use clucene already on system.]),,
1693     [with_system_clucene="$with_system_libs"])
1695 AC_ARG_WITH(system-expat,
1696     AS_HELP_STRING([--with-system-expat],
1697         [Use expat already on system.]),,
1698     [with_system_expat="$with_system_libs"])
1700 AC_ARG_WITH(system-libxml,
1701     AS_HELP_STRING([--with-system-libxml],
1702         [Use libxml/libxslt already on system.]),,
1703     [with_system_libxml=auto])
1705 AC_ARG_WITH(system-icu,
1706     AS_HELP_STRING([--with-system-icu],
1707         [Use icu already on system.]),,
1708     [with_system_icu="$with_system_libs"])
1710 AC_ARG_WITH(system-ucpp,
1711     AS_HELP_STRING([--with-system-ucpp],
1712         [Use ucpp already on system.]),,
1713     [])
1715 AC_ARG_WITH(system-openldap,
1716     AS_HELP_STRING([--with-system-openldap],
1717         [Use the OpenLDAP LDAP SDK already on system.]),,
1718     [with_system_openldap="$with_system_libs"])
1720 AC_ARG_WITH(system-poppler,
1721     AS_HELP_STRING([--with-system-poppler],
1722         [Use system poppler (only needed for PDF import).]),,
1723     [with_system_poppler="$with_system_libs"])
1725 AC_ARG_WITH(system-gpgmepp,
1726     AS_HELP_STRING([--with-system-gpgmepp],
1727         [Use gpgmepp already on system]),,
1728     [with_system_gpgmepp="$with_system_libs"])
1730 AC_ARG_WITH(system-apache-commons,
1731     AS_HELP_STRING([--with-system-apache-commons],
1732         [Use Apache commons libraries already on system.]),,
1733     [with_system_apache_commons="$with_system_jars"])
1735 AC_ARG_WITH(system-mariadb,
1736     AS_HELP_STRING([--with-system-mariadb],
1737         [Use MariaDB/MySQL libraries already on system.]),,
1738     [with_system_mariadb="$with_system_libs"])
1740 AC_ARG_ENABLE(bundle-mariadb,
1741     AS_HELP_STRING([--enable-bundle-mariadb],
1742         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1745 AC_ARG_WITH(system-postgresql,
1746     AS_HELP_STRING([--with-system-postgresql],
1747         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1748          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1749     [with_system_postgresql="$with_system_libs"])
1751 AC_ARG_WITH(libpq-path,
1752     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1753         [Use this PostgreSQL C interface (libpq) installation for building
1754          the PostgreSQL-SDBC extension.]),
1757 AC_ARG_WITH(system-firebird,
1758     AS_HELP_STRING([--with-system-firebird],
1759         [Use Firebird libraries already on system, for building the Firebird-SDBC
1760          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1761     [with_system_firebird="$with_system_libs"])
1763 AC_ARG_WITH(system-libtommath,
1764             AS_HELP_STRING([--with-system-libtommath],
1765                            [Use libtommath already on system]),,
1766             [with_system_libtommath="$with_system_libs"])
1768 AC_ARG_WITH(system-hsqldb,
1769     AS_HELP_STRING([--with-system-hsqldb],
1770         [Use hsqldb already on system.]))
1772 AC_ARG_WITH(hsqldb-jar,
1773     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1774         [Specify path to jarfile manually.]),
1775     HSQLDB_JAR=$withval)
1777 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1778     AS_HELP_STRING([--disable-scripting-beanshell],
1779         [Disable support for scripts in BeanShell.]),
1783 AC_ARG_WITH(system-beanshell,
1784     AS_HELP_STRING([--with-system-beanshell],
1785         [Use beanshell already on system.]),,
1786     [with_system_beanshell="$with_system_jars"])
1788 AC_ARG_WITH(beanshell-jar,
1789     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1790         [Specify path to jarfile manually.]),
1791     BSH_JAR=$withval)
1793 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1794     AS_HELP_STRING([--disable-scripting-javascript],
1795         [Disable support for scripts in JavaScript.]),
1799 AC_ARG_WITH(system-rhino,
1800     AS_HELP_STRING([--with-system-rhino],
1801         [Use rhino already on system.]),,)
1802 #    [with_system_rhino="$with_system_jars"])
1803 # Above is not used as we have different debug interface
1804 # patched into internal rhino. This code needs to be fixed
1805 # before we can enable it by default.
1807 AC_ARG_WITH(rhino-jar,
1808     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1809         [Specify path to jarfile manually.]),
1810     RHINO_JAR=$withval)
1812 AC_ARG_WITH(commons-logging-jar,
1813     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1814         [Specify path to jarfile manually.]),
1815     COMMONS_LOGGING_JAR=$withval)
1817 AC_ARG_WITH(system-jfreereport,
1818     AS_HELP_STRING([--with-system-jfreereport],
1819         [Use JFreeReport already on system.]),,
1820     [with_system_jfreereport="$with_system_jars"])
1822 AC_ARG_WITH(sac-jar,
1823     AS_HELP_STRING([--with-sac-jar=JARFILE],
1824         [Specify path to jarfile manually.]),
1825     SAC_JAR=$withval)
1827 AC_ARG_WITH(libxml-jar,
1828     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1829         [Specify path to jarfile manually.]),
1830     LIBXML_JAR=$withval)
1832 AC_ARG_WITH(flute-jar,
1833     AS_HELP_STRING([--with-flute-jar=JARFILE],
1834         [Specify path to jarfile manually.]),
1835     FLUTE_JAR=$withval)
1837 AC_ARG_WITH(jfreereport-jar,
1838     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1839         [Specify path to jarfile manually.]),
1840     JFREEREPORT_JAR=$withval)
1842 AC_ARG_WITH(liblayout-jar,
1843     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1844         [Specify path to jarfile manually.]),
1845     LIBLAYOUT_JAR=$withval)
1847 AC_ARG_WITH(libloader-jar,
1848     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1849         [Specify path to jarfile manually.]),
1850     LIBLOADER_JAR=$withval)
1852 AC_ARG_WITH(libformula-jar,
1853     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1854         [Specify path to jarfile manually.]),
1855     LIBFORMULA_JAR=$withval)
1857 AC_ARG_WITH(librepository-jar,
1858     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1859         [Specify path to jarfile manually.]),
1860     LIBREPOSITORY_JAR=$withval)
1862 AC_ARG_WITH(libfonts-jar,
1863     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1864         [Specify path to jarfile manually.]),
1865     LIBFONTS_JAR=$withval)
1867 AC_ARG_WITH(libserializer-jar,
1868     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1869         [Specify path to jarfile manually.]),
1870     LIBSERIALIZER_JAR=$withval)
1872 AC_ARG_WITH(libbase-jar,
1873     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1874         [Specify path to jarfile manually.]),
1875     LIBBASE_JAR=$withval)
1877 AC_ARG_WITH(system-odbc,
1878     AS_HELP_STRING([--with-system-odbc],
1879         [Use the odbc headers already on system.]),,
1880     [with_system_odbc="auto"])
1882 AC_ARG_WITH(system-sane,
1883     AS_HELP_STRING([--with-system-sane],
1884         [Use sane.h already on system.]),,
1885     [with_system_sane="$with_system_headers"])
1887 AC_ARG_WITH(system-bluez,
1888     AS_HELP_STRING([--with-system-bluez],
1889         [Use bluetooth.h already on system.]),,
1890     [with_system_bluez="$with_system_headers"])
1892 AC_ARG_WITH(system-curl,
1893     AS_HELP_STRING([--with-system-curl],
1894         [Use curl already on system.]),,
1895     [with_system_curl=auto])
1897 AC_ARG_WITH(system-boost,
1898     AS_HELP_STRING([--with-system-boost],
1899         [Use boost already on system.]),,
1900     [with_system_boost="$with_system_headers"])
1902 AC_ARG_WITH(system-glm,
1903     AS_HELP_STRING([--with-system-glm],
1904         [Use glm already on system.]),,
1905     [with_system_glm="$with_system_headers"])
1907 AC_ARG_WITH(system-hunspell,
1908     AS_HELP_STRING([--with-system-hunspell],
1909         [Use libhunspell already on system.]),,
1910     [with_system_hunspell="$with_system_libs"])
1912 AC_ARG_WITH(system-mythes,
1913     AS_HELP_STRING([--with-system-mythes],
1914         [Use mythes already on system.]),,
1915     [with_system_mythes="$with_system_libs"])
1917 AC_ARG_WITH(system-altlinuxhyph,
1918     AS_HELP_STRING([--with-system-altlinuxhyph],
1919         [Use ALTLinuxhyph already on system.]),,
1920     [with_system_altlinuxhyph="$with_system_libs"])
1922 AC_ARG_WITH(system-lpsolve,
1923     AS_HELP_STRING([--with-system-lpsolve],
1924         [Use lpsolve already on system.]),,
1925     [with_system_lpsolve="$with_system_libs"])
1927 AC_ARG_WITH(system-coinmp,
1928     AS_HELP_STRING([--with-system-coinmp],
1929         [Use CoinMP already on system.]),,
1930     [with_system_coinmp="$with_system_libs"])
1932 AC_ARG_WITH(system-liblangtag,
1933     AS_HELP_STRING([--with-system-liblangtag],
1934         [Use liblangtag library already on system.]),,
1935     [with_system_liblangtag="$with_system_libs"])
1937 AC_ARG_WITH(webdav,
1938     AS_HELP_STRING([--with-webdav],
1939         [Specify which library to use for webdav implementation.
1940          Possible values: "neon", "serf", "no". The default value is "neon".
1941          Example: --with-webdav="serf"]),
1942     WITH_WEBDAV=$withval,
1943     WITH_WEBDAV="neon")
1945 AC_ARG_WITH(linker-hash-style,
1946     AS_HELP_STRING([--with-linker-hash-style],
1947         [Use linker with --hash-style=<style> when linking shared objects.
1948          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1949          if supported on the build system, and "sysv" otherwise.]))
1951 AC_ARG_WITH(jdk-home,
1952     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1953         [If you have installed JDK 1.6 or later on your system please supply the
1954          path here. Note that this is not the location of the java command but the
1955          location of the entire distribution.]),
1958 AC_ARG_WITH(help,
1959     AS_HELP_STRING([--with-help],
1960         [Enable the build of help. There is a special parameter "common" that
1961          can be used to bundle only the common part, .e.g help-specific icons.
1962          This is useful when you build the helpcontent separately.])
1963     [
1964                           Usage:     --with-help    build the old local help
1965                                  --without-help     no local help (default)
1966                                  --with-help=html   build the new HTML local help
1967                                  --with-help=online build the new HTML online help
1968     ],
1971 libo_FUZZ_ARG_WITH(java,
1972     AS_HELP_STRING([--with-java=<java command>],
1973         [Specify the name of the Java interpreter command. Typically "java"
1974          which is the default.
1976          To build without support for Java components, applets, accessibility
1977          or the XML filters written in Java, use --without-java or --with-java=no.]),
1978     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1979     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1982 AC_ARG_WITH(jvm-path,
1983     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1984         [Use a specific JVM search path at runtime.
1985          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1988 AC_ARG_WITH(ant-home,
1989     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
1990         [If you have installed Jakarta Ant on your system, please supply the path here.
1991          Note that this is not the location of the Ant binary but the location
1992          of the entire distribution.]),
1995 AC_ARG_WITH(symbol-config,
1996     AS_HELP_STRING([--with-symbol-config],
1997         [Configuration for the crashreport symbol upload]),
1998         [],
1999         [with_symbol_config=no])
2001 AC_ARG_WITH(export-validation,
2002     AS_HELP_STRING([--without-export-validation],
2003         [Disable validating OOXML and ODF files as exported from in-tree tests.
2004          Use this option e.g. if your system only provides Java 5.]),
2005 ,with_export_validation=auto)
2007 AC_ARG_WITH(bffvalidator,
2008     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2009         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2010          Requires installed Microsoft Office Binary File Format Validator.
2011          Note: export-validation (--with-export-validation) is required to be turned on.
2012          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2013 ,with_bffvalidator=no)
2015 libo_FUZZ_ARG_WITH(junit,
2016     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2017         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2018          --without-junit disables those tests. Not relevant in the --without-java case.]),
2019 ,with_junit=yes)
2021 AC_ARG_WITH(hamcrest,
2022     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2023         [Specifies the hamcrest jar file to use for JUnit-based tests.
2024          --without-junit disables those tests. Not relevant in the --without-java case.]),
2025 ,with_hamcrest=yes)
2027 AC_ARG_WITH(perl-home,
2028     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2029         [If you have installed Perl 5 Distribution, on your system, please
2030          supply the path here. Note that this is not the location of the Perl
2031          binary but the location of the entire distribution.]),
2034 libo_FUZZ_ARG_WITH(doxygen,
2035     AS_HELP_STRING(
2036         [--with-doxygen=<absolute path to doxygen executable>],
2037         [Specifies the doxygen executable to use when generating ODK C/C++
2038          documentation. --without-doxygen disables generation of ODK C/C++
2039          documentation. Not relevant in the --disable-odk case.]),
2040 ,with_doxygen=yes)
2042 AC_ARG_WITH(visual-studio,
2043     AS_HELP_STRING([--with-visual-studio=<2017>],
2044         [Specify which Visual Studio version to use in case several are
2045          installed. Currently only 2017 is supported.]),
2048 AC_ARG_WITH(windows-sdk,
2049     AS_HELP_STRING([--with-windows-sdk=<7.1(A)/8.0(A)/8.1(A)/10>],
2050         [Specify which Windows SDK, or "Windows Kit", version to use
2051          in case the one that came with the selected Visual Studio
2052          is not what you want for some reason. Note that not all compiler/SDK
2053          combinations are supported. The intent is that this option should not
2054          be needed.]),
2057 AC_ARG_WITH(lang,
2058     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2059         [Use this option to build LibreOffice with additional UI language support.
2060          English (US) is always included by default.
2061          Separate multiple languages with space.
2062          For all languages, use --with-lang=ALL.]),
2065 AC_ARG_WITH(locales,
2066     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2067         [Use this option to limit the locale information built in.
2068          Separate multiple locales with space.
2069          Very experimental and might well break stuff.
2070          Just a desperate measure to shrink code and data size.
2071          By default all the locales available is included.
2072          This option is completely unrelated to --with-lang.])
2073     [
2074                           Affects also our character encoding conversion
2075                           tables for encodings mainly targeted for a
2076                           particular locale, like EUC-CN and EUC-TW for
2077                           zh, ISO-2022-JP for ja.
2079                           Affects also our add-on break iterator data for
2080                           some languages.
2082                           For the default, all locales, don't use this switch at all.
2083                           Specifying just the language part of a locale means all matching
2084                           locales will be included.
2085     ],
2088 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2089 libo_FUZZ_ARG_WITH(krb5,
2090     AS_HELP_STRING([--with-krb5],
2091         [Enable MIT Kerberos 5 support in modules that support it.
2092          By default automatically enabled on platforms
2093          where a good system Kerberos 5 is available.]),
2096 libo_FUZZ_ARG_WITH(gssapi,
2097     AS_HELP_STRING([--with-gssapi],
2098         [Enable GSSAPI support in modules that support it.
2099          By default automatically enabled on platforms
2100          where a good system GSSAPI is available.]),
2103 AC_ARG_WITH(iwyu,
2104     AS_HELP_STRING([--with-iwyu],
2105         [Use given IWYU binary path to check unneeded includes instead of building.
2106          Use only if you are hacking on it.]),
2109 libo_FUZZ_ARG_WITH(lxml,
2110     AS_HELP_STRING([--without-lxml],
2111         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2112          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2113          report widget classes and ids.]),
2116 dnl ===================================================================
2117 dnl Branding
2118 dnl ===================================================================
2120 AC_ARG_WITH(branding,
2121     AS_HELP_STRING([--with-branding=/path/to/images],
2122         [Use given path to retrieve branding images set.])
2123     [
2124                           Search for intro.png about.svg and flat_logo.svg.
2125                           If any is missing, default ones will be used instead.
2127                           Search also progress.conf for progress
2128                           settings on intro screen :
2130                           PROGRESSBARCOLOR="255,255,255" Set color of
2131                           progress bar. Comma separated RGB decimal values.
2132                           PROGRESSSIZE="407,6" Set size of progress bar.
2133                           Comma separated decimal values (width, height).
2134                           PROGRESSPOSITION="61,317" Set position of progress
2135                           bar from left,top. Comma separated decimal values.
2136                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2137                           bar frame. Comma separated RGB decimal values.
2138                           PROGRESSTEXTCOLOR="255,255,255" Set color of progress
2139                           bar text. Comma separated RGB decimal values.
2140                           PROGRESSTEXTBASELINE="287" Set vertical position of
2141                           progress bar text from top. Decimal value.
2143                           Default values will be used if not found.
2144     ],
2148 AC_ARG_WITH(extra-buildid,
2149     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2150         [Show addition build identification in about dialog.]),
2154 AC_ARG_WITH(vendor,
2155     AS_HELP_STRING([--with-vendor="John the Builder"],
2156         [Set vendor of the build.]),
2159 AC_ARG_WITH(android-package-name,
2160     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2161         [Set Android package name of the build.]),
2164 AC_ARG_WITH(compat-oowrappers,
2165     AS_HELP_STRING([--with-compat-oowrappers],
2166         [Install oo* wrappers in parallel with
2167          lo* ones to keep backward compatibility.
2168          Has effect only with make distro-pack-install]),
2171 AC_ARG_WITH(os-version,
2172     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2173         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2176 AC_ARG_WITH(mingw-cross-compiler,
2177     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2178         [Specify the MinGW cross-compiler to use.
2179          When building on the ODK on Unix and building unowinreg.dll,
2180          specify the MinGW C++ cross-compiler.]),
2183 AC_ARG_WITH(idlc-cpp,
2184     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2185         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2188 AC_ARG_WITH(build-version,
2189     AS_HELP_STRING([--with-build-version="Built by Jim"],
2190         [Allows the builder to add a custom version tag that will appear in the
2191          Help/About box for QA purposes.]),
2192 with_build_version=$withval,
2195 AC_ARG_WITH(parallelism,
2196     AS_HELP_STRING([--with-parallelism],
2197         [Number of jobs to run simultaneously during build. Parallel builds can
2198         save a lot of time on multi-cpu machines. Defaults to the number of
2199         CPUs on the machine, unless you configure --enable-icecream - then to
2200         10.]),
2203 AC_ARG_WITH(all-tarballs,
2204     AS_HELP_STRING([--with-all-tarballs],
2205         [Download all external tarballs unconditionally]))
2207 AC_ARG_WITH(gdrive-client-id,
2208     AS_HELP_STRING([--with-gdrive-client-id],
2209         [Provides the client id of the application for OAuth2 authentication
2210         on Google Drive. If either this or --with-gdrive-client-secret is
2211         empty, the feature will be disabled]),
2214 AC_ARG_WITH(gdrive-client-secret,
2215     AS_HELP_STRING([--with-gdrive-client-secret],
2216         [Provides the client secret of the application for OAuth2
2217         authentication on Google Drive. If either this or
2218         --with-gdrive-client-id is empty, the feature will be disabled]),
2221 AC_ARG_WITH(alfresco-cloud-client-id,
2222     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2223         [Provides the client id of the application for OAuth2 authentication
2224         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2225         empty, the feature will be disabled]),
2228 AC_ARG_WITH(alfresco-cloud-client-secret,
2229     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2230         [Provides the client secret of the application for OAuth2
2231         authentication on Alfresco Cloud. If either this or
2232         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2235 AC_ARG_WITH(onedrive-client-id,
2236     AS_HELP_STRING([--with-onedrive-client-id],
2237         [Provides the client id of the application for OAuth2 authentication
2238         on OneDrive. If either this or --with-onedrive-client-secret is
2239         empty, the feature will be disabled]),
2242 AC_ARG_WITH(onedrive-client-secret,
2243     AS_HELP_STRING([--with-onedrive-client-secret],
2244         [Provides the client secret of the application for OAuth2
2245         authentication on OneDrive. If either this or
2246         --with-onedrive-client-id is empty, the feature will be disabled]),
2248 dnl ===================================================================
2249 dnl Do we want to use pre-build binary tarball for recompile
2250 dnl ===================================================================
2252 if test "$enable_library_bin_tar" = "yes" ; then
2253     USE_LIBRARY_BIN_TAR=TRUE
2254 else
2255     USE_LIBRARY_BIN_TAR=
2257 AC_SUBST(USE_LIBRARY_BIN_TAR)
2259 dnl ===================================================================
2260 dnl Test whether build target is Release Build
2261 dnl ===================================================================
2262 AC_MSG_CHECKING([whether build target is Release Build])
2263 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2264     AC_MSG_RESULT([no])
2265     ENABLE_RELEASE_BUILD=
2266 else
2267     AC_MSG_RESULT([yes])
2268     ENABLE_RELEASE_BUILD=TRUE
2270 AC_SUBST(ENABLE_RELEASE_BUILD)
2272 dnl ===================================================================
2273 dnl Test whether to sign Windows Build
2274 dnl ===================================================================
2275 AC_MSG_CHECKING([whether to sign windows build])
2276 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2277     AC_MSG_RESULT([yes])
2278     WINDOWS_BUILD_SIGNING="TRUE"
2279 else
2280     AC_MSG_RESULT([no])
2281     WINDOWS_BUILD_SIGNING="FALSE"
2283 AC_SUBST(WINDOWS_BUILD_SIGNING)
2285 dnl ===================================================================
2286 dnl MacOSX build and runtime environment options
2287 dnl ===================================================================
2289 AC_ARG_WITH(macosx-sdk,
2290     AS_HELP_STRING([--with-macosx-sdk=<version>],
2291         [Prefer a specific SDK for building.])
2292     [
2293                           If the requested SDK is not available, a search for the oldest one will be done.
2294                           With current Xcode versions, only the latest SDK is included, so this option is
2295                           not terribly useful. It works fine to build with a new SDK and run the result
2296                           on an older OS.
2298                           e. g.: --with-macosx-sdk=10.9
2300                           there are 3 options to control the MacOSX build:
2301                           --with-macosx-sdk (referred as 'sdk' below)
2302                           --with-macosx-version-min-required (referred as 'min' below)
2303                           --with-macosx-version-max-allowed (referred as 'max' below)
2305                           the connection between these value and the default they take is as follow:
2306                           ( ? means not specified on the command line, s means the SDK version found,
2307                           constraint: 8 <= x <= y <= z)
2309                           ==========================================
2310                            command line      || config result
2311                           ==========================================
2312                           min  | max  | sdk  || min  | max  | sdk  |
2313                           ?    | ?    | ?    || 10.9 | 10.s | 10.s |
2314                           ?    | ?    | 10.x || 10.9 | 10.x | 10.x |
2315                           ?    | 10.x | ?    || 10.9 | 10.s | 10.s |
2316                           ?    | 10.x | 10.y || 10.9 | 10.x | 10.y |
2317                           10.x | ?    | ?    || 10.x | 10.s | 10.s |
2318                           10.x | ?    | 10.y || 10.x | 10.y | 10.y |
2319                           10.x | 10.y | ?    || 10.x | 10.y | 10.y |
2320                           10.x | 10.y | 10.z || 10.x | 10.y | 10.z |
2323                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2324                           for a detailed technical explanation of these variables
2326                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2327     ],
2330 AC_ARG_WITH(macosx-version-min-required,
2331     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2332         [set the minimum OS version needed to run the built LibreOffice])
2333     [
2334                           e. g.: --with-macos-version-min-required=10.9
2335                           see --with-macosx-sdk for more info
2336     ],
2339 AC_ARG_WITH(macosx-version-max-allowed,
2340     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2341         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2342     [
2343                           e. g.: --with-macos-version-max-allowed=10.9
2344                           see --with-macosx-sdk for more info
2345     ],
2349 dnl ===================================================================
2350 dnl options for stuff used during cross-compilation build
2351 dnl Not quite superseded by --with-build-platform-configure-options.
2352 dnl TODO: check, if the "force" option is still needed anywhere.
2353 dnl ===================================================================
2355 AC_ARG_WITH(system-icu-for-build,
2356     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2357         [Use icu already on system for build tools (cross-compilation only).]))
2360 dnl ===================================================================
2361 dnl Check for incompatible options set by fuzzing, and reset those
2362 dnl automatically to working combinations
2363 dnl ===================================================================
2365 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2366         "$enable_dbus" != "$enable_avahi"; then
2367     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2368     enable_avahi=$enable_dbus
2371 dnl ===================================================================
2372 dnl check for required programs (grep, awk, sed, bash)
2373 dnl ===================================================================
2375 pathmunge ()
2377     if test -n "$1"; then
2378         if test "$build_os" = "cygwin"; then
2379             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2380                 PathFormat "$1"
2381                 new_path=`cygpath -sm "$formatted_path"`
2382             else
2383                 PathFormat "$1"
2384                 new_path=`cygpath -u "$formatted_path"`
2385             fi
2386         else
2387             new_path="$1"
2388         fi
2389         if ! echo "$LO_PATH" | $EGREP -q "(^|:)$1($|:)"; then
2390             if test "$2" = "after"; then
2391                 LO_PATH="$LO_PATH${P_SEP}$new_path"
2392             else
2393                 LO_PATH="$new_path${P_SEP}$LO_PATH"
2394             fi
2395         fi
2396         unset new_path
2397     fi
2400 AC_PROG_AWK
2401 AC_PATH_PROG( AWK, $AWK)
2402 if test -z "$AWK"; then
2403     AC_MSG_ERROR([install awk to run this script])
2406 AC_PATH_PROG(BASH, bash)
2407 if test -z "$BASH"; then
2408     AC_MSG_ERROR([bash not found in \$PATH])
2410 AC_SUBST(BASH)
2412 AC_MSG_CHECKING([for GNU or BSD tar])
2413 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2414     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2415     if test $? -eq 0;  then
2416         GNUTAR=$a
2417         break
2418     fi
2419 done
2420 AC_MSG_RESULT($GNUTAR)
2421 if test -z "$GNUTAR"; then
2422     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2424 AC_SUBST(GNUTAR)
2426 AC_MSG_CHECKING([for tar's option to strip components])
2427 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2428 if test $? -eq 0; then
2429     STRIP_COMPONENTS="--strip-components"
2430 else
2431     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2432     if test $? -eq 0; then
2433         STRIP_COMPONENTS="--strip-path"
2434     else
2435         STRIP_COMPONENTS="unsupported"
2436     fi
2438 AC_MSG_RESULT($STRIP_COMPONENTS)
2439 if test x$STRIP_COMPONENTS = xunsupported; then
2440     AC_MSG_ERROR([you need a tar that is able to strip components.])
2442 AC_SUBST(STRIP_COMPONENTS)
2444 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2445 dnl desktop OSes from "mobile" ones.
2447 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2448 dnl In other words, that when building for an OS that is not a
2449 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2451 dnl Note the direction of the implication; there is no assumption that
2452 dnl cross-compiling would imply a non-desktop OS.
2454 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2455     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2456     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2457     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2460 # Whether to build "avmedia" functionality or not.
2462 if test -z "$enable_avmedia"; then
2463     enable_avmedia=yes
2466 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2467 if test "$enable_avmedia" = yes; then
2468     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2469 else
2470     USE_AVMEDIA_DUMMY='TRUE'
2472 AC_SUBST(USE_AVMEDIA_DUMMY)
2474 # Decide whether to build database connectivity stuff (including
2475 # Base) or not. We probably don't want to on non-desktop OSes.
2476 if test -z "$enable_database_connectivity"; then
2477     # --disable-database-connectivity is unfinished work in progress
2478     # and the iOS test app doesn't link if we actually try to use it.
2479     # if test $_os != iOS -a $_os != Android; then
2480     if test $_os != iOS; then
2481         enable_database_connectivity=yes
2482     fi
2485 if test "$enable_database_connectivity" = yes; then
2486     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2487     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2490 if test -z "$enable_extensions"; then
2491     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2492     if test $_os != iOS -a $_os != Android; then
2493         enable_extensions=yes
2494     fi
2497 if test "$enable_extensions" = yes; then
2498     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2499     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2502 if test -z "$enable_scripting"; then
2503     # Disable scripting for iOS unless specifically overridden
2504     # with --enable-scripting.
2505     if test $_os != iOS; then
2506         enable_scripting=yes
2507     fi
2510 DISABLE_SCRIPTING=''
2511 if test "$enable_scripting" = yes; then
2512     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2513     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2514 else
2515     DISABLE_SCRIPTING='TRUE'
2516     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2519 if test $_os = iOS -o $_os = Android; then
2520     # Disable dynamic_loading always for iOS and Android
2521     enable_dynamic_loading=no
2522 elif test -z "$enable_dynamic_loading"; then
2523     # Otherwise enable it unless speficically disabled
2524     enable_dynamic_loading=yes
2527 DISABLE_DYNLOADING=''
2528 if test "$enable_dynamic_loading" = yes; then
2529     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2530 else
2531     DISABLE_DYNLOADING='TRUE'
2533 AC_SUBST(DISABLE_DYNLOADING)
2535 # remenber SYSBASE value
2536 AC_SUBST(SYSBASE)
2538 dnl ===================================================================
2539 dnl  Sort out various gallery compilation options
2540 dnl ===================================================================
2541 AC_MSG_CHECKING([how to build and package galleries])
2542 if test -n "${with_galleries}"; then
2543     if test "$with_galleries" = "build"; then
2544         WITH_GALLERY_BUILD=TRUE
2545         AC_MSG_RESULT([build from source images internally])
2546     elif test "$with_galleries" = "no"; then
2547         WITH_GALLERY_BUILD=
2548         AC_MSG_RESULT([disable non-internal gallery build])
2549     else
2550         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2551     fi
2552 else
2553     if test $_os != iOS -a $_os != Android; then
2554         WITH_GALLERY_BUILD=TRUE
2555         AC_MSG_RESULT([internal src images for desktop])
2556     else
2557         WITH_GALLERY_BUILD=
2558         AC_MSG_RESULT([disable src image build])
2559     fi
2561 AC_SUBST(WITH_GALLERY_BUILD)
2563 dnl ===================================================================
2564 dnl  Checks if ccache is available
2565 dnl ===================================================================
2566 if test "$_os" = "WINNT"; then
2567     # on windows/VC build do not use ccache
2568     CCACHE=""
2569 elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2570     case "%$CC%$CXX%" in
2571     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2572     # assume that's good then
2573     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2574         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2575         ;;
2576     *)
2577         AC_PATH_PROG([CCACHE],[ccache],[not found])
2578         if test "$CCACHE" = "not found"; then
2579             CCACHE=""
2580         else
2581             # Need to check for ccache version: otherwise prevents
2582             # caching of the results (like "-x objective-c++" for Mac)
2583             if test $_os = Darwin -o $_os = iOS; then
2584                 # Check ccache version
2585                 AC_MSG_CHECKING([whether version of ccache is suitable])
2586                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2587                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2588                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2589                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2590                 else
2591                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2592                     CCACHE=""
2593                 fi
2594             fi
2595         fi
2596         ;;
2597     esac
2598 else
2599     CCACHE=""
2602 if test "$CCACHE" != ""; then
2603     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2604     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2605     if test "$ccache_size" = ""; then
2606         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2607         if test "$ccache_size" = ""; then
2608             ccache_size=0
2609         fi
2610         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2611         if test $ccache_size -lt 1024; then
2612             CCACHE=""
2613             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2614             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2615         else
2616             # warn that ccache may be too small for debug build
2617             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2618             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2619         fi
2620     else
2621         if test $ccache_size -lt 5; then
2622             #warn that ccache may be too small for debug build
2623             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2624             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2625         fi
2626     fi
2629 dnl ===================================================================
2630 dnl  Checks for C compiler,
2631 dnl  The check for the C++ compiler is later on.
2632 dnl ===================================================================
2633 if test "$_os" != "WINNT"; then
2634     GCC_HOME_SET="true"
2635     AC_MSG_CHECKING([gcc home])
2636     if test -z "$with_gcc_home"; then
2637         if test "$enable_icecream" = "yes"; then
2638             if test -d "/usr/lib/icecc/bin"; then
2639                 GCC_HOME="/usr/lib/icecc/"
2640             elif test -d "/usr/libexec/icecc/bin"; then
2641                 GCC_HOME="/usr/libexec/icecc/"
2642             elif test -d "/opt/icecream/bin"; then
2643                 GCC_HOME="/opt/icecream/"
2644             else
2645                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2647             fi
2648         else
2649             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2650             GCC_HOME_SET="false"
2651         fi
2652     else
2653         GCC_HOME="$with_gcc_home"
2654     fi
2655     AC_MSG_RESULT($GCC_HOME)
2656     AC_SUBST(GCC_HOME)
2658     if test "$GCC_HOME_SET" = "true"; then
2659         if test -z "$CC"; then
2660             CC="$GCC_HOME/bin/gcc"
2661         fi
2662         if test -z "$CXX"; then
2663             CXX="$GCC_HOME/bin/g++"
2664         fi
2665     fi
2668 COMPATH=`dirname "$CC"`
2669 if test "$COMPATH" = "."; then
2670     AC_PATH_PROGS(COMPATH, $CC)
2671     dnl double square bracket to get single because of M4 quote...
2672     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2674 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2676 dnl ===================================================================
2677 dnl Java support
2678 dnl ===================================================================
2679 AC_MSG_CHECKING([whether to build with Java support])
2680 if test "$with_java" != "no"; then
2681     if test "$DISABLE_SCRIPTING" = TRUE; then
2682         AC_MSG_RESULT([no, overridden by --disable-scripting])
2683         ENABLE_JAVA=""
2684         with_java=no
2685     else
2686         AC_MSG_RESULT([yes])
2687         ENABLE_JAVA="TRUE"
2688         AC_DEFINE(HAVE_FEATURE_JAVA)
2689     fi
2690 else
2691     AC_MSG_RESULT([no])
2692     ENABLE_JAVA=""
2695 AC_SUBST(ENABLE_JAVA)
2697 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2699 dnl ENABLE_JAVA="" indicate no Java support at all
2701 dnl ===================================================================
2702 dnl Check OS X SDK and compiler
2703 dnl ===================================================================
2705 if test $_os = Darwin -o $_os = iOS; then
2707     # If no --with-macosx-sdk option is given, look for one
2709     # The intent is that for "most" Mac-based developers, a suitable
2710     # SDK will be found automatically without any configure options.
2712     # For developers with a current Xcode, the lowest-numbered SDK
2713     # higher than or equal to the minimum required should be found.
2715     AC_MSG_CHECKING([what Mac OS X SDK to use])
2716     for _macosx_sdk in $with_macosx_sdk 10.13 10.12; do
2717         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2718         if test -d "$MACOSX_SDK_PATH"; then
2719             with_macosx_sdk="${_macosx_sdk}"
2720             break
2721         else
2722             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2723             if test -d "$MACOSX_SDK_PATH"; then
2724                 with_macosx_sdk="${_macosx_sdk}"
2725                 break
2726             fi
2727         fi
2728     done
2729     if test ! -d "$MACOSX_SDK_PATH"; then
2730         AC_MSG_ERROR([Could not figure out the location of a Mac OS X SDK and its version])
2731     fi
2733     if test $_os = iOS; then
2734         if test "$enable_ios_simulator" = "yes"; then
2735             useos=iphonesimulator
2736         else
2737             useos=iphoneos
2738         fi
2739         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2740     fi
2741     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2744     case $with_macosx_sdk in
2745     10.9)
2746         MACOSX_SDK_VERSION=1090
2747         ;;
2748     10.10)
2749         MACOSX_SDK_VERSION=101000
2750         ;;
2751     10.11)
2752         MACOSX_SDK_VERSION=101100
2753         ;;
2754     10.12)
2755         MACOSX_SDK_VERSION=101200
2756         ;;
2757     10.13)
2758         MACOSX_SDK_VERSION=101300
2759         ;;
2760     *)
2761         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.9--13])
2762         ;;
2763     esac
2765     if test "$with_macosx_version_min_required" = "" ; then
2766         with_macosx_version_min_required="10.9";
2767     fi
2769     if test "$with_macosx_version_max_allowed" = "" ; then
2770         with_macosx_version_max_allowed="$with_macosx_sdk"
2771     fi
2773     # export this so that "xcrun" invocations later return matching values
2774     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2775     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2776     export DEVELOPER_DIR
2777     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2778     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2780     case "$with_macosx_version_min_required" in
2781     10.9)
2782         MAC_OS_X_VERSION_MIN_REQUIRED="1090"
2783         ;;
2784     10.10)
2785         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2786         ;;
2787     10.11)
2788         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2789         ;;
2790     10.12)
2791         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2792         ;;
2793     10.13)
2794         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2795         ;;
2796     *)
2797         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.9--13])
2798         ;;
2799     esac
2800     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2802     LIBTOOL=/usr/bin/libtool
2803     INSTALL_NAME_TOOL=install_name_tool
2804     if test -z "$save_CC"; then
2805         AC_MSG_CHECKING([what compiler to use])
2806         stdlib=-stdlib=libc++
2807         if test "$ENABLE_LTO" = TRUE; then
2808             lto=-flto
2809         fi
2810         CC="`xcrun -find clang` -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2811         CXX="`xcrun -find clang++` -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2812         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2813         AR=`xcrun -find ar`
2814         NM=`xcrun -find nm`
2815         STRIP=`xcrun -find strip`
2816         LIBTOOL=`xcrun -find libtool`
2817         RANLIB=`xcrun -find ranlib`
2818         AC_MSG_RESULT([$CC and $CXX])
2819     fi
2821     case "$with_macosx_version_max_allowed" in
2822     10.9)
2823         MAC_OS_X_VERSION_MAX_ALLOWED="1090"
2824         ;;
2825     10.10)
2826         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2827         ;;
2828     10.11)
2829         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2830         ;;
2831     10.12)
2832         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2833         ;;
2834     10.13)
2835         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2836         ;;
2837     *)
2838         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.9--13])
2839         ;;
2840     esac
2842     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2843     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2844         AC_MSG_RESULT([$MAC_OS_X_VERSION_MIN_REQUIRED])
2845         AC_MSG_RESULT([$MAC_OS_X_VERSION_MAX_REQUIRED])
2846         AC_MSG_ERROR([the version minimumn required must be inferior or equal to the version maximum allowed])
2847     else
2848         AC_MSG_RESULT([ok])
2849     fi
2851     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2852     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2853         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2854     else
2855         AC_MSG_RESULT([ok])
2856     fi
2857     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2858     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2860     AC_MSG_CHECKING([whether to do code signing])
2862     if test "$enable_macosx_code_signing" = yes; then
2863         # By default use the first suitable certificate (?).
2865         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2866         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2867         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2868         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2869         # "Developer ID Application" one.
2871         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2872         if test -n "$identity"; then
2873             MACOSX_CODESIGNING_IDENTITY=$identity
2874             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2875             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2876         else
2877             AC_MSG_ERROR([cannot determine identity to use])
2878         fi
2879     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2880         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2881         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2882         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2883     else
2884         AC_MSG_RESULT([no])
2885     fi
2887     AC_MSG_CHECKING([whether to create a Mac App Store package])
2889     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2890         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2891     elif test "$enable_macosx_package_signing" = yes; then
2892         # By default use the first suitable certificate.
2893         # It should be a "3rd Party Mac Developer Installer" one
2895         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2896         if test -n "$identity"; then
2897             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2898             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2899             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2900         else
2901             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2902         fi
2903     elif test -n "$enable_macosx_package_signing"; then
2904         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2905         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2906         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2907     else
2908         AC_MSG_RESULT([no])
2909     fi
2911     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2912         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2913     fi
2915     AC_MSG_CHECKING([whether to sandbox the application])
2917     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2918         AC_MSG_ERROR([OS X sandboxing requires code signing])
2919     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2920         AC_MSG_ERROR([OS X sandboxing (actually App Store rules) disallows use of Java])
2921     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2922         ENABLE_MACOSX_SANDBOX=TRUE
2923         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2924         AC_MSG_RESULT([yes])
2925     else
2926         AC_MSG_RESULT([no])
2927     fi
2929     AC_MSG_CHECKING([what OS X app bundle identifier to use])
2930     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2931     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2933 AC_SUBST(MACOSX_SDK_PATH)
2934 AC_SUBST(MACOSX_SDK_VERSION)
2935 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2936 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2937 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2938 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2939 AC_SUBST(INSTALL_NAME_TOOL)
2940 AC_SUBST(LIBTOOL) # Note that the OS X libtool command is unrelated to GNU libtool
2941 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
2942 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
2943 AC_SUBST(ENABLE_MACOSX_SANDBOX)
2944 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
2946 dnl ===================================================================
2947 dnl Check iOS SDK and compiler
2948 dnl ===================================================================
2950 if test $_os = iOS; then
2951     AC_MSG_CHECKING([what iOS SDK to use])
2952     current_sdk_ver=11.4
2953     if test "$enable_ios_simulator" = "yes"; then
2954         platform=iPhoneSimulator
2955         versionmin=-mios-simulator-version-min=$current_sdk_ver
2956     else
2957         platform=iPhoneOS
2958         versionmin=-miphoneos-version-min=$current_sdk_ver
2959     fi
2960     xcode_developer=`xcode-select -print-path`
2962     for sdkver in $current_sdk_ver; do
2963         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
2964         if test -d $t; then
2965             ios_sdk=$sdkver
2966             sysroot=$t
2967             break
2968         fi
2969     done
2971     if test -z "$sysroot"; then
2972         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
2973     fi
2975     AC_MSG_RESULT($sysroot)
2977     IOS_SDK=`echo $platform | tr A-Z a-z`$ios_sdk
2978     IOS_DEPLOYMENT_VERSION=$current_sdk_ver
2980     # LTO is not really recommended for iOS builds,
2981     # the link time will be astronomical
2982     if test "$ENABLE_LTO" = TRUE; then
2983         lto=-flto
2984     fi
2986     stdlib="-stdlib=libc++"
2988     CC="`xcrun -find clang` -arch $host_cpu -isysroot $sysroot $lto $versionmin"
2989     CXX="`xcrun -find clang++` -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
2991     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2992     AR=`xcrun -find ar`
2993     NM=`xcrun -find nm`
2994     STRIP=`xcrun -find strip`
2995     LIBTOOL=`xcrun -find libtool`
2996     RANLIB=`xcrun -find ranlib`
2999 AC_SUBST(IOS_SDK)
3000 AC_SUBST(IOS_DEPLOYMENT_VERSION)
3002 AC_MSG_CHECKING([whether to treat the installation as read-only])
3004 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3005         "$enable_extensions" != yes; then
3006     enable_readonly_installset=yes
3008 if test "$enable_readonly_installset" = yes; then
3009     AC_MSG_RESULT([yes])
3010     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3011 else
3012     AC_MSG_RESULT([no])
3015 dnl ===================================================================
3016 dnl Structure of install set
3017 dnl ===================================================================
3019 if test $_os = Darwin; then
3020     LIBO_BIN_FOLDER=MacOS
3021     LIBO_ETC_FOLDER=Resources
3022     LIBO_LIBEXEC_FOLDER=MacOS
3023     LIBO_LIB_FOLDER=Frameworks
3024     LIBO_LIB_PYUNO_FOLDER=Resources
3025     LIBO_SHARE_FOLDER=Resources
3026     LIBO_SHARE_HELP_FOLDER=Resources/help
3027     LIBO_SHARE_JAVA_FOLDER=Resources/java
3028     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3029     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3030     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3031     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3032     LIBO_URE_BIN_FOLDER=MacOS
3033     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3034     LIBO_URE_LIB_FOLDER=Frameworks
3035     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3036     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3037 elif test $_os = WINNT; then
3038     LIBO_BIN_FOLDER=program
3039     LIBO_ETC_FOLDER=program
3040     LIBO_LIBEXEC_FOLDER=program
3041     LIBO_LIB_FOLDER=program
3042     LIBO_LIB_PYUNO_FOLDER=program
3043     LIBO_SHARE_FOLDER=share
3044     LIBO_SHARE_HELP_FOLDER=help
3045     LIBO_SHARE_JAVA_FOLDER=program/classes
3046     LIBO_SHARE_PRESETS_FOLDER=presets
3047     LIBO_SHARE_READMES_FOLDER=readmes
3048     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3049     LIBO_SHARE_SHELL_FOLDER=program/shell
3050     LIBO_URE_BIN_FOLDER=program
3051     LIBO_URE_ETC_FOLDER=program
3052     LIBO_URE_LIB_FOLDER=program
3053     LIBO_URE_MISC_FOLDER=program
3054     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3055 else
3056     LIBO_BIN_FOLDER=program
3057     LIBO_ETC_FOLDER=program
3058     LIBO_LIBEXEC_FOLDER=program
3059     LIBO_LIB_FOLDER=program
3060     LIBO_LIB_PYUNO_FOLDER=program
3061     LIBO_SHARE_FOLDER=share
3062     LIBO_SHARE_HELP_FOLDER=help
3063     LIBO_SHARE_JAVA_FOLDER=program/classes
3064     LIBO_SHARE_PRESETS_FOLDER=presets
3065     LIBO_SHARE_READMES_FOLDER=readmes
3066     if test "$enable_fuzzers" != yes; then
3067         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3068     else
3069         LIBO_SHARE_RESOURCE_FOLDER=resource
3070     fi
3071     LIBO_SHARE_SHELL_FOLDER=program/shell
3072     LIBO_URE_BIN_FOLDER=program
3073     LIBO_URE_ETC_FOLDER=program
3074     LIBO_URE_LIB_FOLDER=program
3075     LIBO_URE_MISC_FOLDER=program
3076     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3078 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3079 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3080 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3081 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3082 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3083 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3084 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3085 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3086 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3087 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3088 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3089 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3090 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3091 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3092 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3093 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3095 # Not all of them needed in config_host.mk, add more if need arises
3096 AC_SUBST(LIBO_BIN_FOLDER)
3097 AC_SUBST(LIBO_ETC_FOLDER)
3098 AC_SUBST(LIBO_LIB_FOLDER)
3099 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3100 AC_SUBST(LIBO_SHARE_FOLDER)
3101 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3102 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3103 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3104 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3105 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3106 AC_SUBST(LIBO_URE_BIN_FOLDER)
3107 AC_SUBST(LIBO_URE_ETC_FOLDER)
3108 AC_SUBST(LIBO_URE_LIB_FOLDER)
3109 AC_SUBST(LIBO_URE_MISC_FOLDER)
3110 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3112 dnl ===================================================================
3113 dnl Windows specific tests and stuff
3114 dnl ===================================================================
3116 reg_get_value()
3118     # Return value: $regvalue
3119     unset regvalue
3121     local _regentry="/proc/registry${1}/${2}"
3122     if test -f "$_regentry"; then
3123         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3124         # Registry keys read via /proc/registry* are always \0 terminated!
3125         local _regvalue=$(tr -d '\0' < "$_regentry")
3126         if test $? -eq 0; then
3127             regvalue=$_regvalue
3128         fi
3129     fi
3132 # Get a value from the 32-bit side of the Registry
3133 reg_get_value_32()
3135     reg_get_value "32" "$1"
3138 # Get a value from the 64-bit side of the Registry
3139 reg_get_value_64()
3141     reg_get_value "64" "$1"
3144 if test "$_os" = "WINNT"; then
3145     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3146     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3147         AC_MSG_RESULT([no])
3148         WINDOWS_SDK_ARCH="x86"
3149     else
3150         AC_MSG_RESULT([yes])
3151         WINDOWS_SDK_ARCH="x64"
3152         BITNESS_OVERRIDE=64
3153     fi
3155 if test "$_os" = "iOS"; then
3156     cross_compiling="yes"
3159 if test "$cross_compiling" = "yes"; then
3160     export CROSS_COMPILING=TRUE
3161 else
3162     CROSS_COMPILING=
3163     BUILD_TYPE="$BUILD_TYPE NATIVE"
3165 AC_SUBST(CROSS_COMPILING)
3167 USE_LD=
3168 if test -n "$enable_ld" -a "$enable_ld" != "no"; then
3169     AC_MSG_CHECKING([for -fuse-ld=$enable_ld linker support])
3170     if test "$GCC" = "yes"; then
3171         ldflags_save=$LDFLAGS
3172         LDFLAGS="$LDFLAGS -fuse-ld=$enable_ld"
3173         AC_LINK_IFELSE([AC_LANG_PROGRAM([
3174 #include <stdio.h>
3175             ],[
3176 printf ("hello world\n");
3177             ])], USE_LD=$enable_ld, [])
3178         if test -n "$USE_LD"; then
3179             AC_MSG_RESULT( yes )
3180             LDFLAGS="$ldflags_save -fuse-ld=$enable_ld"
3181         else
3182             AC_MSG_ERROR( no )
3183         fi
3184     else
3185         AC_MSG_ERROR( not supported )
3186     fi
3188 AC_SUBST(USE_LD)
3190 ENABLE_GDB_INDEX=
3191 if test "$enable_gdb_index" = "yes"; then
3192     AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
3193     save_CFLAGS=$CFLAGS
3194     CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
3195     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ AC_MSG_RESULT( yes )],[ AC_MSG_ERROR( no )])
3197     AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
3198     ldflags_save=$LDFLAGS
3199     LDFLAGS="$LDFLAGS -Wl,--gdb-index"
3200     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3201 #include <stdio.h>
3202         ],[
3203 printf ("hello world\n");
3204         ])], ENABLE_GDB_INDEX=TRUE, [])
3205     if test "$ENABLE_GDB_INDEX" = "TRUE"; then
3206         AC_MSG_RESULT( yes )
3207     else
3208         AC_MSG_ERROR( no )
3209     fi
3210     CFLAGS=$save_CFLAGS
3211     LDFLAGS=$ldflags_save
3213 AC_SUBST(ENABLE_GDB_INDEX)
3215 HAVE_LD_BSYMBOLIC_FUNCTIONS=
3216 if test "$GCC" = "yes"; then
3217     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
3218     bsymbolic_functions_ldflags_save=$LDFLAGS
3219     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
3220     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3221 #include <stdio.h>
3222         ],[
3223 printf ("hello world\n");
3224         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
3225     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
3226         AC_MSG_RESULT( found )
3227     else
3228         AC_MSG_RESULT( not found )
3229     fi
3230     LDFLAGS=$bsymbolic_functions_ldflags_save
3232 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
3234 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3235 # NOTE: must _not_ be used for bundled external libraries!
3236 ISYSTEM=
3237 if test "$GCC" = "yes"; then
3238     AC_MSG_CHECKING( for -isystem )
3239     save_CFLAGS=$CFLAGS
3240     CFLAGS="$CFLAGS -Werror"
3241     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3242     CFLAGS=$save_CFLAGS
3243     if test -n "$ISYSTEM"; then
3244         AC_MSG_RESULT(yes)
3245     else
3246         AC_MSG_RESULT(no)
3247     fi
3249 if test -z "$ISYSTEM"; then
3250     # fall back to using -I
3251     ISYSTEM=-I
3253 AC_SUBST(ISYSTEM)
3255 dnl ===================================================================
3256 dnl  Check which Visual Studio compiler is used
3257 dnl ===================================================================
3259 map_vs_year_to_version()
3261     # Return value: $vsversion
3263     unset vsversion
3265     case $1 in
3266     2017)
3267         vsversion=15.0;;
3268     *)
3269         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3270     esac
3273 vs_versions_to_check()
3275     # Args: $1 (optional) : versions to check, in the order of preference
3276     # Return value: $vsversions
3278     unset vsversions
3280     if test -n "$1"; then
3281         map_vs_year_to_version "$1"
3282         vsversions=$vsversion
3283     else
3284         # We accept only 2017
3285         vsversions="15.0"
3286     fi
3289 win_get_env_from_vsvars32bat()
3291     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3292     # Also seems to be located in another directory under the same name: vsvars32.bat
3293     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3294     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3295     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3296     chmod +x $WRAPPERBATCHFILEPATH
3297     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3298     rm -f $WRAPPERBATCHFILEPATH
3299     printf '%s' "$_win_get_env_from_vsvars32bat"
3302 find_ucrt()
3304     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3305     if test -n "$regvalue"; then
3306         PathFormat "$regvalue"
3307         UCRTSDKDIR=$formatted_path
3308         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3309         UCRTVERSION=$regvalue
3310         # Rest if not exist
3311         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3312           UCRTSDKDIR=
3313         fi
3314     fi
3315     if test -z "$UCRTSDKDIR"; then
3316         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3317         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3318         if test -f "$ide_env_file"; then
3319             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3320             UCRTSDKDIR=$formatted_path
3321             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3322             dnl Hack needed at least by tml:
3323             if test "$UCRTVERSION" = 10.0.15063.0 \
3324                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3325                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3326             then
3327                 UCRTVERSION=10.0.14393.0
3328             fi
3329         else
3330           AC_MSG_ERROR([No UCRT found])
3331         fi
3332     fi
3335 find_msvc()
3337     # Find Visual C++ 2017
3338     # Args: $1 (optional) : The VS version year
3339     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3341     unset vctest vcnum vcnumwithdot vcbuildnumber
3343     vs_versions_to_check "$1"
3345     for ver in $vsversions; do
3346         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
3347         if test -n "$regvalue"; then
3348             vctest=$regvalue
3349             break
3350         fi
3351         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver
3352         if test -n "$regvalue"; then
3353             AC_MSG_RESULT([found: $regvalue])
3354             PathFormat "$regvalue"
3355             vctest=$formatted_path
3356             break
3357         fi
3358     done
3359     if test -n "$vctest"; then
3360         vcnumwithdot=$ver
3361         case "$vcnumwithdot" in
3362         15.0)
3363             vcyear=2017
3364             vcnum=150
3365             vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3366             ;;
3367         esac
3368     fi
3371 SOLARINC=
3372 MSBUILD_PATH=
3373 DEVENV=
3374 if test "$_os" = "WINNT"; then
3375     AC_MSG_CHECKING([Visual C++])
3377     find_msvc "$with_visual_studio"
3378     if test -z "$vctest"; then
3379         if test -n "$with_visual_studio"; then
3380             AC_MSG_ERROR([No Visual Studio $with_visual_studio installation found])
3381         else
3382             AC_MSG_ERROR([No Visual Studio 2017 installation found])
3383         fi
3384     fi
3386     if test "$BITNESS_OVERRIDE" = ""; then
3387         if test -f "$vctest/bin/cl.exe"; then
3388             VC_PRODUCT_DIR=$vctest
3389         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3390             VC_PRODUCT_DIR=$vctest/VC
3391         else
3392             AC_MSG_ERROR([No compiler (cl.exe) in $vctest/bin/cl.exe])
3393         fi
3394     else
3395         if test -f "$vctest/bin/amd64/cl.exe"; then
3396             VC_PRODUCT_DIR=$vctest
3397         elif test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3398             VC_PRODUCT_DIR=$vctest/VC
3399         else
3400             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])
3401         fi
3402     fi
3404     AC_MSG_CHECKING([for short pathname of VC product directory])
3405     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3406     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3408     UCRTSDKDIR=
3409     UCRTVERSION=
3411     AC_MSG_CHECKING([for UCRT location])
3412     find_ucrt
3413     # find_ucrt errors out if it doesn't find it
3414     AC_MSG_RESULT([found])
3415     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3416     ucrtincpath_formatted=$formatted_path
3417     # SOLARINC is used for external modules and must be set too.
3418     # And no, it's not sufficient to set SOLARINC only, as configure
3419     # itself doesn't honour it.
3420     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3421     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3422     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3423     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3425     AC_SUBST(UCRTSDKDIR)
3426     AC_SUBST(UCRTVERSION)
3428     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3429     # Find the proper version of MSBuild.exe to use based on the VS version
3430     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3431     if test -n "$regvalue" ; then
3432         AC_MSG_RESULT([found: $regvalue])
3433         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3434     else
3435         if test "$BITNESS_OVERRIDE" = ""; then
3436             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3437         else
3438             regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3439         fi
3440         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3441         AC_MSG_RESULT([$regvalue])
3442     fi
3444     # Find the version of devenv.exe
3445     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3446     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3447     if test ! -e "$DEVENV"; then
3448         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3449     fi
3451     dnl ===========================================================
3452     dnl  Check for the corresponding mspdb*.dll
3453     dnl ===========================================================
3455     MSPDB_PATH=
3456     CL_DIR=
3457     CL_LIB=
3459     if test "$BITNESS_OVERRIDE" = ""; then
3460         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86"
3461         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX86/x86
3462     else
3463         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64"
3464         CL_DIR=Tools/MSVC/$vcbuildnumber/bin/HostX64/x64
3465     fi
3467     # MSVC 15.0 has libraries from 14.0?
3468     mspdbnum="140"
3470     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3471         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3472     fi
3474     MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
3475     MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
3477     dnl The path needs to be added before cl is called
3478     PATH="$MSPDB_PATH:$PATH"
3480     AC_MSG_CHECKING([cl.exe])
3482     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3483     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3484     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3485     # is not enough?
3487     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3488     dnl needed when building CLR code:
3489     if test -z "$MSVC_CXX"; then
3490         if test "$BITNESS_OVERRIDE" = ""; then
3491             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3492                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3493             fi
3494         else
3495             if test -f "$VC_PRODUCT_DIR/$CL_DIR/cl.exe"; then
3496                 MSVC_CXX="$VC_PRODUCT_DIR/$CL_DIR/cl.exe"
3497             fi
3498         fi
3500         # This gives us a posix path with 8.3 filename restrictions
3501         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3502     fi
3504     if test -z "$CC"; then
3505         CC=$MSVC_CXX
3506     fi
3507     if test "$BITNESS_OVERRIDE" = ""; then
3508         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3509         MSVC_CXX="$MSVC_CXX -arch:SSE"
3510     fi
3512     if test -n "$CC"; then
3513         # Remove /cl.exe from CC case insensitive
3514         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3515         if test "$BITNESS_OVERRIDE" = ""; then
3516            COMPATH="$VC_PRODUCT_DIR"
3517         else
3518             if test -n "$VC_PRODUCT_DIR"; then
3519                 COMPATH=$VC_PRODUCT_DIR
3520             fi
3521         fi
3522         if test "$BITNESS_OVERRIDE" = ""; then
3523             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3524             CC="$CC -arch:SSE"
3525         fi
3527         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3529         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3531         PathFormat "$COMPATH"
3532         COMPATH="$formatted_path"
3534         VCVER=$vcnum
3535         MSVSVER=$vcyear
3537         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3538         # are always "better", we list them in reverse chronological order.
3540         case $vcnum in
3541         150)
3542             COMEX=19
3543             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0 7.1A"
3544             ;;
3545         esac
3547         # The expectation is that --with-windows-sdk should not need to be used
3548         if test -n "$with_windows_sdk"; then
3549             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3550             *" "$with_windows_sdk" "*)
3551                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3552                 ;;
3553             *)
3554                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3555                 ;;
3556             esac
3557         fi
3559         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3560         ac_objext=obj
3561         ac_exeext=exe
3563     else
3564         AC_MSG_ERROR([Visual C++ not found after all, huh])
3565     fi
3567     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3568     # version of the Explorer extension (and maybe other small
3569     # bits, too) needed when installing a 32-bit LibreOffice on a
3570     # 64-bit OS. The 64-bit Explorer extension is a feature that
3571     # has been present since long in OOo. Don't confuse it with
3572     # building LibreOffice itself as 64-bit code.
3574     BUILD_X64=
3575     CXX_X64_BINARY=
3576     LINK_X64_BINARY=
3578     if test "$BITNESS_OVERRIDE" = ""; then
3579         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3580         if test -f "$VC_PRODUCT_DIR/atlmfc/lib/amd64/atls.lib"; then
3581             # Prefer native x64 compiler to cross-compiler, in case we are running
3582             # the build on a 64-bit OS.
3583             if "$VC_PRODUCT_DIR/bin/amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3584                 BUILD_X64=TRUE
3585                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/cl.exe"
3586                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/amd64/link.exe"
3587             elif "$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3588                 BUILD_X64=TRUE
3589                 CXX_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/cl.exe"
3590                 LINK_X64_BINARY="$VC_PRODUCT_DIR/bin/x86_amd64/link.exe"
3591             fi
3592         elif test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib"; then
3593             # nobody uses 32-bit OS to build, just pick the 64-bit compiler
3594             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3595                 BUILD_X64=TRUE
3596                 CXX_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"
3597                 LINK_X64_BINARY="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/link.exe"
3598             fi
3599         fi
3600         if test "$BUILD_X64" = TRUE; then
3601             AC_MSG_RESULT([found])
3602         else
3603             AC_MSG_RESULT([not found])
3604             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3605         fi
3606     fi
3607     AC_SUBST(BUILD_X64)
3609     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3610     AC_SUBST(CXX_X64_BINARY)
3611     AC_SUBST(LINK_X64_BINARY)
3613 AC_SUBST(VCVER)
3614 AC_SUBST(DEVENV)
3615 PathFormat "$MSPDB_PATH"
3616 MSPDB_PATH="$formatted_path"
3617 AC_SUBST(MSVC_CXX)
3620 # unowinreg.dll
3622 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3623 AC_SUBST(UNOWINREG_DLL)
3625 COM_IS_CLANG=
3626 AC_MSG_CHECKING([whether the compiler is actually Clang])
3627 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3628     #ifndef __clang__
3629     you lose
3630     #endif
3631     int foo=42;
3632     ]])],
3633     [AC_MSG_RESULT([yes])
3634      COM_IS_CLANG=TRUE],
3635     [AC_MSG_RESULT([no])])
3637 CC_PLAIN=$CC
3638 if test "$COM_IS_CLANG" = TRUE; then
3639     AC_MSG_CHECKING([the Clang version])
3640     if test "$_os" = WINNT; then
3641         dnl In which case, assume clang-cl:
3642         my_args="/EP /TC"
3643         dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3644         dnl clang-cl:
3645         CC_PLAIN=
3646         for i in $CC; do
3647             case $i in
3648             -FIIntrin.h)
3649                 ;;
3650             *)
3651                 CC_PLAIN="$CC_PLAIN $i"
3652                 ;;
3653             esac
3654         done
3655     else
3656         my_args="-E -P"
3657     fi
3658     clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args -`
3659     CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3660     CLANGVER=`echo $clang_version \
3661         | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3662     AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
3663     AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3664     AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3666 AC_SUBST(COM_IS_CLANG)
3667 AC_SUBST(CLANGVER)
3669 SHOWINCLUDES_PREFIX=
3670 if test "$_os" = WINNT; then
3671     dnl We need to guess the prefix of the -showIncludes output, it can be
3672     dnl localized
3673     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3674     echo "#include <stdlib.h>" > conftest.c
3675     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3676         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3677     rm -f conftest.c conftest.obj
3678     if test -z "$SHOWINCLUDES_PREFIX"; then
3679         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3680     else
3681         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3682     fi
3684 AC_SUBST(SHOWINCLUDES_PREFIX)
3687 # prefix C with ccache if needed
3689 if test "$CCACHE" != ""; then
3690     AC_MSG_CHECKING([whether $CC is already ccached])
3692     AC_LANG_PUSH([C])
3693     save_CFLAGS=$CFLAGS
3694     CFLAGS="$CFLAGS --ccache-skip -O2"
3695     dnl an empty program will do, we're checking the compiler flags
3696     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3697                       [use_ccache=yes], [use_ccache=no])
3698     if test $use_ccache = yes; then
3699         AC_MSG_RESULT([yes])
3700     else
3701         CC="$CCACHE $CC"
3702         AC_MSG_RESULT([no])
3703     fi
3704     CFLAGS=$save_CFLAGS
3705     AC_LANG_POP([C])
3708 # ===================================================================
3709 # check various GCC options that Clang does not support now but maybe
3710 # will somewhen in the future, check them even for GCC, so that the
3711 # flags are set
3712 # ===================================================================
3714 HAVE_GCC_GGDB2=
3715 HAVE_GCC_FINLINE_LIMIT=
3716 HAVE_GCC_FNO_INLINE=
3717 if test "$GCC" = "yes"; then
3718     AC_MSG_CHECKING([whether $CC supports -ggdb2])
3719     save_CFLAGS=$CFLAGS
3720     CFLAGS="$CFLAGS -Werror -ggdb2"
3721     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3722     CFLAGS=$save_CFLAGS
3723     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3724         AC_MSG_RESULT([yes])
3725     else
3726         AC_MSG_RESULT([no])
3727     fi
3729     AC_MSG_CHECKING([whether $CC supports -finline-limit=0])
3730     save_CFLAGS=$CFLAGS
3731     CFLAGS="$CFLAGS -Werror -finline-limit=0"
3732     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FINLINE_LIMIT=TRUE ],[])
3733     CFLAGS=$save_CFLAGS
3734     if test "$HAVE_GCC_FINLINE_LIMIT" = "TRUE"; then
3735         AC_MSG_RESULT([yes])
3736     else
3737         AC_MSG_RESULT([no])
3738     fi
3740     AC_MSG_CHECKING([whether $CC supports -fno-inline])
3741     save_CFLAGS=$CFLAGS
3742     CFLAGS="$CFLAGS -Werror -fno-inline"
3743     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_INLINE=TRUE ],[])
3744     CFLAGS=$save_CFLAGS
3745     if test "$HAVE_GCC_FNO_INLINE" = "TRUE"; then
3746         AC_MSG_RESULT([yes])
3747     else
3748         AC_MSG_RESULT([no])
3749     fi
3751     if test "$host_cpu" = "m68k"; then
3752         AC_MSG_CHECKING([whether $CC supports -mlong-jump-table-offsets])
3753         save_CFLAGS=$CFLAGS
3754         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3755         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3756         CFLAGS=$save_CFLAGS
3757         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3758             AC_MSG_RESULT([yes])
3759         else
3760             AC_MSG_ERROR([no])
3761         fi
3762     fi
3764 AC_SUBST(HAVE_GCC_GGDB2)
3765 AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
3766 AC_SUBST(HAVE_GCC_FNO_INLINE)
3768 dnl ===================================================================
3769 dnl  Test the gcc version
3770 dnl ===================================================================
3771 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3772     AC_MSG_CHECKING([the GCC version])
3773     _gcc_version=`$CC -dumpversion`
3774     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3775         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3776     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3778     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3780     if test "$gcc_full_version" -lt 40801; then
3781         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.8.1])
3782     fi
3783 else
3784     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3785     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3786     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3787     # (which reports itself as GCC 4.2.1).
3788     GCC_VERSION=
3790 AC_SUBST(GCC_VERSION)
3792 dnl Set the ENABLE_DBGUTIL variable
3793 dnl ===================================================================
3794 AC_MSG_CHECKING([whether to build with additional debug utilities])
3795 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3796     ENABLE_DBGUTIL="TRUE"
3797     # this is an extra var so it can have different default on different MSVC
3798     # versions (in case there are version specific problems with it)
3799     MSVC_USE_DEBUG_RUNTIME="TRUE"
3801     AC_MSG_RESULT([yes])
3802     # cppunit and graphite expose STL in public headers
3803     if test "$with_system_cppunit" = "yes"; then
3804         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3805     else
3806         with_system_cppunit=no
3807     fi
3808     if test "$with_system_graphite" = "yes"; then
3809         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3810     else
3811         with_system_graphite=no
3812     fi
3813     if test "$with_system_orcus" = "yes"; then
3814         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3815     else
3816         with_system_orcus=no
3817     fi
3818     if test "$with_system_libcmis" = "yes"; then
3819         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3820     else
3821         with_system_libcmis=no
3822     fi
3823     if test "$with_system_hunspell" = "yes"; then
3824         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3825     else
3826         with_system_hunspell=no
3827     fi
3828     if test "$with_system_gpgmepp" = "yes"; then
3829         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3830     else
3831         with_system_gpgmepp=no
3832     fi
3833     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3834     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3835     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3836     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3837     # of those two is using the system variant:
3838     if test "$with_system_libnumbertext" = "yes"; then
3839         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3840     else
3841         with_system_libnumbertext=no
3842     fi
3843     if test "$with_system_libwps" = "yes"; then
3844         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3845     else
3846         with_system_libwps=no
3847     fi
3848 else
3849     ENABLE_DBGUTIL=""
3850     MSVC_USE_DEBUG_RUNTIME=""
3851     AC_MSG_RESULT([no])
3853 AC_SUBST(ENABLE_DBGUTIL)
3854 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3856 dnl Set the ENABLE_DEBUG variable.
3857 dnl ===================================================================
3858 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3859     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-selective-debuginfo])
3861 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3862     if test -z "$libo_fuzzed_enable_debug"; then
3863         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3864     else
3865         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3866         enable_debug=yes
3867     fi
3870 AC_MSG_CHECKING([whether to do a debug build])
3871 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3872     ENABLE_DEBUG="TRUE"
3873     if test -n "$ENABLE_DBGUTIL" ; then
3874         AC_MSG_RESULT([yes (dbgutil)])
3875     else
3876         AC_MSG_RESULT([yes])
3877     fi
3878 else
3879     ENABLE_DEBUG=""
3880     AC_MSG_RESULT([no])
3882 AC_SUBST(ENABLE_DEBUG)
3884 if test "$enable_split_debug" = yes; then
3885     HAVE_GSPLIT_DWARF=
3886     if test "$GCC" = "yes"; then
3887         AC_MSG_CHECKING([whether $CC supports -gsplit-dwarf])
3888         save_CFLAGS=$CFLAGS
3889         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
3890         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
3891         CFLAGS=$save_CFLAGS
3892         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
3893             AC_MSG_RESULT([yes])
3894         else
3895             AC_MSG_RESULT([no])
3896         fi
3897     fi
3898     AC_SUBST(HAVE_GCC_SPLIT_DWARF)
3901 if test "$enable_sal_log" = yes; then
3902     ENABLE_SAL_LOG=TRUE
3904 AC_SUBST(ENABLE_SAL_LOG)
3906 dnl Selective debuginfo
3907 ENABLE_DEBUGINFO_FOR=
3908 if test -n "$ENABLE_DEBUG"; then
3909     AC_MSG_CHECKING([whether to use selective debuginfo])
3910     if test -n "$enable_selective_debuginfo" -a "$enable_selective_debuginfo" != "no"; then
3911         if test "$enable_selective_debuginfo" = "yes"; then
3912             AC_MSG_ERROR([--enable-selective-debuginfo requires a parameter])
3913         fi
3914         ENABLE_DEBUGINFO_FOR="$enable_selective_debuginfo"
3915         AC_MSG_RESULT([for "$enable_selective_debuginfo"])
3916     else
3917         ENABLE_DEBUGINFO_FOR=all
3918         AC_MSG_RESULT([no, for all])
3919     fi
3920 else
3921     if test -n "$enable_selective_debuginfo"; then
3922         AC_MSG_ERROR([--enable-selective-debuginfo must be used together with either --enable-debug or --enable-dbgutil])
3923     fi
3925 AC_SUBST(ENABLE_DEBUGINFO_FOR)
3927 dnl Check for enable symbols option
3928 dnl ===================================================================
3929 AC_MSG_CHECKING([whether to generate debug information])
3930 if test -z "$enable_symbols"; then
3931     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3932         enable_symbols=yes
3933     else
3934         enable_symbols=no
3935     fi
3937 if test "$enable_symbols" != no; then
3938     ENABLE_SYMBOLS=TRUE
3939     AC_MSG_RESULT([yes])
3940 else
3941     ENABLE_SYMBOLS=
3942     AC_MSG_RESULT([no])
3944 AC_SUBST(ENABLE_SYMBOLS)
3946 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
3947     # Building on Android with full symbols: without enough memory the linker never finishes currently.
3948     AC_MSG_CHECKING([whether enough memory is available for linking])
3949     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
3950     # Check for 15GB, as Linux reports a bit less than the physical memory size.
3951     if test -n "$mem_size" -a $mem_size -lt 15728640; then
3952         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
3953     else
3954         AC_MSG_RESULT([yes])
3955     fi
3958 AC_MSG_CHECKING([whether to compile with optimization flags])
3959 if test -z "$enable_optimized"; then
3960     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
3961         enable_optimized=no
3962     else
3963         enable_optimized=yes
3964     fi
3966 if test "$enable_optimized" != no; then
3967     ENABLE_OPTIMIZED=TRUE
3968     AC_MSG_RESULT([yes])
3969 else
3970     ENABLE_OPTIMIZED=
3971     AC_MSG_RESULT([no])
3973 AC_SUBST(ENABLE_OPTIMIZED)
3976 # determine CPUNAME, OS, ...
3977 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
3979 case "$host_os" in
3981 aix*)
3982     COM=GCC
3983     CPUNAME=POWERPC
3984     USING_X11=TRUE
3985     OS=AIX
3986     RTL_OS=AIX
3987     RTL_ARCH=PowerPC
3988     PLATFORMID=aix_powerpc
3989     P_SEP=:
3990     ;;
3992 cygwin*)
3993     COM=MSC
3994     USING_X11=
3995     OS=WNT
3996     RTL_OS=Windows
3997     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3998         P_SEP=";"
3999     else
4000         P_SEP=:
4001     fi
4002     case "$host_cpu" in
4003     i*86|x86_64)
4004         if test "$BITNESS_OVERRIDE" = 64; then
4005             CPUNAME=X86_64
4006             RTL_ARCH=X86_64
4007             PLATFORMID=windows_x86_64
4008             WINDOWS_X64=1
4009             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4010         else
4011             CPUNAME=INTEL
4012             RTL_ARCH=x86
4013             PLATFORMID=windows_x86
4014         fi
4015         ;;
4016     *)
4017         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4018         ;;
4019     esac
4020     SCPDEFS="$SCPDEFS -D_MSC_VER"
4021     ;;
4023 darwin*)
4024     COM=GCC
4025     USING_X11=
4026     OS=MACOSX
4027     RTL_OS=MacOSX
4028     P_SEP=:
4030     case "$host_cpu" in
4031     arm)
4032         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4033         ;;
4034     arm64)
4035         OS=IOS
4036         if test "$enable_ios_simulator" = "yes"; then
4037             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4038         else
4039             CPUNAME=ARM64
4040             RTL_ARCH=ARM_EABI
4041             PLATFORMID=ios_arm64
4042         fi
4043         ;;
4044     i*86)
4045         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4046         ;;
4047     x86_64)
4048         if test "$enable_ios_simulator" = "yes"; then
4049             OS=IOS
4050         fi
4051         CPUNAME=X86_64
4052         RTL_ARCH=X86_64
4053         PLATFORMID=macosx_x86_64
4054         ;;
4055     *)
4056         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4057         ;;
4058     esac
4059     ;;
4061 dragonfly*)
4062     COM=GCC
4063     USING_X11=TRUE
4064     OS=DRAGONFLY
4065     RTL_OS=DragonFly
4066     P_SEP=:
4068     case "$host_cpu" in
4069     i*86)
4070         CPUNAME=INTEL
4071         RTL_ARCH=x86
4072         PLATFORMID=dragonfly_x86
4073         ;;
4074     x86_64)
4075         CPUNAME=X86_64
4076         RTL_ARCH=X86_64
4077         PLATFORMID=dragonfly_x86_64
4078         ;;
4079     *)
4080         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4081         ;;
4082     esac
4083     ;;
4085 freebsd*)
4086     COM=GCC
4087     USING_X11=TRUE
4088     RTL_OS=FreeBSD
4089     OS=FREEBSD
4090     P_SEP=:
4092     case "$host_cpu" in
4093     i*86)
4094         CPUNAME=INTEL
4095         RTL_ARCH=x86
4096         PLATFORMID=freebsd_x86
4097         ;;
4098     x86_64|amd64)
4099         CPUNAME=X86_64
4100         RTL_ARCH=X86_64
4101         PLATFORMID=freebsd_x86_64
4102         ;;
4103     *)
4104         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4105         ;;
4106     esac
4107     ;;
4109 haiku*)
4110     COM=GCC
4111     USING_X11=
4112     GUIBASE=haiku
4113     RTL_OS=Haiku
4114     OS=HAIKU
4115     P_SEP=:
4117     case "$host_cpu" in
4118     i*86)
4119         CPUNAME=INTEL
4120         RTL_ARCH=x86
4121         PLATFORMID=haiku_x86
4122         ;;
4123     x86_64|amd64)
4124         CPUNAME=X86_64
4125         RTL_ARCH=X86_64
4126         PLATFORMID=haiku_x86_64
4127         ;;
4128     *)
4129         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4130         ;;
4131     esac
4132     ;;
4134 kfreebsd*)
4135     COM=GCC
4136     USING_X11=TRUE
4137     OS=LINUX
4138     RTL_OS=kFreeBSD
4139     P_SEP=:
4141     case "$host_cpu" in
4143     i*86)
4144         CPUNAME=INTEL
4145         RTL_ARCH=x86
4146         PLATFORMID=kfreebsd_x86
4147         ;;
4148     x86_64)
4149         CPUNAME=X86_64
4150         RTL_ARCH=X86_64
4151         PLATFORMID=kfreebsd_x86_64
4152         ;;
4153     *)
4154         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4155         ;;
4156     esac
4157     ;;
4159 linux-gnu*)
4160     COM=GCC
4161     USING_X11=TRUE
4162     OS=LINUX
4163     RTL_OS=Linux
4164     P_SEP=:
4166     case "$host_cpu" in
4168     aarch64)
4169         CPUNAME=AARCH64
4170         PLATFORMID=linux_aarch64
4171         RTL_ARCH=AARCH64
4172         ;;
4173     alpha)
4174         CPUNAME=AXP
4175         RTL_ARCH=ALPHA
4176         PLATFORMID=linux_alpha
4177         ;;
4178     arm*)
4179         CPUNAME=ARM
4180         EPM_FLAGS="-a arm"
4181         RTL_ARCH=ARM_EABI
4182         PLATFORMID=linux_arm_eabi
4183         case "$host_cpu" in
4184         arm*-linux)
4185             RTL_ARCH=ARM_OABI
4186             PLATFORMID=linux_arm_oabi
4187             ;;
4188         esac
4189         ;;
4190     hppa)
4191         CPUNAME=HPPA
4192         RTL_ARCH=HPPA
4193         EPM_FLAGS="-a hppa"
4194         PLATFORMID=linux_hppa
4195         ;;
4196     i*86)
4197         CPUNAME=INTEL
4198         RTL_ARCH=x86
4199         PLATFORMID=linux_x86
4200         ;;
4201     ia64)
4202         CPUNAME=IA64
4203         RTL_ARCH=IA64
4204         PLATFORMID=linux_ia64
4205         ;;
4206     mips)
4207         CPUNAME=GODSON
4208         RTL_ARCH=MIPS_EB
4209         EPM_FLAGS="-a mips"
4210         PLATFORMID=linux_mips_eb
4211         ;;
4212     mips64)
4213         CPUNAME=GODSON64
4214         RTL_ARCH=MIPS64_EB
4215         EPM_FLAGS="-a mips64"
4216         PLATFORMID=linux_mips64_eb
4217         ;;
4218     mips64el)
4219         CPUNAME=GODSON64
4220         RTL_ARCH=MIPS64_EL
4221         EPM_FLAGS="-a mips64el"
4222         PLATFORMID=linux_mips64_el
4223         ;;
4224     mipsel)
4225         CPUNAME=GODSON
4226         RTL_ARCH=MIPS_EL
4227         EPM_FLAGS="-a mipsel"
4228         PLATFORMID=linux_mips_el
4229         ;;
4230     m68k)
4231         CPUNAME=M68K
4232         RTL_ARCH=M68K
4233         PLATFORMID=linux_m68k
4234         ;;
4235     powerpc)
4236         CPUNAME=POWERPC
4237         RTL_ARCH=PowerPC
4238         PLATFORMID=linux_powerpc
4239         ;;
4240     powerpc64)
4241         CPUNAME=POWERPC64
4242         RTL_ARCH=PowerPC_64
4243         PLATFORMID=linux_powerpc64
4244         ;;
4245     powerpc64le)
4246         CPUNAME=POWERPC64
4247         RTL_ARCH=PowerPC_64_LE
4248         PLATFORMID=linux_powerpc64_le
4249         ;;
4250     sparc)
4251         CPUNAME=SPARC
4252         RTL_ARCH=SPARC
4253         PLATFORMID=linux_sparc
4254         ;;
4255     sparc64)
4256         CPUNAME=SPARC64
4257         RTL_ARCH=SPARC64
4258         PLATFORMID=linux_sparc64
4259         ;;
4260     s390)
4261         CPUNAME=S390
4262         RTL_ARCH=S390
4263         PLATFORMID=linux_s390
4264         ;;
4265     s390x)
4266         CPUNAME=S390X
4267         RTL_ARCH=S390x
4268         PLATFORMID=linux_s390x
4269         ;;
4270     x86_64)
4271         CPUNAME=X86_64
4272         RTL_ARCH=X86_64
4273         PLATFORMID=linux_x86_64
4274         ;;
4275     *)
4276         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4277         ;;
4278     esac
4279     ;;
4281 linux-android*)
4282     COM=GCC
4283     USING_X11=
4284     OS=ANDROID
4285     RTL_OS=Android
4286     P_SEP=:
4288     case "$host_cpu" in
4290     arm|armel)
4291         CPUNAME=ARM
4292         RTL_ARCH=ARM_EABI
4293         PLATFORMID=android_arm_eabi
4294         ;;
4295     aarch64)
4296         CPUNAME=AARCH64
4297         RTL_ARCH=AARCH64
4298         PLATFORMID=android_aarch64
4299         ;;
4300     mips|mipsel)
4301         CPUNAME=GODSON # Weird, but maybe that's the LO convention?
4302         RTL_ARCH=MIPS_EL
4303         PLATFORMID=android_mips_el
4304         ;;
4305     i*86)
4306         CPUNAME=INTEL
4307         RTL_ARCH=x86
4308         PLATFORMID=android_x86
4309         ;;
4310     *)
4311         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4312         ;;
4313     esac
4314     ;;
4316 *netbsd*)
4317     COM=GCC
4318     USING_X11=TRUE
4319     OS=NETBSD
4320     RTL_OS=NetBSD
4321     P_SEP=:
4323     case "$host_cpu" in
4324     i*86)
4325         CPUNAME=INTEL
4326         RTL_ARCH=x86
4327         PLATFORMID=netbsd_x86
4328         ;;
4329     powerpc)
4330         CPUNAME=POWERPC
4331         RTL_ARCH=PowerPC
4332         PLATFORMID=netbsd_powerpc
4333         ;;
4334     sparc)
4335         CPUNAME=SPARC
4336         RTL_ARCH=SPARC
4337         PLATFORMID=netbsd_sparc
4338         ;;
4339     x86_64)
4340         CPUNAME=X86_64
4341         RTL_ARCH=X86_64
4342         PLATFORMID=netbsd_x86_64
4343         ;;
4344     *)
4345         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4346         ;;
4347     esac
4348     ;;
4350 openbsd*)
4351     COM=GCC
4352     USING_X11=TRUE
4353     OS=OPENBSD
4354     RTL_OS=OpenBSD
4355     P_SEP=:
4357     case "$host_cpu" in
4358     i*86)
4359         CPUNAME=INTEL
4360         RTL_ARCH=x86
4361         PLATFORMID=openbsd_x86
4362         ;;
4363     x86_64)
4364         CPUNAME=X86_64
4365         RTL_ARCH=X86_64
4366         PLATFORMID=openbsd_x86_64
4367         ;;
4368     *)
4369         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4370         ;;
4371     esac
4372     SOLARINC="$SOLARINC -I/usr/local/include"
4373     ;;
4375 solaris*)
4376     COM=GCC
4377     USING_X11=TRUE
4378     OS=SOLARIS
4379     RTL_OS=Solaris
4380     P_SEP=:
4382     case "$host_cpu" in
4383     i*86)
4384         CPUNAME=INTEL
4385         RTL_ARCH=x86
4386         PLATFORMID=solaris_x86
4387         ;;
4388     sparc)
4389         CPUNAME=SPARC
4390         RTL_ARCH=SPARC
4391         PLATFORMID=solaris_sparc
4392         ;;
4393     sparc64)
4394         CPUNAME=SPARC64
4395         RTL_ARCH=SPARC64
4396         PLATFORMID=solaris_sparc64
4397         ;;
4398     *)
4399         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4400         ;;
4401     esac
4402     SOLARINC="$SOLARINC -I/usr/local/include"
4403     ;;
4406     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4407     ;;
4408 esac
4410 if test "$with_x" = "no"; then
4411     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4414 DISABLE_GUI=""
4415 if test "$enable_gui" = "no"; then
4416     if test "$USING_X11" != TRUE; then
4417         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4418     fi
4419     USING_X11=
4420     DISABLE_GUI=TRUE
4421     AC_DEFINE(HAVE_FEATURE_UI,0)
4422     test_cairo=yes
4424 AC_SUBST(DISABLE_GUI)
4426 WORKDIR="${BUILDDIR}/workdir"
4427 INSTDIR="${BUILDDIR}/instdir"
4428 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4429 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4430 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4431 AC_SUBST(COM)
4432 AC_SUBST(CPUNAME)
4433 AC_SUBST(RTL_OS)
4434 AC_SUBST(RTL_ARCH)
4435 AC_SUBST(EPM_FLAGS)
4436 AC_SUBST(USING_X11)
4437 AC_SUBST([INSTDIR])
4438 AC_SUBST([INSTROOT])
4439 AC_SUBST([INSTROOTBASE])
4440 AC_SUBST(OS)
4441 AC_SUBST(P_SEP)
4442 AC_SUBST(WORKDIR)
4443 AC_SUBST(PLATFORMID)
4444 AC_SUBST(WINDOWS_X64)
4445 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4447 dnl ===================================================================
4448 dnl Test which package format to use
4449 dnl ===================================================================
4450 AC_MSG_CHECKING([which package format to use])
4451 if test -n "$with_package_format" -a "$with_package_format" != no; then
4452     for i in $with_package_format; do
4453         case "$i" in
4454         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4455             ;;
4456         *)
4457             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4458 aix - AIX software distribution
4459 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4460 deb - Debian software distribution
4461 pkg - Solaris software distribution
4462 rpm - RedHat software distribution
4464 LibreOffice additionally supports:
4465 archive - .tar.gz or .zip
4466 dmg - Mac OS X .dmg
4467 installed - installation tree
4468 msi - Windows .msi
4469         ])
4470             ;;
4471         esac
4472     done
4473     # fakeroot is needed to ensure correct file ownerships/permissions
4474     # inside deb packages and tar archives created on Linux and Solaris.
4475     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4476         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4477         if test "$FAKEROOT" = "no"; then
4478             AC_MSG_ERROR(
4479                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4480         fi
4481     fi
4482     PKGFORMAT="$with_package_format"
4483     AC_MSG_RESULT([$PKGFORMAT])
4484 else
4485     PKGFORMAT=
4486     AC_MSG_RESULT([none])
4488 AC_SUBST(PKGFORMAT)
4490 dnl ===================================================================
4491 dnl Set up a different compiler to produce tools to run on the build
4492 dnl machine when doing cross-compilation
4493 dnl ===================================================================
4495 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4496 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4497 if test "$cross_compiling" = "yes"; then
4498     AC_MSG_CHECKING([for BUILD platform configuration])
4499     echo
4500     rm -rf CONF-FOR-BUILD config_build.mk
4501     mkdir CONF-FOR-BUILD
4502     # Here must be listed all files needed when running the configure script. In particular, also
4503     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4504     # keep them in the same order as there.
4505     (cd $SRC_ROOT && tar cf - \
4506         config.guess \
4507         bin/get_config_variables \
4508         solenv/bin/getcompver.awk \
4509         solenv/inc/langlist.mk \
4510         download.lst \
4511         config_host.mk.in \
4512         config_host_lang.mk.in \
4513         Makefile.in \
4514         lo.xcent.in \
4515         bin/bffvalidator.sh.in \
4516         bin/odfvalidator.sh.in \
4517         bin/officeotron.sh.in \
4518         instsetoo_native/util/openoffice.lst.in \
4519         config_host/*.in \
4520         sysui/desktop/macosx/Info.plist.in) \
4521     | (cd CONF-FOR-BUILD && tar xf -)
4522     cp configure CONF-FOR-BUILD
4523     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4524     (
4525     unset COM USING_X11 OS CPUNAME
4526     unset CC CXX SYSBASE CFLAGS
4527     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4528     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4529     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4530     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
4531     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
4532     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4533     cd CONF-FOR-BUILD
4534     sub_conf_opts=""
4535     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4536     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4537     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4538     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4539     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4540     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4541     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4542     # Don't bother having configure look for stuff not needed for the build platform anyway
4543     ./configure \
4544         --disable-cups \
4545         --disable-gtk3 \
4546         --disable-pdfimport \
4547         --disable-postgresql-sdbc \
4548         --with-parallelism="$with_parallelism" \
4549         --without-doxygen \
4550         --without-java \
4551         $sub_conf_opts \
4552         --srcdir=$srcdir \
4553         2>&1 | sed -e 's/^/    /'
4554     test -f ./config_host.mk 2>/dev/null || exit
4555     cp config_host.mk ../config_build.mk
4556     cp config_host_lang.mk ../config_build_lang.mk
4557     mv config.log ../config.Build.log
4558     mkdir -p ../config_build
4559     mv config_host/*.h ../config_build
4560     . ./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
4562     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
4563         VV='$'$V
4564         VV=`eval "echo $VV"`
4565         if test -n "$VV"; then
4566             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4567             echo "$line" >>build-config
4568         fi
4569     done
4571     for V in INSTDIR INSTROOT WORKDIR; do
4572         VV='$'$V
4573         VV=`eval "echo $VV"`
4574         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4575         if test -n "$VV"; then
4576             line="${V}_FOR_BUILD='$VV'"
4577             echo "$line" >>build-config
4578         fi
4579     done
4581     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4582     echo "$line" >>build-config
4584     )
4585     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4586     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])
4587     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4588              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4590     eval `cat CONF-FOR-BUILD/build-config`
4592     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4594     rm -rf CONF-FOR-BUILD
4595 else
4596     OS_FOR_BUILD="$OS"
4597     CC_FOR_BUILD="$CC"
4598     CXX_FOR_BUILD="$CXX"
4599     INSTDIR_FOR_BUILD="$INSTDIR"
4600     INSTROOT_FOR_BUILD="$INSTROOT"
4601     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4602     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4603     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4604     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4605     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4606     WORKDIR_FOR_BUILD="$WORKDIR"
4608 AC_SUBST(OS_FOR_BUILD)
4609 AC_SUBST(INSTDIR_FOR_BUILD)
4610 AC_SUBST(INSTROOT_FOR_BUILD)
4611 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4612 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4613 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4614 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4615 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4616 AC_SUBST(WORKDIR_FOR_BUILD)
4618 dnl ===================================================================
4619 dnl Check for syslog header
4620 dnl ===================================================================
4621 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4623 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4624 dnl ===================================================================
4625 AC_MSG_CHECKING([whether to turn warnings to errors])
4626 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4627     ENABLE_WERROR="TRUE"
4628     AC_MSG_RESULT([yes])
4629 else
4630     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4631         ENABLE_WERROR="TRUE"
4632         AC_MSG_RESULT([yes])
4633     else
4634         AC_MSG_RESULT([no])
4635     fi
4637 AC_SUBST(ENABLE_WERROR)
4639 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4640 dnl ===================================================================
4641 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4642 if test -z "$enable_assert_always_abort"; then
4643    if test "$ENABLE_DEBUG" = TRUE; then
4644        enable_assert_always_abort=yes
4645    else
4646        enable_assert_always_abort=no
4647    fi
4649 if test "$enable_assert_always_abort" = "yes"; then
4650     ASSERT_ALWAYS_ABORT="TRUE"
4651     AC_MSG_RESULT([yes])
4652 else
4653     ASSERT_ALWAYS_ABORT="FALSE"
4654     AC_MSG_RESULT([no])
4656 AC_SUBST(ASSERT_ALWAYS_ABORT)
4658 # Determine whether to use ooenv for the instdir installation
4659 # ===================================================================
4660 if test $_os != "WINNT" -a $_os != "Darwin"; then
4661     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4662     if test "$enable_ooenv" = "no"; then
4663         AC_MSG_RESULT([no])
4664     else
4665         ENABLE_OOENV="TRUE"
4666         AC_MSG_RESULT([yes])
4667     fi
4669 AC_SUBST(ENABLE_OOENV)
4671 if test "$USING_X11" != TRUE; then
4672     # be sure to do not mess with unneeded stuff
4673     test_randr=no
4674     test_xrender=no
4675     test_cups=no
4676     test_dbus=no
4677     test_gtk=no
4678     build_gstreamer_1_0=no
4679     build_gstreamer_0_10=no
4680     test_kde4=no
4681     test_kde5=no
4682     test_qt5=no
4683     test_gtk3_kde5=no
4684     enable_cairo_canvas=no
4687 if test "$OS" = "HAIKU"; then
4688     enable_cairo_canvas=yes
4689     test_qt5=yes
4690     test_kde5=yes
4693 dnl ===================================================================
4694 dnl check for cups support
4695 dnl ===================================================================
4696 ENABLE_CUPS=""
4698 if test "$enable_cups" = "no"; then
4699     test_cups=no
4702 AC_MSG_CHECKING([whether to enable CUPS support])
4703 if test "$test_cups" = "yes"; then
4704     ENABLE_CUPS="TRUE"
4705     AC_MSG_RESULT([yes])
4707     AC_MSG_CHECKING([whether cups support is present])
4708     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4709     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4710     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4711         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4712     fi
4714 else
4715     AC_MSG_RESULT([no])
4718 AC_SUBST(ENABLE_CUPS)
4720 # fontconfig checks
4721 if test "$test_fontconfig" = "yes"; then
4722     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4723     SYSTEM_FONTCONFIG=TRUE
4724     FilterLibs "${FONTCONFIG_LIBS}"
4725     FONTCONFIG_LIBS="${filteredlibs}"
4727 AC_SUBST(FONTCONFIG_CFLAGS)
4728 AC_SUBST(FONTCONFIG_LIBS)
4729 AC_SUBST([SYSTEM_FONTCONFIG])
4731 dnl whether to find & fetch external tarballs?
4732 dnl ===================================================================
4733 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4734    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4735        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4736    else
4737        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4738    fi
4740 if test -z "$TARFILE_LOCATION"; then
4741     if test -d "$SRC_ROOT/src" ; then
4742         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4743         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4744     fi
4745     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4746 else
4747     AbsolutePath "$TARFILE_LOCATION"
4748     PathFormat "${absolute_path}"
4749     TARFILE_LOCATION="${formatted_path}"
4751 AC_SUBST(TARFILE_LOCATION)
4753 AC_MSG_CHECKING([whether we want to fetch tarballs])
4754 if test "$enable_fetch_external" != "no"; then
4755     if test "$with_all_tarballs" = "yes"; then
4756         AC_MSG_RESULT([yes, all of them])
4757         DO_FETCH_TARBALLS="ALL"
4758     else
4759         AC_MSG_RESULT([yes, if we use them])
4760         DO_FETCH_TARBALLS="TRUE"
4761     fi
4762 else
4763     AC_MSG_RESULT([no])
4764     DO_FETCH_TARBALLS=
4766 AC_SUBST(DO_FETCH_TARBALLS)
4768 AC_MSG_CHECKING([whether to build help])
4769 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
4770     BUILD_TYPE="$BUILD_TYPE HELP"
4771     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
4772     case "$with_help" in
4773     "html")
4774         ENABLE_HTMLHELP=TRUE
4775         SCPDEFS="$SCPDEFS -DWITH_HELP"
4776         AC_MSG_RESULT([HTML])
4777         ;;
4778     "online")
4779         ENABLE_HTMLHELP=TRUE
4780         HELP_ONLINE=TRUE
4781         AC_MSG_RESULT([HTML])
4782         ;;
4783     yes)
4784         SCPDEFS="$SCPDEFS -DWITH_HELP"
4785         AC_MSG_RESULT([yes])
4786         ;;
4787     *)
4788         AC_MSG_ERROR([Unknown --with-help=$with_help])
4789         ;;
4790     esac
4791 else
4792     AC_MSG_RESULT([no])
4794 AC_SUBST([ENABLE_HTMLHELP])
4795 AC_SUBST([HELP_ONLINE])
4797 dnl Test whether to include MySpell dictionaries
4798 dnl ===================================================================
4799 AC_MSG_CHECKING([whether to include MySpell dictionaries])
4800 if test "$with_myspell_dicts" = "yes"; then
4801     AC_MSG_RESULT([yes])
4802     WITH_MYSPELL_DICTS=TRUE
4803     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
4804     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
4805 else
4806     AC_MSG_RESULT([no])
4807     WITH_MYSPELL_DICTS=
4809 AC_SUBST(WITH_MYSPELL_DICTS)
4811 # There are no "system" myspell, hyphen or mythes dictionaries on OS X, Windows, Android or iOS.
4812 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
4813     if test "$with_system_dicts" = yes; then
4814         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
4815     fi
4816     with_system_dicts=no
4819 AC_MSG_CHECKING([whether to use dicts from external paths])
4820 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
4821     AC_MSG_RESULT([yes])
4822     SYSTEM_DICTS=TRUE
4823     AC_MSG_CHECKING([for spelling dictionary directory])
4824     if test -n "$with_external_dict_dir"; then
4825         DICT_SYSTEM_DIR=file://$with_external_dict_dir
4826     else
4827         DICT_SYSTEM_DIR=file:///usr/share/hunspell
4828         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
4829             DICT_SYSTEM_DIR=file:///usr/share/myspell
4830         fi
4831     fi
4832     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
4833     AC_MSG_CHECKING([for hyphenation patterns directory])
4834     if test -n "$with_external_hyph_dir"; then
4835         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
4836     else
4837         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
4838     fi
4839     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
4840     AC_MSG_CHECKING([for thesaurus directory])
4841     if test -n "$with_external_thes_dir"; then
4842         THES_SYSTEM_DIR=file://$with_external_thes_dir
4843     else
4844         THES_SYSTEM_DIR=file:///usr/share/mythes
4845     fi
4846     AC_MSG_RESULT([$THES_SYSTEM_DIR])
4847 else
4848     AC_MSG_RESULT([no])
4849     SYSTEM_DICTS=
4851 AC_SUBST(SYSTEM_DICTS)
4852 AC_SUBST(DICT_SYSTEM_DIR)
4853 AC_SUBST(HYPH_SYSTEM_DIR)
4854 AC_SUBST(THES_SYSTEM_DIR)
4856 dnl ===================================================================
4857 dnl enable pch by default on windows
4858 dnl enable it explicitly otherwise
4859 ENABLE_PCH=""
4860 if test "$enable_pch" = yes -a "$enable_compiler_plugins" = yes; then
4861     if test -z "$libo_fuzzed_enable_pch"; then
4862         AC_MSG_ERROR([--enable-pch cannot be used with --enable-compiler-plugins])
4863     else
4864         AC_MSG_NOTICE([Resetting --enable-pch=no])
4865         enable_pch=no
4866     fi
4869 AC_MSG_CHECKING([whether to enable pch feature])
4870 if test "$enable_pch" != "no"; then
4871     if test "$_os" = "WINNT"; then
4872         ENABLE_PCH="TRUE"
4873         AC_MSG_RESULT([yes])
4874     elif test -n "$enable_pch" && test "$GCC" = "yes"; then
4875         ENABLE_PCH="TRUE"
4876         AC_MSG_RESULT([yes])
4877     elif test -n "$enable_pch"; then
4878         AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
4879     else
4880         AC_MSG_RESULT([no])
4881     fi
4882 else
4883     AC_MSG_RESULT([no])
4885 AC_SUBST(ENABLE_PCH)
4887 TAB=`printf '\t'`
4889 AC_MSG_CHECKING([the GNU Make version])
4890 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
4891 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
4892 if test "$_make_longver" -ge "038200"; then
4893     AC_MSG_RESULT([$GNUMAKE $_make_version])
4895 elif test "$_make_longver" -ge "038100"; then
4896     if test "$build_os" = "cygwin"; then
4897         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
4898     fi
4899     AC_MSG_RESULT([$GNUMAKE $_make_version])
4901     dnl ===================================================================
4902     dnl Search all the common names for sha1sum
4903     dnl ===================================================================
4904     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
4905     if test -z "$SHA1SUM"; then
4906         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
4907     elif test "$SHA1SUM" = "openssl"; then
4908         SHA1SUM="openssl sha1"
4909     fi
4910     AC_MSG_CHECKING([for GNU Make bug 20033])
4911     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
4912     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
4913 A := \$(wildcard *.a)
4915 .PHONY: all
4916 all: \$(A:.a=.b)
4917 <TAB>@echo survived bug20033.
4919 .PHONY: setup
4920 setup:
4921 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
4923 define d1
4924 @echo lala \$(1)
4925 @sleep 1
4926 endef
4928 define d2
4929 @echo tyty \$(1)
4930 @sleep 1
4931 endef
4933 %.b : %.a
4934 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
4935 <TAB>\$(call d1,\$(CHECKSUM)),\
4936 <TAB>\$(call d2,\$(CHECKSUM)))
4938     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
4939         no_parallelism_make="YES"
4940         AC_MSG_RESULT([yes, disable parallelism])
4941     else
4942         AC_MSG_RESULT([no, keep parallelism enabled])
4943     fi
4944     rm -rf $TESTGMAKEBUG20033
4945 else
4946     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
4949 # find if gnumake support file function
4950 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
4951 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
4952 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4953     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
4955 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
4956 \$(file >test.txt,Success )
4958 .PHONY: all
4959 all:
4960 <TAB>@cat test.txt
4963 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
4964 if test -f $TESTGMAKEFILEFUNC/test.txt; then
4965     HAVE_GNUMAKE_FILE_FUNC=TRUE
4966     AC_MSG_RESULT([yes])
4967 else
4968     AC_MSG_RESULT([no])
4970 rm -rf $TESTGMAKEFILEFUNC
4971 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
4972 AC_SUBST(GNUMAKE_WIN_NATIVE)
4974 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
4975 STALE_MAKE=
4976 if test "$_make_ver_check" = ""; then
4977    STALE_MAKE=TRUE
4980 HAVE_LD_HASH_STYLE=FALSE
4981 WITH_LINKER_HASH_STYLE=
4982 AC_MSG_CHECKING([for --hash-style gcc linker support])
4983 if test "$GCC" = "yes"; then
4984     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
4985         hash_styles="gnu sysv"
4986     elif test "$with_linker_hash_style" = "no"; then
4987         hash_styles=
4988     else
4989         hash_styles="$with_linker_hash_style"
4990     fi
4992     for hash_style in $hash_styles; do
4993         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
4994         hash_style_ldflags_save=$LDFLAGS
4995         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
4997         AC_RUN_IFELSE([AC_LANG_PROGRAM(
4998             [
4999 #include <stdio.h>
5000             ],[
5001 printf ("");
5002             ])],
5003             [
5004                   HAVE_LD_HASH_STYLE=TRUE
5005                   WITH_LINKER_HASH_STYLE=$hash_style
5006             ],
5007             [HAVE_LD_HASH_STYLE=FALSE],
5008             [HAVE_LD_HASH_STYLE=FALSE])
5009         LDFLAGS=$hash_style_ldflags_save
5010     done
5012     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5013         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5014     else
5015         AC_MSG_RESULT( no )
5016     fi
5017     LDFLAGS=$hash_style_ldflags_save
5018 else
5019     AC_MSG_RESULT( no )
5021 AC_SUBST(HAVE_LD_HASH_STYLE)
5022 AC_SUBST(WITH_LINKER_HASH_STYLE)
5024 dnl ===================================================================
5025 dnl Check whether there's a Perl version available.
5026 dnl ===================================================================
5027 if test -z "$with_perl_home"; then
5028     AC_PATH_PROG(PERL, perl)
5029 else
5030     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5031     _perl_path="$with_perl_home/bin/perl"
5032     if test -x "$_perl_path"; then
5033         PERL=$_perl_path
5034     else
5035         AC_MSG_ERROR([$_perl_path not found])
5036     fi
5039 dnl ===================================================================
5040 dnl Testing for Perl version 5 or greater.
5041 dnl $] is the Perl version variable, it is returned as an integer
5042 dnl ===================================================================
5043 if test "$PERL"; then
5044     AC_MSG_CHECKING([the Perl version])
5045     ${PERL} -e "exit($]);"
5046     _perl_version=$?
5047     if test "$_perl_version" -lt 5; then
5048         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5049     fi
5050     AC_MSG_RESULT([Perl $_perl_version])
5051 else
5052     AC_MSG_ERROR([Perl not found, install Perl 5])
5055 dnl ===================================================================
5056 dnl Testing for required Perl modules
5057 dnl ===================================================================
5059 AC_MSG_CHECKING([for required Perl modules])
5060 perl_use_string="use Cwd ; use Digest::MD5"
5061 if test "$_os" = "WINNT"; then
5062     if test -n "$PKGFORMAT"; then
5063         for i in $PKGFORMAT; do
5064             case "$i" in
5065             msi)
5066                 # for getting fonts versions to use in MSI
5067                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5068                 ;;
5069             esac
5070         done
5071     fi
5073 if test "$with_system_hsqldb" = "yes"; then
5074         perl_use_string="$perl_use_string ; use Archive::Zip"
5076 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5077     AC_MSG_RESULT([all modules found])
5078 else
5079     AC_MSG_RESULT([failed to find some modules])
5080     # Find out which modules are missing.
5081     for i in $perl_use_string; do
5082         if test "$i" != "use" -a "$i" != ";"; then
5083             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5084                 missing_perl_modules="$missing_perl_modules $i"
5085             fi
5086         fi
5087     done
5088     AC_MSG_ERROR([
5089     The missing Perl modules are: $missing_perl_modules
5090     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5093 dnl ===================================================================
5094 dnl Check for pkg-config
5095 dnl ===================================================================
5096 if test "$_os" != "WINNT"; then
5097     PKG_PROG_PKG_CONFIG
5100 if test "$_os" != "WINNT"; then
5102     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5103     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5104     # explicitly. Or put /path/to/compiler in PATH yourself.
5106     # Use wrappers for LTO
5107     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5108         AC_CHECK_TOOL(AR,gcc-ar)
5109         AC_CHECK_TOOL(NM,gcc-nm)
5110         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5111     else
5112         AC_CHECK_TOOL(AR,ar)
5113         AC_CHECK_TOOL(NM,nm)
5114         AC_CHECK_TOOL(RANLIB,ranlib)
5115     fi
5116     AC_CHECK_TOOL(OBJDUMP,objdump)
5117     AC_CHECK_TOOL(READELF,readelf)
5118     AC_CHECK_TOOL(STRIP,strip)
5119     if test "$_os" = "WINNT"; then
5120         AC_CHECK_TOOL(DLLTOOL,dlltool)
5121         AC_CHECK_TOOL(WINDRES,windres)
5122     fi
5124 AC_SUBST(AR)
5125 AC_SUBST(DLLTOOL)
5126 AC_SUBST(NM)
5127 AC_SUBST(OBJDUMP)
5128 AC_SUBST(PKG_CONFIG)
5129 AC_SUBST(RANLIB)
5130 AC_SUBST(READELF)
5131 AC_SUBST(STRIP)
5132 AC_SUBST(WINDRES)
5134 dnl ===================================================================
5135 dnl pkg-config checks on Mac OS X
5136 dnl ===================================================================
5138 if test $_os = Darwin; then
5139     AC_MSG_CHECKING([for bogus pkg-config])
5140     if test -n "$PKG_CONFIG"; then
5141         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5142             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5143         else
5144             if test "$enable_bogus_pkg_config" = "yes"; then
5145                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5146             else
5147                 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.])
5148             fi
5149         fi
5150     else
5151         AC_MSG_RESULT([no, good])
5152     fi
5155 find_csc()
5157     # Return value: $csctest
5159     unset csctest
5161     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5162     if test -n "$regvalue"; then
5163         csctest=$regvalue
5164         return
5165     fi
5168 find_al()
5170     # Return value: $altest
5172     unset altest
5174     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5175         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5176         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5177             altest=$regvalue
5178             return
5179         fi
5180     done
5182     # We need this additional check to detect 4.6.1 or above.
5183     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5184         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5185         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5186             altest=$regvalue
5187             return
5188         fi
5190         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools"
5191         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5192             altest=$regvalue
5193             return
5194         fi
5195     done
5198 find_dotnetsdk46()
5200     unset frametest
5202     for ver in 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5203         reg_get_value_64 "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5204         if test -n "$regvalue"; then
5205             frametest=$regvalue
5206             return
5207         fi
5208         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5209         if test -n "$regvalue"; then
5210             frametest=$regvalue
5211             return
5212         fi
5213     done
5216 find_winsdk_version()
5218     # Args: $1 : SDK version as in "6.0A", "7.0" etc
5219     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5221     unset winsdktest winsdkbinsubdir winsdklibsubdir
5223     case "$1" in
5224     7.*)
5225         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5226         if test -n "$regvalue"; then
5227             winsdktest=$regvalue
5228             winsdklibsubdir=.
5229             return
5230         fi
5231         ;;
5232     8.0|8.0A)
5233         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5234         if test -n "$regvalue"; then
5235             winsdktest=$regvalue
5236             winsdklibsubdir=win8
5237             return
5238         fi
5239         ;;
5240     8.1|8.1A)
5241         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5242         if test -n "$regvalue"; then
5243             winsdktest=$regvalue
5244             winsdklibsubdir=winv6.3
5245             return
5246         fi
5247         ;;
5248     10.0)
5249         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5250         if test -n "$regvalue"; then
5251             winsdktest=$regvalue
5252             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5253             if test -n "$regvalue"; then
5254                 winsdkbinsubdir="$regvalue".0
5255             fi
5256             winsdklibsubdir=$regvalue
5257             if test "$regvalue" = "10.0.14393"; then
5258                 winsdklibsubdir="10.0.14393.0"
5259             elif test "$regvalue" = "10.0.16299"; then
5260                 winsdklibsubdir="10.0.16299.0"
5261             elif test "$regvalue" = "10.0.15063"; then
5262                 winsdklibsubdir="10.0.15063.0"
5263             elif test "$regvalue" = "10.0.17134"; then
5264                 winsdklibsubdir="$regvalue.0"
5265             fi
5266             return
5267         fi
5268         ;;
5269     esac
5272 find_winsdk()
5274     # Return value: From find_winsdk_version
5276     unset winsdktest
5278     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5279         find_winsdk_version $ver
5280         if test -n "$winsdktest"; then
5281             return
5282         fi
5283     done
5286 find_msms()
5288     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5289     if test $VCVER = 150; then
5290         my_msm_files="Microsoft_VC141_CRT_x86.msm ${my_msm_files}"
5291     fi
5292     AC_MSG_CHECKING([for ${my_msm_files}])
5293     msmdir=
5294     for ver in 14.0 15.0; do
5295         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5296         if test -n "$regvalue"; then
5297             for f in ${my_msm_files}; do
5298                 if test -e "$regvalue/${f}"; then
5299                     msmdir=$regvalue
5300                     break
5301                 fi
5302             done
5303         fi
5304     done
5305     dnl Is the following fallback really necessary, or was it added in response
5306     dnl to never having started Visual Studio on a given machine, so the
5307     dnl registry keys checked above had presumably not yet been created?
5308     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5309     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5310     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5311     dnl expanding to "C:\Program Files\Common Files"), which would need
5312     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5313     dnl obtain its value from cygwin:
5314     if test -z "$msmdir"; then
5315         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5316         for f in ${my_msm_files}; do
5317             if test -e "$my_msm_dir/${f}"; then
5318                 msmdir=$my_msm_dir
5319             fi
5320         done
5321     fi
5323     dnl Starting from MSVC 15.0, merge modules are located in different directory
5324     if test $VCVER = 150; then
5325         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5326             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])
5327             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5328             for f in ${my_msm_files}; do
5329                 if test -e "$my_msm_dir/${f}"; then
5330                     msmdir=$my_msm_dir
5331                     break
5332                 fi
5333             done
5334         done
5335     fi
5337     if test -n "$msmdir"; then
5338         msmdir=`cygpath -m "$msmdir"`
5339         AC_MSG_RESULT([$msmdir])
5340     else
5341         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5342             AC_MSG_ERROR([not found])
5343         else
5344             AC_MSG_WARN([not found])
5345             add_warning "MSM none of ${my_msm_files} found"
5346         fi
5347     fi
5350 find_msvc_x64_dlls()
5352     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5353     if test "$VCVER" = 150; then
5354         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5355             AC_MSG_CHECKING([for $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT])
5356             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5357                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5358                 break
5359             fi
5360             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5361                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5362                 break
5363             fi
5364         done
5365     fi
5366     msvcdlls="msvcp140.dll vcruntime140.dll"
5367     for dll in $msvcdlls; do
5368         if ! test -f "$msvcdllpath/$dll"; then
5369             AC_MSG_ERROR([can not find $dll in $msvcdllpath])
5370         fi
5371     done
5374 dnl =========================================
5375 dnl Check for the Windows  SDK.
5376 dnl =========================================
5377 if test "$_os" = "WINNT"; then
5378     AC_MSG_CHECKING([for Windows SDK])
5379     if test "$build_os" = "cygwin"; then
5380         find_winsdk
5381         WINDOWS_SDK_HOME=$winsdktest
5383         # normalize if found
5384         if test -n "$WINDOWS_SDK_HOME"; then
5385             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5386             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5387         fi
5389         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5390     fi
5392     if test -n "$WINDOWS_SDK_HOME"; then
5393         # Remove a possible trailing backslash
5394         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5396         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5397              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5398              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5399             have_windows_sdk_headers=yes
5400         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5401              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5402              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5403             have_windows_sdk_headers=yes
5404         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5405              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5406              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5407             have_windows_sdk_headers=yes
5408         else
5409             have_windows_sdk_headers=no
5410         fi
5412         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5413             have_windows_sdk_libs=yes
5414         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5415             have_windows_sdk_libs=yes
5416         else
5417             have_windows_sdk_libs=no
5418         fi
5420         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5421             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5422 the  Windows SDK are installed.])
5423         fi
5424     fi
5426     if test -z "$WINDOWS_SDK_HOME"; then
5427         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5428     elif echo $WINDOWS_SDK_HOME | grep "v7.1" >/dev/null 2>/dev/null; then
5429         WINDOWS_SDK_VERSION=70
5430         AC_MSG_RESULT([found Windows SDK 7 ($WINDOWS_SDK_HOME)])
5431     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5432         WINDOWS_SDK_VERSION=80
5433         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5434     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5435         WINDOWS_SDK_VERSION=81
5436         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5437     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5438         WINDOWS_SDK_VERSION=10
5439         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5440     else
5441         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5442     fi
5443     PathFormat "$WINDOWS_SDK_HOME"
5444     WINDOWS_SDK_HOME="$formatted_path"
5445     if test "$build_os" = "cygwin"; then
5446         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5447         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5448             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5449         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5450             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5451         fi
5452     fi
5454     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5455     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5456     dnl but not in v8.0), so allow this to be overridden with a
5457     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5458     dnl and configuration error if no WiLangId.vbs is found would arguably be
5459     dnl better, but I do not know under which conditions exactly it is needed by
5460     dnl msiglobal.pm:
5461     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5462         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5463         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5464             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5465         fi
5466         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5467             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5468         fi
5469         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5470             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5471         fi
5472     fi
5473     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5474         if test -n "$with_package_format" -a "$with_package_format" != no; then
5475             for i in "$with_package_format"; do
5476                 if test "$i" = "msi"; then
5477                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5478                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5479                     fi
5480                 fi
5481             done
5482         fi
5483     fi
5485 AC_SUBST(WINDOWS_SDK_HOME)
5486 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5487 AC_SUBST(WINDOWS_SDK_VERSION)
5488 AC_SUBST(WINDOWS_SDK_WILANGID)
5490 if test "$build_os" = "cygwin"; then
5491     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5492     dnl dir, it also determines that dir's path w/o an arch segment if any,
5493     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5494     AC_MSG_CHECKING([for midl.exe])
5496     find_winsdk
5497     if test -n "$winsdkbinsubdir" \
5498         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5499     then
5500         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5501         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5502     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5503         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5504         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5505     elif test -f "$winsdktest/Bin/midl.exe"; then
5506         MIDL_PATH=$winsdktest/Bin
5507         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5508     fi
5509     if test ! -f "$MIDL_PATH/midl.exe"; then
5510         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5511     else
5512         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5513     fi
5515     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5516     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5518     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5519          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5520          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5521          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5522     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5523          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5524          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5525          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5526     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5527          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5528          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5529          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5530     else
5531         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5532     fi
5534     dnl Check csc.exe
5535     AC_MSG_CHECKING([for csc.exe])
5536     find_csc
5537     if test -f "$csctest/csc.exe"; then
5538         CSC_PATH="$csctest"
5539     fi
5540     if test ! -f "$CSC_PATH/csc.exe"; then
5541         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5542     else
5543         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5544     fi
5546     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5548     dnl Check al.exe
5549     AC_MSG_CHECKING([for al.exe])
5550     find_winsdk
5551     if test -n "$winsdkbinsubdir" \
5552         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5553     then
5554         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5555     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5556         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5557     elif test -f "$winsdktest/Bin/al.exe"; then
5558         AL_PATH="$winsdktest/Bin"
5559     fi
5561     if test -z "$AL_PATH"; then
5562         find_al
5563         if test -f "$altest/bin/al.exe"; then
5564             AL_PATH="$altest/bin"
5565         elif test -f "$altest/al.exe"; then
5566             AL_PATH="$altest"
5567         fi
5568     fi
5569     if test ! -f "$AL_PATH/al.exe"; then
5570         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5571     else
5572         AC_MSG_RESULT([$AL_PATH/al.exe])
5573     fi
5575     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5577     dnl Check mscoree.lib / .NET Framework dir
5578     AC_MSG_CHECKING(.NET Framework)
5579     find_dotnetsdk46
5580     PathFormat "$frametest"
5581     frametest="$formatted_path"
5582     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5583         DOTNET_FRAMEWORK_HOME="$frametest"
5584     else
5585         find_winsdk
5586         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5587             DOTNET_FRAMEWORK_HOME="$winsdktest"
5588         fi
5589     fi
5590     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
5591         AC_MSG_ERROR([mscoree.lib not found])
5592     fi
5593     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5595     PathFormat "$MIDL_PATH"
5596     MIDL_PATH="$formatted_path"
5598     PathFormat "$AL_PATH"
5599     AL_PATH="$formatted_path"
5601     PathFormat "$DOTNET_FRAMEWORK_HOME"
5602     DOTNET_FRAMEWORK_HOME="$formatted_path"
5604     PathFormat "$CSC_PATH"
5605     CSC_PATH="$formatted_path"
5608 dnl ===================================================================
5609 dnl Check if stdc headers are available excluding MSVC.
5610 dnl ===================================================================
5611 if test "$_os" != "WINNT"; then
5612     AC_HEADER_STDC
5615 dnl ===================================================================
5616 dnl Testing for C++ compiler and version...
5617 dnl ===================================================================
5619 if test "$_os" != "WINNT"; then
5620     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5621     save_CXXFLAGS=$CXXFLAGS
5622     AC_PROG_CXX
5623     CXXFLAGS=$save_CXXFLAGS
5624 else
5625     if test -n "$CC" -a -z "$CXX"; then
5626         CXX="$CC"
5627     fi
5630 dnl check for GNU C++ compiler version
5631 if test "$GXX" = "yes"; then
5632     AC_MSG_CHECKING([the GNU C++ compiler version])
5634     _gpp_version=`$CXX -dumpversion`
5635     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5637     if test "$_gpp_majmin" -lt "401"; then
5638         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 4.1 to build LibreOffice, you have $_gpp_version.])
5639     else
5640         AC_MSG_RESULT([checked (g++ $_gpp_version)])
5641     fi
5643     dnl see https://code.google.com/p/android/issues/detail?id=41770
5644     if test "$_gpp_majmin" -ge "401"; then
5645         glibcxx_threads=no
5646         AC_LANG_PUSH([C++])
5647         AC_REQUIRE_CPP
5648         AC_MSG_CHECKING([whether $CXX is broken with boost.thread])
5649         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5650             #include <bits/c++config.h>]],[[
5651             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5652             && !defined(_GLIBCXX__PTHREADS) \
5653             && !defined(_GLIBCXX_HAS_GTHREADS)
5654             choke me
5655             #endif
5656         ]])],[AC_MSG_RESULT([yes])
5657         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5658         AC_LANG_POP([C++])
5659         if test $glibcxx_threads = yes; then
5660             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5661         fi
5662      fi
5664 AC_SUBST(BOOST_CXXFLAGS)
5667 # prefx CXX with ccache if needed
5669 if test "$CCACHE" != ""; then
5670     AC_MSG_CHECKING([whether $CXX is already ccached])
5671     AC_LANG_PUSH([C++])
5672     save_CXXFLAGS=$CXXFLAGS
5673     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5674     dnl an empty program will do, we're checking the compiler flags
5675     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5676                       [use_ccache=yes], [use_ccache=no])
5677     if test $use_ccache = yes; then
5678         AC_MSG_RESULT([yes])
5679     else
5680         CXX="$CCACHE $CXX"
5681         AC_MSG_RESULT([no])
5682     fi
5683     CXXFLAGS=$save_CXXFLAGS
5684     AC_LANG_POP([C++])
5687 dnl ===================================================================
5688 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5689 dnl ===================================================================
5691 if test "$_os" != "WINNT"; then
5692     AC_PROG_CXXCPP
5694     dnl Check whether there's a C pre-processor.
5695     AC_PROG_CPP
5699 dnl ===================================================================
5700 dnl Find integral type sizes and alignments
5701 dnl ===================================================================
5703 if test "$_os" != "WINNT"; then
5705 if test "$_os" == "iOS"; then
5706     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5707     ac_cv_sizeof_long=8
5708     ac_cv_sizeof_short=2
5709     ac_cv_sizeof_int=4
5710     ac_cv_sizeof_long_long=8
5711     ac_cv_sizeof_double=8
5712     ac_cv_sizeof_voidp=8
5713 else
5714     AC_CHECK_SIZEOF(long)
5715     AC_CHECK_SIZEOF(short)
5716     AC_CHECK_SIZEOF(int)
5717     AC_CHECK_SIZEOF(long long)
5718     AC_CHECK_SIZEOF(double)
5719     AC_CHECK_SIZEOF(void*)
5722     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5723     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5724     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5725     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5726     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
5728     dnl Allow build without AC_CHECK_ALIGNOF, grrr
5729     m4_pattern_allow([AC_CHECK_ALIGNOF])
5730     m4_ifdef([AC_CHECK_ALIGNOF],
5731         [
5732             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
5733             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
5734             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
5735             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
5736         ],
5737         [
5738             case "$_os-$host_cpu" in
5739             Linux-i686)
5740                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5741                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5742                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
5743                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
5744                 ;;
5745             Linux-x86_64)
5746                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
5747                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
5748                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
5749                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
5750                 ;;
5751             *)
5752                 if test -z "$ac_cv_alignof_short" -o \
5753                         -z "$ac_cv_alignof_int" -o \
5754                         -z "$ac_cv_alignof_long" -o \
5755                         -z "$ac_cv_alignof_double"; then
5756                    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.])
5757                 fi
5758                 ;;
5759             esac
5760         ])
5762     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
5763     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
5764     if test $ac_cv_sizeof_long -eq 8; then
5765         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
5766     elif test $ac_cv_sizeof_double -eq 8; then
5767         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
5768     else
5769         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
5770     fi
5772     dnl Check for large file support
5773     AC_SYS_LARGEFILE
5774     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
5775         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
5776     fi
5777     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
5778         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
5779     fi
5780 else
5781     # Hardcode for MSVC
5782     SAL_TYPES_SIZEOFSHORT=2
5783     SAL_TYPES_SIZEOFINT=4
5784     SAL_TYPES_SIZEOFLONG=4
5785     SAL_TYPES_SIZEOFLONGLONG=8
5786     if test "$BITNESS_OVERRIDE" = ""; then
5787         SAL_TYPES_SIZEOFPOINTER=4
5788     else
5789         SAL_TYPES_SIZEOFPOINTER=8
5790     fi
5791     SAL_TYPES_ALIGNMENT2=2
5792     SAL_TYPES_ALIGNMENT4=4
5793     SAL_TYPES_ALIGNMENT8=8
5794     LFS_CFLAGS=''
5796 AC_SUBST(LFS_CFLAGS)
5798 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
5799 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
5800 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
5801 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
5802 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
5803 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
5804 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
5805 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
5807 dnl ===================================================================
5808 dnl Check whether to enable runtime optimizations
5809 dnl ===================================================================
5810 ENABLE_RUNTIME_OPTIMIZATIONS=
5811 AC_MSG_CHECKING([whether to enable runtime optimizations])
5812 if test -z "$enable_runtime_optimizations"; then
5813     for i in $CC; do
5814         case $i in
5815         -fsanitize=*)
5816             enable_runtime_optimizations=no
5817             break
5818             ;;
5819         esac
5820     done
5822 if test "$enable_runtime_optimizations" != no; then
5823     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
5824     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
5825     AC_MSG_RESULT([yes])
5826 else
5827     AC_MSG_RESULT([no])
5829 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
5831 dnl ===================================================================
5832 dnl Check if valgrind headers are available
5833 dnl ===================================================================
5834 ENABLE_VALGRIND=
5835 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
5836     prev_cppflags=$CPPFLAGS
5837     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
5838     # or where does it come from?
5839     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
5840     AC_CHECK_HEADER([valgrind/valgrind.h],
5841         [ENABLE_VALGRIND=TRUE])
5842     CPPFLAGS=$prev_cppflags
5844 AC_SUBST([ENABLE_VALGRIND])
5845 if test -z "$ENABLE_VALGRIND"; then
5846     if test "$with_valgrind" = yes; then
5847         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
5848     fi
5849     VALGRIND_CFLAGS=
5851 AC_SUBST([VALGRIND_CFLAGS])
5854 dnl ===================================================================
5855 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
5856 dnl ===================================================================
5858 # We need at least the sys/sdt.h include header.
5859 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
5860 if test "$SDT_H_FOUND" = "TRUE"; then
5861     # Found sys/sdt.h header, now make sure the c++ compiler works.
5862     # Old g++ versions had problems with probes in constructors/destructors.
5863     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
5864     AC_LANG_PUSH([C++])
5865     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5866     #include <sys/sdt.h>
5867     class ProbeClass
5868     {
5869     private:
5870       int& ref;
5871       const char *name;
5873     public:
5874       ProbeClass(int& v, const char *n) : ref(v), name(n)
5875       {
5876         DTRACE_PROBE2(_test_, cons, name, ref);
5877       }
5879       void method(int min)
5880       {
5881         DTRACE_PROBE3(_test_, meth, name, ref, min);
5882         ref -= min;
5883       }
5885       ~ProbeClass()
5886       {
5887         DTRACE_PROBE2(_test_, dest, name, ref);
5888       }
5889     };
5890     ]],[[
5891     int i = 64;
5892     DTRACE_PROBE1(_test_, call, i);
5893     ProbeClass inst = ProbeClass(i, "call");
5894     inst.method(24);
5895     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
5896           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
5897     AC_LANG_POP([C++])
5899 AC_CONFIG_HEADERS([config_host/config_probes.h])
5901 dnl ===================================================================
5902 dnl GCC features
5903 dnl ===================================================================
5904 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
5905     AC_MSG_CHECKING([whether $CC supports -mno-avx])
5906     save_CFLAGS=$CFLAGS
5907     CFLAGS="$CFLAGS -Werror -mno-avx"
5908     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
5909     CFLAGS=$save_CFLAGS
5910     if test "$HAVE_GCC_AVX" = "TRUE"; then
5911         AC_MSG_RESULT([yes])
5912     else
5913         AC_MSG_RESULT([no])
5914     fi
5916     AC_MSG_CHECKING([whether $CC supports -fstack-protector-strong])
5917     save_CFLAGS=$CFLAGS
5918     CFLAGS="$CFLAGS -Werror -fstack-protector-strong"
5919     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; return 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
5920     CFLAGS=$save_CFLAGS
5921     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
5922         AC_MSG_RESULT([yes])
5923     else
5924         AC_MSG_RESULT([no])
5925     fi
5927     AC_MSG_CHECKING([whether $CC supports atomic functions])
5928     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5929     int v = 0;
5930     if (__sync_add_and_fetch(&v, 1) != 1 ||
5931         __sync_sub_and_fetch(&v, 1) != 0)
5932         return 1;
5933     __sync_synchronize();
5934     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
5935         v != 1)
5936         return 1;
5937     return 0;
5938 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
5939     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
5940         AC_MSG_RESULT([yes])
5941         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
5942     else
5943         AC_MSG_RESULT([no])
5944     fi
5946     AC_MSG_CHECKING([whether $CC supports __builtin_ffs])
5947     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
5948     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
5949         AC_MSG_RESULT([yes])
5950         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
5951     else
5952         AC_MSG_RESULT([no])
5953     fi
5955     AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
5956     save_CFLAGS=$CFLAGS
5957     CFLAGS="$CFLAGS -Werror"
5958     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5959             __attribute__((deprecated("test"))) void f();
5960         ])], [
5961             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
5962             AC_MSG_RESULT([yes])
5963         ], [AC_MSG_RESULT([no])])
5964     CFLAGS=$save_CFLAGS
5966     AC_MSG_CHECKING([whether $CXX defines __base_class_type_info in cxxabi.h])
5967     AC_LANG_PUSH([C++])
5968     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5969             #include <cstddef>
5970             #include <cxxabi.h>
5971             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
5972         ])], [
5973             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
5974             AC_MSG_RESULT([yes])
5975         ], [AC_MSG_RESULT([no])])
5976     AC_LANG_POP([C++])
5978     AC_MSG_CHECKING([whether $CXX defines __class_type_info in cxxabi.h])
5979     AC_LANG_PUSH([C++])
5980     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5981             #include <cstddef>
5982             #include <cxxabi.h>
5983             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
5984         ])], [
5985             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
5986             AC_MSG_RESULT([yes])
5987         ], [AC_MSG_RESULT([no])])
5988     AC_LANG_POP([C++])
5990     AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
5991     AC_LANG_PUSH([C++])
5992     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5993             #include <cxxabi.h>
5994             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
5995         ])], [
5996             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
5997             AC_MSG_RESULT([yes])
5998         ], [AC_MSG_RESULT([no])])
5999     AC_LANG_POP([C++])
6001     AC_MSG_CHECKING([whether $CXX defines __cxa_eh_globals in cxxabi.h])
6002     AC_LANG_PUSH([C++])
6003     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6004             #include <cstddef>
6005             #include <cxxabi.h>
6006             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6007         ])], [
6008             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6009             AC_MSG_RESULT([yes])
6010         ], [AC_MSG_RESULT([no])])
6011     AC_LANG_POP([C++])
6013     AC_MSG_CHECKING([whether $CXX defines __cxa_exceptions in cxxabi.h])
6014     AC_LANG_PUSH([C++])
6015     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6016             #include <cstddef>
6017             #include <cxxabi.h>
6018             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6019         ])], [
6020             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6021             AC_MSG_RESULT([yes])
6022         ], [AC_MSG_RESULT([no])])
6023     AC_LANG_POP([C++])
6025     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
6026     AC_LANG_PUSH([C++])
6027     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6028             #include <cxxabi.h>
6029             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6030         ])], [
6031             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6032             AC_MSG_RESULT([yes])
6033         ], [AC_MSG_RESULT([no])])
6034     AC_LANG_POP([C++])
6036     AC_MSG_CHECKING([whether $CXX declares __cxa_current_exception_type in cxxabi.h])
6037     AC_LANG_PUSH([C++])
6038     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6039             #include <cxxabi.h>
6040             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6041         ])], [
6042             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6043             AC_MSG_RESULT([yes])
6044         ], [AC_MSG_RESULT([no])])
6045     AC_LANG_POP([C++])
6047     AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
6048     AC_LANG_PUSH([C++])
6049     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6050             #include <cxxabi.h>
6051             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6052         ])], [
6053             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6054             AC_MSG_RESULT([yes])
6055         ], [AC_MSG_RESULT([no])])
6056     AC_LANG_POP([C++])
6058     AC_MSG_CHECKING([whether $CXX defines __si_class_type_info in cxxabi.h])
6059     AC_LANG_PUSH([C++])
6060     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6061             #include <cstddef>
6062             #include <cxxabi.h>
6063             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6064         ])], [
6065             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6066             AC_MSG_RESULT([yes])
6067         ], [AC_MSG_RESULT([no])])
6068     AC_LANG_POP([C++])
6070     AC_MSG_CHECKING([whether $CXX defines __vmi_class_type_info in cxxabi.h])
6071     AC_LANG_PUSH([C++])
6072     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6073             #include <cstddef>
6074             #include <cxxabi.h>
6075             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6076         ])], [
6077             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6078             AC_MSG_RESULT([yes])
6079         ], [AC_MSG_RESULT([no])])
6080     AC_LANG_POP([C++])
6082     dnl Available in GCC 4.9 and at least since Clang 3.4:
6083     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
6084     AC_LANG_PUSH([C++])
6085     save_CXXFLAGS=$CXXFLAGS
6086     CXXFLAGS="$CXXFLAGS -Werror"
6087     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6088             struct __attribute__((warn_unused)) dummy {};
6089         ])], [
6090             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6091             AC_MSG_RESULT([yes])
6092         ], [AC_MSG_RESULT([no])])
6093     CXXFLAGS=$save_CXXFLAGS
6094 AC_LANG_POP([C++])
6097 AC_SUBST(HAVE_GCC_AVX)
6098 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6099 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6100 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6102 dnl ===================================================================
6103 dnl Identify the C++ library
6104 dnl ===================================================================
6106 AC_MSG_CHECKING([what the C++ library is])
6107 AC_LANG_PUSH([C++])
6108 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6109 #include <utility>
6110 #ifndef __GLIBCXX__
6111 foo bar
6112 #endif
6113 ]])],
6114     [CPP_LIBRARY=GLIBCXX
6115      cpp_library_name="GNU libstdc++"
6116     ],
6117     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6118 #include <utility>
6119 #ifndef _LIBCPP_VERSION
6120 foo bar
6121 #endif
6122 ]])],
6123     [CPP_LIBRARY=LIBCPP
6124      cpp_library_name="LLVM libc++"
6125      AC_DEFINE([HAVE_LIBCXX])
6126     ],
6127     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6128 #include <utility>
6129 #ifndef _MSC_VER
6130 foo bar
6131 #endif
6132 ]])],
6133     [CPP_LIBRARY=MSVCRT
6134      cpp_library_name="Microsoft"
6135     ],
6136     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6137 AC_MSG_RESULT([$cpp_library_name])
6138 AC_LANG_POP([C++])
6140 dnl ===================================================================
6141 dnl Check for gperf
6142 dnl ===================================================================
6143 AC_PATH_PROG(GPERF, gperf)
6144 if test -z "$GPERF"; then
6145     AC_MSG_ERROR([gperf not found but needed. Install it.])
6147 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6148     GPERF=`cygpath -m $GPERF`
6150 AC_MSG_CHECKING([gperf version])
6151 if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
6152     AC_MSG_RESULT([OK])
6153 else
6154     AC_MSG_ERROR([too old, you need at least 3.0.0])
6156 AC_SUBST(GPERF)
6158 dnl ===================================================================
6159 dnl Check for system libcmis
6160 dnl ===================================================================
6161 # libcmis requires curl and we can't build curl for iOS
6162 if test $_os != iOS; then
6163     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.0])
6164     ENABLE_LIBCMIS=TRUE
6165 else
6166     ENABLE_LIBCMIS=
6168 AC_SUBST(ENABLE_LIBCMIS)
6170 dnl ===================================================================
6171 dnl C++11
6172 dnl ===================================================================
6174 my_cxx17switches=
6175 libo_FUZZ_ARG_ENABLE(c++17,
6176     AS_HELP_STRING([--disable-c++17],
6177         [Do not attempt to run GCC/Clang in C++17 mode (needed for Coverity).])
6180 CXXFLAGS_CXX11=
6181 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6182     AC_MSG_CHECKING([whether $CXX supports C++11])
6183     AC_MSG_RESULT(yes)
6184     # MSVC supports (a subset of) CXX11 without any switch
6185 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6186     HAVE_CXX11=
6187     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
6188     dnl But only use C++17 if the gperf that is being used knows not to emit
6189     dnl "register" in C++ output:
6190     printf 'foo\n' | $GPERF -L C++ > conftest.inc
6191     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'
6192     if test "$enable_c__17" != no; then
6193         my_flags="-std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z $my_flags"
6194     fi
6195     for flag in $my_flags; do
6196         if test "$COM" = MSC; then
6197             flag="-Xclang $flag"
6198         fi
6199         save_CXXFLAGS=$CXXFLAGS
6200         CXXFLAGS="$CXXFLAGS $flag -Werror"
6201         if test "$SYSTEM_LIBCMIS" = TRUE; then
6202             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6203         fi
6204         AC_LANG_PUSH([C++])
6205         dnl Clang 3.9 supports __float128 since
6206         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6207         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6208         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6209         dnl $flag is supported below, so check this first):
6210         my_float128hack=
6211         my_float128hack_impl=-D__float128=void
6212         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6213             #include <vector>
6214             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6215             // (__float128)
6216             ]])
6217         ],,[
6218             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6219             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6220             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6221             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6222             dnl place where __float128 is used is in a template specialization, -D__float128=void
6223             dnl will avoid the problem there while still causing a problem if somebody actually uses
6224             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6225             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6226             dnl "fixed" with this hack):
6227             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6228             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6229                 #include <vector>
6230                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6231                 // (__float128)
6232                 ]])
6233             ],[my_float128hack=$my_float128hack_impl])
6234         ])
6235         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6236             #include <algorithm>
6237             #include <functional>
6238             #include <vector>
6240             #include <string.h>
6241             #pragma GCC diagnostic push
6242             #pragma GCC diagnostic ignored "-Wpragmas"
6243                 // make GCC not warn about next pragma
6244             #pragma GCC diagnostic ignored "-Wdeprecated-register"
6245                 // make Clang with -std < C++17 not even warn about register
6246             #include "conftest.inc"
6247             #pragma GCC diagnostic pop
6249             #if defined SYSTEM_LIBCMIS
6250             // See ucb/source/ucp/cmis/auth_provider.hxx:
6251             #if __GNUC__ >= 7
6252             #pragma GCC diagnostic push
6253             #pragma GCC diagnostic ignored "-Wdeprecated"
6254             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6255             #endif
6256             #include <libcmis/libcmis.hxx>
6257             #if __GNUC__ >= 7
6258             #pragma GCC diagnostic pop
6259             #endif
6260             #endif
6262             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6263                 std::sort(v.begin(), v.end(), fn);
6264             }
6265             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6266         AC_LANG_POP([C++])
6267         CXXFLAGS=$save_CXXFLAGS
6268         if test -n "$CXXFLAGS_CXX11"; then
6269             HAVE_CXX11=TRUE
6270             break
6271         fi
6272     done
6273     rm conftest.inc
6274     if test "$HAVE_CXX11" = TRUE; then
6275         AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6276     else
6277         AC_MSG_ERROR(no)
6278     fi
6280 AC_SUBST(CXXFLAGS_CXX11)
6282 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6283 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6284 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6285 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6286 dnl again towards 4.7.2:
6287 if test $CPP_LIBRARY = GLIBCXX; then
6288     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6289     AC_LANG_PUSH([C++])
6290     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6291 #include <list>
6292 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6293     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6294     //   GCC 4.7.0: 20120322
6295     //   GCC 4.7.1: 20120614
6296     // and using a range check is not possible as the mapping between
6297     // __GLIBCXX__ values and GCC versions is not monotonic
6298 /* ok */
6299 #else
6300 abi broken
6301 #endif
6302         ]])], [AC_MSG_RESULT(no, ok)],
6303         [AC_MSG_ERROR(yes)])
6304     AC_LANG_POP([C++])
6307 AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757])
6308 save_CXXFLAGS=$CXXFLAGS
6309 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6310 AC_LANG_PUSH([C++])
6312 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6313 #include <stddef.h>
6315 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6317 namespace
6319         struct b
6320         {
6321                 int i;
6322                 int j;
6323         };
6325 ]], [[
6326 struct a
6328         int i;
6329         int j;
6331 a thinga[]={{0,0}, {1,1}};
6332 b thingb[]={{0,0}, {1,1}};
6333 size_t i = sizeof(sal_n_array_size(thinga));
6334 size_t j = sizeof(sal_n_array_size(thingb));
6335 return !(i != 0 && j != 0);
6337     ], [ AC_MSG_RESULT(yes) ],
6338     [ AC_MSG_ERROR(no)])
6339 AC_LANG_POP([C++])
6340 CXXFLAGS=$save_CXXFLAGS
6342 AC_MSG_CHECKING([whether $CXX supports C++14 constexpr])
6343 save_CXXFLAGS=$CXXFLAGS
6344 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6345 AC_LANG_PUSH([C++])
6346 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6347     // A somewhat over-complicated way of checking for
6348     // <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66460> "ICE using __func__
6349     // in constexpr function":
6350     #include <cassert>
6351     template<typename T> inline constexpr T f(T x) { return x; }
6352     template<typename T> inline constexpr T g(T x) {
6353         assert(f(static_cast<int>(x)));
6354         return x;
6355     }
6356     enum E { e };
6357     auto v = g(E::e);
6359     struct S {
6360         int n_;
6361         constexpr bool f() {
6362             int n = n_;
6363             int i = 0;
6364             while (n > 0) { --n; ++i; }
6365             assert(i >= 0);
6366             return i == 0;
6367         }
6368     };
6369     constexpr auto v2 = S{10}.f();
6370     ]])], [cxx14_constexpr=yes], [cxx14_constexpr=no])
6371 AC_LANG_POP([C++])
6372 CXXFLAGS=$save_CXXFLAGS
6373 AC_MSG_RESULT([$cxx14_constexpr])
6374 if test "$cxx14_constexpr" = yes; then
6375     AC_DEFINE([HAVE_CXX14_CONSTEXPR])
6378 dnl _Pragma support (may require C++11)
6379 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6380     AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
6381     AC_LANG_PUSH([C++])
6382     save_CXXFLAGS=$CXXFLAGS
6383     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6384     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6385             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6386         ])], [
6387             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6388             AC_MSG_RESULT([yes])
6389         ], [AC_MSG_RESULT([no])])
6390     AC_LANG_POP([C++])
6391     CXXFLAGS=$save_CXXFLAGS
6394 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6395 if test "$GCC" = yes; then
6396     AC_MSG_CHECKING([whether $CXX supports -fno-sized-deallocation])
6397     AC_LANG_PUSH([C++])
6398     save_CXXFLAGS=$CXXFLAGS
6399     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6400     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6401     CXXFLAGS=$save_CXXFLAGS
6402     AC_LANG_POP([C++])
6403     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6404         AC_MSG_RESULT([yes])
6405     else
6406         AC_MSG_RESULT([no])
6407     fi
6409 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6411 AC_MSG_CHECKING([whether $CXX supports guaranteed copy elision])
6412 AC_LANG_PUSH([C++])
6413 save_CXXFLAGS=$CXXFLAGS
6414 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6415 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6416         #if !defined __cpp_guaranteed_copy_elision
6417         struct S {
6418         private:
6419             S(S const &);
6420         public:
6421             S copy() const { return *this; }
6422         };
6423         void f(S & s) { S c(s.copy()); }
6424         #endif
6425     ])], [
6426         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6427         AC_MSG_RESULT([yes])
6428     ], [AC_MSG_RESULT([no])])
6429 CXXFLAGS=$save_CXXFLAGS
6430 AC_LANG_POP([C++])
6432 AC_MSG_CHECKING([whether $CXX supports inline variables])
6433 AC_LANG_PUSH([C++])
6434 save_CXXFLAGS=$CXXFLAGS
6435 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6436 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6437         #if !defined __cpp_inline_variables
6438         // This tests for one specific aspect of inline variables that is actually used by
6439         // ORegistry::ROOT (registry/source/regimpl.cxx):
6440         struct S { constexpr S() {} };
6441         struct T { static constexpr S s{}; };
6442         S const * f() { return &T::s; }
6443         #endif
6444     ]])], [
6445         AC_DEFINE([HAVE_CPP_INLINE_VARIABLES],[1])
6446         AC_MSG_RESULT([yes])
6447     ], [AC_MSG_RESULT([no])])
6448 CXXFLAGS=$save_CXXFLAGS
6449 AC_LANG_POP([C++])
6451 AC_MSG_CHECKING([whether $CXX has a fix for CWG1579])
6452 AC_LANG_PUSH([C++])
6453 save_CXXFLAGS=$CXXFLAGS
6454 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6455 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6456         #include <memory>
6457         struct S1 {};
6458         struct S2: S1 {};
6459         std::unique_ptr<S1> f() {
6460             std::unique_ptr<S2> s2(new S2);
6461             return s2;
6462         }
6463     ])], [
6464         AC_DEFINE([HAVE_CXX_CWG1579_FIX],[1])
6465         AC_MSG_RESULT([yes])
6466     ], [AC_MSG_RESULT([no])])
6467 CXXFLAGS=$save_CXXFLAGS
6468 AC_LANG_POP([C++])
6470 AC_MSG_CHECKING([whether $CXX has GCC bug 87150])
6471 AC_LANG_PUSH([C++])
6472 save_CXXFLAGS=$CXXFLAGS
6473 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6474 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6475         struct S1 { S1(S1 &&); };
6476         struct S2: S1 {};
6477         S1 f(S2 s) { return s; }
6478     ])], [
6479         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6480         AC_MSG_RESULT([yes])
6481     ], [AC_MSG_RESULT([no])])
6482 CXXFLAGS=$save_CXXFLAGS
6483 AC_LANG_POP([C++])
6485 dnl ===================================================================
6486 dnl system stl sanity tests
6487 dnl ===================================================================
6488 if test "$_os" != "WINNT"; then
6490     AC_LANG_PUSH([C++])
6492     save_CPPFLAGS="$CPPFLAGS"
6493     if test -n "$MACOSX_SDK_PATH"; then
6494         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6495     fi
6497     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6498     # only.
6499     if test "$CPP_LIBRARY" = GLIBCXX; then
6500         dnl gcc#19664, gcc#22482, rhbz#162935
6501         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6502         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6503         AC_MSG_RESULT([$stlvisok])
6504         if test "$stlvisok" = "no"; then
6505             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6506         fi
6507     fi
6509     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6510     # when we don't make any dynamic libraries?
6511     if test "$DISABLE_DYNLOADING" = ""; then
6512         AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6513         cat > conftestlib1.cc <<_ACEOF
6514 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6515 struct S2: S1<int> { virtual ~S2(); };
6516 S2::~S2() {}
6517 _ACEOF
6518         cat > conftestlib2.cc <<_ACEOF
6519 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6520 struct S2: S1<int> { virtual ~S2(); };
6521 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6522 _ACEOF
6523         gccvisinlineshiddenok=yes
6524         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6525             gccvisinlineshiddenok=no
6526         else
6527             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6528             dnl known to not work with -z defs (unsetting which makes the test
6529             dnl moot, though):
6530             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6531             if test "$COM_IS_CLANG" = TRUE; then
6532                 for i in $CXX $CXXFLAGS; do
6533                     case $i in
6534                     -fsanitize=*)
6535                         my_linkflagsnoundefs=
6536                         break
6537                         ;;
6538                     esac
6539                 done
6540             fi
6541             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6542                 gccvisinlineshiddenok=no
6543             fi
6544         fi
6546         rm -fr libconftest*
6547         AC_MSG_RESULT([$gccvisinlineshiddenok])
6548         if test "$gccvisinlineshiddenok" = "no"; then
6549             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6550         fi
6551     fi
6553    AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
6554     cat >visibility.cxx <<_ACEOF
6555 #pragma GCC visibility push(hidden)
6556 struct __attribute__ ((visibility ("default"))) TestStruct {
6557   static void Init();
6559 __attribute__ ((visibility ("default"))) void TestFunc() {
6560   TestStruct::Init();
6562 _ACEOF
6563     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6564         gccvisbroken=yes
6565     else
6566         case "$host_cpu" in
6567         i?86|x86_64)
6568             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6569                 gccvisbroken=no
6570             else
6571                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6572                     gccvisbroken=no
6573                 else
6574                     gccvisbroken=yes
6575                 fi
6576             fi
6577             ;;
6578         *)
6579             gccvisbroken=no
6580             ;;
6581         esac
6582     fi
6583     rm -f visibility.s visibility.cxx
6585     AC_MSG_RESULT([$gccvisbroken])
6586     if test "$gccvisbroken" = "yes"; then
6587         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6588     fi
6590     CPPFLAGS="$save_CPPFLAGS"
6592     AC_LANG_POP([C++])
6595 dnl ===================================================================
6596 dnl  Clang++ tests
6597 dnl ===================================================================
6599 HAVE_GCC_FNO_DEFAULT_INLINE=
6600 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6601 if test "$GCC" = "yes"; then
6602     AC_MSG_CHECKING([whether $CXX supports -fno-default-inline])
6603     AC_LANG_PUSH([C++])
6604     save_CXXFLAGS=$CXXFLAGS
6605     CXXFLAGS="$CFLAGS -Werror -fno-default-inline"
6606     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_DEFAULT_INLINE=TRUE ],[])
6607     CXXFLAGS=$save_CXXFLAGS
6608     AC_LANG_POP([C++])
6609     if test "$HAVE_GCC_FNO_DEFAULT_INLINE" = "TRUE"; then
6610         AC_MSG_RESULT([yes])
6611     else
6612         AC_MSG_RESULT([no])
6613     fi
6615     AC_MSG_CHECKING([whether $CXX supports -fno-enforce-eh-specs])
6616     AC_LANG_PUSH([C++])
6617     save_CXXFLAGS=$CXXFLAGS
6618     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6619     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6620     CXXFLAGS=$save_CXXFLAGS
6621     AC_LANG_POP([C++])
6622     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6623         AC_MSG_RESULT([yes])
6624     else
6625         AC_MSG_RESULT([no])
6626     fi
6628 AC_SUBST(HAVE_GCC_FNO_DEFAULT_INLINE)
6629 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6631 dnl ===================================================================
6632 dnl Compiler plugins
6633 dnl ===================================================================
6635 COMPILER_PLUGINS=
6636 # currently only Clang
6638 if test "$COM_IS_CLANG" != "TRUE"; then
6639     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6640         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6641         enable_compiler_plugins=no
6642     fi
6645 if test "$COM_IS_CLANG" = "TRUE"; then
6646     if test -n "$enable_compiler_plugins"; then
6647         compiler_plugins="$enable_compiler_plugins"
6648     elif test -n "$ENABLE_DBGUTIL"; then
6649         compiler_plugins=test
6650     else
6651         compiler_plugins=no
6652     fi
6653     if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
6654         if test "$compiler_plugins" = yes; then
6655             AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
6656         else
6657             compiler_plugins=no
6658         fi
6659     fi
6660     if test "$compiler_plugins" != "no"; then
6661         dnl The prefix where Clang resides, override to where Clang resides if
6662         dnl using a source build:
6663         if test -z "$CLANGDIR"; then
6664             CLANGDIR=/usr
6665         fi
6666         AC_LANG_PUSH([C++])
6667         save_CPPFLAGS=$CPPFLAGS
6668         save_CXX=$CXX
6669         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
6670         : "${COMPILER_PLUGINS_CXX=g++}"
6671         CXX=$COMPILER_PLUGINS_CXX
6672         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
6673         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
6674             [COMPILER_PLUGINS=TRUE],
6675             [
6676             if test "$compiler_plugins" = "yes"; then
6677                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
6678             else
6679                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
6680                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
6681             fi
6682             ])
6683         CXX=$save_CXX
6684         CPPFLAGS=$save_CPPFLAGS
6685         AC_LANG_POP([C++])
6686     fi
6687 else
6688     if test "$enable_compiler_plugins" = "yes"; then
6689         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
6690     fi
6692 AC_SUBST(COMPILER_PLUGINS)
6693 AC_SUBST(COMPILER_PLUGINS_CXX)
6694 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
6695 AC_SUBST(COMPILER_PLUGINS_DEBUG)
6696 AC_SUBST(CLANGDIR)
6697 AC_SUBST(CLANGLIBDIR)
6699 # Plugin to help linker.
6700 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
6701 # This makes --enable-lto build with clang work.
6702 AC_SUBST(LD_PLUGIN)
6704 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
6705 AC_SUBST(HAVE_POSIX_FALLOCATE)
6707 dnl ===================================================================
6708 dnl Custom build version
6709 dnl ===================================================================
6711 AC_MSG_CHECKING([whether to add custom build version])
6712 if test "$with_build_version" != ""; then
6713     BUILD_VER_STRING=$with_build_version
6714     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
6715 else
6716     BUILD_VER_STRING=
6717     AC_MSG_RESULT([no])
6719 AC_SUBST(BUILD_VER_STRING)
6721 JITC_PROCESSOR_TYPE=""
6722 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
6723     # IBMs JDK needs this...
6724     JITC_PROCESSOR_TYPE=6
6725     export JITC_PROCESSOR_TYPE
6727 AC_SUBST([JITC_PROCESSOR_TYPE])
6729 # Misc Windows Stuff
6730 AC_ARG_WITH(ucrt-dir,
6731     AS_HELP_STRING([--with-ucrt-dir],
6732         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
6733         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
6734         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
6735             Windows6.1-KB2999226-x64.msu
6736             Windows6.1-KB2999226-x86.msu
6737             Windows8.1-KB2999226-x64.msu
6738             Windows8.1-KB2999226-x86.msu
6739             Windows8-RT-KB2999226-x64.msu
6740             Windows8-RT-KB2999226-x86.msu
6741         A zip archive including those files is available from Microsoft site:
6742         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
6744 UCRT_REDISTDIR="$with_ucrt_dir"
6745 if test $_os = "WINNT"; then
6746     find_msvc_x64_dlls
6747     find_msms
6748     MSVC_DLL_PATH="$msvcdllpath"
6749     MSVC_DLLS="$msvcdlls"
6750     MSM_PATH="$msmdir"
6751     # MSVC 15.3 changed it to VC141
6752     if echo "$MSVC_DLL_PATH" | grep -q "VC141.CRT$"; then
6753         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
6754     else
6755         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
6756     fi
6757     if test "$UCRT_REDISTDIR" = "no"; then
6758         dnl explicitly disabled
6759         UCRT_REDISTDIR=""
6760     else
6761         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
6762                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
6763                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
6764                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
6765                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
6766                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
6767             UCRT_REDISTDIR=""
6768             if test -n "$PKGFORMAT"; then
6769                for i in $PKGFORMAT; do
6770                    case "$i" in
6771                    msi)
6772                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
6773                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
6774                        ;;
6775                    esac
6776                done
6777             fi
6778         fi
6779     fi
6782 AC_SUBST(UCRT_REDISTDIR)
6783 AC_SUBST(MSVC_DLL_PATH)
6784 AC_SUBST(MSVC_DLLS)
6785 AC_SUBST(MSM_PATH)
6787 dnl ===================================================================
6788 dnl Checks for Java
6789 dnl ===================================================================
6790 if test "$ENABLE_JAVA" != ""; then
6792     # Windows-specific tests
6793     if test "$build_os" = "cygwin"; then
6794         if test "$BITNESS_OVERRIDE" = 64; then
6795             bitness=64
6796         else
6797             bitness=32
6798         fi
6800         if test -z "$with_jdk_home"; then
6801             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
6802             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
6803             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
6804             if test -n "$regvalue"; then
6805                 ver=$regvalue
6806                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
6807                 _jdk_home=$regvalue
6808             fi
6809             if test -z "$with_jdk_home"; then
6810                 for ver in 1.8 1.7 1.6; do
6811                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
6812                     if test -n "$regvalue"; then
6813                         _jdk_home=$regvalue
6814                         break
6815                     fi
6816                 done
6817             fi
6818             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
6819                 with_jdk_home="$_jdk_home"
6820                 howfound="found automatically"
6821             else
6822                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
6823             fi
6824         else
6825             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
6826             howfound="you passed"
6827         fi
6828     fi
6830     # 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.
6831     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
6832     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
6833         with_jdk_home=`/usr/libexec/java_home`
6834     fi
6836     JAVA_HOME=; export JAVA_HOME
6837     if test -z "$with_jdk_home"; then
6838         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
6839     else
6840         _java_path="$with_jdk_home/bin/$with_java"
6841         dnl Check if there is a Java interpreter at all.
6842         if test -x "$_java_path"; then
6843             JAVAINTERPRETER=$_java_path
6844         else
6845             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
6846         fi
6847     fi
6849     dnl Check that the JDK found is correct architecture (at least 2 reasons to
6850     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
6851     dnl loaded by java to run JunitTests:
6852     if test "$build_os" = "cygwin"; then
6853         shortjdkhome=`cygpath -d "$with_jdk_home"`
6854         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
6855             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
6856             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6857         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
6858             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6859             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6860         fi
6862         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
6863             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
6864         fi
6865         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
6866     elif test "$cross_compiling" != "yes"; then
6867         case $CPUNAME in
6868             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
6869                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
6870                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
6871                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
6872                 fi
6873                 ;;
6874             *) # assumption: everything else 32-bit
6875                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
6876                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
6877                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
6878                 fi
6879                 ;;
6880         esac
6881     fi
6884 HAVE_JAVA9=
6885 dnl ===================================================================
6886 dnl Checks for JDK.
6887 dnl ===================================================================
6889 # Note that JAVA_HOME as for now always means the *build* platform's
6890 # JAVA_HOME. Whether all the complexity here actually is needed any
6891 # more or not, no idea.
6893 if test "$ENABLE_JAVA" != ""; then
6894     _gij_longver=0
6895     AC_MSG_CHECKING([the installed JDK])
6896     if test -n "$JAVAINTERPRETER"; then
6897         dnl java -version sends output to stderr!
6898         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
6899             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6900         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
6901             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6902         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
6903             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
6904         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
6905             JDK=ibm
6907             dnl IBM JDK specific tests
6908             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
6909             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6911             if test "$_jdk_ver" -lt 10600; then
6912                 AC_MSG_ERROR([IBM JDK is too old, you need at least 1.6])
6913             fi
6915             AC_MSG_RESULT([checked (IBM JDK $_jdk)])
6917             if test "$with_jdk_home" = ""; then
6918                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
6919 you must use the "--with-jdk-home" configure option explicitly])
6920             fi
6922             JAVA_HOME=$with_jdk_home
6923         else
6924             JDK=sun
6926             dnl Sun JDK specific tests
6927             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
6928             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
6930             if test "$_jdk_ver" -lt 10600; then
6931                 AC_MSG_ERROR([JDK is too old, you need at least 1.6])
6932             fi
6933             if test "$_jdk_ver" -gt 10600; then
6934                 JAVA_CLASSPATH_NOT_SET=TRUE
6935             fi
6936             if test "$_jdk_ver" -ge 10900; then
6937                 HAVE_JAVA9=TRUE
6938             fi
6940             AC_MSG_RESULT([checked (JDK $_jdk)])
6941             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
6942             if test "$_os" = "WINNT"; then
6943                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
6944             fi
6946             # set to limit VM usage for JunitTests
6947             JAVAIFLAGS=-Xmx64M
6948             # set to limit VM usage for javac
6949             JAVAFLAGS=-J-Xmx128M
6950         fi
6951     else
6952         AC_MSG_ERROR([Java not found. You need at least jdk-1.6])
6953     fi
6954 else
6955     dnl Java disabled
6956     JAVA_HOME=
6957     export JAVA_HOME
6960 dnl ===================================================================
6961 dnl Set target Java bytecode version
6962 dnl ===================================================================
6963 if test "$ENABLE_JAVA" != ""; then
6964     if test "$HAVE_JAVA9" = "TRUE"; then
6965         _java_target_ver="1.6"
6966     else
6967         _java_target_ver="1.5"
6968     fi
6969     JAVA_SOURCE_VER="$_java_target_ver"
6970     JAVA_TARGET_VER="$_java_target_ver"
6973 dnl ===================================================================
6974 dnl Checks for javac
6975 dnl ===================================================================
6976 if test "$ENABLE_JAVA" != ""; then
6977     javacompiler="javac"
6978     if test -z "$with_jdk_home"; then
6979         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
6980     else
6981         _javac_path="$with_jdk_home/bin/$javacompiler"
6982         dnl Check if there is a Java compiler at all.
6983         if test -x "$_javac_path"; then
6984             JAVACOMPILER=$_javac_path
6985         fi
6986     fi
6987     if test -z "$JAVACOMPILER"; then
6988         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
6989     fi
6990     if test "$build_os" = "cygwin"; then
6991         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
6992             JAVACOMPILER="${JAVACOMPILER}.exe"
6993         fi
6994         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
6995     fi
6998 dnl ===================================================================
6999 dnl Checks for javadoc
7000 dnl ===================================================================
7001 if test "$ENABLE_JAVA" != ""; then
7002     if test -z "$with_jdk_home"; then
7003         AC_PATH_PROG(JAVADOC, javadoc)
7004     else
7005         _javadoc_path="$with_jdk_home/bin/javadoc"
7006         dnl Check if there is a javadoc at all.
7007         if test -x "$_javadoc_path"; then
7008             JAVADOC=$_javadoc_path
7009         else
7010             AC_PATH_PROG(JAVADOC, javadoc)
7011         fi
7012     fi
7013     if test -z "$JAVADOC"; then
7014         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7015     fi
7016     if test "$build_os" = "cygwin"; then
7017         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7018             JAVADOC="${JAVADOC}.exe"
7019         fi
7020         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7021     fi
7023     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7024     JAVADOCISGJDOC="yes"
7025     fi
7027 AC_SUBST(JAVADOCISGJDOC)
7029 if test "$ENABLE_JAVA" != ""; then
7030     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7031     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7032         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7033            # try to recover first by looking whether we have a alternatives
7034            # system as in Debian or newer SuSEs where following /usr/bin/javac
7035            # over /etc/alternatives/javac leads to the right bindir where we
7036            # just need to strip a bit away to get a valid JAVA_HOME
7037            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7038         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7039             # maybe only one level of symlink (e.g. on Mac)
7040             JAVA_HOME=$(readlink $JAVACOMPILER)
7041             if test "$(dirname $JAVA_HOME)" = "."; then
7042                 # we've got no path to trim back
7043                 JAVA_HOME=""
7044             fi
7045         else
7046             # else warn
7047             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7048             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7049             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7050             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7051         fi
7052         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it..
7053         if test "$JAVA_HOME" != "/usr"; then
7054             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7055                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7056                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7057                 dnl Tiger already returns a JDK path..
7058                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7059             else
7060                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7061                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7062                 dnl that checks which version to run
7063                 if test -f "$JAVA_HOME"; then
7064                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7065                 fi
7066             fi
7067         fi
7068     fi
7069     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7071     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7072     if test -z "$JAVA_HOME"; then
7073         if test "x$with_jdk_home" = "x"; then
7074             cat > findhome.java <<_ACEOF
7075 [import java.io.File;
7077 class findhome
7079     public static void main(String args[])
7080     {
7081         String jrelocation = System.getProperty("java.home");
7082         File jre = new File(jrelocation);
7083         System.out.println(jre.getParent());
7084     }
7086 _ACEOF
7087             AC_MSG_CHECKING([if javac works])
7088             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7089             AC_TRY_EVAL(javac_cmd)
7090             if test $? = 0 -a -f ./findhome.class; then
7091                 AC_MSG_RESULT([javac works])
7092             else
7093                 echo "configure: javac test failed" >&5
7094                 cat findhome.java >&5
7095                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7096             fi
7097             AC_MSG_CHECKING([if gij knows its java.home])
7098             JAVA_HOME=`$JAVAINTERPRETER findhome`
7099             if test $? = 0 -a "$JAVA_HOME" != ""; then
7100                 AC_MSG_RESULT([$JAVA_HOME])
7101             else
7102                 echo "configure: java test failed" >&5
7103                 cat findhome.java >&5
7104                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7105             fi
7106             # clean-up after ourselves
7107             rm -f ./findhome.java ./findhome.class
7108         else
7109             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7110         fi
7111     fi
7113     # now check if $JAVA_HOME is really valid
7114     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7115         case "${JAVA_HOME}" in
7116             /Library/Java/JavaVirtualMachines/*)
7117                 ;;
7118             *)
7119                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7120                 ;;
7121         esac
7122         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7123             JAVA_HOME_OK="NO"
7124         fi
7125     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7126         JAVA_HOME_OK="NO"
7127     fi
7128     if test "$JAVA_HOME_OK" = "NO"; then
7129         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7130         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7131         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7132         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7133         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7134         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7135     fi
7136     PathFormat "$JAVA_HOME"
7137     JAVA_HOME="$formatted_path"
7140 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7141     "$_os" != Darwin
7142 then
7143     AC_MSG_CHECKING([for JAWT lib])
7144     if test "$_os" = WINNT; then
7145         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7146         JAWTLIB=jawt.lib
7147     else
7148         case "$host_cpu" in
7149         arm*)
7150             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7151             JAVA_ARCH=$my_java_arch
7152             ;;
7153         i*86)
7154             my_java_arch=i386
7155             ;;
7156         m68k)
7157             my_java_arch=m68k
7158             ;;
7159         powerpc)
7160             my_java_arch=ppc
7161             ;;
7162         powerpc64)
7163             my_java_arch=ppc64
7164             ;;
7165         powerpc64le)
7166             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7167             JAVA_ARCH=$my_java_arch
7168             ;;
7169         sparc64)
7170             my_java_arch=sparcv9
7171             ;;
7172         x86_64)
7173             my_java_arch=amd64
7174             ;;
7175         *)
7176             my_java_arch=$host_cpu
7177             ;;
7178         esac
7179         # This is where JDK9 puts the library
7180         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7181             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7182         else
7183             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7184         fi
7185         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7186     fi
7187     AC_MSG_RESULT([$JAWTLIB])
7189 AC_SUBST(JAWTLIB)
7191 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7192     case "$host_os" in
7194     aix*)
7195         JAVAINC="-I$JAVA_HOME/include"
7196         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7197         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7198         ;;
7200     cygwin*)
7201         JAVAINC="-I$JAVA_HOME/include/win32"
7202         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7203         ;;
7205     darwin*)
7206         if test -d "$JAVA_HOME/include/darwin"; then
7207             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7208         else
7209             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7210         fi
7211         ;;
7213     dragonfly*)
7214         JAVAINC="-I$JAVA_HOME/include"
7215         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7216         ;;
7218     freebsd*)
7219         JAVAINC="-I$JAVA_HOME/include"
7220         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7221         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7222         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7223         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7224         ;;
7226     k*bsd*-gnu*)
7227         JAVAINC="-I$JAVA_HOME/include"
7228         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7229         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7230         ;;
7232     linux-gnu*)
7233         JAVAINC="-I$JAVA_HOME/include"
7234         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7235         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7236         ;;
7238     *netbsd*)
7239         JAVAINC="-I$JAVA_HOME/include"
7240         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7241         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7242        ;;
7244     openbsd*)
7245         JAVAINC="-I$JAVA_HOME/include"
7246         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7247         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7248         ;;
7250     solaris*)
7251         JAVAINC="-I$JAVA_HOME/include"
7252         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7253         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7254         ;;
7255     esac
7257 SOLARINC="$SOLARINC $JAVAINC"
7259 AC_SUBST(JAVACOMPILER)
7260 AC_SUBST(JAVADOC)
7261 AC_SUBST(JAVAINTERPRETER)
7262 AC_SUBST(JAVAIFLAGS)
7263 AC_SUBST(JAVAFLAGS)
7264 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7265 AC_SUBST(JAVA_HOME)
7266 AC_SUBST(JAVA_SOURCE_VER)
7267 AC_SUBST(JAVA_TARGET_VER)
7268 AC_SUBST(JDK)
7271 dnl ===================================================================
7272 dnl Export file validation
7273 dnl ===================================================================
7274 AC_MSG_CHECKING([whether to enable export file validation])
7275 if test "$with_export_validation" != "no"; then
7276     if test -z "$ENABLE_JAVA"; then
7277         if test "$with_export_validation" = "yes"; then
7278             AC_MSG_ERROR([requested, but Java is disabled])
7279         else
7280             AC_MSG_RESULT([no, as Java is disabled])
7281         fi
7282     elif test "$_jdk_ver" -lt 10800; then
7283         if test "$with_export_validation" = "yes"; then
7284             AC_MSG_ERROR([requested, but Java is too old, need Java 8])
7285         else
7286             AC_MSG_RESULT([no, as Java is too old, need Java 8])
7287         fi
7288     else
7289         AC_MSG_RESULT([yes])
7290         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7292         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7293         if test -z "$ODFVALIDATOR"; then
7294             # remember to download the ODF toolkit with validator later
7295             AC_MSG_NOTICE([no odfvalidator found, will download it])
7296             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7297             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7299             # and fetch name of odfvalidator jar name from download.lst
7300             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7301             AC_SUBST(ODFVALIDATOR_JAR)
7303             if test -z "$ODFVALIDATOR_JAR"; then
7304                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7305             fi
7306         fi
7307         if test "$build_os" = "cygwin"; then
7308             # In case of Cygwin it will be executed from Windows,
7309             # so we need to run bash and absolute path to validator
7310             # so instead of "odfvalidator" it will be
7311             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7312             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7313         else
7314             ODFVALIDATOR="sh $ODFVALIDATOR"
7315         fi
7316         AC_SUBST(ODFVALIDATOR)
7319         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7320         if test -z "$OFFICEOTRON"; then
7321             # remember to download the officeotron with validator later
7322             AC_MSG_NOTICE([no officeotron found, will download it])
7323             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7324             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7326             # and fetch name of officeotron jar name from download.lst
7327             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7328             AC_SUBST(OFFICEOTRON_JAR)
7330             if test -z "$OFFICEOTRON_JAR"; then
7331                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7332             fi
7333         else
7334             # check version of existing officeotron
7335             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7336             if test 0"$OFFICEOTRON_VER" -lt 704; then
7337                 AC_MSG_ERROR([officeotron too old])
7338             fi
7339         fi
7340         if test "$build_os" = "cygwin"; then
7341             # In case of Cygwin it will be executed from Windows,
7342             # so we need to run bash and absolute path to validator
7343             # so instead of "odfvalidator" it will be
7344             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7345             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7346         else
7347             OFFICEOTRON="sh $OFFICEOTRON"
7348         fi
7349     fi
7350     AC_SUBST(OFFICEOTRON)
7351 else
7352     AC_MSG_RESULT([no])
7355 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7356 if test "$with_bffvalidator" != "no"; then
7357     AC_DEFINE(HAVE_BFFVALIDATOR)
7359     if test "$with_export_validation" = "no"; then
7360         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7361     fi
7363     if test "$with_bffvalidator" = "yes"; then
7364         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7365     else
7366         BFFVALIDATOR="$with_bffvalidator"
7367     fi
7369     if test "$build_os" = "cygwin"; then
7370         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7371             AC_MSG_RESULT($BFFVALIDATOR)
7372         else
7373             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7374         fi
7375     elif test -n "$BFFVALIDATOR"; then
7376         # We are not in Cygwin but need to run Windows binary with wine
7377         AC_PATH_PROGS(WINE, wine)
7379         # so swap in a shell wrapper that converts paths transparently
7380         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7381         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7382         AC_SUBST(BFFVALIDATOR_EXE)
7383         AC_MSG_RESULT($BFFVALIDATOR)
7384     else
7385         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7386     fi
7387     AC_SUBST(BFFVALIDATOR)
7388 else
7389     AC_MSG_RESULT([no])
7392 dnl ===================================================================
7393 dnl Check for C preprocessor to use
7394 dnl ===================================================================
7395 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7396 if test -n "$with_idlc_cpp"; then
7397     AC_MSG_RESULT([$with_idlc_cpp])
7398     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7399 else
7400     AC_MSG_RESULT([ucpp])
7401     AC_MSG_CHECKING([which ucpp tp use])
7402     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7403         AC_MSG_RESULT([external])
7404         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7405     else
7406         AC_MSG_RESULT([internal])
7407         BUILD_TYPE="$BUILD_TYPE UCPP"
7408     fi
7410 AC_SUBST(SYSTEM_UCPP)
7412 dnl ===================================================================
7413 dnl Check for epm (not needed for Windows)
7414 dnl ===================================================================
7415 AC_MSG_CHECKING([whether to enable EPM for packing])
7416 if test "$enable_epm" = "yes"; then
7417     AC_MSG_RESULT([yes])
7418     if test "$_os" != "WINNT"; then
7419         if test $_os = Darwin; then
7420             EPM=internal
7421         elif test -n "$with_epm"; then
7422             EPM=$with_epm
7423         else
7424             AC_PATH_PROG(EPM, epm, no)
7425         fi
7426         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7427             AC_MSG_NOTICE([EPM will be built.])
7428             BUILD_TYPE="$BUILD_TYPE EPM"
7429             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7430         else
7431             # Gentoo has some epm which is something different...
7432             AC_MSG_CHECKING([whether the found epm is the right epm])
7433             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7434                 AC_MSG_RESULT([yes])
7435             else
7436                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7437             fi
7438             AC_MSG_CHECKING([epm version])
7439             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7440             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7441                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7442                 AC_MSG_RESULT([OK, >= 3.7])
7443             else
7444                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7445                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7446             fi
7447         fi
7448     fi
7450     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7451         AC_MSG_CHECKING([for rpm])
7452         for a in "$RPM" rpmbuild rpm; do
7453             $a --usage >/dev/null 2> /dev/null
7454             if test $? -eq 0; then
7455                 RPM=$a
7456                 break
7457             else
7458                 $a --version >/dev/null 2> /dev/null
7459                 if test $? -eq 0; then
7460                     RPM=$a
7461                     break
7462                 fi
7463             fi
7464         done
7465         if test -z "$RPM"; then
7466             AC_MSG_ERROR([not found])
7467         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7468             RPM_PATH=`which $RPM`
7469             AC_MSG_RESULT([$RPM_PATH])
7470             SCPDEFS="$SCPDEFS -DWITH_RPM"
7471         else
7472             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7473         fi
7474     fi
7475     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7476         AC_PATH_PROG(DPKG, dpkg, no)
7477         if test "$DPKG" = "no"; then
7478             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7479         fi
7480     fi
7481     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7482        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7483         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7484             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7485                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7486                 if grep "Patched for LibreOffice" $EPM >/dev/null 2>/dev/null; then
7487                     AC_MSG_RESULT([yes])
7488                 else
7489                     AC_MSG_RESULT([no])
7490                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7491                         _pt="rpm"
7492                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7493                         add_warning "the rpms will need to be installed with --nodeps"
7494                     else
7495                         _pt="pkg"
7496                     fi
7497                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7498                     add_warning "the ${_pt}s will not be relocatable"
7499                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7500                                  relocation will work, you need to patch your epm with the
7501                                  patch in epm/epm-3.7.patch or build with
7502                                  --with-epm=internal which will build a suitable epm])
7503                 fi
7504             fi
7505         fi
7506     fi
7507     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7508         AC_PATH_PROG(PKGMK, pkgmk, no)
7509         if test "$PKGMK" = "no"; then
7510             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7511         fi
7512     fi
7513     AC_SUBST(RPM)
7514     AC_SUBST(DPKG)
7515     AC_SUBST(PKGMK)
7516 else
7517     for i in $PKGFORMAT; do
7518         case "$i" in
7519         aix | bsd | deb | pkg | rpm | native | portable)
7520             AC_MSG_ERROR(
7521                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7522             ;;
7523         esac
7524     done
7525     AC_MSG_RESULT([no])
7526     EPM=NO
7528 AC_SUBST(EPM)
7530 ENABLE_LWP=
7531 if test "$enable_lotuswordpro" = "yes"; then
7532     ENABLE_LWP="TRUE"
7534 AC_SUBST(ENABLE_LWP)
7536 dnl ===================================================================
7537 dnl Check for building ODK
7538 dnl ===================================================================
7539 if test "$enable_odk" = no; then
7540     unset DOXYGEN
7541 else
7542     if test "$with_doxygen" = no; then
7543         AC_MSG_CHECKING([for doxygen])
7544         unset DOXYGEN
7545         AC_MSG_RESULT([no])
7546     else
7547         if test "$with_doxygen" = yes; then
7548             AC_PATH_PROG([DOXYGEN], [doxygen])
7549             if test -z "$DOXYGEN"; then
7550                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7551             fi
7552             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7553                 if ! dot -V 2>/dev/null; then
7554                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7555                 fi
7556             fi
7557         else
7558             AC_MSG_CHECKING([for doxygen])
7559             DOXYGEN=$with_doxygen
7560             AC_MSG_RESULT([$DOXYGEN])
7561         fi
7562         if test -n "$DOXYGEN"; then
7563             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7564             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7565             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7566                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7567             fi
7568         fi
7569     fi
7571 AC_SUBST([DOXYGEN])
7573 AC_MSG_CHECKING([whether to build the ODK])
7574 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7575     AC_MSG_RESULT([yes])
7577     if test "$with_java" != "no"; then
7578         AC_MSG_CHECKING([whether to build unowinreg.dll])
7579         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7580             # build on Win by default
7581             enable_build_unowinreg=yes
7582         fi
7583         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7584             AC_MSG_RESULT([no])
7585             BUILD_UNOWINREG=
7586         else
7587             AC_MSG_RESULT([yes])
7588             BUILD_UNOWINREG=TRUE
7589         fi
7590         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7591             if test -z "$with_mingw_cross_compiler"; then
7592                 dnl Guess...
7593                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7594             elif test -x "$with_mingw_cross_compiler"; then
7595                  MINGWCXX="$with_mingw_cross_compiler"
7596             else
7597                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7598             fi
7600             if test "$MINGWCXX" = "false"; then
7601                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7602             fi
7604             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7605             if test -x "$mingwstrip_test"; then
7606                 MINGWSTRIP="$mingwstrip_test"
7607             else
7608                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7609             fi
7611             if test "$MINGWSTRIP" = "false"; then
7612                 AC_MSG_ERROR(MinGW32 binutils not found.)
7613             fi
7614         fi
7615     fi
7616     BUILD_TYPE="$BUILD_TYPE ODK"
7617 else
7618     AC_MSG_RESULT([no])
7619     BUILD_UNOWINREG=
7621 AC_SUBST(BUILD_UNOWINREG)
7622 AC_SUBST(MINGWCXX)
7623 AC_SUBST(MINGWSTRIP)
7625 dnl ===================================================================
7626 dnl Check for system zlib
7627 dnl ===================================================================
7628 if test "$with_system_zlib" = "auto"; then
7629     case "$_os" in
7630     WINNT)
7631         with_system_zlib="$with_system_libs"
7632         ;;
7633     *)
7634         if test "$enable_fuzzers" != "yes"; then
7635             with_system_zlib=yes
7636         else
7637             with_system_zlib=no
7638         fi
7639         ;;
7640     esac
7643 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but OS X is too stupid
7644 dnl and has no pkg-config for it at least on some tinderboxes,
7645 dnl so leaving that out for now
7646 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
7647 AC_MSG_CHECKING([which zlib to use])
7648 if test "$with_system_zlib" = "yes"; then
7649     AC_MSG_RESULT([external])
7650     SYSTEM_ZLIB=TRUE
7651     AC_CHECK_HEADER(zlib.h, [],
7652         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
7653     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
7654         [AC_MSG_ERROR(zlib not found or functional)], [])
7655 else
7656     AC_MSG_RESULT([internal])
7657     SYSTEM_ZLIB=
7658     BUILD_TYPE="$BUILD_TYPE ZLIB"
7659     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
7660     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
7662 AC_SUBST(ZLIB_CFLAGS)
7663 AC_SUBST(ZLIB_LIBS)
7664 AC_SUBST(SYSTEM_ZLIB)
7666 dnl ===================================================================
7667 dnl Check for system jpeg
7668 dnl ===================================================================
7669 AC_MSG_CHECKING([which libjpeg to use])
7670 if test "$with_system_jpeg" = "yes"; then
7671     AC_MSG_RESULT([external])
7672     SYSTEM_LIBJPEG=TRUE
7673     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
7674         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
7675     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
7676         [AC_MSG_ERROR(jpeg library not found or fuctional)], [])
7677 else
7678     SYSTEM_LIBJPEG=
7679     AC_MSG_RESULT([internal, libjpeg-turbo])
7680     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
7681     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
7682     if test "$COM" = "MSC"; then
7683         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
7684     else
7685         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
7686     fi
7688     case "$host_cpu" in
7689     x86_64 | amd64 | i*86 | x86 | ia32)
7690         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
7691         if test -z "$NASM" -a "$build_os" = "cygwin"; then
7692             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
7693                 NASM="$LODE_HOME/opt/bin/nasm"
7694             elif test -x "/opt/lo/bin/nasm"; then
7695                 NASM="/opt/lo/bin/nasm"
7696             fi
7697         fi
7699         if test -n "$NASM"; then
7700             AC_MSG_CHECKING([for object file format of host system])
7701             case "$host_os" in
7702               cygwin* | mingw* | pw32* | interix*)
7703                 case "$host_cpu" in
7704                   x86_64)
7705                     objfmt='Win64-COFF'
7706                     ;;
7707                   *)
7708                     objfmt='Win32-COFF'
7709                     ;;
7710                 esac
7711               ;;
7712               msdosdjgpp* | go32*)
7713                 objfmt='COFF'
7714               ;;
7715               os2-emx*)                 # not tested
7716                 objfmt='MSOMF'          # obj
7717               ;;
7718               linux*coff* | linux*oldld*)
7719                 objfmt='COFF'           # ???
7720               ;;
7721               linux*aout*)
7722                 objfmt='a.out'
7723               ;;
7724               linux*)
7725                 case "$host_cpu" in
7726                   x86_64)
7727                     objfmt='ELF64'
7728                     ;;
7729                   *)
7730                     objfmt='ELF'
7731                     ;;
7732                 esac
7733               ;;
7734               kfreebsd* | freebsd* | netbsd* | openbsd*)
7735                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
7736                   objfmt='BSD-a.out'
7737                 else
7738                   case "$host_cpu" in
7739                     x86_64 | amd64)
7740                       objfmt='ELF64'
7741                       ;;
7742                     *)
7743                       objfmt='ELF'
7744                       ;;
7745                   esac
7746                 fi
7747               ;;
7748               solaris* | sunos* | sysv* | sco*)
7749                 case "$host_cpu" in
7750                   x86_64)
7751                     objfmt='ELF64'
7752                     ;;
7753                   *)
7754                     objfmt='ELF'
7755                     ;;
7756                 esac
7757               ;;
7758               darwin* | rhapsody* | nextstep* | openstep* | macos*)
7759                 case "$host_cpu" in
7760                   x86_64)
7761                     objfmt='Mach-O64'
7762                     ;;
7763                   *)
7764                     objfmt='Mach-O'
7765                     ;;
7766                 esac
7767               ;;
7768               *)
7769                 objfmt='ELF ?'
7770               ;;
7771             esac
7773             AC_MSG_RESULT([$objfmt])
7774             if test "$objfmt" = 'ELF ?'; then
7775               objfmt='ELF'
7776               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
7777             fi
7779             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
7780             case "$objfmt" in
7781               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
7782               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
7783               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
7784               COFF)       NAFLAGS='-fcoff -DCOFF';;
7785               a.out)      NAFLAGS='-faout -DAOUT';;
7786               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
7787               ELF)        NAFLAGS='-felf -DELF';;
7788               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
7789               RDF)        NAFLAGS='-frdf -DRDF';;
7790               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
7791               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
7792             esac
7793             AC_MSG_RESULT([$NAFLAGS])
7795             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
7796             cat > conftest.asm << EOF
7797             [%line __oline__ "configure"
7798                     section .text
7799                     global  _main,main
7800             _main:
7801             main:   xor     eax,eax
7802                     ret
7803             ]
7805             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
7806             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
7807               AC_MSG_RESULT(yes)
7808             else
7809               echo "configure: failed program was:" >&AC_FD_CC
7810               cat conftest.asm >&AC_FD_CC
7811               rm -rf conftest*
7812               AC_MSG_RESULT(no)
7813               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
7814               NASM=""
7815             fi
7817         fi
7819         if test -z "$NASM"; then
7820 cat << _EOS
7821 ****************************************************************************
7822 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
7823 To get one please:
7825 _EOS
7826             if test "$build_os" = "cygwin"; then
7827 cat << _EOS
7828 install a pre-compiled binary for Win32
7830 mkdir -p /opt/lo/bin
7831 cd /opt/lo/bin
7832 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
7833 chmod +x nasm
7835 or get and install one from http://www.nasm.us/
7837 Then re-run autogen.sh
7839 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
7840 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
7842 _EOS
7843             else
7844 cat << _EOS
7845 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
7847 _EOS
7848             fi
7849             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
7850             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
7851         fi
7852       ;;
7853     esac
7856 AC_SUBST(NASM)
7857 AC_SUBST(LIBJPEG_CFLAGS)
7858 AC_SUBST(LIBJPEG_LIBS)
7859 AC_SUBST(SYSTEM_LIBJPEG)
7861 dnl ===================================================================
7862 dnl Check for system clucene
7863 dnl ===================================================================
7864 dnl we should rather be using
7865 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
7866 dnl but the contribs-lib check seems tricky
7867 AC_MSG_CHECKING([which clucene to use])
7868 if test "$with_system_clucene" = "yes"; then
7869     AC_MSG_RESULT([external])
7870     SYSTEM_CLUCENE=TRUE
7871     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
7872     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
7873     FilterLibs "${CLUCENE_LIBS}"
7874     CLUCENE_LIBS="${filteredlibs}"
7875     AC_LANG_PUSH([C++])
7876     save_CXXFLAGS=$CXXFLAGS
7877     save_CPPFLAGS=$CPPFLAGS
7878     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
7879     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
7880     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
7881     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
7882     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
7883                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
7884     CXXFLAGS=$save_CXXFLAGS
7885     CPPFLAGS=$save_CPPFLAGS
7886     AC_LANG_POP([C++])
7888     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
7889 else
7890     AC_MSG_RESULT([internal])
7891     SYSTEM_CLUCENE=
7892     BUILD_TYPE="$BUILD_TYPE CLUCENE"
7894 AC_SUBST(SYSTEM_CLUCENE)
7895 AC_SUBST(CLUCENE_CFLAGS)
7896 AC_SUBST(CLUCENE_LIBS)
7898 dnl ===================================================================
7899 dnl Check for system expat
7900 dnl ===================================================================
7901 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
7903 dnl ===================================================================
7904 dnl Check for system xmlsec
7905 dnl ===================================================================
7906 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.24])
7908 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
7909 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
7910     ENABLE_EOT="TRUE"
7911     AC_DEFINE([ENABLE_EOT])
7912     AC_MSG_RESULT([yes])
7914     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
7915 else
7916     ENABLE_EOT=
7917     AC_MSG_RESULT([no])
7919 AC_SUBST([ENABLE_EOT])
7921 dnl ===================================================================
7922 dnl Check for DLP libs
7923 dnl ===================================================================
7924 AS_IF([test "$COM" = "MSC"],
7925       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
7926       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
7928 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
7930 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
7932 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
7934 AS_IF([test "$COM" = "MSC"],
7935       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
7936       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
7938 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
7940 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
7942 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
7943 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
7945 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
7947 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
7949 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
7951 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
7952 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.14])
7954 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
7955 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
7957 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
7959 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
7960 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
7962 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
7964 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
7966 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
7968 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
7970 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
7971 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
7973 dnl ===================================================================
7974 dnl Check for system lcms2
7975 dnl ===================================================================
7976 if test "$with_system_lcms2" != "yes"; then
7977     SYSTEM_LCMS2=
7979 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
7980 if test "$GCC" = "yes"; then
7981     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
7983 if test "$COM" = "MSC"; then # override the above
7984     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
7987 dnl ===================================================================
7988 dnl Check for system cppunit
7989 dnl ===================================================================
7990 if test "$cross_compiling" != "yes"; then
7991     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
7994 dnl ===================================================================
7995 dnl Check whether freetype is available
7996 dnl ===================================================================
7997 if test  "$test_freetype" = "yes"; then
7998     AC_MSG_CHECKING([whether freetype is available])
7999     # FreeType has 3 different kinds of versions
8000     # * release, like 2.4.10
8001     # * libtool, like 13.0.7 (this what pkg-config returns)
8002     # * soname
8003     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8004     #
8005     # 9.9.3 is 2.2.0
8006     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8007     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8008     FilterLibs "${FREETYPE_LIBS}"
8009     FREETYPE_LIBS="${filteredlibs}"
8010     SYSTEM_FREETYPE=TRUE
8011 else
8012     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8013     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8015 AC_SUBST(FREETYPE_CFLAGS)
8016 AC_SUBST(FREETYPE_LIBS)
8017 AC_SUBST([SYSTEM_FREETYPE])
8019 # ===================================================================
8020 # Check for system libxslt
8021 # to prevent incompatibilities between internal libxml2 and external libxslt,
8022 # or vice versa, use with_system_libxml here
8023 # ===================================================================
8024 if test "$with_system_libxml" = "auto"; then
8025     case "$_os" in
8026     WINNT|iOS|Android)
8027         with_system_libxml="$with_system_libs"
8028         ;;
8029     *)
8030         if test "$enable_fuzzers" != "yes"; then
8031             with_system_libxml=yes
8032         else
8033             with_system_libxml=no
8034         fi
8035         ;;
8036     esac
8039 AC_MSG_CHECKING([which libxslt to use])
8040 if test "$with_system_libxml" = "yes"; then
8041     AC_MSG_RESULT([external])
8042     SYSTEM_LIBXSLT=TRUE
8043     if test "$_os" = "Darwin"; then
8044         dnl make sure to use SDK path
8045         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8046         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8047         dnl omit -L/usr/lib
8048         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8049         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8050     else
8051         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8052         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8053         FilterLibs "${LIBXSLT_LIBS}"
8054         LIBXSLT_LIBS="${filteredlibs}"
8055         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8056         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8057         FilterLibs "${LIBEXSLT_LIBS}"
8058         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8059     fi
8061     dnl Check for xsltproc
8062     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8063     if test "$XSLTPROC" = "no"; then
8064         AC_MSG_ERROR([xsltproc is required])
8065     fi
8066 else
8067     AC_MSG_RESULT([internal])
8068     SYSTEM_LIBXSLT=
8069     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8071     if test "$cross_compiling" = "yes"; then
8072         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8073         if test "$XSLTPROC" = "no"; then
8074             AC_MSG_ERROR([xsltproc is required])
8075         fi
8076     fi
8078 AC_SUBST(SYSTEM_LIBXSLT)
8079 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8080     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8082 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8084 AC_SUBST(LIBEXSLT_CFLAGS)
8085 AC_SUBST(LIBEXSLT_LIBS)
8086 AC_SUBST(LIBXSLT_CFLAGS)
8087 AC_SUBST(LIBXSLT_LIBS)
8088 AC_SUBST(XSLTPROC)
8090 # ===================================================================
8091 # Check for system libxml
8092 # ===================================================================
8093 AC_MSG_CHECKING([which libxml to use])
8094 if test "$with_system_libxml" = "yes"; then
8095     AC_MSG_RESULT([external])
8096     SYSTEM_LIBXML=TRUE
8097     if test "$_os" = "Darwin"; then
8098         dnl make sure to use SDK path
8099         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8100         dnl omit -L/usr/lib
8101         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8102     elif test $_os = iOS; then
8103         dnl make sure to use SDK path
8104         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8105         LIBXML_CFLAGS="-I$usr/include/libxml2"
8106         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8107     else
8108         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8109         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8110         FilterLibs "${LIBXML_LIBS}"
8111         LIBXML_LIBS="${filteredlibs}"
8112     fi
8114     dnl Check for xmllint
8115     AC_PATH_PROG(XMLLINT, xmllint, no)
8116     if test "$XMLLINT" = "no"; then
8117         AC_MSG_ERROR([xmllint is required])
8118     fi
8119 else
8120     AC_MSG_RESULT([internal])
8121     SYSTEM_LIBXML=
8122     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8123     if test "$COM" = "MSC"; then
8124         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8125     fi
8126     if test "$COM" = "MSC"; then
8127         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8128     else
8129         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8130     fi
8131     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8133 AC_SUBST(SYSTEM_LIBXML)
8134 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8135     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8137 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8138 AC_SUBST(LIBXML_CFLAGS)
8139 AC_SUBST(LIBXML_LIBS)
8140 AC_SUBST(XMLLINT)
8142 # =====================================================================
8143 # Checking for a Python interpreter with version >= 2.7.
8144 # Build and runtime requires Python 3 compatible version (>= 2.7).
8145 # Optionally user can pass an option to configure, i. e.
8146 # ./configure PYTHON=/usr/bin/python
8147 # =====================================================================
8148 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8149     # This allows a lack of system python with no error, we use internal one in that case.
8150     AM_PATH_PYTHON([2.7],, [:])
8151     # Clean PYTHON_VERSION checked below if cross-compiling
8152     PYTHON_VERSION=""
8153     if test "$PYTHON" != ":"; then
8154         PYTHON_FOR_BUILD=$PYTHON
8155     fi
8157 AC_SUBST(PYTHON_FOR_BUILD)
8159 # Checks for Python to use for Pyuno
8160 AC_MSG_CHECKING([which Python to use for Pyuno])
8161 case "$enable_python" in
8162 no|disable)
8163     if test -z $PYTHON_FOR_BUILD; then
8164         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8165         # requirement from the choice whether to include Python stuff in the installer, but why
8166         # bother?
8167         AC_MSG_ERROR([Python is required at build time.])
8168     fi
8169     enable_python=no
8170     AC_MSG_RESULT([none])
8171     ;;
8172 ""|yes|auto)
8173     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8174         AC_MSG_RESULT([no, overridden by --disable-scripting])
8175         enable_python=no
8176     elif test $build_os = cygwin; then
8177         dnl When building on Windows we don't attempt to use any installed
8178         dnl "system"  Python.
8179         AC_MSG_RESULT([fully internal])
8180         enable_python=internal
8181     elif test "$cross_compiling" = yes; then
8182         AC_MSG_RESULT([system])
8183         enable_python=system
8184     else
8185         # Unset variables set by the above AM_PATH_PYTHON so that
8186         # we actually do check anew.
8187         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
8188         AM_PATH_PYTHON([3.3],, [:])
8189         if test "$PYTHON" = ":"; then
8190             if test -z "$PYTHON_FOR_BUILD"; then
8191                 AC_MSG_RESULT([fully internal])
8192             else
8193                 AC_MSG_RESULT([internal])
8194             fi
8195             enable_python=internal
8196         else
8197             AC_MSG_RESULT([system])
8198             enable_python=system
8199         fi
8200     fi
8201     ;;
8202 internal)
8203     AC_MSG_RESULT([internal])
8204     ;;
8205 fully-internal)
8206     AC_MSG_RESULT([fully internal])
8207     enable_python=internal
8208     ;;
8209 system)
8210     AC_MSG_RESULT([system])
8211     ;;
8213     AC_MSG_ERROR([Incorrect --enable-python option])
8214     ;;
8215 esac
8217 if test $enable_python != no; then
8218     BUILD_TYPE="$BUILD_TYPE PYUNO"
8221 if test $enable_python = system; then
8222     if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then
8223         python_version=2.7
8224         PYTHON=python$python_version
8225         if test -d "$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"; then
8226             PYTHON_CFLAGS="-I$FRAMEWORKSHOME/Python.framework/Versions/${python_version}/include/python${python_version}"
8227             PYTHON_LIBS="-framework Python"
8228         else
8229             PYTHON_CFLAGS="`$PYTHON-config --includes`"
8230             PYTHON_LIBS="`$PYTHON-config --libs`"
8231         fi
8232     fi
8233     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8234         # Fallback: Accept these in the environment, or as set above
8235         # for MacOSX.
8236         :
8237     elif test "$cross_compiling" != yes; then
8238         # Unset variables set by the above AM_PATH_PYTHON so that
8239         # we actually do check anew.
8240         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
8241         # This causes an error if no python command is found
8242         AM_PATH_PYTHON([3.3])
8243         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8244         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8245         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8246         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8247         if test -z "$PKG_CONFIG"; then
8248             PYTHON_CFLAGS="-I$python_include"
8249             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8250         elif $PKG_CONFIG --exists python-$python_version; then
8251             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8252             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8253         else
8254             PYTHON_CFLAGS="-I$python_include"
8255             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8256         fi
8257         FilterLibs "${PYTHON_LIBS}"
8258         PYTHON_LIBS="${filteredlibs}"
8259     else
8260         dnl How to find out the cross-compilation Python installation path?
8261         AC_MSG_CHECKING([for python version])
8262         AS_IF([test -n "$PYTHON_VERSION"],
8263               [AC_MSG_RESULT([$PYTHON_VERSION])],
8264               [AC_MSG_RESULT([not found])
8265                AC_MSG_ERROR([no usable python found])])
8266         test -n "$PYTHON_CFLAGS" && break
8267     fi
8269     dnl Check if the headers really work
8270     save_CPPFLAGS="$CPPFLAGS"
8271     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8272     AC_CHECK_HEADER(Python.h)
8273     CPPFLAGS="$save_CPPFLAGS"
8275     # let the PYTHON_FOR_BUILD match the same python installation that
8276     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8277     # better for PythonTests.
8278     PYTHON_FOR_BUILD=$PYTHON
8281 if test "$with_lxml" != no; then
8282     if test -z "$PYTHON_FOR_BUILD"; then
8283         case $build_os in
8284             cygwin)
8285                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8286                 ;;
8287             *)
8288                 if test "$cross_compiling" != yes ; then
8289                     BUILD_TYPE="$BUILD_TYPE LXML"
8290                 fi
8291                 ;;
8292         esac
8293     else
8294         AC_MSG_CHECKING([for python lxml])
8295         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8296             AC_MSG_RESULT([yes])
8297         else
8298             case $build_os in
8299                 cygwin)
8300                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8301                     ;;
8302                 *)
8303                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8304                         BUILD_TYPE="$BUILD_TYPE LXML"
8305                         AC_MSG_RESULT([no, using internal lxml])
8306                     else
8307                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8308                     fi
8309                     ;;
8310             esac
8311         fi
8312     fi
8315 dnl By now enable_python should be "system", "internal" or "no"
8316 case $enable_python in
8317 system)
8318     SYSTEM_PYTHON=TRUE
8320     if test "x$ac_cv_header_Python_h" != "xyes"; then
8321        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8322     fi
8324     AC_LANG_PUSH(C)
8325     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8326     AC_MSG_CHECKING([for correct python library version])
8327        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8328 #include <Python.h>
8330 int main(int argc, char **argv) {
8331    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8332        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8333    else return 1;
8335        ]])],[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])])
8336     CFLAGS=$save_CFLAGS
8337     AC_LANG_POP(C)
8339     dnl FIXME Check if the Python library can be linked with, too?
8340     ;;
8342 internal)
8343     SYSTEM_PYTHON=
8344     PYTHON_VERSION_MAJOR=3
8345     PYTHON_VERSION_MINOR=5
8346     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.5
8347     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8348         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8349     fi
8350     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8351     BUILD_TYPE="$BUILD_TYPE PYTHON"
8352     # Embedded Python dies without Home set
8353     if test "$HOME" = ""; then
8354         export HOME=""
8355     fi
8356     ;;
8358     DISABLE_PYTHON=TRUE
8359     SYSTEM_PYTHON=
8360     ;;
8362     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8363     ;;
8364 esac
8366 AC_SUBST(DISABLE_PYTHON)
8367 AC_SUBST(SYSTEM_PYTHON)
8368 AC_SUBST(PYTHON_CFLAGS)
8369 AC_SUBST(PYTHON_LIBS)
8370 AC_SUBST(PYTHON_VERSION)
8371 AC_SUBST(PYTHON_VERSION_MAJOR)
8372 AC_SUBST(PYTHON_VERSION_MINOR)
8374 ENABLE_MARIADBC=TRUE
8375 if test "$_os" = "Android" -o "$_os" = "iOS"; then
8376     ENABLE_MARIADBC=
8378 MARIADBC_MAJOR=1
8379 MARIADBC_MINOR=0
8380 MARIADBC_MICRO=2
8381 if test "$ENABLE_MARIADBC" = "TRUE"; then
8382     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8385 AC_SUBST(ENABLE_MARIADBC)
8386 AC_SUBST(MARIADBC_MAJOR)
8387 AC_SUBST(MARIADBC_MINOR)
8388 AC_SUBST(MARIADBC_MICRO)
8390 if test "$ENABLE_MARIADBC" = "TRUE"; then
8391     dnl ===================================================================
8392     dnl Check for system MariaDB
8393     dnl ===================================================================
8394     AC_MSG_CHECKING([which MariaDB to use])
8395     if test "$with_system_mariadb" = "yes"; then
8396         AC_MSG_RESULT([external])
8397         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8398         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8399         if test -z "$MARIADBCONFIG"; then
8400             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8401             if test -z "$MARIADBCONFIG"; then
8402                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8403                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8404             fi
8405         fi
8406         AC_MSG_CHECKING([MariaDB version])
8407         MARIADB_VERSION=`$MARIADBCONFIG --version`
8408         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8409         if test "$MARIADB_MAJOR" -ge "5"; then
8410             AC_MSG_RESULT([OK])
8411         else
8412             AC_MSG_ERROR([too old, use 5.0.x or later])
8413         fi
8414         AC_MSG_CHECKING([for MariaDB Client library])
8415         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8416         if test "$COM_IS_CLANG" = TRUE; then
8417             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8418         fi
8419         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8420         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8421         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8422         dnl linux32:
8423         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8424             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8425             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8426                 | sed -e 's|/lib64/|/lib/|')
8427         fi
8428         FilterLibs "${MARIADB_LIBS}"
8429         MARIADB_LIBS="${filteredlibs}"
8430         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8431         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8432         if test "$enable_bundle_mariadb" = "yes"; then
8433             AC_MSG_RESULT([yes])
8434             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8435             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8437 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8439 /g' | grep -E '(mysqlclient|mariadb)')
8440             if test "$_os" = "Darwin"; then
8441                 LIBMARIADB=${LIBMARIADB}.dylib
8442             elif test "$_os" = "WINNT"; then
8443                 LIBMARIADB=${LIBMARIADB}.dll
8444             else
8445                 LIBMARIADB=${LIBMARIADB}.so
8446             fi
8447             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8448             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8449             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8450                 AC_MSG_RESULT([found.])
8451                 PathFormat "$LIBMARIADB_PATH"
8452                 LIBMARIADB_PATH="$formatted_path"
8453             else
8454                 AC_MSG_ERROR([not found.])
8455             fi
8456         else
8457             AC_MSG_RESULT([no])
8458             BUNDLE_MARIADB_CONNECTOR_C=
8459         fi
8460     else
8461         AC_MSG_RESULT([internal])
8462         SYSTEM_MARIADB_CONNECTOR_C=
8463         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8464         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8465         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8466     fi
8468     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8469     AC_SUBST(MARIADB_CFLAGS)
8470     AC_SUBST(MARIADB_LIBS)
8471     AC_SUBST(LIBMARIADB)
8472     AC_SUBST(LIBMARIADB_PATH)
8473     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8476 dnl ===================================================================
8477 dnl Check for system hsqldb
8478 dnl ===================================================================
8479 if test "$with_java" != "no"; then
8480     HSQLDB_USE_JDBC_4_1=
8481     AC_MSG_CHECKING([which hsqldb to use])
8482     if test "$with_system_hsqldb" = "yes"; then
8483         AC_MSG_RESULT([external])
8484         SYSTEM_HSQLDB=TRUE
8485         if test -z $HSQLDB_JAR; then
8486             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8487         fi
8488         if ! test -f $HSQLDB_JAR; then
8489                AC_MSG_ERROR(hsqldb.jar not found.)
8490         fi
8491         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8492         export HSQLDB_JAR
8493         if $PERL -e \
8494            'use Archive::Zip;
8495             my $file = "$ENV{'HSQLDB_JAR'}";
8496             my $zip = Archive::Zip->new( $file );
8497             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8498             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8499             {
8500                 push @l, split(/\n/, $mf);
8501                 foreach my $line (@l)
8502                 {
8503                     if ($line =~ m/Specification-Version:/)
8504                     {
8505                         ($t, $version) = split (/:/,$line);
8506                         $version =~ s/^\s//;
8507                         ($a, $b, $c, $d) = split (/\./,$version);
8508                         if ($c == "0" && $d > "8")
8509                         {
8510                             exit 0;
8511                         }
8512                         else
8513                         {
8514                             exit 1;
8515                         }
8516                     }
8517                 }
8518             }
8519             else
8520             {
8521                 exit 1;
8522             }'; then
8523             AC_MSG_RESULT([yes])
8524         else
8525             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8526         fi
8527     else
8528         AC_MSG_RESULT([internal])
8529         SYSTEM_HSQLDB=
8530         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8531         NEED_ANT=TRUE
8532         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8533         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8534         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8535             AC_MSG_RESULT([yes])
8536             HSQLDB_USE_JDBC_4_1=TRUE
8537         else
8538             AC_MSG_RESULT([no])
8539         fi
8540     fi
8541     AC_SUBST(SYSTEM_HSQLDB)
8542     AC_SUBST(HSQLDB_JAR)
8543     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8546 dnl ===================================================================
8547 dnl Check for PostgreSQL stuff
8548 dnl ===================================================================
8549 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8550 if test "x$enable_postgresql_sdbc" != "xno"; then
8551     AC_MSG_RESULT([yes])
8552     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8554     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8555         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8556     fi
8557     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8558         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8559     fi
8561     postgres_interface=""
8562     if test "$with_system_postgresql" = "yes"; then
8563         postgres_interface="external PostgreSQL"
8564         SYSTEM_POSTGRESQL=TRUE
8565         if test "$_os" = Darwin; then
8566             supp_path=''
8567             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8568                 pg_supp_path="$P_SEP$d$pg_supp_path"
8569             done
8570         fi
8571         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8572         if test -z "$PGCONFIG"; then
8573             AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH])
8574         fi
8575         POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8576         POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8577         FilterLibs "${POSTGRESQL_LIB}"
8578         POSTGRESQL_LIB="${filteredlibs}"
8579     else
8580         # if/when anything else than PostgreSQL uses Kerberos,
8581         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8582         WITH_KRB5=
8583         WITH_GSSAPI=
8584         case "$_os" in
8585         Darwin)
8586             # MacOS X has system MIT Kerberos 5 since 10.4
8587             if test "$with_krb5" != "no"; then
8588                 WITH_KRB5=TRUE
8589                 save_LIBS=$LIBS
8590                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8591                 # that the libraries where these functions are located on macOS will change, is it?
8592                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8593                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8594                 KRB5_LIBS=$LIBS
8595                 LIBS=$save_LIBS
8596                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8597                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8598                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8599                 LIBS=$save_LIBS
8600             fi
8601             if test "$with_gssapi" != "no"; then
8602                 WITH_GSSAPI=TRUE
8603                 save_LIBS=$LIBS
8604                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8605                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8606                 GSSAPI_LIBS=$LIBS
8607                 LIBS=$save_LIBS
8608             fi
8609             ;;
8610         WINNT)
8611             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
8612                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
8613             fi
8614             ;;
8615         Linux|GNU|*BSD|DragonFly)
8616             if test "$with_krb5" != "no"; then
8617                 WITH_KRB5=TRUE
8618                 save_LIBS=$LIBS
8619                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8620                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8621                 KRB5_LIBS=$LIBS
8622                 LIBS=$save_LIBS
8623                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8624                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8625                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8626                 LIBS=$save_LIBS
8627             fi
8628             if test "$with_gssapi" != "no"; then
8629                 WITH_GSSAPI=TRUE
8630                 save_LIBS=$LIBS
8631                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8632                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8633                 GSSAPI_LIBS=$LIBS
8634                 LIBS=$save_LIBS
8635             fi
8636             ;;
8637         *)
8638             if test "$with_krb5" = "yes"; then
8639                 WITH_KRB5=TRUE
8640                 save_LIBS=$LIBS
8641                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8642                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8643                 KRB5_LIBS=$LIBS
8644                 LIBS=$save_LIBS
8645                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8646                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8647                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8648                 LIBS=$save_LIBS
8649             fi
8650             if test "$with_gssapi" = "yes"; then
8651                 WITH_GSSAPI=TRUE
8652                 save_LIBS=$LIBS
8653                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8654                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8655                 LIBS=$save_LIBS
8656                 GSSAPI_LIBS=$LIBS
8657             fi
8658         esac
8660         if test -n "$with_libpq_path"; then
8661             SYSTEM_POSTGRESQL=TRUE
8662             postgres_interface="external libpq"
8663             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
8664             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
8665         else
8666             SYSTEM_POSTGRESQL=
8667             postgres_interface="internal"
8668             POSTGRESQL_LIB=""
8669             POSTGRESQL_INC="%OVERRIDE_ME%"
8670             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
8671         fi
8672     fi
8674     AC_MSG_CHECKING([PostgreSQL C interface])
8675     AC_MSG_RESULT([$postgres_interface])
8677     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
8678         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
8679         save_CFLAGS=$CFLAGS
8680         save_CPPFLAGS=$CPPFLAGS
8681         save_LIBS=$LIBS
8682         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
8683         LIBS="${LIBS} ${POSTGRESQL_LIB}"
8684         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
8685         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
8686             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
8687         CFLAGS=$save_CFLAGS
8688         CPPFLAGS=$save_CPPFLAGS
8689         LIBS=$save_LIBS
8690     fi
8691     BUILD_POSTGRESQL_SDBC=TRUE
8692 else
8693     AC_MSG_RESULT([no])
8695 AC_SUBST(WITH_KRB5)
8696 AC_SUBST(WITH_GSSAPI)
8697 AC_SUBST(GSSAPI_LIBS)
8698 AC_SUBST(KRB5_LIBS)
8699 AC_SUBST(BUILD_POSTGRESQL_SDBC)
8700 AC_SUBST(SYSTEM_POSTGRESQL)
8701 AC_SUBST(POSTGRESQL_INC)
8702 AC_SUBST(POSTGRESQL_LIB)
8704 dnl ===================================================================
8705 dnl Check for Firebird stuff
8706 dnl ===================================================================
8707 ENABLE_FIREBIRD_SDBC=""
8708 if test "$enable_firebird_sdbc" = "yes" ; then
8709     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
8711     dnl ===================================================================
8712     dnl Check for system Firebird
8713     dnl ===================================================================
8714     AC_MSG_CHECKING([which Firebird to use])
8715     if test "$with_system_firebird" = "yes"; then
8716         AC_MSG_RESULT([external])
8717         SYSTEM_FIREBIRD=TRUE
8718         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
8719         if test -z "$FIREBIRDCONFIG"; then
8720             AC_MSG_NOTICE([No fb_config -- using pkg-config])
8721             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
8722                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
8723             ])
8724             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
8725         else
8726             AC_MSG_NOTICE([fb_config found])
8727             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
8728             AC_MSG_CHECKING([for Firebird Client library])
8729             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
8730             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
8731             FilterLibs "${FIREBIRD_LIBS}"
8732             FIREBIRD_LIBS="${filteredlibs}"
8733         fi
8734         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
8735         AC_MSG_CHECKING([Firebird version])
8736         if test -n "${FIREBIRD_VERSION}"; then
8737             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
8738             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
8739             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
8740                 AC_MSG_RESULT([OK])
8741             else
8742                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
8743             fi
8744         else
8745             __save_CFLAGS="${CFLAGS}"
8746             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
8747             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
8748 #if defined(FB_API_VER) && FB_API_VER == 30
8749 int fb_api_is_30(void) { return 0; }
8750 #else
8751 #error "Wrong Firebird API version"
8752 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
8753             CFLAGS="${__save_CFLAGS}"
8754         fi
8755         ENABLE_FIREBIRD_SDBC="TRUE"
8756     elif test "$enable_database_connectivity" != yes; then
8757         AC_MSG_RESULT([none])
8758     elif test "$cross_compiling" = "yes"; then
8759         AC_MSG_RESULT([none])
8760     else
8761         dnl Embedded Firebird has version 3.0
8762         AC_DEFINE(HAVE_FIREBIRD_30, 1)
8763         dnl We need libatomic-ops for any non X86/X64 system
8764         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
8765             dnl ===================================================================
8766             dnl Check for system libatomic-ops
8767             dnl ===================================================================
8768             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
8769             if test "$with_system_libatomic_ops" = "yes"; then
8770                 SYSTEM_LIBATOMIC_OPS=TRUE
8771                 AC_CHECK_HEADERS(atomic_ops.h, [],
8772                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic-ops)], [])
8773             else
8774                 SYSTEM_LIBATOMIC_OPS=
8775                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
8776                 LIBATOMIC_OPS_LIBS="-latomic_ops"
8777                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
8778             fi
8779         fi
8781         AC_MSG_RESULT([internal])
8782         SYSTEM_FIREBIRD=
8783         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
8784         FIREBIRD_LIBS="-lfbclient"
8786         if test "$with_system_libtommath" = "yes"; then
8787             SYSTEM_LIBTOMMATH=TRUE
8788             dnl check for tommath presence
8789             save_LIBS=$LIBS
8790             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
8791             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
8792             LIBS=$save_LIBS
8793         else
8794             SYSTEM_LIBTOMMATH=
8795             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
8796             LIBTOMMATH_LIBS="-ltommath"
8797             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
8798         fi
8800         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
8801         ENABLE_FIREBIRD_SDBC="TRUE"
8802         AC_DEFINE(ENABLE_FIREBIRD_SDBC)
8803     fi
8805 AC_SUBST(ENABLE_FIREBIRD_SDBC)
8806 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
8807 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
8808 AC_SUBST(LIBATOMIC_OPS_LIBS)
8809 AC_SUBST(SYSTEM_FIREBIRD)
8810 AC_SUBST(FIREBIRD_CFLAGS)
8811 AC_SUBST(FIREBIRD_LIBS)
8812 AC_SUBST([TOMMATH_CFLAGS])
8813 AC_SUBST([TOMMATH_LIBS])
8815 dnl ===================================================================
8816 dnl Check for system curl
8817 dnl ===================================================================
8818 AC_MSG_CHECKING([which libcurl to use])
8819 if test "$with_system_curl" = "auto"; then
8820     with_system_curl="$with_system_libs"
8823 if test "$with_system_curl" = "yes"; then
8824     AC_MSG_RESULT([external])
8825     SYSTEM_CURL=TRUE
8827     # First try PKGCONFIG and then fall back
8828     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
8830     if test -n "$CURL_PKG_ERRORS"; then
8831         AC_PATH_PROG(CURLCONFIG, curl-config)
8832         if test -z "$CURLCONFIG"; then
8833             AC_MSG_ERROR([curl development files not found])
8834         fi
8835         CURL_LIBS=`$CURLCONFIG --libs`
8836         FilterLibs "${CURL_LIBS}"
8837         CURL_LIBS="${filteredlibs}"
8838         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
8839         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
8841         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
8842         case $curl_version in
8843         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
8844         dnl so they need to be doubled to end up in the configure script
8845         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
8846             AC_MSG_RESULT([yes])
8847             ;;
8848         *)
8849             AC_MSG_ERROR([no, you have $curl_version])
8850             ;;
8851         esac
8852     fi
8854     ENABLE_CURL=TRUE
8855 elif test $_os = iOS; then
8856     # Let's see if we need curl, I think not?
8857     AC_MSG_RESULT([none])
8858     ENABLE_CURL=
8859 else
8860     AC_MSG_RESULT([internal])
8861     SYSTEM_CURL=
8862     BUILD_TYPE="$BUILD_TYPE CURL"
8863     ENABLE_CURL=TRUE
8865 AC_SUBST(SYSTEM_CURL)
8866 AC_SUBST(CURL_CFLAGS)
8867 AC_SUBST(CURL_LIBS)
8868 AC_SUBST(ENABLE_CURL)
8870 dnl ===================================================================
8871 dnl Check for system boost
8872 dnl ===================================================================
8873 AC_MSG_CHECKING([which boost to use])
8874 if test "$with_system_boost" = "yes"; then
8875     AC_MSG_RESULT([external])
8876     SYSTEM_BOOST=TRUE
8877     AX_BOOST_BASE(1.47)
8878     AX_BOOST_DATE_TIME
8879     AX_BOOST_FILESYSTEM
8880     AX_BOOST_IOSTREAMS
8881     AX_BOOST_LOCALE
8882     AC_LANG_PUSH([C++])
8883     save_CXXFLAGS=$CXXFLAGS
8884     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
8885     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
8886        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
8887     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
8888        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
8889     CXXFLAGS=$save_CXXFLAGS
8890     AC_LANG_POP([C++])
8891     # this is in m4/ax_boost_base.m4
8892     FilterLibs "${BOOST_LDFLAGS}"
8893     BOOST_LDFLAGS="${filteredlibs}"
8894 else
8895     AC_MSG_RESULT([internal])
8896     BUILD_TYPE="$BUILD_TYPE BOOST"
8897     SYSTEM_BOOST=
8898     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
8899         # use warning-suppressing wrapper headers
8900         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
8901     else
8902         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
8903     fi
8905 AC_SUBST(SYSTEM_BOOST)
8907 dnl ===================================================================
8908 dnl Check for system mdds
8909 dnl ===================================================================
8910 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.4 >= 1.4.1], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
8912 dnl ===================================================================
8913 dnl Check for system glm
8914 dnl ===================================================================
8915 AC_MSG_CHECKING([which glm to use])
8916 if test "$with_system_glm" = "yes"; then
8917     AC_MSG_RESULT([external])
8918     SYSTEM_GLM=TRUE
8919     AC_LANG_PUSH([C++])
8920     AC_CHECK_HEADER([glm/glm.hpp], [],
8921        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
8922     AC_LANG_POP([C++])
8923 else
8924     AC_MSG_RESULT([internal])
8925     BUILD_TYPE="$BUILD_TYPE GLM"
8926     SYSTEM_GLM=
8927     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
8929 AC_SUBST([GLM_CFLAGS])
8930 AC_SUBST([SYSTEM_GLM])
8932 dnl ===================================================================
8933 dnl Check for system odbc
8934 dnl ===================================================================
8935 AC_MSG_CHECKING([which odbc headers to use])
8936 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
8937     AC_MSG_RESULT([external])
8938     SYSTEM_ODBC_HEADERS=TRUE
8940     if test "$build_os" = "cygwin"; then
8941         save_CPPFLAGS=$CPPFLAGS
8942         find_winsdk
8943         PathFormat "$winsdktest"
8944         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"
8945         AC_CHECK_HEADER(sqlext.h, [],
8946             [AC_MSG_ERROR(odbc not found. install odbc)],
8947             [#include <windows.h>])
8948         CPPFLAGS=$save_CPPFLAGS
8949     else
8950         AC_CHECK_HEADER(sqlext.h, [],
8951             [AC_MSG_ERROR(odbc not found. install odbc)],[])
8952     fi
8953 elif test "$enable_database_connectivity" != yes; then
8954     AC_MSG_RESULT([none])
8955 else
8956     AC_MSG_RESULT([internal])
8957     SYSTEM_ODBC_HEADERS=
8959 AC_SUBST(SYSTEM_ODBC_HEADERS)
8962 dnl ===================================================================
8963 dnl Check for system openldap
8964 dnl ===================================================================
8966 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
8967 AC_MSG_CHECKING([which openldap library to use])
8968 if test "$with_system_openldap" = "yes"; then
8969     AC_MSG_RESULT([external])
8970     SYSTEM_OPENLDAP=TRUE
8971     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
8972     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8973     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
8974 else
8975     AC_MSG_RESULT([internal])
8976     SYSTEM_OPENLDAP=
8977     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
8980 AC_SUBST(SYSTEM_OPENLDAP)
8982 dnl ===================================================================
8983 dnl Check for system NSS
8984 dnl ===================================================================
8985 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
8986     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
8987     AC_DEFINE(HAVE_FEATURE_NSS)
8988     ENABLE_NSS="TRUE"
8989     AC_DEFINE(ENABLE_NSS)
8990 elif test $_os != iOS ; then
8991     with_tls=openssl
8993 AC_SUBST(ENABLE_NSS)
8995 dnl ===================================================================
8996 dnl Check for TLS/SSL and cryptographic implementation to use
8997 dnl ===================================================================
8998 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
8999 if test -n "$with_tls"; then
9000     case $with_tls in
9001     openssl)
9002         AC_DEFINE(USE_TLS_OPENSSL)
9003         TLS=OPENSSL
9005         if test "$enable_openssl" != "yes"; then
9006             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9007         fi
9009         # warn that OpenSSL has been selected but not all TLS code has this option
9010         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9011         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9012         ;;
9013     nss)
9014         AC_DEFINE(USE_TLS_NSS)
9015         TLS=NSS
9016         ;;
9017     no)
9018         AC_MSG_WARN([Skipping TLS/SSL])
9019         ;;
9020     *)
9021         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9022 openssl - OpenSSL
9023 nss - Mozilla's Network Security Services (NSS)
9024     ])
9025         ;;
9026     esac
9027 else
9028     # default to using NSS, it results in smaller oox lib
9029     AC_DEFINE(USE_TLS_NSS)
9030     TLS=NSS
9032 AC_MSG_RESULT([$TLS])
9033 AC_SUBST(TLS)
9035 dnl ===================================================================
9036 dnl Check for system sane
9037 dnl ===================================================================
9038 AC_MSG_CHECKING([which sane header to use])
9039 if test "$with_system_sane" = "yes"; then
9040     AC_MSG_RESULT([external])
9041     AC_CHECK_HEADER(sane/sane.h, [],
9042       [AC_MSG_ERROR(sane not found. install sane)], [])
9043 else
9044     AC_MSG_RESULT([internal])
9045     BUILD_TYPE="$BUILD_TYPE SANE"
9048 dnl ===================================================================
9049 dnl Check for system icu
9050 dnl ===================================================================
9051 SYSTEM_GENBRK=
9052 SYSTEM_GENCCODE=
9053 SYSTEM_GENCMN=
9055 ICU_MAJOR=62
9056 ICU_MINOR=1
9057 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9058 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9059 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9060 AC_MSG_CHECKING([which icu to use])
9061 if test "$with_system_icu" = "yes"; then
9062     AC_MSG_RESULT([external])
9063     SYSTEM_ICU=TRUE
9064     AC_LANG_PUSH([C++])
9065     AC_MSG_CHECKING([for unicode/rbbi.h])
9066     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
9067     AC_LANG_POP([C++])
9069     if test "$cross_compiling" != "yes"; then
9070         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9071         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9072         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9073         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9074     fi
9076     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9077         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9078         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9079         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9080         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9081         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9082             AC_MSG_RESULT([yes])
9083         else
9084             AC_MSG_RESULT([no])
9085             if test "$with_system_icu_for_build" != "force"; then
9086                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9087 You can use --with-system-icu-for-build=force to use it anyway.])
9088             fi
9089         fi
9090     fi
9092     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9093         # using the system icu tools can lead to version confusion, use the
9094         # ones from the build environment when cross-compiling
9095         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9096         if test -z "$SYSTEM_GENBRK"; then
9097             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9098         fi
9099         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9100         if test -z "$SYSTEM_GENCCODE"; then
9101             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9102         fi
9103         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9104         if test -z "$SYSTEM_GENCMN"; then
9105             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9106         fi
9107         if test "$ICU_MAJOR" -ge "49"; then
9108             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9109             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9110             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9111         else
9112             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9113             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9114             ICU_RECLASSIFIED_HEBREW_LETTER=
9115         fi
9116     fi
9118     if test "$cross_compiling" = "yes"; then
9119         if test "$ICU_MAJOR" -ge "50"; then
9120             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9121             ICU_MINOR=""
9122         fi
9123     fi
9124 else
9125     AC_MSG_RESULT([internal])
9126     SYSTEM_ICU=
9127     BUILD_TYPE="$BUILD_TYPE ICU"
9128     # surprisingly set these only for "internal" (to be used by various other
9129     # external libs): the system icu-config is quite unhelpful and spits out
9130     # dozens of weird flags and also default path -I/usr/include
9131     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9132     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9134 if test "$ICU_MAJOR" -ge "59"; then
9135     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9136     # with -std=c++11 but not all external libraries can be built with that,
9137     # for those use a bit-compatible typedef uint16_t UChar; see
9138     # icu/source/common/unicode/umachine.h
9139     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9140 else
9141     ICU_UCHAR_TYPE=""
9143 AC_SUBST(SYSTEM_ICU)
9144 AC_SUBST(SYSTEM_GENBRK)
9145 AC_SUBST(SYSTEM_GENCCODE)
9146 AC_SUBST(SYSTEM_GENCMN)
9147 AC_SUBST(ICU_MAJOR)
9148 AC_SUBST(ICU_MINOR)
9149 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9150 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9151 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9152 AC_SUBST(ICU_CFLAGS)
9153 AC_SUBST(ICU_LIBS)
9154 AC_SUBST(ICU_UCHAR_TYPE)
9156 dnl ==================================================================
9157 dnl Breakpad
9158 dnl ==================================================================
9159 AC_MSG_CHECKING([whether to enable breakpad])
9160 if test "$enable_breakpad" != yes; then
9161     AC_MSG_RESULT([no])
9162 else
9163     AC_MSG_RESULT([yes])
9164     ENABLE_BREAKPAD="TRUE"
9165     AC_DEFINE(ENABLE_BREAKPAD)
9166     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9167     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9169     AC_MSG_CHECKING([for crashreport config])
9170     if test "$with_symbol_config" = "no"; then
9171         BREAKPAD_SYMBOL_CONFIG="invalid"
9172         AC_MSG_RESULT([no])
9173     else
9174         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9175         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9176         AC_MSG_RESULT([yes])
9177     fi
9178     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9180 AC_SUBST(ENABLE_BREAKPAD)
9182 dnl ==================================================================
9183 dnl libfuzzer
9184 dnl ==================================================================
9185 AC_MSG_CHECKING([whether to enable fuzzers])
9186 if test "$enable_fuzzers" != yes; then
9187     AC_MSG_RESULT([no])
9188 else
9189     AC_MSG_RESULT([yes])
9190     ENABLE_FUZZERS="TRUE"
9191     AC_DEFINE(ENABLE_FUZZERS)
9192     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9194 AC_SUBST(ENABLE_FUZZERS)
9196 dnl ===================================================================
9197 dnl Orcus
9198 dnl ===================================================================
9199 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.14 >= 0.14.0])
9200 if test "$with_system_orcus" != "yes"; then
9201     if test "$SYSTEM_BOOST" = "TRUE"; then
9202         # ===========================================================
9203         # Determine if we are going to need to link with Boost.System
9204         # ===========================================================
9205         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9206         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9207         dnl in documentation has no effect.
9208         AC_MSG_CHECKING([if we need to link with Boost.System])
9209         AC_LANG_PUSH([C++])
9210         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9211                 @%:@include <boost/version.hpp>
9212             ]],[[
9213                 #if BOOST_VERSION >= 105000
9214                 #   error yes, we need to link with Boost.System
9215                 #endif
9216             ]])],[
9217                 AC_MSG_RESULT([no])
9218             ],[
9219                 AC_MSG_RESULT([yes])
9220                 AX_BOOST_SYSTEM
9221         ])
9222         AC_LANG_POP([C++])
9223     fi
9225 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9226 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9227 AC_SUBST([BOOST_SYSTEM_LIB])
9228 AC_SUBST(SYSTEM_LIBORCUS)
9230 dnl ===================================================================
9231 dnl HarfBuzz
9232 dnl ===================================================================
9233 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9234                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9235                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9237 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9238                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9239                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9241 if test "$COM" = "MSC"; then # override the above
9242     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9243     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9246 if test "$with_system_harfbuzz" = "yes"; then
9247     if test "$with_system_graphite" = "no"; then
9248         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9249     fi
9250     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9251     _save_libs="$LIBS"
9252     _save_cflags="$CFLAGS"
9253     LIBS="$LIBS $HARFBUZZ_LIBS"
9254     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9255     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9256     LIBS="$_save_libs"
9257     CFLAGS="$_save_cflags"
9258 else
9259     if test "$with_system_graphite" = "yes"; then
9260         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9261     fi
9264 AC_MSG_CHECKING([whether to use X11])
9265 dnl ***************************************
9266 dnl testing for X libraries and includes...
9267 dnl ***************************************
9268 if test "$USING_X11" = TRUE; then
9269     AC_DEFINE(HAVE_FEATURE_X11)
9271 AC_MSG_RESULT([$USING_X11])
9273 if test "$USING_X11" = TRUE; then
9274     AC_PATH_X
9275     AC_PATH_XTRA
9276     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9278     if test -z "$x_includes"; then
9279         x_includes="default_x_includes"
9280     fi
9281     if test -z "$x_libraries"; then
9282         x_libraries="default_x_libraries"
9283     fi
9284     CFLAGS="$CFLAGS $X_CFLAGS"
9285     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9286     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9287 else
9288     x_includes="no_x_includes"
9289     x_libraries="no_x_libraries"
9292 if test "$USING_X11" = TRUE; then
9293     dnl ===================================================================
9294     dnl Check for extension headers
9295     dnl ===================================================================
9296     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9297      [#include <X11/extensions/shape.h>])
9299     # vcl needs ICE and SM
9300     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9301     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9302         [AC_MSG_ERROR(ICE library not found)])
9303     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9304     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9305         [AC_MSG_ERROR(SM library not found)])
9308 dnl ===================================================================
9309 dnl Check for system Xrender
9310 dnl ===================================================================
9311 AC_MSG_CHECKING([whether to use Xrender])
9312 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9313     AC_MSG_RESULT([yes])
9314     PKG_CHECK_MODULES(XRENDER, xrender)
9315     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9316     FilterLibs "${XRENDER_LIBS}"
9317     XRENDER_LIBS="${filteredlibs}"
9318     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9319       [AC_MSG_ERROR(libXrender not found or functional)], [])
9320     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9321       [AC_MSG_ERROR(Xrender not found. install X)], [])
9322 else
9323     AC_MSG_RESULT([no])
9325 AC_SUBST(XRENDER_CFLAGS)
9326 AC_SUBST(XRENDER_LIBS)
9328 dnl ===================================================================
9329 dnl Check for XRandr
9330 dnl ===================================================================
9331 AC_MSG_CHECKING([whether to enable RandR support])
9332 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9333     AC_MSG_RESULT([yes])
9334     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9335     if test "$ENABLE_RANDR" != "TRUE"; then
9336         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9337                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9338         XRANDR_CFLAGS=" "
9339         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9340           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9341         XRANDR_LIBS="-lXrandr "
9342         ENABLE_RANDR="TRUE"
9343     fi
9344     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9345     FilterLibs "${XRANDR_LIBS}"
9346     XRANDR_LIBS="${filteredlibs}"
9347 else
9348     ENABLE_RANDR=""
9349     AC_MSG_RESULT([no])
9351 AC_SUBST(XRANDR_CFLAGS)
9352 AC_SUBST(XRANDR_LIBS)
9353 AC_SUBST(ENABLE_RANDR)
9355 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9356     WITH_WEBDAV="serf"
9358 if test $_os = iOS -o $_os = Android; then
9359     WITH_WEBDAV="no"
9361 AC_MSG_CHECKING([for webdav library])
9362 case "$WITH_WEBDAV" in
9363 serf)
9364     AC_MSG_RESULT([serf])
9365     # Check for system apr-util
9366     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9367                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9368                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9369     if test "$COM" = "MSC"; then
9370         APR_LIB_DIR="LibR"
9371         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9372         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9373     fi
9375     # Check for system serf
9376     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9377                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9378     if test "$COM" = "MSC"; then
9379         SERF_LIB_DIR="Release"
9380         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9381         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9382     fi
9383     ;;
9384 neon)
9385     AC_MSG_RESULT([neon])
9386     # Check for system neon
9387     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9388     if test "$with_system_neon" = "yes"; then
9389         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9390     else
9391         NEON_VERSION=0295
9392     fi
9393     AC_SUBST(NEON_VERSION)
9394     ;;
9396     AC_MSG_RESULT([none, disabled])
9397     WITH_WEBDAV=""
9398     ;;
9399 esac
9400 AC_SUBST(WITH_WEBDAV)
9402 dnl ===================================================================
9403 dnl Check for disabling cve_tests
9404 dnl ===================================================================
9405 AC_MSG_CHECKING([whether to execute CVE tests])
9406 # If not explicitly enabled or disabled, default
9407 if test -z "$enable_cve_tests"; then
9408     case "$OS" in
9409     WNT)
9410         # Default cves off for windows with its wild and wonderful
9411         # varienty of AV software kicking in and panicking
9412         enable_cve_tests=no
9413         ;;
9414     *)
9415         # otherwise yes
9416         enable_cve_tests=yes
9417         ;;
9418     esac
9420 if test "$enable_cve_tests" = "no"; then
9421     AC_MSG_RESULT([no])
9422     DISABLE_CVE_TESTS=TRUE
9423     AC_SUBST(DISABLE_CVE_TESTS)
9424 else
9425     AC_MSG_RESULT([yes])
9428 dnl ===================================================================
9429 dnl Check for enabling chart XShape tests
9430 dnl ===================================================================
9431 AC_MSG_CHECKING([whether to execute chart XShape tests])
9432 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9433     AC_MSG_RESULT([yes])
9434     ENABLE_CHART_TESTS=TRUE
9435     AC_SUBST(ENABLE_CHART_TESTS)
9436 else
9437     AC_MSG_RESULT([no])
9440 dnl ===================================================================
9441 dnl Check for system openssl
9442 dnl ===================================================================
9443 DISABLE_OPENSSL=
9444 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9445 if test "$enable_openssl" = "yes"; then
9446     AC_MSG_RESULT([no])
9447     if test "$_os" = Darwin ; then
9448         # OpenSSL is deprecated when building for 10.7 or later.
9449         #
9450         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9451         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9453         with_system_openssl=no
9454         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9455     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9456             && test "$with_system_openssl" != "no"; then
9457         with_system_openssl=yes
9458         SYSTEM_OPENSSL=TRUE
9459         OPENSSL_CFLAGS=
9460         OPENSSL_LIBS="-lssl -lcrypto"
9461     else
9462         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9463     fi
9464     if test "$with_system_openssl" = "yes"; then
9465         AC_MSG_CHECKING([whether openssl supports SHA512])
9466         AC_LANG_PUSH([C])
9467         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9468             SHA512_CTX context;
9469 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9470         AC_LANG_POP(C)
9471     fi
9472 else
9473     AC_MSG_RESULT([yes])
9474     DISABLE_OPENSSL=TRUE
9476     # warn that although OpenSSL is disabled, system libraries may depend on it
9477     AC_MSG_WARN([OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies])
9478     add_warning "OpenSSL has been disabled. No code compiled by LibO will make use of it but system librares may create indirect dependencies"
9481 AC_SUBST([DISABLE_OPENSSL])
9483 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9484     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9485         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9486         enable_cipher_openssl_backend=no
9487     else
9488         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9489     fi
9491 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9492 ENABLE_CIPHER_OPENSSL_BACKEND=
9493 if test "$enable_cipher_openssl_backend" = yes; then
9494     AC_MSG_RESULT([yes])
9495     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9496 else
9497     AC_MSG_RESULT([no])
9499 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9501 dnl ===================================================================
9502 dnl Check for building gnutls
9503 dnl ===================================================================
9504 AC_MSG_CHECKING([whether to use gnutls])
9505 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9506     AC_MSG_RESULT([yes])
9507     AM_PATH_LIBGCRYPT()
9508     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9509         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9510                       available in the system to use as replacement.]]))
9511     FilterLibs "${LIBGCRYPT_LIBS}"
9512     LIBGCRYPT_LIBS="${filteredlibs}"
9513 else
9514     AC_MSG_RESULT([no])
9517 AC_SUBST([LIBGCRYPT_CFLAGS])
9518 AC_SUBST([LIBGCRYPT_LIBS])
9520 dnl ===================================================================
9521 dnl Check for system redland
9522 dnl ===================================================================
9523 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9524 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9525 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9526 if test "$with_system_redland" = "yes"; then
9527     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9528             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9529 else
9530     RAPTOR_MAJOR="0"
9531     RASQAL_MAJOR="3"
9532     REDLAND_MAJOR="0"
9534 AC_SUBST(RAPTOR_MAJOR)
9535 AC_SUBST(RASQAL_MAJOR)
9536 AC_SUBST(REDLAND_MAJOR)
9538 dnl ===================================================================
9539 dnl Check for system hunspell
9540 dnl ===================================================================
9541 AC_MSG_CHECKING([which libhunspell to use])
9542 if test "$with_system_hunspell" = "yes"; then
9543     AC_MSG_RESULT([external])
9544     SYSTEM_HUNSPELL=TRUE
9545     AC_LANG_PUSH([C++])
9546     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9547     if test "$HUNSPELL_PC" != "TRUE"; then
9548         AC_CHECK_HEADER(hunspell.hxx, [],
9549             [
9550             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9551             [AC_MSG_ERROR(hunspell headers not found.)], [])
9552             ], [])
9553         AC_CHECK_LIB([hunspell], [main], [:],
9554            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9555         HUNSPELL_LIBS=-lhunspell
9556     fi
9557     AC_LANG_POP([C++])
9558     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9559     FilterLibs "${HUNSPELL_LIBS}"
9560     HUNSPELL_LIBS="${filteredlibs}"
9561 else
9562     AC_MSG_RESULT([internal])
9563     SYSTEM_HUNSPELL=
9564     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9565     if test "$COM" = "MSC"; then
9566         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9567     else
9568         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.6"
9569     fi
9570     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9572 AC_SUBST(SYSTEM_HUNSPELL)
9573 AC_SUBST(HUNSPELL_CFLAGS)
9574 AC_SUBST(HUNSPELL_LIBS)
9576 dnl ===================================================================
9577 dnl Checking for altlinuxhyph
9578 dnl ===================================================================
9579 AC_MSG_CHECKING([which altlinuxhyph to use])
9580 if test "$with_system_altlinuxhyph" = "yes"; then
9581     AC_MSG_RESULT([external])
9582     SYSTEM_HYPH=TRUE
9583     AC_CHECK_HEADER(hyphen.h, [],
9584        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
9585     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
9586        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
9587        [#include <hyphen.h>])
9588     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
9589         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9590     if test -z "$HYPHEN_LIB"; then
9591         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
9592            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9593     fi
9594     if test -z "$HYPHEN_LIB"; then
9595         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
9596            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
9597     fi
9598 else
9599     AC_MSG_RESULT([internal])
9600     SYSTEM_HYPH=
9601     BUILD_TYPE="$BUILD_TYPE HYPHEN"
9602     if test "$COM" = "MSC"; then
9603         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
9604     else
9605         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
9606     fi
9608 AC_SUBST(SYSTEM_HYPH)
9609 AC_SUBST(HYPHEN_LIB)
9611 dnl ===================================================================
9612 dnl Checking for mythes
9613 dnl ===================================================================
9614 AC_MSG_CHECKING([which mythes to use])
9615 if test "$with_system_mythes" = "yes"; then
9616     AC_MSG_RESULT([external])
9617     SYSTEM_MYTHES=TRUE
9618     AC_LANG_PUSH([C++])
9619     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
9620     if test "$MYTHES_PKGCONFIG" = "no"; then
9621         AC_CHECK_HEADER(mythes.hxx, [],
9622             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
9623         AC_CHECK_LIB([mythes-1.2], [main], [:],
9624             [ MYTHES_FOUND=no], [])
9625     if test "$MYTHES_FOUND" = "no"; then
9626         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
9627                 [ MYTHES_FOUND=no], [])
9628     fi
9629     if test "$MYTHES_FOUND" = "no"; then
9630         AC_MSG_ERROR([mythes library not found!.])
9631     fi
9632     fi
9633     AC_LANG_POP([C++])
9634     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9635     FilterLibs "${MYTHES_LIBS}"
9636     MYTHES_LIBS="${filteredlibs}"
9637 else
9638     AC_MSG_RESULT([internal])
9639     SYSTEM_MYTHES=
9640     BUILD_TYPE="$BUILD_TYPE MYTHES"
9641     if test "$COM" = "MSC"; then
9642         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
9643     else
9644         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
9645     fi
9647 AC_SUBST(SYSTEM_MYTHES)
9648 AC_SUBST(MYTHES_CFLAGS)
9649 AC_SUBST(MYTHES_LIBS)
9651 dnl ===================================================================
9652 dnl How should we build the linear programming solver ?
9653 dnl ===================================================================
9655 ENABLE_COINMP=
9656 AC_MSG_CHECKING([whether to build with CoinMP])
9657 if test "$enable_coinmp" != "no"; then
9658     ENABLE_COINMP=TRUE
9659     AC_MSG_RESULT([yes])
9660     if test "$with_system_coinmp" = "yes"; then
9661         SYSTEM_COINMP=TRUE
9662         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
9663         FilterLibs "${COINMP_LIBS}"
9664         COINMP_LIBS="${filteredlibs}"
9665     else
9666         BUILD_TYPE="$BUILD_TYPE COINMP"
9667     fi
9668 else
9669     AC_MSG_RESULT([no])
9671 AC_SUBST(ENABLE_COINMP)
9672 AC_SUBST(SYSTEM_COINMP)
9673 AC_SUBST(COINMP_CFLAGS)
9674 AC_SUBST(COINMP_LIBS)
9676 ENABLE_LPSOLVE=
9677 AC_MSG_CHECKING([whether to build with lpsolve])
9678 if test "$enable_lpsolve" != "no"; then
9679     ENABLE_LPSOLVE=TRUE
9680     AC_MSG_RESULT([yes])
9681 else
9682     AC_MSG_RESULT([no])
9684 AC_SUBST(ENABLE_LPSOLVE)
9686 if test "$ENABLE_LPSOLVE" = TRUE; then
9687     AC_MSG_CHECKING([which lpsolve to use])
9688     if test "$with_system_lpsolve" = "yes"; then
9689         AC_MSG_RESULT([external])
9690         SYSTEM_LPSOLVE=TRUE
9691         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
9692            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
9693         save_LIBS=$LIBS
9694         # some systems need this. Like Ubuntu....
9695         AC_CHECK_LIB(m, floor)
9696         AC_CHECK_LIB(dl, dlopen)
9697         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
9698             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
9699         LIBS=$save_LIBS
9700     else
9701         AC_MSG_RESULT([internal])
9702         SYSTEM_LPSOLVE=
9703         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
9704     fi
9706 AC_SUBST(SYSTEM_LPSOLVE)
9708 dnl ===================================================================
9709 dnl Checking for libexttextcat
9710 dnl ===================================================================
9711 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
9712 if test "$with_system_libexttextcat" = "yes"; then
9713     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
9715 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
9717 dnl ===================================================================
9718 dnl Checking for libnumbertext
9719 dnl ===================================================================
9720 AC_MSG_CHECKING([whether to use libnumbertext])
9721 if test "$enable_libnumbertext" = "no"; then
9722     AC_MSG_RESULT([no])
9723     ENABLE_LIBNUMBERTEXT=
9724     SYSTEM_LIBNUMBERTEXT=
9725 else
9726     AC_MSG_RESULT([yes])
9727     ENABLE_LIBNUMBERTEXT=TRUE
9728     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
9729     if test "$with_system_libnumbertext" = "yes"; then
9730         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
9731         SYSTEM_LIBNUMBERTEXT=YES
9732     else
9733         SYSTEM_LIBNUMBERTEXT=
9734         AC_LANG_PUSH([C++])
9735         save_CPPFLAGS=$CPPFLAGS
9736         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
9737         AC_CHECK_HEADERS([codecvt regex])
9738         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
9739                 [ ENABLE_LIBNUMBERTEXT=''
9740                   LIBNUMBERTEXT_CFLAGS=''
9741                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
9742                                Enable libnumbertext fallback (missing number to number name conversion).])
9743                 ])
9744         CPPFLAGS=$save_CPPFLAGS
9745         AC_LANG_POP([C++])
9746     fi
9747     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
9748         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
9749     fi
9751 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
9752 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
9753 AC_SUBST(ENABLE_LIBNUMBERTEXT)
9754 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
9756 dnl ***************************************
9757 dnl testing libc version for Linux...
9758 dnl ***************************************
9759 if test "$_os" = "Linux"; then
9760     AC_MSG_CHECKING([whether libc is >= 2.1.1])
9761     exec 6>/dev/null # no output
9762     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
9763     exec 6>&1 # output on again
9764     if test "$HAVE_LIBC"; then
9765         AC_MSG_RESULT([yes])
9766     else
9767         AC_MSG_ERROR([no, upgrade libc])
9768     fi
9771 dnl =========================================
9772 dnl Check for uuidgen
9773 dnl =========================================
9774 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
9775     # presence is already tested above in the WINDOWS_SDK_HOME check
9776     UUIDGEN=uuidgen.exe
9777     AC_SUBST(UUIDGEN)
9778 else
9779     AC_PATH_PROG([UUIDGEN], [uuidgen])
9780     if test -z "$UUIDGEN"; then
9781         AC_MSG_WARN([uuid is needed for building installation sets])
9782     fi
9785 dnl ***************************************
9786 dnl Checking for bison and flex
9787 dnl ***************************************
9788 AC_PATH_PROG(BISON, bison)
9789 if test -z "$BISON"; then
9790     AC_MSG_ERROR([no bison found in \$PATH, install it])
9791 else
9792     AC_MSG_CHECKING([the bison version])
9793     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
9794     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
9795     # Accept newer than 2.0
9796     if test "$_bison_longver" -lt 2000; then
9797         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
9798     fi
9801 AC_PATH_PROG(FLEX, flex)
9802 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9803     FLEX=`cygpath -m $FLEX`
9805 if test -z "$FLEX"; then
9806     AC_MSG_ERROR([no flex found in \$PATH, install it])
9807 else
9808     AC_MSG_CHECKING([the flex version])
9809     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
9810     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2005035; then
9811         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.5.35)])
9812     fi
9814 AC_SUBST([FLEX])
9815 dnl ***************************************
9816 dnl Checking for patch
9817 dnl ***************************************
9818 AC_PATH_PROG(PATCH, patch)
9819 if test -z "$PATCH"; then
9820     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
9823 dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
9824 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
9825     if test -z "$with_gnu_patch"; then
9826         GNUPATCH=$PATCH
9827     else
9828         if test -x "$with_gnu_patch"; then
9829             GNUPATCH=$with_gnu_patch
9830         else
9831             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
9832         fi
9833     fi
9835     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
9836     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
9837         AC_MSG_RESULT([yes])
9838     else
9839         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
9840     fi
9841 else
9842     GNUPATCH=$PATCH
9845 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9846     GNUPATCH=`cygpath -m $GNUPATCH`
9849 dnl We also need to check for --with-gnu-cp
9851 if test -z "$with_gnu_cp"; then
9852     # check the place where the good stuff is hidden on Solaris...
9853     if test -x /usr/gnu/bin/cp; then
9854         GNUCP=/usr/gnu/bin/cp
9855     else
9856         AC_PATH_PROGS(GNUCP, gnucp cp)
9857     fi
9858     if test -z $GNUCP; then
9859         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
9860     fi
9861 else
9862     if test -x "$with_gnu_cp"; then
9863         GNUCP=$with_gnu_cp
9864     else
9865         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
9866     fi
9869 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
9870     GNUCP=`cygpath -m $GNUCP`
9873 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
9874 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
9875     AC_MSG_RESULT([yes])
9876 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
9877     AC_MSG_RESULT([yes])
9878 else
9879     case "$build_os" in
9880     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
9881         x_GNUCP=[\#]
9882         GNUCP=''
9883         AC_MSG_RESULT([no gnucp found - using the system's cp command])
9884         ;;
9885     *)
9886         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
9887         ;;
9888     esac
9891 AC_SUBST(GNUPATCH)
9892 AC_SUBST(GNUCP)
9893 AC_SUBST(x_GNUCP)
9895 dnl ***************************************
9896 dnl testing assembler path
9897 dnl ***************************************
9898 ML_EXE=""
9899 if test "$_os" = "WINNT"; then
9900     if test "$BITNESS_OVERRIDE" = ""; then
9901         assembler=ml.exe
9902         assembler_bin=$CL_DIR
9903     else
9904         assembler=ml64.exe
9905         assembler_bin=$CL_DIR
9906     fi
9908     AC_MSG_CHECKING([$VC_PRODUCT_DIR/$assembler_bin/$assembler])
9909     if test -f "$VC_PRODUCT_DIR/$assembler_bin/$assembler"; then
9910         ASM_HOME=$VC_PRODUCT_DIR/$assembler_bin
9911         AC_MSG_RESULT([found])
9912         ML_EXE="$VC_PRODUCT_DIR/$assembler_bin/$assembler"
9913     else
9914         AC_MSG_ERROR([Configure did not find $assembler assembler.])
9915     fi
9917     PathFormat "$ASM_HOME"
9918     ASM_HOME="$formatted_path"
9919 else
9920     ASM_HOME=""
9923 AC_SUBST(ML_EXE)
9925 dnl ===================================================================
9926 dnl We need zip and unzip
9927 dnl ===================================================================
9928 AC_PATH_PROG(ZIP, zip)
9929 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
9930 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
9931     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],,)
9934 AC_PATH_PROG(UNZIP, unzip)
9935 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
9937 dnl ===================================================================
9938 dnl Zip must be a specific type for different build types.
9939 dnl ===================================================================
9940 if test $build_os = cygwin; then
9941     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
9942         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
9943     fi
9946 dnl ===================================================================
9947 dnl We need touch with -h option support.
9948 dnl ===================================================================
9949 AC_PATH_PROG(TOUCH, touch)
9950 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
9951 touch warn
9952 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
9953     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],,)
9956 dnl ===================================================================
9957 dnl Check for system epoxy
9958 dnl ===================================================================
9959 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
9961 dnl ===================================================================
9962 dnl Set vcl option: coordinate device in double or sal_Int32
9963 dnl ===================================================================
9965 dnl disabled for now, we don't want subtle differences between OSs
9966 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
9967 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
9968 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
9969 dnl     AC_MSG_RESULT([double])
9970 dnl else
9971 dnl     AC_MSG_RESULT([sal_Int32])
9972 dnl fi
9974 dnl ===================================================================
9975 dnl Test which vclplugs have to be built.
9976 dnl ===================================================================
9977 R=""
9978 if test "$USING_X11" != TRUE; then
9979     enable_gtk=no
9980     enable_gtk3=no
9982 GTK3_CFLAGS=""
9983 GTK3_LIBS=""
9984 ENABLE_GTK3=""
9985 if test "x$enable_gtk3" = "xyes"; then
9986     if test "$with_system_cairo" = no; then
9987         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
9988     fi
9989     : ${with_system_cairo:=yes}
9990     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="")
9991     if test "x$ENABLE_GTK3" = "xTRUE"; then
9992         R="gtk3"
9993         dnl Avoid installed by unpackaged files for now.
9994         if test -z "$PKGFORMAT"; then
9995             GOBJECT_INTROSPECTION_CHECK(INTROSPECTION_REQUIRED_VERSION)
9996         fi
9997     else
9998         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
9999     fi
10000     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10001     FilterLibs "${GTK3_LIBS}"
10002     GTK3_LIBS="${filteredlibs}"
10004     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10005     if test "$with_system_epoxy" != "yes"; then
10006         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10007         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10008                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10009     fi
10011 AC_SUBST(GTK3_LIBS)
10012 AC_SUBST(GTK3_CFLAGS)
10013 AC_SUBST(ENABLE_GTK3)
10015 ENABLE_GTK=""
10016 if test "x$enable_gtk" = "xyes"; then
10017     if test "$with_system_cairo" = no; then
10018         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10019     fi
10020     : ${with_system_cairo:=yes}
10021     ENABLE_GTK="TRUE"
10022     AC_DEFINE(ENABLE_GTK)
10023     R="gtk $R"
10025 AC_SUBST(ENABLE_GTK)
10027 ENABLE_KDE4=""
10028 if test "x$enable_kde4" = "xyes"; then
10029     ENABLE_KDE4="TRUE"
10030     AC_DEFINE(ENABLE_KDE4)
10031     R="$R kde4"
10033 AC_SUBST(ENABLE_KDE4)
10035 ENABLE_QT5=""
10036 if test "x$enable_qt5" = "xyes"; then
10037     ENABLE_QT5="TRUE"
10038     AC_DEFINE(ENABLE_QT5)
10039     R="$R qt5"
10041 AC_SUBST(ENABLE_QT5)
10043 ENABLE_KDE5=""
10044 if test "x$enable_kde5" = "xyes"; then
10045     ENABLE_KDE5="TRUE"
10046     AC_DEFINE(ENABLE_KDE5)
10047     R="$R kde5"
10049 AC_SUBST(ENABLE_KDE5)
10051 ENABLE_GTK3_KDE5=""
10052 if test "x$enable_gtk3_kde5" = "xyes"; then
10053     ENABLE_GTK3_KDE5="TRUE"
10054     AC_DEFINE(ENABLE_GTK3_KDE5)
10055     R="$R gtk3_kde5"
10057 AC_SUBST(ENABLE_GTK3_KDE5)
10059 build_vcl_plugins="$R"
10060 if test -z "$build_vcl_plugins"; then
10061     build_vcl_plugins="none"
10063 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10065 dnl ===================================================================
10066 dnl check for dbus support
10067 dnl ===================================================================
10068 ENABLE_DBUS=""
10069 DBUS_CFLAGS=""
10070 DBUS_LIBS=""
10071 DBUS_GLIB_CFLAGS=""
10072 DBUS_GLIB_LIBS=""
10073 DBUS_HAVE_GLIB=""
10075 if test "$enable_dbus" = "no"; then
10076     test_dbus=no
10079 AC_MSG_CHECKING([whether to enable DBUS support])
10080 if test "$test_dbus" = "yes"; then
10081     ENABLE_DBUS="TRUE"
10082     AC_MSG_RESULT([yes])
10083     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10084     AC_DEFINE(ENABLE_DBUS)
10085     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10086     FilterLibs "${DBUS_LIBS}"
10087     DBUS_LIBS="${filteredlibs}"
10089     # Glib is needed for BluetoothServer
10090     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10091     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10092         [
10093             DBUS_HAVE_GLIB="TRUE"
10094             AC_DEFINE(DBUS_HAVE_GLIB,1)
10095         ],
10096         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10097     )
10098 else
10099     AC_MSG_RESULT([no])
10102 AC_SUBST(ENABLE_DBUS)
10103 AC_SUBST(DBUS_CFLAGS)
10104 AC_SUBST(DBUS_LIBS)
10105 AC_SUBST(DBUS_GLIB_CFLAGS)
10106 AC_SUBST(DBUS_GLIB_LIBS)
10107 AC_SUBST(DBUS_HAVE_GLIB)
10109 AC_MSG_CHECKING([whether to enable Impress remote control])
10110 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10111     AC_MSG_RESULT([yes])
10112     ENABLE_SDREMOTE=TRUE
10113     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10115     # If not explicitly enabled or disabled, default
10116     if test -z "$enable_sdremote_bluetooth"; then
10117         case "$OS" in
10118         LINUX|MACOSX|WNT)
10119             # Default to yes for these
10120             enable_sdremote_bluetooth=yes
10121             ;;
10122         *)
10123             # otherwise no
10124             enable_sdremote_bluetooth=no
10125             ;;
10126         esac
10127     fi
10128     # $enable_sdremote_bluetooth is guaranteed non-empty now
10130     if test "$enable_sdremote_bluetooth" != "no"; then
10131         if test "$OS" = "LINUX"; then
10132             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10133                 AC_MSG_RESULT([yes])
10134                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10135                 dnl ===================================================================
10136                 dnl Check for system bluez
10137                 dnl ===================================================================
10138                 AC_MSG_CHECKING([which Bluetooth header to use])
10139                 if test "$with_system_bluez" = "yes"; then
10140                     AC_MSG_RESULT([external])
10141                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10142                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10143                     SYSTEM_BLUEZ=TRUE
10144                 else
10145                     AC_MSG_RESULT([internal])
10146                     SYSTEM_BLUEZ=
10147                 fi
10148             else
10149                 AC_MSG_RESULT([no, dbus disabled])
10150                 ENABLE_SDREMOTE_BLUETOOTH=
10151                 SYSTEM_BLUEZ=
10152             fi
10153         else
10154             AC_MSG_RESULT([yes])
10155             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10156             SYSTEM_BLUEZ=
10157         fi
10158     else
10159         AC_MSG_RESULT([no])
10160         ENABLE_SDREMOTE_BLUETOOTH=
10161         SYSTEM_BLUEZ=
10162     fi
10163 else
10164     ENABLE_SDREMOTE=
10165     SYSTEM_BLUEZ=
10166     AC_MSG_RESULT([no])
10168 AC_SUBST(ENABLE_SDREMOTE)
10169 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10170 AC_SUBST(SYSTEM_BLUEZ)
10172 dnl ===================================================================
10173 dnl Check whether the gtk 2.0 libraries are available.
10174 dnl ===================================================================
10176 GTK_CFLAGS=""
10177 GTK_LIBS=""
10178 if test  "$test_gtk" = "yes"; then
10180     if test "$ENABLE_GTK" = "TRUE"; then
10181         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]))
10182         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10183         FilterLibs "${GTK_LIBS}"
10184         GTK_LIBS="${filteredlibs}"
10185         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]))
10186         BUILD_TYPE="$BUILD_TYPE GTK"
10187         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10188         FilterLibs "${GTHREAD_LIBS}"
10189         GTHREAD_LIBS="${filteredlibs}"
10191         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10192         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10193                           [ENABLE_GTK_PRINT="TRUE"],
10194                           [ENABLE_GTK_PRINT=""])
10195         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10196         FilterLibs "${GTK_PRINT_LIBS}"
10197         GTK_PRINT_LIBS="${filteredlibs}"
10198     fi
10200     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10201         AC_MSG_CHECKING([whether to enable GIO support])
10202         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10203             dnl Need at least 2.26 for the dbus support.
10204             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10205                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10206             if test "$ENABLE_GIO" = "TRUE"; then
10207                 AC_DEFINE(ENABLE_GIO)
10208                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10209                 FilterLibs "${GIO_LIBS}"
10210                 GIO_LIBS="${filteredlibs}"
10211             fi
10212         else
10213             AC_MSG_RESULT([no])
10214         fi
10215     fi
10217 AC_SUBST(ENABLE_GIO)
10218 AC_SUBST(GIO_CFLAGS)
10219 AC_SUBST(GIO_LIBS)
10220 AC_SUBST(GTK_CFLAGS)
10221 AC_SUBST(GTK_LIBS)
10222 AC_SUBST(GTHREAD_CFLAGS)
10223 AC_SUBST(GTHREAD_LIBS)
10224 AC_SUBST([ENABLE_GTK_PRINT])
10225 AC_SUBST([GTK_PRINT_CFLAGS])
10226 AC_SUBST([GTK_PRINT_LIBS])
10229 dnl ===================================================================
10231 SPLIT_APP_MODULES=""
10232 if test "$enable_split_app_modules" = "yes"; then
10233     SPLIT_APP_MODULES="TRUE"
10235 AC_SUBST(SPLIT_APP_MODULES)
10237 SPLIT_OPT_FEATURES=""
10238 if test "$enable_split_opt_features" = "yes"; then
10239     SPLIT_OPT_FEATURES="TRUE"
10241 AC_SUBST(SPLIT_OPT_FEATURES)
10243 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10244     if test "$enable_cairo_canvas" = yes; then
10245         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10246     fi
10247     enable_cairo_canvas=no
10248 elif test -z "$enable_cairo_canvas"; then
10249     enable_cairo_canvas=yes
10252 ENABLE_CAIRO_CANVAS=""
10253 if test "$enable_cairo_canvas" = "yes"; then
10254     test_cairo=yes
10255     ENABLE_CAIRO_CANVAS="TRUE"
10256     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10258 AC_SUBST(ENABLE_CAIRO_CANVAS)
10260 dnl ===================================================================
10261 dnl Check whether the GStreamer libraries are available.
10262 dnl It's possible to build avmedia with both GStreamer backends!
10263 dnl ===================================================================
10265 ENABLE_GSTREAMER_1_0=""
10267 if test "$build_gstreamer_1_0" = "yes"; then
10269     AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend])
10270     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10271         ENABLE_GSTREAMER_1_0="TRUE"
10272         AC_MSG_RESULT([yes])
10273         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10274         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10275         FilterLibs "${GSTREAMER_1_0_LIBS}"
10276         GSTREAMER_1_0_LIBS="${filteredlibs}"
10277     else
10278         AC_MSG_RESULT([no])
10279     fi
10281 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10282 AC_SUBST(GSTREAMER_1_0_LIBS)
10283 AC_SUBST(ENABLE_GSTREAMER_1_0)
10286 ENABLE_GSTREAMER_0_10=""
10287 if test "$build_gstreamer_0_10" = "yes"; then
10289     AC_MSG_CHECKING([whether to enable the GStreamer 0.10 avmedia backend])
10290     if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then
10291         ENABLE_GSTREAMER_0_10="TRUE"
10292         AC_MSG_RESULT([yes])
10293         PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [
10294             PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] )
10295         ])
10296         GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10297         FilterLibs "${GSTREAMER_0_10_LIBS}"
10298         GSTREAMER_0_10_LIBS="${filteredlibs}"
10299     else
10300         AC_MSG_RESULT([no])
10301     fi
10304 AC_SUBST(GSTREAMER_0_10_CFLAGS)
10305 AC_SUBST(GSTREAMER_0_10_LIBS)
10306 AC_SUBST(ENABLE_GSTREAMER_0_10)
10308 dnl ===================================================================
10309 dnl Check whether to build the VLC avmedia backend
10310 dnl ===================================================================
10312 ENABLE_VLC=""
10314 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10315 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10316     ENABLE_VLC="TRUE"
10317     AC_MSG_RESULT([yes])
10318 else
10319     AC_MSG_RESULT([no])
10321 AC_SUBST(ENABLE_VLC)
10323 ENABLE_OPENGL_TRANSITIONS=
10324 ENABLE_OPENGL_CANVAS=
10325 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10326    : # disable
10327 elif test "$_os" = "Darwin"; then
10328     # We use frameworks on Mac OS X, no need for detail checks
10329     ENABLE_OPENGL_TRANSITIONS=TRUE
10330     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10331     ENABLE_OPENGL_CANVAS=TRUE
10332 elif test $_os = WINNT; then
10333     ENABLE_OPENGL_TRANSITIONS=TRUE
10334     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10335     ENABLE_OPENGL_CANVAS=TRUE
10336 else
10337     if test "$USING_X11" = TRUE; then
10338         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10339         ENABLE_OPENGL_TRANSITIONS=TRUE
10340         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10341         ENABLE_OPENGL_CANVAS=TRUE
10342     fi
10345 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10346 AC_SUBST(ENABLE_OPENGL_CANVAS)
10348 dnl =================================================
10349 dnl Check whether to build with OpenCL support.
10350 dnl =================================================
10352 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10353     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10354     # platform (optional at run-time, used through clew).
10355     BUILD_TYPE="$BUILD_TYPE OPENCL"
10356     AC_DEFINE(HAVE_FEATURE_OPENCL)
10359 dnl =================================================
10360 dnl Check whether to build with dconf support.
10361 dnl =================================================
10363 if test "$enable_dconf" != no; then
10364     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10365         if test "$enable_dconf" = yes; then
10366             AC_MSG_ERROR([dconf not found])
10367         else
10368             enable_dconf=no
10369         fi])
10371 AC_MSG_CHECKING([whether to enable dconf])
10372 if test "$enable_dconf" = no; then
10373     DCONF_CFLAGS=
10374     DCONF_LIBS=
10375     ENABLE_DCONF=
10376     AC_MSG_RESULT([no])
10377 else
10378     ENABLE_DCONF=TRUE
10379     AC_DEFINE(ENABLE_DCONF)
10380     AC_MSG_RESULT([yes])
10382 AC_SUBST([DCONF_CFLAGS])
10383 AC_SUBST([DCONF_LIBS])
10384 AC_SUBST([ENABLE_DCONF])
10386 # pdf import?
10387 AC_MSG_CHECKING([whether to build the PDF import feature])
10388 ENABLE_PDFIMPORT=
10389 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10390     AC_MSG_RESULT([yes])
10391     ENABLE_PDFIMPORT=TRUE
10392     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10394     dnl ===================================================================
10395     dnl Check for system poppler
10396     dnl ===================================================================
10397     AC_MSG_CHECKING([which PDF import backend to use])
10398     if test "$with_system_poppler" = "yes"; then
10399         AC_MSG_RESULT([external])
10400         SYSTEM_POPPLER=TRUE
10401         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10402         AC_LANG_PUSH([C++])
10403         save_CXXFLAGS=$CXXFLAGS
10404         save_CPPFLAGS=$CPPFLAGS
10405         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10406         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10407         AC_CHECK_HEADER([cpp/poppler-version.h],
10408             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10409             [])
10410         CXXFLAGS=$save_CXXFLAGS
10411         CPPFLAGS=$save_CPPFLAGS
10412         AC_LANG_POP([C++])
10413         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10415         FilterLibs "${POPPLER_LIBS}"
10416         POPPLER_LIBS="${filteredlibs}"
10417     else
10418         AC_MSG_RESULT([internal])
10419         SYSTEM_POPPLER=
10420         BUILD_TYPE="$BUILD_TYPE POPPLER"
10421         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10422     fi
10423     AC_DEFINE([ENABLE_PDFIMPORT],1)
10424 else
10425     AC_MSG_RESULT([no])
10427 AC_SUBST(ENABLE_PDFIMPORT)
10428 AC_SUBST(SYSTEM_POPPLER)
10429 AC_SUBST(POPPLER_CFLAGS)
10430 AC_SUBST(POPPLER_LIBS)
10432 # pdf import?
10433 AC_MSG_CHECKING([whether to build PDFium])
10434 ENABLE_PDFIUM=
10435 if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then
10436     AC_MSG_RESULT([yes])
10437     ENABLE_PDFIUM=TRUE
10438     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10439     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10440 else
10441     AC_MSG_RESULT([no])
10443 AC_SUBST(ENABLE_PDFIUM)
10445 SYSTEM_GPGMEPP=
10447 if test "$build_for_ios" = "YES"; then
10448     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10449     AC_MSG_RESULT([yes])
10450 elif test "$enable_mpl_subset" = "yes"; then
10451     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10452     AC_MSG_RESULT([yes])
10453 elif test "$enable_fuzzers" = "yes"; then
10454     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10455     AC_MSG_RESULT([yes])
10456 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10457     dnl ===================================================================
10458     dnl Check for system gpgme
10459     dnl ===================================================================
10460     AC_MSG_CHECKING([which gpgmepp to use])
10461     if test "$with_system_gpgmepp" = "yes"; then
10462         AC_MSG_RESULT([external])
10463         SYSTEM_GPGMEPP=TRUE
10465         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10466         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10467             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10468         # progress_callback is the only func with plain C linkage
10469         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10470         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10471             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10472         AC_CHECK_HEADER(gpgme.h, [],
10473             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10474     else
10475         AC_MSG_RESULT([internal])
10476         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10477         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10479         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10480         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10481         if test "$_os" != "WINNT"; then
10482             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10483             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10484         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10485             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10486         fi
10487     fi
10488     ENABLE_GPGMEPP=TRUE
10489     AC_DEFINE([HAVE_FEATURE_GPGME])
10490     AC_PATH_PROG(GPG, gpg)
10491     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10492     # so let's exclude that manually for the moment
10493     if test -n "$GPG" -a "$_os" != "WINNT"; then
10494         # make sure we not only have a working gpgme, but a full working
10495         # gpg installation to run OpenPGP signature verification
10496         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10497     fi
10498     if test "$_os" = "Linux"; then
10499       uid=`id -u`
10500       AC_MSG_CHECKING([for /run/user/$uid])
10501       if test -d /run/user/$uid; then
10502         AC_MSG_RESULT([yes])
10503         AC_PATH_PROG(GPGCONF, gpgconf)
10504         AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10505         if $GPGCONF --dump-options > /dev/null ; then
10506           if $GPGCONF --dump-options | grep -q create-socketdir ; then
10507             AC_MSG_RESULT([yes])
10508             AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10509           else
10510             AC_MSG_RESULT([no])
10511           fi
10512         else
10513           AC_MSG_RESULT([no. missing or broken gpgconf?])
10514         fi
10515       else
10516         AC_MSG_RESULT([no])
10517      fi
10518    fi
10520 AC_SUBST(ENABLE_GPGMEPP)
10521 AC_SUBST(SYSTEM_GPGMEPP)
10522 AC_SUBST(GPG_ERROR_CFLAGS)
10523 AC_SUBST(GPG_ERROR_LIBS)
10524 AC_SUBST(LIBASSUAN_CFLAGS)
10525 AC_SUBST(LIBASSUAN_LIBS)
10526 AC_SUBST(GPGMEPP_CFLAGS)
10527 AC_SUBST(GPGMEPP_LIBS)
10528 AC_SUBST(GPGCONF)
10529 AC_SUBST(HAVE_GPGCONF_SOCKETDIR)
10531 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10532 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10533     AC_MSG_RESULT([yes])
10534     ENABLE_MEDIAWIKI=TRUE
10535     BUILD_TYPE="$BUILD_TYPE XSLTML"
10536     if test  "x$with_java" = "xno"; then
10537         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10538     fi
10539 else
10540     AC_MSG_RESULT([no])
10541     ENABLE_MEDIAWIKI=
10542     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10544 AC_SUBST(ENABLE_MEDIAWIKI)
10546 AC_MSG_CHECKING([whether to build the Report Builder])
10547 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10548     AC_MSG_RESULT([yes])
10549     ENABLE_REPORTBUILDER=TRUE
10550     AC_MSG_CHECKING([which jfreereport libs to use])
10551     if test "$with_system_jfreereport" = "yes"; then
10552         SYSTEM_JFREEREPORT=TRUE
10553         AC_MSG_RESULT([external])
10554         if test -z $SAC_JAR; then
10555             SAC_JAR=/usr/share/java/sac.jar
10556         fi
10557         if ! test -f $SAC_JAR; then
10558              AC_MSG_ERROR(sac.jar not found.)
10559         fi
10561         if test -z $LIBXML_JAR; then
10562             if test -f /usr/share/java/libxml-1.0.0.jar; then
10563                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
10564             elif test -f /usr/share/java/libxml.jar; then
10565                 LIBXML_JAR=/usr/share/java/libxml.jar
10566             else
10567                 AC_MSG_ERROR(libxml.jar replacement not found.)
10568             fi
10569         elif ! test -f $LIBXML_JAR; then
10570             AC_MSG_ERROR(libxml.jar not found.)
10571         fi
10573         if test -z $FLUTE_JAR; then
10574             if test -f/usr/share/java/flute-1.3.0.jar; then
10575                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
10576             elif test -f /usr/share/java/flute.jar; then
10577                 FLUTE_JAR=/usr/share/java/flute.jar
10578             else
10579                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
10580             fi
10581         elif ! test -f $FLUTE_JAR; then
10582             AC_MSG_ERROR(flute-1.3.0.jar not found.)
10583         fi
10585         if test -z $JFREEREPORT_JAR; then
10586             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
10587                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
10588             elif test -f /usr/share/java/flow-engine.jar; then
10589                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
10590             else
10591                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
10592             fi
10593         elif ! test -f  $JFREEREPORT_JAR; then
10594                 AC_MSG_ERROR(jfreereport.jar not found.)
10595         fi
10597         if test -z $LIBLAYOUT_JAR; then
10598             if test -f /usr/share/java/liblayout-0.2.9.jar; then
10599                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
10600             elif test -f /usr/share/java/liblayout.jar; then
10601                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
10602             else
10603                 AC_MSG_ERROR(liblayout.jar replacement not found.)
10604             fi
10605         elif ! test -f $LIBLAYOUT_JAR; then
10606                 AC_MSG_ERROR(liblayout.jar not found.)
10607         fi
10609         if test -z $LIBLOADER_JAR; then
10610             if test -f /usr/share/java/libloader-1.0.0.jar; then
10611                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
10612             elif test -f /usr/share/java/libloader.jar; then
10613                 LIBLOADER_JAR=/usr/share/java/libloader.jar
10614             else
10615                 AC_MSG_ERROR(libloader.jar replacement not found.)
10616             fi
10617         elif ! test -f  $LIBLOADER_JAR; then
10618             AC_MSG_ERROR(libloader.jar not found.)
10619         fi
10621         if test -z $LIBFORMULA_JAR; then
10622             if test -f /usr/share/java/libformula-0.2.0.jar; then
10623                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
10624             elif test -f /usr/share/java/libformula.jar; then
10625                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
10626             else
10627                 AC_MSG_ERROR(libformula.jar replacement not found.)
10628             fi
10629         elif ! test -f $LIBFORMULA_JAR; then
10630                 AC_MSG_ERROR(libformula.jar not found.)
10631         fi
10633         if test -z $LIBREPOSITORY_JAR; then
10634             if test -f /usr/share/java/librepository-1.0.0.jar; then
10635                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
10636             elif test -f /usr/share/java/librepository.jar; then
10637                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
10638             else
10639                 AC_MSG_ERROR(librepository.jar replacement not found.)
10640             fi
10641         elif ! test -f $LIBREPOSITORY_JAR; then
10642             AC_MSG_ERROR(librepository.jar not found.)
10643         fi
10645         if test -z $LIBFONTS_JAR; then
10646             if test -f /usr/share/java/libfonts-1.0.0.jar; then
10647                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
10648             elif test -f /usr/share/java/libfonts.jar; then
10649                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
10650             else
10651                 AC_MSG_ERROR(libfonts.jar replacement not found.)
10652             fi
10653         elif ! test -f $LIBFONTS_JAR; then
10654                 AC_MSG_ERROR(libfonts.jar not found.)
10655         fi
10657         if test -z $LIBSERIALIZER_JAR; then
10658             if test -f /usr/share/java/libserializer-1.0.0.jar; then
10659                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
10660             elif test -f /usr/share/java/libserializer.jar; then
10661                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
10662             else
10663                 AC_MSG_ERROR(libserializer.jar replacement not found.)
10664             fi
10665         elif ! test -f $LIBSERIALIZER_JAR; then
10666                 AC_MSG_ERROR(libserializer.jar not found.)
10667         fi
10669         if test -z $LIBBASE_JAR; then
10670             if test -f /usr/share/java/libbase-1.0.0.jar; then
10671                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
10672             elif test -f /usr/share/java/libbase.jar; then
10673                 LIBBASE_JAR=/usr/share/java/libbase.jar
10674             else
10675                 AC_MSG_ERROR(libbase.jar replacement not found.)
10676             fi
10677         elif ! test -f $LIBBASE_JAR; then
10678             AC_MSG_ERROR(libbase.jar not found.)
10679         fi
10681     else
10682         AC_MSG_RESULT([internal])
10683         SYSTEM_JFREEREPORT=
10684         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
10685         NEED_ANT=TRUE
10686     fi
10687 else
10688     AC_MSG_RESULT([no])
10689     ENABLE_REPORTBUILDER=
10690     SYSTEM_JFREEREPORT=
10692 AC_SUBST(ENABLE_REPORTBUILDER)
10693 AC_SUBST(SYSTEM_JFREEREPORT)
10694 AC_SUBST(SAC_JAR)
10695 AC_SUBST(LIBXML_JAR)
10696 AC_SUBST(FLUTE_JAR)
10697 AC_SUBST(JFREEREPORT_JAR)
10698 AC_SUBST(LIBBASE_JAR)
10699 AC_SUBST(LIBLAYOUT_JAR)
10700 AC_SUBST(LIBLOADER_JAR)
10701 AC_SUBST(LIBFORMULA_JAR)
10702 AC_SUBST(LIBREPOSITORY_JAR)
10703 AC_SUBST(LIBFONTS_JAR)
10704 AC_SUBST(LIBSERIALIZER_JAR)
10706 # this has to be here because both the Wiki Publisher and the SRB use
10707 # commons-logging
10708 COMMONS_LOGGING_VERSION=1.2
10709 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
10710     AC_MSG_CHECKING([which Apache commons-* libs to use])
10711     if test "$with_system_apache_commons" = "yes"; then
10712         SYSTEM_APACHE_COMMONS=TRUE
10713         AC_MSG_RESULT([external])
10714         if test -z $COMMONS_LOGGING_JAR; then
10715             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
10716                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
10717            elif test -f /usr/share/java/commons-logging.jar; then
10718                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
10719             else
10720                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
10721             fi
10722         elif ! test -f $COMMONS_LOGGING_JAR; then
10723             AC_MSG_ERROR(commons-logging.jar not found.)
10724         fi
10725     else
10726         AC_MSG_RESULT([internal])
10727         SYSTEM_APACHE_COMMONS=
10728         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
10729         NEED_ANT=TRUE
10730     fi
10732 AC_SUBST(SYSTEM_APACHE_COMMONS)
10733 AC_SUBST(COMMONS_LOGGING_JAR)
10734 AC_SUBST(COMMONS_LOGGING_VERSION)
10736 # scripting provider for BeanShell?
10737 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
10738 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
10739     AC_MSG_RESULT([yes])
10740     ENABLE_SCRIPTING_BEANSHELL=TRUE
10742     dnl ===================================================================
10743     dnl Check for system beanshell
10744     dnl ===================================================================
10745     AC_MSG_CHECKING([which beanshell to use])
10746     if test "$with_system_beanshell" = "yes"; then
10747         AC_MSG_RESULT([external])
10748         SYSTEM_BSH=TRUE
10749         if test -z $BSH_JAR; then
10750             BSH_JAR=/usr/share/java/bsh.jar
10751         fi
10752         if ! test -f $BSH_JAR; then
10753             AC_MSG_ERROR(bsh.jar not found.)
10754         fi
10755     else
10756         AC_MSG_RESULT([internal])
10757         SYSTEM_BSH=
10758         BUILD_TYPE="$BUILD_TYPE BSH"
10759     fi
10760 else
10761     AC_MSG_RESULT([no])
10762     ENABLE_SCRIPTING_BEANSHELL=
10763     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
10765 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
10766 AC_SUBST(SYSTEM_BSH)
10767 AC_SUBST(BSH_JAR)
10769 # scripting provider for JavaScript?
10770 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
10771 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
10772     AC_MSG_RESULT([yes])
10773     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
10775     dnl ===================================================================
10776     dnl Check for system rhino
10777     dnl ===================================================================
10778     AC_MSG_CHECKING([which rhino to use])
10779     if test "$with_system_rhino" = "yes"; then
10780         AC_MSG_RESULT([external])
10781         SYSTEM_RHINO=TRUE
10782         if test -z $RHINO_JAR; then
10783             RHINO_JAR=/usr/share/java/js.jar
10784         fi
10785         if ! test -f $RHINO_JAR; then
10786             AC_MSG_ERROR(js.jar not found.)
10787         fi
10788     else
10789         AC_MSG_RESULT([internal])
10790         SYSTEM_RHINO=
10791         BUILD_TYPE="$BUILD_TYPE RHINO"
10792         NEED_ANT=TRUE
10793     fi
10794 else
10795     AC_MSG_RESULT([no])
10796     ENABLE_SCRIPTING_JAVASCRIPT=
10797     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
10799 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
10800 AC_SUBST(SYSTEM_RHINO)
10801 AC_SUBST(RHINO_JAR)
10803 # This is only used in KDE3/KDE4 checks to determine if /usr/lib64
10804 # paths should be added to library search path. So lets put all 64-bit
10805 # platforms there.
10806 supports_multilib=
10807 case "$host_cpu" in
10808 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
10809     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
10810         supports_multilib="yes"
10811     fi
10812     ;;
10814     ;;
10815 esac
10817 dnl ===================================================================
10818 dnl KDE4 Integration
10819 dnl ===================================================================
10821 KDE4_CFLAGS=""
10822 KDE4_LIBS=""
10823 QMAKE4="qmake"
10824 MOC4="moc"
10825 KDE4_GLIB_CFLAGS=""
10826 KDE4_GLIB_LIBS=""
10827 KDE4_HAVE_GLIB=""
10828 if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE"; then
10829     qt4_incdirs="$QT4INC /usr/include/qt4 /usr/include $x_includes"
10830     qt4_libdirs="$QT4LIB /usr/lib/qt4 /usr/lib $x_libraries"
10832     kde4_incdirs="/usr/include /usr/include/kde4 $x_includes"
10833     kde4_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
10835     if test -n "$supports_multilib"; then
10836         qt4_libdirs="$qt4_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
10837         kde4_libdirs="$kde4_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
10838     fi
10840     if test -n "$QTDIR"; then
10841         qt4_incdirs="$QTDIR/include $qt4_incdirs"
10842         if test -z "$supports_multilib"; then
10843             qt4_libdirs="$QTDIR/lib $qt4_libdirs"
10844         else
10845             qt4_libdirs="$QTDIR/lib64 $QTDIR/lib $qt4_libdirs"
10846         fi
10847     fi
10848     if test -n "$QT4DIR"; then
10849         qt4_incdirs="$QT4DIR/include $qt4_incdirs"
10850         if test -z "$supports_multilib"; then
10851             qt4_libdirs="$QT4DIR/lib $qt4_libdirs"
10852         else
10853             qt4_libdirs="$QT4DIR/lib64 $QT4DIR/lib $qt4_libdirs"
10854         fi
10855     fi
10857     if test -n "$KDEDIR"; then
10858         kde4_incdirs="$KDEDIR/include $kde4_incdirs"
10859         if test -z "$supports_multilib"; then
10860             kde4_libdirs="$KDEDIR/lib $kde4_libdirs"
10861         else
10862             kde4_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde4_libdirs"
10863         fi
10864     fi
10865     if test -n "$KDE4DIR"; then
10866         kde4_incdirs="$KDE4DIR/include $KDE4DIR/include/kde4 $kde4_incdirs"
10867         if test -z "$supports_multilib"; then
10868             kde4_libdirs="$KDE4DIR/lib $kde4_libdirs"
10869         else
10870             kde4_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde4_libdirs"
10871         fi
10872     fi
10874     qt4_test_include="Qt/qobject.h"
10875     qt4_test_library="libQtNetwork.so"
10876     kde4_test_include="kwindowsystem.h"
10877     kde4_test_library="libsolid.so"
10879     AC_MSG_CHECKING([for Qt4 headers])
10880     qt4_header_dir="no"
10881     for inc_dir in $qt4_incdirs; do
10882         if test -r "$inc_dir/$qt4_test_include"; then
10883             qt4_header_dir="$inc_dir"
10884             break
10885         fi
10886     done
10888     AC_MSG_RESULT([$qt4_header_dir])
10889     if test "x$qt4_header_dir" = "xno"; then
10890         AC_MSG_ERROR([Qt4 headers not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10891     fi
10893     dnl Check for qmake
10894     AC_PATH_PROGS( QMAKE4, [qmake-qt4 qmake], no, [`dirname $qt4_header_dir`/bin:$QT4DIR/bin:$PATH] )
10895     if test "$QMAKE4" = "no"; then
10896         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10897     else
10898         qmake4_test_ver="`$QMAKE4 -v 2>&1 | sed -n -e '/^Using Qt version 4\./p'`"
10899         if test -z "$qmake4_test_ver"; then
10900             AC_MSG_ERROR([Wrong qmake for Qt4 found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
10901         fi
10902     fi
10904     qt4_libdirs="`$QMAKE4 -query QT_INSTALL_LIBS` $qt4_libdirs"
10905     AC_MSG_CHECKING([for Qt4 libraries])
10906     qt4_lib_dir="no"
10907     for lib_dir in $qt4_libdirs; do
10908         if test -r "$lib_dir/$qt4_test_library"; then
10909             qt4_lib_dir="$lib_dir"
10910             PKG_CONFIG_PATH="$qt4_lib_dir"/pkgconfig:$PKG_CONFIG_PATH
10911             break
10912         fi
10913     done
10915     AC_MSG_RESULT([$qt4_lib_dir])
10917     if test "x$qt4_lib_dir" = "xno"; then
10918         AC_MSG_ERROR([Qt4 libraries not found.  Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
10919     fi
10921     dnl Check for Meta Object Compiler
10923     AC_PATH_PROG( MOCQT4, moc-qt4, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10924     MOC4="$MOCQT4"
10925     if test "$MOC4" = "no"; then
10926         AC_PATH_PROG( MOC4, moc, no, [`dirname $qt4_lib_dir`/bin:$QT4DIR/bin:$PATH] )
10927         if test "$MOC4" = "no"; then
10928             AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
10929 the root of your Qt installation by exporting QT4DIR before running "configure".])
10930         fi
10931     fi
10933     dnl Check for KDE4 headers
10934     AC_MSG_CHECKING([for KDE4 headers])
10935     kde4_incdir="no"
10936     for kde4_check in $kde4_incdirs; do
10937         if test -r "$kde4_check/$kde4_test_include"; then
10938             kde4_incdir="$kde4_check"
10939             break
10940         fi
10941     done
10942     AC_MSG_RESULT([$kde4_incdir])
10943     if test "x$kde4_incdir" = "xno"; then
10944         AC_MSG_ERROR([KDE4 headers not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10945     fi
10946     if test "$kde4_incdir" = "/usr/include"; then kde4_incdir=; fi
10948     dnl Check for KDE4 libraries
10949     AC_MSG_CHECKING([for KDE4 libraries])
10950     kde4_libdir="no"
10951     for kde4_check in $kde4_libdirs; do
10952         if test -r "$kde4_check/$kde4_test_library"; then
10953             kde4_libdir="$kde4_check"
10954             break
10955         fi
10956     done
10958     AC_MSG_RESULT([$kde4_libdir])
10959     if test "x$kde4_libdir" = "xno"; then
10960         AC_MSG_ERROR([KDE4 libraries not found.  Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
10961     fi
10963     PKG_CHECK_MODULES([QT4],[QtNetwork QtGui])
10964     if ! test -z "$kde4_incdir"; then
10965         KDE4_CFLAGS="-I$kde4_incdir $QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10966     else
10967         KDE4_CFLAGS="$QT4_CFLAGS -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
10968     fi
10970     KDE4_LIBS="-L$kde4_libdir -lkio -lkfile -lkdeui -lkdecore -L$qt4_lib_dir $QT4_LIBS"
10971     KDE4_CFLAGS=$(printf '%s' "$KDE4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10972     FilterLibs "$KDE4_LIBS"
10973     KDE4_LIBS="$filteredlibs"
10975     AC_LANG_PUSH([C++])
10976     save_CXXFLAGS=$CXXFLAGS
10977     CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
10978     AC_MSG_CHECKING([whether KDE is >= 4.2])
10979        AC_RUN_IFELSE([AC_LANG_SOURCE([[
10980 #include <kdeversion.h>
10982 int main(int argc, char **argv) {
10983        if (KDE_VERSION_MAJOR == 4 && KDE_VERSION_MINOR >= 2) return 0;
10984        else return 1;
10986 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[AC_MSG_ERROR([KDE support not tested with cross-compilation])])
10987     CXXFLAGS=$save_CXXFLAGS
10988     AC_LANG_POP([C++])
10990     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
10991     # Sets also KDE4_GLIB_CFLAGS/KDE4_GLIB_LIBS if successful.
10992     PKG_CHECK_MODULES(KDE4_GLIB,[glib-2.0 >= 2.4],
10993         [
10994             KDE4_HAVE_GLIB=TRUE
10995             AC_DEFINE(KDE4_HAVE_GLIB,1)
10996             KDE4_GLIB_CFLAGS=$(printf '%s' "$KDE4_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10997             FilterLibs "${KDE4_GLIB_LIBS}"
10998             KDE4_GLIB_LIBS="${filteredlibs}"
11000             qt4_fix_warning=
11002             AC_LANG_PUSH([C++])
11003             # tst_exclude_socket_notifiers.moc:70:28: runtime error: member access within address 0x60d00000bb20 which does not point to an object of type 'QObjectData'
11004             # 0x60d00000bb20: note: object is of type 'QObjectPrivate'
11005             #  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
11006             #               ^~~~~~~~~~~~~~~~~~~~~~~
11007             #               vptr for 'QObjectPrivate'
11008             # so temporarily ignore here whichever way would be used to make such errors fatal
11009             # (-fno-sanitize-recover=... or UBSAN_OPTIONS halt_on_error=1):
11010             save_CXX=$CXX
11011             CXX=$(printf %s "$CXX" \
11012                 | sed -e 's/-fno-sanitize-recover\(=[[0-9A-Za-z,_-]]*\)*//')
11013             save_UBSAN_OPTIONS=$UBSAN_OPTIONS
11014             UBSAN_OPTIONS=$UBSAN_OPTIONS:halt_on_error=0
11015             save_CXXFLAGS=$CXXFLAGS
11016             CXXFLAGS="$CXXFLAGS $KDE4_CFLAGS"
11017             save_LIBS=$LIBS
11018             LIBS="$LIBS $KDE4_LIBS"
11019             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
11021             # Prepare meta object data
11022             TSTBASE="tst_exclude_socket_notifiers"
11023             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11024             ln -fs "${TSTMOC}.hxx"
11025             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11027             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11028 #include <cstdlib>
11029 #include "tst_exclude_socket_notifiers.moc"
11031 int main(int argc, char *argv[])
11033     QCoreApplication app(argc, argv);
11034     exit(tst_processEventsExcludeSocket());
11035     return 0;
11037             ]])],[
11038                 AC_MSG_RESULT([yes])
11039             ],[
11040                 AC_MSG_RESULT([no])
11041                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11042                 if test -z "$qt4_fix_warning"; then
11043                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11044                 fi
11045                 qt4_fix_warning=1
11046                 add_warning "  https://bugreports.qt.io/browse/QTBUG-37380 (needed)"
11047                 ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11049             # Remove meta object data
11050             rm -f "${TSTBASE}."*
11052             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
11054             # Prepare meta object data
11055             TSTBASE="tst_exclude_posted_events"
11056             TSTMOC="${SRC_ROOT}/vcl/unx/kde4/${TSTBASE}"
11057             ln -fs "${TSTMOC}.hxx"
11058             $MOC4 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
11060             AC_RUN_IFELSE([AC_LANG_SOURCE([[
11061 #include <cstdlib>
11062 #include "tst_exclude_posted_events.moc"
11064 int main(int argc, char *argv[])
11066     QCoreApplication app(argc, argv);
11067     exit(tst_excludePostedEvents());
11068     return 0;
11070             ]])],[
11071                 AC_MSG_RESULT([yes])
11072             ],[
11073                 AC_MSG_RESULT([no])
11074                 AC_MSG_WARN([native KDE4 file pickers will be disabled at runtime])
11075                 if test -z "$qt4_fix_warning"; then
11076                     add_warning "native KDE4 file pickers will be disabled at runtime, Qt4 fixes needed"
11077                 fi
11078                 qt4_fix_warning=1
11079                 add_warning "  https://bugreports.qt.io/browse/QTBUG-34614 (needed)"
11080             ],[AC_MSG_ERROR([KDE4 file pickers not tested with cross-compilation])])
11082             # Remove meta object data
11083             rm -f "${TSTBASE}."*
11085             if test -n "$qt4_fix_warning"; then
11086                 add_warning "  https://bugreports.qt.io/browse/QTBUG-38585 (recommended)"
11087             fi
11089             LIBS=$save_LIBS
11090             CXXFLAGS=$save_CXXFLAGS
11091             UBSAN_OPTIONS=$save_UBSAN_OPTIONS
11092             CXX=$save_CXX
11093             AC_LANG_POP([C++])
11094         ],
11095         AC_MSG_WARN([[No Glib found, KDE4 support will not use native file pickers!]]))
11097 AC_SUBST(KDE4_CFLAGS)
11098 AC_SUBST(KDE4_LIBS)
11099 AC_SUBST(MOC4)
11100 AC_SUBST(KDE4_GLIB_CFLAGS)
11101 AC_SUBST(KDE4_GLIB_LIBS)
11102 AC_SUBST(KDE4_HAVE_GLIB)
11104 dnl ===================================================================
11105 dnl QT5 Integration
11106 dnl ===================================================================
11108 QT5_CFLAGS=""
11109 QT5_LIBS=""
11110 QMAKE5="qmake"
11111 MOC5="moc"
11112 QT5_GLIB_CFLAGS=""
11113 QT5_GLIB_LIBS=""
11114 QT5_HAVE_GLIB=""
11115 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11116         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11117         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11118 then
11119     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11120     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11122     if test -n "$supports_multilib"; then
11123         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11124     fi
11126     qt5_test_include="QtWidgets/qapplication.h"
11127     qt5_test_library="libQt5Widgets.so"
11129     dnl Check for qmake5
11130     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11131     if test "$QMAKE5" = "no"; then
11132         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11133     else
11134         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11135         if test -z "$qmake5_test_ver"; then
11136             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11137         fi
11138         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11139         qt5_minimal_minor="6"
11140         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11141             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11142         else
11143             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11144         fi
11145     fi
11147     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11148     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11150     AC_MSG_CHECKING([for Qt5 headers])
11151     qt5_incdir="no"
11152     for inc_dir in $qt5_incdirs; do
11153         if test -r "$inc_dir/$qt5_test_include"; then
11154             qt5_incdir="$inc_dir"
11155             break
11156         fi
11157     done
11158     AC_MSG_RESULT([$qt5_incdir])
11159     if test "x$qt5_incdir" = "xno"; then
11160         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11161     fi
11163     AC_MSG_CHECKING([for Qt5 libraries])
11164     qt5_libdir="no"
11165     for lib_dir in $qt5_libdirs; do
11166         if test -r "$lib_dir/$qt5_test_library"; then
11167             qt5_libdir="$lib_dir"
11168             break
11169         fi
11170     done
11171     AC_MSG_RESULT([$qt5_libdir])
11172     if test "x$qt5_libdir" = "xno"; then
11173         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11174     fi
11176     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
11177     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11178     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11180     dnl Check for Meta Object Compiler
11182     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11183     if test "$MOC5" = "no"; then
11184         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11185 the root of your Qt installation by exporting QT5DIR before running "configure".])
11186     fi
11188     # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
11189     # Sets also QT5_GLIB_CFLAGS/QT5_GLIB_LIBS if successful.
11190     PKG_CHECK_MODULES(QT5_GLIB,[glib-2.0 >= 2.4],
11191         [
11192             QT5_HAVE_GLIB=1
11193             AC_DEFINE(QT5_HAVE_GLIB,1)
11194         ],
11195         AC_MSG_WARN([[No Glib found, Qt5 support will not use native file pickers!]])
11196     )
11198 AC_SUBST(QT5_CFLAGS)
11199 AC_SUBST(QT5_LIBS)
11200 AC_SUBST(MOC5)
11201 AC_SUBST(QT5_GLIB_CFLAGS)
11202 AC_SUBST(QT5_GLIB_LIBS)
11203 AC_SUBST(QT5_HAVE_GLIB)
11205 dnl ===================================================================
11206 dnl KDE5 Integration
11207 dnl ===================================================================
11209 KF5_CFLAGS=""
11210 KF5_LIBS=""
11211 KF5_CONFIG="kf5-config"
11212 if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
11213         \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11214         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11215 then
11216     if test "$OS" = "HAIKU"; then
11217         haiku_arch="`echo $RTL_ARCH | tr X x`"
11218         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11219         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11220     fi
11222     kf5_incdirs="$KF5INC /usr/include/ $kf5_haiku_incdirs $x_includes"
11223     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11224     if test -n "$supports_multilib"; then
11225         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11226     fi
11228     kf5_test_include="KF5/kcoreaddons_version.h"
11229     kf5_test_library="libKF5CoreAddons.so"
11230     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11232     dnl kf5 KDE4 support compatibility installed
11233     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11234     if test "$KF5_CONFIG" != "no"; then
11235         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11236         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11237     fi
11239     dnl Check for KF5 headers
11240     AC_MSG_CHECKING([for KF5 headers])
11241     kf5_incdir="no"
11242     for kf5_check in $kf5_incdirs; do
11243         if test -r "$kf5_check/$kf5_test_include"; then
11244             kf5_incdir="$kf5_check/KF5"
11245             break
11246         fi
11247     done
11248     AC_MSG_RESULT([$kf5_incdir])
11249     if test "x$kf5_incdir" = "xno"; then
11250         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11251     fi
11253     dnl Check for KF5 libraries
11254     AC_MSG_CHECKING([for KF5 libraries])
11255     kf5_libdir="no"
11256     for kf5_check in $kf5_libdirs; do
11257         if test -r "$kf5_check/$kf5_test_library"; then
11258             kf5_libdir="$kf5_check"
11259             break
11260         fi
11261     done
11263     AC_MSG_RESULT([$kf5_libdir])
11264     if test "x$kf5_libdir" = "xno"; then
11265         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11266     fi
11268     if test "$USING_X11" = TRUE; then
11269         PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
11270     fi
11272     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"
11273     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network $KF5_XCB_LIBS"
11274     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11276     if test "$USING_X11" = TRUE; then
11277         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11278     fi
11280     AC_LANG_PUSH([C++])
11281     save_CXXFLAGS=$CXXFLAGS
11282     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11283     AC_MSG_CHECKING([whether KDE is >= 5.0])
11284        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11285 #include <kcoreaddons_version.h>
11287 int main(int argc, char **argv) {
11288        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11289        else return 1;
11291        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11292     CXXFLAGS=$save_CXXFLAGS
11293     AC_LANG_POP([C++])
11295 AC_SUBST(KF5_CFLAGS)
11296 AC_SUBST(KF5_LIBS)
11298 dnl ===================================================================
11299 dnl Test whether to include Evolution 2 support
11300 dnl ===================================================================
11301 AC_MSG_CHECKING([whether to enable evolution 2 support])
11302 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11303     AC_MSG_RESULT([yes])
11304     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11305     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11306     FilterLibs "${GOBJECT_LIBS}"
11307     GOBJECT_LIBS="${filteredlibs}"
11308     ENABLE_EVOAB2="TRUE"
11309 else
11310     ENABLE_EVOAB2=""
11311     AC_MSG_RESULT([no])
11313 AC_SUBST(ENABLE_EVOAB2)
11314 AC_SUBST(GOBJECT_CFLAGS)
11315 AC_SUBST(GOBJECT_LIBS)
11317 dnl ===================================================================
11318 dnl Test which themes to include
11319 dnl ===================================================================
11320 AC_MSG_CHECKING([which themes to include])
11321 # if none given use default subset of available themes
11322 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11323     with_theme="breeze breeze_dark colibre elementary karasa_jaga sifr sifr_dark tango"
11326 WITH_THEMES=""
11327 if test "x$with_theme" != "xno"; then
11328     for theme in $with_theme; do
11329         case $theme in
11330         breeze|breeze_dark|colibre|elementary|karasa_jaga|sifr|sifr_dark|tango) real_theme="$theme" ;;
11331         default) real_theme=colibre ;;
11332         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11333         esac
11334         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11335     done
11337 AC_MSG_RESULT([$WITH_THEMES])
11338 AC_SUBST([WITH_THEMES])
11339 # FIXME: remove this, and the convenience default->colibre remapping after a crace period
11340 for theme in $with_theme; do
11341     case $theme in
11342     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11343     *) ;;
11344     esac
11345 done
11347 dnl ===================================================================
11348 dnl Test whether to integrate helppacks into the product's installer
11349 dnl ===================================================================
11350 AC_MSG_CHECKING([for helppack integration])
11351 if test "$with_helppack_integration" = "no"; then
11352     AC_MSG_RESULT([no integration])
11353 else
11354     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11355     AC_MSG_RESULT([integration])
11358 ###############################################################################
11359 # Extensions checking
11360 ###############################################################################
11361 AC_MSG_CHECKING([for extensions integration])
11362 if test "x$enable_extension_integration" != "xno"; then
11363     WITH_EXTENSION_INTEGRATION=TRUE
11364     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11365     AC_MSG_RESULT([yes, use integration])
11366 else
11367     WITH_EXTENSION_INTEGRATION=
11368     AC_MSG_RESULT([no, do not integrate])
11370 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11372 dnl Should any extra extensions be included?
11373 dnl There are standalone tests for each of these below.
11374 WITH_EXTRA_EXTENSIONS=
11375 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11377 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11378 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11379 if test "x$with_java" != "xno"; then
11380     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11381     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11384 AC_MSG_CHECKING([whether to build opens___.ttf])
11385 if test "$enable_build_opensymbol" = "yes"; then
11386     AC_MSG_RESULT([yes])
11387     AC_PATH_PROG(FONTFORGE, fontforge)
11388     if test -z "$FONTFORGE"; then
11389         AC_MSG_ERROR([fontforge not installed])
11390     fi
11391 else
11392     AC_MSG_RESULT([no])
11393     OPENSYMBOL_TTF=49a64f3bcf20a7909ba2751349231d6652ded9cd2840e961b5164d09de3ffa63-opens___.ttf
11394     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11396 AC_SUBST(OPENSYMBOL_TTF)
11397 AC_SUBST(FONTFORGE)
11399 dnl ===================================================================
11400 dnl Test whether to include fonts
11401 dnl ===================================================================
11402 AC_MSG_CHECKING([whether to include third-party fonts])
11403 if test "$with_fonts" != "no"; then
11404     AC_MSG_RESULT([yes])
11405     WITH_FONTS=TRUE
11406     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11407     AC_DEFINE(HAVE_MORE_FONTS)
11408 else
11409     AC_MSG_RESULT([no])
11410     WITH_FONTS=
11411     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11413 AC_SUBST(WITH_FONTS)
11416 dnl ===================================================================
11417 dnl Test whether to enable online update service
11418 dnl ===================================================================
11419 AC_MSG_CHECKING([whether to enable online update])
11420 ENABLE_ONLINE_UPDATE=
11421 ENABLE_ONLINE_UPDATE_MAR=
11422 UPDATE_CONFIG=
11423 if test "$enable_online_update" = ""; then
11424     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11425         AC_MSG_RESULT([yes])
11426         ENABLE_ONLINE_UPDATE="TRUE"
11427     else
11428         AC_MSG_RESULT([no])
11429     fi
11430 else
11431     if test "$enable_online_update" = "mar"; then
11432         AC_MSG_RESULT([yes - MAR-based online update])
11433         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11434         if test "$with_update_config" = ""; then
11435             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11436         fi
11437         UPDATE_CONFIG="$with_update_config"
11438         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11439     elif test "$enable_online_update" = "yes"; then
11440         AC_MSG_RESULT([yes])
11441         ENABLE_ONLINE_UPDATE="TRUE"
11442     else
11443         AC_MSG_RESULT([no])
11444     fi
11446 AC_SUBST(ENABLE_ONLINE_UPDATE)
11447 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11448 AC_SUBST(UPDATE_CONFIG)
11450 dnl ===================================================================
11451 dnl Test whether we need bzip2
11452 dnl ===================================================================
11453 SYSTEM_BZIP2=
11454 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11455     AC_MSG_CHECKING([whether to use system bzip2])
11456     if test "$with_system_bzip2" = yes; then
11457         SYSTEM_BZIP2=TRUE
11458         AC_MSG_RESULT([yes])
11459         PKG_CHECK_MODULES(BZIP2, bzip2)
11460         FilterLibs "${BZIP2_LIBS}"
11461         BZIP2_LIBS="${filteredlibs}"
11462     else
11463         AC_MSG_RESULT([no])
11464         BUILD_TYPE="$BUILD_TYPE BZIP2"
11465     fi
11467 AC_SUBST(SYSTEM_BZIP2)
11468 AC_SUBST(BZIP2_CFLAGS)
11469 AC_SUBST(BZIP2_LIBS)
11471 dnl ===================================================================
11472 dnl Test whether to enable extension update
11473 dnl ===================================================================
11474 AC_MSG_CHECKING([whether to enable extension update])
11475 ENABLE_EXTENSION_UPDATE=
11476 if test "x$enable_extension_update" = "xno"; then
11477     AC_MSG_RESULT([no])
11478 else
11479     AC_MSG_RESULT([yes])
11480     ENABLE_EXTENSION_UPDATE="TRUE"
11481     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11482     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11484 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11487 dnl ===================================================================
11488 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11489 dnl ===================================================================
11490 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11491 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11492     AC_MSG_RESULT([no])
11493     ENABLE_SILENT_MSI=
11494 else
11495     AC_MSG_RESULT([yes])
11496     ENABLE_SILENT_MSI=TRUE
11497     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11499 AC_SUBST(ENABLE_SILENT_MSI)
11501 AC_MSG_CHECKING([whether and how to use Xinerama])
11502 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11503     if test "$x_libraries" = "default_x_libraries"; then
11504         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11505         if test "x$XINERAMALIB" = x; then
11506            XINERAMALIB="/usr/lib"
11507         fi
11508     else
11509         XINERAMALIB="$x_libraries"
11510     fi
11511     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11512         # we have both versions, let the user decide but use the dynamic one
11513         # per default
11514         USE_XINERAMA=TRUE
11515         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11516             XINERAMA_LINK=dynamic
11517         else
11518             XINERAMA_LINK=static
11519         fi
11520     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11521         # we have only the dynamic version
11522         USE_XINERAMA=TRUE
11523         XINERAMA_LINK=dynamic
11524     elif test -e "$XINERAMALIB/libXinerama.a"; then
11525         # static version
11526         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11527             USE_XINERAMA=TRUE
11528             XINERAMA_LINK=static
11529         else
11530             USE_XINERAMA=
11531             XINERAMA_LINK=none
11532         fi
11533     else
11534         # no Xinerama
11535         USE_XINERAMA=
11536         XINERAMA_LINK=none
11537     fi
11538     if test "$USE_XINERAMA" = "TRUE"; then
11539         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11540         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11541             [AC_MSG_ERROR(Xinerama header not found.)], [])
11542         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11543         if test "x$XEXTLIB" = x; then
11544            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11545         fi
11546         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11547         if test "$_os" = "FreeBSD"; then
11548             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11549         fi
11550         if test "$_os" = "Linux"; then
11551             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11552         fi
11553         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11554             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11555     else
11556         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11557     fi
11558 else
11559     USE_XINERAMA=
11560     XINERAMA_LINK=none
11561     AC_MSG_RESULT([no])
11563 AC_SUBST(USE_XINERAMA)
11564 AC_SUBST(XINERAMA_LINK)
11566 dnl ===================================================================
11567 dnl Test whether to build cairo or rely on the system version
11568 dnl ===================================================================
11570 if test "$USING_X11" = TRUE; then
11571     # Used in vcl/Library_vclplug_gen.mk
11572     test_cairo=yes
11575 if test "$test_cairo" = "yes"; then
11576     AC_MSG_CHECKING([whether to use the system cairo])
11578     : ${with_system_cairo:=$with_system_libs}
11579     if test "$with_system_cairo" = "yes"; then
11580         SYSTEM_CAIRO=TRUE
11581         AC_MSG_RESULT([yes])
11583         PKG_CHECK_MODULES( CAIRO, cairo >= 1.2.0 )
11584         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11585         FilterLibs "${CAIRO_LIBS}"
11586         CAIRO_LIBS="${filteredlibs}"
11588         if test "$test_xrender" = "yes"; then
11589             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11590             AC_LANG_PUSH([C])
11591             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11592 #ifdef PictStandardA8
11593 #else
11594       return fail;
11595 #endif
11596 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11598             AC_LANG_POP([C])
11599         fi
11600     else
11601         SYSTEM_CAIRO=
11602         AC_MSG_RESULT([no])
11604         BUILD_TYPE="$BUILD_TYPE CAIRO"
11605     fi
11608 AC_SUBST(SYSTEM_CAIRO)
11609 AC_SUBST(CAIRO_CFLAGS)
11610 AC_SUBST(CAIRO_LIBS)
11612 dnl ===================================================================
11613 dnl Test whether to use avahi
11614 dnl ===================================================================
11615 if test "$_os" = "WINNT"; then
11616     # Windows uses bundled mDNSResponder
11617     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11618 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11619     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11620                       [ENABLE_AVAHI="TRUE"])
11621     AC_DEFINE(HAVE_FEATURE_AVAHI)
11622     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11623     FilterLibs "${AVAHI_LIBS}"
11624     AVAHI_LIBS="${filteredlibs}"
11627 AC_SUBST(ENABLE_AVAHI)
11628 AC_SUBST(AVAHI_CFLAGS)
11629 AC_SUBST(AVAHI_LIBS)
11631 dnl ===================================================================
11632 dnl Test whether to use liblangtag
11633 dnl ===================================================================
11634 SYSTEM_LIBLANGTAG=
11635 AC_MSG_CHECKING([whether to use system liblangtag])
11636 if test "$with_system_liblangtag" = yes; then
11637     SYSTEM_LIBLANGTAG=TRUE
11638     AC_MSG_RESULT([yes])
11639     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11640     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11641     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11642     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11643     FilterLibs "${LIBLANGTAG_LIBS}"
11644     LIBLANGTAG_LIBS="${filteredlibs}"
11645 else
11646     SYSTEM_LIBLANGTAG=
11647     AC_MSG_RESULT([no])
11648     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11649     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11650     if test "$COM" = "MSC"; then
11651         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11652     else
11653         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11654     fi
11656 AC_SUBST(SYSTEM_LIBLANGTAG)
11657 AC_SUBST(LIBLANGTAG_CFLAGS)
11658 AC_SUBST(LIBLANGTAG_LIBS)
11660 dnl ===================================================================
11661 dnl Test whether to build libpng or rely on the system version
11662 dnl ===================================================================
11664 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11666 dnl ===================================================================
11667 dnl Check for runtime JVM search path
11668 dnl ===================================================================
11669 if test "$ENABLE_JAVA" != ""; then
11670     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11671     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11672         AC_MSG_RESULT([yes])
11673         if ! test -d "$with_jvm_path"; then
11674             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11675         fi
11676         if ! test -d "$with_jvm_path"jvm; then
11677             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11678         fi
11679         JVM_ONE_PATH_CHECK="$with_jvm_path"
11680         AC_SUBST(JVM_ONE_PATH_CHECK)
11681     else
11682         AC_MSG_RESULT([no])
11683     fi
11686 dnl ===================================================================
11687 dnl Test for the presence of Ant and that it works
11688 dnl ===================================================================
11690 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11691     ANT_HOME=; export ANT_HOME
11692     WITH_ANT_HOME=; export WITH_ANT_HOME
11693     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11694         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11695             if test "$_os" = "WINNT"; then
11696                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11697             else
11698                 with_ant_home="$LODE_HOME/opt/ant"
11699             fi
11700         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11701             with_ant_home="$LODE_HOME/opt/ant"
11702         fi
11703     fi
11704     if test -z "$with_ant_home"; then
11705         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd])
11706     else
11707         if test "$_os" = "WINNT"; then
11708             # AC_PATH_PROGS needs unix path
11709             with_ant_home=`cygpath -u "$with_ant_home"`
11710         fi
11711         AbsolutePath "$with_ant_home"
11712         with_ant_home=$absolute_path
11713         AC_PATH_PROGS(ANT, [jakarta-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11714         WITH_ANT_HOME=$with_ant_home
11715         ANT_HOME=$with_ant_home
11716     fi
11718     if test -z "$ANT"; then
11719         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11720     else
11721         # resolve relative or absolute symlink
11722         while test -h "$ANT"; do
11723             a_cwd=`pwd`
11724             a_basename=`basename "$ANT"`
11725             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11726             cd "`dirname "$ANT"`"
11727             cd "`dirname "$a_script"`"
11728             ANT="`pwd`"/"`basename "$a_script"`"
11729             cd "$a_cwd"
11730         done
11732         AC_MSG_CHECKING([if $ANT works])
11733         mkdir -p conftest.dir
11734         a_cwd=$(pwd)
11735         cd conftest.dir
11736         cat > conftest.java << EOF
11737         public class conftest {
11738             int testmethod(int a, int b) {
11739                     return a + b;
11740             }
11741         }
11744         cat > conftest.xml << EOF
11745         <project name="conftest" default="conftest">
11746         <target name="conftest">
11747             <javac srcdir="." includes="conftest.java">
11748             </javac>
11749         </target>
11750         </project>
11753         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11754         if test $? = 0 -a -f ./conftest.class; then
11755             AC_MSG_RESULT([Ant works])
11756             if test -z "$WITH_ANT_HOME"; then
11757                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11758                 if test -z "$ANT_HOME"; then
11759                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11760                 fi
11761             else
11762                 ANT_HOME="$WITH_ANT_HOME"
11763             fi
11764         else
11765             echo "configure: Ant test failed" >&5
11766             cat conftest.java >&5
11767             cat conftest.xml >&5
11768             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11769         fi
11770         cd "$a_cwd"
11771         rm -fr conftest.dir
11772     fi
11773     if test -z "$ANT_HOME"; then
11774         ANT_HOME="NO_ANT_HOME"
11775     else
11776         PathFormat "$ANT_HOME"
11777         ANT_HOME="$formatted_path"
11778         PathFormat "$ANT"
11779         ANT="$formatted_path"
11780     fi
11781     AC_SUBST(ANT_HOME)
11782     AC_SUBST(ANT)
11784     dnl Checking for ant.jar
11785     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11786         AC_MSG_CHECKING([Ant lib directory])
11787         if test -f $ANT_HOME/lib/ant.jar; then
11788             ANT_LIB="$ANT_HOME/lib"
11789         else
11790             if test -f $ANT_HOME/ant.jar; then
11791                 ANT_LIB="$ANT_HOME"
11792             else
11793                 if test -f /usr/share/java/ant.jar; then
11794                     ANT_LIB=/usr/share/java
11795                 else
11796                     if test -f /usr/share/ant-core/lib/ant.jar; then
11797                         ANT_LIB=/usr/share/ant-core/lib
11798                     else
11799                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11800                             ANT_LIB="$ANT_HOME/lib/ant"
11801                         else
11802                             if test -f /usr/share/lib/ant/ant.jar; then
11803                                 ANT_LIB=/usr/share/lib/ant
11804                             else
11805                                 AC_MSG_ERROR([Ant libraries not found!])
11806                             fi
11807                         fi
11808                     fi
11809                 fi
11810             fi
11811         fi
11812         PathFormat "$ANT_LIB"
11813         ANT_LIB="$formatted_path"
11814         AC_MSG_RESULT([Ant lib directory found.])
11815     fi
11816     AC_SUBST(ANT_LIB)
11818     ant_minver=1.6.0
11819     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11821     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11822     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11823     ant_version_major=`echo $ant_version | cut -d. -f1`
11824     ant_version_minor=`echo $ant_version | cut -d. -f2`
11825     echo "configure: ant_version $ant_version " >&5
11826     echo "configure: ant_version_major $ant_version_major " >&5
11827     echo "configure: ant_version_minor $ant_version_minor " >&5
11828     if test "$ant_version_major" -ge "2"; then
11829         AC_MSG_RESULT([yes, $ant_version])
11830     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11831         AC_MSG_RESULT([yes, $ant_version])
11832     else
11833         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11834     fi
11836     rm -f conftest* core core.* *.core
11839 OOO_JUNIT_JAR=
11840 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11841     AC_MSG_CHECKING([for JUnit 4])
11842     if test "$with_junit" = "yes"; then
11843         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
11844             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
11845         elif test -e /usr/share/java/junit4.jar; then
11846             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
11847         else
11848            if test -e /usr/share/lib/java/junit.jar; then
11849               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
11850            else
11851               OOO_JUNIT_JAR=/usr/share/java/junit.jar
11852            fi
11853         fi
11854     else
11855         OOO_JUNIT_JAR=$with_junit
11856     fi
11857     if test "$_os" = "WINNT"; then
11858         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
11859     fi
11860     printf 'import org.junit.Before;' > conftest.java
11861     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11862         AC_MSG_RESULT([$OOO_JUNIT_JAR])
11863     else
11864         AC_MSG_ERROR(
11865 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
11866  specify its pathname via --with-junit=..., or disable it via --without-junit])
11867     fi
11868     rm -f conftest.class conftest.java
11869     if test $OOO_JUNIT_JAR != ""; then
11870     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
11871     fi
11873 AC_SUBST(OOO_JUNIT_JAR)
11875 HAMCREST_JAR=
11876 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
11877     AC_MSG_CHECKING([for included Hamcrest])
11878     printf 'import org.hamcrest.BaseDescription;' > conftest.java
11879     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
11880         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
11881     else
11882         AC_MSG_RESULT([Not included])
11883         AC_MSG_CHECKING([for standalone hamcrest jar.])
11884         if test "$with_hamcrest" = "yes"; then
11885             if test -e /usr/share/lib/java/hamcrest.jar; then
11886                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
11887             elif test -e /usr/share/java/hamcrest/core.jar; then
11888                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
11889             else
11890                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
11891             fi
11892         else
11893             HAMCREST_JAR=$with_hamcrest
11894         fi
11895         if test "$_os" = "WINNT"; then
11896             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
11897         fi
11898         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
11899             AC_MSG_RESULT([$HAMCREST_JAR])
11900         else
11901             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),
11902                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
11903         fi
11904     fi
11905     rm -f conftest.class conftest.java
11907 AC_SUBST(HAMCREST_JAR)
11910 AC_SUBST(SCPDEFS)
11913 # check for wget and curl
11915 WGET=
11916 CURL=
11918 if test "$enable_fetch_external" != "no"; then
11920 CURL=`which curl 2>/dev/null`
11922 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
11923     # wget new enough?
11924     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
11925     if test $? -eq 0; then
11926         WGET=$i
11927         break
11928     fi
11929 done
11931 if test -z "$WGET" -a -z "$CURL"; then
11932     AC_MSG_ERROR([neither wget nor curl found!])
11937 AC_SUBST(WGET)
11938 AC_SUBST(CURL)
11941 # check for sha256sum
11943 SHA256SUM=
11945 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
11946     eval "$i -a 256 --version" > /dev/null 2>&1
11947     ret=$?
11948     if test $ret -eq 0; then
11949         SHA256SUM="$i -a 256"
11950         break
11951     fi
11952 done
11954 if test -z "$SHA256SUM"; then
11955     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
11956         eval "$i --version" > /dev/null 2>&1
11957         ret=$?
11958         if test $ret -eq 0; then
11959             SHA256SUM=$i
11960             break
11961         fi
11962     done
11965 if test -z "$SHA256SUM"; then
11966     AC_MSG_ERROR([no sha256sum found!])
11969 AC_SUBST(SHA256SUM)
11971 dnl ===================================================================
11972 dnl Dealing with l10n options
11973 dnl ===================================================================
11974 AC_MSG_CHECKING([which languages to be built])
11975 # get list of all languages
11976 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
11977 # the sed command does the following:
11978 #   + if a line ends with a backslash, append the next line to it
11979 #   + adds " on the beginning of the value (after =)
11980 #   + adds " at the end of the value
11981 #   + removes en-US; we want to put it on the beginning
11982 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
11983 [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)]
11984 ALL_LANGS="en-US $completelangiso"
11985 # check the configured localizations
11986 WITH_LANG="$with_lang"
11988 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
11989 # (Norwegian is "nb" and "nn".)
11990 if test "$WITH_LANG" = "no"; then
11991     WITH_LANG=
11994 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
11995     AC_MSG_RESULT([en-US])
11996 else
11997     AC_MSG_RESULT([$WITH_LANG])
11998     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
11999     if test -z "$MSGFMT"; then
12000         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12001             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12002         elif test -x "/opt/lo/bin/msgfmt"; then
12003             MSGFMT="/opt/lo/bin/msgfmt"
12004         else
12005             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12006             if test -z "$MSGFMT"; then
12007                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12008             fi
12009         fi
12010     fi
12011     if test -z "$MSGUNIQ"; then
12012         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12013             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12014         elif test -x "/opt/lo/bin/msguniq"; then
12015             MSGUNIQ="/opt/lo/bin/msguniq"
12016         else
12017             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12018             if test -z "$MSGUNIQ"; then
12019                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12020             fi
12021         fi
12022     fi
12024 AC_SUBST(MSGFMT)
12025 AC_SUBST(MSGUNIQ)
12026 # check that the list is valid
12027 for lang in $WITH_LANG; do
12028     test "$lang" = "ALL" && continue
12029     # need to check for the exact string, so add space before and after the list of all languages
12030     for vl in $ALL_LANGS; do
12031         if test "$vl" = "$lang"; then
12032            break
12033         fi
12034     done
12035     if test "$vl" != "$lang"; then
12036         # if you're reading this - you prolly quoted your languages remove the quotes ...
12037         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12038     fi
12039 done
12040 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12041     echo $WITH_LANG | grep -q en-US
12042     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12044 # list with substituted ALL
12045 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12046 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12047 test "$WITH_LANG" = "en-US" && WITH_LANG=
12048 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12049     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12050     ALL_LANGS=`echo $ALL_LANGS qtz`
12052 AC_SUBST(ALL_LANGS)
12053 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12054 AC_SUBST(WITH_LANG)
12055 AC_SUBST(WITH_LANG_LIST)
12056 AC_SUBST(GIT_NEEDED_SUBMODULES)
12058 WITH_POOR_HELP_LOCALIZATIONS=
12059 if test -d "$SRC_ROOT/translations/source"; then
12060     for l in `ls -1 $SRC_ROOT/translations/source`; do
12061         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12062             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12063         fi
12064     done
12066 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12068 if test -n "$with_locales"; then
12069     WITH_LOCALES="$with_locales"
12071     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12072     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12073     # config_host/config_locales.h.in
12074     for locale in $WITH_LOCALES; do
12075         lang=${locale%_*}
12077         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12079         case $lang in
12080         hi|mr*ne)
12081             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12082             ;;
12083         bg|ru)
12084             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12085             ;;
12086         esac
12087     done
12088 else
12089     AC_DEFINE(WITH_LOCALE_ALL)
12091 AC_SUBST(WITH_LOCALES)
12093 dnl git submodule update --reference
12094 dnl ===================================================================
12095 if test -n "${GIT_REFERENCE_SRC}"; then
12096     for repo in ${GIT_NEEDED_SUBMODULES}; do
12097         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12098             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12099         fi
12100     done
12102 AC_SUBST(GIT_REFERENCE_SRC)
12104 dnl git submodules linked dirs
12105 dnl ===================================================================
12106 if test -n "${GIT_LINK_SRC}"; then
12107     for repo in ${GIT_NEEDED_SUBMODULES}; do
12108         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12109             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12110         fi
12111     done
12113 AC_SUBST(GIT_LINK_SRC)
12115 dnl branding
12116 dnl ===================================================================
12117 AC_MSG_CHECKING([for alternative branding images directory])
12118 # initialize mapped arrays
12119 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12120 brand_files="$BRAND_INTRO_IMAGES about.svg"
12122 if test -z "$with_branding" -o "$with_branding" = "no"; then
12123     AC_MSG_RESULT([none])
12124     DEFAULT_BRAND_IMAGES="$brand_files"
12125 else
12126     if ! test -d $with_branding ; then
12127         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12128     else
12129         AC_MSG_RESULT([$with_branding])
12130         CUSTOM_BRAND_DIR="$with_branding"
12131         for lfile in $brand_files
12132         do
12133             if ! test -f $with_branding/$lfile ; then
12134                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12135                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12136             else
12137                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12138             fi
12139         done
12140         check_for_progress="yes"
12141     fi
12143 AC_SUBST([BRAND_INTRO_IMAGES])
12144 AC_SUBST([CUSTOM_BRAND_DIR])
12145 AC_SUBST([CUSTOM_BRAND_IMAGES])
12146 AC_SUBST([DEFAULT_BRAND_IMAGES])
12149 AC_MSG_CHECKING([for 'intro' progress settings])
12150 PROGRESSBARCOLOR=
12151 PROGRESSSIZE=
12152 PROGRESSPOSITION=
12153 PROGRESSFRAMECOLOR=
12154 PROGRESSTEXTCOLOR=
12155 PROGRESSTEXTBASELINE=
12157 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12158     source "$with_branding/progress.conf"
12159     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12160 else
12161     AC_MSG_RESULT([none])
12164 AC_SUBST(PROGRESSBARCOLOR)
12165 AC_SUBST(PROGRESSSIZE)
12166 AC_SUBST(PROGRESSPOSITION)
12167 AC_SUBST(PROGRESSFRAMECOLOR)
12168 AC_SUBST(PROGRESSTEXTCOLOR)
12169 AC_SUBST(PROGRESSTEXTBASELINE)
12172 AC_MSG_CHECKING([for extra build ID])
12173 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12174     EXTRA_BUILDID="$with_extra_buildid"
12176 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12177 if test -n "$EXTRA_BUILDID" ; then
12178     AC_MSG_RESULT([$EXTRA_BUILDID])
12179 else
12180     AC_MSG_RESULT([not set])
12182 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12184 OOO_VENDOR=
12185 AC_MSG_CHECKING([for vendor])
12186 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12187     OOO_VENDOR="$USERNAME"
12189     if test -z "$OOO_VENDOR"; then
12190         OOO_VENDOR="$USER"
12191     fi
12193     if test -z "$OOO_VENDOR"; then
12194         OOO_VENDOR="`id -u -n`"
12195     fi
12197     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12198 else
12199     OOO_VENDOR="$with_vendor"
12200     AC_MSG_RESULT([$OOO_VENDOR])
12202 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12203 AC_SUBST(OOO_VENDOR)
12205 if test "$_os" = "Android" ; then
12206     ANDROID_PACKAGE_NAME=
12207     AC_MSG_CHECKING([for Android package name])
12208     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12209         if test -n "$ENABLE_DEBUG"; then
12210             # Default to the package name that makes ndk-gdb happy.
12211             ANDROID_PACKAGE_NAME="org.libreoffice"
12212         else
12213             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12214         fi
12216         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12217     else
12218         ANDROID_PACKAGE_NAME="$with_android_package_name"
12219         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12220     fi
12221     AC_SUBST(ANDROID_PACKAGE_NAME)
12224 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12225 if test "$with_compat_oowrappers" = "yes"; then
12226     WITH_COMPAT_OOWRAPPERS=TRUE
12227     AC_MSG_RESULT(yes)
12228 else
12229     WITH_COMPAT_OOWRAPPERS=
12230     AC_MSG_RESULT(no)
12232 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12234 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12235 AC_MSG_CHECKING([for install dirname])
12236 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12237     INSTALLDIRNAME="$with_install_dirname"
12239 AC_MSG_RESULT([$INSTALLDIRNAME])
12240 AC_SUBST(INSTALLDIRNAME)
12242 AC_MSG_CHECKING([for prefix])
12243 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12244 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12245 PREFIXDIR="$prefix"
12246 AC_MSG_RESULT([$PREFIXDIR])
12247 AC_SUBST(PREFIXDIR)
12249 LIBDIR=[$(eval echo $(eval echo $libdir))]
12250 AC_SUBST(LIBDIR)
12252 DATADIR=[$(eval echo $(eval echo $datadir))]
12253 AC_SUBST(DATADIR)
12255 MANDIR=[$(eval echo $(eval echo $mandir))]
12256 AC_SUBST(MANDIR)
12258 DOCDIR=[$(eval echo $(eval echo $docdir))]
12259 AC_SUBST(DOCDIR)
12261 BINDIR=[$(eval echo $(eval echo $bindir))]
12262 AC_SUBST(BINDIR)
12264 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12265 AC_SUBST(INSTALLDIR)
12267 TESTINSTALLDIR="${BUILDDIR}/test-install"
12268 AC_SUBST(TESTINSTALLDIR)
12271 # ===================================================================
12272 # OAuth2 id and secrets
12273 # ===================================================================
12275 AC_MSG_CHECKING([for Google Drive client id and secret])
12276 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12277     AC_MSG_RESULT([not set])
12278     GDRIVE_CLIENT_ID="\"\""
12279     GDRIVE_CLIENT_SECRET="\"\""
12280 else
12281     AC_MSG_RESULT([set])
12282     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12283     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12285 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12286 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12288 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12289 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12290     AC_MSG_RESULT([not set])
12291     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12292     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12293 else
12294     AC_MSG_RESULT([set])
12295     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12296     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12298 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12299 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12301 AC_MSG_CHECKING([for OneDrive client id and secret])
12302 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12303     AC_MSG_RESULT([not set])
12304     ONEDRIVE_CLIENT_ID="\"\""
12305     ONEDRIVE_CLIENT_SECRET="\"\""
12306 else
12307     AC_MSG_RESULT([set])
12308     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12309     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12311 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12312 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12315 dnl ===================================================================
12316 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12317 dnl --enable-dependency-tracking configure option
12318 dnl ===================================================================
12319 AC_MSG_CHECKING([whether to enable dependency tracking])
12320 if test "$enable_dependency_tracking" = "no"; then
12321     nodep=TRUE
12322     AC_MSG_RESULT([no])
12323 else
12324     AC_MSG_RESULT([yes])
12326 AC_SUBST(nodep)
12328 dnl ===================================================================
12329 dnl Number of CPUs to use during the build
12330 dnl ===================================================================
12331 AC_MSG_CHECKING([for number of processors to use])
12332 # plain --with-parallelism is just the default
12333 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12334     if test "$with_parallelism" = "no"; then
12335         PARALLELISM=0
12336     else
12337         PARALLELISM=$with_parallelism
12338     fi
12339 else
12340     if test "$enable_icecream" = "yes"; then
12341         PARALLELISM="10"
12342     else
12343         case `uname -s` in
12345         Darwin|FreeBSD|NetBSD|OpenBSD)
12346             PARALLELISM=`sysctl -n hw.ncpu`
12347             ;;
12349         Linux)
12350             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12351         ;;
12352         # what else than above does profit here *and* has /proc?
12353         *)
12354             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12355             ;;
12356         esac
12358         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12359         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12360     fi
12363 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12364     if test -z "$with_parallelism"; then
12365             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12366             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12367             PARALLELISM="1"
12368     else
12369         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."
12370     fi
12373 if test $PARALLELISM -eq 0; then
12374     AC_MSG_RESULT([explicit make -j option needed])
12375 else
12376     AC_MSG_RESULT([$PARALLELISM])
12378 AC_SUBST(PARALLELISM)
12380 IWYU_PATH="$with_iwyu"
12381 AC_SUBST(IWYU_PATH)
12382 if test ! -z "$IWYU_PATH"; then
12383     if test ! -f "$IWYU_PATH"; then
12384         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12385     fi
12389 # Set up ILIB for MSVC build
12391 ILIB1=
12392 if test "$build_os" = "cygwin"; then
12393     ILIB="."
12394     if test -n "$JAVA_HOME"; then
12395         ILIB="$ILIB;$JAVA_HOME/lib"
12396     fi
12397     ILIB1=-link
12398     if test "$BITNESS_OVERRIDE" = 64; then
12399         ILIB="$ILIB;$COMPATH/lib/x64"
12400         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12401         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12402         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12403         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12404             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12405             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12406         fi
12407         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12408         ucrtlibpath_formatted=$formatted_path
12409         ILIB="$ILIB;$ucrtlibpath_formatted"
12410         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12411     else
12412         ILIB="$ILIB;$COMPATH/lib/x86"
12413         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12414         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12415         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12416         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12417             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12418             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12419         fi
12420         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12421         ucrtlibpath_formatted=$formatted_path
12422         ILIB="$ILIB;$ucrtlibpath_formatted"
12423         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12424     fi
12425     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12426         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12427     else
12428         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12429     fi
12431     AC_SUBST(ILIB)
12434 dnl We should be able to drop the below check when bumping the GCC baseline to
12435 dnl 4.9, as <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54577>
12436 dnl "deque<T>::erase() still takes iterator instead of const_iterator" should be
12437 dnl fixed there with <https://gcc.gnu.org/git/?p=gcc.git;a=commit;
12438 dnl h=6b0e18ca48bb4b4c01e7b5be2b98849943fdcf91>:
12439 AC_MSG_CHECKING(
12440     [whether C++11 use of const_iterator in standard containers is broken])
12441 save_CXXFLAGS=$CXXFLAGS
12442 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12443 AC_LANG_PUSH([C++])
12444 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
12445     #include <list>
12446     ]],[[
12447         std::list<int> l;
12448         l.erase(l.cbegin());
12449     ]])],
12450     [broken=no], [broken=yes])
12451 AC_LANG_POP([C++])
12452 CXXFLAGS=$save_CXXFLAGS
12453 AC_MSG_RESULT([$broken])
12454 if test "$broken" = yes; then
12455     AC_DEFINE([HAVE_BROKEN_CONST_ITERATORS])
12459 AC_MSG_CHECKING([whether $CXX has broken static initializer_list support])
12460 save_CXXFLAGS=$CXXFLAGS
12461 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
12462 save_LIBS=$LIBS
12463 if test -n "$ILIB1"; then
12464     LIBS="$LIBS $ILIB1"
12466 AC_LANG_PUSH([C++])
12467 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
12468     // Exit with failure if the static initializer_list is stored on the
12469     // stack (as done by Clang < 3.4):
12470     #include <initializer_list>
12471     struct S {};
12472     bool g(void const * p1, void const * p2) {
12473         int n;
12474         return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n));
12475     }
12476     bool f(void const * p1) {
12477         static std::initializer_list<S> s { S() };
12478         return g(p1, s.begin());
12479     }
12480     ]],[[
12481         int n;
12482         return f(&n) ? 0 : 1;
12483     ]])], [broken=no], [broken=yes],[broken='assuming not (cross-compiling)'])
12484 AC_LANG_POP([C++])
12485 LIBS=$save_LIBS
12486 CXXFLAGS=$save_CXXFLAGS
12487 AC_MSG_RESULT([$broken])
12488 if test "$broken" = yes -a "$_os" != "iOS"; then
12489     AC_MSG_ERROR([working support for static initializer_list needed])
12493 # ===================================================================
12494 # Creating bigger shared library to link against
12495 # ===================================================================
12496 AC_MSG_CHECKING([whether to create huge library])
12497 MERGELIBS=
12499 if test $_os = iOS -o $_os = Android; then
12500     # Never any point in mergelibs for these as we build just static
12501     # libraries anyway...
12502     enable_mergelibs=no
12505 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12506     if test $_os != Linux -a $_os != WINNT; then
12507         add_warning "--enable-mergelibs is not tested for this platform"
12508     fi
12509     MERGELIBS="TRUE"
12510     AC_MSG_RESULT([yes])
12511 else
12512     AC_MSG_RESULT([no])
12514 AC_SUBST([MERGELIBS])
12516 dnl ===================================================================
12517 dnl icerun is a wrapper that stops us spawning tens of processes
12518 dnl locally - for tools that can't be executed on the compile cluster
12519 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12520 dnl ===================================================================
12521 AC_MSG_CHECKING([whether to use icerun wrapper])
12522 ICECREAM_RUN=
12523 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12524     ICECREAM_RUN=icerun
12525     AC_MSG_RESULT([yes])
12526 else
12527     AC_MSG_RESULT([no])
12529 AC_SUBST(ICECREAM_RUN)
12531 dnl ===================================================================
12532 dnl Setup the ICECC_VERSION for the build the same way it was set for
12533 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12534 dnl ===================================================================
12535 x_ICECC_VERSION=[\#]
12536 if test -n "$ICECC_VERSION" ; then
12537     x_ICECC_VERSION=
12539 AC_SUBST(x_ICECC_VERSION)
12540 AC_SUBST(ICECC_VERSION)
12542 dnl ===================================================================
12544 AC_MSG_CHECKING([MPL subset])
12545 MPL_SUBSET=
12547 if test "$enable_mpl_subset" = "yes"; then
12548     warn_report=false
12549     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12550         warn_report=true
12551     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12552         warn_report=true
12553     fi
12554     if test "$warn_report" = "true"; then
12555         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12556     fi
12557     if test "x$enable_postgresql_sdbc" != "xno"; then
12558         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12559     fi
12560     if test "$enable_lotuswordpro" = "yes"; then
12561         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12562     fi
12563     if test "$WITH_WEBDAV" = "neon"; then
12564         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12565     fi
12566     if test -n "$ENABLE_PDFIMPORT"; then
12567         if test "x$SYSTEM_POPPLER" = "x"; then
12568             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12569         fi
12570     fi
12571     # cf. m4/libo_check_extension.m4
12572     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12573         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12574     fi
12575     for theme in $WITH_THEMES; do
12576         case $theme in
12577         breeze|breeze_dark|sifr|sifr_dark|elementary|karasa_jaga) #blacklist of icon themes under GPL or LGPL
12578             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12579         *) : ;;
12580         esac
12581     done
12583     ENABLE_OPENGL_TRANSITIONS=
12585     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12586         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12587     fi
12589     MPL_SUBSET="TRUE"
12590     AC_DEFINE(MPL_HAVE_SUBSET)
12591     AC_MSG_RESULT([only])
12592 else
12593     AC_MSG_RESULT([no restrictions])
12595 AC_SUBST(MPL_SUBSET)
12597 dnl ===================================================================
12599 AC_MSG_CHECKING([formula logger])
12600 ENABLE_FORMULA_LOGGER=
12602 if test "x$enable_formula_logger" = "xyes"; then
12603     AC_MSG_RESULT([yes])
12604     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12605     ENABLE_FORMULA_LOGGER=TRUE
12606 elif test -n "$ENABLE_DBGUTIL" ; then
12607     AC_MSG_RESULT([yes])
12608     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12609     ENABLE_FORMULA_LOGGER=TRUE
12610 else
12611     AC_MSG_RESULT([no])
12614 AC_SUBST(ENABLE_FORMULA_LOGGER)
12616 dnl ===================================================================
12617 dnl Setting up the environment.
12618 dnl ===================================================================
12619 AC_MSG_NOTICE([setting up the build environment variables...])
12621 AC_SUBST(COMPATH)
12623 if test "$build_os" = "cygwin"; then
12624     if test -d "$COMPATH/atlmfc/lib"; then
12625         ATL_LIB="$COMPATH/atlmfc/lib"
12626         ATL_INCLUDE="$COMPATH/atlmfc/include"
12627     else
12628         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12629         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12630     fi
12631     if test "$BITNESS_OVERRIDE" = 64; then
12632         if test $VCVER = "150"; then
12633             ATL_LIB="$ATL_LIB/x64"
12634         else
12635             ATL_LIB="$ATL_LIB/amd64"
12636         fi
12637     else
12638         if test $VCVER = "150"; then
12639             ATL_LIB="$ATL_LIB/x86"
12640         fi
12641     fi
12642     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12643     PathFormat "/usr/bin/find.exe"
12644     FIND="$formatted_path"
12645     PathFormat "/usr/bin/sort.exe"
12646     SORT="$formatted_path"
12647     PathFormat "/usr/bin/grep.exe"
12648     WIN_GREP="$formatted_path"
12649     PathFormat "/usr/bin/ls.exe"
12650     WIN_LS="$formatted_path"
12651     PathFormat "/usr/bin/touch.exe"
12652     WIN_TOUCH="$formatted_path"
12653 else
12654     FIND=find
12655     SORT=sort
12658 AC_SUBST(ATL_INCLUDE)
12659 AC_SUBST(ATL_LIB)
12660 AC_SUBST(FIND)
12661 AC_SUBST(SORT)
12662 AC_SUBST(WIN_GREP)
12663 AC_SUBST(WIN_LS)
12664 AC_SUBST(WIN_TOUCH)
12666 AC_SUBST(BUILD_TYPE)
12668 AC_SUBST(SOLARINC)
12670 PathFormat "$PERL"
12671 PERL="$formatted_path"
12672 AC_SUBST(PERL)
12674 if test -n "$TMPDIR"; then
12675     TEMP_DIRECTORY="$TMPDIR"
12676 else
12677     TEMP_DIRECTORY="/tmp"
12679 if test "$build_os" = "cygwin"; then
12680     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12682 AC_SUBST(TEMP_DIRECTORY)
12684 # setup the PATH for the environment
12685 if test -n "$LO_PATH_FOR_BUILD"; then
12686     LO_PATH="$LO_PATH_FOR_BUILD"
12687 else
12688     LO_PATH="$PATH"
12690     case "$host_os" in
12692     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12693         if test "$ENABLE_JAVA" != ""; then
12694             pathmunge "$JAVA_HOME/bin" "after"
12695         fi
12696         ;;
12698     cygwin*)
12699         # Win32 make needs native paths
12700         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12701             LO_PATH=`cygpath -p -m "$PATH"`
12702         fi
12703         if test "$BITNESS_OVERRIDE" = 64; then
12704             # needed for msi packaging
12705             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12706         fi
12707         # .NET 4.6 and higher don't have bin directory
12708         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12709             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12710         fi
12711         pathmunge "$ASM_HOME" "before"
12712         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12713         pathmunge "$CSC_PATH" "before"
12714         pathmunge "$MIDL_PATH" "before"
12715         pathmunge "$AL_PATH" "before"
12716         pathmunge "$MSPDB_PATH" "before"
12717         if test -n "$MSBUILD_PATH" ; then
12718             pathmunge "$MSBUILD_PATH" "before"
12719         fi
12720         if test "$BITNESS_OVERRIDE" = 64; then
12721             pathmunge "$COMPATH/bin/amd64" "before"
12722             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12723         else
12724             pathmunge "$COMPATH/bin" "before"
12725             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12726         fi
12727         if test "$ENABLE_JAVA" != ""; then
12728             if test -d "$JAVA_HOME/jre/bin/client"; then
12729                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12730             fi
12731             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12732                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12733             fi
12734             pathmunge "$JAVA_HOME/bin" "before"
12735         fi
12736         ;;
12738     solaris*)
12739         pathmunge "/usr/css/bin" "before"
12740         if test "$ENABLE_JAVA" != ""; then
12741             pathmunge "$JAVA_HOME/bin" "after"
12742         fi
12743         ;;
12744     esac
12747 AC_SUBST(LO_PATH)
12749 libo_FUZZ_SUMMARY
12751 # Generate a configuration sha256 we can use for deps
12752 if test -f config_host.mk; then
12753     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12755 if test -f config_host_lang.mk; then
12756     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12759 CFLAGS=$my_original_CFLAGS
12760 CXXFLAGS=$my_original_CXXFLAGS
12761 CPPFLAGS=$my_original_CPPFLAGS
12763 AC_CONFIG_FILES([config_host.mk
12764                  config_host_lang.mk
12765                  Makefile
12766                  lo.xcent
12767                  bin/bffvalidator.sh
12768                  bin/odfvalidator.sh
12769                  bin/officeotron.sh
12770                  instsetoo_native/util/openoffice.lst
12771                  sysui/desktop/macosx/Info.plist])
12772 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12773 AC_CONFIG_HEADERS([config_host/config_clang.h])
12774 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12775 AC_CONFIG_HEADERS([config_host/config_eot.h])
12776 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12777 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12778 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12779 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12780 AC_CONFIG_HEADERS([config_host/config_features.h])
12781 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12782 AC_CONFIG_HEADERS([config_host/config_folders.h])
12783 AC_CONFIG_HEADERS([config_host/config_gio.h])
12784 AC_CONFIG_HEADERS([config_host/config_global.h])
12785 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12786 AC_CONFIG_HEADERS([config_host/config_java.h])
12787 AC_CONFIG_HEADERS([config_host/config_langs.h])
12788 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12789 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12790 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12791 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12792 AC_CONFIG_HEADERS([config_host/config_locales.h])
12793 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12794 AC_CONFIG_HEADERS([config_host/config_kde4.h])
12795 AC_CONFIG_HEADERS([config_host/config_qt5.h])
12796 AC_CONFIG_HEADERS([config_host/config_kde5.h])
12797 AC_CONFIG_HEADERS([config_host/config_gtk3_kde5.h])
12798 AC_CONFIG_HEADERS([config_host/config_oox.h])
12799 AC_CONFIG_HEADERS([config_host/config_options.h])
12800 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12801 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12802 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12803 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12804 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12805 AC_CONFIG_HEADERS([config_host/config_version.h])
12806 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12807 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12808 AC_CONFIG_HEADERS([config_host/config_python.h])
12809 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12810 AC_OUTPUT
12812 if test "$CROSS_COMPILING" = TRUE; then
12813     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12816 # touch the config timestamp file
12817 if test ! -f config_host.mk.stamp; then
12818     echo > config_host.mk.stamp
12819 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12820     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12821 else
12822     echo > config_host.mk.stamp
12825 # touch the config lang timestamp file
12826 if test ! -f config_host_lang.mk.stamp; then
12827     echo > config_host_lang.mk.stamp
12828 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12829     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12830 else
12831     echo > config_host_lang.mk.stamp
12835 if test "$STALE_MAKE" = "TRUE" -a "$build_os" = "cygwin"; then
12837 cat << _EOS
12838 ****************************************************************************
12839 WARNING:
12840 Your make version is known to be horribly slow, and hard to debug
12841 problems with. To get a reasonably functional make please do:
12843 to install a pre-compiled binary make for Win32
12845  mkdir -p /opt/lo/bin
12846  cd /opt/lo/bin
12847  wget https://dev-www.libreoffice.org/bin/cygwin/make-85047eb-msvc.exe
12848  cp make-85047eb-msvc.exe make
12849  chmod +x make
12851 to install from source:
12852 place yourself in a working directory of you choice.
12854  git clone git://git.savannah.gnu.org/make.git
12856  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12857  set PATH=%PATH%;C:\Cygwin\bin
12858  [or Cygwin64, if that is what you have]
12859  cd path-to-make-repo-you-cloned-above
12860  build_w32.bat --without-guile
12862 should result in a WinRel/gnumake.exe.
12863 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12865 Then re-run autogen.sh
12867 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12868 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12870 _EOS
12873 cat << _EOF
12874 ****************************************************************************
12876 To build, run:
12877 $GNUMAKE
12879 To view some help, run:
12880 $GNUMAKE help
12882 _EOF
12884 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12885     cat << _EOF
12886 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12887 _EOF
12889     if test $_os = Darwin; then
12890         echo open instdir/$PRODUCTNAME.app
12891     else
12892         echo instdir/program/soffice
12893     fi
12894     cat << _EOF
12896 If you want to run the smoketest, run:
12897 $GNUMAKE check
12899 _EOF
12902 if test -f warn; then
12903     cat warn
12904     rm warn
12907 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: